{"version":3,"file":"chunk-ot1ql0eq.js","sources":["packages/vanilla/lib/features/header/src/header-item-base.ts","packages/global-search/productstub-lib/src/events.ts","packages/global-search/productstub-lib/src/entrypoints/header-leftmenu-entry.component.html","packages/global-search/productstub-lib/src/entrypoints/header-leftmenu-entry.component.ts","packages/casino/platform-lib/src/lib/casino-core-lazy-placeholder/casino-core-lazy-routes.ts","packages/casino/platform-lib/src/lib/casino-core-lazy-placeholder/casino-core-lazy-route.service.ts","packages/casino/platform-lib/src/lib/casino-core-lazy-placeholder/casino-core-lazy-placeholder.component.ts","packages/casino/platform-lib/src/lib/casino-core-lazy-placeholder/casino-core-lazy-placeholder.component.html","node_modules/ng-in-viewport/fesm2022/ng-in-viewport.mjs","node_modules/@rx-angular/cdk/fesm2022/cdk-internals-scheduler.mjs","node_modules/@rx-angular/cdk/fesm2022/cdk-coercing.mjs","node_modules/@rx-angular/cdk/fesm2022/cdk-render-strategies.mjs","node_modules/@rx-angular/cdk/fesm2022/cdk-notifications.mjs","node_modules/@rx-angular/cdk/fesm2022/cdk-template.mjs","node_modules/@rx-angular/template/fesm2022/template-let.mjs","node_modules/@angular/material/fesm2022/grid-list.mjs","node_modules/ng-circle-progress/fesm2020/ng-circle-progress.mjs","packages/casino/ui-lib/src/chevron/chevron.component.html","packages/casino/ui-lib/src/chevron/chevron.component.ts","packages/casino/ui-lib/src/cta/cs-cta/cs-cta.component.ts","packages/casino/ui-lib/src/cta/gametile-cta/gametile-cta.component.html","packages/casino/ui-lib/src/cta/gametile-cta/gametile-cta.component.ts","packages/casino/ui-lib/src/icons/class-icon/class-icon.component.ts","packages/casino/ui-lib/src/cta/rp-fav-cta/rp-fav-cta-legacy.component.ts","packages/casino/ui-lib/src/cta/rp-fav-cta/rp-fav-cta-legacy.component.html","packages/casino/ui-lib/src/cta/rp-fav-cta/rp-fav-cta.component.html","packages/casino/ui-lib/src/cta/rp-fav-cta/rp-fav-cta.component.ts","packages/casino/ui-lib/src/icons/image-icon/image-icon.component.ts","packages/casino/ui-lib/src/cta/slot-race-widget/slotrace-cta.component.html","packages/casino/ui-lib/src/cta/slot-race-widget/slotrace-cta.component.ts","packages/casino/ui-lib/src/utils/class-decoration/decorator-class.directive.ts","node_modules/hammerjs/hammer.js","packages/vanilla/lib/features/gamification/src/gamification.service.ts","packages/vanilla/lib/features/gamification/src/gamification-bootstrap.service.ts","packages/vanilla/lib/features/gamification/src/gamification-dsl-values-provider.ts","packages/vanilla/lib/features/gamification/src/gamification.feature.ts","packages/vanilla/lib/features/message-panel/src/message-panel-registry.service.ts","packages/vanilla/lib/features/message-panel/src/message-panel.html","packages/vanilla/lib/features/message-panel/src/message-panel.component.ts","node_modules/@angular/forms/fesm2022/forms.mjs","packages/vanilla/lib/shared/current-session/src/current-session.client-config.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties.client-config.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties.service.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties-bootstrap.service.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties-dsl-values-provider.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties.feature.ts","packages/vanilla/lib/features/balance-properties/src/balance-properties.models.ts","packages/vanilla/lib/features/popper/src/popper-content.html","packages/vanilla/lib/features/popper/src/popper-content.component.ts","packages/vanilla/lib/shared/browser/src/trust-as-html.pipe.ts","packages/vanilla/lib/shared/browser/src/format.pipe.ts","packages/vanilla/lib/shared/browser/src/html-attrs.directive.ts","packages/vanilla/lib/shared/browser/src/trust-as-resource-url.pipe.ts","packages/vanilla/lib/shared/browser/src/iframe.component.ts","node_modules/@rx-angular/state/fesm2022/state-effects.mjs","packages/casino/platform-lib/core/client-config/abtesting-config.ts","packages/casino/platform-lib/core/client-config/advance-game-data.config.ts","packages/casino/platform-lib/core/client-config/api-paths.config.ts","packages/casino/platform-lib/core/client-config/arcadelobby-config.ts","packages/casino/platform-lib/core/client-config/betmgmoriginals-config.ts","packages/casino/platform-lib/core/client-config/casino-config.config.ts","packages/casino/platform-lib/core/client-config/casino-overlay.config.ts","packages/casino/platform-lib/core/client-config/clientside-config.ts","packages/casino/platform-lib/core/client-config/common.config.ts","packages/casino/platform-lib/core/client-config/cozy-bingo.config.ts","packages/casino/platform-lib/core/client-config/dev-settings.config.ts","packages/casino/platform-lib/core/client-config/discover-feed.config.ts","packages/casino/platform-lib/core/client-config/download-app-from-device.config.ts","packages/casino/platform-lib/core/client-config/features.config.ts","packages/casino/platform-lib/core/client-config/feed-cache.config.ts","packages/casino/platform-lib/core/client-config/freespins.config.ts","packages/casino/platform-lib/core/client-config/game-launch-tracking.config.ts","packages/casino/platform-lib/core/client-config/game-premiere.config.ts","packages/casino/platform-lib/core/client-config/game-selector-widget.config.ts","packages/casino/platform-lib/core/client-config/game-show-hub.config.ts","packages/casino/platform-lib/core/client-config/game.config.ts","packages/casino/platform-lib/core/client-config/gameimpressions-config.ts","packages/casino/platform-lib/core/client-config/gamification-widget-config.ts","packages/casino/platform-lib/core/client-config/gaming-stories-config.ts","packages/casino/platform-lib/core/client-config/geo-location.config.ts","packages/casino/platform-lib/core/client-config/global-jackpot.config.ts","packages/casino/platform-lib/core/client-config/global-search.config.ts","packages/casino/platform-lib/core/client-config/global.config.ts","packages/casino/platform-lib/core/client-config/header-teaser.config.ts","packages/casino/platform-lib/core/client-config/image-load-optimization.config.ts","packages/casino/platform-lib/core/client-config/immersive-lobby.config.ts","packages/casino/platform-lib/core/client-config/jackpot-data.config.ts","packages/casino/platform-lib/core/client-config/live-casino-lounge.config.ts","packages/casino/platform-lib/core/client-config/live-dealer.config.ts","packages/casino/platform-lib/core/client-config/livecasino-config.ts","packages/casino/platform-lib/core/client-config/lmt-data.config.ts","packages/casino/platform-lib/core/client-config/mc-page.config.ts","packages/casino/platform-lib/core/client-config/minbetgames-config.ts","packages/casino/platform-lib/core/client-config/modular-bingo.config.ts","packages/casino/platform-lib/core/client-config/modular-settings.config.ts","packages/casino/platform-lib/core/client-config/native-game-launch.config.ts","packages/casino/platform-lib/core/client-config/news-feed.config.ts","packages/casino/platform-lib/core/client-config/noncritical-config.ts","packages/casino/platform-lib/core/client-config/optimized-teaser.config.ts","packages/casino/platform-lib/core/client-config/pre-login.config.ts","packages/casino/platform-lib/core/client-config/promo-coin-economy-config.ts","packages/casino/platform-lib/core/client-config/promo-offer-widget-config.ts","packages/casino/platform-lib/core/client-config/promoted-games.config.ts","packages/casino/platform-lib/core/client-config/promotions-info.config.ts","packages/casino/platform-lib/core/client-config/quick-info.config.ts","packages/casino/platform-lib/core/client-config/recentlyplayed-games.config.ts","packages/casino/platform-lib/core/client-config/search.config.ts","packages/casino/platform-lib/core/client-config/slot-races.config.ts","packages/casino/platform-lib/core/client-config/smart-lobby.config.ts","packages/casino/platform-lib/core/client-config/sub-nav.config.ts","packages/casino/platform-lib/core/client-config/thumbnailconfig.ts","packages/casino/platform-lib/core/client-config/video-preview.config.ts","packages/casino/platform-lib/core/client-config/widget.config.ts","packages/casino/platform-lib/core/client-config/casinoCore-client-config.module.ts","packages/casino/platform-lib/core/client-config/gaming-stories-phase2-config.ts","packages/casino/platform-lib/core/client-config/player-stats-config.ts","packages/casino/platform-lib/core/client-config/promotions-banner.config.ts","packages/casino/platform-lib/core/client-config/recent-winners-config.ts","packages/casino/platform-lib/core/client-config/super-button.config.ts","packages/casino/platform-lib/core/public-api.ts","packages/casino/platform-lib/core/cashier-iframe/cashier-iframe.component.ts","packages/casino/platform-lib/core/cashier-iframe/cashier-iframe.component.html","packages/casino/platform-lib/core/cashier-iframe/game-pop-out.component.ts","packages/casino/platform-lib/core/cashier-iframe/game-pop-out.component.html","packages/casino/platform-lib/core/casino-lobby-manager/casino-lobby.models.ts","packages/casino/platform-lib/utils/utils.ts","packages/casino/platform-lib/core/platform-api/platform-api.service.ts","node_modules/ng-lazyload-image/fesm2020/ng-lazyload-image.mjs","packages/casino/platform-lib/core/directives/intersection-observer/from-intersection-observer.ts","packages/casino/platform-lib/core/directives/intersection-observer/intersection-observer.directive.ts","packages/casino/platform-lib/core/shared/casino-core-npm-params.service.ts","packages/casino/platform-lib/core/utilities/url-utility.service.ts","packages/casino/platform-lib/core/image-loader/image-loader.component.html","packages/casino/platform-lib/core/image-loader/image-loader.component.ts","packages/casino/platform-lib/core/shared/invoker-product.service.ts","packages/casino/platform-lib/core/shared/casino-widget.service.ts","packages/casino/platform-lib/core/shared/models/home-lobby.model.ts","packages/casino/platform-lib/core/shared/nativeapi.service.ts","packages/casino/platform-lib/core/shared/casino-manager.service.ts","packages/casino/platform-lib/core/shared/const.service.ts","packages/casino/platform-lib/core/platform-api/platform-bingo-api.service.ts","packages/casino/platform-lib/core/shared/api-paths-helper-service.ts","packages/casino/platform-lib/core/shared/bingo-favorite-service.ts","packages/casino/platform-lib/core/shared/casino-iframe-overlay.service.ts","packages/casino/platform-lib/core/shared/casino-api.service.ts","packages/casino/platform-lib/core/shared/cozybingodata.service.ts","packages/casino/platform-lib/core/shared/favourite.service.ts","packages/casino/platform-lib/core/shared/gamelaunchfactory.service.ts","packages/casino/platform-lib/core/shared/jackpotdata-service.ts","packages/casino/platform-lib/core/shared/localstorage.expirable.persistence.service.ts","packages/casino/platform-lib/core/shared/models/gameDataFromCacheResponse.model.ts","packages/casino/platform-lib/core/shared/cache-manager.service.ts","packages/casino/platform-lib/core/shared/unfinished-games-service.ts","packages/casino/platform-lib/core/game-embed/game-embed.component.html","packages/casino/platform-lib/core/game-embed/game-embed.component.ts","packages/casino/platform-lib/core/search-desktop/lazy-search-desktop.component.ts","packages/casino/platform-lib/core/shared/models/advance-game-data.model.ts","packages/casino/platform-lib/core/shared/advance-game-data.service.ts","packages/casino/platform-lib/core/shared/cashier.service.ts","packages/casino/platform-lib/core/shared/fast-loading-games.service.ts","packages/casino/platform-lib/core/shared/freespins-summary.service.ts","packages/casino/platform-lib/core/shared/models/game-lobby.model.ts","packages/casino/platform-lib/core/shared/game-data-manager.service.ts","packages/casino/platform-lib/core/shared/game-launch-tracking.service.ts","packages/casino/platform-lib/core/shared/jackpot.service.ts","packages/casino/platform-lib/core/shared/models/gamelaunch.model.ts","packages/casino/platform-lib/core/shared/open-login-dialog-v6.ts","packages/casino/platform-lib/core/shared/recent-games.service.ts","packages/casino/platform-lib/core/slot-races/shared/slot-races.service.ts","packages/casino/platform-lib/core/embedded-game-view/embedded-game-view.component.html","packages/casino/platform-lib/core/embedded-game-view/embedded-game-view.component.ts","packages/casino/platform-lib/core/shared/teaser.service.ts","packages/casino/platform-lib/core/embedded-game-popup/embedded-game-popup.component.html","packages/casino/platform-lib/core/embedded-game-popup/embedded-game-popup.component.ts","packages/casino/platform-lib/core/directives/globaltranslate/globaltranslate.component.ts","packages/casino/platform-lib/core/header-box/header-box.component.html","packages/casino/platform-lib/core/header-box/header-box.component.ts","packages/casino/platform-lib/core/shared/game-launch-places.service.ts","packages/casino/platform-lib/core/game-detail/game-detail-buttons/game-detail-buttons.component.html","packages/casino/platform-lib/core/game-detail/game-detail-buttons/game-detail-buttons.component.ts","packages/casino/platform-lib/core/game-detail/game-detail.component.html","packages/casino/platform-lib/core/game-detail/game-detail.component.ts","packages/casino/platform-lib/core/geolocation/services/activator.service.ts","packages/casino/platform-lib/core/geolocation/services/coordinator.service.ts","packages/casino/platform-lib/core/geolocation/coordinator.models.ts","packages/casino/platform-lib/core/geolocation/geo-location-error/geo-location-error.html","packages/casino/platform-lib/core/geolocation/geo-location-error/geo-location-error.component.ts","packages/casino/platform-lib/core/geolocation/services/geolocation-validation.service.ts","packages/casino/platform-lib/core/shared/geolocation-tracking.service.ts","packages/casino/platform-lib/core/geolocation/installer/installer.component.html","packages/casino/platform-lib/core/geolocation/installer/installer.component.ts","packages/casino/platform-lib/core/geolocation/services/installer-dialog.service.ts","packages/casino/platform-lib/core/geolocation/services/geolocation-check.service.ts","packages/casino/platform-lib/core/shared/gamelaunch-url-formation.service.ts","packages/casino/platform-lib/core/shared/globalsearch-helper.service.ts","packages/casino/platform-lib/core/shared/live-dealer.service.ts","packages/casino/platform-lib/core/shared/monitor.service.ts","packages/casino/platform-lib/core/shared/nativeapphelper.service.ts","packages/casino/platform-lib/core/shared/navigator.service.ts","packages/casino/platform-lib/core/shared/search-section.service.ts","packages/casino/platform-lib/core/shared/vc-client.service.ts","packages/casino/platform-lib/core/shared/gamelaunch.service.ts","packages/casino/platform-lib/core/confirm-message/confirm-message.component.html","packages/casino/platform-lib/core/confirm-message/confirm-message.component.ts","packages/casino/platform-lib/core/directives/custom-carousel-pagination.component.ts","packages/casino/platform-lib/core/directives/long-press.directive.ts","packages/casino/platform-lib/core/directives/search-highlight-filter/search-highlight.filter.ts","packages/casino/platform-lib/core/gif-tag/gif-tag.component.html","packages/casino/platform-lib/core/gif-tag/gif-tag.component.ts","packages/casino/platform-lib/core/shared/time-zone.service.ts","packages/casino/platform-lib/core/lc-timer/lc-timer.component.html","packages/casino/platform-lib/core/lc-timer/lc-timer.component.ts","packages/casino/platform-lib/core/shared/arcade-lobby-tracking.service.ts","packages/casino/platform-lib/core/shared/betmgm-originals.service.ts","packages/casino/platform-lib/core/shared/bingo-vf-services/bingo-game-launch.service.ts","packages/casino/platform-lib/core/shared/category-manager.service.ts","packages/casino/platform-lib/core/shared/cozybingo-toast-message.service.ts","packages/casino/platform-lib/core/shared/discover-feed.service.ts","packages/casino/platform-lib/core/shared/ds-enabler.service.ts","packages/casino/platform-lib/core/shared/forceGameLaunchHandler.service.ts","packages/casino/platform-lib/core/shared/game-selector-widget.service.ts","packages/casino/platform-lib/core/shared/game.service.ts","packages/casino/platform-lib/core/shared/models/gaming-stories.model.ts","packages/casino/platform-lib/core/shared/gaming-stories.service.ts","packages/casino/platform-lib/core/shared/global-jackpot-mod.service.ts","packages/casino/platform-lib/core/shared/livecasino.service.ts","packages/casino/platform-lib/core/shared/models/game-selector-widget.model.ts","packages/casino/platform-lib/core/shared/new-quick-info.service.ts","packages/casino/platform-lib/core/shared/news-feed-v2.service.ts","packages/casino/platform-lib/core/shared/news-feed.service.ts","packages/casino/platform-lib/core/shared/optimizedTeaser-manager.service.ts","packages/casino/platform-lib/core/shared/other-product.service.ts","packages/casino/platform-lib/core/shared/pipes/currencyformat.pipe.ts","packages/casino/platform-lib/core/shared/pipes/currencySymbol.pipe.ts","packages/casino/platform-lib/core/shared/pipes/sitecore-image-resize.pipe.ts","packages/casino/platform-lib/core/shared/player-segmentation.service.ts","packages/casino/platform-lib/core/shared/player-stats.service.ts","packages/casino/platform-lib/core/shared/promoted-games.service.ts","packages/casino/platform-lib/core/shared/promotions-banner.service.ts","packages/casino/platform-lib/core/shared/quick-info-modal.service.ts","packages/casino/platform-lib/core/shared/recent-winners.service.ts","packages/casino/platform-lib/core/shared/sign-posting.service.ts","packages/casino/platform-lib/core/shared/smartBanner.service.ts","packages/casino/platform-lib/core/shared/super-button.service.ts","packages/casino/platform-lib/core/shared/thumbnail.service.ts","packages/casino/platform-lib/core/shared/timezone-format.pipe.ts","packages/casino/platform-lib/core/shared/utility.service.ts","packages/casino/platform-lib/core/shared/windowref.service.ts","packages/casino/platform-lib/core/slot-races/shared/slot-races-tracking.service.ts","packages/casino/platform-lib/core/slot-races/shared/slot-races.models.ts","packages/casino/platform-lib/core/config-provider/config-provider.service.ts","packages/casino/platform-lib/core/casino-lobby-manager/casino-lobby.service.ts","packages/casino/platform-lib/core/search-desktop/search-desktop.component.html","packages/casino/platform-lib/core/search-desktop/search-desktop.component.ts","packages/casino/platform-lib/src/lib/services/lib-mock.service.ts","packages/casino/platform-lib/src/lib/freespins-summary/freespins-quick-info/freespins-quick-info.component.html","packages/casino/platform-lib/src/lib/freespins-summary/freespins-quick-info/freespins-quick-info.component.ts","packages/casino/platform-lib/src/lib/freespins-summary/freespins-summary.component.html","packages/casino/platform-lib/src/lib/freespins-summary/freespins-summary.component.ts","packages/casino/platform-lib/src/lib/stickers-jackpot/stickers-jackpot.component.html","packages/casino/platform-lib/src/lib/stickers-jackpot/stickers-jackpot.component.ts","packages/casino/platform-lib/bingo-quick-info-model/bingo-quick-info-model.component.html","packages/casino/platform-lib/bingo-quick-info-model/bingo-quick-info-model.component.ts","packages/casino/platform-lib/src/lib/game-quick-info/game-quick-info.component.html","packages/casino/platform-lib/src/lib/game-quick-info/game-quick-info.component.ts","packages/casino/platform-lib/src/lib/services/quick-info.service.ts","packages/casino/platform-lib/src/lib/quick-info-modal/quick-info-modal.component.html","packages/casino/platform-lib/src/lib/quick-info-modal/quick-info-modal.component.ts","node_modules/@ngu/carousel/fesm2022/ngu-carousel.mjs","packages/casino/platform-lib/src/lib/gamelobby/gamelobby.component.html","packages/casino/platform-lib/src/lib/gamelobby/gamelobby.component.ts","packages/casino/platform-lib/src/lib/feature-grid/feature-grid.component.html","packages/casino/platform-lib/src/lib/feature-grid/feature-grid.component.ts","node_modules/@angular/material/fesm2022/bottom-sheet.mjs","node_modules/@angular/material/fesm2022/progress-bar.mjs","node_modules/swiper/shared/ssr-window.esm.mjs","node_modules/swiper/shared/utils.mjs","node_modules/swiper/shared/swiper-core.mjs","node_modules/swiper/modules/virtual.mjs","node_modules/swiper/modules/keyboard.mjs","node_modules/swiper/modules/mousewheel.mjs","node_modules/swiper/shared/create-element-if-not-defined.mjs","node_modules/swiper/modules/navigation.mjs","node_modules/swiper/shared/classes-to-selector.mjs","node_modules/swiper/modules/pagination.mjs","node_modules/swiper/modules/autoplay.mjs","node_modules/swiper/modules/free-mode.mjs","node_modules/swiper/shared/effect-init.mjs","node_modules/swiper/shared/effect-target.mjs","node_modules/swiper/shared/create-shadow.mjs","node_modules/swiper/modules/effect-coverflow.mjs","packages/vanilla/lib/shared/swiper/src/swiper.html","packages/vanilla/lib/shared/swiper/src/swiper.component.ts","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-free-spins/quick-info-free-spins.component.html","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-free-spins/quick-info-free-spins.component.ts","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-game-description/quick-info-game-description.component.html","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-game-description/quick-info-game-description.component.ts","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-more-info/quick-info-more-info.component.html","packages/casino/platform-lib/new-game-quick-info/nav-quick-info-more-info/quick-info-more-info.component.ts","packages/casino/platform-lib/new-game-quick-info/new-quick-info-modal/new-quick-info-modal.component.html","packages/casino/platform-lib/new-game-quick-info/new-quick-info-modal/new-quick-info-modal.component.ts","packages/casino/platform-lib/new-game-quick-info/new-game-quick-info.component.ts","packages/casino/platform-lib/new-game-quick-info/new-game-quick-info.module.ts","node_modules/@cloudflare/stream-angular/fesm2020/cloudflare-stream-angular.mjs"],"sourcesContent":["import { Directive, Input, inject } from '@angular/core';\n\nimport { MenuActionOrigin, MenuActionsService, MenuContentItem, MenuSection, Page, VanillaElements, trackByProp } from '@frontend/vanilla/core';\nimport { IconFastService } from '@frontend/vanilla/features/icons';\n\n/**\n * A base class for responsive header components registered with {@link HeaderService}.\n *\n * @stable\n */\n@Directive()\nexport abstract class HeaderItemBase {\n @Input() item: MenuContentItem;\n readonly trackByText = trackByProp('text');\n\n menuActionsService = inject(MenuActionsService);\n MenuSection = MenuSection;\n VanillaElements = VanillaElements;\n private pageConfig = inject(Page);\n get useFastIconType(): boolean {\n return this.pageConfig.htmlSourceTypeReplace ? IconFastService.isValueHere(this.pageConfig.htmlSourceTypeReplace, 'header') : false;\n }\n\n processClick(event: Event, item?: any) {\n this.menuActionsService.processClick(event, item || this.item, MenuActionOrigin.Header);\n }\n}\n","export const __SEARCH_ACCESSIBLE__ = 'gs:presentation:search:accessible';\nexport const __LAUNCH_SEARCH__ = 'gs:presentation:launchsearch';\nexport const __PRESENTATION_BOOTSTRAPPED__ = 'gs:presentation:bootstrapped';\nexport const __FETCH_CONTEXT__ = 'gs:search:service:context:fetch';\nexport const __CONTEXT__ = 'gs:search:service:context:result';\nexport const __TRACK__ = 'gs:search:tracking';\nexport const __USER_EVENT__ = 'gs:productstub:vnuserevent';\nexport const __ENTRY_POINT_ACTIVE__ = 'gs:productstub:entrypoint:active';\nexport const __READ_CLIENT_CONFIG__ = 'gs:productstub:clientconfig:read';\nexport const __CLIENT_CONFIG_UPDATE_AVAILABLE__ = 'gs:productstub:clientconfig:updateavailable';\nexport const SearchIndexLoadEvent = 'gs:searchindex:load';\nexport const __BOOTSTRAP_APP__ = 'gs:search:bootstrap:app';\n\nexport const ServiceTokenHeader = '--x-globalsearch-service-servicetoken';\nexport const TransportTokenHeader = '--x-globalsearch-security-transporttoken';\nexport const SearchAppEnablerQuery = '--globalsearch.app.isenabled';\nexport const SearchContextWrittenEventIdentifier = 'gs:searchContextWritten';\nexport const ReadSearchContextEventIdentifier = 'gs:readSearchContext';\nexport const SearchAppLoadingEventIdentifier = 'gs:searchAppLoading';\nexport const SearchAppLoadedEventIdentifier = 'gs:searchAppLoaded';\nexport const SearchServiceInitializingEventIdentifier = 'gs:searchServiceInitializing';\nexport const SearchServiceInitializedEventIdentifier = 'gs:searchServiceInitialized';\nexport const SearchServiceLoadingEventIdentifier = 'gs:searchServiceLoading';\nexport const SearchServiceLoadedEventIdentifier = 'gs:searchServiceLoaded';\nexport const SearchContextLoadingEventIdentifier = 'gs:searchContextLoading';\nexport const SearchContextLoadedEventIdentifier = 'gs:searchContextLoaded';\nexport const SearchAppQueryEventIdentifier = 'gs:query';\nexport const SearchAppQueryResultEventIdentifier = 'gs:queryresult';\n","\n","/* eslint-disable no-console */\nimport { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';\n\nimport { HeaderItemBase } from '@frontend/vanilla/features/header';\n\nimport { IGlobalSearchContext } from '../context/search';\nimport { __CONTEXT__, __ENTRY_POINT_ACTIVE__, __FETCH_CONTEXT__, __LAUNCH_SEARCH__, __PRESENTATION_BOOTSTRAPPED__ } from '../events';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'vn-h-global-search',\n templateUrl: 'header-leftmenu-entry.component.html',\n styleUrls: ['header-leftmenu-entry.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class HeaderLeftMenuEntryComponent extends HeaderItemBase implements OnInit, OnDestroy {\n isEnabled = false;\n searchContext: any;\n\n constructor() {\n // private readonly menuActionService: MenuActionsService // private readonly searchLauncherService: SearchLauncherService,\n super();\n // this.menuActionService = this.menuActionService; // Hack\n }\n\n private displayIcon = true;\n private desktopClassValue = 'theme-search-i tab-nav-link';\n\n ngOnInit() {\n this.registerEventHandlers();\n this.raiseIsAppEnabledQuery();\n }\n\n ngOnDestroy() {\n this.unregisterEventHandlers();\n }\n\n showsearch() {\n dispatchEvent(new CustomEvent(__LAUNCH_SEARCH__, { detail: { launchChannel: 'desktop', launchedFrom: 'top' } }));\n }\n\n get canDisplayIcon(): boolean {\n return this.displayIcon;\n }\n\n get desktopClass(): string {\n return this.desktopClassValue;\n }\n\n private setState(searchContext: IGlobalSearchContext) {\n this.desktopClassValue = this.getDesktopClassFromClientConfig(searchContext);\n console.log('desktopClassvalue', this.desktopClassValue);\n if (this.desktopClassValue) {\n this.displayIcon = true;\n } else {\n this.displayIcon = true;\n this.desktopClassValue = 'theme-search tab-nav-link';\n }\n }\n\n private getDesktopClassFromClientConfig(searchContext: IGlobalSearchContext): string {\n const presentationContext = searchContext && searchContext.presentationContext;\n return (\n (presentationContext &&\n presentationContext.entryPoints &&\n presentationContext.entryPoints['sticky'] &&\n presentationContext.entryPoints['sticky'].parameters &&\n (presentationContext.entryPoints['sticky'].parameters['DesktopClass'] ||\n presentationContext.entryPoints['sticky'].parameters['desktopClass'])) ||\n ''\n );\n }\n\n private raiseIsAppEnabledQuery() {\n dispatchEvent(new CustomEvent(__FETCH_CONTEXT__));\n }\n\n private registerEventHandlers() {\n addEventListener('gs:hideHeaderEntry', this.hideHeaderEntryEventHandler);\n addEventListener('gs:showHeaderEntry', this.showHeaderEntryEventHandler);\n addEventListener(__CONTEXT__, this.contextResultEventHandler);\n addEventListener(__PRESENTATION_BOOTSTRAPPED__, this.presentationBootstarppedEventHandler);\n addEventListener('message', this.messageEventHandler);\n }\n\n private unregisterEventHandlers() {\n removeEventListener('gs:hideHeaderEntry', this.hideHeaderEntryEventHandler);\n removeEventListener('gs:showHeaderEntry', this.showHeaderEntryEventHandler);\n removeEventListener(__CONTEXT__, this.contextResultEventHandler);\n removeEventListener(__PRESENTATION_BOOTSTRAPPED__, this.presentationBootstarppedEventHandler);\n removeEventListener('message', this.messageEventHandler);\n }\n\n private readonly hideHeaderEntryEventHandler = (event: Event): void => {\n this.isEnabled = false;\n if (event && event?.stopImmediatePropagation && typeof event?.stopImmediatePropagation === typeof (() => {})) {\n event?.stopImmediatePropagation();\n }\n };\n\n private readonly showHeaderEntryEventHandler = (event: Event): void => {\n this.isEnabled = true;\n if (event && event?.stopImmediatePropagation && typeof event?.stopImmediatePropagation === typeof (() => {})) {\n event?.stopImmediatePropagation();\n }\n };\n\n private readonly presentationBootstarppedEventHandler = (messageEvent: CustomEventInit) => {\n if (messageEvent && messageEvent.detail && messageEvent.detail) {\n const searchHost: any = messageEvent.detail;\n this.searchContext = searchHost.searchContext;\n this.setState(this.searchContext);\n this.isEnabled = searchHost.searchContext.appContext.isEnabled || false;\n }\n if (this.isEnabled) {\n dispatchEvent(new CustomEvent(__ENTRY_POINT_ACTIVE__, { detail: { activeFrom: 'header' } }));\n }\n };\n\n private readonly contextResultEventHandler = (customEvent: CustomEventInit) => {\n if (customEvent && customEvent?.detail && customEvent?.detail?.appContext) {\n this.isEnabled = customEvent?.detail?.appContext.isEnabled || false;\n this.setState(customEvent?.detail);\n }\n if (this.isEnabled) {\n dispatchEvent(new CustomEvent(__ENTRY_POINT_ACTIVE__, { detail: { activeFrom: 'header' } }));\n }\n };\n\n private readonly messageEventHandler = (messageEvent: MessageEvent): void => {\n if (\n messageEvent &&\n messageEvent.data &&\n messageEvent.data.eventIdentifier &&\n typeof messageEvent.data.eventIdentifier === typeof '' &&\n messageEvent.data.eventIdentifier?.trim()\n ) {\n switch (messageEvent.data.eventIdentifier?.trim().toLowerCase()) {\n case 'gs:hideheaderentry':\n this.hideHeaderEntryEventHandler(messageEvent);\n break;\n case 'gs:showheaderentry':\n this.showHeaderEntryEventHandler(messageEvent);\n break;\n default:\n break;\n }\n }\n };\n}\n","import { InjectionToken, NgModuleFactory, Type } from '@angular/core';\n\nexport interface LazyModules {\n [key: string]: { loadChildren: () => Promise | Type> };\n}\nexport interface LazyComponents {\n [key: string]: { loadComponent: () => Promise> };\n}\n\nexport const lazyMap: LazyModules = {\n DiscoverFeedComponent: {\n loadChildren: () => import('@casinocore/platform/discover-feed').then((m) => m.DiscoverFeedModule),\n },\n CozyBingoWidgetComponent: {\n loadChildren: () => import('@casinocore/platform/cozy-bingo-widget').then((m) => m.CozyBingoWidgetModule),\n },\n LiveGamesIframeComponent: {\n loadChildren: () => import('@casinocore/platform/live-games-section').then((m) => m.LiveGamesIframeModule),\n },\n JackpotwidgetComponent: {\n loadChildren: () => import('@casinocore/platform/jackpot-widgets').then((m) => m.JackpotWidgetModule),\n },\n JackpotWidgetRedesignComponent: {\n loadChildren: () => import('@casinocore/platform/jackpot-widgets').then((m) => m.JackpotWidgetRedesignModule),\n },\n MustGoJackpotRedesignComponent: {\n loadChildren: () => import('@casinocore/platform/must-go-redesign').then((m) => m.MustGoJackpotRedesignModule),\n },\n LiveCasinoComponent: {\n loadChildren: () => import('@casinocore/platform/livecasino').then((m) => m.LiveCasinoModule),\n },\n CasinoGameVideosComponent: {\n loadChildren: () => import('@casinocore/platform/casino-game-videos').then((m) => m.CasinoGameVideosModule),\n },\n NewsFeedComponent: {\n loadChildren: () => import('@casinocore/platform/news-feed-section').then((m) => m.NewsFeedModule),\n },\n ParallaxAnimationComponent: {\n loadChildren: () => import('@casinocore/platform/parallax-animation').then((m) => m.ParallaxAnimationModule),\n },\n PromoOfferWidgetComponent: {\n loadChildren: () => import('@casinocore/platform/promo-offer-widget').then((m) => m.PromoOfferWidgetModule),\n },\n GamificationLoaderComponent: {\n loadChildren: () => import('@casinocore/platform/gamification').then((m) => m.GamificationLoaderModule),\n },\n PromoEdsWidgetComponent: {\n loadChildren: () => import('@casinocore/platform/promo-eds-widget').then((m) => m.PromoEdsWidgetModule),\n },\n NewGridGameMetaDataComponent: {\n loadChildren: () => import('@casinocore/platform/new-grid-game-metadata').then((m) => m.NewGridGameMetaDataModule),\n },\n SlotRacesComponent: {\n loadChildren: () => import('@casinocore/platform/slot-races').then((m) => m.SlotRacesModule),\n },\n SlotRacesPhase2Component: {\n loadChildren: () => import('@casinocore/platform/slot-races-phase2').then((m) => m.SlotRacesPhase2Module),\n },\n BingoTournamentsComponent: {\n loadChildren: () => import('@casinocore/platform/bingo-tournaments').then((m) => m.BingoTournamentsModule),\n },\n CasinoGameSelectorComponent: {\n loadChildren: () => import('@casinocore/platform/casino-game-selector').then((m) => m.CasinoGameSelectorModule),\n },\n SuperButtonComponent: {\n loadChildren: () => import('@casinocore/platform/super-button').then((m) => m.SuperButtonModule),\n },\n PromotionsBannerComponent: {\n loadChildren: () => import('@casinocore/platform/promotions-banner').then((m) => m.PromotionsBannerModule),\n },\n InstagramWrapperComponent: {\n loadChildren: () => import('@casinocore/platform/instagram-section-wrapper').then((m) => m.InstagramSectionWrapperModule),\n },\n NewGameQuickInfoComponent: {\n loadChildren: () => import('@casinocore/platform/new-game-quick-info').then((m) => m.NewGameQuickInfoModule),\n },\n};\nexport const LAZY_MODULES_MAP = new InjectionToken('LAZY_MODULES_MAP', {\n factory: () => lazyMap,\n});\n\nexport const lazyMapC: LazyComponents = {\n JackpotTileConatinerComponent: {\n loadComponent: () => import('./../jackpot-tiles/jackpot-tile-container.component').then((x) => x.JackpotTileConatinerComponent),\n },\n BetMGMOriginalsComponent: {\n loadComponent: () => import('./../betmgm-originals/betmgm-originals.component').then((x) => x.BetMGMOriginalsComponent),\n },\n};\n\nexport const LAZY_COMPONENETS_MAPC = new InjectionToken('LAZY_COMPONENETS_MAPC', {\n factory: () => lazyMapC,\n});\n","import { Compiler, ComponentFactoryResolver, Inject, Injectable, Injector, NgModuleFactory, Type } from '@angular/core';\n\nimport { LAZY_COMPONENETS_MAPC, LAZY_MODULES_MAP, LazyComponents, LazyModules } from './casino-core-lazy-routes';\n\nexport type ModuleWithRoot = Type & { rootComponent: Type };\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LazyRouteService {\n constructor(\n private injector: Injector,\n private compiler: Compiler,\n @Inject(LAZY_MODULES_MAP) private modulesMap: LazyModules,\n @Inject(LAZY_COMPONENETS_MAPC) private componentsMap: LazyComponents,\n private componentFactoryResolver: ComponentFactoryResolver,\n ) {}\n\n async loadAndRenderLazyComponents(data: any) {\n const { type } = data;\n const moduleMap = this.modulesMap[type];\n const componentMap = this.componentsMap[type];\n if (moduleMap) {\n const moduleOrFactory = await moduleMap.loadChildren();\n let moduleFactory;\n if (moduleOrFactory instanceof NgModuleFactory) {\n moduleFactory = moduleOrFactory; // AOT\n } else {\n moduleFactory = await this.compiler.compileModuleAsync(moduleOrFactory); //JIT\n }\n const moduleRef = moduleFactory.create(this.injector);\n const rootComponent = (moduleFactory.moduleType as ModuleWithRoot).rootComponent;\n const factory = moduleRef.componentFactoryResolver.resolveComponentFactory(rootComponent);\n return factory;\n } else if (componentMap) {\n const component = await componentMap.loadComponent();\n const factory = this.componentFactoryResolver.resolveComponentFactory(component);\n return factory;\n }\n return '';\n }\n}\n","import { Component, ComponentRef, Input, OnChanges, OnInit, ViewChild, ViewContainerRef } from '@angular/core';\n\nimport { OutputEventModel } from '@casinocore/platform/core';\n\nimport { LazyRouteService } from './casino-core-lazy-route.service';\n\n@Component({\n selector: 'cc-casino-core-lazy-placeholder',\n templateUrl: 'casino-core-lazy-placeholder.component.html',\n standalone: true,\n})\nexport class CasinoCoreLazyPlaceholderComponent implements OnInit, OnChanges {\n @Input() componentName: string;\n @Input() inputData: any;\n @Input() outputEvents: OutputEventModel[];\n componentRef_: ComponentRef;\n @ViewChild('casinoCoreLazyTemplate', { read: ViewContainerRef, static: true }) casinoCoreLazyPlaceholdercontainer: ViewContainerRef;\n constructor(private lazyRouteService: LazyRouteService) {}\n ngOnInit() {\n const componentData = {\n type: this.componentName,\n };\n this.lazyRouteService.loadAndRenderLazyComponents(componentData).then((componentFactory: any) => {\n this.componentRef_ = this.casinoCoreLazyPlaceholdercontainer.createComponent(componentFactory);\n for (const attribute in this.inputData) {\n this.componentRef_.instance[attribute] = this.inputData[attribute];\n }\n if (this.outputEvents) {\n this.outputEvents.forEach((outputEvent: OutputEventModel) => {\n this.componentRef_.instance[outputEvent.eventName].subscribe((data: any) => {\n outputEvent.callback(data);\n });\n });\n }\n this.componentRef_.changeDetectorRef.detectChanges();\n });\n }\n ngOnChanges() {\n if (this.componentRef_) {\n for (const attribute in this.inputData) {\n this.componentRef_.instance[attribute] = this.inputData[attribute];\n }\n try {\n this.componentRef_.instance.ngOnChanges();\n } catch {\n // ignored;\n }\n }\n }\n}\n","\n","import * as i0 from '@angular/core';\nimport { Directive, inject, NgZone, Injectable, EventEmitter, PLATFORM_ID, ChangeDetectorRef, ElementRef, Input, Output, NgModule } from '@angular/core';\nimport { ReplaySubject, Subject } from 'rxjs';\nimport { isPlatformBrowser } from '@angular/common';\nimport { filter, takeUntil } from 'rxjs/operators';\nimport { isFunction, isNil, uniqueId, isBoolean, isString, isNumber } from 'lodash-es';\nlet DestroyableDirective = /*#__PURE__*/(() => {\n class DestroyableDirective {\n constructor() {\n this.destroyed$$ = new ReplaySubject(1);\n this.destroyed$ = this.destroyed$$.asObservable();\n }\n ngOnDestroy() {\n if (this.destroyed$$ && !this.destroyed$$.closed) {\n this.destroyed$$.next();\n this.destroyed$$.complete();\n }\n }\n static {\n this.ɵfac = function DestroyableDirective_Factory(t) {\n return new (t || DestroyableDirective)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: DestroyableDirective,\n selectors: [[\"\", \"inViewportDestroyable\", \"\"]],\n standalone: true\n });\n }\n }\n return DestroyableDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst isObject = value => Object.prototype.toString.call(value) === '[object Object]';\nconst ids = new WeakMap();\nconst fallbackId = 'in-viewport-empty-check-fn';\nclass CheckFn {\n #value;\n #id;\n get value() {\n return this.#value;\n }\n get id() {\n return this.#id;\n }\n constructor(value) {\n this.#value = isFunction(value) ? value : undefined;\n let id = ids.get(value) ?? fallbackId;\n if (!isNil(value) && !ids.has(value)) {\n ids.set(value, id = uniqueId('in-viewport-check-fn-'));\n }\n this.#id = id;\n }\n}\nvar InViewportDirection = /*#__PURE__*/function (InViewportDirection) {\n InViewportDirection[\"BOTH\"] = \"both\";\n InViewportDirection[\"VERTICAL\"] = \"vertical\";\n InViewportDirection[\"HORIZONTAL\"] = \"horizontal\";\n return InViewportDirection;\n}(InViewportDirection || {});\nclass InvalidDirectionException extends TypeError {\n constructor() {\n const values = Object.values(InViewportDirection).join('|');\n super(`The provided value for the direction is incorrect. The value must be any of \\`${values}\\`.`);\n }\n}\nclass InvalidRootMarginException extends TypeError {\n constructor() {\n super('The provided value for the rootMargin is incorrect. The value must be specified in pixels or percent.');\n }\n}\nclass InvalidRootNodeException extends TypeError {\n constructor() {\n super(`The provided value for the root is incorrect. The value must be of type '(Document or Element)'.`);\n }\n}\nclass InvalidThresholdException extends TypeError {\n constructor() {\n super('The provided values for the threshold are incorrect. The values must be numbers between 0 and 1.');\n }\n}\nclass Direction {\n #value;\n get value() {\n return this.#value;\n }\n constructor(value = InViewportDirection.VERTICAL) {\n if (!Object.values(InViewportDirection).includes(value)) {\n throw new InvalidDirectionException();\n }\n this.#value = value;\n }\n}\nclass Partial {\n #value;\n get value() {\n return this.#value;\n }\n constructor(value) {\n this.#value = isBoolean(value) ? value : true;\n }\n}\nclass RootMargin {\n #value;\n get value() {\n return this.#value;\n }\n constructor(value) {\n this.#value = RootMargin.parse(value);\n }\n static parse(value) {\n const strValue = isString(value) ? value.trim() : '0px';\n const values = strValue.split(/\\s+/);\n if (values.length <= 4 && values.every(val => /^-?\\d*\\.?\\d+(px|%)$/.test(val))) {\n const [top, right = top, bottom = top, left = right] = values;\n return `${top} ${right} ${bottom} ${left}`;\n }\n throw new InvalidRootMarginException();\n }\n}\nclass RootNode {\n #value;\n get value() {\n return this.#value;\n }\n constructor(node) {\n this.#value = RootNode.validate(node);\n }\n static validate(node) {\n if (isNil(node)) {\n return null;\n }\n if (node instanceof Element && node.nodeType === Node.ELEMENT_NODE) {\n return node;\n }\n throw new InvalidRootNodeException();\n }\n}\nclass Threshold {\n #value;\n get value() {\n return this.#value;\n }\n constructor(value) {\n this.#value = Threshold.validate(value ?? [0, 1]);\n }\n static validate(value) {\n if (Threshold.isValid(value)) {\n return [value];\n }\n if (Array.isArray(value) && value.every(val => Threshold.isValid(val))) {\n return value.sort();\n }\n throw new InvalidThresholdException();\n }\n static isValid(value) {\n return isNumber(value) && value >= 0 && value <= 1;\n }\n}\nconst checkFnId = Symbol('InViewportCheckFnId');\nconst configHash = Symbol('InViewportConfigHash');\nclass Config {\n #value;\n #hash;\n get root() {\n return this.#value.root.value;\n }\n get rootMargin() {\n return this.#value.rootMargin.value;\n }\n get threshold() {\n return this.#value.threshold.value;\n }\n get partial() {\n return this.#value.partial.value;\n }\n get direction() {\n return this.#value.direction.value;\n }\n get checkFn() {\n return this.#value.checkFn.value;\n }\n get [checkFnId]() {\n return this.#value.checkFn.id;\n }\n get [configHash]() {\n return this.#hash;\n }\n constructor(options) {\n options ??= {};\n this.#value = Object.freeze({\n root: new RootNode(options.root),\n rootMargin: new RootMargin(options.rootMargin),\n threshold: new Threshold(options.threshold),\n partial: new Partial(options.partial),\n direction: new Direction(options.direction),\n checkFn: new CheckFn(options.checkFn)\n });\n this.#hash = toBase64(stringify({\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n partial: this.partial,\n direction: this.direction,\n checkFn: this[checkFnId]\n }));\n }\n}\nclass ObserverCacheItem {\n #nodes = new Set();\n #observer;\n #destroy;\n constructor(config, callback) {\n this.#observer = new IntersectionObserver((...args) => {\n callback.next(...args);\n }, {\n root: config.root,\n rootMargin: config.rootMargin,\n threshold: [...config.threshold]\n });\n this.#destroy = () => {\n this.#observer.disconnect();\n callback.complete();\n };\n }\n addNode(node) {\n this.#nodes.add(node);\n this.#observer.observe(node);\n }\n deleteNode(node) {\n this.#nodes.delete(node);\n this.#nodes.size ? this.#observer.unobserve(node) : this.#destroy();\n }\n}\nclass ObserverCache {\n static #EMPTY_ROOT = Object.create(null);\n #cache = new WeakMap();\n #callback;\n constructor(callback) {\n this.#callback = callback;\n }\n addNode(node, config) {\n const items = this.#cache.get(config.root ?? ObserverCache.#EMPTY_ROOT) ?? this.create(config);\n const hash = config[configHash];\n // Scenario when configuration with new hash appears,\n // but root is already in cache.\n if (!items.has(hash)) {\n this.insert(items, config);\n }\n items.get(hash).addNode(node);\n }\n deleteNode(node, config) {\n const items = this.#cache.get(config.root ?? ObserverCache.#EMPTY_ROOT);\n const hash = config[configHash];\n if (items && items.has(hash)) {\n items.get(hash).deleteNode(node);\n }\n if (items && items.size === 0) {\n this.#cache.delete(config.root ?? ObserverCache.#EMPTY_ROOT);\n }\n }\n create(config) {\n const items = new Map();\n this.#cache.set(config.root ?? ObserverCache.#EMPTY_ROOT, items);\n this.insert(items, config);\n return items;\n }\n insert(items, config) {\n const hash = config[configHash];\n const cacheItem = new ObserverCacheItem(config, {\n next: (...args) => {\n this.#callback(...args);\n },\n complete: () => {\n items.delete(hash);\n }\n });\n items.set(hash, cacheItem);\n }\n}\nconst stringify = input => {\n if (Array.isArray(input)) {\n return `[${input.map(stringify).join(',')}]`;\n }\n if (isObject(input)) {\n return Object.entries(input).sort(([a], [b]) => String(a).localeCompare(String(b))).map(([key, value]) => `${key}:${stringify(value)}`).join('|');\n }\n return String(input);\n};\nconst toBase64 = value => {\n try {\n const input = globalThis.encodeURI(value);\n return globalThis.btoa(input);\n } catch {\n return value;\n }\n};\nlet InViewportService = /*#__PURE__*/(() => {\n class InViewportService {\n #trigger$;\n #cache;\n constructor() {\n this.#trigger$ = new Subject();\n this.trigger$ = this.#trigger$.asObservable();\n this.zone = inject(NgZone);\n this.zone.runOutsideAngular(() => {\n this.#cache = new ObserverCache(entries => this.onIntersectionEvent(entries));\n });\n }\n register(node, config) {\n this.zone.runOutsideAngular(() => {\n this.#cache.addNode(node, config);\n });\n }\n unregister(node, config) {\n this.zone.runOutsideAngular(() => {\n this.#cache.deleteNode(node, config);\n });\n }\n onIntersectionEvent(entries = []) {\n this.zone.run(() => entries.forEach(entry => this.#trigger$.next(entry)));\n }\n static {\n this.ɵfac = function InViewportService_Factory(t) {\n return new (t || InViewportService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InViewportService,\n factory: InViewportService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return InViewportService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst InViewportMetadata = Symbol('InViewportMetadata');\nlet InViewportDirective = /*#__PURE__*/(() => {\n class InViewportDirective {\n constructor() {\n this.inViewportAction = new EventEmitter();\n this.inViewportCustomCheck = new EventEmitter();\n this.config = new Config({});\n this.platformId = inject(PLATFORM_ID);\n this.changeDetectorRef = inject(ChangeDetectorRef);\n this.elementRef = inject(ElementRef);\n this.destroyable = inject(DestroyableDirective, {\n self: true\n });\n this.inViewportService = inject(InViewportService);\n }\n set options(options) {\n this.config = new Config(options);\n }\n get nativeElement() {\n return this.elementRef.nativeElement;\n }\n ngAfterViewInit() {\n if (!isPlatformBrowser(this.platformId)) {\n this.emit(undefined, true, true);\n return;\n }\n this.inViewportService.trigger$.pipe(filter(entry => entry.target === this.nativeElement), takeUntil(this.destroyable.destroyed$)).subscribe(entry => {\n this.emit(entry, false);\n this.changeDetectorRef.markForCheck();\n });\n this.inViewportService.register(this.nativeElement, this.config);\n }\n ngOnDestroy() {\n if (isPlatformBrowser(this.platformId)) {\n this.inViewportService.unregister(this.nativeElement, this.config);\n this.emit(undefined, true, false);\n }\n }\n isVisible(entry) {\n return this.config.partial ? entry.isIntersecting || entry.intersectionRatio > 0 : entry.intersectionRatio >= 1;\n }\n emit(entry, force, forcedValue) {\n this.inViewportAction.emit({\n [InViewportMetadata]: {\n entry\n },\n target: this.nativeElement,\n visible: force ? !!forcedValue : !entry || this.isVisible(entry)\n });\n if (this.config.checkFn) {\n this.inViewportCustomCheck.emit(this.config.checkFn(entry, {\n force,\n forcedValue: force ? !!forcedValue : undefined,\n config: this.config\n }));\n }\n }\n static {\n this.ɵfac = function InViewportDirective_Factory(t) {\n return new (t || InViewportDirective)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: InViewportDirective,\n selectors: [[\"\", \"inViewport\", \"\"]],\n inputs: {\n options: [i0.ɵɵInputFlags.None, \"inViewportOptions\", \"options\"]\n },\n outputs: {\n inViewportAction: \"inViewportAction\",\n inViewportCustomCheck: \"inViewportCustomCheck\"\n },\n standalone: true,\n features: [i0.ɵɵHostDirectivesFeature([DestroyableDirective])]\n });\n }\n }\n return InViewportDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet InViewportModule = /*#__PURE__*/(() => {\n class InViewportModule {\n static {\n this.ɵfac = function InViewportModule_Factory(t) {\n return new (t || InViewportModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: InViewportModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n }\n return InViewportModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of ng-in-viewport\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Config, DestroyableDirective, InViewportDirection, InViewportDirective, InViewportMetadata, InViewportModule, InViewportService, InvalidDirectionException, InvalidRootMarginException, InvalidRootNodeException, InvalidThresholdException };\n","import { ɵglobal } from '@angular/core';\nfunction push(heap, node) {\n const index = heap.length;\n heap.push(node);\n siftUp(heap, node, index);\n}\nfunction peek(heap) {\n const first = heap[0];\n return first === undefined ? null : first;\n}\nfunction pop(heap) {\n const first = heap[0];\n if (first !== undefined) {\n const last = heap.pop();\n if (last !== first) {\n heap[0] = last;\n siftDown(heap, last, 0);\n }\n return first;\n } else {\n return null;\n }\n}\nfunction siftUp(heap, node, i) {\n let index = i;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const parentIndex = index - 1 >>> 1;\n const parent = heap[parentIndex];\n if (parent !== undefined && compare(parent, node) > 0) {\n // The parent is larger. Swap positions.\n heap[parentIndex] = node;\n heap[index] = parent;\n index = parentIndex;\n } else {\n // The parent is smaller. Exit.\n return;\n }\n }\n}\nfunction siftDown(heap, node, i) {\n let index = i;\n const length = heap.length;\n while (index < length) {\n const leftIndex = (index + 1) * 2 - 1;\n const left = heap[leftIndex];\n const rightIndex = leftIndex + 1;\n const right = heap[rightIndex];\n // If the left or right node is smaller, swap with the smaller of those.\n if (left !== undefined && compare(left, node) < 0) {\n if (right !== undefined && compare(right, left) < 0) {\n heap[index] = right;\n heap[rightIndex] = node;\n index = rightIndex;\n } else {\n heap[index] = left;\n heap[leftIndex] = node;\n index = leftIndex;\n }\n } else if (right !== undefined && compare(right, node) < 0) {\n heap[index] = right;\n heap[rightIndex] = node;\n index = rightIndex;\n } else {\n // Neither child is smaller. Exit.\n return;\n }\n }\n}\nfunction compare(a, b) {\n // Compare sort index first, then task id.\n const diff = a.sortIndex - b.sortIndex;\n return diff !== 0 ? diff : a.id - b.id;\n}\n\n// see https://github.com/facebook/react/blob/main/packages/scheduler/src/forks/Scheduler.js\nlet getCurrentTime;\nconst hasPerformanceNow = typeof ɵglobal.performance === 'object' && typeof ɵglobal.performance.now === 'function';\nif (hasPerformanceNow) {\n const localPerformance = ɵglobal.performance;\n getCurrentTime = () => localPerformance.now();\n} else {\n const localDate = Date;\n const initialTime = localDate.now();\n getCurrentTime = () => localDate.now() - initialTime;\n}\n// Max 31 bit integer. The max integer size in V8 for 32-bit systems.\n// Math.pow(2, 30) - 1\n// 0b111111111111111111111111111111\nconst maxSigned31BitInt = 1073741823;\n// Times out immediately\nconst IMMEDIATE_PRIORITY_TIMEOUT = -1;\n// Eventually times out\nconst USER_BLOCKING_PRIORITY_TIMEOUT = 250;\nconst NORMAL_PRIORITY_TIMEOUT = 5000;\nconst LOW_PRIORITY_TIMEOUT = 10000;\n// Never times out\nconst IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;\n// Tasks are stored on a min heap\nconst taskQueue = [];\nconst timerQueue = [];\n// Incrementing id counter. Used to maintain insertion order.\nlet taskIdCounter = 1;\n// Pausing the scheduler is useful for debugging.\nlet isSchedulerPaused = false;\nlet currentTask = null;\nlet currentPriorityLevel = 3 /* PriorityLevel.NormalPriority */;\n// This is set while performing work, to prevent re-entrancy.\nlet isPerformingWork = false;\nlet isHostCallbackScheduled = false;\nlet isHostTimeoutScheduled = false;\n// Capture local references to native APIs, in case a polyfill overrides them.\nconst setTimeout = ɵglobal.setTimeout;\nconst clearTimeout = ɵglobal.clearTimeout;\nconst setImmediate = ɵglobal.setImmediate; // IE and Node.js + jsdom\nconst messageChannel = ɵglobal.MessageChannel;\nconst isInputPending = typeof ɵglobal.navigator !== 'undefined' && ɵglobal.navigator.scheduling !== undefined && ɵglobal.navigator.scheduling.isInputPending !== undefined ? ɵglobal.navigator.scheduling.isInputPending.bind(ɵglobal.navigator.scheduling) : null;\nconst defaultZone = {\n run: fn => fn()\n};\nfunction advanceTimers(currentTime) {\n // Check for tasks that are no longer delayed and add them to the queue.\n let timer = peek(timerQueue);\n while (timer !== null) {\n if (timer.callback === null) {\n // Timer was cancelled.\n pop(timerQueue);\n } else if (timer.startTime <= currentTime) {\n // Timer fired. Transfer to the task queue.\n pop(timerQueue);\n timer.sortIndex = timer.expirationTime;\n push(taskQueue, timer);\n } else {\n // Remaining timers are pending.\n return;\n }\n timer = peek(timerQueue);\n }\n}\nfunction handleTimeout(currentTime) {\n isHostTimeoutScheduled = false;\n advanceTimers(currentTime);\n if (!isHostCallbackScheduled) {\n if (peek(taskQueue) !== null) {\n isHostCallbackScheduled = true;\n requestHostCallback(flushWork);\n } else {\n const firstTimer = peek(timerQueue);\n if (firstTimer !== null) {\n requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);\n }\n }\n }\n}\nfunction flushWork(hasTimeRemaining, initialTime) {\n // We'll need a host callback the next time work is scheduled.\n isHostCallbackScheduled = false;\n if (isHostTimeoutScheduled) {\n // We scheduled a timeout but it's no longer needed. Cancel it.\n isHostTimeoutScheduled = false;\n cancelHostTimeout();\n }\n isPerformingWork = true;\n const previousPriorityLevel = currentPriorityLevel;\n try {\n return workLoop(hasTimeRemaining, initialTime);\n } finally {\n currentTask = null;\n currentPriorityLevel = previousPriorityLevel;\n isPerformingWork = false;\n }\n}\nfunction workLoop(hasTimeRemaining, initialTime, _currentTask) {\n let currentTime = initialTime;\n if (_currentTask) {\n currentTask = _currentTask;\n } else {\n advanceTimers(currentTime);\n currentTask = peek(taskQueue);\n }\n let zoneChanged = false;\n const hitDeadline = () => currentTask && currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost());\n if (!hitDeadline()) {\n const ngZone = currentTask.ngZone || defaultZone;\n ngZone.run(() => {\n while (currentTask !== null && !zoneChanged) {\n if (hitDeadline()) {\n break;\n }\n const callback = currentTask.callback;\n if (typeof callback === 'function') {\n currentTask.callback = null;\n currentPriorityLevel = currentTask.priorityLevel;\n const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;\n const continuationCallback = callback(didUserCallbackTimeout);\n currentTime = getCurrentTime();\n if (typeof continuationCallback === 'function') {\n currentTask.callback = continuationCallback;\n } else {\n if (currentTask === peek(taskQueue)) {\n pop(taskQueue);\n }\n }\n advanceTimers(currentTime);\n } else {\n pop(taskQueue);\n }\n currentTask = peek(taskQueue);\n zoneChanged = currentTask?.ngZone != null && currentTask.ngZone !== ngZone;\n }\n });\n }\n // we need to check if leaving `NgZone` (tick => detectChanges) caused other\n // directives to add tasks to the queue. If there is one and we still didn't\n // hit the deadline, run the workLoop again in order to flush everything thats\n // left.\n // Otherwise, newly added tasks won't run as `performingWork` is still `true`\n currentTask = currentTask ?? peek(taskQueue);\n // We should also re-calculate the currentTime, as we need to account for the execution\n // time of the NgZone tasks as well.\n // If there is still a task in the queue, but no time is left for executing it,\n // the scheduler will re-schedule the next tick anyway\n currentTime = getCurrentTime();\n if (zoneChanged || currentTask && !hitDeadline()) {\n return workLoop(hasTimeRemaining, currentTime, currentTask);\n }\n // Return whether there's additional work\n if (currentTask !== null) {\n return true;\n } else {\n const firstTimer = peek(timerQueue);\n if (firstTimer !== null) {\n requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);\n }\n return false;\n }\n}\nfunction runWithPriority(priorityLevel, eventHandler) {\n switch (priorityLevel) {\n case 1 /* PriorityLevel.ImmediatePriority */:\n case 2 /* PriorityLevel.UserBlockingPriority */:\n case 3 /* PriorityLevel.NormalPriority */:\n case 4 /* PriorityLevel.LowPriority */:\n case 5 /* PriorityLevel.IdlePriority */:\n break;\n default:\n priorityLevel = 3 /* PriorityLevel.NormalPriority */;\n }\n const previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n}\nfunction next(eventHandler) {\n let priorityLevel;\n switch (currentPriorityLevel) {\n case 1 /* PriorityLevel.ImmediatePriority */:\n case 2 /* PriorityLevel.UserBlockingPriority */:\n case 3 /* PriorityLevel.NormalPriority */:\n // Shift down to normal priority\n priorityLevel = 3 /* PriorityLevel.NormalPriority */;\n break;\n default:\n // Anything lower than normal priority should remain at the current level.\n priorityLevel = currentPriorityLevel;\n break;\n }\n const previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n}\nfunction wrapCallback(callback) {\n const parentPriorityLevel = currentPriorityLevel;\n return () => {\n // This is a fork of runWithPriority, inlined for performance.\n const previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = parentPriorityLevel;\n try {\n // eslint-disable-next-line prefer-rest-params\n return callback.apply(this, arguments);\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n };\n}\nfunction scheduleCallback(priorityLevel, callback, options) {\n const currentTime = getCurrentTime();\n let startTime;\n if (typeof options === 'object' && options !== null) {\n const delay = options.delay;\n if (typeof delay === 'number' && delay > 0) {\n startTime = currentTime + delay;\n } else {\n startTime = currentTime;\n }\n } else {\n startTime = currentTime;\n }\n let timeout;\n switch (priorityLevel) {\n case 1 /* PriorityLevel.ImmediatePriority */:\n timeout = IMMEDIATE_PRIORITY_TIMEOUT;\n break;\n case 2 /* PriorityLevel.UserBlockingPriority */:\n timeout = USER_BLOCKING_PRIORITY_TIMEOUT;\n break;\n case 5 /* PriorityLevel.IdlePriority */:\n timeout = IDLE_PRIORITY_TIMEOUT;\n break;\n case 4 /* PriorityLevel.LowPriority */:\n timeout = LOW_PRIORITY_TIMEOUT;\n break;\n case 3 /* PriorityLevel.NormalPriority */:\n default:\n timeout = NORMAL_PRIORITY_TIMEOUT;\n break;\n }\n const expirationTime = startTime + timeout;\n const newTask = {\n id: taskIdCounter++,\n callback,\n priorityLevel,\n startTime,\n expirationTime,\n sortIndex: -1,\n ngZone: options?.ngZone || null\n };\n if (startTime > currentTime) {\n // This is a delayed task.\n newTask.sortIndex = startTime;\n push(timerQueue, newTask);\n if (peek(taskQueue) === null && newTask === peek(timerQueue)) {\n // All tasks are delayed, and this is the task with the earliest delay.\n if (isHostTimeoutScheduled) {\n // Cancel an existing timeout.\n cancelHostTimeout();\n } else {\n isHostTimeoutScheduled = true;\n }\n // Schedule a timeout.\n requestHostTimeout(handleTimeout, startTime - currentTime);\n }\n } else {\n newTask.sortIndex = expirationTime;\n push(taskQueue, newTask);\n // Schedule a host callback, if needed. If we're already performing work,\n // wait until the next time we yield.\n if (!isHostCallbackScheduled && !isPerformingWork) {\n isHostCallbackScheduled = true;\n requestHostCallback(flushWork);\n }\n }\n return newTask;\n}\nfunction pauseExecution() {\n isSchedulerPaused = true;\n}\nfunction continueExecution() {\n isSchedulerPaused = false;\n if (!isHostCallbackScheduled && !isPerformingWork) {\n isHostCallbackScheduled = true;\n requestHostCallback(flushWork);\n }\n}\nfunction getFirstCallbackNode() {\n return peek(taskQueue);\n}\nfunction cancelCallback(task) {\n // Null out the callback to indicate the task has been canceled. (Can't\n // remove from the queue because you can't remove arbitrary nodes from an\n // array based heap, only the first one.)\n task.callback = null;\n}\nfunction getCurrentPriorityLevel() {\n return currentPriorityLevel;\n}\nlet isMessageLoopRunning = false;\nlet scheduledHostCallback = null;\nlet taskTimeoutID = -1;\n// Scheduler periodically yields in case there is other work on the main\n// thread, like user events. By default, it yields multiple times per frame.\n// It does not attempt to align with frame boundaries, since most tasks don't\n// need to be frame aligned; for those that do, use requestAnimationFrame.\nlet yieldInterval = 16;\n// TODO: Make this configurable\n// TODO: Adjust this based on priority?\nconst maxYieldInterval = 300;\nlet needsPaint = false;\nlet queueStartTime = -1;\nfunction shouldYieldToHost() {\n if (needsPaint) {\n // There's a pending paint (signaled by `requestPaint`). Yield now.\n return true;\n }\n const timeElapsed = getCurrentTime() - queueStartTime;\n if (timeElapsed < yieldInterval) {\n // The main thread has only been blocked for a really short amount of time;\n // smaller than a single frame. Don't yield yet.\n return false;\n }\n // The main thread has been blocked for a non-negligible amount of time. We\n // may want to yield control of the main thread, so the browser can perform\n // high priority tasks. The main ones are painting and user input. If there's\n // a pending paint or a pending input, then we should yield. But if there's\n // neither, then we can yield less often while remaining responsive. We'll\n // eventually yield regardless, since there could be a pending paint that\n // wasn't accompanied by a call to `requestPaint`, or other main thread tasks\n // like network events.\n // we don't support isInputPending currently\n /*if (enableIsInputPending) {\n if (needsPaint) {\n // There's a pending paint (signaled by `requestPaint`). Yield now.\n return true;\n }\n if (timeElapsed < continuousInputInterval) {\n // We haven't blocked the thread for that long. Only yield if there's a\n // pending discrete input (e.g. click). It's OK if there's pending\n // continuous input (e.g. mouseover).\n if (isInputPending !== null) {\n return isInputPending();\n }\n } else if (timeElapsed < maxInterval) {\n // Yield if there's either a pending discrete or continuous input.\n if (isInputPending !== null) {\n return isInputPending(continuousOptions);\n }\n } else {\n // We've blocked the thread for a long time. Even if there's no pending\n // input, there may be some other scheduled work that we don't know about,\n // like a network event. Yield now.\n return true;\n }\n }*/\n // `isInputPending` isn't available. Yield now.\n return true;\n}\nfunction requestPaint() {\n needsPaint = true;\n // we don't support isInputPending currently\n /*if (\n enableIsInputPending &&\n navigator !== undefined &&\n (navigator as any).scheduling !== undefined &&\n (navigator as any).scheduling.isInputPending !== undefined\n ) {\n needsPaint = true;\n }*/\n}\nfunction forceFrameRate(fps) {\n if (fps < 0 || fps > 125) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported');\n }\n return;\n }\n if (fps > 0) {\n yieldInterval = Math.floor(1000 / fps);\n } else {\n // reset the framerate\n yieldInterval = 5;\n }\n // be aware of browser housekeeping work (~6ms per frame)\n // according to https://developers.google.com/web/fundamentals/performance/rendering\n yieldInterval = Math.max(5, yieldInterval - 6);\n}\nconst performWorkUntilDeadline = () => {\n if (scheduledHostCallback !== null) {\n const currentTime = getCurrentTime();\n // Yield after `yieldInterval` ms, regardless of where we are in the vsync\n // cycle. This means there's always time remaining at the beginning of\n // the message event.\n queueStartTime = currentTime;\n const hasTimeRemaining = true;\n // If a scheduler task throws, exit the current browser task so the\n // error can be observed.\n //\n // Intentionally not using a try-catch, since that makes some debugging\n // techniques harder. Instead, if `scheduledHostCallback` errors, then\n // `hasMoreWork` will remain true, and we'll continue the work loop.\n let hasMoreWork = true;\n try {\n hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);\n } finally {\n if (hasMoreWork) {\n // If there's more work, schedule the next message event at the end\n // of the preceding one.\n schedulePerformWorkUntilDeadline();\n } else {\n isMessageLoopRunning = false;\n scheduledHostCallback = null;\n }\n }\n } else {\n isMessageLoopRunning = false;\n }\n // Yielding to the browser will give it a chance to paint, so we can\n // reset this.\n needsPaint = false;\n};\nlet schedulePerformWorkUntilDeadline;\nif (typeof setImmediate === 'function') {\n // Node.js and old IE.\n // There's a few reasons for why we prefer setImmediate.\n //\n // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.\n // (Even though this is a DOM fork of the Scheduler, you could get here\n // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)\n // https://github.com/facebook/react/issues/20756\n //\n // But also, it runs earlier which is the semantic we want.\n // If other browsers ever implement it, it's better to use it.\n // Although both of these would be inferior to native scheduling.\n schedulePerformWorkUntilDeadline = () => {\n setImmediate(performWorkUntilDeadline);\n };\n} else if (typeof messageChannel !== 'undefined') {\n const channel = new messageChannel();\n const port = channel.port2;\n channel.port1.onmessage = performWorkUntilDeadline;\n schedulePerformWorkUntilDeadline = () => {\n port.postMessage(null);\n };\n} else {\n // We should only fallback here in non-browser environments.\n schedulePerformWorkUntilDeadline = () => {\n setTimeout(performWorkUntilDeadline, 0);\n };\n}\nfunction requestHostCallback(callback) {\n scheduledHostCallback = callback;\n if (!isMessageLoopRunning) {\n isMessageLoopRunning = true;\n schedulePerformWorkUntilDeadline();\n }\n}\nfunction requestHostTimeout(callback, ms) {\n taskTimeoutID = setTimeout(() => {\n callback(getCurrentTime());\n }, ms);\n}\nfunction cancelHostTimeout() {\n clearTimeout(taskTimeoutID);\n taskTimeoutID = -1;\n}\nconst _requestPaint = requestPaint;\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { cancelCallback, forceFrameRate, scheduleCallback };\n","import { isObservable, of, Subject } from 'rxjs';\nimport { map, switchAll, distinctUntilChanged } from 'rxjs/operators';\n\n/**\n * This Observable factory creates an Observable out of a static value or an Observable.\n *\n * @param o - the value to coerce\n */\nfunction coerceObservable(o) {\n return isObservable(o) ? o : of(o);\n}\n\n/**\n * This operator maps an Observable out of a static value or an Observable.\n *\n */\nfunction coerceObservableWith() {\n return o$ => map(coerceObservable)(o$);\n}\n\n/**\n * This Observable factory creates an Observable out of a static value or an Observable.\n * It forwards only distinct values from distinct incoming Observables or values.\n * This comes in handy in any environment where you handle processing of incoming dynamic values and their state.\n *\n * Optionally you can pass a flatten strategy to get find grained control of the flattening process. E.g. mergeAll, switchAll\n *\n * @param o$ - The Observable to coerce and map to a Observable with distinct values\n * @param flattenOperator - determines the flattening strategy e.g. mergeAll, concatAll, exhaust, switchAll. default is switchAll\n */\nfunction coerceDistinctObservable(o$, flattenOperator) {\n flattenOperator = flattenOperator || switchAll();\n return coerceObservable(o$).pipe(distinctUntilChanged(), flattenOperator, distinctUntilChanged());\n}\n\n/**\n * This operator takes an Observable of values ot Observables aof values and\n * It forwards only distinct values from distinct incoming Observables or values.\n * This comes in handy in any environment where you handle processing of incoming dynamic values and their state.\n *\n * Optionally you can pass a flatten strategy to get find grained control of the flattening process. E.g. mergeAll, switchAll\n *\n * @param flattenOperator - determines the flattening strategy e.g. mergeAll, concatAll, exhaust, switchAll. default is switchAll\n *\n */\nfunction coerceDistinctWith(flattenOperator) {\n flattenOperator = flattenOperator || switchAll();\n return o$ => o$.pipe(coerceObservableWith(), distinctUntilChanged(), flattenOperator, distinctUntilChanged());\n}\n\n/**\n * A factory function returning an object to handle the process of merging Observable next notifications into one\n * Observable. This API takes away the clumsy handling of static values and Observable, reduces the number of\n * emissions by:\n * - only merging distinct Observables\n * - only emit distinct values of the merged result\n *\n * You can next a Observable of `U` multiple times and merge them into the Observable exposed under one optimized\n * `values$`\n *\n */\nfunction coerceAllFactory(subjectFactory, flattenOperator) {\n const observablesSubject = subjectFactory ? subjectFactory() : new Subject();\n flattenOperator = flattenOperator || switchAll();\n const values$ = observablesSubject.pipe(coerceDistinctWith(flattenOperator));\n return {\n next(observable) {\n observablesSubject.next(observable);\n },\n values$\n };\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { coerceAllFactory, coerceDistinctObservable, coerceDistinctWith, coerceObservable, coerceObservableWith };\n","import * as i0 from '@angular/core';\nimport { NgZone, InjectionToken, Injectable, Optional, Inject } from '@angular/core';\nimport { Observable, throwError, BehaviorSubject, fromEvent, ReplaySubject } from 'rxjs';\nimport { filter, mapTo, switchMap, tap, catchError, map, take, shareReplay, takeUntil, switchAll, startWith, share } from 'rxjs/operators';\nimport { forceFrameRate, scheduleCallback, cancelCallback } from '@rx-angular/cdk/internals/scheduler';\nimport { coalescingManager, coalesceWith } from '@rx-angular/cdk/coalescing';\nimport { getZoneUnPatchedApi } from '@rx-angular/cdk/internals/core';\nimport { coerceAllFactory } from '@rx-angular/cdk/coercing';\n\n// set default to 60fps\nforceFrameRate(60);\nconst immediateStrategy = {\n name: 'immediate',\n work: cdRef => cdRef.detectChanges(),\n behavior: ({\n work,\n scope,\n ngZone\n }) => {\n return o$ => o$.pipe(scheduleOnQueue(work, {\n ngZone,\n priority: 1 /* PriorityLevel.ImmediatePriority */,\n scope\n }));\n }\n};\nconst userBlockingStrategy = {\n name: 'userBlocking',\n work: cdRef => cdRef.detectChanges(),\n behavior: ({\n work,\n scope,\n ngZone\n }) => {\n return o$ => o$.pipe(scheduleOnQueue(work, {\n ngZone,\n priority: 2 /* PriorityLevel.UserBlockingPriority */,\n scope\n }));\n }\n};\nconst normalStrategy = {\n name: 'normal',\n work: cdRef => cdRef.detectChanges(),\n behavior: ({\n work,\n scope,\n ngZone\n }) => {\n return o$ => o$.pipe(scheduleOnQueue(work, {\n ngZone,\n priority: 3 /* PriorityLevel.NormalPriority */,\n scope\n }));\n }\n};\nconst lowStrategy = {\n name: 'low',\n work: cdRef => cdRef.detectChanges(),\n behavior: ({\n work,\n scope,\n ngZone\n }) => {\n return o$ => o$.pipe(scheduleOnQueue(work, {\n ngZone,\n priority: 4 /* PriorityLevel.LowPriority */,\n scope\n }));\n }\n};\nconst idleStrategy = {\n name: 'idle',\n work: cdRef => cdRef.detectChanges(),\n behavior: ({\n work,\n scope,\n ngZone\n }) => {\n return o$ => o$.pipe(scheduleOnQueue(work, {\n ngZone,\n priority: 5 /* PriorityLevel.IdlePriority */,\n scope\n }));\n }\n};\nfunction scheduleOnQueue(work, options) {\n const scope = options.scope || {};\n return o$ => o$.pipe(filter(() => !coalescingManager.isCoalescing(scope)), switchMap(v => new Observable(subscriber => {\n coalescingManager.add(scope);\n const task = scheduleCallback(options.priority, () => {\n work();\n coalescingManager.remove(scope);\n subscriber.next(v);\n }, {\n delay: options.delay,\n ngZone: options.ngZone\n });\n return () => {\n coalescingManager.remove(scope);\n cancelCallback(task);\n };\n }).pipe(mapTo(v))));\n}\nconst RX_CONCURRENT_STRATEGIES = {\n immediate: immediateStrategy,\n userBlocking: userBlockingStrategy,\n normal: normalStrategy,\n low: lowStrategy,\n idle: idleStrategy\n};\nconst animationFrameTick = () => new Observable(subscriber => {\n // use the unpatched API no avoid zone interference\n const id = getZoneUnPatchedApi('requestAnimationFrame')(() => {\n subscriber.next(0);\n subscriber.complete();\n });\n return () => {\n // use the unpatched API no avoid zone interference\n getZoneUnPatchedApi('cancelAnimationFrame')(id);\n };\n});\nconst localCredentials = {\n name: 'local',\n work: (cdRef, _, notification) => {\n cdRef.detectChanges();\n },\n behavior: ({\n work,\n scope,\n ngZone\n }) => o$ => o$.pipe(coalesceWith(animationFrameTick(), scope), tap(() => ngZone ? ngZone.run(() => work()) : work()))\n};\nconst noopCredentials = {\n name: 'noop',\n work: () => void 0,\n behavior: () => o$ => o$\n};\nconst nativeCredentials = {\n name: 'native',\n work: cdRef => cdRef.markForCheck(),\n behavior: ({\n work,\n ngZone\n }) => o$ => o$.pipe(tap(() => ngZone && !NgZone.isInAngularZone() ? ngZone.run(() => work()) : work()))\n};\nconst RX_NATIVE_STRATEGIES = {\n native: nativeCredentials,\n noop: noopCredentials,\n local: localCredentials\n};\nconst RX_RENDER_STRATEGIES_CONFIG = new InjectionToken('rxa-render-strategies-config');\nconst RX_RENDER_STRATEGIES_DEFAULTS = {\n primaryStrategy: 'normal',\n customStrategies: {\n ...RX_NATIVE_STRATEGIES,\n ...RX_CONCURRENT_STRATEGIES\n },\n patchZone: true,\n parent: true\n};\nfunction mergeDefaultConfig(cfg) {\n const custom = cfg ? cfg : {\n customStrategies: {}\n };\n return {\n ...RX_RENDER_STRATEGIES_DEFAULTS,\n ...custom,\n customStrategies: {\n ...custom.customStrategies,\n ...RX_RENDER_STRATEGIES_DEFAULTS.customStrategies\n }\n };\n}\n\n/**\n * @internal\n *\n * @param value\n * @param strategy\n * @param workFactory\n * @param options\n */\nfunction onStrategy(value, strategy, workFactory, options = {}) {\n return new Observable(subscriber => {\n subscriber.next(value);\n }).pipe(strategy.behavior({\n work: () => workFactory(value, strategy.work, options),\n scope: options.scope || {},\n ngZone: options.ngZone\n }), catchError(error => throwError(() => [error, value])), map(() => value), take(1));\n}\n\n/**\n * @description\n * RxStrategyProvider is a wrapper service that you can use to consume strategies and schedule your code execution.\n *\n * @example\n * Component({\n * selector: 'app-service-communicator',\n * template: ``\n * });\n * export class ServiceCommunicationComponent {\n * private currentUserSettings;\n *\n * constructor(\n * private strategyProvider: RxStrategyProvider,\n * private userService: UserService,\n * private backgroundSync: BackgroundSyncService\n * ) {\n * this.userService.fetchCurrentUserSettings\n * .pipe(\n * tap(settings => (this.currentUserSettings = settings)),\n * this.strategyProvider.scheduleWith(\n * settings => this.backgroundSync.openConnection(settings),\n * { strategy: 'idle' }\n * )\n * )\n * .subscribe();\n * }\n * }\n *\n * @docsCategory RxStrategyProvider\n * @docsPage RxStrategyProvider\n */\nlet RxStrategyProvider = /*#__PURE__*/(() => {\n class RxStrategyProvider {\n _strategies$ = new BehaviorSubject(undefined);\n _primaryStrategy$ = new BehaviorSubject(undefined);\n _cfg;\n /**\n * @description\n * Returns current `RxAngularConfig` used in the service.\n * Config includes:\n * - strategy that currently in use - `primaryStrategy`\n * - array of custom user defined strategies - `customStrategies`\n * - setting that is responsible for running in our outside of the zone.js - `patchZone`\n */\n get config() {\n return this._cfg;\n }\n /**\n * @description\n * Returns object that contains key-value pairs of strategy names and their credentials (settings) that are available in the service.\n */\n get strategies() {\n return this._strategies$.getValue();\n }\n /**\n * @description\n * Returns an array of strategy names available in the service.\n */\n get strategyNames() {\n return Object.values(this.strategies).map(s => s.name);\n }\n /**\n * @description\n * Returns current strategy of the service.\n */\n get primaryStrategy() {\n return this._primaryStrategy$.getValue().name;\n }\n /**\n * @description\n * Set's the strategy that will be used by the service.\n */\n set primaryStrategy(strategyName) {\n this._primaryStrategy$.next(this.strategies[strategyName]);\n }\n /**\n * @description\n * Current strategy of the service as an observable.\n */\n primaryStrategy$ = this._primaryStrategy$.asObservable();\n /**\n * @description\n * Returns observable of an object that contains key-value pairs of strategy names and their credentials (settings) that are available in the service.\n */\n strategies$ = this._strategies$.asObservable();\n /**\n * @description\n * Returns an observable of an array of strategy names available in the service.\n */\n strategyNames$ = this.strategies$.pipe(map(strategies => Object.values(strategies).map(s => s.name)), shareReplay({\n bufferSize: 1,\n refCount: true\n }));\n /**\n * @internal\n */\n constructor(cfg) {\n this._cfg = mergeDefaultConfig(cfg);\n this._strategies$.next(this._cfg.customStrategies);\n this.primaryStrategy = this.config.primaryStrategy;\n }\n /**\n * @description\n * Allows to schedule a work inside rxjs `pipe`. Accepts the work and configuration options object.\n * - work is any function that should be executed\n * - (optional) options includes strategy, patchZone and scope\n *\n * Scope is by default a subscription but you can also pass `this` and then the scope will be current component.\n * Scope setup is useful if your work is some of the methods of `ChangeDetectorRef`. Only one change detection will be triggered if you have multiple schedules of change detection methods and scope is set to `this`.\n *\n * @example\n * myObservable$.pipe(\n * this.strategyProvider.scheduleWith(() => myWork(), {strategy: 'idle', patchZone: false})\n * ).subscribe();\n *\n * @return MonoTypeOperatorFunction\n */\n scheduleWith(work, options) {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || {};\n const _work = getWork(work, options?.patchZone);\n const ngZone = options?.patchZone || undefined;\n return o$ => o$.pipe(switchMap(v => onStrategy(v, strategy, _v => {\n _work(_v);\n }, {\n scope,\n ngZone\n })));\n }\n /**\n * @description\n * Allows to schedule a work as an observable. Accepts the work and configuration options object.\n * - work is any function that should be executed\n * - (optional) options includes strategy, patchZone and scope\n *\n * Scope is by default a subscription but you can also pass `this` and then the scope will be current component.\n * Scope setup is especially useful if you provide work that will trigger a change detection.\n *\n * @example\n * this.strategyProvider.schedule(() => myWork(), {strategy: 'idle', patchZone: false}).subscribe();\n *\n * @return Observable\n */\n schedule(work, options) {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || {};\n const _work = getWork(work, options?.patchZone);\n const ngZone = options?.patchZone || undefined;\n let returnVal;\n return onStrategy(null, strategy, () => {\n returnVal = _work();\n }, {\n scope,\n ngZone\n }).pipe(map(() => returnVal));\n }\n /**\n * @description\n * Allows to schedule a change detection cycle. Accepts the ChangeDetectorRef and configuration options object.\n * Options include:\n * - afterCD which is the work that should be executed after change detection cycle.\n * - abortCtrl is an AbortController that you can use to cancel the scheduled cycle.\n *\n * @example\n * this.strategyProvider.scheduleCd(this.changeDetectorRef, {afterCD: myWork()});\n *\n * @return AbortController\n */\n scheduleCD(cdRef, options) {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || cdRef;\n const abC = options?.abortCtrl || new AbortController();\n const ngZone = options?.patchZone || undefined;\n const work = getWork(() => {\n strategy.work(cdRef, scope);\n if (options?.afterCD) {\n options.afterCD();\n }\n }, options.patchZone);\n onStrategy(null, strategy, () => {\n work();\n }, {\n scope,\n ngZone\n }).pipe(takeUntil(fromEvent(abC.signal, 'abort'))).subscribe();\n return abC;\n }\n /** @nocollapse */\n static ɵfac = function RxStrategyProvider_Factory(t) {\n return new (t || RxStrategyProvider)(i0.ɵɵinject(RX_RENDER_STRATEGIES_CONFIG, 8));\n };\n /** @nocollapse */\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RxStrategyProvider,\n factory: RxStrategyProvider.ɵfac,\n providedIn: 'root'\n });\n }\n return RxStrategyProvider;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction getWork(work, patchZone) {\n let _work = work;\n if (patchZone) {\n _work = args => patchZone.run(() => work(args));\n }\n return _work;\n}\n\n/**\n * @internal\n *\n * A factory function returning an object to handle the process of turning strategy names into `RxStrategyCredentials`\n * You can next a strategy name as Observable or string and get an Observable of `RxStrategyCredentials`\n *\n * @param defaultStrategyName\n * @param strategies\n */\nfunction strategyHandling(defaultStrategyName, strategies) {\n const hotFlattened = coerceAllFactory(() => new ReplaySubject(1), switchAll());\n return {\n strategy$: hotFlattened.values$.pipe(startWith(defaultStrategyName), nameToStrategyCredentials(strategies, defaultStrategyName), share()),\n next(name) {\n hotFlattened.next(name);\n }\n };\n}\n/**\n * @internal\n */\nfunction nameToStrategyCredentials(strategies, defaultStrategyName) {\n return o$ => o$.pipe(map(name => name && Object.keys(strategies).includes(name) ? strategies[name] : strategies[defaultStrategyName]));\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { RX_CONCURRENT_STRATEGIES, RX_NATIVE_STRATEGIES, RX_RENDER_STRATEGIES_CONFIG, RxStrategyProvider, onStrategy, strategyHandling };\n","import { Subject, NEVER, ReplaySubject, from, Observable, isObservable } from 'rxjs';\nimport { mergeAll, share, materialize, tap, map, startWith, distinctUntilChanged, switchMap } from 'rxjs/operators';\nimport { coerceAllFactory } from '@rx-angular/cdk/coercing';\nfunction toRxErrorNotification(error, value) {\n return {\n value,\n kind: \"error\" /* RxNotificationKind.Error */,\n hasValue: !!value || false,\n complete: false,\n error: error || true\n };\n}\nfunction toRxSuspenseNotification(value) {\n return {\n value,\n kind: \"suspense\" /* RxNotificationKind.Suspense */,\n hasValue: !!value || false,\n complete: false,\n error: false\n };\n}\nfunction toRxCompleteNotification(value) {\n return {\n value,\n kind: \"complete\" /* RxNotificationKind.Complete */,\n hasValue: !!value || false,\n complete: true,\n error: false\n };\n}\n\n/**\n * @internal\n *\n * A factory function returning an object to handle the process of switching templates by Notification channel.\n * You can next a Observable of `RxNotification` multiple times and merge them into the Observable exposed under `trigger$`\n *\n */\nfunction templateTriggerHandling() {\n const hotFlattened = coerceAllFactory(() => new Subject(), mergeAll());\n return {\n next(templateName) {\n hotFlattened.next(templateName);\n },\n trigger$: hotFlattened.values$.pipe(share())\n };\n}\nfunction rxMaterialize() {\n return o$ => o$.pipe(materialize(), tap(({\n kind,\n error\n }) => {\n // As we dont want to just swallow errors we log them here\n if (kind === 'E') {\n console.error(error);\n }\n }), map(({\n value,\n error,\n kind,\n hasValue\n }) => {\n const rxNotificationKind = notificationKindToRxNotificationKind(kind);\n return {\n value,\n hasValue,\n error,\n kind: rxNotificationKind,\n complete: rxNotificationKind === \"complete\" /* RxNotificationKind.Complete */\n };\n }));\n}\n/**\n * @internal\n *\n * @description\n * This function is here to turn RxJS notification kind values into RxNotification kind names.\n * The main reason for the naming is the RxNotification kind values map directly to the default\n * template names (`suspense`, `next`, `error` `complete`) in the directives of the template package\n */\nfunction notificationKindToRxNotificationKind(kind) {\n switch (kind) {\n case 'C':\n return \"complete\" /* RxNotificationKind.Complete */;\n case 'E':\n return \"error\" /* RxNotificationKind.Error */;\n case 'N':\n default:\n return \"next\" /* RxNotificationKind.Next */;\n }\n}\n\n/**\n * @description\n * Sends value and an initial `undefined` as value With a NEVER.\n * This is needed to render the suspense template and avoid completing (and render the complete template).\n * @param value\n */\nconst emitAndDontComplete = value => NEVER.pipe(startWith(value));\n/**\n * This helper is responsible for turning a stream of materialized notifications\n * (next error, complete as object in the next stream) into an enriched version with an additional suspense\n * notification type.\n *\n * If a notification enters and is of type next we store tne value of `notification.next` as last value emitted.\n * This value is important in the template to show an e.g. error and also have access to the last emitted value of\n * next.\n * The value can be very useful in error or complete messages or to display the old value overlays by a loading spinner\n * in case of the suspense state.\n *\n * If a notification of kind `next` enters and its value is undefined we turn it into a suspense notification\n * If a notification of kind `error`, `complete`, `suspense` enters we take the last value from of a next notification\n * and assign it as new value to the notification\n */\nconst handleSuspenseAndLastValueInNotifications = () => {\n // Used to store the last value per handleSuspenseAndLastValueInNotifications call\n let latestNextValue;\n // returns a projection function with a lastValue cache\n return notification => {\n // if it is the notification is of type next we take its value\n // otherwise we keep the existing last value\n if (notification.kind === \"next\" /* RxNotificationKind.Next */) {\n latestNextValue = notification.value;\n }\n // If a next notification enters with a value of undefined we turn it into a suspense notification\n if (notification.kind === \"next\" /* RxNotificationKind.Next */ && notification.value === undefined) {\n return toRxSuspenseNotification(undefined);\n }\n // If a Notification of type error, complete or suspense enters we assign the latest last value to them.\n // This is needed to access the old value in case of error or complete.\n // Next notifications will pass as they are.\n if (notification.kind === \"error\" /* RxNotificationKind.Error */ || notification.kind === \"complete\" /* RxNotificationKind.Complete */ || notification.kind === \"suspense\" /* RxNotificationKind.Suspense */) {\n notification.value = latestNextValue;\n }\n return notification;\n };\n};\n/**\n * @internal\n *\n * @description\n * This factory function returns an object that can be driven imperatively over a `next` method.\n * Internally it prepares the incoming values for rendering by turning them into \"template notifications\",\n * an extended `ObservableNotification` object used to determine the respective template for values, errors, completing\n * or suspense states.\n *\n * Internally it handles different edge cases for initial emits. This helps to have or template creation lazy.\n * Also it maps any Observable to RxNotifications. These notifications are bound to the view later and handle the\n * display of the default template as well as the suspense, error, complete templates.\n */\nfunction createTemplateNotifier() {\n // A Subject driven from the outside, it can contain Observables, static values null and undefined on purpose of from unassigned properties\n const observablesSubject = new ReplaySubject(1);\n let emittedValueOnce = false;\n const values$ = observablesSubject.pipe(distinctUntilChanged(),\n // handle static values inc null assignment and new Observable or Promises\n map(observable$ => {\n if (isObservableInput(observable$)) {\n return skipSuspenseIfHasValue(observable$);\n } else if (!emittedValueOnce && observable$ === undefined) {\n return NEVER;\n }\n return emitAndDontComplete(observable$);\n }), switchMap(o => {\n return o.pipe(tap(() => emittedValueOnce = true), distinctUntilChanged(), rxMaterialize(), map(handleSuspenseAndLastValueInNotifications()));\n }));\n return {\n next(observable) {\n observablesSubject.next(observable);\n },\n withInitialSuspense(withInitialSuspense) {\n emittedValueOnce = emittedValueOnce || withInitialSuspense;\n },\n values$\n };\n /**\n * @description\n * returns an observable that starts with an undefined value in case the input\n * observable$ does not emit a value immediately.\n * This is needed in order to skip the suspense template when we already know\n * there will be a next template rendered afterwards\n * @param observable$\n */\n function skipSuspenseIfHasValue(observable$) {\n return new Observable(subscriber => {\n let startWithUndefined = true;\n const inner = from(observable$).subscribe({\n next: v => {\n startWithUndefined = false;\n subscriber.next(v);\n },\n error: e => {\n startWithUndefined = false;\n subscriber.error(e);\n },\n complete: () => subscriber.complete()\n });\n if (emittedValueOnce && startWithUndefined) {\n subscriber.next(undefined);\n }\n return () => {\n inner.unsubscribe();\n };\n });\n }\n}\nfunction isObservableInput(input) {\n return typeof input?.then === 'function' || isObservable(input);\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { createTemplateNotifier, rxMaterialize, templateTriggerHandling, toRxCompleteNotification, toRxErrorNotification, toRxSuspenseNotification };\n","import { onStrategy, strategyHandling } from '@rx-angular/cdk/render-strategies';\nimport { of, BehaviorSubject, concat, EMPTY, merge, combineLatest, ReplaySubject } from 'rxjs';\nimport { ignoreElements, switchMap, map, withLatestFrom, catchError, tap, distinctUntilChanged } from 'rxjs/operators';\n\n/**\n * @internal\n * creates an embeddedViewRef\n *\n * @param viewContainerRef\n * @param templateRef\n * @param context\n * @param index\n * @return EmbeddedViewRef\n */\nfunction createEmbeddedView(viewContainerRef, templateRef, context, index = 0) {\n const view = viewContainerRef.createEmbeddedView(templateRef, context, index);\n view.detectChanges();\n return view;\n}\n/**\n * @internal\n *\n * A factory function returning an object to handle `TemplateRef`'s.\n * You can add and get a `TemplateRef`.\n *\n */\nfunction templateHandling(viewContainerRef) {\n const templateCache = new Map();\n const get$ = name => {\n return templateCache.get(name) || of(undefined);\n };\n const get = name => {\n let ref;\n const templatRef$ = get$(name);\n if (templatRef$) {\n const sub = templatRef$.subscribe(r => ref = r);\n sub.unsubscribe();\n }\n return ref;\n };\n return {\n add(name, templateRef) {\n assertTemplate(name, templateRef);\n if (!templateCache.has(name)) {\n templateCache.set(name, new BehaviorSubject(templateRef));\n } else {\n templateCache.get(name).next(templateRef);\n }\n },\n get$,\n get,\n createEmbeddedView: (name, context) => createEmbeddedView(viewContainerRef, get(name), context)\n };\n //\n function assertTemplate(property, templateRef) {\n const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);\n if (!isTemplateRefOrNull) {\n throw new Error(`${property} must be a TemplateRef, but received ${typeof templateRef}`);\n }\n return isTemplateRefOrNull;\n }\n}\n/**\n * @internal\n *\n * A side effect operator similar to `tap` but with a static internal logic.\n * It calls detect changes on the 'VirtualParent' and the injectingViewCdRef.\n *\n * @param injectingViewCdRef\n * @param strategy\n * @param notifyNeeded\n * @param ngZone\n */\nfunction notifyAllParentsIfNeeded(injectingViewCdRef, strategy, notifyNeeded, ngZone) {\n return o$ => o$.pipe(switchMap(v => {\n const notifyParent = notifyNeeded();\n if (!notifyParent) {\n return of(v);\n }\n return concat(of(v), onStrategy(injectingViewCdRef, strategy, (_v, work, options) => {\n /*console.log(\n 'notifyAllParentsIfNeeded injectingView',\n (injectingViewCdRef as any).context\n );*/\n work(injectingViewCdRef, options.scope);\n }, {\n scope: injectingViewCdRef.context || injectingViewCdRef,\n ngZone\n }).pipe(ignoreElements()));\n }));\n}\nvar RxBaseTemplateNames = /*#__PURE__*/function (RxBaseTemplateNames) {\n RxBaseTemplateNames[\"error\"] = \"errorTpl\";\n RxBaseTemplateNames[\"complete\"] = \"completeTpl\";\n RxBaseTemplateNames[\"suspense\"] = \"suspenseTpl\";\n return RxBaseTemplateNames;\n}(RxBaseTemplateNames || {});\n/** @internal **/\nfunction isRxRenderError(e) {\n return e != null && Array.isArray(e) && e.length === 2 && e[0] instanceof Error;\n}\n/** @internal **/\nfunction createErrorHandler(_handler) {\n const _handleError = _handler ? e => _handler.handleError(e) : console.error;\n return {\n handleError: error => {\n if (isRxRenderError(error)) {\n _handleError(error[0]);\n console.error('additionalErrorContext', error[1]);\n } else {\n _handleError(error);\n }\n }\n };\n}\n/** @internal **/\nfunction toRenderError(e, context) {\n return [e, context];\n}\n\n/**\n * @internal\n *\n * A factory function that returns a map of projections to turn a notification of a Observable (next, error, complete)\n *\n * @param customNextContext - projection function to provide custom properties as well as override existing\n */\nfunction notificationKindToViewContext(customNextContext) {\n // @TODO rethink overrides\n return {\n suspense: notification => {\n const $implicit = notification.value;\n return {\n $implicit,\n suspense: true,\n error: false,\n complete: false,\n ...customNextContext($implicit)\n };\n },\n next: notification => {\n const $implicit = notification.value;\n return {\n $implicit,\n suspense: false,\n error: false,\n complete: false,\n ...customNextContext($implicit)\n };\n },\n error: notification => {\n const $implicit = notification.value;\n return {\n $implicit,\n complete: false,\n error: notification.error || true,\n suspense: false,\n ...customNextContext($implicit)\n };\n },\n complete: notification => {\n const $implicit = notification.value;\n return {\n $implicit,\n error: false,\n complete: true,\n suspense: false,\n ...customNextContext($implicit)\n };\n }\n };\n}\nfunction createTemplateManager(config) {\n const {\n renderSettings,\n notificationToTemplateName,\n templateSettings\n } = config;\n const {\n defaultStrategyName,\n strategies,\n cdRef: injectingViewCdRef,\n patchZone,\n parent\n } = renderSettings;\n const errorHandler = createErrorHandler(renderSettings.errorHandler);\n const ngZone = patchZone ? patchZone : undefined;\n let activeTemplate;\n const strategyHandling$ = strategyHandling(defaultStrategyName, strategies);\n const templates = templateHandling(templateSettings.viewContainerRef);\n const viewContainerRef = templateSettings.viewContainerRef;\n const triggerHandling = config.templateTrigger$ || EMPTY;\n const getContext = notificationKindToViewContext(templateSettings.customContext || (() => ({})));\n return {\n addTemplateRef: (name, templateRef) => {\n templates.add(name, templateRef);\n },\n nextStrategy: strategyHandling$.next,\n render(values$) {\n let trg;\n let notification = {\n value: undefined,\n complete: false,\n error: false,\n kind: \"suspense\" /* RxNotificationKind.Suspense */,\n hasValue: false\n };\n return merge(values$.pipe(tap(n => notification = n)), triggerHandling.pipe(tap(trigger => trg = trigger))).pipe(switchMap(() => {\n const contextKind = trg || notification.kind;\n trg = undefined;\n const value = notification.value;\n const templateName = notificationToTemplateName[contextKind](value, templates);\n return templates.get$(templateName).pipe(map(template => ({\n template,\n templateName,\n notification,\n contextKind\n })));\n }), withLatestFrom(strategyHandling$.strategy$),\n // Cancel old renders\n switchMap(([{\n template,\n templateName,\n notification,\n contextKind\n }, strategy]) => {\n const isNewTemplate = activeTemplate !== template || !template;\n const notifyParent = isNewTemplate && parent;\n return onStrategy(notification.value, strategy, (v, work, options) => {\n const context = getContext[contextKind](notification);\n if (isNewTemplate) {\n // template has changed (undefined => next; suspense => next; ...)\n // handle remove & insert\n // remove current view if there is any\n if (viewContainerRef.length > 0) {\n // patch removal if needed\n viewContainerRef.clear();\n }\n // create new view if any\n if (template) {\n // createEmbeddedView is already patched, no need for workFactory\n templates.createEmbeddedView(templateName, context);\n }\n } else if (template) {\n // template didn't change, update it\n // handle update\n const view = viewContainerRef.get(0);\n Object.keys(context).forEach(k => {\n view.context[k] = context[k];\n });\n // update view context, patch if needed\n work(view, options.scope, notification);\n }\n activeTemplate = template;\n }, {\n ngZone\n }\n // we don't need to specify any scope here. The template manager is the only one\n // who will call `viewRef#detectChanges` on any of the templates it manages.\n // whenever a new value comes in, any pre-scheduled work of this taskManager will\n // be nooped before a new work will be scheduled. This happens because of the implementation\n // of `StrategyCredential#behavior`\n ).pipe(notifyAllParentsIfNeeded(injectingViewCdRef, strategy, () => notifyParent, ngZone), catchError(e => {\n errorHandler.handleError(e);\n return of(e);\n }));\n }));\n }\n };\n}\n\n/**\n * @internal\n *\n * Factory that returns a `ListTemplateManager` for the passed params.\n *\n * @param templateSettings\n */\nfunction getTemplateHandler(templateSettings) {\n const {\n viewContainerRef,\n initialTemplateRef,\n createViewContext,\n updateViewContext\n } = templateSettings;\n return {\n updateUnchangedContext,\n insertView,\n moveView,\n removeView,\n getListChanges,\n updateView\n };\n // =====\n function updateUnchangedContext(item, index, count) {\n const view = viewContainerRef.get(index);\n updateViewContext(item, view, {\n count,\n index\n });\n view.detectChanges();\n }\n function moveView(oldIndex, item, index, count) {\n const oldView = viewContainerRef.get(oldIndex);\n const view = viewContainerRef.move(oldView, index);\n updateViewContext(item, view, {\n count,\n index\n });\n view.detectChanges();\n }\n function updateView(item, index, count) {\n const view = viewContainerRef.get(index);\n updateViewContext(item, view, {\n count,\n index\n });\n view.detectChanges();\n }\n function removeView(index) {\n return viewContainerRef.remove(index);\n }\n function insertView(item, index, count) {\n createEmbeddedView(viewContainerRef, initialTemplateRef, createViewContext(item, {\n count,\n index\n }), index);\n }\n}\n/**\n * @internal\n *\n * @param changes\n * @param items\n */\nfunction getListChanges(changes, items) {\n const changedIdxs = new Set();\n const changesArr = [];\n let notifyParent = false;\n changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {\n const item = record.item;\n if (record.previousIndex == null) {\n // insert\n changesArr.push(getInsertChange(item, currentIndex === null ? undefined : currentIndex));\n changedIdxs.add(item);\n notifyParent = true;\n } else if (currentIndex == null) {\n // remove\n changesArr.push(getRemoveChange(item, adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex));\n notifyParent = true;\n } else if (adjustedPreviousIndex !== null) {\n // move\n changesArr.push(getMoveChange(item, currentIndex, adjustedPreviousIndex));\n changedIdxs.add(item);\n notifyParent = true;\n }\n });\n changes.forEachIdentityChange(record => {\n const item = record.item;\n if (!changedIdxs.has(item)) {\n changesArr.push(getUpdateChange(item, record.currentIndex));\n changedIdxs.add(item);\n }\n });\n items.forEach((item, index) => {\n if (!changedIdxs.has(item)) {\n changesArr.push(getUnchangedChange(item, index));\n }\n });\n return [changesArr, notifyParent];\n // ==========\n function getMoveChange(item, currentIndex, adjustedPreviousIndex) {\n return [2 /* RxListTemplateChangeType.move */, [item, currentIndex, adjustedPreviousIndex]];\n }\n function getUpdateChange(item, currentIndex) {\n return [3 /* RxListTemplateChangeType.update */, [item, currentIndex]];\n }\n function getUnchangedChange(item, index) {\n return [4 /* RxListTemplateChangeType.context */, [item, index]];\n }\n function getInsertChange(item, currentIndex) {\n return [0 /* RxListTemplateChangeType.insert */, [item, currentIndex === null ? undefined : currentIndex]];\n }\n function getRemoveChange(item, adjustedPreviousIndex) {\n return [1 /* RxListTemplateChangeType.remove */, [item, adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex]];\n }\n}\nfunction createListTemplateManager(config) {\n const {\n templateSettings,\n renderSettings,\n trackBy,\n iterableDiffers\n } = config;\n const {\n defaultStrategyName,\n strategies,\n cdRef: injectingViewCdRef,\n patchZone,\n parent\n } = renderSettings;\n const errorHandler = createErrorHandler(renderSettings.errorHandler);\n const ngZone = patchZone ? patchZone : undefined;\n const strategyHandling$ = strategyHandling(defaultStrategyName, strategies);\n let _differ;\n function getDiffer(values) {\n if (_differ) {\n return _differ;\n }\n return values ? _differ = iterableDiffers.find(values).create(trackBy) : null;\n }\n // type, context\n /* TODO (regarding createView): this is currently not in use. for the list-manager this would mean to provide\n functions for not only create. developers than should have to provide create, move, remove,... the whole thing.\n i don't know if this is the right decision for a first RC */\n const listViewHandler = getTemplateHandler({\n ...templateSettings,\n initialTemplateRef: templateSettings.templateRef\n });\n const viewContainerRef = templateSettings.viewContainerRef;\n let notifyParent = false;\n let changesArr;\n let partiallyFinished = false;\n return {\n nextStrategy(nextConfig) {\n strategyHandling$.next(nextConfig);\n },\n render(values$) {\n return values$.pipe(render());\n }\n };\n function handleError() {\n return o$ => o$.pipe(catchError(err => {\n partiallyFinished = false;\n errorHandler.handleError(err);\n return of(null);\n }));\n }\n function render() {\n return o$ => combineLatest([o$, strategyHandling$.strategy$.pipe(distinctUntilChanged())]).pipe(map(([iterable, strategy]) => {\n const differ = getDiffer(iterable);\n let changes;\n if (differ) {\n if (partiallyFinished) {\n const currentIterable = [];\n for (let i = 0, ilen = viewContainerRef.length; i < ilen; i++) {\n const viewRef = viewContainerRef.get(i);\n currentIterable[i] = viewRef.context.$implicit;\n }\n differ.diff(currentIterable);\n }\n changes = differ.diff(iterable);\n }\n return {\n changes,\n iterable,\n strategy\n };\n }),\n // Cancel old renders\n switchMap(({\n changes,\n iterable,\n strategy\n }) => {\n if (!changes) {\n return of([]);\n }\n const values = iterable || [];\n // TODO: we might want to treat other iterables in a more performant way than Array.from()\n const items = Array.isArray(values) ? values : Array.from(iterable);\n const listChanges = listViewHandler.getListChanges(changes, items);\n changesArr = listChanges[0];\n const insertedOrRemoved = listChanges[1];\n const applyChanges$ = getObservablesFromChangesArray(changesArr, strategy, items.length);\n partiallyFinished = true;\n notifyParent = insertedOrRemoved && parent;\n return combineLatest(applyChanges$.length > 0 ? applyChanges$ : [of(null)]).pipe(tap(() => partiallyFinished = false), notifyAllParentsIfNeeded(injectingViewCdRef, strategy, () => notifyParent, ngZone), handleError(), map(() => iterable));\n }), handleError());\n }\n /**\n * @internal\n *\n * returns an array of streams which process all of the view updates needed to reflect the latest diff to the\n * viewContainer.\n * I\n *\n * @param changes\n * @param strategy\n * @param count\n */\n function getObservablesFromChangesArray(changes, strategy, count) {\n return changes.length > 0 ? changes.map(change => {\n const payload = change[1];\n return onStrategy(change[0], strategy, type => {\n switch (type) {\n case 0 /* RxListTemplateChangeType.insert */:\n listViewHandler.insertView(payload[0], payload[1], count);\n break;\n case 2 /* RxListTemplateChangeType.move */:\n listViewHandler.moveView(payload[2], payload[0], payload[1], count);\n break;\n case 1 /* RxListTemplateChangeType.remove */:\n listViewHandler.removeView(payload[1]);\n break;\n case 3 /* RxListTemplateChangeType.update */:\n listViewHandler.updateView(payload[0], payload[1], count);\n break;\n case 4 /* RxListTemplateChangeType.context */:\n listViewHandler.updateUnchangedContext(payload[0], payload[1], count);\n break;\n }\n }, {\n ngZone\n });\n }) : [of(null)];\n }\n}\nconst computeFirst = ({\n count,\n index\n}) => index === 0;\nconst computeLast = ({\n count,\n index\n}) => index === count - 1;\nconst computeEven = ({\n count,\n index\n}) => index % 2 === 0;\nclass RxDefaultListViewContext {\n _item = new ReplaySubject(1);\n item$ = this._item.asObservable();\n _$implicit;\n _$complete;\n _$error;\n _$suspense;\n _context$ = new BehaviorSubject({\n index: -1,\n count: -1\n });\n set $implicit($implicit) {\n this._$implicit = $implicit;\n this._item.next($implicit);\n }\n get $implicit() {\n return this._$implicit;\n }\n get $complete() {\n return this._$complete;\n }\n get $error() {\n return this._$error;\n }\n get $suspense() {\n return this._$suspense;\n }\n get index() {\n return this._context$.getValue().index;\n }\n get count() {\n return this._context$.getValue().count;\n }\n get first() {\n return computeFirst(this._context$.getValue());\n }\n get last() {\n return computeLast(this._context$.getValue());\n }\n get even() {\n return computeEven(this._context$.getValue());\n }\n get odd() {\n return !this.even;\n }\n get index$() {\n return this._context$.pipe(map(c => c.index), distinctUntilChanged());\n }\n get count$() {\n return this._context$.pipe(map(s => s.count), distinctUntilChanged());\n }\n get first$() {\n return this._context$.pipe(map(computeFirst), distinctUntilChanged());\n }\n get last$() {\n return this._context$.pipe(map(computeLast), distinctUntilChanged());\n }\n get even$() {\n return this._context$.pipe(map(computeEven), distinctUntilChanged());\n }\n get odd$() {\n return this.even$.pipe(map(even => !even));\n }\n constructor(item, customProps) {\n this.$implicit = item;\n if (customProps) {\n this.updateContext(customProps);\n }\n }\n updateContext(newProps) {\n this._context$.next({\n ...this._context$.getValue(),\n ...newProps\n });\n }\n select = props => {\n return this.item$.pipe(map(r => props.reduce((acc, key) => acc?.[key], r)));\n };\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { RxBaseTemplateNames, RxDefaultListViewContext, createListTemplateManager, createTemplateManager, templateHandling };\n","import * as i0 from '@angular/core';\nimport { inject, ChangeDetectorRef, NgZone, TemplateRef, ViewContainerRef, ErrorHandler, Directive, Input, Output } from '@angular/core';\nimport { coerceAllFactory } from '@rx-angular/cdk/coercing';\nimport { createTemplateNotifier } from '@rx-angular/cdk/notifications';\nimport { RxStrategyProvider } from '@rx-angular/cdk/render-strategies';\nimport { RxBaseTemplateNames, createTemplateManager } from '@rx-angular/cdk/template';\nimport { ReplaySubject, Subscription, Subject, defer, merge, NEVER } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\n\n/** @internal */\nconst RxLetTemplateNames = {\n ...RxBaseTemplateNames,\n next: 'nextTpl'\n};\n/**\n * @Directive RxLet\n *\n * @description\n * In Angular there is one way to handle asynchronous values or streams in the template, the `async` pipe.\n * Even though the async pipe evaluates such values in the template, it is insufficient in many ways.\n * To name a few:\n * * it will only update the template when `NgZone` is also aware of the value change\n * * it leads to over rendering because it can only run global change detection\n * * it leads to too many subscriptions in the template\n * * it is cumbersome to work with values in the template\n *\n * read more about the LetDirective in the [official docs](https://www.rx-angular.io/docs/template/api/let-directive)\n *\n * **Conclusion - Structural directives**\n *\n * In contrast to global change detection, structural directives allow fine-grained control of change detection on a per directive basis.\n * The `LetDirective` comes with its own way to handle change detection in templates in a very efficient way.\n * However, the change detection behavior is configurable on a per directive or global basis.\n * This makes it possible to implement your own strategies, and also provides a migration path from large existing apps running with Angulars default change detection.\n *\n * This package helps to reduce code used to create composable action streams.\n * It mostly is used in combination with state management libs to handle user interaction and backend communication.\n *\n * ```html\n * \n * ...\n * \n * ```\n *\n *\n * @docsCategory LetDirective\n * @docsPage LetDirective\n * @publicApi\n */\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\nlet RxLet = /*#__PURE__*/(() => {\n class RxLet {\n /** @internal */\n strategyProvider = inject(RxStrategyProvider);\n /** @internal */\n cdRef = inject(ChangeDetectorRef);\n /** @internal */\n ngZone = inject(NgZone);\n /** @internal */\n nextTemplateRef = inject(TemplateRef);\n /** @internal */\n viewContainerRef = inject(ViewContainerRef);\n /** @internal */\n errorHandler = inject(ErrorHandler);\n static ngTemplateGuard_rxLet;\n /**\n * @description\n * The Observable or value to be bound to the context of a template.\n *\n * @example\n * const hero1 = {name: 'Batman'};\n * const hero$ = of(hero);\n *\n * \n * \n * \n *\n * \n * \n * \n *\n * @param { ObservableInput | U | null | undefined } rxLet\n */\n rxLet;\n /**\n * @description\n *\n * You can change the used `RenderStrategy` by using the `strategy` input of the `*rxLet`. It accepts\n * an `Observable` or [`RxStrategyNames`](https://github.com/rx-angular/rx-angular/blob/b0630f69017cc1871d093e976006066d5f2005b9/libs/cdk/render-strategies/src/lib/model.ts#L52).\n *\n * The default value for strategy is\n * [`normal`](https://www.rx-angular.io/docs/template/cdk/render-strategies/strategies/concurrent-strategies).\n *\n * Read more about this in the\n * [official docs](https://www.rx-angular.io/docs/template/api/let-directive#use-render-strategies-strategy).\n *\n * @example\n *\n * \\@Component({\n * selector: 'app-root',\n * template: `\n * \n * \n * \n *\n * \n * \n * \n * `\n * })\n * export class AppComponent {\n * strategy = 'low';\n * strategy$ = of('immediate');\n * }\n *\n * @param { string | Observable | undefined } strategyName\n * @see {@link RxStrategyNames}\n */\n set strategy(strategyName) {\n this.strategyHandler.next(strategyName);\n }\n /**\n * @description\n * Defines the template for the complete state. Will be\n * shown when the bound Observable is in \"complete\" state.\n *\n * @example\n * \n * \n * \n * \n * thumb_up\n * \n *\n * @param { TemplateRef | null> } complete\n */\n complete;\n /**\n * @description\n * Defines the template for the error state. Will be\n * shown when the bound Observable is in \"error\" state.\n *\n * @example\n * \n * \n * \n * \n * thumb_down\n * \n *\n * @param { TemplateRef | null> } error\n */\n error;\n /**\n * @description\n * Defines the template for the suspense state. Will be\n * shown when the bound Observable is in \"suspense\" state.\n * Suspense means any undefined value, a never emitted value or `NEVER` itself.\n *\n * @example\n * \n * \n * \n * \n * \n * \n *\n * @param { TemplateRef | null> } suspense\n */\n suspense;\n /**\n * @description\n * A trigger to manually set the active template. It accepts a `RxNotificationKind`\n * which determines what template to display. If no template is given, a context\n * variable resembling the notification state is put into the `Next`\n * template of the directive\n *\n * @example\n * \n *\n * \n * \n * \n *\n * // trigger template from component.ts\n * contextTrigger$.next(RxNotificationKind.error)\n *\n * @param { Observable } contextTrigger\n * @see {@link RxNotificationKind}\n */\n contextTrigger;\n /**\n * @description\n * A trigger to manually activate the complete template. It accepts any value,\n * on emission it will display the error template. If no template is given,\n * the complete context variable will complete set to true instead.\n *\n * @example\n * \n *\n * \n * \n * \n *\n * // trigger template from component.ts\n * completeTrigger$.next()\n *\n * @param { Observable } completeTrigger\n */\n completeTrigger;\n /**\n * @description\n * A trigger to manually activate the error template. It accepts any value,\n * on emission it will display the error template. If no template is given,\n * the error context variable will be set to true instead.\n *\n * @example\n * \n *\n * \n * \n * \n *\n * // trigger template from component.ts\n * errorTrigger$.next()\n *\n * @param { Observable } errorTrigger\n */\n errorTrigger;\n /**\n * @description\n * A trigger to manually activate the suspense template. It accepts any value,\n * on emission it will display the suspense template. If no template is given,\n * the suspense context variable will be set to true instead.\n *\n * @example\n * \n *\n * \n * \n * \n *\n *\n * // trigger template from component.ts\n * suspenseTrigger$.next()\n *\n * @param { Observable } suspenseTrigger\n */\n suspenseTrigger;\n /**\n * @description\n * A trigger to manually activate the default template. It accepts any value,\n * on emission it will switch to the let directives default template.\n *\n * @example\n * \n *\n * \n * \n *\n * \n *\n * // trigger template from component.ts\n * nextTrigger$.next()\n *\n * @param { Observable } nextTrigger\n */\n nextTrigger;\n /**\n * @description\n * A `Subject` which emits whenever *rxFor finished rendering a set changes to the view.\n * This enables developers to perform actions when a list has finished rendering.\n * The `renderCallback` is useful in situations where you rely on specific DOM properties like the `height` a\n * table after all items got rendered.\n * It is also possible to use the renderCallback in order to determine if a view should be visible or not. This\n * way developers can hide a list as long as it has not finished rendering.\n *\n * The result of the `renderCallback` will contain the currently rendered set of items in the iterable.\n *\n * @example\n * \\Component({\n * selector: 'app-root',\n * template: `\n * \n * \n *
{{ item.name }}
\n * \n *
\n * `\n * })\n * export class AppComponent {\n * items$: Observable = itemService.getItems();\n * trackItem = (idx, item) => item.id;\n * // this emits whenever rxFor finished rendering changes\n * itemsRendered = new Subject();\n *\n * constructor(elementRef: ElementRef) {\n * itemsRendered.subscribe(() => {\n * // items are rendered, we can now scroll\n * elementRef.scrollTo({bottom: 0});\n * })\n * }\n * }\n *\n * @param {Subject} renderCallback\n */\n set renderCallback(callback) {\n this._renderObserver = callback;\n }\n /**\n * @description\n *\n * When local rendering strategies are used, we need to treat view and content queries in a\n * special way.\n * To make `*rxLet` in such situations, a certain mechanism is implemented to\n * execute change detection on the parent (`parent`).\n *\n * This is required if your components state is dependent on its view or content children:\n *\n * - `@ViewChild`\n * - `@ViewChildren`\n * - `@ContentChild`\n * - `@ContentChildren`\n *\n * Read more about this in the\n * [official\n * docs](https://www.rx-angular.io/docs/template/api/let-directive#local-strategies-and-view-content-queries-parent).\n *\n * @example\n * \\@Component({\n * selector: 'app-root',\n * template: `\n * \n * \n *
{{ item.name }}
\n * \n *
\n * `\n * })\n * export class AppComponent {\n * item$ = itemService.getItem();\n * }\n *\n * @param boolean\n */\n renderParent = this.strategyProvider.config.parent;\n /**\n * @description\n * A flag to control whether *rxLet templates are created within `NgZone` or not.\n * The default value is `true, `*rxLet` will create it's `EmbeddedViews` inside `NgZone`.\n *\n * Event listeners normally trigger zone. Especially high frequently events cause performance issues.\n *\n * Read more about this in the\n * [official docs](https://www.rx-angular.io/docs/template/api/let-directive#working-with-event-listeners-patchzone).\n *\n * @example\n * \\@Component({\n * selector: 'app-root',\n * template: `\n * \n * \n *
{{ item.name }}
\n * \n *
\n * `\n * })\n * export class AppComponent {\n * item$ = itemService.getItem();\n * }\n */\n patchZone = this.strategyProvider.config.patchZone;\n /** @internal */\n observablesHandler = createTemplateNotifier();\n /** @internal */\n strategyHandler = coerceAllFactory(() => new ReplaySubject(1));\n /** @internal */\n triggerHandler = new ReplaySubject(1);\n /** @internal */\n _renderObserver;\n /** @internal */\n subscription = new Subscription();\n /** @internal */\n templateManager;\n /** @internal */\n rendered$ = new Subject();\n /** @internal */\n templateNotification$ = new Subject();\n /** @internal */\n values$ = this.observablesHandler.values$;\n rendered = defer(() => this.rendered$);\n /** @internal */\n static ngTemplateContextGuard(dir, ctx) {\n return true;\n }\n /** @internal */\n ngOnInit() {\n this.subscription.add(this.templateManager.render(merge(this.values$, this.templateNotification$)).subscribe(n => {\n this.rendered$.next(n);\n this._renderObserver?.next(n);\n }));\n this.subscription.add(merge(this.contextTrigger || NEVER, this.nextTrigger?.pipe(map(() => \"next\" /* RxNotificationKind.Next */)) || NEVER, this.suspenseTrigger?.pipe(map(() => \"suspense\" /* RxNotificationKind.Suspense */)) || NEVER, this.completeTrigger?.pipe(map(() => \"complete\" /* RxNotificationKind.Complete */)) || NEVER, this.errorTrigger?.pipe(map(() => \"error\" /* RxNotificationKind.Error */)) || NEVER).pipe(filter(v => !!v)).subscribe(t => this.triggerHandler.next(t)));\n }\n /** @internal */\n ngOnChanges(changes) {\n if (!this.templateManager) {\n this._createTemplateManager();\n }\n if (changes.complete) {\n this.templateManager.addTemplateRef(RxLetTemplateNames.complete, this.complete);\n }\n if (changes.suspense) {\n this.templateManager.addTemplateRef(RxLetTemplateNames.suspense, this.suspense);\n this.observablesHandler.withInitialSuspense(!!this.suspense);\n }\n if (changes.error) {\n this.templateManager.addTemplateRef(RxLetTemplateNames.error, this.error);\n }\n if (changes.rxLet) {\n this.observablesHandler.next(this.rxLet);\n }\n }\n /** @internal */\n ngOnDestroy() {\n this.subscription.unsubscribe();\n }\n /** @internal */\n _createTemplateManager() {\n this.templateManager = createTemplateManager({\n templateSettings: {\n viewContainerRef: this.viewContainerRef,\n customContext: rxLet => ({\n rxLet\n })\n },\n renderSettings: {\n cdRef: this.cdRef,\n parent: !!this.renderParent,\n patchZone: this.patchZone ? this.ngZone : false,\n defaultStrategyName: this.strategyProvider.primaryStrategy,\n strategies: this.strategyProvider.strategies,\n errorHandler: this.errorHandler\n },\n notificationToTemplateName: {\n [\"suspense\" /* RxNotificationKind.Suspense */]: () => this.suspense ? RxLetTemplateNames.suspense : RxLetTemplateNames.next,\n [\"next\" /* RxNotificationKind.Next */]: () => RxLetTemplateNames.next,\n [\"error\" /* RxNotificationKind.Error */]: () => this.error ? RxLetTemplateNames.error : RxLetTemplateNames.next,\n [\"complete\" /* RxNotificationKind.Complete */]: () => this.complete ? RxLetTemplateNames.complete : RxLetTemplateNames.next\n },\n templateTrigger$: this.triggerHandler\n });\n this.templateManager.addTemplateRef(RxLetTemplateNames.next, this.nextTemplateRef);\n this.templateManager.nextStrategy(this.strategyHandler.values$);\n }\n /** @nocollapse */\n static ɵfac = function RxLet_Factory(t) {\n return new (t || RxLet)();\n };\n /** @nocollapse */\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RxLet,\n selectors: [[\"\", \"rxLet\", \"\"]],\n inputs: {\n rxLet: \"rxLet\",\n strategy: [i0.ɵɵInputFlags.None, \"rxLetStrategy\", \"strategy\"],\n complete: [i0.ɵɵInputFlags.None, \"rxLetComplete\", \"complete\"],\n error: [i0.ɵɵInputFlags.None, \"rxLetError\", \"error\"],\n suspense: [i0.ɵɵInputFlags.None, \"rxLetSuspense\", \"suspense\"],\n contextTrigger: [i0.ɵɵInputFlags.None, \"rxLetContextTrigger\", \"contextTrigger\"],\n completeTrigger: [i0.ɵɵInputFlags.None, \"rxLetCompleteTrigger\", \"completeTrigger\"],\n errorTrigger: [i0.ɵɵInputFlags.None, \"rxLetErrorTrigger\", \"errorTrigger\"],\n suspenseTrigger: [i0.ɵɵInputFlags.None, \"rxLetSuspenseTrigger\", \"suspenseTrigger\"],\n nextTrigger: [i0.ɵɵInputFlags.None, \"rxLetNextTrigger\", \"nextTrigger\"],\n renderCallback: [i0.ɵɵInputFlags.None, \"rxLetRenderCallback\", \"renderCallback\"],\n renderParent: [i0.ɵɵInputFlags.None, \"rxLetParent\", \"renderParent\"],\n patchZone: [i0.ɵɵInputFlags.None, \"rxLetPatchZone\", \"patchZone\"]\n },\n outputs: {\n rendered: \"rendered\"\n },\n standalone: true,\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n return RxLet;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { RxLet };\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Inject, Input, ContentChildren, Directive, NgModule } from '@angular/core';\nimport { setLines, MatLine, MatLineModule, MatCommonModule } from '@angular/material/core';\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport * as i1 from '@angular/cdk/bidi';\n\n/**\n * Class for determining, from a list of tiles, the (row, col) position of each of those tiles\n * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)\n * because the tiles can have a rowspan.\n *\n * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid\n * large enough to accommodate it so that the tiles still render in the same order in which they\n * are given.\n *\n * The basis of the algorithm is the use of an array to track the already placed tiles. Each\n * element of the array corresponds to a column, and the value indicates how many cells in that\n * column are already occupied; zero indicates an empty cell. Moving \"down\" to the next row\n * decrements each value in the tracking array (indicating that the column is one cell closer to\n * being free).\n *\n * @docs-private\n */\nconst _c0 = [\"*\"];\nconst _c1 = [[[\"\", \"mat-grid-avatar\", \"\"], [\"\", \"matGridAvatar\", \"\"]], [[\"\", \"mat-line\", \"\"], [\"\", \"matLine\", \"\"]], \"*\"];\nconst _c2 = [\"[mat-grid-avatar], [matGridAvatar]\", \"[mat-line], [matLine]\", \"*\"];\nconst _c3 = \".mat-grid-list{display:block;position:relative}.mat-grid-tile{display:block;position:absolute;overflow:hidden}.mat-grid-tile .mat-grid-tile-header,.mat-grid-tile .mat-grid-tile-footer{display:flex;align-items:center;height:48px;color:#fff;background:rgba(0,0,0,.38);overflow:hidden;padding:0 16px;position:absolute;left:0;right:0}.mat-grid-tile .mat-grid-tile-header>*,.mat-grid-tile .mat-grid-tile-footer>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-tile-header.mat-2-line,.mat-grid-tile .mat-grid-tile-footer.mat-2-line{height:68px}.mat-grid-tile .mat-grid-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden}.mat-grid-tile .mat-grid-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-list-text:empty{display:none}.mat-grid-tile .mat-grid-tile-header{top:0}.mat-grid-tile .mat-grid-tile-footer{bottom:0}.mat-grid-tile .mat-grid-avatar{padding-right:16px}[dir=rtl] .mat-grid-tile .mat-grid-avatar{padding-right:0;padding-left:16px}.mat-grid-tile .mat-grid-avatar:empty{display:none}.mat-grid-tile-header{font-size:var(--mat-grid-list-tile-header-primary-text-size)}.mat-grid-tile-header .mat-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;box-sizing:border-box}.mat-grid-tile-header .mat-line:nth-child(n+2){font-size:var(--mat-grid-list-tile-header-secondary-text-size)}.mat-grid-tile-footer{font-size:var(--mat-grid-list-tile-footer-primary-text-size)}.mat-grid-tile-footer .mat-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;box-sizing:border-box}.mat-grid-tile-footer .mat-line:nth-child(n+2){font-size:var(--mat-grid-list-tile-footer-secondary-text-size)}.mat-grid-tile-content{top:0;left:0;right:0;bottom:0;position:absolute;display:flex;align-items:center;justify-content:center;height:100%;padding:0;margin:0}\";\nclass TileCoordinator {\n constructor() {\n /** Index at which the search for the next gap will start. */\n this.columnIndex = 0;\n /** The current row index. */\n this.rowIndex = 0;\n }\n /** Gets the total number of rows occupied by tiles */\n get rowCount() {\n return this.rowIndex + 1;\n }\n /**\n * Gets the total span of rows occupied by tiles.\n * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.\n */\n get rowspan() {\n const lastRowMax = Math.max(...this.tracker);\n // if any of the tiles has a rowspan that pushes it beyond the total row count,\n // add the difference to the rowcount\n return lastRowMax > 1 ? this.rowCount + lastRowMax - 1 : this.rowCount;\n }\n /**\n * Updates the tile positions.\n * @param numColumns Amount of columns in the grid.\n * @param tiles Tiles to be positioned.\n */\n update(numColumns, tiles) {\n this.columnIndex = 0;\n this.rowIndex = 0;\n this.tracker = new Array(numColumns);\n this.tracker.fill(0, 0, this.tracker.length);\n this.positions = tiles.map(tile => this._trackTile(tile));\n }\n /** Calculates the row and col position of a tile. */\n _trackTile(tile) {\n // Find a gap large enough for this tile.\n const gapStartIndex = this._findMatchingGap(tile.colspan);\n // Place tile in the resulting gap.\n this._markTilePosition(gapStartIndex, tile);\n // The next time we look for a gap, the search will start at columnIndex, which should be\n // immediately after the tile that has just been placed.\n this.columnIndex = gapStartIndex + tile.colspan;\n return new TilePosition(this.rowIndex, gapStartIndex);\n }\n /** Finds the next available space large enough to fit the tile. */\n _findMatchingGap(tileCols) {\n if (tileCols > this.tracker.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`mat-grid-list: tile with colspan ${tileCols} is wider than ` + `grid with cols=\"${this.tracker.length}\".`);\n }\n // Start index is inclusive, end index is exclusive.\n let gapStartIndex = -1;\n let gapEndIndex = -1;\n // Look for a gap large enough to fit the given tile. Empty spaces are marked with a zero.\n do {\n // If we've reached the end of the row, go to the next row.\n if (this.columnIndex + tileCols > this.tracker.length) {\n this._nextRow();\n gapStartIndex = this.tracker.indexOf(0, this.columnIndex);\n gapEndIndex = this._findGapEndIndex(gapStartIndex);\n continue;\n }\n gapStartIndex = this.tracker.indexOf(0, this.columnIndex);\n // If there are no more empty spaces in this row at all, move on to the next row.\n if (gapStartIndex == -1) {\n this._nextRow();\n gapStartIndex = this.tracker.indexOf(0, this.columnIndex);\n gapEndIndex = this._findGapEndIndex(gapStartIndex);\n continue;\n }\n gapEndIndex = this._findGapEndIndex(gapStartIndex);\n // If a gap large enough isn't found, we want to start looking immediately after the current\n // gap on the next iteration.\n this.columnIndex = gapStartIndex + 1;\n // Continue iterating until we find a gap wide enough for this tile. Since gapEndIndex is\n // exclusive, gapEndIndex is 0 means we didn't find a gap and should continue.\n } while (gapEndIndex - gapStartIndex < tileCols || gapEndIndex == 0);\n // If we still didn't manage to find a gap, ensure that the index is\n // at least zero so the tile doesn't get pulled out of the grid.\n return Math.max(gapStartIndex, 0);\n }\n /** Move \"down\" to the next row. */\n _nextRow() {\n this.columnIndex = 0;\n this.rowIndex++;\n // Decrement all spaces by one to reflect moving down one row.\n for (let i = 0; i < this.tracker.length; i++) {\n this.tracker[i] = Math.max(0, this.tracker[i] - 1);\n }\n }\n /**\n * Finds the end index (exclusive) of a gap given the index from which to start looking.\n * The gap ends when a non-zero value is found.\n */\n _findGapEndIndex(gapStartIndex) {\n for (let i = gapStartIndex + 1; i < this.tracker.length; i++) {\n if (this.tracker[i] != 0) {\n return i;\n }\n }\n // The gap ends with the end of the row.\n return this.tracker.length;\n }\n /** Update the tile tracker to account for the given tile in the given space. */\n _markTilePosition(start, tile) {\n for (let i = 0; i < tile.colspan; i++) {\n this.tracker[start + i] = tile.rowspan;\n }\n }\n}\n/**\n * Simple data structure for tile position (row, col).\n * @docs-private\n */\nclass TilePosition {\n constructor(row, col) {\n this.row = row;\n this.col = col;\n }\n}\n\n/**\n * Injection token used to provide a grid list to a tile and to avoid circular imports.\n * @docs-private\n */\nconst MAT_GRID_LIST = /*#__PURE__*/new InjectionToken('MAT_GRID_LIST');\nlet MatGridTile = /*#__PURE__*/(() => {\n class MatGridTile {\n constructor(_element, _gridList) {\n this._element = _element;\n this._gridList = _gridList;\n this._rowspan = 1;\n this._colspan = 1;\n }\n /** Amount of rows that the grid tile takes up. */\n get rowspan() {\n return this._rowspan;\n }\n set rowspan(value) {\n this._rowspan = Math.round(coerceNumberProperty(value));\n }\n /** Amount of columns that the grid tile takes up. */\n get colspan() {\n return this._colspan;\n }\n set colspan(value) {\n this._colspan = Math.round(coerceNumberProperty(value));\n }\n /**\n * Sets the style of the grid-tile element. Needs to be set manually to avoid\n * \"Changed after checked\" errors that would occur with HostBinding.\n */\n _setStyle(property, value) {\n this._element.nativeElement.style[property] = value;\n }\n static {\n this.ɵfac = function MatGridTile_Factory(t) {\n return new (t || MatGridTile)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MAT_GRID_LIST, 8));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: MatGridTile,\n selectors: [[\"mat-grid-tile\"]],\n hostAttrs: [1, \"mat-grid-tile\"],\n hostVars: 2,\n hostBindings: function MatGridTile_HostBindings(rf, ctx) {\n if (rf & 2) {\n i0.ɵɵattribute(\"rowspan\", ctx.rowspan)(\"colspan\", ctx.colspan);\n }\n },\n inputs: {\n rowspan: \"rowspan\",\n colspan: \"colspan\"\n },\n exportAs: [\"matGridTile\"],\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n ngContentSelectors: _c0,\n decls: 2,\n vars: 0,\n consts: [[1, \"mat-grid-tile-content\"]],\n template: function MatGridTile_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef();\n i0.ɵɵelementStart(0, \"div\", 0);\n i0.ɵɵprojection(1);\n i0.ɵɵelementEnd();\n }\n },\n styles: [\".mat-grid-list{display:block;position:relative}.mat-grid-tile{display:block;position:absolute;overflow:hidden}.mat-grid-tile .mat-grid-tile-header,.mat-grid-tile .mat-grid-tile-footer{display:flex;align-items:center;height:48px;color:#fff;background:rgba(0,0,0,.38);overflow:hidden;padding:0 16px;position:absolute;left:0;right:0}.mat-grid-tile .mat-grid-tile-header>*,.mat-grid-tile .mat-grid-tile-footer>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-tile-header.mat-2-line,.mat-grid-tile .mat-grid-tile-footer.mat-2-line{height:68px}.mat-grid-tile .mat-grid-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden}.mat-grid-tile .mat-grid-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-list-text:empty{display:none}.mat-grid-tile .mat-grid-tile-header{top:0}.mat-grid-tile .mat-grid-tile-footer{bottom:0}.mat-grid-tile .mat-grid-avatar{padding-right:16px}[dir=rtl] .mat-grid-tile .mat-grid-avatar{padding-right:0;padding-left:16px}.mat-grid-tile .mat-grid-avatar:empty{display:none}.mat-grid-tile-header{font-size:var(--mat-grid-list-tile-header-primary-text-size)}.mat-grid-tile-header .mat-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;box-sizing:border-box}.mat-grid-tile-header .mat-line:nth-child(n+2){font-size:var(--mat-grid-list-tile-header-secondary-text-size)}.mat-grid-tile-footer{font-size:var(--mat-grid-list-tile-footer-primary-text-size)}.mat-grid-tile-footer .mat-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;box-sizing:border-box}.mat-grid-tile-footer .mat-line:nth-child(n+2){font-size:var(--mat-grid-list-tile-footer-secondary-text-size)}.mat-grid-tile-content{top:0;left:0;right:0;bottom:0;position:absolute;display:flex;align-items:center;justify-content:center;height:100%;padding:0;margin:0}\"],\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return MatGridTile;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet MatGridTileText = /*#__PURE__*/(() => {\n class MatGridTileText {\n constructor(_element) {\n this._element = _element;\n }\n ngAfterContentInit() {\n setLines(this._lines, this._element);\n }\n static {\n this.ɵfac = function MatGridTileText_Factory(t) {\n return new (t || MatGridTileText)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: MatGridTileText,\n selectors: [[\"mat-grid-tile-header\"], [\"mat-grid-tile-footer\"]],\n contentQueries: function MatGridTileText_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, MatLine, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx._lines = _t);\n }\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n ngContentSelectors: _c2,\n decls: 4,\n vars: 0,\n consts: [[1, \"mat-grid-list-text\"]],\n template: function MatGridTileText_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef(_c1);\n i0.ɵɵprojection(0);\n i0.ɵɵelementStart(1, \"div\", 0);\n i0.ɵɵprojection(2, 1);\n i0.ɵɵelementEnd();\n i0.ɵɵprojection(3, 2);\n }\n },\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return MatGridTileText;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Directive whose purpose is to add the mat- CSS styling to this selector.\n * @docs-private\n */\nlet MatGridAvatarCssMatStyler = /*#__PURE__*/(() => {\n class MatGridAvatarCssMatStyler {\n static {\n this.ɵfac = function MatGridAvatarCssMatStyler_Factory(t) {\n return new (t || MatGridAvatarCssMatStyler)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: MatGridAvatarCssMatStyler,\n selectors: [[\"\", \"mat-grid-avatar\", \"\"], [\"\", \"matGridAvatar\", \"\"]],\n hostAttrs: [1, \"mat-grid-avatar\"],\n standalone: true\n });\n }\n }\n return MatGridAvatarCssMatStyler;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Directive whose purpose is to add the mat- CSS styling to this selector.\n * @docs-private\n */\nlet MatGridTileHeaderCssMatStyler = /*#__PURE__*/(() => {\n class MatGridTileHeaderCssMatStyler {\n static {\n this.ɵfac = function MatGridTileHeaderCssMatStyler_Factory(t) {\n return new (t || MatGridTileHeaderCssMatStyler)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: MatGridTileHeaderCssMatStyler,\n selectors: [[\"mat-grid-tile-header\"]],\n hostAttrs: [1, \"mat-grid-tile-header\"],\n standalone: true\n });\n }\n }\n return MatGridTileHeaderCssMatStyler;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Directive whose purpose is to add the mat- CSS styling to this selector.\n * @docs-private\n */\nlet MatGridTileFooterCssMatStyler = /*#__PURE__*/(() => {\n class MatGridTileFooterCssMatStyler {\n static {\n this.ɵfac = function MatGridTileFooterCssMatStyler_Factory(t) {\n return new (t || MatGridTileFooterCssMatStyler)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: MatGridTileFooterCssMatStyler,\n selectors: [[\"mat-grid-tile-footer\"]],\n hostAttrs: [1, \"mat-grid-tile-footer\"],\n standalone: true\n });\n }\n }\n return MatGridTileFooterCssMatStyler;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * RegExp that can be used to check whether a value will\n * be allowed inside a CSS `calc()` expression.\n */\nconst cssCalcAllowedValue = /^-?\\d+((\\.\\d+)?[A-Za-z%$]?)+$/;\n/**\n * Sets the style properties for an individual tile, given the position calculated by the\n * Tile Coordinator.\n * @docs-private\n */\nclass TileStyler {\n constructor() {\n this._rows = 0;\n this._rowspan = 0;\n }\n /**\n * Adds grid-list layout info once it is available. Cannot be processed in the constructor\n * because these properties haven't been calculated by that point.\n *\n * @param gutterSize Size of the grid's gutter.\n * @param tracker Instance of the TileCoordinator.\n * @param cols Amount of columns in the grid.\n * @param direction Layout direction of the grid.\n */\n init(gutterSize, tracker, cols, direction) {\n this._gutterSize = normalizeUnits(gutterSize);\n this._rows = tracker.rowCount;\n this._rowspan = tracker.rowspan;\n this._cols = cols;\n this._direction = direction;\n }\n /**\n * Computes the amount of space a single 1x1 tile would take up (width or height).\n * Used as a basis for other calculations.\n * @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up.\n * @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile.\n * @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc().\n */\n getBaseTileSize(sizePercent, gutterFraction) {\n // Take the base size percent (as would be if evenly dividing the size between cells),\n // and then subtracting the size of one gutter. However, since there are no gutters on the\n // edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter\n // size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the\n // edge evenly among the cells).\n return `(${sizePercent}% - (${this._gutterSize} * ${gutterFraction}))`;\n }\n /**\n * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.\n * @param offset Number of tiles that have already been rendered in the row/column.\n * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).\n * @return Position of the tile as a CSS calc() expression.\n */\n getTilePosition(baseSize, offset) {\n // The position comes the size of a 1x1 tile plus gutter for each previous tile in the\n // row/column (offset).\n return offset === 0 ? '0' : calc(`(${baseSize} + ${this._gutterSize}) * ${offset}`);\n }\n /**\n * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.\n * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).\n * @param span The tile's rowspan or colspan.\n * @return Size of the tile as a CSS calc() expression.\n */\n getTileSize(baseSize, span) {\n return `(${baseSize} * ${span}) + (${span - 1} * ${this._gutterSize})`;\n }\n /**\n * Sets the style properties to be applied to a tile for the given row and column index.\n * @param tile Tile to which to apply the styling.\n * @param rowIndex Index of the tile's row.\n * @param colIndex Index of the tile's column.\n */\n setStyle(tile, rowIndex, colIndex) {\n // Percent of the available horizontal space that one column takes up.\n let percentWidthPerTile = 100 / this._cols;\n // Fraction of the vertical gutter size that each column takes up.\n // For example, if there are 5 columns, each column uses 4/5 = 0.8 times the gutter width.\n let gutterWidthFractionPerTile = (this._cols - 1) / this._cols;\n this.setColStyles(tile, colIndex, percentWidthPerTile, gutterWidthFractionPerTile);\n this.setRowStyles(tile, rowIndex, percentWidthPerTile, gutterWidthFractionPerTile);\n }\n /** Sets the horizontal placement of the tile in the list. */\n setColStyles(tile, colIndex, percentWidth, gutterWidth) {\n // Base horizontal size of a column.\n let baseTileWidth = this.getBaseTileSize(percentWidth, gutterWidth);\n // The width and horizontal position of each tile is always calculated the same way, but the\n // height and vertical position depends on the rowMode.\n let side = this._direction === 'rtl' ? 'right' : 'left';\n tile._setStyle(side, this.getTilePosition(baseTileWidth, colIndex));\n tile._setStyle('width', calc(this.getTileSize(baseTileWidth, tile.colspan)));\n }\n /**\n * Calculates the total size taken up by gutters across one axis of a list.\n */\n getGutterSpan() {\n return `${this._gutterSize} * (${this._rowspan} - 1)`;\n }\n /**\n * Calculates the total size taken up by tiles across one axis of a list.\n * @param tileHeight Height of the tile.\n */\n getTileSpan(tileHeight) {\n return `${this._rowspan} * ${this.getTileSize(tileHeight, 1)}`;\n }\n /**\n * Calculates the computed height and returns the correct style property to set.\n * This method can be implemented by each type of TileStyler.\n * @docs-private\n */\n getComputedHeight() {\n return null;\n }\n}\n/**\n * This type of styler is instantiated when the user passes in a fixed row height.\n * Example ``\n * @docs-private\n */\nclass FixedTileStyler extends TileStyler {\n constructor(fixedRowHeight) {\n super();\n this.fixedRowHeight = fixedRowHeight;\n }\n init(gutterSize, tracker, cols, direction) {\n super.init(gutterSize, tracker, cols, direction);\n this.fixedRowHeight = normalizeUnits(this.fixedRowHeight);\n if (!cssCalcAllowedValue.test(this.fixedRowHeight) && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`Invalid value \"${this.fixedRowHeight}\" set as rowHeight.`);\n }\n }\n setRowStyles(tile, rowIndex) {\n tile._setStyle('top', this.getTilePosition(this.fixedRowHeight, rowIndex));\n tile._setStyle('height', calc(this.getTileSize(this.fixedRowHeight, tile.rowspan)));\n }\n getComputedHeight() {\n return ['height', calc(`${this.getTileSpan(this.fixedRowHeight)} + ${this.getGutterSpan()}`)];\n }\n reset(list) {\n list._setListStyle(['height', null]);\n if (list._tiles) {\n list._tiles.forEach(tile => {\n tile._setStyle('top', null);\n tile._setStyle('height', null);\n });\n }\n }\n}\n/**\n * This type of styler is instantiated when the user passes in a width:height ratio\n * for the row height. Example ``\n * @docs-private\n */\nclass RatioTileStyler extends TileStyler {\n constructor(value) {\n super();\n this._parseRatio(value);\n }\n setRowStyles(tile, rowIndex, percentWidth, gutterWidth) {\n let percentHeightPerTile = percentWidth / this.rowHeightRatio;\n this.baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterWidth);\n // Use padding-top and margin-top to maintain the given aspect ratio, as\n // a percentage-based value for these properties is applied versus the *width* of the\n // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties\n tile._setStyle('marginTop', this.getTilePosition(this.baseTileHeight, rowIndex));\n tile._setStyle('paddingTop', calc(this.getTileSize(this.baseTileHeight, tile.rowspan)));\n }\n getComputedHeight() {\n return ['paddingBottom', calc(`${this.getTileSpan(this.baseTileHeight)} + ${this.getGutterSpan()}`)];\n }\n reset(list) {\n list._setListStyle(['paddingBottom', null]);\n list._tiles.forEach(tile => {\n tile._setStyle('marginTop', null);\n tile._setStyle('paddingTop', null);\n });\n }\n _parseRatio(value) {\n const ratioParts = value.split(':');\n if (ratioParts.length !== 2 && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`mat-grid-list: invalid ratio given for row-height: \"${value}\"`);\n }\n this.rowHeightRatio = parseFloat(ratioParts[0]) / parseFloat(ratioParts[1]);\n }\n}\n/**\n * This type of styler is instantiated when the user selects a \"fit\" row height mode.\n * In other words, the row height will reflect the total height of the container divided\n * by the number of rows. Example ``\n *\n * @docs-private\n */\nclass FitTileStyler extends TileStyler {\n setRowStyles(tile, rowIndex) {\n // Percent of the available vertical space that one row takes up.\n let percentHeightPerTile = 100 / this._rowspan;\n // Fraction of the horizontal gutter size that each column takes up.\n let gutterHeightPerTile = (this._rows - 1) / this._rows;\n // Base vertical size of a column.\n let baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile);\n tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex));\n tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan)));\n }\n reset(list) {\n if (list._tiles) {\n list._tiles.forEach(tile => {\n tile._setStyle('top', null);\n tile._setStyle('height', null);\n });\n }\n }\n}\n/** Wraps a CSS string in a calc function */\nfunction calc(exp) {\n return `calc(${exp})`;\n}\n/** Appends pixels to a CSS string if no units are given. */\nfunction normalizeUnits(value) {\n return value.match(/([A-Za-z%]+)$/) ? value : `${value}px`;\n}\n\n// TODO(kara): Conditional (responsive) column count / row size.\n// TODO(kara): Re-layout on window resize / media change (debounced).\n// TODO(kara): gridTileHeader and gridTileFooter.\nconst MAT_FIT_MODE = 'fit';\nlet MatGridList = /*#__PURE__*/(() => {\n class MatGridList {\n constructor(_element, _dir) {\n this._element = _element;\n this._dir = _dir;\n /** The amount of space between tiles. This will be something like '5px' or '2em'. */\n this._gutter = '1px';\n }\n /** Amount of columns in the grid list. */\n get cols() {\n return this._cols;\n }\n set cols(value) {\n this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));\n }\n /** Size of the grid list's gutter in pixels. */\n get gutterSize() {\n return this._gutter;\n }\n set gutterSize(value) {\n this._gutter = `${value == null ? '' : value}`;\n }\n /** Set internal representation of row height from the user-provided value. */\n get rowHeight() {\n return this._rowHeight;\n }\n set rowHeight(value) {\n const newValue = `${value == null ? '' : value}`;\n if (newValue !== this._rowHeight) {\n this._rowHeight = newValue;\n this._setTileStyler(this._rowHeight);\n }\n }\n ngOnInit() {\n this._checkCols();\n this._checkRowHeight();\n }\n /**\n * The layout calculation is fairly cheap if nothing changes, so there's little cost\n * to run it frequently.\n */\n ngAfterContentChecked() {\n this._layoutTiles();\n }\n /** Throw a friendly error if cols property is missing */\n _checkCols() {\n if (!this.cols && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`mat-grid-list: must pass in number of columns. ` + `Example: `);\n }\n }\n /** Default to equal width:height if rowHeight property is missing */\n _checkRowHeight() {\n if (!this._rowHeight) {\n this._setTileStyler('1:1');\n }\n }\n /** Creates correct Tile Styler subtype based on rowHeight passed in by user */\n _setTileStyler(rowHeight) {\n if (this._tileStyler) {\n this._tileStyler.reset(this);\n }\n if (rowHeight === MAT_FIT_MODE) {\n this._tileStyler = new FitTileStyler();\n } else if (rowHeight && rowHeight.indexOf(':') > -1) {\n this._tileStyler = new RatioTileStyler(rowHeight);\n } else {\n this._tileStyler = new FixedTileStyler(rowHeight);\n }\n }\n /** Computes and applies the size and position for all children grid tiles. */\n _layoutTiles() {\n if (!this._tileCoordinator) {\n this._tileCoordinator = new TileCoordinator();\n }\n const tracker = this._tileCoordinator;\n const tiles = this._tiles.filter(tile => !tile._gridList || tile._gridList === this);\n const direction = this._dir ? this._dir.value : 'ltr';\n this._tileCoordinator.update(this.cols, tiles);\n this._tileStyler.init(this.gutterSize, tracker, this.cols, direction);\n tiles.forEach((tile, index) => {\n const pos = tracker.positions[index];\n this._tileStyler.setStyle(tile, pos.row, pos.col);\n });\n this._setListStyle(this._tileStyler.getComputedHeight());\n }\n /** Sets style on the main grid-list element, given the style name and value. */\n _setListStyle(style) {\n if (style) {\n this._element.nativeElement.style[style[0]] = style[1];\n }\n }\n static {\n this.ɵfac = function MatGridList_Factory(t) {\n return new (t || MatGridList)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.Directionality, 8));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: MatGridList,\n selectors: [[\"mat-grid-list\"]],\n contentQueries: function MatGridList_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, MatGridTile, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx._tiles = _t);\n }\n },\n hostAttrs: [1, \"mat-grid-list\"],\n hostVars: 1,\n hostBindings: function MatGridList_HostBindings(rf, ctx) {\n if (rf & 2) {\n i0.ɵɵattribute(\"cols\", ctx.cols);\n }\n },\n inputs: {\n cols: \"cols\",\n gutterSize: \"gutterSize\",\n rowHeight: \"rowHeight\"\n },\n exportAs: [\"matGridList\"],\n standalone: true,\n features: [i0.ɵɵProvidersFeature([{\n provide: MAT_GRID_LIST,\n useExisting: MatGridList\n }]), i0.ɵɵStandaloneFeature],\n ngContentSelectors: _c0,\n decls: 2,\n vars: 0,\n template: function MatGridList_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef();\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵprojection(1);\n i0.ɵɵelementEnd();\n }\n },\n styles: [_c3],\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return MatGridList;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet MatGridListModule = /*#__PURE__*/(() => {\n class MatGridListModule {\n static {\n this.ɵfac = function MatGridListModule_Factory(t) {\n return new (t || MatGridListModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: MatGridListModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n imports: [MatLineModule, MatCommonModule, MatLineModule, MatCommonModule]\n });\n }\n }\n return MatGridListModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// Privately exported for the grid-list harness.\nconst ɵTileCoordinator = TileCoordinator;\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { MatGridAvatarCssMatStyler, MatGridList, MatGridListModule, MatGridTile, MatGridTileFooterCssMatStyler, MatGridTileHeaderCssMatStyler, MatGridTileText, ɵTileCoordinator };\n","import * as i0 from '@angular/core';\nimport { EventEmitter, Component, Output, Input, NgModule } from '@angular/core';\nimport * as i1 from '@angular/common';\nimport { DOCUMENT, CommonModule } from '@angular/common';\nimport { timer } from 'rxjs';\nfunction CircleProgressComponent__svg_svg_0__svg_linearGradient_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"linearGradient\");\n i0.ɵɵelement(1, \"stop\", 5)(2, \"stop\", 6);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext(2);\n i0.ɵɵattribute(\"id\", ctx_r1.svg.outerLinearGradient.id);\n i0.ɵɵadvance();\n i0.ɵɵattribute(\"stop-color\", ctx_r1.svg.outerLinearGradient.colorStop1)(\"stop-opacity\", 1);\n i0.ɵɵadvance();\n i0.ɵɵattribute(\"stop-color\", ctx_r1.svg.outerLinearGradient.colorStop2)(\"stop-opacity\", 1);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_radialGradient_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"radialGradient\");\n i0.ɵɵelement(1, \"stop\", 5)(2, \"stop\", 6);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r2 = i0.ɵɵnextContext(2);\n i0.ɵɵattribute(\"id\", ctx_r2.svg.radialGradient.id);\n i0.ɵɵadvance();\n i0.ɵɵattribute(\"stop-color\", ctx_r2.svg.radialGradient.colorStop1)(\"stop-opacity\", 1);\n i0.ɵɵadvance();\n i0.ɵɵattribute(\"stop-color\", ctx_r2.svg.radialGradient.colorStop2)(\"stop-opacity\", 1);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_4__svg_circle_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"circle\");\n }\n if (rf & 2) {\n const ctx_r8 = i0.ɵɵnextContext(3);\n i0.ɵɵattribute(\"cx\", ctx_r8.svg.backgroundCircle.cx)(\"cy\", ctx_r8.svg.backgroundCircle.cy)(\"r\", ctx_r8.svg.backgroundCircle.r)(\"fill\", ctx_r8.svg.backgroundCircle.fill)(\"fill-opacity\", ctx_r8.svg.backgroundCircle.fillOpacity)(\"stroke\", ctx_r8.svg.backgroundCircle.stroke)(\"stroke-width\", ctx_r8.svg.backgroundCircle.strokeWidth);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_4__svg_circle_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"circle\");\n }\n if (rf & 2) {\n const ctx_r9 = i0.ɵɵnextContext(3);\n i0.ɵɵattributeInterpolate2(\"fill\", \"url(\", ctx_r9.window.location.href, \"#\", ctx_r9.svg.radialGradient.id, \")\");\n i0.ɵɵattribute(\"cx\", ctx_r9.svg.backgroundCircle.cx)(\"cy\", ctx_r9.svg.backgroundCircle.cy)(\"r\", ctx_r9.svg.backgroundCircle.r)(\"fill-opacity\", ctx_r9.svg.backgroundCircle.fillOpacity)(\"stroke\", ctx_r9.svg.backgroundCircle.stroke)(\"stroke-width\", ctx_r9.svg.backgroundCircle.strokeWidth);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtemplate(1, CircleProgressComponent__svg_svg_0__svg_ng_container_4__svg_circle_1_Template, 1, 7, \"circle\", 2)(2, CircleProgressComponent__svg_svg_0__svg_ng_container_4__svg_circle_2_Template, 1, 8, \"circle\", 2);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", !ctx_r3.options.backgroundGradient);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r3.options.backgroundGradient);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_circle_5_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"circle\");\n }\n if (rf & 2) {\n const ctx_r4 = i0.ɵɵnextContext(2);\n i0.ɵɵattribute(\"cx\", ctx_r4.svg.circle.cx)(\"cy\", ctx_r4.svg.circle.cy)(\"r\", ctx_r4.svg.circle.r)(\"fill\", ctx_r4.svg.circle.fill)(\"stroke\", ctx_r4.svg.circle.stroke)(\"stroke-width\", ctx_r4.svg.circle.strokeWidth);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_6__svg_path_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"path\");\n }\n if (rf & 2) {\n const ctx_r10 = i0.ɵɵnextContext(3);\n i0.ɵɵattribute(\"d\", ctx_r10.svg.path.d)(\"stroke\", ctx_r10.svg.path.stroke)(\"stroke-width\", ctx_r10.svg.path.strokeWidth)(\"stroke-linecap\", ctx_r10.svg.path.strokeLinecap)(\"fill\", ctx_r10.svg.path.fill);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_6__svg_path_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"path\");\n }\n if (rf & 2) {\n const ctx_r11 = i0.ɵɵnextContext(3);\n i0.ɵɵattributeInterpolate2(\"stroke\", \"url(\", ctx_r11.window.location.href, \"#\", ctx_r11.svg.outerLinearGradient.id, \")\");\n i0.ɵɵattribute(\"d\", ctx_r11.svg.path.d)(\"stroke-width\", ctx_r11.svg.path.strokeWidth)(\"stroke-linecap\", ctx_r11.svg.path.strokeLinecap)(\"fill\", ctx_r11.svg.path.fill);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_ng_container_6_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtemplate(1, CircleProgressComponent__svg_svg_0__svg_ng_container_6__svg_path_1_Template, 1, 5, \"path\", 2)(2, CircleProgressComponent__svg_svg_0__svg_ng_container_6__svg_path_2_Template, 1, 6, \"path\", 2);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r5 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", !ctx_r5.options.outerStrokeGradient);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r5.options.outerStrokeGradient);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_1__svg_tspan_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"tspan\");\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const tspan_r16 = ctx.$implicit;\n const ctx_r15 = i0.ɵɵnextContext(4);\n i0.ɵɵattribute(\"x\", ctx_r15.svg.title.x)(\"y\", ctx_r15.svg.title.y)(\"dy\", tspan_r16.dy)(\"font-size\", ctx_r15.svg.title.fontSize)(\"font-weight\", ctx_r15.svg.title.fontWeight)(\"fill\", ctx_r15.svg.title.color);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(tspan_r16.span);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtemplate(1, CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_1__svg_tspan_1_Template, 2, 7, \"tspan\", 8);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r12 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngForOf\", ctx_r12.svg.title.tspans);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7__svg_tspan_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"tspan\");\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r13 = i0.ɵɵnextContext(3);\n i0.ɵɵattribute(\"font-size\", ctx_r13.svg.units.fontSize)(\"font-weight\", ctx_r13.svg.units.fontWeight)(\"fill\", ctx_r13.svg.units.color);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(ctx_r13.svg.units.text);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_3__svg_tspan_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"tspan\");\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const tspan_r18 = ctx.$implicit;\n const ctx_r17 = i0.ɵɵnextContext(4);\n i0.ɵɵattribute(\"x\", ctx_r17.svg.subtitle.x)(\"y\", ctx_r17.svg.subtitle.y)(\"dy\", tspan_r18.dy)(\"font-size\", ctx_r17.svg.subtitle.fontSize)(\"font-weight\", ctx_r17.svg.subtitle.fontWeight)(\"fill\", ctx_r17.svg.subtitle.color);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(tspan_r18.span);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtemplate(1, CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_3__svg_tspan_1_Template, 2, 7, \"tspan\", 8);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r14 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngForOf\", ctx_r14.svg.subtitle.tspans);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_text_7_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"text\", 7);\n i0.ɵɵtemplate(1, CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_1_Template, 2, 1, \"ng-container\", 2)(2, CircleProgressComponent__svg_svg_0__svg_text_7__svg_tspan_2_Template, 2, 4, \"tspan\", 2)(3, CircleProgressComponent__svg_svg_0__svg_text_7__svg_ng_container_3_Template, 2, 1, \"ng-container\", 2);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r6 = i0.ɵɵnextContext(2);\n i0.ɵɵattribute(\"x\", ctx_r6.svg.circle.cx)(\"y\", ctx_r6.svg.circle.cy)(\"text-anchor\", ctx_r6.svg.title.textAnchor);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r6.options.showTitle);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r6.options.showUnits);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r6.options.showSubtitle);\n }\n}\nfunction CircleProgressComponent__svg_svg_0__svg_image_8_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelement(0, \"image\", 9);\n }\n if (rf & 2) {\n const ctx_r7 = i0.ɵɵnextContext(2);\n i0.ɵɵattribute(\"height\", ctx_r7.svg.image.height)(\"width\", ctx_r7.svg.image.width)(\"href\", ctx_r7.svg.image.src, null, \"xlink\")(\"x\", ctx_r7.svg.image.x)(\"y\", ctx_r7.svg.image.y);\n }\n}\nfunction CircleProgressComponent__svg_svg_0_Template(rf, ctx) {\n if (rf & 1) {\n const _r20 = i0.ɵɵgetCurrentView();\n i0.ɵɵnamespaceSVG();\n i0.ɵɵelementStart(0, \"svg\", 1);\n i0.ɵɵlistener(\"click\", function CircleProgressComponent__svg_svg_0_Template__svg_svg_click_0_listener($event) {\n i0.ɵɵrestoreView(_r20);\n const ctx_r19 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r19.emitClickEvent($event));\n });\n i0.ɵɵelementStart(1, \"defs\");\n i0.ɵɵtemplate(2, CircleProgressComponent__svg_svg_0__svg_linearGradient_2_Template, 3, 5, \"linearGradient\", 2)(3, CircleProgressComponent__svg_svg_0__svg_radialGradient_3_Template, 3, 5, \"radialGradient\", 2);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(4, CircleProgressComponent__svg_svg_0__svg_ng_container_4_Template, 3, 2, \"ng-container\", 2)(5, CircleProgressComponent__svg_svg_0__svg_circle_5_Template, 1, 6, \"circle\", 2)(6, CircleProgressComponent__svg_svg_0__svg_ng_container_6_Template, 3, 2, \"ng-container\", 2)(7, CircleProgressComponent__svg_svg_0__svg_text_7_Template, 4, 6, \"text\", 3)(8, CircleProgressComponent__svg_svg_0__svg_image_8_Template, 1, 5, \"image\", 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r0 = i0.ɵɵnextContext();\n i0.ɵɵattribute(\"viewBox\", ctx_r0.svg.viewBox)(\"height\", ctx_r0.svg.height)(\"width\", ctx_r0.svg.width)(\"class\", ctx_r0.options.class);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", ctx_r0.options.outerStrokeGradient);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r0.options.backgroundGradient);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r0.options.showBackground);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r0.options.showInnerStroke);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", +ctx_r0.options.percent !== 0 || ctx_r0.options.showZeroOuterStroke);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", !ctx_r0.options.showImage && (ctx_r0.options.showTitle || ctx_r0.options.showUnits || ctx_r0.options.showSubtitle));\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r0.options.showImage);\n }\n}\nclass CircleProgressOptions {\n constructor() {\n this.class = '';\n this.backgroundGradient = false;\n this.backgroundColor = 'transparent';\n this.backgroundGradientStopColor = 'transparent';\n this.backgroundOpacity = 1;\n this.backgroundStroke = 'transparent';\n this.backgroundStrokeWidth = 0;\n this.backgroundPadding = 5;\n this.percent = 0;\n this.radius = 90;\n this.space = 4;\n this.toFixed = 0;\n this.maxPercent = 1000;\n this.renderOnClick = true;\n this.units = '%';\n this.unitsFontSize = '10';\n this.unitsFontWeight = 'normal';\n this.unitsColor = '#444444';\n this.outerStrokeGradient = false;\n this.outerStrokeWidth = 8;\n this.outerStrokeColor = '#78C000';\n this.outerStrokeGradientStopColor = 'transparent';\n this.outerStrokeLinecap = 'round';\n this.innerStrokeColor = '#C7E596';\n this.innerStrokeWidth = 4;\n this.titleFormat = undefined;\n this.title = 'auto';\n this.titleColor = '#444444';\n this.titleFontSize = '20';\n this.titleFontWeight = 'normal';\n this.subtitleFormat = undefined;\n this.subtitle = 'progress';\n this.subtitleColor = '#A9A9A9';\n this.subtitleFontSize = '10';\n this.subtitleFontWeight = 'normal';\n this.imageSrc = undefined;\n this.imageHeight = 0;\n this.imageWidth = 0;\n this.animation = true;\n this.animateTitle = true;\n this.animateSubtitle = false;\n this.animationDuration = 500;\n this.showTitle = true;\n this.showSubtitle = true;\n this.showUnits = true;\n this.showImage = false;\n this.showBackground = true;\n this.showInnerStroke = true;\n this.clockwise = true;\n this.responsive = false;\n this.startFromZero = true;\n this.showZeroOuterStroke = true;\n this.lazy = false;\n }\n}\nlet CircleProgressComponent = /*#__PURE__*/(() => {\n class CircleProgressComponent {\n constructor(defaultOptions, ngZone, elRef, injector) {\n this.ngZone = ngZone;\n this.elRef = elRef;\n this.onClick = new EventEmitter();\n // of component\n this.svgElement = null;\n // whether is in viewport\n this.isInViewport = false;\n // event for notifying viewport change caused by scrolling or resizing\n this.onViewportChanged = new EventEmitter();\n this._viewportChangedSubscriber = null;\n this.options = new CircleProgressOptions();\n this.defaultOptions = new CircleProgressOptions();\n this._lastPercent = 0;\n this._gradientUUID = null;\n this.render = () => {\n this.applyOptions();\n if (this.options.lazy) {\n // Draw svg if it doesn't exist\n this.svgElement === null && this.draw(this._lastPercent);\n // Draw it only when it's in the viewport\n if (this.isInViewport) {\n // Draw it at the latest position when I am in.\n if (this.options.animation && this.options.animationDuration > 0) {\n this.animate(this._lastPercent, this.options.percent);\n } else {\n this.draw(this.options.percent);\n }\n this._lastPercent = this.options.percent;\n }\n } else {\n if (this.options.animation && this.options.animationDuration > 0) {\n this.animate(this._lastPercent, this.options.percent);\n } else {\n this.draw(this.options.percent);\n }\n this._lastPercent = this.options.percent;\n }\n };\n this.polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {\n let angleInRadius = angleInDegrees * Math.PI / 180;\n let x = centerX + Math.sin(angleInRadius) * radius;\n let y = centerY - Math.cos(angleInRadius) * radius;\n return {\n x: x,\n y: y\n };\n };\n this.draw = percent => {\n // make percent reasonable\n percent = percent === undefined ? this.options.percent : Math.abs(percent);\n // circle percent shouldn't be greater than 100%.\n let circlePercent = percent > 100 ? 100 : percent;\n // determine box size\n let boxSize = this.options.radius * 2 + this.options.outerStrokeWidth * 2;\n if (this.options.showBackground) {\n boxSize += this.options.backgroundStrokeWidth * 2 + this.max(0, this.options.backgroundPadding * 2);\n }\n // the centre of the circle\n let centre = {\n x: boxSize / 2,\n y: boxSize / 2\n };\n // the start point of the arc\n let startPoint = {\n x: centre.x,\n y: centre.y - this.options.radius\n };\n // get the end point of the arc\n let endPoint = this.polarToCartesian(centre.x, centre.y, this.options.radius, 360 * (this.options.clockwise ? circlePercent : 100 - circlePercent) / 100); // ####################\n // We'll get an end point with the same [x, y] as the start point when percent is 100%, so move x a little bit.\n if (circlePercent === 100) {\n endPoint.x = endPoint.x + (this.options.clockwise ? -0.01 : +0.01);\n }\n // largeArcFlag and sweepFlag\n let largeArcFlag, sweepFlag;\n if (circlePercent > 50) {\n [largeArcFlag, sweepFlag] = this.options.clockwise ? [1, 1] : [1, 0];\n } else {\n [largeArcFlag, sweepFlag] = this.options.clockwise ? [0, 1] : [0, 0];\n }\n // percent may not equal the actual percent\n let titlePercent = this.options.animateTitle ? percent : this.options.percent;\n let titleTextPercent = titlePercent > this.options.maxPercent ? `${this.options.maxPercent.toFixed(this.options.toFixed)}+` : titlePercent.toFixed(this.options.toFixed);\n let subtitlePercent = this.options.animateSubtitle ? percent : this.options.percent;\n // get title object\n let title = {\n x: centre.x,\n y: centre.y,\n textAnchor: 'middle',\n color: this.options.titleColor,\n fontSize: this.options.titleFontSize,\n fontWeight: this.options.titleFontWeight,\n texts: [],\n tspans: []\n };\n // from v0.9.9, both title and titleFormat(...) may be an array of string.\n if (this.options.titleFormat !== undefined && this.options.titleFormat.constructor.name === 'Function') {\n let formatted = this.options.titleFormat(titlePercent);\n if (formatted instanceof Array) {\n title.texts = [...formatted];\n } else {\n title.texts.push(formatted.toString());\n }\n } else {\n if (this.options.title === 'auto') {\n title.texts.push(titleTextPercent);\n } else {\n if (this.options.title instanceof Array) {\n title.texts = [...this.options.title];\n } else {\n title.texts.push(this.options.title.toString());\n }\n }\n }\n // get subtitle object\n let subtitle = {\n x: centre.x,\n y: centre.y,\n textAnchor: 'middle',\n color: this.options.subtitleColor,\n fontSize: this.options.subtitleFontSize,\n fontWeight: this.options.subtitleFontWeight,\n texts: [],\n tspans: []\n };\n // from v0.9.9, both subtitle and subtitleFormat(...) may be an array of string.\n if (this.options.subtitleFormat !== undefined && this.options.subtitleFormat.constructor.name === 'Function') {\n let formatted = this.options.subtitleFormat(subtitlePercent);\n if (formatted instanceof Array) {\n subtitle.texts = [...formatted];\n } else {\n subtitle.texts.push(formatted.toString());\n }\n } else {\n if (this.options.subtitle instanceof Array) {\n subtitle.texts = [...this.options.subtitle];\n } else {\n subtitle.texts.push(this.options.subtitle.toString());\n }\n }\n // get units object\n let units = {\n text: `${this.options.units}`,\n fontSize: this.options.unitsFontSize,\n fontWeight: this.options.unitsFontWeight,\n color: this.options.unitsColor\n };\n // get total count of text lines to be shown\n let rowCount = 0,\n rowNum = 1;\n this.options.showTitle && (rowCount += title.texts.length);\n this.options.showSubtitle && (rowCount += subtitle.texts.length);\n // calc dy for each tspan for title\n if (this.options.showTitle) {\n for (let span of title.texts) {\n title.tspans.push({\n span: span,\n dy: this.getRelativeY(rowNum, rowCount)\n });\n rowNum++;\n }\n }\n // calc dy for each tspan for subtitle\n if (this.options.showSubtitle) {\n for (let span of subtitle.texts) {\n subtitle.tspans.push({\n span: span,\n dy: this.getRelativeY(rowNum, rowCount)\n });\n rowNum++;\n }\n }\n // create ID for gradient element\n if (null === this._gradientUUID) {\n this._gradientUUID = this.uuid();\n }\n // Bring it all together\n this.svg = {\n viewBox: `0 0 ${boxSize} ${boxSize}`,\n // Set both width and height to '100%' if it's responsive\n width: this.options.responsive ? '100%' : boxSize,\n height: this.options.responsive ? '100%' : boxSize,\n backgroundCircle: {\n cx: centre.x,\n cy: centre.y,\n r: this.options.radius + this.options.outerStrokeWidth / 2 + this.options.backgroundPadding,\n fill: this.options.backgroundColor,\n fillOpacity: this.options.backgroundOpacity,\n stroke: this.options.backgroundStroke,\n strokeWidth: this.options.backgroundStrokeWidth\n },\n path: {\n // A rx ry x-axis-rotation large-arc-flag sweep-flag x y (https://developer.mozilla.org/en/docs/Web/SVG/Tutorial/Paths#Arcs)\n d: `M ${startPoint.x} ${startPoint.y}\n A ${this.options.radius} ${this.options.radius} 0 ${largeArcFlag} ${sweepFlag} ${endPoint.x} ${endPoint.y}`,\n stroke: this.options.outerStrokeColor,\n strokeWidth: this.options.outerStrokeWidth,\n strokeLinecap: this.options.outerStrokeLinecap,\n fill: 'none'\n },\n circle: {\n cx: centre.x,\n cy: centre.y,\n r: this.options.radius - this.options.space - this.options.outerStrokeWidth / 2 - this.options.innerStrokeWidth / 2,\n fill: 'none',\n stroke: this.options.innerStrokeColor,\n strokeWidth: this.options.innerStrokeWidth\n },\n title: title,\n units: units,\n subtitle: subtitle,\n image: {\n x: centre.x - this.options.imageWidth / 2,\n y: centre.y - this.options.imageHeight / 2,\n src: this.options.imageSrc,\n width: this.options.imageWidth,\n height: this.options.imageHeight\n },\n outerLinearGradient: {\n id: 'outer-linear-' + this._gradientUUID,\n colorStop1: this.options.outerStrokeColor,\n colorStop2: this.options.outerStrokeGradientStopColor === 'transparent' ? '#FFF' : this.options.outerStrokeGradientStopColor\n },\n radialGradient: {\n id: 'radial-' + this._gradientUUID,\n colorStop1: this.options.backgroundColor,\n colorStop2: this.options.backgroundGradientStopColor === 'transparent' ? '#FFF' : this.options.backgroundGradientStopColor\n }\n };\n };\n this.getAnimationParameters = (previousPercent, currentPercent) => {\n const MIN_INTERVAL = 10;\n let times, step, interval;\n let fromPercent = this.options.startFromZero ? 0 : previousPercent < 0 ? 0 : previousPercent;\n let toPercent = currentPercent < 0 ? 0 : this.min(currentPercent, this.options.maxPercent);\n let delta = Math.abs(Math.round(toPercent - fromPercent));\n if (delta >= 100) {\n // we will finish animation in 100 times\n times = 100;\n if (!this.options.animateTitle && !this.options.animateSubtitle) {\n step = 1;\n } else {\n // show title or subtitle animation even if the arc is full, we also need to finish it in 100 times.\n step = Math.round(delta / times);\n }\n } else {\n // we will finish in as many times as the number of percent.\n times = delta;\n step = 1;\n }\n // Get the interval of timer\n interval = Math.round(this.options.animationDuration / times);\n // Readjust all values if the interval of timer is extremely small.\n if (interval < MIN_INTERVAL) {\n interval = MIN_INTERVAL;\n times = this.options.animationDuration / interval;\n if (!this.options.animateTitle && !this.options.animateSubtitle && delta > 100) {\n step = Math.round(100 / times);\n } else {\n step = Math.round(delta / times);\n }\n }\n // step must be greater than 0.\n if (step < 1) {\n step = 1;\n }\n return {\n times: times,\n step: step,\n interval: interval\n };\n };\n this.animate = (previousPercent, currentPercent) => {\n if (this._timerSubscription && !this._timerSubscription.closed) {\n this._timerSubscription.unsubscribe();\n }\n let fromPercent = this.options.startFromZero ? 0 : previousPercent;\n let toPercent = currentPercent;\n let {\n step: step,\n interval: interval\n } = this.getAnimationParameters(fromPercent, toPercent);\n let count = fromPercent;\n if (fromPercent < toPercent) {\n this._timerSubscription = timer(0, interval).subscribe(() => {\n count += step;\n if (count <= toPercent) {\n if (!this.options.animateTitle && !this.options.animateSubtitle && count >= 100) {\n this.draw(toPercent);\n this._timerSubscription.unsubscribe();\n } else {\n this.draw(count);\n }\n } else {\n this.draw(toPercent);\n this._timerSubscription.unsubscribe();\n }\n });\n } else {\n this._timerSubscription = timer(0, interval).subscribe(() => {\n count -= step;\n if (count >= toPercent) {\n if (!this.options.animateTitle && !this.options.animateSubtitle && toPercent >= 100) {\n this.draw(toPercent);\n this._timerSubscription.unsubscribe();\n } else {\n this.draw(count);\n }\n } else {\n this.draw(toPercent);\n this._timerSubscription.unsubscribe();\n }\n });\n }\n };\n this.applyOptions = () => {\n // the options of may change already\n for (let name of Object.keys(this.options)) {\n if (this.hasOwnProperty(name) && this[name] !== undefined) {\n this.options[name] = this[name];\n } else if (this.templateOptions && this.templateOptions[name] !== undefined) {\n this.options[name] = this.templateOptions[name];\n }\n }\n // make sure key options valid\n this.options.radius = Math.abs(+this.options.radius);\n this.options.space = +this.options.space;\n this.options.percent = +this.options.percent > 0 ? +this.options.percent : 0;\n this.options.maxPercent = Math.abs(+this.options.maxPercent);\n this.options.animationDuration = Math.abs(this.options.animationDuration);\n this.options.outerStrokeWidth = Math.abs(+this.options.outerStrokeWidth);\n this.options.innerStrokeWidth = Math.abs(+this.options.innerStrokeWidth);\n this.options.backgroundPadding = +this.options.backgroundPadding;\n };\n this.getRelativeY = (rowNum, rowCount) => {\n // why '-0.18em'? It's a magic number when property 'alignment-baseline' equals 'baseline'. :)\n let initialOffset = -0.18,\n offset = 1;\n return (initialOffset + offset * (rowNum - rowCount / 2)).toFixed(2) + 'em';\n };\n this.min = (a, b) => {\n return a < b ? a : b;\n };\n this.max = (a, b) => {\n return a > b ? a : b;\n };\n this.uuid = () => {\n // https://www.w3resource.com/javascript-exercises/javascript-math-exercise-23.php\n var dt = new Date().getTime();\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (dt + Math.random() * 16) % 16 | 0;\n dt = Math.floor(dt / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n return uuid;\n };\n this.checkViewport = () => {\n this.findSvgElement();\n let previousValue = this.isInViewport;\n this.isInViewport = this.isElementInViewport(this.svgElement);\n if (previousValue !== this.isInViewport && this.onViewportChanged.observers.length > 0) {\n this.ngZone.run(() => {\n this.onViewportChanged.emit({\n oldValue: previousValue,\n newValue: this.isInViewport\n });\n });\n }\n };\n this.onScroll = event => {\n this.checkViewport();\n };\n this.loadEventsForLazyMode = () => {\n if (this.options.lazy) {\n this.ngZone.runOutsideAngular(() => {\n this.document.addEventListener('scroll', this.onScroll, true);\n this.window.addEventListener('resize', this.onScroll, true);\n });\n if (this._viewportChangedSubscriber === null) {\n this._viewportChangedSubscriber = this.onViewportChanged.subscribe(({\n oldValue,\n newValue\n }) => {\n newValue ? this.render() : null;\n });\n }\n // svgElement must be created in DOM before being checked.\n // Is there a better way to check the existence of svgElemnt?\n let _timer = timer(0, 50).subscribe(() => {\n this.svgElement === null ? this.checkViewport() : _timer.unsubscribe();\n });\n }\n };\n this.unloadEventsForLazyMode = () => {\n // Remove event listeners\n this.document.removeEventListener('scroll', this.onScroll, true);\n this.window.removeEventListener('resize', this.onScroll, true);\n // Unsubscribe onViewportChanged\n if (this._viewportChangedSubscriber !== null) {\n this._viewportChangedSubscriber.unsubscribe();\n this._viewportChangedSubscriber = null;\n }\n };\n this.document = injector.get(DOCUMENT);\n this.window = this.document.defaultView;\n Object.assign(this.options, defaultOptions);\n Object.assign(this.defaultOptions, defaultOptions);\n }\n emitClickEvent(event) {\n if (this.options.renderOnClick) {\n this.animate(0, this.options.percent);\n }\n if (this.onClick.observers.length > 0) {\n this.onClick.emit(event);\n }\n }\n isDrawing() {\n return this._timerSubscription && !this._timerSubscription.closed;\n }\n findSvgElement() {\n if (this.svgElement === null) {\n let tags = this.elRef.nativeElement.getElementsByTagName('svg');\n if (tags.length > 0) {\n this.svgElement = tags[0];\n }\n }\n }\n isElementInViewport(el) {\n // Return false if el has not been created in page.\n if (el === null || el === undefined) return false;\n // Check if the element is out of view due to a container scrolling\n let rect = el.getBoundingClientRect(),\n parent = el.parentNode,\n parentRect;\n do {\n parentRect = parent.getBoundingClientRect();\n if (rect.top >= parentRect.bottom) return false;\n if (rect.bottom <= parentRect.top) return false;\n if (rect.left >= parentRect.right) return false;\n if (rect.right <= parentRect.left) return false;\n parent = parent.parentNode;\n } while (parent != this.document.body);\n // Check its within the document viewport\n if (rect.top >= (this.window.innerHeight || this.document.documentElement.clientHeight)) return false;\n if (rect.bottom <= 0) return false;\n if (rect.left >= (this.window.innerWidth || this.document.documentElement.clientWidth)) return false;\n if (rect.right <= 0) return false;\n return true;\n }\n ngOnInit() {\n this.loadEventsForLazyMode();\n }\n ngOnDestroy() {\n this.unloadEventsForLazyMode();\n }\n ngOnChanges(changes) {\n this.render();\n if ('lazy' in changes) {\n changes.lazy.currentValue ? this.loadEventsForLazyMode() : this.unloadEventsForLazyMode();\n }\n }\n }\n CircleProgressComponent.ɵfac = function CircleProgressComponent_Factory(t) {\n return new (t || CircleProgressComponent)(i0.ɵɵdirectiveInject(CircleProgressOptions), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Injector));\n };\n CircleProgressComponent.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: CircleProgressComponent,\n selectors: [[\"circle-progress\"]],\n inputs: {\n name: \"name\",\n class: \"class\",\n backgroundGradient: \"backgroundGradient\",\n backgroundColor: \"backgroundColor\",\n backgroundGradientStopColor: \"backgroundGradientStopColor\",\n backgroundOpacity: \"backgroundOpacity\",\n backgroundStroke: \"backgroundStroke\",\n backgroundStrokeWidth: \"backgroundStrokeWidth\",\n backgroundPadding: \"backgroundPadding\",\n radius: \"radius\",\n space: \"space\",\n percent: \"percent\",\n toFixed: \"toFixed\",\n maxPercent: \"maxPercent\",\n renderOnClick: \"renderOnClick\",\n units: \"units\",\n unitsFontSize: \"unitsFontSize\",\n unitsFontWeight: \"unitsFontWeight\",\n unitsColor: \"unitsColor\",\n outerStrokeGradient: \"outerStrokeGradient\",\n outerStrokeWidth: \"outerStrokeWidth\",\n outerStrokeColor: \"outerStrokeColor\",\n outerStrokeGradientStopColor: \"outerStrokeGradientStopColor\",\n outerStrokeLinecap: \"outerStrokeLinecap\",\n innerStrokeColor: \"innerStrokeColor\",\n innerStrokeWidth: \"innerStrokeWidth\",\n titleFormat: \"titleFormat\",\n title: \"title\",\n titleColor: \"titleColor\",\n titleFontSize: \"titleFontSize\",\n titleFontWeight: \"titleFontWeight\",\n subtitleFormat: \"subtitleFormat\",\n subtitle: \"subtitle\",\n subtitleColor: \"subtitleColor\",\n subtitleFontSize: \"subtitleFontSize\",\n subtitleFontWeight: \"subtitleFontWeight\",\n imageSrc: \"imageSrc\",\n imageHeight: \"imageHeight\",\n imageWidth: \"imageWidth\",\n animation: \"animation\",\n animateTitle: \"animateTitle\",\n animateSubtitle: \"animateSubtitle\",\n animationDuration: \"animationDuration\",\n showTitle: \"showTitle\",\n showSubtitle: \"showSubtitle\",\n showUnits: \"showUnits\",\n showImage: \"showImage\",\n showBackground: \"showBackground\",\n showInnerStroke: \"showInnerStroke\",\n clockwise: \"clockwise\",\n responsive: \"responsive\",\n startFromZero: \"startFromZero\",\n showZeroOuterStroke: \"showZeroOuterStroke\",\n lazy: \"lazy\",\n templateOptions: [i0.ɵɵInputFlags.None, \"options\", \"templateOptions\"]\n },\n outputs: {\n onClick: \"onClick\"\n },\n features: [i0.ɵɵNgOnChangesFeature],\n decls: 1,\n vars: 1,\n consts: [[\"xmlns\", \"http://www.w3.org/2000/svg\", \"preserveAspectRatio\", \"xMidYMid meet\", 3, \"click\", 4, \"ngIf\"], [\"xmlns\", \"http://www.w3.org/2000/svg\", \"preserveAspectRatio\", \"xMidYMid meet\", 3, \"click\"], [4, \"ngIf\"], [\"alignment-baseline\", \"baseline\", 4, \"ngIf\"], [\"preserveAspectRatio\", \"none\", 4, \"ngIf\"], [\"offset\", \"5%\"], [\"offset\", \"95%\"], [\"alignment-baseline\", \"baseline\"], [4, \"ngFor\", \"ngForOf\"], [\"preserveAspectRatio\", \"none\"]],\n template: function CircleProgressComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, CircleProgressComponent__svg_svg_0_Template, 9, 11, \"svg\", 0);\n }\n if (rf & 2) {\n i0.ɵɵproperty(\"ngIf\", ctx.svg);\n }\n },\n dependencies: [i1.NgForOf, i1.NgIf],\n encapsulation: 2\n });\n return CircleProgressComponent;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet NgCircleProgressModule = /*#__PURE__*/(() => {\n class NgCircleProgressModule {\n static forRoot(options = {}) {\n return {\n ngModule: NgCircleProgressModule,\n providers: [{\n provide: CircleProgressOptions,\n useValue: options\n }]\n };\n }\n }\n NgCircleProgressModule.ɵfac = function NgCircleProgressModule_Factory(t) {\n return new (t || NgCircleProgressModule)();\n };\n NgCircleProgressModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NgCircleProgressModule\n });\n NgCircleProgressModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n imports: [CommonModule]\n });\n return NgCircleProgressModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of ng-circle-progress\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CircleProgressComponent, CircleProgressOptions, NgCircleProgressModule };\n","@if (chevronKind === 'up') {\n \n}\n@if (chevronKind === 'down') {\n \n}\n","/* eslint-disable @angular-eslint/component-max-inline-declarations */\nimport { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'cs-chevron',\n templateUrl: './chevron.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: [\n `\n .theme-arrow-up:before {\n vertical-align: middle;\n margin-top: 0;\n padding-right: 0;\n font-size: 0.75rem;\n transform: rotate(-180deg);\n }\n `,\n ],\n})\nexport class CsChevronComponent {\n @Input() chevronKind: ChevronKind = 'down';\n}\n\nexport type ChevronKind = 'up' | 'down';\n","/* eslint-disable @nx/enforce-module-boundaries */\n\n/* eslint-disable @angular-eslint/component-max-inline-declarations */\nimport { ChangeDetectionStrategy, Component, Input, booleanAttribute } from '@angular/core';\n\nimport {\n DS_BUTTON_KIND_ARRAY as CS_CTA_KIND_ARRAY,\n DS_BUTTON_SIZES_ARRAY as CS_CTA_SIZES_ARRAY,\n DS_BUTTON_VARIANTS_ARRAY as CS_CTA_VARIANTS_ARRAY,\n DsButtonKind as CsCtaKind,\n DsButtonSize as CsCtaSize,\n DsButtonVariant as CsCtaVariant,\n DsButton,\n} from '@frontend/ui/button';\n\n/*\n Don't use this. Soon will be removed.\n It has identical template redundancy with DsButton\n*/\n@Component({\n selector: 'cs-cta',\n template: `\n \n \n {{ cta_text }}\n \n \n `,\n standalone: true,\n imports: [DsButton],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CsCtaComponent implements CsCtaViewModel {\n @Input() size: CsCtaSize = 'large';\n @Input() variant: CsCtaVariant = 'filled';\n @Input() kind: CsCtaKind = 'primary';\n @Input() cta_text = '';\n @Input() casinoDsClass = '';\n @Input() inlineStyle = '';\n @Input({ transform: booleanAttribute }) disabled = false;\n}\n\nexport { CS_CTA_KIND_ARRAY, CS_CTA_SIZES_ARRAY, CS_CTA_VARIANTS_ARRAY, CsCtaKind, CsCtaSize, CsCtaVariant };\n\nexport interface CsCtaViewModel {\n size: CsCtaSize;\n variant: CsCtaVariant;\n kind: CsCtaKind;\n cta_text: string;\n casinoDsClass: string;\n disabled: boolean;\n // Color customisation properties, experimental, start\n inlineStyle: string;\n // Color customisation properties, experimental, end\n}\n","@if (!isLegacy) {\n \n \n {{ cta_text }}\n \n \n}\n\n@if (isLegacy) {\n \n}\n","import { ChangeDetectionStrategy, Component, Input, booleanAttribute, numberAttribute } from '@angular/core';\n\nimport { CsCtaComponent, CsCtaKind, CsCtaSize, CsCtaVariant } from '../cs-cta/cs-cta.component';\n\n@Component({\n selector: 'cs-gametile-cta',\n templateUrl: './gametile-cta.component.html',\n standalone: true,\n imports: [CsCtaComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GameTileCtaComponent implements GameTileCtaViewModel, GameTileCtaLegacyViewModel, GameTileCtaViewBinding {\n @Input() size: CsCtaSize = 'large';\n @Input() variant: CsCtaVariant = 'filled';\n @Input() kind: CsCtaKind = 'primary';\n @Input() cta_text = '';\n @Input() casinoDsClass = '';\n @Input() customBgColor = '';\n @Input() customTextColor = '';\n @Input() inlineStyle = '';\n @Input({ transform: booleanAttribute }) isLegacy = false;\n @Input({ transform: booleanAttribute }) disabled = false;\n @Input({ transform: numberAttribute }) ctaWidth: number | undefined;\n\n getComputerStyle() {\n return `width: ${this.ctaWidth}%; background-color: ${this.customBgColor}; color: ${this.customTextColor}; ${this.inlineStyle}`;\n }\n}\n\nexport interface GameTileCtaViewModel {\n size: CsCtaSize;\n variant: CsCtaVariant;\n kind: CsCtaKind;\n cta_text: string;\n casinoDsClass: string;\n inlineStyle: string;\n customBgColor: string;\n customTextColor: string;\n disabled: boolean;\n ctaWidth: number | undefined;\n}\n\nexport interface GameTileCtaLegacyViewModel {\n isLegacy: boolean;\n}\n\ninterface GameTileCtaViewBinding {\n getComputerStyle(): string;\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'cs-class-icon',\n template: `\n @if (startIconClass) {\n
\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class CsClassIconComponent implements CsClassIconViewModel {\n @Input() startIconClass = '';\n}\n\nexport interface CsClassIconViewModel {\n startIconClass: string;\n}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Input, booleanAttribute } from '@angular/core';\n\nimport { CsClassIconComponent } from '../../icons/class-icon/class-icon.component';\n\n@Component({\n selector: 'cs-rp-fav-cta-legacy',\n templateUrl: './rp-fav-cta-legacy.component.html',\n standalone: true,\n imports: [CommonModule, CsClassIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RpFavCtaLegacyComponent implements RpFavCtaLegacyViewModel {\n @Input() color = '';\n @Input() backgroundColor = '';\n @Input() startIconClass = '';\n @Input() endIconClass = '';\n @Input({ transform: booleanAttribute }) isFav = false;\n @Input({ transform: booleanAttribute }) setActive = false;\n}\n\nexport interface RpFavCtaLegacyViewModel {\n color: string;\n backgroundColor: string;\n startIconClass: string;\n endIconClass: string;\n isFav: boolean;\n setActive: boolean;\n}\n","\n \n \n \n\n","@if (!isLegacy) {\n \n @if (startIconClass) {\n \n }\n {{ cta_text }}\n \n \n}\n\n\n@if (isLegacy) {\n \n {{ cta_text }}\n \n}\n","import { ChangeDetectionStrategy, Component, Input, booleanAttribute } from '@angular/core';\n\nimport { ChevronKind, CsChevronComponent } from '../../chevron/chevron.component';\nimport { CsClassIconComponent } from '../../icons/class-icon/class-icon.component';\nimport { CsCtaKind, CsCtaSize, CsCtaVariant } from '../cs-cta/cs-cta.component';\nimport { GameTileCtaComponent } from '../gametile-cta/gametile-cta.component';\nimport { RpFavCtaLegacyComponent, RpFavCtaLegacyViewModel } from './rp-fav-cta-legacy.component';\n\n@Component({\n selector: 'cs-rp-fav-cta',\n templateUrl: './rp-fav-cta.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [GameTileCtaComponent, RpFavCtaLegacyComponent, CsChevronComponent, CsClassIconComponent],\n})\nexport class RpFavWidgetCtaComponent implements RpFavWidgetCtaViewModel, RpFavWidgetCtaViewBinding, RpFavCtaLegacyViewModel {\n size: CsCtaSize = 'medium';\n variant: CsCtaVariant = 'filled';\n kind: CsCtaKind = 'primary';\n @Input() chevronKind: ChevronKind = 'down';\n @Input() cta_text = 'XXX';\n @Input() color = '';\n @Input() backgroundColor = '';\n @Input() startIconClass = '';\n @Input() endIconClass = '';\n @Input({ transform: booleanAttribute }) isLegacy = false;\n @Input({ transform: booleanAttribute }) isFav = false;\n @Input({ transform: booleanAttribute }) setActive = false;\n}\n\nexport interface RpFavWidgetCtaViewModel {\n cta_text: string;\n color: string;\n backgroundColor: string;\n startIconClass: string;\n chevronKind: ChevronKind;\n}\n\ninterface RpFavWidgetCtaViewBinding {\n size: CsCtaSize;\n variant: CsCtaVariant;\n kind: CsCtaKind;\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'cs-image-icon',\n template: ` @if (imgSrc) {\n \n }`,\n styles: ['img { width: 100%; height: 100%; display: block; }'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CsImageIconComponent implements CsImageIconViewModel {\n @Input() imgSrc = '';\n @Input() altText = 'image not found';\n}\n\nexport interface CsImageIconViewModel {\n imgSrc: string;\n altText: string;\n}\n","@if (!isLegacy) {\n \n \n\n \n \n}\n\n@if (isLegacy) {\n \n}\n","/* eslint-disable @angular-eslint/no-host-metadata-property */\nimport { ChangeDetectionStrategy, Component, Input, booleanAttribute, numberAttribute } from '@angular/core';\n\nimport { CsClassIconComponent } from '../../icons/class-icon/class-icon.component';\nimport { CsImageIconComponent } from '../../icons/image-icon/image-icon.component';\nimport { CsCtaComponent, CsCtaKind, CsCtaSize, CsCtaVariant } from '../cs-cta/cs-cta.component';\n\n@Component({\n selector: 'cs-slotrace-cta',\n templateUrl: './slotrace-cta.component.html',\n standalone: true,\n imports: [CsCtaComponent, CsImageIconComponent, CsClassIconComponent],\n host: {\n '[style]': \"disabled ? 'pointer-events:none' : ''\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SlotRaceCtaComponent implements SlotRaceCtaViewModel, SlotRaceCtaLegacyViewModel {\n @Input() cta_text = '';\n @Input() imgSrc = '';\n @Input() startIconClass = '';\n @Input({ transform: booleanAttribute }) isLegacy = false;\n @Input({ transform: booleanAttribute }) disabled = false;\n @Input() casinoDsClass = '';\n\n // Legacy Properties, start\n @Input({ transform: numberAttribute }) coinsForOptin: number | undefined;\n @Input() size: CsCtaSize = 'large';\n @Input() variant: CsCtaVariant = 'filled';\n @Input() kind: CsCtaKind = 'primary';\n}\n\nexport interface SlotRaceCtaViewModel {\n size: CsCtaSize;\n variant: CsCtaVariant;\n kind: CsCtaKind;\n cta_text: string;\n casinoDsClass: string;\n startIconClass: string;\n imgSrc: string;\n disabled: boolean;\n coinsForOptin: number | undefined;\n}\n\nexport interface SlotRaceCtaLegacyViewModel {\n isLegacy: boolean;\n}\n","import { AfterViewInit, Directive, DoCheck, ElementRef, Input } from '@angular/core';\n\ntype NgClassSupportedTypes = string[] | Set | { [klass: string]: any } | null | undefined;\n\nconst WS_REGEXP = /\\s+/;\n\nconst EMPTY_ARRAY: string[] = [];\n\ninterface CssClassState {\n enabled: boolean;\n changed: boolean;\n touched: boolean;\n}\n\n@Directive({\n selector: '[csDecoratorClass]',\n standalone: true,\n})\nexport class DecoratorClassDirective implements DoCheck, AfterViewInit {\n private initialClasses = EMPTY_ARRAY;\n // private rawClass: NgClassSupportedTypes;\n private rawClasses: Array = [];\n\n private stateMap = new Map();\n private decoratorClassHost!: HTMLElement | null;\n constructor(private _ngEl: ElementRef) {}\n\n ngAfterViewInit(): void {\n this.decoratorClassHost = (this._ngEl.nativeElement as HTMLElement).querySelector('[data-decoratorclass-host]');\n this._applyStateDiff();\n }\n\n @Input()\n set csDecoratorClass(value: string | string[] | Set | { [klass: string]: any } | null | undefined) {\n this.rawClasses.push(typeof value === 'string' ? value.trim().split(WS_REGEXP) : value);\n }\n\n ngDoCheck(): void {\n // classes from the [class] binding\n for (const klass of this.initialClasses) {\n this._updateState(klass, true);\n }\n\n // classes from the [decoratorClass] binding\n this.rawClasses.forEach((rawClass) => {\n if (Array.isArray(rawClass) || rawClass instanceof Set) {\n for (const klass of rawClass) {\n this._updateState(klass, true);\n }\n } else if (rawClass != null) {\n for (const klass of Object.keys(rawClass)) {\n this._updateState(klass, Boolean(rawClass[klass]));\n }\n }\n });\n\n this._applyStateDiff();\n }\n\n private _updateState(klass: string, nextEnabled: boolean) {\n const state = this.stateMap.get(klass);\n if (state === undefined) {\n this.stateMap.set(klass, { enabled: nextEnabled, changed: true, touched: true });\n } else {\n if (state.enabled !== nextEnabled) {\n state.changed = true;\n state.enabled = nextEnabled;\n }\n state.touched = true;\n }\n }\n\n private _applyStateDiff() {\n for (const stateEntry of this.stateMap) {\n const klass = stateEntry[0];\n const state = stateEntry[1];\n\n if (state.changed) {\n this._toggleClass(klass, state.enabled);\n state.changed = false;\n } else if (!state.touched) {\n // A class that was previously active got removed from the new collection of classes -\n // remove from the DOM as well.\n if (state.enabled) {\n this._toggleClass(klass, false);\n }\n this.stateMap.delete(klass);\n }\n\n state.touched = false;\n }\n }\n\n private _toggleClass(klass: string, enabled: boolean): void {\n klass = klass.trim();\n if (klass.length > 0) {\n klass.split(WS_REGEXP).forEach((c_lass) => {\n if (enabled) {\n if (this.decoratorClassHost) {\n this.decoratorClassHost.classList.add(c_lass);\n }\n } else {\n if (this.decoratorClassHost) {\n this.decoratorClassHost.classList.remove(c_lass);\n }\n }\n });\n }\n }\n}\n","/*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license */\n(function (window, document, exportName, undefined) {\n 'use strict';\n\n var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n var TEST_ELEMENT = document.createElement('div');\n var TYPE_FUNCTION = 'function';\n var round = Math.round;\n var abs = Math.abs;\n var now = Date.now;\n\n /**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\n function setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n }\n\n /**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n function invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n }\n\n /**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\n function each(obj, iterator, context) {\n var i;\n if (!obj) {\n return;\n }\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n }\n\n /**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\n function deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n }\n\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\n var assign;\n if (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n } else {\n assign = Object.assign;\n }\n\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n var extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n }, 'extend', 'Use `assign`.');\n\n /**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n var merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n }, 'merge', 'Use `assign`.');\n\n /**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n function inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n if (properties) {\n assign(childP, properties);\n }\n }\n\n /**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\n function bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n }\n\n /**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n function boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n }\n\n /**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\n function ifUndefined(val1, val2) {\n return val1 === undefined ? val2 : val1;\n }\n\n /**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n }\n\n /**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n }\n\n /**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\n function hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n }\n\n /**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\n function inStr(str, find) {\n return str.indexOf(find) > -1;\n }\n\n /**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\n function splitStr(str) {\n return str.trim().split(/\\s+/g);\n }\n\n /**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\n function inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n return i;\n }\n i++;\n }\n return -1;\n }\n }\n\n /**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\n function toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n }\n\n /**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n function uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n return results;\n }\n\n /**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n function prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n }\n\n /**\n * get a unique id\n * @returns {number} uniqueId\n */\n var _uniqueId = 1;\n function uniqueId() {\n return _uniqueId++;\n }\n\n /**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\n function getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n }\n var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n var SUPPORT_TOUCH = ('ontouchstart' in window);\n var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n var INPUT_TYPE_TOUCH = 'touch';\n var INPUT_TYPE_PEN = 'pen';\n var INPUT_TYPE_MOUSE = 'mouse';\n var INPUT_TYPE_KINECT = 'kinect';\n var COMPUTE_INTERVAL = 25;\n var INPUT_START = 1;\n var INPUT_MOVE = 2;\n var INPUT_END = 4;\n var INPUT_CANCEL = 8;\n var DIRECTION_NONE = 1;\n var DIRECTION_LEFT = 2;\n var DIRECTION_RIGHT = 4;\n var DIRECTION_UP = 8;\n var DIRECTION_DOWN = 16;\n var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n var PROPS_XY = ['x', 'y'];\n var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n /**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n this.init();\n }\n Input.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function () {},\n /**\n * bind the events\n */\n init: function () {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n /**\n * unbind the events\n */\n destroy: function () {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n };\n\n /**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n function createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new Type(manager, inputHandler);\n }\n\n /**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n function inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n }\n\n /**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n function computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n }\n function computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n }\n\n /**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n function computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity,\n velocityX,\n velocityY,\n direction;\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n }\n\n /**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n function simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n }\n\n /**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n function getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n var x = 0,\n y = 0,\n i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n }\n\n /**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\n function getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n }\n\n /**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n function getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n }\n\n /**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n function getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n }\n\n /**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n function getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n }\n\n /**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n function getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n }\n\n /**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n function getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n }\n var MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n };\n var MOUSE_ELEMENT_EVENTS = 'mousedown';\n var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n /**\n * Mouse events input\n * @constructor\n * @extends Input\n */\n function MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n }\n inherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down\n if (!this.pressed) {\n return;\n }\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n });\n var POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n };\n\n // in IE10 the pointer types is defined as an enum\n var IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n };\n var POINTER_ELEMENT_EVENTS = 'pointerdown';\n var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n // IE10 has prefixed support, and case-sensitive\n if (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n }\n\n /**\n * Pointer events input\n * @constructor\n * @extends Input\n */\n function PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n Input.apply(this, arguments);\n this.store = this.manager.session.pointerEvents = [];\n }\n inherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType == INPUT_TYPE_TOUCH;\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n });\n var SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n /**\n * Touch events input\n * @constructor\n * @extends Input\n */\n function SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n Input.apply(this, arguments);\n }\n inherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n if (!this.started) {\n return;\n }\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n return [all, changed];\n }\n var TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n /**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n function TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n Input.apply(this, arguments);\n }\n inherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n if (!changedTargetTouches.length) {\n return;\n }\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n }\n\n /**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\n var DEDUP_TIMEOUT = 2500;\n var DEDUP_DISTANCE = 25;\n function TouchMouseInput() {\n Input.apply(this, arguments);\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n this.primaryTouch = null;\n this.lastTouches = [];\n }\n inherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,\n isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n }\n\n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n this.callback(manager, inputEvent, inputData);\n },\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n });\n function recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n }\n function setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function () {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n }\n function isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX,\n y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x),\n dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n }\n var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n // magical touchAction value\n var TOUCH_ACTION_COMPUTE = 'compute';\n var TOUCH_ACTION_AUTO = 'auto';\n var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n var TOUCH_ACTION_NONE = 'none';\n var TOUCH_ACTION_PAN_X = 'pan-x';\n var TOUCH_ACTION_PAN_Y = 'pan-y';\n var TOUCH_ACTION_MAP = getTouchActionProps();\n\n /**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n TouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function (value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n /**\n * just re-set the touchAction value\n */\n update: function () {\n this.set(this.manager.options.touchAction);\n },\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function () {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function (input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n },\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function (srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n };\n\n /**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n function cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n return TOUCH_ACTION_AUTO;\n }\n function getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n }\n\n /**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n var STATE_POSSIBLE = 1;\n var STATE_BEGAN = 2;\n var STATE_CHANGED = 4;\n var STATE_ENDED = 8;\n var STATE_RECOGNIZED = STATE_ENDED;\n var STATE_CANCELLED = 16;\n var STATE_FAILED = 32;\n\n /**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n function Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n this.id = uniqueId();\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n Recognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function (options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function () {\n return this.requireFail.length > 0;\n },\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function (otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function (input) {\n var self = this;\n var state = this.state;\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function (input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function () {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function (inputData) {},\n // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function () {},\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function () {}\n };\n\n /**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\n function stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n }\n\n /**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\n function directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n }\n\n /**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\n function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n }\n\n /**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n function AttrRecognizer() {\n Recognizer.apply(this, arguments);\n }\n inherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function (input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function (input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n });\n\n /**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n this.pX = null;\n this.pY = null;\n }\n inherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n getTouchAction: function () {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n directionTest: function (input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n attrTest: function (input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n },\n emit: function (input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n });\n\n /**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n function PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n emit: function (input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n });\n\n /**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n function PressRecognizer() {\n Recognizer.apply(this, arguments);\n this._timer = null;\n this._input = null;\n }\n inherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_AUTO];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function (input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n\n /**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n function RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n });\n\n /**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n getTouchAction: function () {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n attrTest: function (input) {\n var direction = this.options.direction;\n var velocity;\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n emit: function (input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n this.manager.emit(this.options.event, input);\n }\n });\n\n /**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n function TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n this._timer = null;\n this._input = null;\n this.count = 0;\n }\n inherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_MANIPULATION];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n failTimeout: function () {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function () {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n\n /**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n }\n\n /**\n * @const {string}\n */\n Hammer.VERSION = '2.0.7';\n\n /**\n * default settings\n * @namespace\n */\n Hammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {\n enable: false\n }], [PinchRecognizer, {\n enable: false\n }, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n }], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n }, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n }, ['tap']], [PressRecognizer]],\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n };\n var STOP = 1;\n var FORCED_STOP = 2;\n\n /**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = this.add(new item[0](item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n Manager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function (options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function (force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n curRecognizer = session.curRecognizer = null;\n }\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && (\n // 1\n !curRecognizer || recognizer == curRecognizer ||\n // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function (recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function (recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n },\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function (recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n return this;\n },\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function (events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function (events, handler) {\n if (events === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function (event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n data.type = event;\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function () {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n };\n\n /**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n function toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n }\n\n /**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n function triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n }\n assign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n });\n\n // this prevents errors when Hammer is loaded in the presence of an AMD\n // style loader but by script tag, not by the loader.\n var freeGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; // jshint ignore:line\n freeGlobal.Hammer = Hammer;\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return Hammer;\n });\n } else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n } else {\n window[exportName] = Hammer;\n }\n})(window, document, 'Hammer');","import { Injectable } from '@angular/core';\n\nimport { SharedFeaturesApiService } from '@frontend/vanilla/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\nexport interface CoinsBalance {\n balance: string;\n status: number;\n statusCode: number;\n statusMessage: number;\n additionalAttribs: number;\n productBalances: number;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GamificationService {\n isLoaded: boolean = false;\n\n private coinBalanceEvents = new ReplaySubject(1);\n get coinBalance(): Observable {\n return this.coinBalanceEvents;\n }\n\n constructor(private apiService: SharedFeaturesApiService) {}\n\n load() {\n this.apiService.get('gamification').subscribe((response) => {\n this.coinBalanceEvents.next(response);\n this.isLoaded = true;\n });\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { OnFeatureInit, RtmsService, RtmsType, UserService } from '@frontend/vanilla/core';\nimport { filter } from 'rxjs/operators';\n\nimport { GamificationService } from './gamification.service';\n\n@Injectable()\nexport class GamificationBootstrapService implements OnFeatureInit {\n constructor(private gamificationService: GamificationService, private user: UserService, private rtmsService: RtmsService) {}\n\n onFeatureInit() {\n if (this.user.isAuthenticated) {\n this.gamificationService.load();\n\n this.rtmsService.messages.pipe(filter((m) => m.type == RtmsType.COIN_BAL_UPDATE_EVENT)).subscribe(() => {\n this.gamificationService.load();\n });\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport {\n DSL_NOT_READY,\n DslCacheService,\n DslRecordable,\n DslRecorderService,\n DslValuesProvider,\n EventsService,\n UserService,\n VanillaEventNames,\n} from '@frontend/vanilla/core';\nimport { distinctUntilChanged } from 'rxjs';\n\nimport { CoinsBalance, GamificationService } from './gamification.service';\n\n@Injectable()\nexport class GamificationDslValuesProvider implements DslValuesProvider {\n private balance: CoinsBalance | null;\n\n constructor(\n private userService: UserService,\n readonly dslCacheService: DslCacheService,\n private readonly dslRecorderService: DslRecorderService,\n private readonly gamificationService: GamificationService,\n private eventsService: EventsService,\n ) {\n this.gamificationService.coinBalance\n .pipe(distinctUntilChanged((previous, current) => previous.balance === current.balance))\n .subscribe((balance: CoinsBalance) => {\n this.balance = balance;\n dslCacheService.invalidate(['gamification']);\n this.eventsService.raise({ eventName: VanillaEventNames.TriggerAnimation });\n });\n }\n\n getProviders(): { [provider: string]: DslRecordable } {\n return {\n Gamification: this.dslRecorderService.createRecordable('gamification').createProperty({\n name: 'CoinsBalance',\n get: () => this.getCurrentValue(() => (this.balance ? this.balance.balance : DSL_NOT_READY)),\n deps: () => ['gamification', 'user.isAuthenticated'],\n }),\n };\n }\n\n private getCurrentValue(get: () => T, defaultValue = '') {\n if (!this.userService.isAuthenticated) {\n return defaultValue;\n }\n\n if (!this.gamificationService.isLoaded) {\n this.gamificationService.load();\n }\n\n return get();\n }\n}\n","import { registerLazyDslOnModuleInit, runOnFeatureInit } from '@frontend/vanilla/core';\n\nimport { GamificationBootstrapService } from './gamification-bootstrap.service';\nimport { GamificationDslValuesProvider } from './gamification-dsl-values-provider';\n\nexport function provide() {\n return [runOnFeatureInit(GamificationBootstrapService), registerLazyDslOnModuleInit(GamificationDslValuesProvider)];\n}\n","import { Injectable } from '@angular/core';\n\nimport { Observable, Subject } from 'rxjs';\n\nimport { IMessagePanelComponent, MessagePanelRegistryEvent } from './message-panel.models';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MessagePanelRegistry {\n get onChange(): Observable {\n return this.onChangeSubject.asObservable();\n }\n\n private onChangeSubject = new Subject();\n private components = [] as IMessagePanelComponent[];\n\n add(component: IMessagePanelComponent) {\n this.components.push(component);\n this.onChangeSubject.next({ component });\n }\n\n remove(component: IMessagePanelComponent) {\n const index = this.components.indexOf(component);\n this.components.splice(index, 1);\n\n const componentsInScope = this.components.filter((c: IMessagePanelComponent) => c.currentScope === component.currentScope);\n const lastMessagePanelComponent = componentsInScope[componentsInScope.length - 1] || null;\n\n this.onChangeSubject.next({\n component: lastMessagePanelComponent,\n });\n }\n}\n","@if (messages.length && isLatest) {\n
\n @for (message of messages; track trackByHtml($index, message)) {\n \n
\n
\n }\n \n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EffectRef, ElementRef, Input, OnDestroy, OnInit, ViewEncapsulation, effect } from '@angular/core';\n\nimport {\n DynamicHtmlDirective,\n Message,\n MessageQueueService,\n WebWorkerService,\n WindowOffsetModifierService,\n WorkerType,\n trackByProp,\n} from '@frontend/vanilla/core';\nimport { Subject } from 'rxjs';\nimport { filter, takeUntil } from 'rxjs/operators';\n\nimport { MessagePanelRegistry } from './message-panel-registry.service';\nimport { IMessagePanelComponent, MessagePanelRegistryEvent } from './message-panel.models';\n\n/**\n * @whatItDoes Displays messages that have been added by {@link MessageQueueService}.\n *\n * @howToUse\n *\n * Place this component on a page where you want to display messages.\n *\n * ```\n * \n * ```\n *\n * @stable\n */\n@Component({\n standalone: true,\n imports: [CommonModule, DynamicHtmlDirective],\n selector: 'vn-message-panel',\n templateUrl: 'message-panel.html',\n styleUrls: ['../../../../../themepark/themes/whitelabel/components/message-panel/styles.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class MessagePanelComponent implements IMessagePanelComponent, OnInit, OnDestroy {\n @Input() scope: string;\n\n messages: Message[] = [];\n isLatest: boolean;\n readonly trackByHtml = trackByProp('html');\n\n private unsubscribe = new Subject();\n private messagesEffectRef: EffectRef;\n\n constructor(\n private service: MessageQueueService,\n private elementRef: ElementRef,\n private windowOffsetModifierService: WindowOffsetModifierService,\n private registry: MessagePanelRegistry,\n private webWorkerService: WebWorkerService,\n ) {\n this.messagesEffectRef = effect(() => {\n this.messages = this.service.messages().filter((message: Message) => (message.scope || '') === this.currentScope);\n\n if (this.messages.length) {\n const offset = this.elementRef.nativeElement.getBoundingClientRect().top;\n this.windowOffsetModifierService.scrollBy(offset);\n }\n });\n }\n\n get currentScope(): string {\n return this.scope || '';\n }\n\n ngOnInit() {\n this.registry.onChange\n .pipe(\n takeUntil(this.unsubscribe),\n filter((c: MessagePanelRegistryEvent) => c.component?.currentScope === this.currentScope),\n )\n .subscribe((c: MessagePanelRegistryEvent) => {\n const workerType = WorkerType.MessagePanelTimeout + this.currentScope;\n\n this.webWorkerService.createWorker(workerType, { timeout: 0 }, () => {\n this.isLatest = c.component === this;\n this.webWorkerService.removeWorker(workerType);\n });\n });\n\n this.registry.add(this);\n }\n\n ngOnDestroy() {\n this.unsubscribe.next();\n this.unsubscribe.complete();\n this.messagesEffectRef.destroy();\n this.registry.remove(this);\n this.webWorkerService.removeWorker(WorkerType.MessagePanelTimeout + this.currentScope);\n }\n}\n","/**\n * @license Angular v17.1.2\n * (c) 2010-2022 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Directive, InjectionToken, forwardRef, Optional, Inject, ɵisPromise, ɵisSubscribable, ɵRuntimeError, Self, EventEmitter, Input, Host, SkipSelf, booleanAttribute, ChangeDetectorRef, Output, Injectable, inject, NgModule, Version } from '@angular/core';\nimport { ɵgetDOM } from '@angular/common';\nimport { from, forkJoin } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n/**\n * Base class for all ControlValueAccessor classes defined in Forms package.\n * Contains common logic and utility functions.\n *\n * Note: this is an *internal-only* class and should not be extended or used directly in\n * applications code.\n */\nlet BaseControlValueAccessor = /*#__PURE__*/(() => {\n class BaseControlValueAccessor {\n constructor(_renderer, _elementRef) {\n this._renderer = _renderer;\n this._elementRef = _elementRef;\n /**\n * The registered callback function called when a change or input event occurs on the input\n * element.\n * @nodoc\n */\n this.onChange = _ => {};\n /**\n * The registered callback function called when a blur event occurs on the input element.\n * @nodoc\n */\n this.onTouched = () => {};\n }\n /**\n * Helper method that sets a property on a target element using the current Renderer\n * implementation.\n * @nodoc\n */\n setProperty(key, value) {\n this._renderer.setProperty(this._elementRef.nativeElement, key, value);\n }\n /**\n * Registers a function called when the control is touched.\n * @nodoc\n */\n registerOnTouched(fn) {\n this.onTouched = fn;\n }\n /**\n * Registers a function called when the control value changes.\n * @nodoc\n */\n registerOnChange(fn) {\n this.onChange = fn;\n }\n /**\n * Sets the \"disabled\" property on the range input element.\n * @nodoc\n */\n setDisabledState(isDisabled) {\n this.setProperty('disabled', isDisabled);\n }\n static {\n this.ɵfac = function BaseControlValueAccessor_Factory(t) {\n return new (t || BaseControlValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BaseControlValueAccessor\n });\n }\n }\n return BaseControlValueAccessor;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is\n * used in case no other CVAs can be found). We use this class to distinguish between default CVA,\n * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom\n * ones with higher priority (when both built-in and custom CVAs are present).\n *\n * Note: this is an *internal-only* class and should not be extended or used directly in\n * applications code.\n */\nlet BuiltInControlValueAccessor = /*#__PURE__*/(() => {\n class BuiltInControlValueAccessor extends BaseControlValueAccessor {\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵBuiltInControlValueAccessor_BaseFactory;\n return function BuiltInControlValueAccessor_Factory(t) {\n return (ɵBuiltInControlValueAccessor_BaseFactory || (ɵBuiltInControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(BuiltInControlValueAccessor)))(t || BuiltInControlValueAccessor);\n };\n })();\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BuiltInControlValueAccessor,\n features: [i0.ɵɵInheritDefinitionFeature]\n });\n }\n }\n return BuiltInControlValueAccessor;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Used to provide a `ControlValueAccessor` for form controls.\n *\n * See `DefaultValueAccessor` for how to implement one.\n *\n * @publicApi\n */\nconst NG_VALUE_ACCESSOR = /*#__PURE__*/new InjectionToken(ngDevMode ? 'NgValueAccessor' : '');\nconst CHECKBOX_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: /*#__PURE__*/forwardRef(() => CheckboxControlValueAccessor),\n multi: true\n};\n/**\n * @description\n * A `ControlValueAccessor` for writing a value and listening to changes on a checkbox input\n * element.\n *\n * @usageNotes\n *\n * ### Using a checkbox with a reactive form.\n *\n * The following example shows how to use a checkbox with a reactive form.\n *\n * ```ts\n * const rememberLoginControl = new FormControl();\n * ```\n *\n * ```\n * \n * ```\n *\n * @ngModule ReactiveFormsModule\n * @ngModule FormsModule\n * @publicApi\n */\nlet CheckboxControlValueAccessor = /*#__PURE__*/(() => {\n class CheckboxControlValueAccessor extends BuiltInControlValueAccessor {\n /**\n * Sets the \"checked\" property on the input element.\n * @nodoc\n */\n writeValue(value) {\n this.setProperty('checked', value);\n }\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵCheckboxControlValueAccessor_BaseFactory;\n return function CheckboxControlValueAccessor_Factory(t) {\n return (ɵCheckboxControlValueAccessor_BaseFactory || (ɵCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(CheckboxControlValueAccessor)))(t || CheckboxControlValueAccessor);\n };\n })();\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: CheckboxControlValueAccessor,\n selectors: [[\"input\", \"type\", \"checkbox\", \"formControlName\", \"\"], [\"input\", \"type\", \"checkbox\", \"formControl\", \"\"], [\"input\", \"type\", \"checkbox\", \"ngModel\", \"\"]],\n hostBindings: function CheckboxControlValueAccessor_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"change\", function CheckboxControlValueAccessor_change_HostBindingHandler($event) {\n return ctx.onChange($event.target.checked);\n })(\"blur\", function CheckboxControlValueAccessor_blur_HostBindingHandler() {\n return ctx.onTouched();\n });\n }\n },\n features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature]\n });\n }\n }\n return CheckboxControlValueAccessor;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DEFAULT_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: /*#__PURE__*/forwardRef(() => DefaultValueAccessor),\n multi: true\n};\n/**\n * We must check whether the agent is Android because composition events\n * behave differently between iOS and Android.\n */\nfunction _isAndroid() {\n const userAgent = ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';\n return /android (\\d+)/.test(userAgent.toLowerCase());\n}\n/**\n * @description\n * Provide this token to control if form directives buffer IME input until\n * the \"compositionend\" event occurs.\n * @publicApi\n */\nconst COMPOSITION_BUFFER_MODE = /*#__PURE__*/new InjectionToken(ngDevMode ? 'CompositionEventMode' : '');\n/**\n * The default `ControlValueAccessor` for writing a value and listening to changes on input\n * elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and\n * `NgModel` directives.\n *\n * {@searchKeywords ngDefaultControl}\n *\n * @usageNotes\n *\n * ### Using the default value accessor\n *\n * The following example shows how to use an input element that activates the default value accessor\n * (in this case, a text field).\n *\n * ```ts\n * const firstNameControl = new FormControl();\n * ```\n *\n * ```\n * \n * ```\n *\n * This value accessor is used by default for `` and `