{"version":3,"file":"chunk-ezm02tl7.js","sources":["packages/sports/web/app/src/bottom-nav/bottom-nav-actions.service.ts","packages/sports/web/app/src/banner/game-launcher.resolver.ts","packages/sports/web/app/src/common/local-storage.service.ts","packages/sports/web/app/src/competition-list/competition-route.service.ts","packages/sports/web/app/src/competition-list/competition-list-seo.service.ts","packages/sports/web/app/src/seo/seo-content.service.ts","packages/sports/web/app/src/option-pick/pick-source.provider.ts","packages/sports/web/app/src/widget/core/modular-config-accessor.service.ts","packages/sports/web/app/src/widget/core/modular-pick-source.service.ts","packages/sports/common/betslip/modules/quick-bet/quick-bet.state.ts","packages/sports/common/betslip/modules/combo-bet/selectors.ts","packages/sports/common/betslip/modules/validation/errors/notify-user-error.ts","packages/sports/common/betslip/modules/validation/errors/result/pick-invisible.ts","packages/sports/common/betslip/modules/validation/errors/pre-check/pick-locked-pre-check-error.ts","packages/sports/common/betslip/modules/betslip-bar/selectors.ts","packages/sports/common/betslip/modules/settings/selectors.ts","packages/sports/common/betslip/modules/tracking/models.ts","packages/sports/common/betslip/modules/quick-bet/quick-bet.selectors.ts","packages/sports/web/app/src/common/hide-header.service.ts","node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js","packages/sports/libs/common/core/utils/dom/src/lib/resize-observer.service.ts","packages/sports/libs/grid/core/feature/model/src/grid.model.ts","packages/sports/web/app/src/grid/grid-breakpoint.service.ts","packages/sports/libs/common/core/utils/hooks/src/lib/hooks-wireup.ts","packages/sports/libs/common/core/utils/hooks/src/lib/on-route-resolve.ts","packages/sports/libs/common/core/utils/rxjs/src/lib/buffer-with-size.ts","packages/sports/libs/common/core/utils/collection/src/lib/collection.ts","packages/sports/web/app/src/widget/core/widget-skeleton.model.ts","packages/sports/web/app/src/widget/core/widget-registry.service.ts","packages/vanilla/lib/features/launch-darkly/src/launch-darkly.client-config.ts","node_modules/launchdarkly-js-client-sdk/dist/ldclient.es.js","packages/vanilla/lib/features/launch-darkly/src/launch-darkly.service.ts","packages/vanilla/lib/features/launch-darkly/src/launch-darkly-bootstrap.service.ts","packages/vanilla/lib/features/launch-darkly/src/launch-darkly.feature.ts","packages/sports/web/app/src/widget/core/widgets-to-widget-types.util.ts","packages/sports/web/app/src/widget/core/widget-right-column.service.ts","packages/sports/web/app/src/widget/core/modular-tracking.service.ts","packages/sports/web/app/src/widget/common/widget-context-refresh-processor.ts","packages/sports/web/app/src/widget/core/widget-refresh.service.ts","packages/sports/web/app/src/widget/core/widget-skeleton-renderer.service.ts","packages/sports/web/app/src/widget/core/widget-slot.component.ts","packages/sports/web/app/src/widget/core/widget-tracking.service.ts","packages/sports/web/app/src/widget/core/widget-layout-hook.ts","packages/sports/web/app/src/widget/core/widget-layout.component.html","packages/sports/web/app/src/widget/core/widget-layout.component.ts","packages/sports/libs/common/core/utils/element-provider/src/lib/element-provider.ts","packages/sports/libs/modal/feature/src/dialog/modal-dialog-container.directive.ts","packages/sports/web/app/src/widget/core/widget-column.component.html","packages/sports/web/app/src/widget/core/widget-column.component.ts","packages/sports/web/app/src/widget/core/widget-core.module.ts","packages/sports/web/app/src/betslip/betslip-digital-component-loader.service.ts","packages/sports/web/app/src/betslip-base/models/pick-models.ts","packages/sports/libs/betting-offer/feature/fixture-factories/src/mappers/detailed-delete.factory.ts","packages/sports/libs/betting-offer/feature/fixture-factories/src/mappers/detailed-update.factory.ts","packages/sports/libs/betting-offer/feature/fixture-factories/src/mappers/detailed-fixture.factory.ts","packages/sports/web/app/src/statistics/statistics-config.service.ts","packages/sports/libs/betting-offer/feature/offer-service/src/betting-offer.service.ts","packages/sports/web/app/src/betbuilder/services/betbuilder-mapper.service.ts","packages/sports/web/app/src/event-details-common/event-details.service.ts","packages/design-system/ui/rx-host-listener/src/rx-host-listener.ts","node_modules/@angular/forms/fesm2022/forms.mjs","packages/design-system/ui/radio-button/src/radio-button.component.ts","packages/design-system/ui/radio-button/src/index.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","packages/vanilla/lib/shared/image/image.html","packages/vanilla/lib/shared/image/image.component.ts","packages/vanilla/lib/shared/account-menu/src/account-menu-onboarding.service.ts","packages/vanilla/lib/shared/account-menu/src/account-menu.client-config.ts","packages/vanilla/lib/shared/account-menu/src/account-menu-data.service.ts","packages/vanilla/lib/shared/account-menu/src/account-menu.models.ts","packages/vanilla/lib/shared/account-menu/src/account-menu-tasks.service.ts","packages/vanilla/lib/shared/account-menu/src/account-menu-router.ts","packages/vanilla/lib/shared/account-menu/src/account-menu.html","packages/vanilla/lib/shared/account-menu/src/account-menu.component.ts","packages/vanilla/lib/shared/overlay-factory/src/overlay-factory.models.ts","packages/vanilla/lib/shared/overlay-factory/src/overlay.factory.ts","packages/vanilla/lib/shared/icons/src/icons.client-config.ts","packages/vanilla/lib/shared/icons/src/icon-fast.service.ts","packages/vanilla/lib/shared/icons/src/icon-fast.component.ts","packages/vanilla/lib/features/header-bar/src/header-bar.client-config.ts","packages/vanilla/lib/features/header-bar/src/header-bar.service.ts","packages/vanilla/lib/features/header-bar/src/header-bar-bootstrap.service.ts","packages/vanilla/lib/features/header-bar/src/header-bar.feature.ts","packages/vanilla/lib/shared/confirm-popup/src/confirm-popup.client-config.ts","packages/vanilla/lib/shared/confirm-popup/src/confirm-popup.html","packages/vanilla/lib/shared/confirm-popup/src/confirm-popup.component.ts","packages/vanilla/lib/shared/confirm-popup/src/confirm-popup.service.ts","packages/vanilla/lib/features/header-bar/src/header-bar.models.ts","packages/vanilla/lib/features/header-bar/src/header-bar.html","packages/vanilla/lib/features/header-bar/src/header-bar.component.ts","packages/vanilla/lib/features/header-bar/src/lh-header-bar.component.ts","packages/vanilla/lib/features/header-bar/src/header-bar.component.html","packages/vanilla/lib/features/language-switcher/src/language-switcher.client-config.ts","packages/vanilla/lib/features/language-switcher/src/language-item.html","packages/vanilla/lib/features/language-switcher/src/language-item.component.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-tracking.service.ts","packages/vanilla/lib/features/flags/src/flags.service.ts","packages/vanilla/lib/features/language-switcher/src/default-language-switcher-urls-provider.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-urls-provider.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher.service.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher.tokens.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-menu.html","packages/vanilla/lib/features/language-switcher/src/language-switcher-menu.component.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-overlay.service.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-bootstrap.service.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher.feature.ts","packages/vanilla/lib/features/language-switcher/src/language-switcher-radio-menu.html","packages/vanilla/lib/features/language-switcher/src/language-switcher-radio-menu.component.ts","packages/vanilla/lib/features/language-switcher/src/seo-language-links.html","packages/vanilla/lib/features/language-switcher/src/seo-language-links.component.ts","packages/vanilla/lib/features/language-switcher/src/responsive-language-switcher.html","packages/vanilla/lib/features/language-switcher/src/responsive-language-switcher.component.ts","packages/sports/web/app/src/world-cup-hub/world-cup-hub.service.ts","packages/sports/web/app/src/calendar/calendar-cache.service.ts","packages/sports/web/app/src/event-list-shared/sport/sport-sub-navigation.service.ts","packages/sports/web/app/src/layout/slot-layout.service.ts","packages/sports/libs/event-subscription/feature/base-subscription/src/base-subscription.service.ts","packages/sports/web/app/src/event-subscription/player-stats-subscription-service.ts","packages/sports/web/app/src/sub-navigation/sub-navigation-resolve.service.ts","packages/sports/web/app/src/breadcrumbs/breadcrumbs.resolver.ts","packages/sports/web/app/src/router/regex.matcher.ts","packages/sports/web/app/src/router/router.resolver.ts","packages/sports/web/app/src/timers/timer-utils.service.ts","packages/design-system/ui/button-icon/src/button-icon.component.ts","node_modules/@angular/material/fesm2022/button.mjs","node_modules/@angular/material/fesm2022/snack-bar.mjs","packages/sports/libs/toaster/feature/src/toaster.component.ts","packages/sports/libs/toaster/feature/src/toaster.service.ts","packages/sports/web/app/src/native-alerts/alert-config.service.ts","packages/sports/web/app/src/native-alerts/model.ts","packages/sports/web/app/src/native-alerts/subscription-stream.service.ts","packages/sports/web/app/src/native-alerts/alert-subscription.service.ts","packages/sports/web/app/src/native-alerts/native-alerts.service.ts","packages/sports/web/app/src/native-alerts/alert-toast-messages.service.ts","packages/sports/web/app/src/native-alerts/alert-selector/alert-selector.service.ts","packages/sports/web/app/src/native-alerts/alert-selector/alert-selector.html","packages/sports/web/app/src/native-alerts/alert-selector/alert-selector.component.ts","packages/sports/web/app/src/native-alerts/alert-button/alert-button.component.ts","packages/sports/web/app/src/native-alerts/native-alerts.module.ts","packages/sports/web/app/src/directives/scrolled-to-bottom.directive.ts","packages/sports/web/app/src/directives/class-auto-remove.directive.ts","packages/sports/web/app/src/directives/column-width.directive.ts","packages/sports/web/app/src/directives/height-to-bottom.directive.ts","packages/sports/web/app/src/directives/info-tooltip.directive.ts","packages/sports/web/app/src/directives/outside-interaction.directive.ts","packages/sports/web/app/src/directives/scroll-ios-hack/scroll-ios-hack.directive.ts","packages/sports/web/app/src/directives/scroll-to.directive.ts","packages/sports/web/app/src/directives/stop-event-propagation.directive.ts","packages/sports/web/app/src/directives/toolbar-buttons-height.directive.ts","packages/sports/web/app/src/directives/directives.module.ts","packages/sports/web/app/src/scoreboards/models/scoreboard-stats.ts","packages/sports/web/app/src/scoreboards/models/scoreboard-timer.ts","packages/sports/web/app/src/scoreboards/models/scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/pair-game-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/set-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/baseball-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/pair-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/darts-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/tournament-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/leaderboard-game-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/penalty-shootout-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/period-game-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/snooker-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/soccer-scoreboard.viewmodel.ts","packages/sports/web/app/src/scoreboards/models/scoreboard-viewmodel.factory.ts","packages/sports/web/app/src/common/epcot-config.directive.ts","packages/sports/libs/common/core/utils/timer/src/lib/ticker.service.ts","packages/sports/web/app/src/scoreboards/scoreboard-host.directive.ts","packages/sports/web/app/src/scoreboards/scoreboard-base.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-timer.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-timer.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-time.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-time.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-leaderboard-game-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-leaderboard-game-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-players-pair.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-players-pair.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-game-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-game-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-game-no-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-game-no-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-penalty-shootout-scoreboard-stats.component.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-penalty-shootout-scoreboard-stats.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-penalty-shootout-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-penalty-shootout-scoreboard.html","packages/sports/web/app/src/scoreboards/components/stats-value.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-scoreboard-stats.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pair-scoreboard-stats.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-pair.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-pair.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-set-scoreboard-stats.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-set-scoreboard-stats.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-set.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-set.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/snooker/my-bets-snooker-scoreboard-stats.component.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/snooker/my-bets-snooker-scoreboard-stats.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-snooker.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-scoreboard-snooker.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-tournament-game-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-tournament-game-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/baseball/my-bets-baseball-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/baseball/my-bets-baseball-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/darts/my-bets-darts-stats-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/darts/my-bets-darts-stats-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/darts/my-bets-darts-scoreboard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/darts/my-bets-darts-scoreboard.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pairgame-full-scoreboard-stats.html","packages/sports/web/app/src/my-bets/components/scoreboard/general/my-bets-pairgame-full-scoreboard-stats.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/period-game/my-bets-scoreboard-period-game.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/period-game/my-bets-scoreboard-period-game.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/soccer/my-bets-scoreboard-soccer-redcard.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/soccer/my-bets-scoreboard-soccer-goal.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/soccer/my-bets-scoreboard-soccer.component.html","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/soccer/my-bets-scoreboard-soccer.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/tennis/my-bets-scoreboard-tennis.component.ts","packages/sports/web/app/src/my-bets/components/scoreboard/sport-specific/tennis/my-bets-scoreboard-tennis.html","packages/sports/web/app/src/my-bets/components/scoreboard/my-bets-scoreboard-resolve.service.ts","packages/sports/web/app/src/my-bets/components/scoreboard/my-bets-scoreboard.module.ts","packages/sports/web/app/src/sitemap/sitemap-routing.ts","node_modules/@babel/runtime/helpers/esm/typeof.js","packages/sports/libs/loading-indicator-feature/src/custom-loading-indicator-handler.ts","packages/sports/libs/loading-indicator-feature/src/custom-loading-indicator-switch.service.ts","packages/sports/libs/loading-indicator-feature/src/custom-loading-indicator.service.ts","packages/sports/libs/loading-indicator-feature/src/loading-indicator.html","packages/sports/libs/loading-indicator-feature/src/loading-indicator.component.ts","packages/sports/libs/loading-indicator-feature/src/loading-indicator.module.ts"],"sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\n\nimport { AccaBoostConfig, LayoutNavigationConfig, MyBetsConfig } from '@frontend/sports/common/client-config-data-access';\nimport { filterSportsEmitLast } from '@frontend/sports/host-app/sports-product/feature/utils';\nimport { DialogAnimation, ModalDialogOptions } from '@frontend/sports/modal/feature';\nimport { TrackingService, trackingConstants } from '@frontend/sports/tracking/feature';\nimport { OpenBetsSummary } from '@frontend/sports/types/models/my-bets';\nimport { UserService } from '@frontend/sports/user/feature';\nimport { BottomNavService, MenuAction, MenuActionsService, NavigationService } from '@frontend/vanilla/core';\nimport { BetslipIntegrationService } from 'packages/sports/common/betslip/integration/betslip-integration.service';\nimport { combineLatest, switchMap } from 'rxjs';\n\nimport { EpcotConfigService } from '../common/epcot-config.service';\nimport { MyBetsSummaryService } from '../my-bets-base/my-bets-summary.service';\nimport { RedirectHelperService } from '../navigation-core/redirect-helper.service';\nimport { ModelPopupTypes, UrlHelperService } from '../navigation-core/url-helper.service';\nimport { PopupManager } from '../popup/popup-manager.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class BottomNavActionsService {\n private static readonly betslipBadgeClass: string = 'badge-primary';\n private static readonly extraIconBadgeClass: string = 'badge-extra-bubble-icon';\n private static readonly myBetsBadgeClass: string = 'badge-primary theme-spot-filled';\n\n private openBetsCount: number;\n private hasLiveOpenBets = false;\n\n constructor(\n private vanillaNavigation: NavigationService,\n private popupManager: PopupManager,\n private trackingService: TrackingService,\n private redirectHelper: RedirectHelperService,\n private location: Location,\n private myBetsSummary: MyBetsSummaryService,\n private userService: UserService,\n private urlHelper: UrlHelperService,\n private betslipIntegrationService: BetslipIntegrationService,\n private bottomNavService: BottomNavService,\n private menuActionsService: MenuActionsService,\n private accaBoostConfig: AccaBoostConfig,\n private layoutNavigationConfig: LayoutNavigationConfig,\n private epcotConfigService: EpcotConfigService,\n private mybetsConfig: MyBetsConfig,\n ) {}\n\n betslipToggled(): void {\n if (this.popupManager.isOpen()) {\n this.trackingService.track(trackingConstants.EVENT_PAGE_VIEW, { [trackingConstants.PAGE_NAME]: 'M2_slip_action_ClosePopup' });\n }\n this.popupManager.open('betslip', undefined);\n }\n\n myBetsToggled(): void {\n const myBetsUrl = this.urlHelper.getMyBetsUrl();\n if (this.location.path() === myBetsUrl) {\n this.redirectHelper.goBack();\n this.myBetsTracking(false);\n } else {\n if (this.userService.isAuthenticated) {\n if (this.epcotConfigService.isShowMyBetsPopup) {\n this.popupManager.updateDialogAnimation(ModelPopupTypes.MyBets, DialogAnimation.SlideInFromBottom);\n const options: ModalDialogOptions = {\n settings: {\n closeAnimation: DialogAnimation.SlideOutFromTop,\n },\n };\n this.popupManager.open(ModelPopupTypes.MyBets, undefined, options);\n } else {\n this.vanillaNavigation.goTo(myBetsUrl);\n }\n } else {\n const returnUrl = this.epcotConfigService.isShowMyBetsPopup ? this.urlHelper.getMyBetPopupUrl() : myBetsUrl;\n this.menuActionsService.invoke(MenuAction.GOTO_LOGIN, '', [undefined, undefined, { returnUrl }]);\n }\n this.myBetsTracking(true);\n }\n }\n\n private myBetsTracking(isOpen: boolean): void {\n if (!isOpen) {\n return;\n }\n\n let pageName: string;\n if (this.hasLiveOpenBets) {\n pageName = 'HIconON_Live';\n } else if (this.openBetsCount > 0) {\n pageName = 'HIcon_Open';\n } else {\n pageName = 'HIcon_Settled';\n }\n this.trackingService.update({ [trackingConstants.PAGE_REFERRING_ACTION]: pageName });\n }\n\n init(): void {\n if (!this.mybetsConfig.isOpenSummaryLoadingRestricted) {\n this.myBetsSummary.summaryUpdate.pipe(filterSportsEmitLast()).subscribe((stats: OpenBetsSummary) => {\n this.hasLiveOpenBets = stats.liveBetsCount > 0;\n this.openBetsCount = stats.openBetsCount;\n\n let betsCount: number | string = 0;\n let badgeClass = BottomNavActionsService.myBetsBadgeClass;\n if (this.mybetsConfig.isShowOpenBetsCount) {\n if (stats.openBetsCount > 99) {\n betsCount = '99+';\n badgeClass = badgeClass.replace('theme-spot-filled', 'open-bets bets-99-plus');\n } else {\n betsCount = stats.openBetsCount;\n badgeClass = badgeClass.replace('theme-spot-filled', 'open-bets');\n }\n } else betsCount = stats.liveBetsCount;\n const myBetsItem = this.layoutNavigationConfig?.bottomNavItemsMapping['mybets'] || 'mybets';\n\n this.bottomNavService.setItemCounter(myBetsItem, betsCount || null, badgeClass);\n });\n }\n\n this.betslipIntegrationService\n .betslipInitialized$()\n .pipe(\n filterSportsEmitLast(),\n switchMap(() =>\n combineLatest([this.betslipIntegrationService.betslipPicksCount$(), this.betslipIntegrationService.isAccaBoostToken$()]),\n ),\n )\n .subscribe(([count, isAccaBoost]) => this.setBetslipCounter(count, isAccaBoost));\n }\n\n private setBetslipCounter(count: number, isAccaBoost: boolean): void {\n this.bottomNavService.setItemCounter(\n 'betslip',\n count || null,\n isAccaBoost ? this.accaBoostBadgeClass : BottomNavActionsService.betslipBadgeClass,\n );\n }\n\n menuToggled(): void {\n this.vanillaNavigation.goToOverlayOutlet('menu');\n }\n\n private get accaBoostBadgeClass(): string {\n return `${BottomNavActionsService.betslipBadgeClass} ${BottomNavActionsService.extraIconBadgeClass} ${this.accaBoostConfig.icon}`;\n }\n}\n","import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';\n\nexport enum GameLauncherSection {\n Gyml = 'gyml',\n Link = 'link',\n Jackpot = 'jackpot',\n}\n\nexport interface GameLauncherModel {\n name: string;\n section: GameLauncherSection;\n position: number;\n title: string;\n provider: string;\n lobbyPosition: string;\n}\n\nexport const gameLauncherResolver: ResolveFn = (route: ActivatedRouteSnapshot): GameLauncherModel => ({\n name: route.params.name,\n section: route.params.section,\n position: route.params.position,\n title: route.params.title,\n provider: route.params.provider,\n lobbyPosition: route.params.lobbyPosition,\n});\n","import { Injectable } from '@angular/core';\n\nimport { LocalStoreService } from '@frontend/vanilla/core';\n\nexport interface StorageItem {\n data: T;\n timestamp: number;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LocalStorageService {\n constructor(private localStore: LocalStoreService) {}\n\n getItem(storageKey: string): T[] {\n const y = this.localStore.get(storageKey) || [];\n\n return y;\n }\n\n getItemObject(storageKey: string): T | null {\n return this.localStore.get(storageKey);\n }\n\n saveItem(storageKey: string, input: T): void {\n if (!input) {\n return;\n }\n\n this.localStore.set(storageKey, input);\n }\n\n clearStorage(storageKey: string): void {\n this.localStore.remove(storageKey);\n }\n\n addTimestampToItem(item: T): StorageItem {\n const timestamp = new Date().getTime();\n\n return { data: item, timestamp } as StorageItem;\n }\n\n sortStorageItemsByTimestamp(items: StorageItem[]): StorageItem[] {\n return items.sort((a, b) => b.timestamp - a.timestamp);\n }\n\n clearExpiredItems(expirationDays: number, storageKey: string): void {\n const storedItems: StorageItem[] = this.getItem>(storageKey);\n const currentTime = new Date().getTime();\n let hasItemRemoved = false;\n\n if (storedItems.length) {\n const filteredArray = storedItems.filter((item) => {\n if (!item?.timestamp) {\n hasItemRemoved = true;\n\n return false;\n }\n const millisecondsInOneDay: number = 1000 * 60 * 60 * 24;\n const daysDifference: number = Math.floor((currentTime - item.timestamp) / millisecondsInOneDay);\n\n if (daysDifference >= expirationDays) {\n hasItemRemoved = true;\n\n return false;\n }\n\n return true;\n });\n\n if (hasItemRemoved) {\n this.saveItem[]>(storageKey, filteredArray);\n }\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { PrettyUrlsConfig } from '@frontend/sports/common/client-config-data-access';\nimport { RouterEventsService } from '@frontend/sports/common/core/utils/router-events';\nimport { ParsedUrl, UrlService } from '@frontend/vanilla/core';\nimport { capitalize, cloneDeep, isEqual, toInteger } from 'lodash-es';\n\nimport { CompetitionRoute } from '../navigation/navigation.models';\n\ntype RegExpMapper = (result: RegExpExecArray) => CompetitionRoute;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CompetitionRouteService {\n private parsedUrl: ParsedUrl;\n private parsedRoute: CompetitionRoute = {};\n private matchers = new Map();\n private mappers = new Map();\n protected get base(): string {\n return '(/.+/sports)';\n }\n\n constructor(\n routerEvents: RouterEventsService,\n private router: Router,\n private urlService: UrlService,\n private urlConfig: PrettyUrlsConfig,\n ) {\n const context = (...options: string[]) => `(/(${options.join('|')}))`;\n const register = (key: string, regex: string, mapper: RegExpMapper) => {\n this.matchers.set(key, new RegExp(regex, 'i'));\n this.mappers.set(key, mapper);\n };\n\n const couponContext = context(this.urlConfig.translations.coupons);\n const competitionContext = context(this.urlConfig.translations.competitions);\n const conferencesContext = context(this.urlConfig.translations.conferences);\n const tournamentContext = context(this.urlConfig.translations.tournaments);\n const teampagesContext = context(this.urlConfig.translations.teamPages);\n const betsContext = '/' + this.urlConfig.translations.bets;\n const standingsContext = '/' + this.urlConfig.translations.standings;\n const liveContext = context(this.urlConfig.translations.live);\n const worldCupHubContext = context(this.urlConfig.translations.worldCupHub);\n\n const baseOptions = [\n this.urlConfig.translations.betting,\n this.urlConfig.translations.calendar,\n this.urlConfig.translations.in30minutes,\n this.urlConfig.translations.in60minutes,\n this.urlConfig.translations.in180minutes,\n this.urlConfig.translations.today,\n this.urlConfig.translations.nextRaces,\n this.urlConfig.translations.tomorrow,\n this.urlConfig.translations.after2days,\n this.urlConfig.translations.after3days,\n this.urlConfig.translations.next2days,\n this.urlConfig.translations.next3days,\n this.urlConfig.translations.next5days,\n this.urlConfig.translations.midWeek,\n this.urlConfig.translations.thisWeekend,\n ];\n const eventContext = context(...baseOptions, this.urlConfig.translations.coupons);\n const baseContext = context(...baseOptions);\n\n const node = '(/(([^/]+)-)?(\\\\d+))'; // name-identifier with optional name\n const virtualNode = '(/(([^/]+)-)?(0:(\\\\d+)))';\n\n register('bets', `${this.base}${betsContext}${node}${node}?${node}?${node}?$`, this.getBetsRoute);\n register('bets-virtual', `${this.base}${betsContext}${node}${node}${virtualNode}$`, this.getBetsVirtualRoute);\n register('sport', `${this.base}${node}${eventContext}?${competitionContext}?$`, this.getSportRoute);\n register('sport-modular', `${this.base}${node}/modular$`, this.getSportRoute); // temporary, needs to be removed after the route switch technique will be included\n register('calendar', `${this.base}${eventContext}$`, this.getCalendarRoute);\n register('conferences', `${this.base}${node}${conferencesContext}${node}?${node}?${node}?$`, this.getConferencesRoute);\n register('betting', `${this.base}${node}${baseContext}${node}?${node}?$`, this.getBettingRoute);\n register('betting-virtual', `${this.base}${node}${baseContext}${node}${virtualNode}${node}?$`, this.getVirtualBettingRoute);\n register('live', `${this.base}${liveContext}${node}${node}?${node}?$`, this.getLiveRoute);\n register('live-conference', `${this.base}${liveContext}${node}${node}?${node}?${node}?$`, this.getLiveConferenceRoute);\n register('live-virtual', `${this.base}${liveContext}${node}${node}${virtualNode}${node}?$`, this.getVirtualLiveRoute);\n register('betting-multi', `${this.base}${node}${baseContext}/(\\\\d+(,\\\\d+)*)$`, this.getBettingSportRoute);\n register('coupon', `${this.base}${node}${couponContext}(/${this.urlConfig.translations.betBuilder}|${node})?$`, this.getCouponRoute);\n register('tournament', `${this.base}${node}${tournamentContext}(/([^/]+))?${node}?$`, this.getTournamentRoute);\n register('teamPages', `${this.base}${node}${teampagesContext}(/([^/]+))?${node}?$`, this.getCommon);\n register('standings', `${this.base}${standingsContext}${node}${node}${node}?$`, this.getStandingsRoute);\n register('standings-virtual', `${this.base}${standingsContext}${node}${node}${virtualNode}${node}?$`, this.getStandingsVirtualRoute);\n register(\n 'coupon-competition',\n `${this.base}${node}${couponContext}${node}${node}(/${this.urlConfig.translations.betBuilder}|${node})$`,\n this.getCouponCompetitionRoute,\n );\n register(\n 'coupon-virtual',\n `${this.base}${node}${couponContext}${node}${virtualNode}(/${this.urlConfig.translations.betBuilder}|${node})$`,\n this.getCouponVirtualCompetitionRoute,\n );\n register('worldCupHub', `${this.base}${node}${worldCupHubContext}`, this.getWorldCupHubRoute);\n\n routerEvents.currentRoutesRecognized.subscribe((event) => {\n if (event) {\n const url = event.urlAfterRedirects || event.url || this.router.url;\n const parsed = this.urlService.parse(url);\n\n if (!this.parsedUrl || !isEqual(this.parsedUrl.path(), parsed.path()) || !isEqual(this.parsedUrl.search, parsed.search)) {\n this.parsedUrl = parsed;\n this.parsedRoute = this.parseUrl(parsed);\n }\n }\n });\n }\n\n current(): string {\n // as from vanilla code, they depend on window.location.pathname which is always encoded, so we need to decode\n return decodeURI(this.parsedUrl.url());\n }\n\n path(): string {\n // as from vanilla code, they depend on window.location.pathname which is always encoded, so we need to decode\n return decodeURI(this.parsedUrl.path());\n }\n\n params(): CompetitionRoute {\n return cloneDeep(this.parsedRoute);\n }\n\n parse(url: string): CompetitionRoute {\n const parsed = this.urlService.parse(url);\n\n return this.parseUrl(parsed);\n }\n\n private parseUrl(url: ParsedUrl): CompetitionRoute {\n let result: CompetitionRoute = {};\n\n // Root-level secondary outlets take the form e.g. /en/sports(overlay:menu/subpath)\n const decodedPathWithSecondaryOutletsRemoved = decodeURI(url.path()).replace(/\\(.*\\)/giu, '');\n\n for (const type of this.matchers.keys()) {\n const matcher = this.matchers.get(type);\n const mapper = this.mappers.get(type);\n\n if (matcher && mapper) {\n const match = matcher.exec(decodedPathWithSecondaryOutletsRemoved);\n\n if (match) {\n result = mapper(match);\n\n break;\n }\n }\n }\n\n return result;\n }\n\n private getQuery = (key: string) => this.parsedUrl.search.get(key) || undefined;\n private getInteger = (value?: string) => toInteger(value) || undefined;\n private getIntegerArray = (value?: string) => {\n const values = (value || '')\n .split(',')\n .map(this.getInteger)\n .filter((current) => !!current) as number[];\n\n if (values.length === 0) {\n return;\n }\n\n if (values.length === 1) {\n return values.pop();\n }\n\n return values;\n };\n\n private getSportRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n subContext: result[9],\n });\n\n private getBettingRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n region: this.getInteger(result[11]),\n regionName: result[10],\n league: this.getIntegerArray(result[15]),\n leagueName: result[14],\n });\n\n private getConferencesRoute: RegExpMapper = (result) => ({\n ...this.getBettingRoute(result),\n conference: result[19] ? this.getInteger(result[19]) || 0 : undefined,\n conferenceName: result[18],\n });\n\n private getVirtualBettingRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n region: this.getInteger(result[11]),\n regionName: result[10],\n league: this.getIntegerArray(result[16]),\n leagueName: result[14],\n virtualCompetitionGroup: this.getInteger(result[20]),\n virtualCompetitionGroupName: result[19],\n isVirtual: true,\n });\n\n private getBettingSportRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n league: this.getIntegerArray(result[8]),\n });\n\n private getCouponRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n coupon: this.getInteger(result[12]),\n couponName: result[11],\n });\n\n private getTournamentRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n tournament: result[9],\n league: this.getIntegerArray(result[13]),\n leagueName: result[12],\n });\n\n private getStandingsRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n context: this.urlConfig.translations.standings,\n leagueName: result[12],\n league: toInteger(result[13]),\n region: toInteger(result[9]),\n regionName: result[8],\n });\n\n private getStandingsVirtualRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n context: this.urlConfig.translations.standings,\n virtualCompetitionGroup: result[18] !== undefined ? toInteger(result[18]) : undefined,\n virtualCompetitionGroupName: result[17],\n isVirtual: true,\n leagueName: result[12],\n league: toInteger(result[14]),\n region: toInteger(result[9]),\n regionName: result[8],\n });\n\n private getCalendarRoute: RegExpMapper = (result) => ({\n base: result[1],\n context: result[3],\n });\n\n private getWorldCupHubRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n context: this.urlConfig.translations.worldCupHub,\n });\n\n private getBetsRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n league: this.getInteger(result[13]),\n leagueName: result[12],\n region: this.getInteger(result[9]),\n regionName: result[8],\n conference: this.getInteger(result[17]),\n conferenceName: result[16],\n marketOffer: this.getQuery('category'),\n outrightCategory: this.getQuery('outrightCategory'),\n specialCategory: this.getQuery('specialCategory'),\n context: this.urlConfig.translations.bets,\n });\n\n private getBetsVirtualRoute: RegExpMapper = (result) => ({\n ...this.getCommon(result),\n marketOffer: this.getQuery('category'),\n outrightCategory: this.getQuery('outrightCategory'),\n specialCategory: this.getQuery('specialCategory'),\n context: this.urlConfig.translations.bets,\n isVirtual: true,\n leagueName: result[12],\n league: toInteger(result[14]),\n region: toInteger(result[9]),\n regionName: result[8],\n });\n\n private getCommon: RegExpMapper = (result) => ({\n base: result[1],\n sport: this.getInteger(result[5]),\n sportName: result[4],\n context: result[7],\n marketTemplate: this.getInteger(this.getQuery('marketTemplate')),\n marketCategory: this.getInteger(this.getQuery('marketCategory')),\n marketOffer: this.getQuery('tab'),\n dynamicOfferCategory: this.getQuery('dynamicCategory'),\n });\n\n private getLiveRoute: RegExpMapper = (result) => ({\n base: result[1],\n sport: this.getInteger(result[7]),\n sportName: result[6],\n context: result[3],\n region: this.getInteger(result[11]),\n regionName: result[10],\n league: this.getIntegerArray(result[15]),\n leagueName: result[14],\n marketTemplate: this.getInteger(this.getQuery('marketTemplate')),\n marketCategory: this.getInteger(this.getQuery('marketCategory')),\n marketOffer: this.getQuery('tab'),\n });\n\n private getLiveConferenceRoute: RegExpMapper = (result) => ({\n ...this.getLiveRoute(result),\n conference: this.getInteger(result[19]),\n conferenceName: result[18],\n });\n\n private getVirtualLiveRoute: RegExpMapper = (result) => ({\n ...this.getLiveRoute(result),\n league: this.getIntegerArray(result[16]),\n virtualCompetitionGroup: this.getInteger(result[20]),\n virtualCompetitionGroupName: result[19],\n isVirtual: true,\n });\n\n private getCouponCompetitionRoute: RegExpMapper = (result) => ({\n ...this.getBettingRoute(result),\n coupon: this.getInteger(result[20]),\n couponName: result[19],\n });\n\n private getCouponVirtualCompetitionRoute: RegExpMapper = (result) => ({\n base: result[1],\n sport: this.getInteger(result[5]),\n sportName: result[4],\n context: result[7],\n region: this.getInteger(result[11]),\n regionName: result[10],\n league: this.getIntegerArray(result[16]),\n leagueName: result[14],\n isVirtual: true,\n coupon: this.getInteger(result[21]),\n couponName: result[20],\n });\n\n getCompetitionRouteTracking(hasFixtures: boolean): string {\n const params = this.params() ?? {};\n if (params.isVirtual) {\n let groupName = params.virtualCompetitionGroupName;\n\n if (!groupName) {\n groupName = 'All';\n }\n\n return `EventList/League/${groupName}`;\n }\n\n if (hasFixtures && params.league) {\n return 'EventList/League';\n }\n\n const routeContext = params.context;\n\n return `EventList/${capitalize(routeContext || 'all')}`;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { VirtualCompetitionGroupItem } from '@frontend/sports/common/core/data-access/sport-model';\n\nimport { FixtureList } from '../event-list-shared/sport/competitions/competition.models';\n\n@Injectable({ providedIn: 'root' })\nexport class CompetitionListSeoService {\n private realCompetitionId: number | undefined;\n\n getRealCompetitionId(): number | undefined {\n return this.realCompetitionId;\n }\n\n saveRealCompetitionId(id: number | undefined): void {\n this.realCompetitionId = id;\n }\n\n storeRealCompetitionId(fixtureList: FixtureList | undefined): void {\n this.realCompetitionId = undefined;\n const virtualCompetition = fixtureList && fixtureList.virtualCompetition;\n if (virtualCompetition) {\n const virtualGroupId = fixtureList.params && fixtureList.params.virtualCompetitionGroup;\n const virtualGroup =\n virtualCompetition.children &&\n (virtualCompetition.children.find((group) => group.id === virtualGroupId) as VirtualCompetitionGroupItem | undefined);\n this.realCompetitionId = virtualGroup ? virtualGroup.siblings[0] : virtualCompetition.siblings[0];\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Params } from '@angular/router';\n\nimport { ApiService } from '@frontend/sports/common/api-utils';\nimport { PrettyUrlsConfig } from '@frontend/sports/common/client-config-data-access';\nimport { LoggerFactory, SportsRemoteLogger } from '@frontend/sports/common/core/feature/logging';\nimport { assign, isArray, isEqual, keys, pickBy } from 'lodash-es';\nimport { Observable, catchError, map, of, switchMap, tap } from 'rxjs';\n\nimport { MasterdataApiService } from '../cds/cds-masterdata-api.service';\nimport { CompetitionListSeoService } from '../competition-list/competition-list-seo.service';\nimport { CompetitionRouteService } from '../competition-list/competition-route.service';\nimport { SportUrlParam } from '../navigation-core/url-helper.service';\nimport { CompetitionRoute } from '../navigation/navigation.models';\nimport { SeoContentApiRequest, SeoContentApiResponse, SeoRoute } from './seo.models';\n\ninterface SeoContentRequest {\n filter?: string;\n lobby?: boolean;\n live?: boolean;\n virtual?: boolean;\n highlights?: boolean;\n allSports?: boolean;\n sport?: number;\n region?: number | string;\n league?: number;\n event?: string;\n video?: boolean;\n conference?: number;\n virtualCompetitionId?: number;\n virtualCompetitionGroupId?: number;\n esportsLobby?: boolean;\n esportsHighlights?: boolean;\n multiSportsLobby?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SeoContentService {\n private lastRequestApiParams: SeoContentApiRequest | null = null;\n private lastResponse: SeoContentApiResponse | null = null;\n private readonly logger: SportsRemoteLogger;\n\n constructor(\n private competitionRoute: CompetitionRouteService,\n private api: ApiService,\n loggerFactory: LoggerFactory,\n private urlConfig: PrettyUrlsConfig,\n private competitionListSeoService: CompetitionListSeoService,\n private masterDataApiService: MasterdataApiService,\n ) {\n this.logger = loggerFactory.getLogger('SeoContentService');\n }\n\n getForEventDetails(request: SeoContentRequest): Observable {\n return this.performApiRequest(request);\n }\n\n getSeoContent(routeParams: Params, data: SeoRoute): Observable {\n const competitionData = this.competitionRoute.params();\n const league = competitionData.league;\n const routeData = assign(competitionData, routeParams);\n\n if (!routeData) {\n return of(undefined);\n }\n\n return this.getLeagueId(routeData, league || routeData.league).pipe(\n switchMap((leagueId) => {\n return this.performApiRequest({\n filter: this.getSeoFilter(routeData),\n lobby: data.sportsLobby,\n live: data.live,\n virtual: data.virtual,\n highlights: data.liveHighlights,\n allSports: data.sportsList,\n sport: routeData.sport,\n region: routeData.region || routeData.tournament,\n league: leagueId,\n video: data.liveVideo,\n conference: routeData.conference,\n virtualCompetitionId: routeData.isVirtual ? routeParams.league : null,\n virtualCompetitionGroupId: routeData.isVirtual ? routeParams.virtualCompetitionGroup : null,\n esportsLobby: data.esportsLobby,\n esportsHighlights: data.esportsHighlights,\n multiSportsLobby: data.multiSportsLobby,\n }).pipe(\n tap((response) => {\n if (response) {\n const fixtureContext: (string | undefined)[] = [\n this.urlConfig.translations.betting,\n this.urlConfig.translations.conferences,\n this.urlConfig.translations.after2days,\n this.urlConfig.translations.after3days,\n this.urlConfig.translations.in30minutes,\n this.urlConfig.translations.in60minutes,\n this.urlConfig.translations.in180minutes,\n this.urlConfig.translations.today,\n this.urlConfig.translations.tomorrow,\n ];\n\n response.h1Included = fixtureContext.includes(competitionData.context) && !!competitionData.region;\n }\n }),\n );\n }),\n );\n }\n\n private getLeagueId(routeData: CompetitionRoute & Params, leagueId: number | number[] | undefined): Observable {\n const league = isArray(leagueId) ? undefined : leagueId;\n if (!routeData.isVirtual) {\n return of(league);\n }\n const realCompetitionId = this.competitionListSeoService.getRealCompetitionId();\n if (realCompetitionId) {\n return of(realCompetitionId);\n }\n if (routeData.sport && league) {\n return this.masterDataApiService\n .getVirtualCompetitionInfo({\n competitionId: league,\n sportId: routeData.sport,\n virtualCompetitionGroupId: routeData.virtualCompetitionGroup || 0,\n virtualCompetitionId: league,\n })\n .pipe(\n map(\n (virtualCompetitionInfo) =>\n virtualCompetitionInfo?.virtualCompetitionGroup?.competitionIds[0] ||\n virtualCompetitionInfo?.virtualCompetition?.competitionIds[0],\n ),\n catchError((err) => {\n if (err.status) {\n this.logger.error(err, 'Error fetching virtual competition info');\n }\n\n return of(undefined);\n }),\n );\n }\n\n return of(league);\n }\n\n private performApiRequest(request: SeoContentRequest): Observable {\n const apiParams: SeoContentApiRequest = pickBy(request, (prop) => prop != null && prop !== false && prop !== '');\n\n if (this.lastResponse != null && isEqual(apiParams, this.lastRequestApiParams)) {\n return of(this.lastResponse);\n }\n\n return this.api.get('seo/tags', apiParams).pipe(\n tap((response) => {\n this.lastRequestApiParams = apiParams;\n this.lastResponse = response;\n }),\n catchError((err) => {\n // check if request got cancelled (happens e.g. if the user quickly navigates to another page or if the signal was lost) and only log exception if it's a real error\n if (err.status) {\n this.logger.error(err, 'Error getting SEO tags');\n }\n\n return of(undefined);\n }),\n );\n }\n\n private getSeoFilter(routeData: CompetitionRoute & Params): string | undefined {\n const contextKey = (input: string | undefined) =>\n keys(this.urlConfig.translations)\n .filter((prop) => this.urlConfig.translations[prop] === input)\n .pop();\n\n const subContext = contextKey(routeData.subContext);\n\n return subContext === SportUrlParam.Competitions ? subContext : contextKey(routeData.context);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { trackingConstants } from '@frontend/sports/tracking/feature';\nimport { isNil } from 'lodash-es';\nimport { IPickTracking } from 'packages/sports/common/betslip/core/picks/pick-models';\n\n@Injectable({ providedIn: 'root' })\nexport class PickSourceProvider {\n getTracking(): { [key: string]: string } {\n return {};\n }\n\n get(\n source: string,\n contentPosition?: number,\n isFallbackMarketEnabled?: boolean,\n marqueeName?: string,\n sitecoreTemplateId?: string,\n marqueeType?: string,\n trackingOptions?: { [key: string]: string },\n isAutomatedMarquee?: boolean,\n isInSheetView?: boolean,\n ): IPickTracking {\n const baseTracking: IPickTracking = {\n source,\n additional: trackingOptions || {},\n };\n if (!isNil(contentPosition)) {\n baseTracking[trackingConstants.COMPONENT_CONTENT_POSITION] = contentPosition.toString();\n }\n\n if (!isNil(isAutomatedMarquee)) {\n baseTracking.additional![trackingConstants.MARQUEE_CONTENT_LOGIC] = isAutomatedMarquee ? 'default - automated' : 'default';\n }\n\n if (isInSheetView) {\n baseTracking.additional![trackingConstants.COMPONENT_MODULE_NAME] = trackingConstants.SEE_ALL_OVERLAY;\n baseTracking.sheetviewSuffix = `/${trackingConstants.SEE_ALL_OVERLAY}`;\n }\n\n return baseTracking;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { Widget, WidgetLayoutTemplate, WidgetPage } from '@frontend/sports/types/components/widget';\n\n@Injectable()\nexport class ModularConfigAccessorService {\n private widget?: Widget;\n private parent?: Widget;\n private page?: WidgetPage;\n private layoutTemplate?: WidgetLayoutTemplate;\n\n setPage(page: WidgetPage | undefined): void {\n this.page = page;\n }\n\n getPage(): WidgetPage | undefined {\n return this.page;\n }\n\n setWidget(widget: Widget): void {\n this.widget = widget;\n }\n\n getWidget(): Readonly> | undefined {\n return this.widget;\n }\n\n setParentWidget(widget: Widget | undefined): void {\n this.parent = widget;\n }\n\n getParentWidget(): Readonly> | undefined {\n return this.parent;\n }\n\n setLayoutTemplate(layoutTemplate: WidgetLayoutTemplate | undefined): void {\n this.layoutTemplate = layoutTemplate;\n }\n\n getLayoutTemplate(): WidgetLayoutTemplate | undefined {\n return this.layoutTemplate;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { hasValue } from '@frontend/sports/common/core/utils/extended-types';\nimport { trackingConstants } from '@frontend/sports/tracking/feature';\nimport { Widget } from '@frontend/sports/types/components/widget';\nimport { isEmpty, isNil } from 'lodash-es';\nimport { IPickTracking } from 'packages/sports/common/betslip/core/picks/pick-models';\n\nimport { PickSourceProvider } from '../../option-pick/pick-source.provider';\nimport { ModularConfigAccessorService } from './modular-config-accessor.service';\n\n@Injectable()\nexport class ModularPickSourceService extends PickSourceProvider {\n constructor(private configAccessor: ModularConfigAccessorService) {\n super();\n }\n\n override getTracking(): { [key: string]: string } {\n return this.getBaseTracking();\n }\n\n override get(\n source: string,\n contentPosition?: number,\n isFallbackMarketEnabled?: boolean,\n marqueeName?: string,\n sitecoreTemplateId?: string,\n marqueeType?: string,\n trackingOptions?: { [key: string]: string },\n isAutomatedMarquee?: boolean,\n ): IPickTracking {\n const config = this.configAccessor.getWidget();\n const page = this.configAccessor.getPage();\n\n if (!config) {\n return super.get(source);\n }\n\n const baseTracking = {\n source: this.buildPath(page, config.templateName, source).toLowerCase(),\n additional: this.getBaseTracking(config),\n };\n\n if (!isNil(contentPosition)) {\n baseTracking.additional[trackingConstants.COMPONENT_CONTENT_POSITION] = contentPosition.toString();\n }\n\n if (!isNil(isAutomatedMarquee)) {\n baseTracking.additional[trackingConstants.MARQUEE_CONTENT_LOGIC] = isAutomatedMarquee ? 'default - automated' : 'default';\n } else if (!isNil(isFallbackMarketEnabled)) {\n baseTracking.additional[trackingConstants.MARQUEE_CONTENT_LOGIC] = isFallbackMarketEnabled ? 'fallback' : 'default';\n }\n\n if (!isNil(marqueeName)) {\n baseTracking.additional[trackingConstants.MARQUEE_NAME] = marqueeName;\n }\n\n if (!isNil(sitecoreTemplateId)) {\n baseTracking.additional[trackingConstants.SITECORE_TEMPLATE_ID] = sitecoreTemplateId;\n }\n\n if (!isNil(marqueeType)) {\n baseTracking.additional[trackingConstants.MARQUEE_TYPE] = marqueeType;\n }\n\n return baseTracking;\n }\n\n private getBaseTracking(config?: Readonly>): { [key: string]: string } {\n config = config || this.configAccessor.getWidget();\n const parentWidget = this.configAccessor.getParentWidget();\n\n let baseTracking = {};\n\n if (config) {\n baseTracking = Object.assign(baseTracking, config.trackingData, {\n [trackingConstants.COMPONENT_MODULE_NAME]: config.type,\n [trackingConstants.COMPONENT_MODULE_POSITION]: `${config.location}|${config.order}`,\n [trackingConstants.COMPONENT_MODULE_CUSTOM_NAME]: config.templateName,\n [trackingConstants.COMPONENT_MODULE_SOURCE]: isNil(parentWidget) ? 'standard module' : `composable|${parentWidget.templateName}`,\n });\n }\n\n const layoutTemplate = this.configAccessor.getLayoutTemplate();\n const page = this.configAccessor.getPage();\n if (layoutTemplate) {\n baseTracking = Object.assign(baseTracking, {\n [trackingConstants.COMPONENT_PAGE_LAYOUT]: this.buildPath(layoutTemplate.folder, page, layoutTemplate.name),\n });\n }\n\n return !isEmpty(baseTracking) ? baseTracking : super.getTracking();\n }\n\n private buildPath(...params: unknown[]): string {\n return params.filter(hasValue).join('/');\n }\n}\n","import { Nullable } from '@frontend/sports/common/core/utils/extended-types';\nimport { Odds } from '@frontend/sports/odds/feature';\nimport { Decimal } from 'decimal.js';\nimport { NumpadAction } from 'packages/sports/web/app/src/numpad/model';\n\nimport { PickId } from '../../core/picks/pick-id';\nimport { SlipResult } from '../betplacement/models';\nimport { BetPlacementError } from '../validation/errors/bet-placement-error';\nimport { BetslipError } from '../validation/errors/betslip-error';\n\nexport enum QuickBetActionButtonState {\n Login = 'Login',\n MakeDeposit = 'MakeDeposit',\n Place = 'Place',\n PlaceFreeBet = 'PlaceFreeBet',\n Placing = 'Placing',\n PlacingFreeBet = 'PlacingFreeBet',\n ProcessingDeposit = 'ProcessingDeposit',\n ProcessingDepositAndBet = 'ProcessingDepositAndBet',\n AcceptChanges = 'AcceptChanges',\n AcceptAndPlace = 'AcceptAndPlace',\n AcceptAndPlaceFreeBet = 'AcceptAndPlaceFreeBet',\n Deposit = 'Deposit',\n DepositAndPlaceBet = 'DepositAndPlaceBet',\n UpdateMinStake = 'UpdateMinStake',\n}\n\nexport enum QuickBetUiState {\n None = 'None',\n Loading = 'Loading',\n Place = 'Place',\n Success = 'Success',\n}\n\nexport interface IQuickBetActionButtonState {\n isDisabled: boolean;\n isProcessing: boolean;\n state: QuickBetActionButtonState;\n hasTaxation: boolean;\n possibleWinnings: Nullable;\n winningsBoost: Nullable;\n riskFreeAmount: Nullable;\n taxationAmount: Nullable;\n taxationLiability: Nullable;\n possibleWinningsNet: Nullable;\n}\n\nexport interface IQuickBetErrorsStatus {\n isLocked: boolean;\n isClosed: boolean;\n oddsChanged: boolean;\n oddsAccepted: boolean;\n hasBetslipErrors: boolean;\n hasStakeUpdateErrors: boolean;\n}\n\nexport interface IQuickBetWinningsState {\n hasTaxation: boolean;\n possibleWinnings: Nullable;\n winningsBoost: Nullable;\n riskFreeAmount: Nullable;\n taxationAmount: Nullable;\n taxationLiability: Nullable;\n taxationRate: Nullable;\n possibleWinningsNet: Nullable;\n originalWinnings?: Nullable;\n}\n\nexport const defaultQuickBetActionButtonState: IQuickBetActionButtonState = {\n isDisabled: false,\n isProcessing: false,\n state: QuickBetActionButtonState.Login,\n hasTaxation: false,\n possibleWinnings: null,\n winningsBoost: null,\n riskFreeAmount: null,\n taxationAmount: null,\n taxationLiability: null,\n possibleWinningsNet: null,\n};\n\nexport interface IQuickBetStakeState {\n stake: Nullable; // numpad-keys.component work with strings\n numpadAction?: NumpadAction;\n}\n\nexport const defaultQuickBetStakeState: IQuickBetStakeState = {\n stake: null,\n};\n\nexport interface IQuickBetPlaceResultWarning {\n disableButton: boolean;\n error: BetPlacementError;\n}\n\nexport interface IQuickBetPlaceResultSummaryState {\n stake: number;\n numberOfBets: number;\n currency?: string;\n possibleWinningsGross: number;\n possibleWinningsNet: number;\n}\n\nexport interface IQuickBetPlaceResultState {\n betNumber: string;\n slipResults: SlipResult;\n isSuccessful: boolean;\n errors: BetslipError[];\n warnings: IQuickBetPlaceResultWarning[];\n placedNewCustomerOffer: boolean;\n summary: IQuickBetPlaceResultSummaryState;\n isEachWay: boolean;\n acceptedOdds: Odds | null;\n boostedOdds: Odds | null;\n}\n\nexport const defaultQuickBetPlaceResultState: IQuickBetPlaceResultState = {\n betNumber: '',\n slipResults: {},\n isSuccessful: false,\n errors: [],\n warnings: [],\n placedNewCustomerOffer: false,\n summary: {},\n isEachWay: false,\n acceptedOdds: null,\n boostedOdds: null,\n};\n\nexport interface IQuickBetHelpState {\n isVisible: boolean;\n wasShown: boolean;\n}\n\nexport const defaultQuickBetHelpState: IQuickBetHelpState = {\n isVisible: false,\n wasShown: false,\n};\n\nexport interface IQuickBetState {\n uiState: QuickBetUiState;\n isDisabled: boolean;\n keepOpen: boolean;\n pickIds: PickId[];\n oddsChangedOnBetPlacement: boolean;\n pickLockedOnBetPlacement: boolean;\n displayHelper: QuickBetDisplayHelper;\n hasClosedPick: boolean;\n hasLockedPick: boolean;\n helpState: IQuickBetHelpState;\n stakeState: IQuickBetStakeState;\n actionButtonState: IQuickBetActionButtonState;\n betPlacedResult: IQuickBetPlaceResultState;\n inOverlay: boolean;\n inEditBetMode: boolean;\n}\n\nexport interface QuickBetDisplayHelper {\n addedToBetslip: boolean;\n //hidden => QB can be reopend if the user correct the error from betbar\n hiddenByError: boolean;\n //the user did not take care of the error we are closing QB\n closedByError: boolean;\n}\n\nexport const defaultQuickBetDisplayHelper: QuickBetDisplayHelper = {\n addedToBetslip: false,\n closedByError: false,\n hiddenByError: false,\n};\n\nexport const defaultQuickBetState: IQuickBetState = {\n uiState: QuickBetUiState.None,\n isDisabled: false,\n keepOpen: false,\n pickIds: [],\n displayHelper: defaultQuickBetDisplayHelper,\n oddsChangedOnBetPlacement: false,\n pickLockedOnBetPlacement: false,\n hasClosedPick: false,\n hasLockedPick: false,\n helpState: defaultQuickBetHelpState,\n stakeState: defaultQuickBetStakeState,\n actionButtonState: defaultQuickBetActionButtonState,\n betPlacedResult: defaultQuickBetPlaceResultState,\n inOverlay: false,\n inEditBetMode: false,\n};\n\nexport interface QuickBetStore {\n helpShown: boolean;\n}\n\nexport interface IQuickBetPlaceResultStorageState {\n betNumber: string;\n isSuccessful: boolean;\n errors: BetslipError[];\n warnings: IQuickBetPlaceResultWarning[];\n placedNewCustomerOffer: boolean;\n summary: IQuickBetPlaceResultSummaryState;\n isEachWay: boolean;\n acceptedOdds: Odds | null;\n boostedOdds: Odds | null;\n}\n\nexport interface IQuickBetSaveState {\n pickIds: string[];\n helpState: IQuickBetHelpState;\n keepOpen: boolean;\n stakeState: IQuickBetStakeState;\n actionButtonState: IQuickBetActionButtonState;\n betPlacedResult: IQuickBetPlaceResultStorageState;\n}\n","import { createSelector } from '@ngrx/store';\nimport { pickBy } from 'lodash-es';\n\nimport { BetslipType } from '../../core/betslip-type';\nimport { PickId } from '../../core/picks/pick-id';\nimport { isBetBuilderPick } from '../../core/utils';\nimport { betslipPicksListSelector, selectBetslipFlattenedPicksList, selectHasEachWayPick } from '../picks/selectors';\nimport { filterTypePicks } from '../picks/services/linear-betslip-pick.utils';\nimport { RewardTokenContext } from '../reward-tokens/reward-tokens.model';\nimport { selectIsRewardTokensSelectorVisible, selectRewardTokens } from '../reward-tokens/selectors';\nimport { betslipTypeStateSelector, selectBetBuilderPicksCount } from '../types/selectors';\nimport {\n selectBetslipTypeErrorsFactory,\n selectComboContainerModuleErrors,\n selectHasComboPreventionForTypeFactory,\n selectSlipErrorsForTypeFactory,\n} from '../validation/selectors';\n\nexport const comboBetStateSelector = createSelector(betslipTypeStateSelector, (typeState) => typeState.comboBet);\n\nexport const selectComboBetIsEachWay = createSelector(comboBetStateSelector, (comboBet) => comboBet.isEachWay);\n\nexport const comboBetStateStakeSelector = createSelector(comboBetStateSelector, (comboBet) => ({\n actualStake: comboBet.actualStake,\n stake: comboBet.stake,\n}));\n\nexport const comboBetPicksSelector = createSelector(comboBetStateSelector, (s) => s.picks);\n\nexport const comboBetPickSelectorFactory = (pickId: PickId) =>\n createSelector(comboBetPicksSelector, (picks) => {\n return picks[pickId.toString()];\n });\n\nexport const selectComboBetActualStake = createSelector(comboBetStateSelector, (state) => state.actualStake);\nexport const selectComboBetStake = createSelector(comboBetStateSelector, (state) => state.stake);\n\nexport const comboBetSelectedPicksSelector = createSelector(comboBetPicksSelector, (picks) => pickBy(picks, (pick) => pick.isSelected));\n\nexport const selectComboBetRewardTokenId = createSelector(comboBetStateSelector, (state) => state.rewardTokenId);\n\nexport const selectComboBetRewardToken = createSelector(selectComboBetRewardTokenId, selectRewardTokens, (tokenId, tokens) => {\n return tokenId ? tokens[tokenId] : null;\n});\n\nexport const selectComboBetPicks = createSelector(comboBetPicksSelector, selectBetslipFlattenedPicksList, (comboBetPicks, picksList) => {\n return picksList.filter((pick) => comboBetPicks[pick.id.toString()]);\n});\n\nexport const selectComboBetEachWay = createSelector(comboBetStateSelector, (comboState) => comboState.isEachWay);\n\nexport const selectComboBetComponentState = createSelector(comboBetStateSelector, selectComboBetPicks, (comboBetState, pickList) => ({\n comboBetState,\n pickList,\n}));\n\nexport const selectHasBetBuilderModuleErrors = createSelector(\n selectSlipErrorsForTypeFactory(BetslipType.BetBuilder),\n selectBetslipTypeErrorsFactory(BetslipType.BetBuilder),\n selectHasComboPreventionForTypeFactory(BetslipType.BetBuilder),\n (slipErrors, typeErrors, hasComboPrevention) => slipErrors.length > 0 || typeErrors.length > 0 || hasComboPrevention,\n);\n\nexport const selectPlaceableComboBetPicks = createSelector(comboBetPicksSelector, betslipPicksListSelector, (comboPicks, picksList) =>\n filterTypePicks(comboPicks, picksList, { isSelected: true, isLocked: false }),\n);\n\nexport const selectPlaceableComboBetBuilderPicksCount = createSelector(\n selectPlaceableComboBetPicks,\n (placeablePicks) => placeablePicks.filter(isBetBuilderPick).length,\n);\n\nexport const selectMainComboContainerState = (tokenContext: RewardTokenContext) =>\n createSelector(\n comboBetPicksSelector,\n selectComboBetEachWay,\n selectBetBuilderPicksCount,\n selectPlaceableComboBetPicks,\n selectPlaceableComboBetBuilderPicksCount,\n selectHasEachWayPick,\n selectIsRewardTokensSelectorVisible(tokenContext),\n selectComboContainerModuleErrors,\n selectHasComboPreventionForTypeFactory(BetslipType.Combo),\n (\n comboPicks,\n comboEachWay,\n betBuilderPicksCount,\n placeablePicks,\n placeableBetBuilderPicksCount,\n hasEachWayPick,\n isRewardSelectorVisible,\n moduleErrors,\n hasComboPrevention,\n ) => ({\n comboPicks,\n comboEachWay,\n betBuilderPicksCount,\n placeablePicks,\n placeableBetBuilderPicksCount,\n hasEachWayPick,\n isRewardSelectorVisible,\n moduleErrors,\n hasComboPrevention,\n }),\n );\n","import { Type } from '@angular/core';\n\nimport { BetslipError } from './betslip-error';\n\nexport interface INotifyUserError {\n userHasBeenNotified: boolean;\n\n markAsSeen(): void;\n}\n\nexport declare class NotifyUserError extends BetslipError implements INotifyUserError {\n userHasBeenNotified: boolean;\n markAsSeen(): void;\n}\n\nexport type ErrorConstructor = new (...args: any[]) => T;\n\nexport function NotifyUserErrorMixin<\n TBaseError extends BetslipError,\n TBaseErrorType extends ErrorConstructor = ErrorConstructor,\n>(\n // eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match\n BaseErrorType: TBaseErrorType,\n): Type {\n // @ts-ignore Constructor type https://github.com/Microsoft/TypeScript/issues/16390\n return class extends BaseErrorType implements INotifyUserError {\n constructor(...args: any[]) {\n super(...args);\n this.userHasBeenNotified = false;\n }\n\n userHasBeenNotified: boolean;\n\n markAsSeen(): void {\n this.userHasBeenNotified = true;\n }\n };\n}\n","import { PlacementErrorType } from '@frontend/sports/types/betslip';\n\nimport { BetPlacementErrorIcon } from '../bet-placement-error-icon';\nimport { BetslipError } from '../betslip-error';\nimport { NotifyUserErrorMixin } from '../notify-user-error';\nimport { ResultError } from './result-error';\n\nexport class PickInvisible extends NotifyUserErrorMixin(ResultError) {\n constructor(pickId: string) {\n super(pickId);\n this.icon = BetPlacementErrorIcon.Warning;\n this.priority = -999;\n this.hasClientValidation = true;\n this.type = PlacementErrorType.OptionInvisible;\n }\n\n override equals(error: BetslipError): boolean {\n return error instanceof PickInvisible && error.pickId === this.pickId;\n }\n}\n","import { PickInvisible } from '../result/pick-invisible';\nimport { IPickPreCheckError, PreCheckErrorMixin } from './pre-check-error';\n\n/**\n * Raised when market/option/price visibility is false.\n */\nexport class PickLockedPreCheckError extends PreCheckErrorMixin(PickInvisible) implements IPickPreCheckError {\n constructor(pickId: string) {\n super(pickId);\n }\n}\n","import { PlacementErrorType } from '@frontend/sports/types/betslip';\nimport { createSelector } from '@ngrx/store';\n\nimport { BetslipType } from '../../core/betslip-type';\nimport { BetslipUnknownPick } from '../../core/picks/betslip-unknown-pick';\nimport { getLegsCount } from '../../core/utils';\nimport { comboBetPicksSelector, comboBetSelectedPicksSelector } from '../combo-bet/selectors';\nimport { betslipPicksListSelector, selectBetslipFlattenedPicksList } from '../picks/selectors';\nimport { singleBetSelectedPicksSelector } from '../single-bet/selectors';\nimport { betslipCurrentTypeSelector } from '../types/base/selectors';\nimport { MinSelectionsBetbuilderError } from '../validation/errors/general/min-selections-betbuilder-error';\nimport { PickLockedPreCheckError } from '../validation/errors/pre-check/pick-locked-pre-check-error';\nimport { selectBetslipErrors, selectCurrentPicksErrors, selectPickErrorsState } from '../validation/selectors';\nimport { isPickStatusChangeError } from '../validation/services/utils/betslip-errors-utils';\n\nexport const selectedComboPicksSelector = createSelector(betslipPicksListSelector, comboBetSelectedPicksSelector, (pickList, selectedPicks) =>\n pickList.filter(({ id }) => !!selectedPicks[id.toString()]),\n);\n\n//include unselected picks\nexport const comboPickListCountSelector = createSelector(betslipPicksListSelector, comboBetPicksSelector, (pickList, comboBetPicks) => {\n const comboBetPick = pickList.filter(({ id }) => !!comboBetPicks[id.toString()]);\n\n return getLegsCount(comboBetPick);\n});\n\nexport const selectSelectedSinglePicks = createSelector(selectBetslipFlattenedPicksList, singleBetSelectedPicksSelector, (pickList, selectedPicks) =>\n pickList.filter(({ id }) => !!selectedPicks[id.toString()]),\n);\n\nexport const hasPickLockedPreCheckErrorSelector = createSelector(selectedComboPicksSelector, selectPickErrorsState, (selectedPicks, pickErrors) =>\n selectedPicks.some((pick) => {\n const errors = Object.values(pickErrors).flatMap((e) => e[pick.id.toString()] ?? []);\n\n return errors.some((e) => e instanceof PickLockedPreCheckError);\n }),\n);\n\nexport const hasComboPreventionErrorSelector = createSelector(selectedComboPicksSelector, selectCurrentPicksErrors, (selectedPicks, pickErrors) =>\n selectedPicks.some((pick) => {\n const errors = pickErrors[pick.id.toString()] ?? [];\n\n return errors.some((e) => e.type === PlacementErrorType.ComboPrevention);\n }),\n);\n\nexport const pickStatusChangeErrorSelector = createSelector(selectedComboPicksSelector, selectPickErrorsState, (selectedPicks, pickErrors) =>\n selectedPicks.some((pick) => {\n const errors = Object.values(pickErrors).flatMap((e) => e[pick.id.toString()] ?? []);\n\n return errors.some((e) => isPickStatusChangeError(e));\n }),\n);\n\nexport const singlePickCountSelector = createSelector(selectSelectedSinglePicks, (selectedPicks) => {\n return getLegsCount(selectedPicks);\n});\n\nexport const comboPickCountSelector = createSelector(selectedComboPicksSelector, (selectedPicks) => {\n return getLegsCount(selectedPicks);\n});\n\nexport const hasMinSelectionsBetbuilderError = createSelector(selectBetslipErrors, (betslipError) =>\n betslipError.some((e) => e instanceof MinSelectionsBetbuilderError),\n);\n\nexport const selectedPicksByCurrentTypeSelector = createSelector(\n betslipCurrentTypeSelector,\n selectedComboPicksSelector,\n selectSelectedSinglePicks,\n (currentType, selectedComboPicks, selectedSinglePicks) => {\n return currentType === BetslipType.Combo\n ? selectedComboPicks.filter((pick) => !BetslipUnknownPick.isPick(pick))\n : selectedSinglePicks.filter((pick) => !BetslipUnknownPick.isPick(pick));\n },\n);\n","import { createSelector } from '@ngrx/store';\n\nimport { betslipSelector } from '../../base/store/selectors';\n\nexport const settingsSelector = createSelector(betslipSelector, (s) => s.settings);\nexport const settingsOddsAcceptanceSelector = createSelector(settingsSelector, (s) => s.oddsAcceptance);\nexport const settingsNotificationsSelector = createSelector(settingsSelector, (s) => s.notifications);\n","export enum BetslipActionButtonTracking {\n NotApplicable = 'not applicable',\n Betslip = 'Betslip',\n QuickBet = 'QuickBet',\n EditMyBet = 'Edit My Bet',\n PlaceBet = 'Place bet',\n PlaceFreeBet = 'Place free bet',\n AcceptChanges = 'Accept changes',\n AcceptAndPlace = 'Accept&place bet',\n AcceptAndPlaceFreeBet = 'Accept&place freebet',\n LoginToBet = 'Login to bet',\n MakeDeposit = 'Make a deposit',\n Deposit = 'Deposit',\n DepositAndPlace = 'Deposit&place bet',\n Confirm = 'Confirm',\n SaveChanges = 'Save changes',\n}\n\nexport enum BetslipLinearTracking {\n NotApplicable = 'not applicable',\n Betslip = 'Betslip',\n FullBetslip = 'full betslip',\n Click = 'click',\n LinearCheckbox = 'linear checkbox',\n LinearNoCheckbox = 'linear no checkbox',\n Tabbed = 'tabbed',\n Combo = 'combo bet',\n Single = 'single bet',\n System = 'system bet',\n Teaser = 'teaser bet',\n EditBet = 'edit bet',\n Load = 'load',\n Icon = 'Icon',\n BetBuilder = 'betbuilder bet',\n SuccessMessage = 'success message',\n AddPromo = 'add promo',\n PromotionsPopup = 'rewards popup/active promotions',\n Close = 'close',\n SettingsIcon = 'settings icon',\n Settings = 'betslip settings',\n SettingsPopup = 'settings popup',\n}\n\nexport enum LinearCtaTrackingType {\n CloseCta = 'close cta',\n DepositCta = 'deposit cta',\n}\n\nexport enum PickBetTrackingTypes {\n Single = 'single',\n Parlay = 'parlay',\n Sgp = 'sgp',\n SgpPlus = 'sgp+',\n Teaser = 'teaser',\n System = 'system',\n}\n\nexport enum InfoTrackingContext {\n ComboBet = 'combo bet',\n Sgp = 'sgp',\n SgpPlus = 'sgp+',\n SystemBet = 'system bet',\n TeaserBet = 'teaser bet',\n}\n\nexport enum LinearCheckboxTrackingState {\n Selected = 'selected',\n Unselected = 'unselected',\n}\n\nexport enum LinearModuleExpansionTrackingState {\n Expand = 'expand',\n Collapse = 'collapse',\n}\n\nexport const BetslipTrackingLocation = 'Betslip';\nexport const LinearBetslipTrackingLocation = 'linear';\nexport const QuickBetTrackingLocation = 'Quick Bet';\n\nexport enum BetslipTrackingConstants {\n CategoryEvent = 'betslip',\n LabelEvent = 'full betslip',\n SourceTabbed = 'tabbed betslip',\n SourceLinear = 'linear betslip',\n Close = 'close cta',\n Click = 'click',\n}\n","import { createSelector } from '@ngrx/store';\n\nimport { betslipBaseSelector, betslipSelector, selectIsLinearBetslip } from '../../base/store/selectors';\nimport { BetslipType } from '../../core/betslip-type';\nimport { BetslipBetBuilderPick } from '../../core/picks/betslip-bet-builder-pick';\nimport { BetBuilderPickId, PickId } from '../../core/picks/pick-id';\nimport { getLegsCount, isBetBuilderPickId } from '../../core/utils';\nimport { comboPickCountSelector, singlePickCountSelector } from '../betslip-bar/selectors';\nimport { betslipPicksListSelector } from '../picks/selectors';\nimport { CriteriaType } from '../reward-tokens/reward-tokens.model';\nimport { selectTokensStateContext } from '../reward-tokens/selectors';\nimport { getSelectedTokenAndEligibilityForContext, getSelectedTokenForContext } from '../reward-tokens/services/linear-reward-tokens.utils';\nimport { isFreebetToken } from '../reward-tokens/services/reward-tokens.utils';\nimport { settingsOddsAcceptanceSelector } from '../settings/selectors';\nimport { PickBetTrackingTypes } from '../tracking/models';\nimport { betslipCurrentTypeSelector } from '../types/base/selectors';\nimport { betslipTypeStateSelector } from '../types/selectors';\nimport { GroupWithClosedLegsError } from '../validation/errors/general/group-pick-error';\nimport { selectAllBetBuilderErrors, selectAllCurrentBetslipErrors, selectPickErrorsState } from '../validation/selectors';\nimport {\n isGroupPickOfferChange,\n isPickStatusClosed,\n isPickStatusLocked,\n isPickStatusOddsChangedPreCheck,\n isUnderMinimumStakeErrorPreCheck,\n} from '../validation/services/utils/betslip-errors-utils';\nimport { QuickBetUiState } from './quick-bet.state';\n\nexport const quickBetStateSelector = createSelector(betslipSelector, (state) => state.quickBet);\nexport const quickBetUiStateSelector = createSelector(quickBetStateSelector, (state) => state.uiState);\nexport const actionButtonStateSelector = createSelector(quickBetStateSelector, (state) => state.actionButtonState);\nexport const betPlacedResultSelector = createSelector(quickBetStateSelector, (state) => state.betPlacedResult);\nexport const showQuickBetHelpSelector = createSelector(quickBetStateSelector, (state) => state.helpState);\nexport const selectQuickBetPickIds = createSelector(quickBetStateSelector, (state) => state.pickIds);\nexport const selectQuickBetStakeState = createSelector(quickBetStateSelector, (state) => state.stakeState);\n\nexport const selectLinearQuickBetBuilderState = createSelector(\n quickBetStateSelector,\n selectIsLinearBetslip,\n (state, isLinear): { isLinearQuickBetBuilder: true; pickId: PickId } | { isLinearQuickBetBuilder: false; pickId: undefined } => {\n if (state.pickIds.length === 1 && isBetBuilderPickId(state.pickIds[0]) && isLinear) {\n return {\n isLinearQuickBetBuilder: true,\n pickId: state.pickIds[0],\n };\n }\n\n return {\n isLinearQuickBetBuilder: false,\n pickId: undefined,\n };\n },\n);\n\nexport const selectQuickBetContext = createSelector(\n betslipBaseSelector,\n selectQuickBetPickIds,\n selectIsLinearBetslip,\n (\n betslipBaseState,\n quickBetPickIds,\n isLinear,\n ): { betslipType: BetslipType.Combo } | { betslipType: BetslipType.BetBuilder | BetslipType.Single; pickId: PickId } => {\n //The betbuilder pick can come from the BB drawer OR from the QB itself\n const betBuilderPickId = quickBetPickIds.length === 1 && isBetBuilderPickId(quickBetPickIds[0]) ? quickBetPickIds[0] : null;\n if (betBuilderPickId) {\n // if it's a bet builder pick, and we're in linear mode - all bet builder picks are stored in BetBuilderState\n if (isLinear) {\n return { betslipType: BetslipType.BetBuilder, pickId: betBuilderPickId };\n }\n\n // if it's a Sportcast pick and isSportcastAsCombo is false then it is stored in Single state\n if (BetBuilderPickId.isId(betBuilderPickId) && !betslipBaseState.isSportcastAsComboEnabled) {\n return { betslipType: BetslipType.Single, pickId: betBuilderPickId };\n }\n\n // otherwise(it's GroupPick OR Sportcast with isSportcastAsCombo==true) then we should check the Combo state\n return { betslipType: BetslipType.Combo };\n }\n\n // if it's a \"regular\" single pick, then check the Single state\n if (quickBetPickIds.length === 1) {\n return { betslipType: BetslipType.Single, pickId: quickBetPickIds[0] };\n }\n\n // otherwise(multiple picks), check Combo state\n return { betslipType: BetslipType.Combo };\n },\n);\n\nexport const selectQuickBetRewardToken = createSelector(selectTokensStateContext, selectQuickBetContext, ({ tokens, types }, context) => {\n return getSelectedTokenForContext(context, tokens, types);\n});\n\nexport const selectIsLinearQuickBetBuilder = createSelector(selectLinearQuickBetBuilderState, (state) => state.isLinearQuickBetBuilder);\n\nexport const selectAllQuickBetErrors = createSelector(\n selectIsLinearQuickBetBuilder,\n selectAllCurrentBetslipErrors,\n selectAllBetBuilderErrors,\n (isLinearQuickBetBuilder, currentBetslipErrors, betbuilderErrors) => {\n return isLinearQuickBetBuilder ? betbuilderErrors : currentBetslipErrors;\n },\n);\n\nexport const selectIsQuickBetSuccess = createSelector(quickBetUiStateSelector, (state) => state === QuickBetUiState.Success);\nexport const selectIsQuickBetInOverlay = createSelector(quickBetStateSelector, (state) => state.inOverlay);\n\nexport const selectQuickBetPicksErrors = createSelector(\n selectPickErrorsState,\n betslipCurrentTypeSelector,\n selectIsLinearQuickBetBuilder,\n (pickErrors, type, isLinearQuickBetBuilder) => {\n if (isLinearQuickBetBuilder) {\n return pickErrors[BetslipType.BetBuilder];\n }\n\n return type ? pickErrors[type] : {};\n },\n);\n\nexport const selectQuickBetErrorsState = createSelector(\n selectAllQuickBetErrors,\n selectQuickBetPicksErrors,\n quickBetStateSelector,\n (betslipErrors, pickErrors, quickBetState) => {\n const pickIds = quickBetState.pickIds;\n const quickBetPickErrors = pickIds.flatMap((pickId) => pickErrors[pickId.toString()] ?? []);\n const oddsChangedError = quickBetPickErrors.find(isPickStatusOddsChangedPreCheck);\n\n return {\n hasBetslipErrors: betslipErrors.length > 0,\n isLocked: quickBetPickErrors.some((error) => isPickStatusLocked(error) || isGroupPickOfferChange(error)),\n isClosed: quickBetPickErrors.some((error) => isPickStatusClosed(error) || error instanceof GroupWithClosedLegsError),\n oddsChanged: !!oddsChangedError,\n oddsAccepted: !!oddsChangedError?.userHasBeenNotified,\n hasStakeUpdateErrors: betslipErrors.some(isUnderMinimumStakeErrorPreCheck),\n };\n },\n);\n\nexport const selectHasQuickBetRewardTokensErrors = createSelector(\n selectTokensStateContext,\n selectQuickBetContext,\n ({ eligibilityState, tokens, types }, rewardTokenContext) => {\n const [_, eligibility] = getSelectedTokenAndEligibilityForContext(rewardTokenContext, eligibilityState, tokens, types);\n\n if (!eligibility) {\n return false;\n }\n\n return [CriteriaType.SlipType, CriteriaType.MinimumLegs, CriteriaType.MaximumStake].some(\n // This needs to be checked against the boolean literal, as using \"!\" would also return \"true\"\n // when the criteria type is undefined. We only want to return \"true\" if the type is defined and false\n (criteriaType) => eligibility.softCriteriasValidity[criteriaType] === false,\n );\n },\n);\n\nexport const selectQuickBetErrorsStateWithRewardsTokens = createSelector(\n selectQuickBetErrorsState,\n selectHasQuickBetRewardTokensErrors,\n (state, hasRewardTokensError) => ({\n ...state,\n hasBetslipErrors: state.hasBetslipErrors || hasRewardTokensError,\n }),\n);\n\nexport const selectClosedLockedPickOverview = createSelector(\n betslipTypeStateSelector,\n betslipPicksListSelector,\n selectQuickBetPicksErrors,\n (typeState, pickList, comboPickErrors) => ({\n typeState,\n pickList,\n comboPickErrors,\n }),\n);\n\nexport const selectQuickBetLockedState = createSelector(selectQuickBetErrorsState, (state) => state.isLocked);\nexport const selectQuickBetLockedOrClosedState = createSelector(selectQuickBetErrorsState, (state) => {\n return { isLocked: state.isLocked, isClosed: state.isClosed };\n});\n\nexport const selectQuickBetActionButtonProcessing = createSelector(actionButtonStateSelector, (state) => state.isProcessing);\n\nexport const selectQuickBetPickNotificationState = createSelector(\n quickBetStateSelector,\n betslipPicksListSelector,\n settingsOddsAcceptanceSelector,\n selectQuickBetErrorsState,\n (quickBet, picksList, oddsAcceptance, errorState) => ({ quickBet, picksList, oddsAcceptance, errorState }),\n);\n\nexport const selectQuickBetStakeErrorState = createSelector(selectQuickBetStakeState, selectAllQuickBetErrors, (stakeState, errors) => ({\n stakeState,\n errors,\n}));\n\nexport const selectQuickBetPicks = createSelector(betslipPicksListSelector, selectQuickBetPickIds, (pickList, quickBetPickIds) => {\n const stringPickIds = quickBetPickIds.map((id) => id.toString());\n\n return pickList.filter((pick) => stringPickIds.includes(pick.id.toString()));\n});\n\nexport const selectQuickBetBetBuilderPicks = createSelector(selectQuickBetPickIds, betslipPicksListSelector, (quickBetPickIds, pickList) => {\n const betBuilderPickIds = [...quickBetPickIds].filter(BetBuilderPickId.isId).map((id) => id.toString());\n\n return pickList.filter((pick) => betBuilderPickIds.includes(pick.id.toString())) as BetslipBetBuilderPick[];\n});\n\nexport const selectQuickBetBetBuilderPicksCount = createSelector(selectQuickBetBetBuilderPicks, (betBuilderPicks) => betBuilderPicks.length);\n\nexport const selectQuickBetDisplayHelper = createSelector(quickBetStateSelector, (quickBetState) => quickBetState.displayHelper);\n\nexport const selectQuickBetLegsCount = createSelector(selectQuickBetPicks, (quickBetPicks) => getLegsCount(quickBetPicks));\n\nexport const selectedPickCountByCurrentType = createSelector(\n betslipCurrentTypeSelector,\n comboPickCountSelector,\n singlePickCountSelector,\n (currentType, comboCount, singleCount) => {\n if (currentType === BetslipType.Single) {\n return singleCount;\n }\n\n return comboCount;\n },\n);\n\nexport const selectQuickBetTrackingType = createSelector(betslipBaseSelector, selectQuickBetPickIds, (betslipBaseState, quickBetPickIds) => {\n const betBuilderPickId = getBetBuilderId(quickBetPickIds);\n if (betBuilderPickId) {\n if (BetBuilderPickId.isId(betBuilderPickId) && !betslipBaseState.isSportcastAsComboEnabled) {\n return PickBetTrackingTypes.Single;\n }\n\n return PickBetTrackingTypes.Sgp;\n }\n\n if (quickBetPickIds.length === 1) {\n return isBetBuilderPickId(quickBetPickIds[0]) ? PickBetTrackingTypes.Sgp : PickBetTrackingTypes.Single;\n }\n\n return quickBetPickIds.some(isBetBuilderPickId) ? PickBetTrackingTypes.SgpPlus : PickBetTrackingTypes.Parlay;\n});\n\nexport const selectTrackingDetails = createSelector(selectQuickBetTrackingType, selectedPickCountByCurrentType, (trackingType, pickCount) => {\n return {\n mode: trackingType,\n pickCount,\n };\n});\n\nexport const selectIsQuickBetActive = createSelector(quickBetUiStateSelector, (state) => state !== QuickBetUiState.None);\n\nexport const selectQuickBetPickIdsOrBetbuilderId = createSelector(selectQuickBetPickIds, (pickIds) => {\n return [...pickIds];\n});\n\nfunction getBetBuilderId(quickBetPickIds: PickId[]) {\n if (quickBetPickIds.length === 1 && isBetBuilderPickId(quickBetPickIds[0])) {\n return quickBetPickIds[0];\n }\n\n return null;\n}\n\nexport const selectQuickBetFreebetToken = createSelector(selectQuickBetRewardToken, (tokenInfo) => (isFreebetToken(tokenInfo) ? tokenInfo : null));\n\nexport const selectIsQuickBetOpen = createSelector(\n quickBetUiStateSelector,\n selectQuickBetDisplayHelper,\n (uiState, displayHelper) => uiState !== QuickBetUiState.None && !displayHelper?.hiddenByError,\n);\n\nexport const selectQuickBetPicksWithErrors = createSelector(selectQuickBetPicks, selectQuickBetPicksErrors, (pickList, pickErrors) =>\n pickList.map((pick) => ({\n pick,\n errors: pickErrors[pick.id.toString()] || [],\n })),\n);\nexport const selectQuickBetUnderMinStakeError = createSelector(\n selectAllQuickBetErrors,\n (betslipErrors) => betslipErrors.find(isUnderMinimumStakeErrorPreCheck) ?? null,\n);\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, Signal, inject } from '@angular/core';\n\nimport { ScrollContainerService } from '@frontend/sports/common/core/utils/scroll-container';\nimport { Store } from '@ngrx/store';\nimport { selectIsQuickBetSuccess } from 'packages/sports/common/betslip/modules/quick-bet/quick-bet.selectors';\nimport { IQuickBetState } from 'packages/sports/common/betslip/modules/quick-bet/quick-bet.state';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HideHeaderService {\n scrollLastPosition = 0;\n private quickBetUiState: Signal;\n\n private readonly _doc = inject(DOCUMENT);\n\n constructor(\n private scrollContainer: ScrollContainerService,\n private store: Store,\n ) {\n this.quickBetUiState = this.store.selectSignal(selectIsQuickBetSuccess);\n }\n\n onScroll() {\n if (this.quickBetUiState()) {\n return;\n }\n\n if (this.scrollContainer.scrollTop > 5 && this.scrollContainer.scrollTop >= this.scrollLastPosition) {\n const headerElement = this._doc.querySelector('.slot-header_bottom_items') as HTMLElement;\n const scrollHeight = headerElement.offsetTop;\n const scrollTop = (Math.abs(scrollHeight) * -1).toString();\n this._doc.querySelector('.slot-header')?.setAttribute('style', `top:${scrollTop}px`);\n } else {\n this._doc.querySelector('.slot-header')?.removeAttribute('style');\n }\n this.scrollLastPosition = this.scrollContainer.scrollTop;\n }\n\n removeHideHeader() {\n this._doc.querySelector('.slot-header')?.removeAttribute('style');\n }\n}\n","/**\r\n * A collection of shims that provide minimal functionality of the ES6 collections.\r\n *\r\n * These implementations are not meant to be used outside of the ResizeObserver\r\n * modules as they cover only a limited range of use cases.\r\n */\n/* eslint-disable require-jsdoc, valid-jsdoc */\nvar MapShim = function () {\n if (typeof Map !== 'undefined') {\n return Map;\n }\n /**\r\n * Returns index in provided array that matches the specified key.\r\n *\r\n * @param {Array} arr\r\n * @param {*} key\r\n * @returns {number}\r\n */\n function getIndex(arr, key) {\n var result = -1;\n arr.some(function (entry, index) {\n if (entry[0] === key) {\n result = index;\n return true;\n }\n return false;\n });\n return result;\n }\n return /** @class */function () {\n function class_1() {\n this.__entries__ = [];\n }\n Object.defineProperty(class_1.prototype, \"size\", {\n /**\r\n * @returns {boolean}\r\n */\n get: function () {\n return this.__entries__.length;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @param {*} key\r\n * @returns {*}\r\n */\n class_1.prototype.get = function (key) {\n var index = getIndex(this.__entries__, key);\n var entry = this.__entries__[index];\n return entry && entry[1];\n };\n /**\r\n * @param {*} key\r\n * @param {*} value\r\n * @returns {void}\r\n */\n class_1.prototype.set = function (key, value) {\n var index = getIndex(this.__entries__, key);\n if (~index) {\n this.__entries__[index][1] = value;\n } else {\n this.__entries__.push([key, value]);\n }\n };\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\n class_1.prototype.delete = function (key) {\n var entries = this.__entries__;\n var index = getIndex(entries, key);\n if (~index) {\n entries.splice(index, 1);\n }\n };\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\n class_1.prototype.has = function (key) {\n return !!~getIndex(this.__entries__, key);\n };\n /**\r\n * @returns {void}\r\n */\n class_1.prototype.clear = function () {\n this.__entries__.splice(0);\n };\n /**\r\n * @param {Function} callback\r\n * @param {*} [ctx=null]\r\n * @returns {void}\r\n */\n class_1.prototype.forEach = function (callback, ctx) {\n if (ctx === void 0) {\n ctx = null;\n }\n for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {\n var entry = _a[_i];\n callback.call(ctx, entry[1], entry[0]);\n }\n };\n return class_1;\n }();\n}();\n\n/**\r\n * Detects whether window and document objects are available in current environment.\r\n */\nvar isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;\n\n// Returns global object of a current environment.\nvar global$1 = function () {\n if (typeof global !== 'undefined' && global.Math === Math) {\n return global;\n }\n if (typeof self !== 'undefined' && self.Math === Math) {\n return self;\n }\n if (typeof window !== 'undefined' && window.Math === Math) {\n return window;\n }\n // eslint-disable-next-line no-new-func\n return Function('return this')();\n}();\n\n/**\r\n * A shim for the requestAnimationFrame which falls back to the setTimeout if\r\n * first one is not supported.\r\n *\r\n * @returns {number} Requests' identifier.\r\n */\nvar requestAnimationFrame$1 = function () {\n if (typeof requestAnimationFrame === 'function') {\n // It's required to use a bounded function because IE sometimes throws\n // an \"Invalid calling object\" error if rAF is invoked without the global\n // object on the left hand side.\n return requestAnimationFrame.bind(global$1);\n }\n return function (callback) {\n return setTimeout(function () {\n return callback(Date.now());\n }, 1000 / 60);\n };\n}();\n\n// Defines minimum timeout before adding a trailing call.\nvar trailingTimeout = 2;\n/**\r\n * Creates a wrapper function which ensures that provided callback will be\r\n * invoked only once during the specified delay period.\r\n *\r\n * @param {Function} callback - Function to be invoked after the delay period.\r\n * @param {number} delay - Delay after which to invoke callback.\r\n * @returns {Function}\r\n */\nfunction throttle(callback, delay) {\n var leadingCall = false,\n trailingCall = false,\n lastCallTime = 0;\n /**\r\n * Invokes the original callback function and schedules new invocation if\r\n * the \"proxy\" was called during current request.\r\n *\r\n * @returns {void}\r\n */\n function resolvePending() {\n if (leadingCall) {\n leadingCall = false;\n callback();\n }\n if (trailingCall) {\n proxy();\n }\n }\n /**\r\n * Callback invoked after the specified delay. It will further postpone\r\n * invocation of the original function delegating it to the\r\n * requestAnimationFrame.\r\n *\r\n * @returns {void}\r\n */\n function timeoutCallback() {\n requestAnimationFrame$1(resolvePending);\n }\n /**\r\n * Schedules invocation of the original function.\r\n *\r\n * @returns {void}\r\n */\n function proxy() {\n var timeStamp = Date.now();\n if (leadingCall) {\n // Reject immediately following calls.\n if (timeStamp - lastCallTime < trailingTimeout) {\n return;\n }\n // Schedule new call to be in invoked when the pending one is resolved.\n // This is important for \"transitions\" which never actually start\n // immediately so there is a chance that we might miss one if change\n // happens amids the pending invocation.\n trailingCall = true;\n } else {\n leadingCall = true;\n trailingCall = false;\n setTimeout(timeoutCallback, delay);\n }\n lastCallTime = timeStamp;\n }\n return proxy;\n}\n\n// Minimum delay before invoking the update of observers.\nvar REFRESH_DELAY = 20;\n// A list of substrings of CSS properties used to find transition events that\n// might affect dimensions of observed elements.\nvar transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];\n// Check if MutationObserver is available.\nvar mutationObserverSupported = typeof MutationObserver !== 'undefined';\n/**\r\n * Singleton controller class which handles updates of ResizeObserver instances.\r\n */\nvar ResizeObserverController = /** @class */function () {\n /**\r\n * Creates a new instance of ResizeObserverController.\r\n *\r\n * @private\r\n */\n function ResizeObserverController() {\n /**\r\n * Indicates whether DOM listeners have been added.\r\n *\r\n * @private {boolean}\r\n */\n this.connected_ = false;\n /**\r\n * Tells that controller has subscribed for Mutation Events.\r\n *\r\n * @private {boolean}\r\n */\n this.mutationEventsAdded_ = false;\n /**\r\n * Keeps reference to the instance of MutationObserver.\r\n *\r\n * @private {MutationObserver}\r\n */\n this.mutationsObserver_ = null;\n /**\r\n * A list of connected observers.\r\n *\r\n * @private {Array}\r\n */\n this.observers_ = [];\n this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);\n this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);\n }\n /**\r\n * Adds observer to observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be added.\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.addObserver = function (observer) {\n if (!~this.observers_.indexOf(observer)) {\n this.observers_.push(observer);\n }\n // Add listeners if they haven't been added yet.\n if (!this.connected_) {\n this.connect_();\n }\n };\n /**\r\n * Removes observer from observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be removed.\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.removeObserver = function (observer) {\n var observers = this.observers_;\n var index = observers.indexOf(observer);\n // Remove observer if it's present in registry.\n if (~index) {\n observers.splice(index, 1);\n }\n // Remove listeners if controller has no connected observers.\n if (!observers.length && this.connected_) {\n this.disconnect_();\n }\n };\n /**\r\n * Invokes the update of observers. It will continue running updates insofar\r\n * it detects changes.\r\n *\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.refresh = function () {\n var changesDetected = this.updateObservers_();\n // Continue running updates if changes have been detected as there might\n // be future ones caused by CSS transitions.\n if (changesDetected) {\n this.refresh();\n }\n };\n /**\r\n * Updates every observer from observers list and notifies them of queued\r\n * entries.\r\n *\r\n * @private\r\n * @returns {boolean} Returns \"true\" if any observer has detected changes in\r\n * dimensions of it's elements.\r\n */\n ResizeObserverController.prototype.updateObservers_ = function () {\n // Collect observers that have active observations.\n var activeObservers = this.observers_.filter(function (observer) {\n return observer.gatherActive(), observer.hasActive();\n });\n // Deliver notifications in a separate cycle in order to avoid any\n // collisions between observers, e.g. when multiple instances of\n // ResizeObserver are tracking the same element and the callback of one\n // of them changes content dimensions of the observed target. Sometimes\n // this may result in notifications being blocked for the rest of observers.\n activeObservers.forEach(function (observer) {\n return observer.broadcastActive();\n });\n return activeObservers.length > 0;\n };\n /**\r\n * Initializes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.connect_ = function () {\n // Do nothing if running in a non-browser environment or if listeners\n // have been already added.\n if (!isBrowser || this.connected_) {\n return;\n }\n // Subscription to the \"Transitionend\" event is used as a workaround for\n // delayed transitions. This way it's possible to capture at least the\n // final state of an element.\n document.addEventListener('transitionend', this.onTransitionEnd_);\n window.addEventListener('resize', this.refresh);\n if (mutationObserverSupported) {\n this.mutationsObserver_ = new MutationObserver(this.refresh);\n this.mutationsObserver_.observe(document, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true\n });\n } else {\n document.addEventListener('DOMSubtreeModified', this.refresh);\n this.mutationEventsAdded_ = true;\n }\n this.connected_ = true;\n };\n /**\r\n * Removes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.disconnect_ = function () {\n // Do nothing if running in a non-browser environment or if listeners\n // have been already removed.\n if (!isBrowser || !this.connected_) {\n return;\n }\n document.removeEventListener('transitionend', this.onTransitionEnd_);\n window.removeEventListener('resize', this.refresh);\n if (this.mutationsObserver_) {\n this.mutationsObserver_.disconnect();\n }\n if (this.mutationEventsAdded_) {\n document.removeEventListener('DOMSubtreeModified', this.refresh);\n }\n this.mutationsObserver_ = null;\n this.mutationEventsAdded_ = false;\n this.connected_ = false;\n };\n /**\r\n * \"Transitionend\" event handler.\r\n *\r\n * @private\r\n * @param {TransitionEvent} event\r\n * @returns {void}\r\n */\n ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {\n var _b = _a.propertyName,\n propertyName = _b === void 0 ? '' : _b;\n // Detect whether transition may affect dimensions of an element.\n var isReflowProperty = transitionKeys.some(function (key) {\n return !!~propertyName.indexOf(key);\n });\n if (isReflowProperty) {\n this.refresh();\n }\n };\n /**\r\n * Returns instance of the ResizeObserverController.\r\n *\r\n * @returns {ResizeObserverController}\r\n */\n ResizeObserverController.getInstance = function () {\n if (!this.instance_) {\n this.instance_ = new ResizeObserverController();\n }\n return this.instance_;\n };\n /**\r\n * Holds reference to the controller's instance.\r\n *\r\n * @private {ResizeObserverController}\r\n */\n ResizeObserverController.instance_ = null;\n return ResizeObserverController;\n}();\n\n/**\r\n * Defines non-writable/enumerable properties of the provided target object.\r\n *\r\n * @param {Object} target - Object for which to define properties.\r\n * @param {Object} props - Properties to be defined.\r\n * @returns {Object} Target object.\r\n */\nvar defineConfigurable = function (target, props) {\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\n var key = _a[_i];\n Object.defineProperty(target, key, {\n value: props[key],\n enumerable: false,\n writable: false,\n configurable: true\n });\n }\n return target;\n};\n\n/**\r\n * Returns the global object associated with provided element.\r\n *\r\n * @param {Object} target\r\n * @returns {Object}\r\n */\nvar getWindowOf = function (target) {\n // Assume that the element is an instance of Node, which means that it\n // has the \"ownerDocument\" property from which we can retrieve a\n // corresponding global object.\n var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;\n // Return the local global object if it's not possible extract one from\n // provided element.\n return ownerGlobal || global$1;\n};\n\n// Placeholder of an empty content rectangle.\nvar emptyRect = createRectInit(0, 0, 0, 0);\n/**\r\n * Converts provided string to a number.\r\n *\r\n * @param {number|string} value\r\n * @returns {number}\r\n */\nfunction toFloat(value) {\n return parseFloat(value) || 0;\n}\n/**\r\n * Extracts borders size from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @param {...string} positions - Borders positions (top, right, ...)\r\n * @returns {number}\r\n */\nfunction getBordersSize(styles) {\n var positions = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n positions[_i - 1] = arguments[_i];\n }\n return positions.reduce(function (size, position) {\n var value = styles['border-' + position + '-width'];\n return size + toFloat(value);\n }, 0);\n}\n/**\r\n * Extracts paddings sizes from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @returns {Object} Paddings box.\r\n */\nfunction getPaddings(styles) {\n var positions = ['top', 'right', 'bottom', 'left'];\n var paddings = {};\n for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {\n var position = positions_1[_i];\n var value = styles['padding-' + position];\n paddings[position] = toFloat(value);\n }\n return paddings;\n}\n/**\r\n * Calculates content rectangle of provided SVG element.\r\n *\r\n * @param {SVGGraphicsElement} target - Element content rectangle of which needs\r\n * to be calculated.\r\n * @returns {DOMRectInit}\r\n */\nfunction getSVGContentRect(target) {\n var bbox = target.getBBox();\n return createRectInit(0, 0, bbox.width, bbox.height);\n}\n/**\r\n * Calculates content rectangle of provided HTMLElement.\r\n *\r\n * @param {HTMLElement} target - Element for which to calculate the content rectangle.\r\n * @returns {DOMRectInit}\r\n */\nfunction getHTMLElementContentRect(target) {\n // Client width & height properties can't be\n // used exclusively as they provide rounded values.\n var clientWidth = target.clientWidth,\n clientHeight = target.clientHeight;\n // By this condition we can catch all non-replaced inline, hidden and\n // detached elements. Though elements with width & height properties less\n // than 0.5 will be discarded as well.\n //\n // Without it we would need to implement separate methods for each of\n // those cases and it's not possible to perform a precise and performance\n // effective test for hidden elements. E.g. even jQuery's ':visible' filter\n // gives wrong results for elements with width & height less than 0.5.\n if (!clientWidth && !clientHeight) {\n return emptyRect;\n }\n var styles = getWindowOf(target).getComputedStyle(target);\n var paddings = getPaddings(styles);\n var horizPad = paddings.left + paddings.right;\n var vertPad = paddings.top + paddings.bottom;\n // Computed styles of width & height are being used because they are the\n // only dimensions available to JS that contain non-rounded values. It could\n // be possible to utilize the getBoundingClientRect if only it's data wasn't\n // affected by CSS transformations let alone paddings, borders and scroll bars.\n var width = toFloat(styles.width),\n height = toFloat(styles.height);\n // Width & height include paddings and borders when the 'border-box' box\n // model is applied (except for IE).\n if (styles.boxSizing === 'border-box') {\n // Following conditions are required to handle Internet Explorer which\n // doesn't include paddings and borders to computed CSS dimensions.\n //\n // We can say that if CSS dimensions + paddings are equal to the \"client\"\n // properties then it's either IE, and thus we don't need to subtract\n // anything, or an element merely doesn't have paddings/borders styles.\n if (Math.round(width + horizPad) !== clientWidth) {\n width -= getBordersSize(styles, 'left', 'right') + horizPad;\n }\n if (Math.round(height + vertPad) !== clientHeight) {\n height -= getBordersSize(styles, 'top', 'bottom') + vertPad;\n }\n }\n // Following steps can't be applied to the document's root element as its\n // client[Width/Height] properties represent viewport area of the window.\n // Besides, it's as well not necessary as the itself neither has\n // rendered scroll bars nor it can be clipped.\n if (!isDocumentElement(target)) {\n // In some browsers (only in Firefox, actually) CSS width & height\n // include scroll bars size which can be removed at this step as scroll\n // bars are the only difference between rounded dimensions + paddings\n // and \"client\" properties, though that is not always true in Chrome.\n var vertScrollbar = Math.round(width + horizPad) - clientWidth;\n var horizScrollbar = Math.round(height + vertPad) - clientHeight;\n // Chrome has a rather weird rounding of \"client\" properties.\n // E.g. for an element with content width of 314.2px it sometimes gives\n // the client width of 315px and for the width of 314.7px it may give\n // 314px. And it doesn't happen all the time. So just ignore this delta\n // as a non-relevant.\n if (Math.abs(vertScrollbar) !== 1) {\n width -= vertScrollbar;\n }\n if (Math.abs(horizScrollbar) !== 1) {\n height -= horizScrollbar;\n }\n }\n return createRectInit(paddings.left, paddings.top, width, height);\n}\n/**\r\n * Checks whether provided element is an instance of the SVGGraphicsElement.\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\nvar isSVGGraphicsElement = function () {\n // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement\n // interface.\n if (typeof SVGGraphicsElement !== 'undefined') {\n return function (target) {\n return target instanceof getWindowOf(target).SVGGraphicsElement;\n };\n }\n // If it's so, then check that element is at least an instance of the\n // SVGElement and that it has the \"getBBox\" method.\n // eslint-disable-next-line no-extra-parens\n return function (target) {\n return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function';\n };\n}();\n/**\r\n * Checks whether provided element is a document element ().\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\nfunction isDocumentElement(target) {\n return target === getWindowOf(target).document.documentElement;\n}\n/**\r\n * Calculates an appropriate content rectangle for provided html or svg element.\r\n *\r\n * @param {Element} target - Element content rectangle of which needs to be calculated.\r\n * @returns {DOMRectInit}\r\n */\nfunction getContentRect(target) {\n if (!isBrowser) {\n return emptyRect;\n }\n if (isSVGGraphicsElement(target)) {\n return getSVGContentRect(target);\n }\n return getHTMLElementContentRect(target);\n}\n/**\r\n * Creates rectangle with an interface of the DOMRectReadOnly.\r\n * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly\r\n *\r\n * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.\r\n * @returns {DOMRectReadOnly}\r\n */\nfunction createReadOnlyRect(_a) {\n var x = _a.x,\n y = _a.y,\n width = _a.width,\n height = _a.height;\n // If DOMRectReadOnly is available use it as a prototype for the rectangle.\n var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;\n var rect = Object.create(Constr.prototype);\n // Rectangle's properties are not writable and non-enumerable.\n defineConfigurable(rect, {\n x: x,\n y: y,\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: height + y,\n left: x\n });\n return rect;\n}\n/**\r\n * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.\r\n * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit\r\n *\r\n * @param {number} x - X coordinate.\r\n * @param {number} y - Y coordinate.\r\n * @param {number} width - Rectangle's width.\r\n * @param {number} height - Rectangle's height.\r\n * @returns {DOMRectInit}\r\n */\nfunction createRectInit(x, y, width, height) {\n return {\n x: x,\n y: y,\n width: width,\n height: height\n };\n}\n\n/**\r\n * Class that is responsible for computations of the content rectangle of\r\n * provided DOM element and for keeping track of it's changes.\r\n */\nvar ResizeObservation = /** @class */function () {\n /**\r\n * Creates an instance of ResizeObservation.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n */\n function ResizeObservation(target) {\n /**\r\n * Broadcasted width of content rectangle.\r\n *\r\n * @type {number}\r\n */\n this.broadcastWidth = 0;\n /**\r\n * Broadcasted height of content rectangle.\r\n *\r\n * @type {number}\r\n */\n this.broadcastHeight = 0;\n /**\r\n * Reference to the last observed content rectangle.\r\n *\r\n * @private {DOMRectInit}\r\n */\n this.contentRect_ = createRectInit(0, 0, 0, 0);\n this.target = target;\n }\n /**\r\n * Updates content rectangle and tells whether it's width or height properties\r\n * have changed since the last broadcast.\r\n *\r\n * @returns {boolean}\r\n */\n ResizeObservation.prototype.isActive = function () {\n var rect = getContentRect(this.target);\n this.contentRect_ = rect;\n return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;\n };\n /**\r\n * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data\r\n * from the corresponding properties of the last observed content rectangle.\r\n *\r\n * @returns {DOMRectInit} Last observed content rectangle.\r\n */\n ResizeObservation.prototype.broadcastRect = function () {\n var rect = this.contentRect_;\n this.broadcastWidth = rect.width;\n this.broadcastHeight = rect.height;\n return rect;\n };\n return ResizeObservation;\n}();\nvar ResizeObserverEntry = /** @class */function () {\n /**\r\n * Creates an instance of ResizeObserverEntry.\r\n *\r\n * @param {Element} target - Element that is being observed.\r\n * @param {DOMRectInit} rectInit - Data of the element's content rectangle.\r\n */\n function ResizeObserverEntry(target, rectInit) {\n var contentRect = createReadOnlyRect(rectInit);\n // According to the specification following properties are not writable\n // and are also not enumerable in the native implementation.\n //\n // Property accessors are not being used as they'd require to define a\n // private WeakMap storage which may cause memory leaks in browsers that\n // don't support this type of collections.\n defineConfigurable(this, {\n target: target,\n contentRect: contentRect\n });\n }\n return ResizeObserverEntry;\n}();\nvar ResizeObserverSPI = /** @class */function () {\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback function that is invoked\r\n * when one of the observed elements changes it's content dimensions.\r\n * @param {ResizeObserverController} controller - Controller instance which\r\n * is responsible for the updates of observer.\r\n * @param {ResizeObserver} callbackCtx - Reference to the public\r\n * ResizeObserver instance which will be passed to callback function.\r\n */\n function ResizeObserverSPI(callback, controller, callbackCtx) {\n /**\r\n * Collection of resize observations that have detected changes in dimensions\r\n * of elements.\r\n *\r\n * @private {Array}\r\n */\n this.activeObservations_ = [];\n /**\r\n * Registry of the ResizeObservation instances.\r\n *\r\n * @private {Map}\r\n */\n this.observations_ = new MapShim();\n if (typeof callback !== 'function') {\n throw new TypeError('The callback provided as parameter 1 is not a function.');\n }\n this.callback_ = callback;\n this.controller_ = controller;\n this.callbackCtx_ = callbackCtx;\n }\n /**\r\n * Starts observing provided element.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.observe = function (target) {\n if (!arguments.length) {\n throw new TypeError('1 argument required, but only 0 present.');\n }\n // Do nothing if current environment doesn't have the Element interface.\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\n return;\n }\n if (!(target instanceof getWindowOf(target).Element)) {\n throw new TypeError('parameter 1 is not of type \"Element\".');\n }\n var observations = this.observations_;\n // Do nothing if element is already being observed.\n if (observations.has(target)) {\n return;\n }\n observations.set(target, new ResizeObservation(target));\n this.controller_.addObserver(this);\n // Force the update of observations.\n this.controller_.refresh();\n };\n /**\r\n * Stops observing provided element.\r\n *\r\n * @param {Element} target - Element to stop observing.\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.unobserve = function (target) {\n if (!arguments.length) {\n throw new TypeError('1 argument required, but only 0 present.');\n }\n // Do nothing if current environment doesn't have the Element interface.\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\n return;\n }\n if (!(target instanceof getWindowOf(target).Element)) {\n throw new TypeError('parameter 1 is not of type \"Element\".');\n }\n var observations = this.observations_;\n // Do nothing if element is not being observed.\n if (!observations.has(target)) {\n return;\n }\n observations.delete(target);\n if (!observations.size) {\n this.controller_.removeObserver(this);\n }\n };\n /**\r\n * Stops observing all elements.\r\n *\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.disconnect = function () {\n this.clearActive();\n this.observations_.clear();\n this.controller_.removeObserver(this);\n };\n /**\r\n * Collects observation instances the associated element of which has changed\r\n * it's content rectangle.\r\n *\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.gatherActive = function () {\n var _this = this;\n this.clearActive();\n this.observations_.forEach(function (observation) {\n if (observation.isActive()) {\n _this.activeObservations_.push(observation);\n }\n });\n };\n /**\r\n * Invokes initial callback function with a list of ResizeObserverEntry\r\n * instances collected from active resize observations.\r\n *\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.broadcastActive = function () {\n // Do nothing if observer doesn't have active observations.\n if (!this.hasActive()) {\n return;\n }\n var ctx = this.callbackCtx_;\n // Create ResizeObserverEntry instance for every active observation.\n var entries = this.activeObservations_.map(function (observation) {\n return new ResizeObserverEntry(observation.target, observation.broadcastRect());\n });\n this.callback_.call(ctx, entries, ctx);\n this.clearActive();\n };\n /**\r\n * Clears the collection of active observations.\r\n *\r\n * @returns {void}\r\n */\n ResizeObserverSPI.prototype.clearActive = function () {\n this.activeObservations_.splice(0);\n };\n /**\r\n * Tells whether observer has active observations.\r\n *\r\n * @returns {boolean}\r\n */\n ResizeObserverSPI.prototype.hasActive = function () {\n return this.activeObservations_.length > 0;\n };\n return ResizeObserverSPI;\n}();\n\n// Registry of internal observers. If WeakMap is not available use current shim\n// for the Map collection as it has all required methods and because WeakMap\n// can't be fully polyfilled anyway.\nvar observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();\n/**\r\n * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation\r\n * exposing only those methods and properties that are defined in the spec.\r\n */\nvar ResizeObserver = /** @class */function () {\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback that is invoked when\r\n * dimensions of the observed elements change.\r\n */\n function ResizeObserver(callback) {\n if (!(this instanceof ResizeObserver)) {\n throw new TypeError('Cannot call a class as a function.');\n }\n if (!arguments.length) {\n throw new TypeError('1 argument required, but only 0 present.');\n }\n var controller = ResizeObserverController.getInstance();\n var observer = new ResizeObserverSPI(callback, controller, this);\n observers.set(this, observer);\n }\n return ResizeObserver;\n}();\n// Expose public methods of ResizeObserver.\n['observe', 'unobserve', 'disconnect'].forEach(function (method) {\n ResizeObserver.prototype[method] = function () {\n var _a;\n return (_a = observers.get(this))[method].apply(_a, arguments);\n };\n});\nvar index = function () {\n // Export existing implementation if available.\n if (typeof global$1.ResizeObserver !== 'undefined') {\n return global$1.ResizeObserver;\n }\n return ResizeObserver;\n}();\nexport default index;","import { ElementRef, Injectable } from '@angular/core';\n\nimport ResizeObserver from 'resize-observer-polyfill';\nimport { Observable, Subject, shareReplay } from 'rxjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResizeObserverService {\n private changes$ = new Subject();\n private elementChanges = new WeakMap, Observable>();\n private observer = new ResizeObserver((entries: ResizeObserverEntry[]) => this.changes$.next(entries));\n\n observe(element: ElementRef): Observable {\n let elementChanges$ = this.elementChanges.get(element);\n if (!elementChanges$) {\n this.observer.observe(element.nativeElement);\n\n elementChanges$ = new Observable((observer) => {\n const inner = this.changes$.subscribe((changes) => {\n const change = changes.find((e) => e.target === element.nativeElement);\n if (change) {\n observer.next(change);\n }\n });\n\n return () => {\n inner.unsubscribe();\n this.observer.unobserve(element.nativeElement);\n this.elementChanges.delete(element);\n };\n }).pipe(shareReplay({ bufferSize: 1, refCount: true }));\n\n this.elementChanges.set(element, elementChanges$);\n }\n\n return elementChanges$;\n }\n}\n","import { ImageProfile } from '@cds/betting-offer';\nimport { CompetitionStatistics } from '@cds/statistics/competition';\nimport { EventModel, EventOptionGroup, RegionModel, SportModel } from '@frontend/sports/betting-offer/feature/model';\nimport { StringDictionary } from '@frontend/sports/common/core/utils/extended-types';\n\nexport enum SubscriptionTopic {\n Grid,\n NonGridable,\n Specials,\n Outrights,\n All,\n}\nexport interface Column {\n id: string;\n groups: Group[];\n enabled: boolean;\n more: boolean;\n}\n\nexport interface OptionsToShow {\n v1?: number[];\n v2?: number[];\n}\n\nexport interface Group {\n id: string;\n name: string;\n active: boolean;\n extended: boolean;\n visible: boolean;\n balancedMarket?: boolean;\n marketAttribute?: boolean;\n options?: string[];\n childGroups?: string[];\n optionsToShow?: OptionsToShow;\n badge?: GroupBadge;\n scoreBoardPeriodId?: number;\n fallbackGridGroupIds?: string[];\n isFallbackGroup: boolean;\n}\n\nexport enum GridLayout {\n Default,\n SixPack,\n Hybrid,\n}\n\nexport interface GridBreakpointSize {\n columns: number;\n default: number;\n}\n\nexport enum GridGrouping {\n None,\n Date,\n League,\n HomeForm,\n AwayForm,\n OverallForm,\n}\n\nexport interface GroupBadge {\n text: string;\n cssClass: string;\n}\n\nexport enum GridSorting {\n Competition,\n Time,\n HomeForm,\n AwayForm,\n OverallForm,\n}\n\nexport interface CollapsedState {\n collapsed: boolean;\n collapsedChildren: string[];\n}\n\nexport interface GridEvent extends EventModel {\n favourited?: boolean;\n}\n\nexport interface EventGroup {\n id: number;\n name: string;\n count: number;\n events: GridEvent[];\n collapsed: boolean;\n collapsible: boolean;\n deferred: boolean;\n}\n\nexport interface LeagueGroup extends EventGroup {\n siblings: number[];\n region: RegionModel;\n canBeFavourited: boolean;\n statistics?: CompetitionStatistics;\n virtualCompetitionId?: number;\n virtualCompetitionGroupId?: number;\n imageProfile?: ImageProfile;\n}\n\nexport interface StandingsData {\n groups: LeagueGroup[];\n virtualCompetitionId?: number;\n}\n\nexport interface DateGroup extends EventGroup {\n date: Date;\n}\n\nexport interface FormGroup extends EventGroup {\n winCount: number;\n}\n\nexport interface GridMedia {\n videoEvent?: string;\n animationEvent?: string;\n statsEvent?: string;\n enabled: boolean;\n}\n\nexport interface GridCollapsedModel {\n groups: number[];\n events: StringDictionary;\n}\n\nexport interface GridModel {\n columns: Column[];\n grouping: GridGrouping;\n disableGroupSorting?: boolean;\n groupingThreshold?: number;\n groups: (EventGroup | LeagueGroup)[];\n id: string;\n layout: GridLayout;\n sport: SportModel;\n media: GridMedia;\n topic: SubscriptionTopic;\n sorting?: GridSorting;\n collapsed: GridCollapsedModel;\n}\n\nexport interface FallbackGroup {\n optionGroup: EventOptionGroup | undefined;\n fallbackMarketName: string;\n showNoGoalText: boolean;\n isFallbackMarket: boolean;\n}\n","import { DestroyRef, ElementRef, Injectable, Optional, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { ResizeObserverService } from '@frontend/sports/common/core/utils/dom';\nimport { GridBreakpointSize, GridLayout } from '@frontend/sports/grid/core/feature/model';\nimport { MediaQueryService } from '@frontend/vanilla/core';\nimport { entries, isEqual } from 'lodash-es';\nimport { Observable, distinctUntilChanged, map } from 'rxjs';\n\ninterface ColumnsBreakpoint {\n query: string;\n min?: number;\n max?: number;\n columns: number;\n}\n\ninterface GridBreakpoint {\n [breakpoint: string]: number;\n}\n\nexport interface GridBreakpointOptions {\n calculateGridWidth: (containerWidth: number) => number;\n}\n\nconst DEFAULT_GRID_BREAKPOINTS_OPTIONS: GridBreakpointOptions = {\n calculateGridWidth: (containerWidth: number) => containerWidth,\n};\n\nconst DEFAULT_GRID_BREAKPOINTS: GridBreakpoint = {\n 'xs': 1,\n 'sm': 2,\n 'md': 3,\n 'gt-md': 4,\n};\n\nconst SIX_PACK_GRID_BREAKPOINTS: GridBreakpoint = {\n 'lt-md': 1,\n 'gt-sm': 2,\n};\n\n@Injectable()\nexport class GridBreakpointService {\n private static DEFAULT_BREAKPOINTS: ColumnsBreakpoint[];\n private static SIX_PACK_BREAKPOINTS: ColumnsBreakpoint[];\n\n private get defaultBreakpoints(): ColumnsBreakpoint[] {\n return (\n GridBreakpointService.DEFAULT_BREAKPOINTS ??\n (GridBreakpointService.DEFAULT_BREAKPOINTS = this.parseGridBreakpoints(DEFAULT_GRID_BREAKPOINTS))\n );\n }\n\n private get sixPackBreakpoints(): ColumnsBreakpoint[] {\n return (\n GridBreakpointService.SIX_PACK_BREAKPOINTS ??\n (GridBreakpointService.SIX_PACK_BREAKPOINTS = this.parseGridBreakpoints(SIX_PACK_GRID_BREAKPOINTS))\n );\n }\n\n private readonly destroyRef = inject(DestroyRef);\n\n constructor(\n private mediaObserver: MediaQueryService,\n private resizeObserver: ResizeObserverService,\n @Optional() private container?: ElementRef,\n ) {}\n\n forGrid(\n element: ElementRef,\n layout: GridLayout,\n options: GridBreakpointOptions = DEFAULT_GRID_BREAKPOINTS_OPTIONS,\n ): Observable {\n const containerWidth = this.container\n ? this.resizeObserver.observe(this.container).pipe(\n map((changes) => changes.contentRect.width),\n distinctUntilChanged(),\n map((width) => options.calculateGridWidth(width)),\n )\n : this.mediaObserver.observe().pipe(map(() => element.nativeElement.clientWidth));\n\n return containerWidth.pipe(\n map((width) => {\n const columnsBreakpoints = layout === GridLayout.SixPack ? this.sixPackBreakpoints : this.defaultBreakpoints;\n\n return {\n default: this.matchColumnsBreakpoint(this.defaultBreakpoints, width),\n columns: this.matchColumnsBreakpoint(columnsBreakpoints, width),\n };\n }),\n distinctUntilChanged(isEqual),\n takeUntilDestroyed(this.destroyRef),\n );\n }\n\n private matchColumnsBreakpoint(source: ColumnsBreakpoint[], width?: number): number {\n const matcher = width\n ? (item: ColumnsBreakpoint) => (item.min === undefined || item.min <= width) && (item.max === undefined || item.max >= width)\n : (item: ColumnsBreakpoint) => this.mediaObserver.isActive(item.query);\n\n for (const current of source) {\n if (matcher(current)) {\n return current.columns;\n }\n }\n\n return 1;\n }\n\n private parseGridBreakpoints(source: GridBreakpoint): ColumnsBreakpoint[] {\n return entries(this.mediaObserver.breakpoints)\n .filter((point) => point[0] in source)\n .map(([key, value]) => this.parseColumnsBreakpoint(key, value, source))\n .filter((point) => point.min || point.max)\n .sort((first, second) => second.columns - first.columns);\n }\n\n private parseColumnsBreakpoint(name: string, query: string, source: GridBreakpoint): ColumnsBreakpoint {\n const regex = /(min|max)-width\\:\\s*(\\d+)px/gi;\n let match: RegExpExecArray | null;\n\n const result: ColumnsBreakpoint = { query: name, columns: source[name] };\n\n while ((match = regex.exec(query))) {\n //@ts-ignore using match[1] as key index for result doesn't work, add expect error to bypass compiler issues.\n result[match[1]] = parseInt(match[2]);\n }\n\n return result;\n }\n}\n","/* eslint-disable no-param-reassign */\n\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n\n/* eslint-disable no-prototype-builtins */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ɵComponentType as ComponentType, ɵNG_COMP_DEF as NG_COMP_DEF } from '@angular/core';\n\nimport { capitalize } from 'lodash-es';\n\nconst WIREDUP: unique symbol = Symbol('__hooks__wiredup__');\nconst REGISTERED_WIREDUP: unique symbol = Symbol('__hooks__wiredup__registered__');\n\nfunction markWiredUp(type: any): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-param-reassign\n type.prototype[WIREDUP] = true;\n}\n\nfunction isComponent(type: any): type is ComponentType {\n return type.hasOwnProperty(NG_COMP_DEF);\n}\n\nfunction wireUpComponent(type: ComponentType): void {\n type.prototype.ngOnInit = wireUp(type.prototype.ngOnInit, 'init');\n markWiredUp(type);\n}\n\nfunction wireUp(hook: Function | null | undefined, target: 'init'): Function {\n const pre = `preNgOn${capitalize(target)}`;\n const post = `postNgOn${capitalize(target)}`;\n\n return function (this: any): void {\n this[pre]?.();\n hook?.call(this);\n this[post]?.();\n };\n}\n\nexport function HooksWireup(): (target: any) => void {\n return function (target: any): void {\n if (!target.prototype[REGISTERED_WIREDUP]) {\n throw new Error(\n `Decorator @HooksWireup used in the class ${target.name} should only be used when class extends a hook implementation like OnRouteResolve.`,\n );\n }\n\n if (isComponent(target)) {\n wireUpComponent(target);\n } else {\n throw new Error(\n `Cannot wireup class ${target.name} as it is not decorated with @Component. Also check the order of the directives, as @HooksWireup should come prior to the other ones.`,\n );\n }\n };\n}\n\nexport abstract class Hook {\n get [REGISTERED_WIREDUP](): boolean {\n return true;\n }\n\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prototype = Object.getPrototypeOf(this);\n\n if (!prototype[WIREDUP]) {\n throw new Error(`To make the custom hooks work correctly, the class ${prototype.constructor.name} should be decorated with @HooksWireup`);\n }\n }\n}\n","import { DestroyRef, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { Hook } from './hooks-wireup';\n\nexport abstract class OnRouteResolve extends Hook {\n protected readonly destroyRef = inject(DestroyRef);\n\n constructor(protected route: ActivatedRoute) {\n super();\n }\n\n preNgOnInit(): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n this.route.data.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ model }) => this.onRouteResolved(model));\n }\n\n abstract onRouteResolved(model: TModel): void;\n}\n","import { Observable, Operator, OperatorFunction, Subscriber } from 'rxjs';\n\nclass BufferWithSizeSubscriber extends Subscriber {\n private buffer: T[] = [];\n\n constructor(\n public override destination: Subscriber,\n private bufferSize: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n closingNotifier: Observable,\n ) {\n super(destination);\n closingNotifier.subscribe(() => {\n this.emitAndClearBuffer(this.buffer);\n });\n }\n\n private emitAndClearBuffer(buffer: T[]): void {\n this.destination.next(buffer);\n this.buffer = [];\n }\n\n protected override _next(value: T): void {\n const buffer = this.buffer;\n buffer.push(value);\n\n if (buffer.length === this.bufferSize) {\n this.emitAndClearBuffer(buffer);\n }\n }\n\n protected override _complete(): void {\n const buffer = this.buffer;\n if (buffer.length > 0) {\n this.destination.next(buffer);\n }\n super._complete();\n }\n}\n\nclass BufferWithSizeOperator implements Operator {\n constructor(\n private bufferSize: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private closingNotifier: Observable,\n ) {}\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call(subscriber: Subscriber, source: any): any {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n return source.subscribe(new BufferWithSizeSubscriber(subscriber, this.bufferSize, this.closingNotifier));\n }\n}\n\n/**\n * Combination of buffer() and bufferCount()\n *\n * @param bufferSize Argument of bufferCount()\n * @param closingNotifier Argument of buffer()\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function bufferWithSize(bufferSize: number, closingNotifier: Observable): OperatorFunction {\n return function bufferWithSizeOperatorFunction(source: Observable): Observable {\n return source.lift(new BufferWithSizeOperator(bufferSize, closingNotifier));\n };\n}\n","/* eslint-disable @typescript-eslint/prefer-ts-expect-error */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport { StringDictionary } from '@frontend/sports/common/core/utils/extended-types';\n\nexport const isShallowCopy = (prev: T, next: T): boolean => {\n // eslint-disable-next-line eqeqeq\n if (prev === null && next === null) {\n // When both null then objects are equal\n return true;\n }\n\n // eslint-disable-next-line eqeqeq\n if (prev === null || next === null) {\n // When one is null then objects are unequal\n return false;\n }\n\n if (prev === undefined && next === undefined) {\n // When both undefined then objects are equal\n return true;\n }\n\n if (prev === undefined || next === undefined) {\n // When one is undefined then objects are unequal\n return false;\n }\n\n const prevKeys = Object.keys(prev);\n const nextKeys = Object.keys(next);\n if (prevKeys.length !== nextKeys.length) {\n // If number of keys is different: unequal\n return false;\n }\n for (const key of nextKeys) {\n //below ignore was added to get rid of suppressImplicitAnyIndexErrors in our tsconfig, at least it's limited to this usage now.\n //@ts-ignore\n if (prev[key] !== next[key]) {\n // One key is different: unequal\n return false;\n }\n }\n\n return true; // Keys are the same: equal\n};\n\nexport const calcDiff = function (prev: T[], next: T[]): { added: T[]; removed: T[] } {\n if ((!prev && !next) || (prev.length === 0 && next.length === 0)) {\n return { removed: [], added: [] };\n }\n if (!prev || prev.length === 0) {\n return { removed: [], added: [...next] };\n }\n if (!next || next.length === 0) {\n return { removed: [...prev], added: [] };\n }\n\n const removed = new Map(prev.map((item) => [item, true]));\n const added = new Map(next.map((item) => [item, true]));\n for (const [item] of removed) {\n if (added.has(item)) {\n removed.set(item, false);\n }\n }\n for (const [item] of added) {\n if (removed.has(item)) {\n added.set(item, false);\n }\n }\n\n return {\n removed: [...removed.entries()].filter((e) => !!e[1]).map((e) => e[0]),\n added: [...added.entries()].filter((e) => !!e[1]).map((e) => e[0]),\n };\n};\n\nexport const toDictionary = function (\n list: T[] | undefined,\n keySelector: (item: T) => TKey,\n valueSelector: (item: T, index: number) => TValue,\n): StringDictionary {\n const result: StringDictionary = {};\n\n if (!list) {\n return {};\n }\n\n for (let i = 0; i < list.length; i++) {\n const item = list[i];\n const key = keySelector(item);\n\n if (key in result) {\n console.warn('Item with the same key has already been added');\n continue;\n }\n\n result[key] = valueSelector(item, i);\n }\n\n return result;\n};\n","import { InjectionToken, Type } from '@angular/core';\n\nimport { Widget, WidgetType } from '@frontend/sports/types/components/widget';\nimport { Observable } from 'rxjs';\n\nexport interface WidgetSkeletonModel {\n widget?: Widget;\n showSkeleton$: Observable;\n}\nexport interface WidgetSkeletonConfig {\n visible: boolean;\n loaderClass?: string;\n}\n// so we can inject it\nexport class WidgetSkeletonData {\n widget: Widget;\n widgetsBeforeLoaded$: Observable;\n config: (payload: T) => Observable;\n}\nexport interface WidgetSkeletonDefinition {\n config: (payload: T) => Observable;\n type: WidgetType;\n component: Type;\n}\n\nexport const WIDGET_SKELETON = new InjectionToken>('ms-widget-skeleton');\n","import { Component, DestroyRef, Injectable, Injector, Type, effect, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { WidgetConfig } from '@frontend/sports/common/client-config-data-access';\nimport { LoggerFactory } from '@frontend/sports/common/core/feature/logging';\nimport { toDictionary } from '@frontend/sports/common/core/utils/collection';\nimport { bufferWithSize } from '@frontend/sports/common/core/utils/rxjs';\nimport { Widget, WidgetContext, WidgetLocation, WidgetType } from '@frontend/sports/types/components/widget';\nimport { NativeAppService } from '@frontend/vanilla/core';\nimport { omit } from 'lodash-es';\nimport { Subject, Subscription, combineLatest, debounceTime, filter, iif, map, of, take, timeout } from 'rxjs';\n\nimport { WidgetData, WidgetLoaderService } from './widget-loader.service';\nimport { WIDGET_SKELETON, WidgetSkeletonDefinition } from './widget-skeleton.model';\n\nexport interface RegisteredWidget {\n componentType: Type>;\n injector?: Injector;\n}\n\n@Component({\n template: '',\n host: {\n '[class.hidden]': '_hidden()',\n },\n})\nexport abstract class WidgetComponent {\n get hidden() {\n return this._hidden();\n }\n\n set hidden(hidden) {\n this._hidden.set(hidden);\n }\n\n _hidden = signal(!inject(NativeAppService).isTerminal);\n hasData = true;\n private widgetAlreadyReady: boolean;\n private widgetLoaderService = inject(WidgetLoaderService);\n private widgetConfig = signal | undefined>(undefined);\n private parentConfig?: Widget;\n private widgetLoadedSubscription$: Subscription;\n private logger = inject(LoggerFactory).getLogger('WidgetComponent');\n private widgetClientConfig = inject(WidgetConfig);\n\n get parent(): Readonly> | undefined {\n return this.parentConfig;\n }\n\n get config(): Readonly> {\n return this.widgetConfig()!;\n }\n\n protected logEmptyData(): void {\n this.logger.warning(`Empty widget data configured for ${this.config.id}`);\n }\n\n protected readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n effect(() => {\n const config = this.widgetConfig();\n const visible = !this._hidden();\n if (config) {\n this.widgetLoaderService.setWidgetVisible(`${this.config.location}-${this.config.id}`, visible);\n }\n });\n }\n\n onResolve(widget: Widget, parent?: Widget, shouldCallOnData: boolean = true, isWidgetRefresh: boolean = false): void {\n this.widgetConfig.set(omit(widget, 'payload') as Widget);\n\n if (parent) {\n this.parentConfig = omit(parent, 'payload') as Widget;\n }\n\n if (shouldCallOnData) {\n if (this.config.location !== WidgetLocation.Right && !isWidgetRefresh) {\n this.widgetAlreadyReady = false;\n this.subscribeWidgetLoaded();\n }\n\n this.onData?.(widget.payload, isWidgetRefresh);\n if (parent?.payload) {\n this.onParentData?.(parent.payload);\n }\n }\n }\n\n protected onData?(data?: T, isWidgetRefresh?: boolean): void;\n\n protected onParentData?(data: unknown): void;\n\n getContext(): Partial {\n return { widgetId: this.config.id };\n }\n\n protected setWidgetLoaded(): void {\n if (this.widgetAlreadyReady) {\n this.hidden = !this.hasData;\n\n return;\n }\n\n //Adding below check to avoid null config from widget constructor on initial load\n if (this.config) {\n this.widgetLoaderService.setWidgetLoaded(`${this.config.location}-${this.config.id}`);\n }\n }\n\n private subscribeWidgetLoaded(): void {\n this.widgetLoadedSubscription$?.unsubscribe();\n this.widgetLoadedSubscription$ = combineLatest([\n this.widgetLoaderService.widgetLoadedDetails$(this.config.location),\n iif(\n () => [WidgetLocation.Left, WidgetLocation.Center].includes(this.config.location),\n this.widgetLoaderService.allTopLocationWidgetsLoaded$,\n of(true),\n ),\n ])\n .pipe(\n map(([widgetsData, topLocationWidgetsLoaded]) => topLocationWidgetsLoaded && this.checkWidgetReady(widgetsData)),\n filter(Boolean),\n take(1),\n timeout({\n each: this.widgetClientConfig.orderedRenderingTimeout,\n with: () => of(false),\n }),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe((loadedWithoutTimeout) => {\n if (!loadedWithoutTimeout) {\n this.logger.warning(\n `Widget ordered rendering timed out after ${this.widgetClientConfig.orderedRenderingTimeout}ms for ${this.config.id}`,\n );\n }\n this.widgetAlreadyReady = true;\n this.hidden = !this.hasData;\n });\n }\n\n private checkWidgetReady = (widgets: WidgetData[]): boolean => {\n return widgets.findIndex((x) => x.widgetId === this.config.id && x.isLoaded) > -1 && this.checkPreceedingWidgetsReady(widgets);\n };\n\n private checkPreceedingWidgetsReady = (widgets: WidgetData[]): boolean => {\n const currentWidgetOrder = widgets.find((widget) => widget.widgetId === this.config.id)!.order;\n const filteredWidgets = widgets.filter((x) => x.order <= currentWidgetOrder);\n\n return filteredWidgets.every((x) => x.isLoaded);\n };\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WidgetRegistryService {\n // inject all candidates that got registered\n private readonly widgetSkeletonConfig = inject[]>(WIDGET_SKELETON, { optional: true });\n // create a dictionary for faster access\n readonly widgetSkeletons = this.widgetSkeletonConfig\n ? toDictionary(\n this.widgetSkeletonConfig,\n ({ type }) => type.toString(),\n (v) => v,\n )\n : {};\n\n private readonly widgets = new Map();\n private readonly lazyWidgets = new Subject();\n\n private readonly debounceTimer = this.lazyWidgets.pipe(debounceTime(2));\n readonly lazyWidgets$ = this.lazyWidgets.pipe(\n bufferWithSize(10, this.debounceTimer),\n filter((data) => data.length > 0),\n );\n\n register(name: WidgetType, widget: Type>): void {\n this.assertNotAlreadyRegistered(name);\n this.widgets.set(name, { componentType: widget });\n }\n\n registerLazy(name: WidgetType, widget: Type>, injector?: Injector): void {\n this.assertNotAlreadyRegistered(name);\n\n this.widgets.set(name, { componentType: widget, injector });\n this.lazyWidgets.next(name);\n }\n\n get(name: WidgetType): RegisteredWidget | null {\n return this.widgets.get(name) ?? null;\n }\n\n private assertNotAlreadyRegistered(type: WidgetType): void {\n if (this.widgets.has(type)) {\n throw new Error(`Widget with name ${type} is already registered`);\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { ClientConfigProductName, LazyClientConfig, LazyClientConfigBase, LazyClientConfigService } from '@frontend/vanilla/core';\nimport { LDOptions } from 'launchdarkly-js-client-sdk';\n\n/**\n * @stable\n */\n@LazyClientConfig({ key: 'vnLaunchDarkly', product: ClientConfigProductName.SF })\n@Injectable({\n providedIn: 'root',\n useFactory: launchDarklyConfigFactory,\n deps: [LazyClientConfigService],\n})\nexport class LaunchDarklyConfig extends LazyClientConfigBase {\n clientId: string;\n options: LDOptions;\n sessionCookieName: string;\n}\n\nexport function launchDarklyConfigFactory(service: LazyClientConfigService) {\n return service.get(LaunchDarklyConfig);\n}\n","function e(e) {\n function t(e, t) {\n Error.captureStackTrace && Error.captureStackTrace(this, this.constructor), this.message = e, this.code = t;\n }\n return t.prototype = new Error(), t.prototype.name = e, t.prototype.constructor = t, t;\n}\nconst t = e(\"LaunchDarklyUnexpectedResponseError\"),\n n = e(\"LaunchDarklyInvalidEnvironmentIdError\"),\n r = e(\"LaunchDarklyInvalidUserError\"),\n o = e(\"LaunchDarklyInvalidEventKeyError\"),\n i = e(\"LaunchDarklyInvalidArgumentError\"),\n a = e(\"LaunchDarklyFlagFetchError\");\nfor (var s = {\n LDUnexpectedResponseError: t,\n LDInvalidEnvironmentIdError: n,\n LDInvalidUserError: r,\n LDInvalidEventKeyError: o,\n LDInvalidArgumentError: i,\n LDInvalidDataError: e(\"LaunchDarklyInvalidDataError\"),\n LDFlagFetchError: a,\n LDTimeoutError: e(\"LaunchDarklyTimeoutError\"),\n isHttpErrorRecoverable: function (e) {\n return !(e >= 400 && e < 500) || 400 === e || 408 === e || 429 === e;\n }\n }, c = function (e) {\n var t = m(e),\n n = t[0],\n r = t[1];\n return 3 * (n + r) / 4 - r;\n }, u = function (e) {\n var t,\n n,\n r = m(e),\n o = r[0],\n i = r[1],\n a = new g(function (e, t, n) {\n return 3 * (t + n) / 4 - n;\n }(0, o, i)),\n s = 0,\n c = i > 0 ? o - 4 : o;\n for (n = 0; n < c; n += 4) t = f[e.charCodeAt(n)] << 18 | f[e.charCodeAt(n + 1)] << 12 | f[e.charCodeAt(n + 2)] << 6 | f[e.charCodeAt(n + 3)], a[s++] = t >> 16 & 255, a[s++] = t >> 8 & 255, a[s++] = 255 & t;\n 2 === i && (t = f[e.charCodeAt(n)] << 2 | f[e.charCodeAt(n + 1)] >> 4, a[s++] = 255 & t);\n 1 === i && (t = f[e.charCodeAt(n)] << 10 | f[e.charCodeAt(n + 1)] << 4 | f[e.charCodeAt(n + 2)] >> 2, a[s++] = t >> 8 & 255, a[s++] = 255 & t);\n return a;\n }, l = function (e) {\n for (var t, n = e.length, r = n % 3, o = [], i = 16383, a = 0, s = n - r; a < s; a += i) o.push(h(e, a, a + i > s ? s : a + i));\n 1 === r ? (t = e[n - 1], o.push(d[t >> 2] + d[t << 4 & 63] + \"==\")) : 2 === r && (t = (e[n - 2] << 8) + e[n - 1], o.push(d[t >> 10] + d[t >> 4 & 63] + d[t << 2 & 63] + \"=\"));\n return o.join(\"\");\n }, d = [], f = [], g = \"undefined\" != typeof Uint8Array ? Uint8Array : Array, v = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", p = 0; p < 64; ++p) d[p] = v[p], f[v.charCodeAt(p)] = p;\nfunction m(e) {\n var t = e.length;\n if (t % 4 > 0) throw new Error(\"Invalid string. Length must be a multiple of 4\");\n var n = e.indexOf(\"=\");\n return -1 === n && (n = t), [n, n === t ? 0 : 4 - n % 4];\n}\nfunction h(e, t, n) {\n for (var r, o, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (255 & e[a + 2]), i.push(d[(o = r) >> 18 & 63] + d[o >> 12 & 63] + d[o >> 6 & 63] + d[63 & o]);\n return i.join(\"\");\n}\nf[\"-\".charCodeAt(0)] = 62, f[\"_\".charCodeAt(0)] = 63;\nvar y = {\n byteLength: c,\n toByteArray: u,\n fromByteArray: l\n },\n w = Array.isArray,\n b = Object.keys,\n k = Object.prototype.hasOwnProperty,\n E = function e(t, n) {\n if (t === n) return !0;\n if (t && n && \"object\" == typeof t && \"object\" == typeof n) {\n var r,\n o,\n i,\n a = w(t),\n s = w(n);\n if (a && s) {\n if ((o = t.length) != n.length) return !1;\n for (r = o; 0 != r--;) if (!e(t[r], n[r])) return !1;\n return !0;\n }\n if (a != s) return !1;\n var c = t instanceof Date,\n u = n instanceof Date;\n if (c != u) return !1;\n if (c && u) return t.getTime() == n.getTime();\n var l = t instanceof RegExp,\n d = n instanceof RegExp;\n if (l != d) return !1;\n if (l && d) return t.toString() == n.toString();\n var f = b(t);\n if ((o = f.length) !== b(n).length) return !1;\n for (r = o; 0 != r--;) if (!k.call(n, f[r])) return !1;\n for (r = o; 0 != r--;) if (!e(t[i = f[r]], n[i])) return !1;\n return !0;\n }\n return t != t && n != n;\n };\nconst D = [\"key\", \"ip\", \"country\", \"email\", \"firstName\", \"lastName\", \"avatar\", \"name\"];\nfunction x(e) {\n const t = unescape(encodeURIComponent(e));\n return y.fromByteArray(function (e) {\n const t = [];\n for (let n = 0; n < e.length; n++) t.push(e.charCodeAt(n));\n return t;\n }(t));\n}\nfunction C(e, t) {\n return Object.prototype.hasOwnProperty.call(e, t);\n}\nvar P,\n S = {\n appendUrlPath: function (e, t) {\n return (e.endsWith(\"/\") ? e.substring(0, e.length - 1) : e) + (t.startsWith(\"/\") ? \"\" : \"/\") + t;\n },\n base64URLEncode: function (e) {\n return x(e).replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n },\n btoa: x,\n clone: function (e) {\n return JSON.parse(JSON.stringify(e));\n },\n deepEquals: function (e, t) {\n return E(e, t);\n },\n extend: function (...e) {\n return e.reduce((e, t) => ({\n ...e,\n ...t\n }), {});\n },\n getLDUserAgentString: function (e) {\n const t = e.version || \"?\";\n return e.userAgent + \"/\" + t;\n },\n objectHasOwnProperty: C,\n onNextTick: function (e) {\n setTimeout(e, 0);\n },\n sanitizeContext: function (e) {\n if (!e) return e;\n let t;\n return null !== e.kind && void 0 !== e.kind || D.forEach(n => {\n const r = e[n];\n void 0 !== r && \"string\" != typeof r && (t = t || {\n ...e\n }, t[n] = String(r));\n }), t || e;\n },\n transformValuesToVersionedValues: function (e) {\n const t = {};\n for (const n in e) C(e, n) && (t[n] = {\n value: e[n],\n version: 0\n });\n return t;\n },\n transformVersionedValuesToValues: function (e) {\n const t = {};\n for (const n in e) C(e, n) && (t[n] = e[n].value);\n return t;\n },\n wrapPromiseCallback: function (e, t) {\n const n = e.then(e => (t && setTimeout(() => {\n t(null, e);\n }, 0), e), e => {\n if (!t) return Promise.reject(e);\n setTimeout(() => {\n t(e, null);\n }, 0);\n });\n return t ? void 0 : n;\n }\n },\n I = new Uint8Array(16);\nfunction O() {\n if (!P && !(P = \"undefined\" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || \"undefined\" != typeof msCrypto && \"function\" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto))) throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return P(I);\n}\nvar T = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nfunction L(e) {\n return \"string\" == typeof e && T.test(e);\n}\nfor (var U, R, A = [], j = 0; j < 256; ++j) A.push((j + 256).toString(16).substr(1));\nfunction F(e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,\n n = (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + \"-\" + A[e[t + 4]] + A[e[t + 5]] + \"-\" + A[e[t + 6]] + A[e[t + 7]] + \"-\" + A[e[t + 8]] + A[e[t + 9]] + \"-\" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();\n if (!L(n)) throw TypeError(\"Stringified UUID is invalid\");\n return n;\n}\nvar N = 0,\n $ = 0;\nfunction V(e) {\n if (!L(e)) throw TypeError(\"Invalid UUID\");\n var t,\n n = new Uint8Array(16);\n return n[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = 255 & t, n[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8, n[5] = 255 & t, n[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8, n[7] = 255 & t, n[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8, n[9] = 255 & t, n[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = 255 & t, n;\n}\nfunction M(e, t, n) {\n function r(e, r, o, i) {\n if (\"string\" == typeof e && (e = function (e) {\n e = unescape(encodeURIComponent(e));\n for (var t = [], n = 0; n < e.length; ++n) t.push(e.charCodeAt(n));\n return t;\n }(e)), \"string\" == typeof r && (r = V(r)), 16 !== r.length) throw TypeError(\"Namespace must be array-like (16 iterable integer values, 0-255)\");\n var a = new Uint8Array(16 + e.length);\n if (a.set(r), a.set(e, r.length), (a = n(a))[6] = 15 & a[6] | t, a[8] = 63 & a[8] | 128, o) {\n i = i || 0;\n for (var s = 0; s < 16; ++s) o[i + s] = a[s];\n return o;\n }\n return F(a);\n }\n try {\n r.name = e;\n } catch (e) {}\n return r.DNS = \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", r.URL = \"6ba7b811-9dad-11d1-80b4-00c04fd430c8\", r;\n}\nfunction q(e) {\n return 14 + (e + 64 >>> 9 << 4) + 1;\n}\nfunction H(e, t) {\n var n = (65535 & e) + (65535 & t);\n return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;\n}\nfunction z(e, t, n, r, o, i) {\n return H((a = H(H(t, e), H(r, i))) << (s = o) | a >>> 32 - s, n);\n var a, s;\n}\nfunction K(e, t, n, r, o, i, a) {\n return z(t & n | ~t & r, e, t, o, i, a);\n}\nfunction _(e, t, n, r, o, i, a) {\n return z(t & r | n & ~r, e, t, o, i, a);\n}\nfunction J(e, t, n, r, o, i, a) {\n return z(t ^ n ^ r, e, t, o, i, a);\n}\nfunction B(e, t, n, r, o, i, a) {\n return z(n ^ (t | ~r), e, t, o, i, a);\n}\nvar G = M(\"v3\", 48, function (e) {\n if (\"string\" == typeof e) {\n var t = unescape(encodeURIComponent(e));\n e = new Uint8Array(t.length);\n for (var n = 0; n < t.length; ++n) e[n] = t.charCodeAt(n);\n }\n return function (e) {\n for (var t = [], n = 32 * e.length, r = \"0123456789abcdef\", o = 0; o < n; o += 8) {\n var i = e[o >> 5] >>> o % 32 & 255,\n a = parseInt(r.charAt(i >>> 4 & 15) + r.charAt(15 & i), 16);\n t.push(a);\n }\n return t;\n }(function (e, t) {\n e[t >> 5] |= 128 << t % 32, e[q(t) - 1] = t;\n for (var n = 1732584193, r = -271733879, o = -1732584194, i = 271733878, a = 0; a < e.length; a += 16) {\n var s = n,\n c = r,\n u = o,\n l = i;\n n = K(n, r, o, i, e[a], 7, -680876936), i = K(i, n, r, o, e[a + 1], 12, -389564586), o = K(o, i, n, r, e[a + 2], 17, 606105819), r = K(r, o, i, n, e[a + 3], 22, -1044525330), n = K(n, r, o, i, e[a + 4], 7, -176418897), i = K(i, n, r, o, e[a + 5], 12, 1200080426), o = K(o, i, n, r, e[a + 6], 17, -1473231341), r = K(r, o, i, n, e[a + 7], 22, -45705983), n = K(n, r, o, i, e[a + 8], 7, 1770035416), i = K(i, n, r, o, e[a + 9], 12, -1958414417), o = K(o, i, n, r, e[a + 10], 17, -42063), r = K(r, o, i, n, e[a + 11], 22, -1990404162), n = K(n, r, o, i, e[a + 12], 7, 1804603682), i = K(i, n, r, o, e[a + 13], 12, -40341101), o = K(o, i, n, r, e[a + 14], 17, -1502002290), n = _(n, r = K(r, o, i, n, e[a + 15], 22, 1236535329), o, i, e[a + 1], 5, -165796510), i = _(i, n, r, o, e[a + 6], 9, -1069501632), o = _(o, i, n, r, e[a + 11], 14, 643717713), r = _(r, o, i, n, e[a], 20, -373897302), n = _(n, r, o, i, e[a + 5], 5, -701558691), i = _(i, n, r, o, e[a + 10], 9, 38016083), o = _(o, i, n, r, e[a + 15], 14, -660478335), r = _(r, o, i, n, e[a + 4], 20, -405537848), n = _(n, r, o, i, e[a + 9], 5, 568446438), i = _(i, n, r, o, e[a + 14], 9, -1019803690), o = _(o, i, n, r, e[a + 3], 14, -187363961), r = _(r, o, i, n, e[a + 8], 20, 1163531501), n = _(n, r, o, i, e[a + 13], 5, -1444681467), i = _(i, n, r, o, e[a + 2], 9, -51403784), o = _(o, i, n, r, e[a + 7], 14, 1735328473), n = J(n, r = _(r, o, i, n, e[a + 12], 20, -1926607734), o, i, e[a + 5], 4, -378558), i = J(i, n, r, o, e[a + 8], 11, -2022574463), o = J(o, i, n, r, e[a + 11], 16, 1839030562), r = J(r, o, i, n, e[a + 14], 23, -35309556), n = J(n, r, o, i, e[a + 1], 4, -1530992060), i = J(i, n, r, o, e[a + 4], 11, 1272893353), o = J(o, i, n, r, e[a + 7], 16, -155497632), r = J(r, o, i, n, e[a + 10], 23, -1094730640), n = J(n, r, o, i, e[a + 13], 4, 681279174), i = J(i, n, r, o, e[a], 11, -358537222), o = J(o, i, n, r, e[a + 3], 16, -722521979), r = J(r, o, i, n, e[a + 6], 23, 76029189), n = J(n, r, o, i, e[a + 9], 4, -640364487), i = J(i, n, r, o, e[a + 12], 11, -421815835), o = J(o, i, n, r, e[a + 15], 16, 530742520), n = B(n, r = J(r, o, i, n, e[a + 2], 23, -995338651), o, i, e[a], 6, -198630844), i = B(i, n, r, o, e[a + 7], 10, 1126891415), o = B(o, i, n, r, e[a + 14], 15, -1416354905), r = B(r, o, i, n, e[a + 5], 21, -57434055), n = B(n, r, o, i, e[a + 12], 6, 1700485571), i = B(i, n, r, o, e[a + 3], 10, -1894986606), o = B(o, i, n, r, e[a + 10], 15, -1051523), r = B(r, o, i, n, e[a + 1], 21, -2054922799), n = B(n, r, o, i, e[a + 8], 6, 1873313359), i = B(i, n, r, o, e[a + 15], 10, -30611744), o = B(o, i, n, r, e[a + 6], 15, -1560198380), r = B(r, o, i, n, e[a + 13], 21, 1309151649), n = B(n, r, o, i, e[a + 4], 6, -145523070), i = B(i, n, r, o, e[a + 11], 10, -1120210379), o = B(o, i, n, r, e[a + 2], 15, 718787259), r = B(r, o, i, n, e[a + 9], 21, -343485551), n = H(n, s), r = H(r, c), o = H(o, u), i = H(i, l);\n }\n return [n, r, o, i];\n }(function (e) {\n if (0 === e.length) return [];\n for (var t = 8 * e.length, n = new Uint32Array(q(t)), r = 0; r < t; r += 8) n[r >> 5] |= (255 & e[r / 8]) << r % 32;\n return n;\n }(e), 8 * e.length));\n }),\n W = G;\nfunction X(e, t, n, r) {\n switch (e) {\n case 0:\n return t & n ^ ~t & r;\n case 1:\n case 3:\n return t ^ n ^ r;\n case 2:\n return t & n ^ t & r ^ n & r;\n }\n}\nfunction Q(e, t) {\n return e << t | e >>> 32 - t;\n}\nvar Y = M(\"v5\", 80, function (e) {\n var t = [1518500249, 1859775393, 2400959708, 3395469782],\n n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];\n if (\"string\" == typeof e) {\n var r = unescape(encodeURIComponent(e));\n e = [];\n for (var o = 0; o < r.length; ++o) e.push(r.charCodeAt(o));\n } else Array.isArray(e) || (e = Array.prototype.slice.call(e));\n e.push(128);\n for (var i = e.length / 4 + 2, a = Math.ceil(i / 16), s = new Array(a), c = 0; c < a; ++c) {\n for (var u = new Uint32Array(16), l = 0; l < 16; ++l) u[l] = e[64 * c + 4 * l] << 24 | e[64 * c + 4 * l + 1] << 16 | e[64 * c + 4 * l + 2] << 8 | e[64 * c + 4 * l + 3];\n s[c] = u;\n }\n s[a - 1][14] = 8 * (e.length - 1) / Math.pow(2, 32), s[a - 1][14] = Math.floor(s[a - 1][14]), s[a - 1][15] = 8 * (e.length - 1) & 4294967295;\n for (var d = 0; d < a; ++d) {\n for (var f = new Uint32Array(80), g = 0; g < 16; ++g) f[g] = s[d][g];\n for (var v = 16; v < 80; ++v) f[v] = Q(f[v - 3] ^ f[v - 8] ^ f[v - 14] ^ f[v - 16], 1);\n for (var p = n[0], m = n[1], h = n[2], y = n[3], w = n[4], b = 0; b < 80; ++b) {\n var k = Math.floor(b / 20),\n E = Q(p, 5) + X(k, m, h, y) + w + t[k] + f[b] >>> 0;\n w = y, y = h, h = Q(m, 30) >>> 0, m = p, p = E;\n }\n n[0] = n[0] + p >>> 0, n[1] = n[1] + m >>> 0, n[2] = n[2] + h >>> 0, n[3] = n[3] + y >>> 0, n[4] = n[4] + w >>> 0;\n }\n return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, 255 & n[0], n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, 255 & n[1], n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, 255 & n[2], n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, 255 & n[3], n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, 255 & n[4]];\n }),\n Z = Y;\nvar ee = Object.freeze({\n __proto__: null,\n v1: function (e, t, n) {\n var r = t && n || 0,\n o = t || new Array(16),\n i = (e = e || {}).node || U,\n a = void 0 !== e.clockseq ? e.clockseq : R;\n if (null == i || null == a) {\n var s = e.random || (e.rng || O)();\n null == i && (i = U = [1 | s[0], s[1], s[2], s[3], s[4], s[5]]), null == a && (a = R = 16383 & (s[6] << 8 | s[7]));\n }\n var c = void 0 !== e.msecs ? e.msecs : Date.now(),\n u = void 0 !== e.nsecs ? e.nsecs : $ + 1,\n l = c - N + (u - $) / 1e4;\n if (l < 0 && void 0 === e.clockseq && (a = a + 1 & 16383), (l < 0 || c > N) && void 0 === e.nsecs && (u = 0), u >= 1e4) throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n N = c, $ = u, R = a;\n var d = (1e4 * (268435455 & (c += 122192928e5)) + u) % 4294967296;\n o[r++] = d >>> 24 & 255, o[r++] = d >>> 16 & 255, o[r++] = d >>> 8 & 255, o[r++] = 255 & d;\n var f = c / 4294967296 * 1e4 & 268435455;\n o[r++] = f >>> 8 & 255, o[r++] = 255 & f, o[r++] = f >>> 24 & 15 | 16, o[r++] = f >>> 16 & 255, o[r++] = a >>> 8 | 128, o[r++] = 255 & a;\n for (var g = 0; g < 6; ++g) o[r + g] = i[g];\n return t || F(o);\n },\n v3: W,\n v4: function (e, t, n) {\n var r = (e = e || {}).random || (e.rng || O)();\n if (r[6] = 15 & r[6] | 64, r[8] = 63 & r[8] | 128, t) {\n n = n || 0;\n for (var o = 0; o < 16; ++o) t[n + o] = r[o];\n return t;\n }\n return F(r);\n },\n v5: Z,\n NIL: \"00000000-0000-0000-0000-000000000000\",\n version: function (e) {\n if (!L(e)) throw TypeError(\"Invalid UUID\");\n return parseInt(e.substr(14, 1), 16);\n },\n validate: L,\n stringify: F,\n parse: V\n});\nconst te = [\"debug\", \"info\", \"warn\", \"error\", \"none\"];\nvar ne = {\n commonBasicLogger: function (e, t) {\n if (e && e.destination && \"function\" != typeof e.destination) throw new Error(\"destination for basicLogger was set to a non-function\");\n function n(e) {\n return function (t) {\n console && console[e] && console[e].call(console, t);\n };\n }\n const r = e && e.destination ? [e.destination, e.destination, e.destination, e.destination] : [n(\"log\"), n(\"info\"), n(\"warn\"), n(\"error\")],\n o = !(!e || !e.destination),\n i = e && void 0 !== e.prefix && null !== e.prefix ? e.prefix : \"[LaunchDarkly] \";\n let a = 1;\n if (e && e.level) for (let t = 0; t < te.length; t++) te[t] === e.level && (a = t);\n function s(e, n, a) {\n if (a.length < 1) return;\n let s;\n const c = o ? n + \": \" + i : i;\n if (1 !== a.length && t) {\n const e = [...a];\n e[0] = c + e[0], s = t(...e);\n } else s = c + a[0];\n try {\n r[e](s);\n } catch (e) {\n console && console.log && console.log(\"[LaunchDarkly] Configured logger's \" + n + \" method threw an exception: \" + e);\n }\n }\n const c = {};\n for (let e = 0; e < te.length; e++) {\n const t = te[e];\n if (\"none\" !== t) if (e < a) c[t] = () => {};else {\n const n = e;\n c[t] = function () {\n s(n, t, arguments);\n };\n }\n }\n return c;\n },\n validateLogger: function (e) {\n te.forEach(t => {\n if (\"none\" !== t && (!e[t] || \"function\" != typeof e[t])) throw new Error(\"Provided logger instance must support logger.\" + t + \"(...) method\");\n });\n }\n};\nfunction re(e) {\n return e && e.message ? e.message : \"string\" == typeof e || e instanceof String ? e : JSON.stringify(e);\n}\nconst oe = \" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initialize-the-client for instructions on SDK initialization.\";\nvar ie = {\n bootstrapInvalid: function () {\n return \"LaunchDarkly bootstrap data is not available because the back end could not read the flags.\";\n },\n bootstrapOldFormat: function () {\n return \"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly.\" + oe;\n },\n clientInitialized: function () {\n return \"LaunchDarkly client initialized\";\n },\n clientNotReady: function () {\n return \"LaunchDarkly client is not ready\";\n },\n debugEnqueueingEvent: function (e) {\n return 'enqueueing \"' + e + '\" event';\n },\n debugPostingDiagnosticEvent: function (e) {\n return \"sending diagnostic event (\" + e.kind + \")\";\n },\n debugPostingEvents: function (e) {\n return \"sending \" + e + \" events\";\n },\n debugStreamDelete: function (e) {\n return 'received streaming deletion for flag \"' + e + '\"';\n },\n debugStreamDeleteIgnored: function (e) {\n return 'received streaming deletion for flag \"' + e + '\" but ignored due to version check';\n },\n debugStreamPatch: function (e) {\n return 'received streaming update for flag \"' + e + '\"';\n },\n debugStreamPatchIgnored: function (e) {\n return 'received streaming update for flag \"' + e + '\" but ignored due to version check';\n },\n debugStreamPing: function () {\n return \"received ping message from stream\";\n },\n debugPolling: function (e) {\n return \"polling for feature flags at \" + e;\n },\n debugStreamPut: function () {\n return \"received streaming update for all flags\";\n },\n deprecated: function (e, t) {\n return t ? '\"' + e + '\" is deprecated, please use \"' + t + '\"' : '\"' + e + '\" is deprecated';\n },\n environmentNotFound: function () {\n return \"Environment not found. Double check that you specified a valid environment/client-side ID.\" + oe;\n },\n environmentNotSpecified: function () {\n return \"No environment/client-side ID was specified.\" + oe;\n },\n errorFetchingFlags: function (e) {\n return \"Error fetching flag settings: \" + re(e);\n },\n eventCapacityExceeded: function () {\n return \"Exceeded event queue capacity. Increase capacity to avoid dropping events.\";\n },\n eventWithoutContext: function () {\n return \"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript\";\n },\n httpErrorMessage: function (e, t, n) {\n return \"Received error \" + e + (401 === e ? \" (invalid SDK key)\" : \"\") + \" for \" + t + \" - \" + (s.isHttpErrorRecoverable(e) ? n : \"giving up permanently\");\n },\n httpUnavailable: function () {\n return \"Cannot make HTTP requests in this environment.\" + oe;\n },\n identifyDisabled: function () {\n return \"identify() has no effect here; it must be called on the main client instance\";\n },\n inspectorMethodError: (e, t) => `an inspector: \"${t}\" of type: \"${e}\" generated an exception`,\n invalidContentType: function (e) {\n return 'Expected application/json content type but got \"' + e + '\"';\n },\n invalidData: function () {\n return \"Invalid data received from LaunchDarkly; connection may have been interrupted\";\n },\n invalidInspector: (e, t) => `an inspector: \"${t}\" of an invalid type (${e}) was configured`,\n invalidKey: function () {\n return \"Event key must be a string\";\n },\n invalidMetricValue: e => `The track function was called with a non-numeric \"metricValue\" (${e}), only numeric metric values are supported.`,\n invalidContext: function () {\n return \"Invalid context specified.\" + oe;\n },\n invalidTagValue: e => `Config option \"${e}\" must only contain letters, numbers, ., _ or -.`,\n localStorageUnavailable: function (e) {\n return \"local storage is unavailable: \" + re(e);\n },\n networkError: e => \"network error\" + (e ? \" (\" + e + \")\" : \"\"),\n optionBelowMinimum: (e, t, n) => 'Config option \"' + e + '\" was set to ' + t + \", changing to minimum value of \" + n,\n streamClosing: function () {\n return \"Closing stream connection\";\n },\n streamConnecting: function (e) {\n return \"Opening stream connection to \" + e;\n },\n streamError: function (e, t) {\n return \"Error on stream connection: \" + re(e) + \", will continue retrying after \" + t + \" milliseconds.\";\n },\n tagValueTooLong: e => `Value of \"${e}\" was longer than 64 characters and was discarded.`,\n unknownCustomEventKey: function (e) {\n return 'Custom event \"' + e + '\" does not exist';\n },\n unknownOption: e => 'Ignoring unknown config option \"' + e + '\"',\n contextNotSpecified: function () {\n return \"No context specified.\" + oe;\n },\n unrecoverableStreamError: e => `Error on stream connection ${re(e)}, giving up permanently`,\n wrongOptionType: (e, t, n) => 'Config option \"' + e + '\" should be of type ' + t + \", got \" + n + \", using default value\",\n wrongOptionTypeBoolean: (e, t) => 'Config option \"' + e + '\" should be a boolean, got ' + t + \", converting to boolean\"\n};\nconst {\n validateLogger: ae\n } = ne,\n se = {\n baseUrl: {\n default: \"https://app.launchdarkly.com\"\n },\n streamUrl: {\n default: \"https://clientstream.launchdarkly.com\"\n },\n eventsUrl: {\n default: \"https://events.launchdarkly.com\"\n },\n sendEvents: {\n default: !0\n },\n streaming: {\n type: \"boolean\"\n },\n sendLDHeaders: {\n default: !0\n },\n requestHeaderTransform: {\n type: \"function\"\n },\n sendEventsOnlyForVariation: {\n default: !1\n },\n useReport: {\n default: !1\n },\n evaluationReasons: {\n default: !1\n },\n eventCapacity: {\n default: 100,\n minimum: 1\n },\n flushInterval: {\n default: 2e3,\n minimum: 2e3\n },\n samplingInterval: {\n default: 0,\n minimum: 0\n },\n streamReconnectDelay: {\n default: 1e3,\n minimum: 0\n },\n allAttributesPrivate: {\n default: !1\n },\n privateAttributes: {\n default: []\n },\n bootstrap: {\n type: \"string|object\"\n },\n diagnosticRecordingInterval: {\n default: 9e5,\n minimum: 2e3\n },\n diagnosticOptOut: {\n default: !1\n },\n wrapperName: {\n type: \"string\"\n },\n wrapperVersion: {\n type: \"string\"\n },\n stateProvider: {\n type: \"object\"\n },\n application: {\n validator: function (e, t, n) {\n const r = {};\n t.id && (r.id = le(`${e}.id`, t.id, n));\n t.version && (r.version = le(`${e}.version`, t.version, n));\n return r;\n }\n },\n inspectors: {\n default: []\n }\n },\n ce = /^(\\w|\\.|-)+$/;\nfunction ue(e) {\n return e && e.replace(/\\/+$/, \"\");\n}\nfunction le(e, t, n) {\n if (\"string\" == typeof t && t.match(ce)) {\n if (!(t.length > 64)) return t;\n n.warn(ie.tagValueTooLong(e));\n } else n.warn(ie.invalidTagValue(e));\n}\nvar de = {\n baseOptionDefs: se,\n validate: function (e, t, n, r) {\n const o = S.extend({\n logger: {\n default: r\n }\n }, se, n),\n i = {};\n function a(e) {\n S.onNextTick(() => {\n t && t.maybeReportError(new s.LDInvalidArgumentError(e));\n });\n }\n let c = S.extend({}, e || {});\n return function (e) {\n const t = e;\n Object.keys(i).forEach(e => {\n if (void 0 !== t[e]) {\n const n = i[e];\n r && r.warn(ie.deprecated(e, n)), n && (void 0 === t[n] && (t[n] = t[e]), delete t[e]);\n }\n });\n }(c), c = function (e) {\n const t = S.extend({}, e);\n return Object.keys(o).forEach(e => {\n void 0 !== t[e] && null !== t[e] || (t[e] = o[e] && o[e].default);\n }), t;\n }(c), c = function (e) {\n const t = S.extend({}, e),\n n = e => {\n if (null === e) return \"any\";\n if (void 0 === e) return;\n if (Array.isArray(e)) return \"array\";\n const t = typeof e;\n return \"boolean\" === t || \"string\" === t || \"number\" === t || \"function\" === t ? t : \"object\";\n };\n return Object.keys(e).forEach(i => {\n const s = e[i];\n if (null != s) {\n const c = o[i];\n if (void 0 === c) a(ie.unknownOption(i));else {\n const o = c.type || n(c.default),\n u = c.validator;\n if (u) {\n const n = u(i, e[i], r);\n void 0 !== n ? t[i] = n : delete t[i];\n } else if (\"any\" !== o) {\n const e = o.split(\"|\"),\n r = n(s);\n e.indexOf(r) < 0 ? \"boolean\" === o ? (t[i] = !!s, a(ie.wrongOptionTypeBoolean(i, r))) : (a(ie.wrongOptionType(i, o, r)), t[i] = c.default) : \"number\" === r && void 0 !== c.minimum && s < c.minimum && (a(ie.optionBelowMinimum(i, s, c.minimum)), t[i] = c.minimum);\n }\n }\n }\n }), t.baseUrl = ue(t.baseUrl), t.streamUrl = ue(t.streamUrl), t.eventsUrl = ue(t.eventsUrl), t;\n }(c), ae(c.logger), c;\n },\n getTags: function (e) {\n const t = {};\n return e && (e.application && void 0 !== e.application.id && null !== e.application.id && (t[\"application-id\"] = [e.application.id]), e.application && void 0 !== e.application.version && null !== e.application.id && (t[\"application-version\"] = [e.application.version])), t;\n }\n};\nconst {\n getLDUserAgentString: fe\n} = S;\nvar ge = {\n getLDHeaders: function (e, t) {\n if (t && !t.sendLDHeaders) return {};\n const n = {};\n n[e.userAgentHeaderName || \"User-Agent\"] = fe(e), t && t.wrapperName && (n[\"X-LaunchDarkly-Wrapper\"] = t.wrapperVersion ? t.wrapperName + \"/\" + t.wrapperVersion : t.wrapperName);\n const r = de.getTags(t),\n o = Object.keys(r);\n return o.length && (n[\"x-launchdarkly-tags\"] = o.sort().map(e => Array.isArray(r[e]) ? r[e].sort().map(t => `${e}/${t}`) : [`${e}/${r[e]}`]).reduce((e, t) => e.concat(t), []).join(\" \")), n;\n },\n transformHeaders: function (e, t) {\n return t && t.requestHeaderTransform ? t.requestHeaderTransform({\n ...e\n }) : e;\n }\n};\nconst {\n v1: ve\n } = ee,\n {\n getLDHeaders: pe,\n transformHeaders: me\n } = ge;\nvar he = function (e, t, n) {\n const r = S.extend({\n \"Content-Type\": \"application/json\"\n }, pe(e, n)),\n o = {};\n return o.sendEvents = (t, o, i) => {\n if (!e.httpRequest) return Promise.resolve();\n const a = JSON.stringify(t),\n c = i ? null : ve();\n return function t(u) {\n const l = i ? r : S.extend({}, r, {\n \"X-LaunchDarkly-Event-Schema\": \"4\",\n \"X-LaunchDarkly-Payload-ID\": c\n });\n return e.httpRequest(\"POST\", o, me(l, n), a).promise.then(e => {\n if (e) return e.status >= 400 && s.isHttpErrorRecoverable(e.status) && u ? t(!1) : function (e) {\n const t = {\n status: e.status\n },\n n = e.header(\"date\");\n if (n) {\n const e = Date.parse(n);\n e && (t.serverTime = e);\n }\n return t;\n }(e);\n }).catch(() => u ? t(!1) : Promise.reject());\n }(!0).catch(() => {});\n }, o;\n};\nconst {\n commonBasicLogger: ye\n} = ne;\nfunction we(e) {\n return \"string\" == typeof e && \"kind\" !== e && e.match(/^(\\w|\\.|-)+$/);\n}\nfunction be(e) {\n return e.includes(\"%\") || e.includes(\":\") ? e.replace(/%/g, \"%25\").replace(/:/g, \"%3A\") : e;\n}\nvar ke = {\n checkContext: function (e, t) {\n if (e) {\n if (t && (void 0 === e.kind || null === e.kind)) return void 0 !== e.key && null !== e.key;\n const n = e.key,\n r = void 0 === e.kind ? \"user\" : e.kind,\n o = we(r),\n i = \"multi\" === r || null != n && \"\" !== n;\n if (\"multi\" === r) {\n const t = Object.keys(e).filter(e => \"kind\" !== e);\n return i && t.every(e => we(e)) && t.every(t => {\n const n = e[t].key;\n return null != n && \"\" !== n;\n });\n }\n return i && o;\n }\n return !1;\n },\n getContextKeys: function (e, t = ye()) {\n if (!e) return;\n const n = {},\n {\n kind: r,\n key: o\n } = e;\n switch (r) {\n case void 0:\n n.user = `${o}`;\n break;\n case \"multi\":\n Object.entries(e).filter(([e]) => \"kind\" !== e).forEach(([e, t]) => {\n t && t.key && (n[e] = t.key);\n });\n break;\n case null:\n t.warn(`null is not a valid context kind: ${e}`);\n break;\n case \"\":\n t.warn(`'' is not a valid context kind: ${e}`);\n break;\n default:\n n[r] = `${o}`;\n }\n return n;\n },\n getContextKinds: function (e) {\n return e ? null === e.kind || void 0 === e.kind ? [\"user\"] : \"multi\" !== e.kind ? [e.kind] : Object.keys(e).filter(e => \"kind\" !== e) : [];\n },\n getCanonicalKey: function (e) {\n if (e) {\n if ((void 0 === e.kind || null === e.kind || \"user\" === e.kind) && e.key) return e.key;\n if (\"multi\" !== e.kind && e.key) return `${e.kind}:${be(e.key)}`;\n if (\"multi\" === e.kind) return Object.keys(e).sort().filter(e => \"kind\" !== e).map(t => `${t}:${be(e[t].key)}`).join(\":\");\n }\n }\n};\nconst {\n getContextKinds: Ee\n} = ke;\nvar De = function () {\n const e = {};\n let t = 0,\n n = 0,\n r = {},\n o = {};\n return e.summarizeEvent = e => {\n if (\"feature\" === e.kind) {\n const i = e.key + \":\" + (null !== e.variation && void 0 !== e.variation ? e.variation : \"\") + \":\" + (null !== e.version && void 0 !== e.version ? e.version : \"\"),\n a = r[i];\n let s = o[e.key];\n s || (s = new Set(), o[e.key] = s), function (e) {\n return e.context ? Ee(e.context) : e.contextKeys ? Object.keys(e.contextKeys) : [];\n }(e).forEach(e => s.add(e)), a ? a.count = a.count + 1 : r[i] = {\n count: 1,\n key: e.key,\n version: e.version,\n variation: e.variation,\n value: e.value,\n default: e.default\n }, (0 === t || e.creationDate < t) && (t = e.creationDate), e.creationDate > n && (n = e.creationDate);\n }\n }, e.getSummary = () => {\n const e = {};\n let i = !0;\n for (const t of Object.values(r)) {\n let n = e[t.key];\n n || (n = {\n default: t.default,\n counters: [],\n contextKinds: [...o[t.key]]\n }, e[t.key] = n);\n const r = {\n value: t.value,\n count: t.count\n };\n void 0 !== t.variation && null !== t.variation && (r.variation = t.variation), void 0 !== t.version && null !== t.version ? r.version = t.version : r.unknown = !0, n.counters.push(r), i = !1;\n }\n return i ? null : {\n startDate: t,\n endDate: n,\n features: e\n };\n }, e.clearSummary = () => {\n t = 0, n = 0, r = {}, o = {};\n }, e;\n};\nfunction xe(e) {\n return e.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction Ce(e) {\n return (e.startsWith(\"/\") ? e.substring(1) : e).split(\"/\").map(e => e.indexOf(\"~\") >= 0 ? e.replace(/~1/g, \"/\").replace(/~0/g, \"~\") : e);\n}\nfunction Pe(e) {\n return !e.startsWith(\"/\");\n}\nfunction Se(e, t) {\n const n = Pe(e),\n r = Pe(t);\n if (n && r) return e === t;\n if (n) {\n const n = Ce(t);\n return 1 === n.length && e === n[0];\n }\n if (r) {\n const n = Ce(e);\n return 1 === n.length && t === n[0];\n }\n return e === t;\n}\nfunction Ie(e) {\n return `/${xe(e)}`;\n}\nvar Oe = {\n cloneExcluding: function (e, t) {\n const n = [],\n r = {},\n o = [];\n for (n.push(...Object.keys(e).map(t => ({\n key: t,\n ptr: Ie(t),\n source: e,\n parent: r,\n visited: [e]\n }))); n.length;) {\n const e = n.pop();\n if (t.some(t => Se(t, e.ptr))) o.push(e.ptr);else {\n const t = e.source[e.key];\n if (null === t) e.parent[e.key] = t;else if (Array.isArray(t)) e.parent[e.key] = [...t];else if (\"object\" == typeof t) {\n if (e.visited.includes(t)) continue;\n e.parent[e.key] = {}, n.push(...Object.keys(t).map(n => {\n return {\n key: n,\n ptr: (r = e.ptr, o = xe(n), `${r}/${o}`),\n source: t,\n parent: e.parent[e.key],\n visited: [...e.visited, t]\n };\n var r, o;\n }));\n } else e.parent[e.key] = t;\n }\n }\n return {\n cloned: r,\n excluded: o.sort()\n };\n },\n compare: Se,\n literalToReference: Ie\n};\nvar Te = function (e) {\n const t = {},\n n = e.allAttributesPrivate,\n r = e.privateAttributes || [],\n o = [\"key\", \"kind\", \"_meta\", \"anonymous\"],\n i = [\"name\", \"ip\", \"firstName\", \"lastName\", \"email\", \"avatar\", \"country\"],\n a = (e, t) => {\n if (\"object\" != typeof e || null === e || Array.isArray(e)) return;\n const {\n cloned: i,\n excluded: a\n } = Oe.cloneExcluding(e, ((e, t) => (n || t && e.anonymous ? Object.keys(e) : [...r, ...(e._meta && e._meta.privateAttributes || [])]).filter(e => !o.some(t => Oe.compare(e, t))))(e, t));\n return i.key = String(i.key), a.length && (i._meta || (i._meta = {}), i._meta.redactedAttributes = a), i._meta && (delete i._meta.privateAttributes, 0 === Object.keys(i._meta).length && delete i._meta), void 0 !== i.anonymous && (i.anonymous = !!i.anonymous), i;\n };\n return t.filter = (e, t = !1) => void 0 === e.kind || null === e.kind ? a((e => {\n const t = {\n ...(e.custom || {}),\n kind: \"user\",\n key: e.key\n };\n void 0 !== e.anonymous && (t.anonymous = !!e.anonymous);\n for (const n of i) delete t[n], void 0 !== e[n] && null !== e[n] && (t[n] = String(e[n]));\n return void 0 !== e.privateAttributeNames && null !== e.privateAttributeNames && (t._meta = t._meta || {}, t._meta.privateAttributes = e.privateAttributeNames.map(e => e.startsWith(\"/\") ? Oe.literalToReference(e) : e)), t;\n })(e), t) : \"multi\" === e.kind ? ((e, t) => {\n const n = {\n kind: e.kind\n },\n r = Object.keys(e);\n for (const o of r) if (\"kind\" !== o) {\n const r = a(e[o], t);\n r && (n[o] = r);\n }\n return n;\n })(e, t) : a(e, t), t;\n};\nconst {\n getContextKeys: Le\n} = ke;\nvar Ue = function (e, t, n, r = null, o = null, i = null) {\n const a = {},\n c = i || he(e, n, t),\n u = S.appendUrlPath(t.eventsUrl, \"/events/bulk/\" + n),\n l = De(),\n d = Te(t),\n f = t.samplingInterval,\n g = t.eventCapacity,\n v = t.flushInterval,\n p = t.logger;\n let m,\n h = [],\n y = 0,\n w = !1,\n b = !1;\n function k() {\n return 0 === f || 0 === Math.floor(Math.random() * f);\n }\n function E(e) {\n const t = S.extend({}, e);\n return \"identify\" === e.kind ? t.context = d.filter(e.context) : \"feature\" === e.kind ? t.context = d.filter(e.context, !0) : (t.contextKeys = Le(e.context, p), delete t.context), \"feature\" === e.kind && (delete t.trackEvents, delete t.debugEventsUntilDate), t;\n }\n function D(e) {\n h.length < g ? (h.push(e), b = !1) : (b || (b = !0, p.warn(ie.eventCapacityExceeded())), r && r.incrementDroppedEvents());\n }\n return a.enqueue = function (e) {\n if (w) return;\n let t = !1,\n n = !1;\n var r;\n if (l.summarizeEvent(e), \"feature\" === e.kind ? k() && (t = !!e.trackEvents, n = !!(r = e).debugEventsUntilDate && r.debugEventsUntilDate > y && r.debugEventsUntilDate > new Date().getTime()) : t = k(), t && D(E(e)), n) {\n const t = S.extend({}, e, {\n kind: \"debug\"\n });\n t.context = d.filter(t.context), delete t.trackEvents, delete t.debugEventsUntilDate, D(t);\n }\n }, a.flush = function () {\n if (w) return Promise.resolve();\n const e = h,\n t = l.getSummary();\n return l.clearSummary(), t && (t.kind = \"summary\", e.push(t)), r && r.setEventsInLastBatch(e.length), 0 === e.length ? Promise.resolve() : (h = [], p.debug(ie.debugPostingEvents(e.length)), c.sendEvents(e, u).then(e => {\n e && (e.serverTime && (y = e.serverTime), s.isHttpErrorRecoverable(e.status) || (w = !0), e.status >= 400 && S.onNextTick(() => {\n o.maybeReportError(new s.LDUnexpectedResponseError(ie.httpErrorMessage(e.status, \"event posting\", \"some events were dropped\")));\n }));\n }));\n }, a.start = function () {\n const e = () => {\n a.flush(), m = setTimeout(e, v);\n };\n m = setTimeout(e, v);\n }, a.stop = function () {\n clearTimeout(m);\n }, a;\n};\nvar Re = function (e) {\n const t = {},\n n = {};\n return t.on = function (e, t, r) {\n n[e] = n[e] || [], n[e] = n[e].concat({\n handler: t,\n context: r\n });\n }, t.off = function (e, t, r) {\n if (n[e]) for (let o = 0; o < n[e].length; o++) n[e][o].handler === t && n[e][o].context === r && (n[e] = n[e].slice(0, o).concat(n[e].slice(o + 1)));\n }, t.emit = function (e) {\n if (!n[e]) return;\n const t = n[e].slice(0);\n for (let e = 0; e < t.length; e++) t[e].handler.apply(t[e].context, Array.prototype.slice.call(arguments, 1));\n }, t.getEvents = function () {\n return Object.keys(n);\n }, t.getEventListenerCount = function (e) {\n return n[e] ? n[e].length : 0;\n }, t.maybeReportError = function (t) {\n t && (n[\"error\"] ? this.emit(\"error\", t) : (e || console).error(t.message));\n }, t;\n};\nconst Ae = \"ready\",\n je = \"initialized\",\n Fe = \"failed\";\nvar Ne = function (e) {\n let t = !1,\n n = !1,\n r = null,\n o = null;\n const i = new Promise(t => {\n const n = () => {\n e.off(Ae, n), t();\n };\n e.on(Ae, n);\n }).catch(() => {});\n return {\n getInitializationPromise: () => o || (t ? Promise.resolve() : n ? Promise.reject(r) : (o = new Promise((t, n) => {\n const r = () => {\n e.off(je, r), t();\n },\n o = t => {\n e.off(Fe, o), n(t);\n };\n e.on(je, r), e.on(Fe, o);\n }), o)),\n getReadyPromise: () => i,\n signalSuccess: () => {\n t || n || (t = !0, e.emit(je), e.emit(Ae));\n },\n signalFailure: o => {\n t || n || (n = !0, r = o, e.emit(Fe, o), e.emit(Ae)), e.maybeReportError(o);\n }\n };\n};\nvar $e = function (e, t, n, r) {\n const o = {};\n function i() {\n let e = \"\";\n const o = r.getContext();\n return o && (e = n || S.btoa(JSON.stringify(o))), \"ld:\" + t + \":\" + e;\n }\n return o.loadFlags = () => e.get(i()).then(e => {\n if (null == e) return null;\n try {\n let t = JSON.parse(e);\n if (t) {\n const e = t.$schema;\n void 0 === e || e < 1 ? t = S.transformValuesToVersionedValues(t) : delete t.$schema;\n }\n return t;\n } catch (e) {\n return o.clearFlags().then(() => null);\n }\n }), o.saveFlags = t => {\n const n = S.extend({}, t, {\n $schema: 1\n });\n return e.set(i(), JSON.stringify(n));\n }, o.clearFlags = () => e.clear(i()), o;\n};\nvar Ve = function (e, t) {\n const n = {};\n let r = !1;\n const o = e => {\n r || (r = !0, t.warn(ie.localStorageUnavailable(e)));\n };\n return n.isEnabled = () => !!e, n.get = t => new Promise(n => {\n e ? e.get(t).then(n).catch(e => {\n o(e), n(void 0);\n }) : n(void 0);\n }), n.set = (t, n) => new Promise(r => {\n e ? e.set(t, n).then(() => r(!0)).catch(e => {\n o(e), r(!1);\n }) : r(!1);\n }), n.clear = t => new Promise(n => {\n e ? e.clear(t).then(() => n(!0)).catch(e => {\n o(e), n(!1);\n }) : n(!1);\n }), n;\n};\nconst {\n appendUrlPath: Me,\n base64URLEncode: qe,\n objectHasOwnProperty: He\n } = S,\n {\n getLDHeaders: ze,\n transformHeaders: Ke\n } = ge,\n {\n isHttpErrorRecoverable: _e\n } = s;\nvar Je = function (e, t, n, r) {\n const o = t.streamUrl,\n i = t.logger,\n a = {},\n s = Me(o, \"/eval/\" + n),\n c = t.useReport,\n u = t.evaluationReasons,\n l = t.streamReconnectDelay,\n d = ze(e, t);\n let f,\n g = !1,\n v = null,\n p = null,\n m = null,\n h = null,\n y = null,\n w = 0;\n function b() {\n const e = (t = function () {\n const e = l * Math.pow(2, w);\n return e > 3e4 ? 3e4 : e;\n }(), t - Math.trunc(.5 * Math.random() * t));\n var t;\n return w += 1, e;\n }\n function k(e) {\n if (e.status && \"number\" == typeof e.status && !_e(e.status)) return x(), i.error(ie.unrecoverableStreamError(e)), void (p && (clearTimeout(p), p = null));\n const t = b();\n g || (i.warn(ie.streamError(e, t)), g = !0), C(!1), x(), E(t);\n }\n function E(e) {\n p || (e ? p = setTimeout(D, e) : D());\n }\n function D() {\n let r;\n p = null;\n let a = \"\";\n const l = {\n headers: d,\n readTimeoutMillis: 3e5\n };\n if (e.eventSourceFactory) {\n null != h && (a = \"h=\" + h), c ? e.eventSourceAllowsReport ? (r = s, l.method = \"REPORT\", l.headers[\"Content-Type\"] = \"application/json\", l.body = JSON.stringify(m)) : (r = Me(o, \"/ping/\" + n), a = \"\") : r = s + \"/\" + qe(JSON.stringify(m)), l.headers = Ke(l.headers, t), u && (a = a + (a ? \"&\" : \"\") + \"withReasons=true\"), r = r + (a ? \"?\" : \"\") + a, x(), i.info(ie.streamConnecting(r)), f = new Date().getTime(), v = e.eventSourceFactory(r, l);\n for (const e in y) He(y, e) && v.addEventListener(e, y[e]);\n v.onerror = k, v.onopen = () => {\n w = 0;\n };\n }\n }\n function x() {\n v && (i.info(ie.streamClosing()), v.close(), v = null);\n }\n function C(e) {\n f && r && r.recordStreamInit(f, !e, new Date().getTime() - f), f = null;\n }\n return a.connect = function (e, t, n) {\n m = e, h = t, y = {};\n for (const e in n || {}) y[e] = function (t) {\n g = !1, C(!0), n[e] && n[e](t);\n };\n E();\n }, a.disconnect = function () {\n clearTimeout(p), p = null, x();\n }, a.isConnected = function () {\n return !!(v && e.eventSourceIsActive && e.eventSourceIsActive(v));\n }, a;\n};\nvar Be = function (e) {\n let t, n, r, o;\n const i = {\n addPromise: (i, a) => {\n t = i, n && n(), n = a, i.then(n => {\n t === i && (r(n), e && e());\n }, n => {\n t === i && (o(n), e && e());\n });\n }\n };\n return i.resultPromise = new Promise((e, t) => {\n r = e, o = t;\n }), i;\n};\nconst {\n transformHeaders: Ge,\n getLDHeaders: We\n } = ge,\n Xe = \"application/json\";\nvar Qe = function (e, t, n) {\n const r = t.baseUrl,\n o = t.useReport,\n i = t.evaluationReasons,\n a = t.logger,\n c = {},\n u = {};\n function l(n, r) {\n if (!e.httpRequest) return new Promise((e, t) => {\n t(new s.LDFlagFetchError(ie.httpUnavailable()));\n });\n const o = r ? \"REPORT\" : \"GET\",\n i = We(e, t);\n r && (i[\"Content-Type\"] = Xe);\n let a = u[n];\n a || (a = Be(() => {\n delete u[n];\n }), u[n] = a);\n const c = e.httpRequest(o, n, Ge(i, t), r),\n l = c.promise.then(e => {\n if (200 === e.status) {\n if (e.header(\"content-type\") && e.header(\"content-type\").substring(0, 16) === Xe) return JSON.parse(e.body);\n {\n const t = ie.invalidContentType(e.header(\"content-type\") || \"\");\n return Promise.reject(new s.LDFlagFetchError(t));\n }\n }\n return Promise.reject(function (e) {\n return 404 === e.status ? new s.LDInvalidEnvironmentIdError(ie.environmentNotFound()) : new s.LDFlagFetchError(ie.errorFetchingFlags(e.statusText || String(e.status)));\n }(e));\n }, e => Promise.reject(new s.LDFlagFetchError(ie.networkError(e))));\n return a.addPromise(l, () => {\n c.cancel && c.cancel();\n }), a.resultPromise;\n }\n return c.fetchJSON = function (e) {\n return l(S.appendUrlPath(r, e), null);\n }, c.fetchFlagSettings = function (e, t) {\n let s,\n c,\n u,\n d = \"\";\n return o ? (c = [r, \"/sdk/evalx/\", n, \"/context\"].join(\"\"), u = JSON.stringify(e)) : (s = S.base64URLEncode(JSON.stringify(e)), c = [r, \"/sdk/evalx/\", n, \"/contexts/\", s].join(\"\")), t && (d = \"h=\" + t), i && (d = d + (d ? \"&\" : \"\") + \"withReasons=true\"), c = c + (d ? \"?\" : \"\") + d, a.debug(ie.debugPolling(c)), l(c, u);\n }, c;\n};\nvar Ye = function (e, t) {\n const n = {};\n let r;\n return n.setContext = function (e) {\n r = S.sanitizeContext(e), r && t && t(S.clone(r));\n }, n.getContext = function () {\n return r ? S.clone(r) : null;\n }, e && n.setContext(e), n;\n};\nconst {\n v1: Ze\n } = ee,\n {\n getContextKinds: et\n } = ke;\nvar tt = function (e) {\n function t(e) {\n return null == e || \"user\" === e ? \"ld:$anonUserId\" : `ld:$contextKey:${e}`;\n }\n function n(n, r) {\n return null !== r.key && void 0 !== r.key ? (r.key = r.key.toString(), Promise.resolve(r)) : r.anonymous ? function (n) {\n return e.get(t(n));\n }(n).then(o => {\n if (o) return r.key = o, r;\n {\n const o = Ze();\n return r.key = o, function (n, r) {\n return e.set(t(r), n);\n }(o, n).then(() => r);\n }\n }) : Promise.reject(new s.LDInvalidUserError(ie.invalidContext()));\n }\n this.processContext = e => {\n if (!e) return Promise.reject(new s.LDInvalidUserError(ie.contextNotSpecified()));\n const t = S.clone(e);\n if (\"multi\" === e.kind) {\n const e = et(t);\n return Promise.all(e.map(e => n(e, t[e]))).then(() => t);\n }\n return n(e.kind, t);\n };\n};\nconst {\n v1: nt\n } = ee,\n {\n baseOptionDefs: rt\n } = de,\n {\n appendUrlPath: ot\n } = S;\nvar it = {\n DiagnosticId: function (e) {\n const t = {\n diagnosticId: nt()\n };\n return e && (t.sdkKeySuffix = e.length > 6 ? e.substring(e.length - 6) : e), t;\n },\n DiagnosticsAccumulator: function (e) {\n let t, n, r, o;\n function i(e) {\n t = e, n = 0, r = 0, o = [];\n }\n return i(e), {\n getProps: () => ({\n dataSinceDate: t,\n droppedEvents: n,\n eventsInLastBatch: r,\n streamInits: o\n }),\n setProps: e => {\n t = e.dataSinceDate, n = e.droppedEvents || 0, r = e.eventsInLastBatch || 0, o = e.streamInits || [];\n },\n incrementDroppedEvents: () => {\n n++;\n },\n setEventsInLastBatch: e => {\n r = e;\n },\n recordStreamInit: (e, t, n) => {\n const r = {\n timestamp: e,\n failed: t,\n durationMillis: n\n };\n o.push(r);\n },\n reset: i\n };\n },\n DiagnosticsManager: function (e, t, n, r, o, i, a) {\n const s = !!e.diagnosticUseCombinedEvent,\n c = \"ld:\" + o + \":$diagnostics\",\n u = ot(i.eventsUrl, \"/events/diagnostic/\" + o),\n l = i.diagnosticRecordingInterval,\n d = n;\n let f,\n g,\n v = !!i.streaming;\n const p = {};\n function m() {\n return {\n sdk: w(),\n configuration: b(),\n platform: e.diagnosticPlatformData\n };\n }\n function h(e) {\n i.logger && i.logger.debug(ie.debugPostingDiagnosticEvent(e)), r.sendEvents(e, u, !0).then(() => {}).catch(() => {});\n }\n function y() {\n h(function () {\n const e = new Date().getTime();\n let t = {\n kind: s ? \"diagnostic-combined\" : \"diagnostic\",\n id: a,\n creationDate: e,\n ...d.getProps()\n };\n return s && (t = {\n ...t,\n ...m()\n }), d.reset(e), t;\n }()), g = setTimeout(y, l), f = new Date().getTime(), s && function () {\n if (t.isEnabled()) {\n const e = {\n ...d.getProps()\n };\n t.set(c, JSON.stringify(e));\n }\n }();\n }\n function w() {\n const t = {\n ...e.diagnosticSdkData\n };\n return i.wrapperName && (t.wrapperName = i.wrapperName), i.wrapperVersion && (t.wrapperVersion = i.wrapperVersion), t;\n }\n function b() {\n return {\n customBaseURI: i.baseUrl !== rt.baseUrl.default,\n customStreamURI: i.streamUrl !== rt.streamUrl.default,\n customEventsURI: i.eventsUrl !== rt.eventsUrl.default,\n eventsCapacity: i.eventCapacity,\n eventsFlushIntervalMillis: i.flushInterval,\n reconnectTimeMillis: i.streamReconnectDelay,\n streamingDisabled: !v,\n allAttributesPrivate: !!i.allAttributesPrivate,\n diagnosticRecordingIntervalMillis: i.diagnosticRecordingInterval,\n usingSecureMode: !!i.hash,\n bootstrapMode: !!i.bootstrap,\n fetchGoalsDisabled: !i.fetchGoals,\n sendEventsOnlyForVariation: !!i.sendEventsOnlyForVariation\n };\n }\n return p.start = () => {\n s ? function (e) {\n if (!t.isEnabled()) return e(!1);\n t.get(c).then(t => {\n if (t) try {\n const e = JSON.parse(t);\n d.setProps(e), f = e.dataSinceDate;\n } catch (e) {}\n e(!0);\n }).catch(() => {\n e(!1);\n });\n }(e => {\n if (e) {\n const e = (f || 0) + l,\n t = new Date().getTime();\n t >= e ? y() : g = setTimeout(y, e - t);\n } else 0 === Math.floor(4 * Math.random()) ? y() : g = setTimeout(y, l);\n }) : (h({\n kind: \"diagnostic-init\",\n id: a,\n creationDate: d.getProps().dataSinceDate,\n ...m()\n }), g = setTimeout(y, l));\n }, p.stop = () => {\n g && clearTimeout(g);\n }, p.setStreaming = e => {\n v = e;\n }, p;\n }\n};\nvar at = function (e, t) {\n let n = !1;\n const r = {\n type: e.type,\n name: e.name,\n synchronous: e.synchronous,\n method: (...o) => {\n try {\n e.method(...o);\n } catch {\n n || (n = !0, t.warn(ie.inspectorMethodError(r.type, r.name)));\n }\n }\n };\n return r;\n};\nconst {\n onNextTick: st\n } = S,\n ct = {\n flagUsed: \"flag-used\",\n flagDetailsChanged: \"flag-details-changed\",\n flagDetailChanged: \"flag-detail-changed\",\n clientIdentityChanged: \"client-identity-changed\"\n };\nObject.freeze(ct);\nvar ut = {\n InspectorTypes: ct,\n InspectorManager: function (e, t) {\n const n = {},\n r = {\n [ct.flagUsed]: [],\n [ct.flagDetailsChanged]: [],\n [ct.flagDetailChanged]: [],\n [ct.clientIdentityChanged]: []\n },\n o = {\n [ct.flagUsed]: [],\n [ct.flagDetailsChanged]: [],\n [ct.flagDetailChanged]: [],\n [ct.clientIdentityChanged]: []\n },\n i = e && e.map(e => at(e, t));\n return i && i.forEach(e => {\n Object.prototype.hasOwnProperty.call(r, e.type) && !e.synchronous ? r[e.type].push(e) : Object.prototype.hasOwnProperty.call(o, e.type) && e.synchronous ? o[e.type].push(e) : t.warn(ie.invalidInspector(e.type, e.name));\n }), n.hasListeners = e => r[e] && r[e].length || o[e] && o[e].length, n.onFlagUsed = (e, t, n) => {\n const i = ct.flagUsed;\n o[i].length && o[i].forEach(r => r.method(e, t, n)), r[i].length && st(() => {\n r[i].forEach(r => r.method(e, t, n));\n });\n }, n.onFlags = e => {\n const t = ct.flagDetailsChanged;\n o[t].length && o[t].forEach(t => t.method(e)), r[t].length && st(() => {\n r[t].forEach(t => t.method(e));\n });\n }, n.onFlagChanged = (e, t) => {\n const n = ct.flagDetailChanged;\n o[n].length && o[n].forEach(n => n.method(e, t)), r[n].length && st(() => {\n r[n].forEach(n => n.method(e, t));\n });\n }, n.onIdentityChanged = e => {\n const t = ct.clientIdentityChanged;\n o[t].length && o[t].forEach(t => t.method(e)), r[t].length && st(() => {\n r[t].forEach(t => t.method(e));\n });\n }, n;\n }\n};\nconst {\n LDTimeoutError: lt\n} = s;\nvar dt = function (e, t) {\n return new Promise((n, r) => {\n setTimeout(() => {\n r(new lt(`${t} timed out after ${e} seconds.`));\n }, 1e3 * e);\n });\n};\nconst {\n commonBasicLogger: ft\n } = ne,\n {\n checkContext: gt,\n getContextKeys: vt\n } = ke,\n {\n InspectorTypes: pt,\n InspectorManager: mt\n } = ut,\n ht = \"change\",\n yt = \"internal-change\";\nvar wt = {\n initialize: function (e, t, n, r, o) {\n const i = function () {\n if (n && n.logger) return n.logger;\n return o && o.logger && o.logger.default || ft(\"warn\");\n }(),\n a = Re(i),\n c = Ne(a),\n u = de.validate(n, a, o, i),\n l = mt(u.inspectors, i),\n d = u.sendEvents;\n let f = e,\n g = u.hash;\n const v = Ve(r.localStorage, i),\n p = he(r, f, u),\n m = u.sendEvents && !u.diagnosticOptOut,\n h = m ? it.DiagnosticId(f) : null,\n y = m ? it.DiagnosticsAccumulator(new Date().getTime()) : null,\n w = m ? it.DiagnosticsManager(r, v, y, p, f, u, h) : null,\n b = Je(r, u, f, y),\n k = u.eventProcessor || Ue(r, u, f, y, a, p),\n E = Qe(r, u, f);\n let D,\n x,\n C,\n P = {},\n I = u.streaming,\n O = !1,\n T = !1,\n L = !0;\n const U = u.stateProvider,\n R = Ye(null, function (e) {\n (function (e) {\n if (U) return;\n e && F({\n kind: \"identify\",\n context: e,\n creationDate: new Date().getTime()\n });\n })(e), l.hasListeners(pt.clientIdentityChanged) && l.onIdentityChanged(R.getContext());\n }),\n A = new tt(v),\n j = v.isEnabled() ? $e(v, f, g, R) : null;\n function F(e) {\n f && (U && U.enqueueEvent && U.enqueueEvent(e) || (e.context ? (L = !1, !d || T || r.isDoNotTrack() || (i.debug(ie.debugEnqueueingEvent(e.kind)), k.enqueue(e))) : L && (i.warn(ie.eventWithoutContext()), L = !1)));\n }\n function N(e, t) {\n l.hasListeners(pt.flagDetailChanged) && l.onFlagChanged(e.key, H(t));\n }\n function $() {\n l.hasListeners(pt.flagDetailsChanged) && l.onFlags(Object.entries(P).map(([e, t]) => ({\n key: e,\n detail: H(t)\n })).reduce((e, t) => (e[t.key] = t.detail, e), {}));\n }\n function V(e, t, n, r) {\n const o = R.getContext(),\n i = new Date(),\n a = {\n kind: \"feature\",\n key: e,\n context: o,\n value: t ? t.value : null,\n variation: t ? t.variationIndex : null,\n default: n,\n creationDate: i.getTime()\n },\n s = P[e];\n s && (a.version = s.flagVersion ? s.flagVersion : s.version, a.trackEvents = s.trackEvents, a.debugEventsUntilDate = s.debugEventsUntilDate), (r || s && s.trackReason) && t && (a.reason = t.reason), F(a);\n }\n function M(e) {\n return gt(e, !1) ? Promise.resolve(e) : Promise.reject(new s.LDInvalidUserError(ie.invalidContext()));\n }\n function q(e, t, n, r, o, i) {\n let a, s;\n return P && S.objectHasOwnProperty(P, e) && P[e] && !P[e].deleted ? (s = P[e], a = H(s), null !== s.value && void 0 !== s.value || (a.value = t)) : a = {\n value: t,\n variationIndex: null,\n reason: {\n kind: \"ERROR\",\n errorKind: \"FLAG_NOT_FOUND\"\n }\n }, n && (o || s?.prerequisites?.forEach(e => {\n q(e, void 0, n, !1, !1, !1);\n }), V(e, a, t, r)), !o && i && function (e, t) {\n l.hasListeners(pt.flagUsed) && l.onFlagUsed(e, t, R.getContext());\n }(e, a), a;\n }\n function H(e) {\n return {\n value: e.value,\n variationIndex: void 0 === e.variation ? null : e.variation,\n reason: e.reason || null\n };\n }\n function z() {\n if (x = !0, !R.getContext()) return;\n const e = e => {\n try {\n return JSON.parse(e);\n } catch (e) {\n return void a.maybeReportError(new s.LDInvalidDataError(ie.invalidData()));\n }\n };\n b.connect(R.getContext(), g, {\n ping: function () {\n i.debug(ie.debugStreamPing());\n const e = R.getContext();\n E.fetchFlagSettings(e, g).then(t => {\n S.deepEquals(e, R.getContext()) && _(t || {});\n }).catch(e => {\n a.maybeReportError(new s.LDFlagFetchError(ie.errorFetchingFlags(e)));\n });\n },\n put: function (t) {\n const n = e(t.data);\n n && (i.debug(ie.debugStreamPut()), _(n));\n },\n patch: function (t) {\n const n = e(t.data);\n if (!n) return;\n const r = P[n.key];\n if (!r || !r.version || !n.version || r.version < n.version) {\n i.debug(ie.debugStreamPatch(n.key));\n const e = {},\n t = S.extend({}, n);\n delete t.key, P[n.key] = t;\n const o = H(t);\n e[n.key] = r ? {\n previous: r.value,\n current: o\n } : {\n current: o\n }, N(n, t), J(e);\n } else i.debug(ie.debugStreamPatchIgnored(n.key));\n },\n delete: function (t) {\n const n = e(t.data);\n if (n) if (!P[n.key] || P[n.key].version < n.version) {\n i.debug(ie.debugStreamDelete(n.key));\n const e = {};\n P[n.key] && !P[n.key].deleted && (e[n.key] = {\n previous: P[n.key].value\n }), P[n.key] = {\n version: n.version,\n deleted: !0\n }, N(n, P[n.key]), J(e);\n } else i.debug(ie.debugStreamDeleteIgnored(n.key));\n }\n });\n }\n function K() {\n x && (b.disconnect(), x = !1);\n }\n function _(e) {\n const t = {};\n if (!e) return Promise.resolve();\n for (const n in P) S.objectHasOwnProperty(P, n) && P[n] && (e[n] && !S.deepEquals(e[n].value, P[n].value) ? t[n] = {\n previous: P[n].value,\n current: H(e[n])\n } : e[n] && !e[n].deleted || (t[n] = {\n previous: P[n].value\n }));\n for (const n in e) S.objectHasOwnProperty(e, n) && e[n] && (!P[n] || P[n].deleted) && (t[n] = {\n current: H(e[n])\n });\n return P = {\n ...e\n }, $(), J(t).catch(() => {});\n }\n function J(e) {\n const t = Object.keys(e);\n if (t.length > 0) {\n const n = {};\n t.forEach(t => {\n const r = e[t].current,\n o = r ? r.value : void 0,\n i = e[t].previous;\n a.emit(ht + \":\" + t, o, i), n[t] = r ? {\n current: o,\n previous: i\n } : {\n previous: i\n };\n }), a.emit(ht, n), a.emit(yt, P), u.sendEventsOnlyForVariation || U || t.forEach(t => {\n V(t, e[t].current);\n });\n }\n return D && j ? j.saveFlags(P) : Promise.resolve();\n }\n function B() {\n const e = I || C && void 0 === I;\n e && !x ? z() : !e && x && K(), w && w.setStreaming(e);\n }\n function G(e) {\n return e === ht || e.substr(0, 7) === ht + \":\";\n }\n if (\"string\" == typeof u.bootstrap && \"LOCALSTORAGE\" === u.bootstrap.toUpperCase() && (j ? D = !0 : i.warn(ie.localStorageUnavailable())), \"object\" == typeof u.bootstrap && (P = function (e) {\n const t = Object.keys(e),\n n = \"$flagsState\",\n r = \"$valid\",\n o = e[n];\n !o && t.length && i.warn(ie.bootstrapOldFormat()), !1 === e[r] && i.warn(ie.bootstrapInvalid());\n const a = {};\n return t.forEach(t => {\n if (t !== n && t !== r) {\n let n = {\n value: e[t]\n };\n o && o[t] ? n = S.extend(n, o[t]) : n.version = 0, a[t] = n;\n }\n }), a;\n }(u.bootstrap)), U) {\n const e = U.getInitialState();\n e ? W(e) : U.on(\"init\", W), U.on(\"update\", function (e) {\n e.context && R.setContext(e.context);\n e.flags && _(e.flags);\n });\n } else (function () {\n if (!e) return Promise.reject(new s.LDInvalidEnvironmentIdError(ie.environmentNotSpecified()));\n return A.processContext(t).then(M).then(e => (R.setContext(e), \"object\" == typeof u.bootstrap ? X() : D ? j.loadFlags().then(e => null == e ? (P = {}, E.fetchFlagSettings(R.getContext(), g).then(e => _(e || {})).then(X).catch(e => {\n Q(new s.LDFlagFetchError(ie.errorFetchingFlags(e)));\n })) : (P = e, S.onNextTick(X), E.fetchFlagSettings(R.getContext(), g).then(e => _(e)).catch(e => a.maybeReportError(e)))) : E.fetchFlagSettings(R.getContext(), g).then(e => {\n P = e || {}, $(), X();\n }).catch(e => {\n P = {}, Q(e);\n })));\n })().catch(Q);\n function W(e) {\n f = e.environment, R.setContext(e.context), P = {\n ...e.flags\n }, S.onNextTick(X);\n }\n function X() {\n i.info(ie.clientInitialized()), O = !0, B(), c.signalSuccess();\n }\n function Q(e) {\n c.signalFailure(e);\n }\n const Y = {\n waitForInitialization: function (e = void 0) {\n if (null != e) {\n if (\"number\" == typeof e) return function (e) {\n e > 5 && i.warn(\"The waitForInitialization function was called with a timeout greater than 5 seconds. We recommend a timeout of 5 seconds or less.\");\n const t = c.getInitializationPromise(),\n n = dt(e, \"waitForInitialization\");\n return Promise.race([n, t]).catch(e => {\n throw e instanceof s.LDTimeoutError && i.error(`waitForInitialization error: ${e}`), e;\n });\n }(e);\n i.warn(\"The waitForInitialization method was provided with a non-numeric timeout.\");\n }\n return i.warn(\"The waitForInitialization function was called without a timeout specified. In a future version a default timeout will be applied.\"), c.getInitializationPromise();\n },\n waitUntilReady: () => c.getReadyPromise(),\n identify: function (e, t, n) {\n if (T) return S.wrapPromiseCallback(Promise.resolve({}), n);\n if (U) return i.warn(ie.identifyDisabled()), S.wrapPromiseCallback(Promise.resolve(S.transformVersionedValuesToValues(P)), n);\n const r = D && j ? j.clearFlags() : Promise.resolve();\n return S.wrapPromiseCallback(r.then(() => A.processContext(e)).then(M).then(e => E.fetchFlagSettings(e, t).then(n => {\n const r = S.transformVersionedValuesToValues(n);\n return R.setContext(e), g = t, n ? _(n).then(() => r) : r;\n })).then(e => (x && z(), e)).catch(e => (a.maybeReportError(e), Promise.reject(e))), n);\n },\n getContext: function () {\n return R.getContext();\n },\n variation: function (e, t) {\n return q(e, t, !0, !1, !1, !0).value;\n },\n variationDetail: function (e, t) {\n return q(e, t, !0, !0, !1, !0);\n },\n track: function (e, t, n) {\n if (\"string\" != typeof e) return void a.maybeReportError(new s.LDInvalidEventKeyError(ie.unknownCustomEventKey(e)));\n void 0 !== n && \"number\" != typeof n && i.warn(ie.invalidMetricValue(typeof n)), r.customEventFilter && !r.customEventFilter(e) && i.warn(ie.unknownCustomEventKey(e));\n const o = R.getContext(),\n c = {\n kind: \"custom\",\n key: e,\n context: o,\n url: r.getCurrentUrl(),\n creationDate: new Date().getTime()\n };\n o && o.anonymous && (c.contextKind = o.anonymous ? \"anonymousUser\" : \"user\"), null != t && (c.data = t), null != n && (c.metricValue = n), F(c);\n },\n on: function (e, t, n) {\n G(e) ? (C = !0, O && B(), a.on(e, t, n)) : a.on(...arguments);\n },\n off: function (e) {\n if (a.off(...arguments), G(e)) {\n let e = !1;\n a.getEvents().forEach(t => {\n G(t) && a.getEventListenerCount(t) > 0 && (e = !0);\n }), e || (C = !1, x && void 0 === I && K());\n }\n },\n setStreaming: function (e) {\n const t = null === e ? void 0 : e;\n t !== I && (I = t, B());\n },\n flush: function (e) {\n return S.wrapPromiseCallback(d ? k.flush() : Promise.resolve(), e);\n },\n allFlags: function () {\n const e = {};\n if (!P) return e;\n for (const t in P) S.objectHasOwnProperty(P, t) && !P[t].deleted && (e[t] = q(t, null, !u.sendEventsOnlyForVariation, !1, !0, !1).value);\n return e;\n },\n close: function (e) {\n if (T) return S.wrapPromiseCallback(Promise.resolve(), e);\n const t = () => {\n T = !0, P = {};\n },\n n = Promise.resolve().then(() => {\n if (K(), w && w.stop(), d) return k.stop(), k.flush();\n }).then(t).catch(t);\n return S.wrapPromiseCallback(n, e);\n }\n };\n return {\n client: Y,\n options: u,\n emitter: a,\n ident: R,\n logger: i,\n requestor: E,\n start: function () {\n d && (w && w.start(), k.start());\n },\n enqueueEvent: F,\n getFlagsInternal: function () {\n return P;\n },\n getEnvironmentId: () => f,\n internalChangeEventName: yt\n };\n },\n commonBasicLogger: ft,\n errors: s,\n messages: ie,\n utils: S,\n getContextKeys: vt\n },\n bt = wt.initialize,\n kt = wt.errors,\n Et = wt.messages;\nfunction Dt(e, t, n) {\n return (t = function (e) {\n var t = function (e, t) {\n if (\"object\" != typeof e || !e) return e;\n var n = e[Symbol.toPrimitive];\n if (void 0 !== n) {\n var r = n.call(e, t || \"default\");\n if (\"object\" != typeof r) return r;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === t ? String : Number)(e);\n }(e, \"string\");\n return \"symbol\" == typeof t ? t : t + \"\";\n }(t)) in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\nfunction xt(e, t) {\n var n = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var r = Object.getOwnPropertySymbols(e);\n t && (r = r.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, r);\n }\n return n;\n}\nfunction Ct(e) {\n for (var t = 1; t < arguments.length; t++) {\n var n = null != arguments[t] ? arguments[t] : {};\n t % 2 ? xt(Object(n), !0).forEach(function (t) {\n Dt(e, t, n[t]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : xt(Object(n)).forEach(function (t) {\n Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));\n });\n }\n return e;\n}\nvar Pt = wt.commonBasicLogger;\nvar St = function (e) {\n return Pt(Ct({\n destination: console.log\n }, e));\n};\nvar It = {\n promise: Promise.resolve({\n status: 200,\n header: function () {\n return null;\n },\n body: null\n })\n};\nfunction Ot(e, t, n, r, o) {\n if (o && !function () {\n var e = window.navigator && window.navigator.userAgent;\n if (e) {\n var t = e.match(/Chrom(e|ium)\\/([0-9]+)\\./);\n if (t) return parseInt(t[2], 10) < 73;\n }\n return !0;\n }()) return It;\n var i = new window.XMLHttpRequest();\n for (var a in i.open(e, t, !o), n || {}) Object.prototype.hasOwnProperty.call(n, a) && i.setRequestHeader(a, n[a]);\n if (o) {\n try {\n i.send(r);\n } catch (e) {}\n return It;\n }\n var s,\n c = new Promise(function (e, t) {\n i.addEventListener(\"load\", function () {\n s || e({\n status: i.status,\n header: function (e) {\n return i.getResponseHeader(e);\n },\n body: i.responseText\n });\n }), i.addEventListener(\"error\", function () {\n s || t(new Error());\n }), i.send(r);\n });\n return {\n promise: c,\n cancel: function () {\n s = !0, i.abort();\n }\n };\n}\nvar Tt = e => {\n if (\"string\" != typeof e) throw new TypeError(\"Expected a string\");\n return e.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n};\nfunction Lt(e, t, n, r) {\n var o,\n i,\n a = ((\"substring\" === e.kind || \"regex\" === e.kind) && r.includes(\"/\") ? t : t.replace(r, \"\")).replace(n, \"\");\n switch (e.kind) {\n case \"exact\":\n i = t, o = new RegExp(\"^\" + Tt(e.url) + \"/?$\");\n break;\n case \"canonical\":\n i = a, o = new RegExp(\"^\" + Tt(e.url) + \"/?$\");\n break;\n case \"substring\":\n i = a, o = new RegExp(\".*\" + Tt(e.substring) + \".*$\");\n break;\n case \"regex\":\n i = a, o = new RegExp(e.pattern);\n break;\n default:\n return !1;\n }\n return o.test(i);\n}\nfunction Ut(e, t) {\n for (var n = {}, r = null, o = [], i = 0; i < e.length; i++) for (var a = e[i], s = a.urls || [], c = 0; c < s.length; c++) if (Lt(s[c], window.location.href, window.location.search, window.location.hash)) {\n \"pageview\" === a.kind ? t(\"pageview\", a) : (o.push(a), t(\"click_pageview\", a));\n break;\n }\n return o.length > 0 && (r = function (e) {\n for (var n = function (e, t) {\n for (var n = [], r = 0; r < t.length; r++) for (var o = e.target, i = t[r], a = i.selector, s = document.querySelectorAll(a); o && s.length > 0;) {\n for (var c = 0; c < s.length; c++) o === s[c] && n.push(i);\n o = o.parentNode;\n }\n return n;\n }(e, o), r = 0; r < n.length; r++) t(\"click\", n[r]);\n }, document.addEventListener(\"click\", r)), n.dispose = function () {\n document.removeEventListener(\"click\", r);\n }, n;\n}\nfunction Rt(e, t) {\n var n, r;\n function o() {\n r && r.dispose(), n && n.length && (r = Ut(n, i));\n }\n function i(t, n) {\n var r = e.ident.getContext(),\n o = {\n kind: t,\n key: n.key,\n data: null,\n url: window.location.href,\n creationDate: new Date().getTime(),\n context: r\n };\n return \"click\" === t && (o.selector = n.selector), e.enqueueEvent(o);\n }\n return e.requestor.fetchJSON(\"/sdk/goals/\" + e.getEnvironmentId()).then(function (e) {\n e && e.length > 0 && (r = Ut(n = e, i), function (e, t) {\n var n,\n r = window.location.href;\n function o() {\n (n = window.location.href) !== r && (r = n, t());\n }\n !function e(t, n) {\n t(), setTimeout(function () {\n e(t, n);\n }, n);\n }(o, e), window.history && window.history.pushState ? window.addEventListener(\"popstate\", o) : window.addEventListener(\"hashchange\", o);\n }(300, o)), t();\n }).catch(function (n) {\n e.emitter.maybeReportError(new kt.LDUnexpectedResponseError((n && n.message, n.message))), t();\n }), {};\n}\nvar At = \"goalsReady\",\n jt = {\n fetchGoals: {\n default: !0\n },\n hash: {\n type: \"string\"\n },\n eventProcessor: {\n type: \"object\"\n },\n eventUrlTransformer: {\n type: \"function\"\n },\n disableSyncEventPost: {\n default: !1\n }\n };\nfunction Ft(e, t) {\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\n r = function (e) {\n var t,\n n = {\n userAgentHeaderName: \"X-LaunchDarkly-User-Agent\",\n synchronousFlush: !1\n };\n if (window.XMLHttpRequest) {\n var r = e && e.disableSyncEventPost;\n n.httpRequest = function (e, t, o, i) {\n var a = n.synchronousFlush & !r;\n return n.synchronousFlush = !1, Ot(e, t, o, i, a);\n };\n }\n n.httpAllowsPost = function () {\n return void 0 === t && (t = !!window.XMLHttpRequest && \"withCredentials\" in new window.XMLHttpRequest()), t;\n }, n.httpFallbackPing = function (e) {\n new window.Image().src = e;\n };\n var o,\n i = e && e.eventUrlTransformer;\n n.getCurrentUrl = function () {\n return i ? i(window.location.href) : window.location.href;\n }, n.isDoNotTrack = function () {\n var e;\n return 1 === (e = window.navigator && void 0 !== window.navigator.doNotTrack ? window.navigator.doNotTrack : window.navigator && void 0 !== window.navigator.msDoNotTrack ? window.navigator.msDoNotTrack : window.doNotTrack) || !0 === e || \"1\" === e || \"yes\" === e;\n };\n try {\n window.localStorage && (n.localStorage = {\n get: function (e) {\n return new Promise(function (t) {\n t(window.localStorage.getItem(e));\n });\n },\n set: function (e, t) {\n return new Promise(function (n) {\n window.localStorage.setItem(e, t), n();\n });\n },\n clear: function (e) {\n return new Promise(function (t) {\n window.localStorage.removeItem(e), t();\n });\n }\n });\n } catch (e) {\n n.localStorage = null;\n }\n if (e && e.useReport && \"function\" == typeof window.EventSourcePolyfill && window.EventSourcePolyfill.supportedOptions && window.EventSourcePolyfill.supportedOptions.method ? (n.eventSourceAllowsReport = !0, o = window.EventSourcePolyfill) : (n.eventSourceAllowsReport = !1, o = window.EventSource), window.EventSource) {\n var a = 3e5;\n n.eventSourceFactory = function (e, t) {\n var n = Ct(Ct({}, {\n heartbeatTimeout: a,\n silentTimeout: a,\n skipDefaultHeaders: !0\n }), t);\n return new o(e, n);\n }, n.eventSourceIsActive = function (e) {\n return e.readyState === window.EventSource.OPEN || e.readyState === window.EventSource.CONNECTING;\n };\n }\n return n.userAgent = \"JSClient\", n.version = \"3.5.0\", n.diagnosticSdkData = {\n name: \"js-client-sdk\",\n version: \"3.5.0\"\n }, n.diagnosticPlatformData = {\n name: \"JS\"\n }, n.diagnosticUseCombinedEvent = !0, n;\n }(n),\n o = bt(e, t, n, r, jt),\n i = o.client,\n a = o.options,\n s = o.emitter,\n c = new Promise(function (e) {\n var t = s.on(At, function () {\n s.off(At, t), e();\n });\n });\n i.waitUntilGoalsReady = function () {\n return c;\n }, a.fetchGoals ? Rt(o, function () {\n return s.emit(At);\n }) : s.emit(At), \"complete\" !== document.readyState ? window.addEventListener(\"load\", o.start) : o.start();\n var u = function () {\n r.synchronousFlush = !0, i.flush().catch(function () {}), r.synchronousFlush = !1;\n };\n return document.addEventListener(\"visibilitychange\", function () {\n \"hidden\" === document.visibilityState && u();\n }), window.addEventListener(\"pagehide\", u), i;\n}\nvar Nt = St,\n $t = void 0,\n Vt = \"3.5.0\";\nvar Mt = {\n initialize: function (e, t) {\n var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};\n return console && console.warn && console.warn(Et.deprecated(\"default export\", \"named LDClient export\")), Ft(e, t, n);\n },\n version: Vt\n};\nexport { Nt as basicLogger, $t as createConsoleLogger, Mt as default, Ft as initialize, Vt as version };\n","import { Injectable, OnDestroy } from '@angular/core';\n\nimport {\n CookieName,\n CookieService,\n LaunchDarklyContextProviderService,\n Logger,\n TrackingService,\n UserEvent,\n UserLoginEvent,\n UserLogoutEvent,\n UserService,\n} from '@frontend/vanilla/core';\nimport { LDClient, LDEvaluationDetail, LDFlagChangeset, LDFlagSet, LDOptions, initialize } from 'launchdarkly-js-client-sdk';\nimport { BehaviorSubject, Observable, ReplaySubject, Subscription, catchError, map, merge, of, switchMap, timeout } from 'rxjs';\nimport { first } from 'rxjs/operators';\n\nimport { LaunchDarklyConfig } from './launch-darkly.client-config';\n\n/**\n * @stable\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class LaunchDarklyService implements OnDestroy {\n /**\n * LaunchDarkly SDK client object.\n *\n * Can be used directly to access all properties and methods provided by the SDK.\n *\n * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/javascript).\n */\n client: LDClient;\n defaultOptions: LDOptions = {\n inspectors: [\n {\n type: 'flag-used',\n name: 'flag-used-inspector',\n method: (flagKey: string, flagDetail: LDEvaluationDetail) => this.trackFlagUsed(flagKey, flagDetail),\n },\n ],\n };\n private flags: LDFlagSet = {};\n private userAuthenticationSubscriber: Subscription;\n private _featureFlags = new BehaviorSubject({});\n private isLaunchDarklyConfigured = false;\n\n constructor(\n private userService: UserService,\n private contextProviderService: LaunchDarklyContextProviderService,\n private config: LaunchDarklyConfig,\n private trackingService: TrackingService,\n private cookieService: CookieService,\n private logger: Logger,\n ) {}\n\n private _clientInitialized = new ReplaySubject(1);\n private get clientInitialized(): Observable {\n return this._clientInitialized.pipe(first());\n }\n\n async initialize(clientId: string) {\n this.isLaunchDarklyConfigured = true;\n\n if (!this.client) {\n const options = Object.assign({}, this.defaultOptions, this.config.options);\n const context = await this.contextProviderService.getContext();\n this.client = initialize(clientId, context, options);\n\n this.client\n .waitForInitialization()\n .then(() => {\n this.fetchLDFlags();\n this._clientInitialized.next();\n this.contextProviderService.contextChanged.subscribe(() => {\n this.updateContext();\n });\n this.subscribeToUserAuthenticationEvents();\n })\n .catch((error: unknown) => {\n this.logger.error('[LaunchDarkly] - Error while initializing SDK.', error);\n });\n\n this.client.on('change', async (changedFlags: LDFlagChangeset) => {\n await this.updateFlag(changedFlags);\n this.logger.info('[LaunchDarkly] - Flags changed', changedFlags);\n });\n\n this.client.on('error', (error: any) => {\n this.logger.error('[LaunchDarkly] - General error.', error);\n });\n }\n }\n\n /**\n * Emits the current value for the specified Feature flag.\n *\n * // Usage (component example):\n * export class HeaderComponent implements OnInit\n * {\n * buttonsEnabled = false;\n * ngOnInit() {\n * this.flagsService.getFeatureFlagValue('HeaderButtonsEnabled').subscribe((value) => {\n * this.buttonsEnabled = value;\n * });\n * }\n * }\n *\n * // Usage (Markup)\n *