@ethlete/core 0.2.0-next.2 → 0.2.0-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/esm2020/lib/components/public-api.mjs +2 -0
  2. package/esm2020/lib/components/structured-data/public-api.mjs +2 -0
  3. package/esm2020/lib/components/structured-data/structured-data.component.mjs +37 -0
  4. package/esm2020/lib/directives/click-outside/click-outside.directive.mjs +37 -0
  5. package/esm2020/lib/directives/click-outside/public-api.mjs +2 -0
  6. package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.mjs +3 -0
  7. package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.mjs +147 -0
  8. package/esm2020/lib/directives/cursor-drag-scroll/public-api.mjs +2 -0
  9. package/esm2020/lib/directives/let/let.directive.mjs +8 -8
  10. package/esm2020/lib/directives/observe-content/observe-content.directive.mjs +11 -11
  11. package/esm2020/lib/directives/observe-resize/observe-resize.directive.mjs +11 -12
  12. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.constants.mjs +3 -0
  13. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.directive.mjs +171 -0
  14. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.types.mjs +2 -0
  15. package/esm2020/lib/directives/observe-scroll-state/public-api.mjs +3 -0
  16. package/esm2020/lib/directives/public-api.mjs +10 -3
  17. package/esm2020/lib/directives/repeat/repeat.directive.mjs +10 -11
  18. package/esm2020/lib/directives/scroll-observer-first-element/index.mjs +2 -0
  19. package/esm2020/lib/directives/scroll-observer-first-element/public-api.mjs +2 -0
  20. package/esm2020/lib/directives/scroll-observer-first-element/scroll-observer-first-element.directive.mjs +31 -0
  21. package/esm2020/lib/directives/scroll-observer-ignore-target/index.mjs +2 -0
  22. package/esm2020/lib/directives/scroll-observer-ignore-target/public-api.mjs +2 -0
  23. package/esm2020/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.mjs +18 -0
  24. package/esm2020/lib/directives/scroll-observer-last-element/index.mjs +2 -0
  25. package/esm2020/lib/directives/scroll-observer-last-element/public-api.mjs +2 -0
  26. package/esm2020/lib/directives/scroll-observer-last-element/scroll-observer-last-element.directive.mjs +34 -0
  27. package/esm2020/lib/directives/seo/public-api.mjs +5 -0
  28. package/esm2020/lib/directives/seo/seo.directive.constants.mjs +3 -0
  29. package/esm2020/lib/directives/seo/seo.directive.mjs +166 -0
  30. package/esm2020/lib/directives/seo/seo.directive.types.mjs +2 -0
  31. package/esm2020/lib/directives/seo/seo.directive.utils.mjs +7 -0
  32. package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.pipe.mjs +15 -0
  33. package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.types.mjs +2 -0
  34. package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.util.mjs +34 -0
  35. package/esm2020/lib/pipes/normalize-game-result-type/public-api.mjs +4 -0
  36. package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.pipe.mjs +15 -0
  37. package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.types.mjs +2 -0
  38. package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.util.mjs +47 -0
  39. package/esm2020/lib/pipes/normalize-match-participants/public-api.mjs +4 -0
  40. package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.pipe.mjs +15 -0
  41. package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.types.mjs +2 -0
  42. package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.util.mjs +126 -0
  43. package/esm2020/lib/pipes/normalize-match-score/public-api.mjs +4 -0
  44. package/esm2020/lib/pipes/normalize-match-state/index.mjs +2 -0
  45. package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.constants.mjs +2 -0
  46. package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.pipe.mjs +15 -0
  47. package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.util.mjs +19 -0
  48. package/esm2020/lib/pipes/normalize-match-state/public-api.mjs +4 -0
  49. package/esm2020/lib/pipes/normalize-match-type/normalize-match-type.pipe.mjs +15 -0
  50. package/esm2020/lib/pipes/normalize-match-type/normalize-match-type.util.mjs +38 -0
  51. package/esm2020/lib/pipes/normalize-match-type/public-api.mjs +3 -0
  52. package/esm2020/lib/pipes/public-api.mjs +6 -1
  53. package/esm2020/lib/pipes/to-array/to-array.pipe.mjs +3 -3
  54. package/esm2020/lib/public-api.mjs +2 -1
  55. package/esm2020/lib/services/click-observer.service.mjs +73 -0
  56. package/esm2020/lib/services/content-observer.service.mjs +6 -6
  57. package/esm2020/lib/services/destroy.service.mjs +19 -0
  58. package/esm2020/lib/services/focus-visible.service.mjs +7 -7
  59. package/esm2020/lib/services/public-api.mjs +7 -4
  60. package/esm2020/lib/services/resize-observer.service.mjs +6 -6
  61. package/esm2020/lib/services/router-state.service.mjs +115 -0
  62. package/esm2020/lib/services/viewport.service.mjs +16 -16
  63. package/esm2020/lib/types/angular.types.mjs +36 -2
  64. package/esm2020/lib/types/i18n.types.mjs +2 -0
  65. package/esm2020/lib/types/public-api.mjs +3 -2
  66. package/esm2020/lib/utils/clone.util.mjs +78 -0
  67. package/esm2020/lib/utils/cookie.util.mjs +48 -0
  68. package/esm2020/lib/utils/equal.util.mjs +118 -0
  69. package/esm2020/lib/utils/index.mjs +2 -0
  70. package/esm2020/lib/utils/public-api.mjs +7 -2
  71. package/esm2020/lib/utils/reactive-binding.util.mjs +111 -0
  72. package/esm2020/lib/utils/scrollable.utils.mjs +5 -0
  73. package/fesm2015/ethlete-core.mjs +1821 -289
  74. package/fesm2015/ethlete-core.mjs.map +1 -1
  75. package/fesm2020/ethlete-core.mjs +1818 -289
  76. package/fesm2020/ethlete-core.mjs.map +1 -1
  77. package/lib/components/public-api.d.ts +1 -0
  78. package/lib/components/structured-data/public-api.d.ts +1 -0
  79. package/lib/components/structured-data/structured-data.component.d.ts +11 -0
  80. package/lib/directives/click-outside/click-outside.directive.d.ts +12 -0
  81. package/lib/directives/click-outside/public-api.d.ts +1 -0
  82. package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.d.ts +2 -0
  83. package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.d.ts +27 -0
  84. package/lib/directives/cursor-drag-scroll/public-api.d.ts +1 -0
  85. package/lib/directives/let/let.directive.d.ts +1 -1
  86. package/lib/directives/observe-content/observe-content.directive.d.ts +2 -4
  87. package/lib/directives/observe-resize/observe-resize.directive.d.ts +3 -5
  88. package/lib/directives/observe-scroll-state/observe-scroll-state.constants.d.ts +3 -0
  89. package/lib/directives/observe-scroll-state/observe-scroll-state.directive.d.ts +31 -0
  90. package/lib/directives/observe-scroll-state/observe-scroll-state.types.d.ts +6 -0
  91. package/lib/directives/observe-scroll-state/public-api.d.ts +3 -0
  92. package/lib/directives/public-api.d.ts +9 -2
  93. package/lib/directives/repeat/repeat.directive.d.ts +3 -4
  94. package/lib/directives/scroll-observer-first-element/index.d.ts +1 -0
  95. package/lib/directives/scroll-observer-first-element/public-api.d.ts +1 -0
  96. package/lib/directives/scroll-observer-first-element/scroll-observer-first-element.directive.d.ts +10 -0
  97. package/lib/directives/scroll-observer-ignore-target/index.d.ts +1 -0
  98. package/lib/directives/scroll-observer-ignore-target/public-api.d.ts +1 -0
  99. package/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.d.ts +6 -0
  100. package/lib/directives/scroll-observer-last-element/index.d.ts +1 -0
  101. package/lib/directives/scroll-observer-last-element/public-api.d.ts +1 -0
  102. package/lib/directives/scroll-observer-last-element/scroll-observer-last-element.directive.d.ts +10 -0
  103. package/lib/directives/seo/public-api.d.ts +4 -0
  104. package/lib/directives/seo/seo.directive.constants.d.ts +3 -0
  105. package/lib/directives/seo/seo.directive.d.ts +21 -0
  106. package/lib/directives/seo/seo.directive.types.d.ts +51 -0
  107. package/lib/directives/seo/seo.directive.utils.d.ts +2 -0
  108. package/lib/pipes/normalize-game-result-type/normalize-game-result-type.pipe.d.ts +7 -0
  109. package/lib/pipes/normalize-game-result-type/normalize-game-result-type.types.d.ts +4 -0
  110. package/lib/pipes/normalize-game-result-type/normalize-game-result-type.util.d.ts +2 -0
  111. package/lib/pipes/normalize-game-result-type/public-api.d.ts +3 -0
  112. package/lib/pipes/normalize-match-participants/normalize-match-participants.pipe.d.ts +7 -0
  113. package/lib/pipes/normalize-match-participants/normalize-match-participants.types.d.ts +21 -0
  114. package/lib/pipes/normalize-match-participants/normalize-match-participants.util.d.ts +4 -0
  115. package/lib/pipes/normalize-match-participants/public-api.d.ts +3 -0
  116. package/lib/pipes/normalize-match-score/normalize-match-score.pipe.d.ts +7 -0
  117. package/lib/pipes/normalize-match-score/normalize-match-score.types.d.ts +12 -0
  118. package/lib/pipes/normalize-match-score/normalize-match-score.util.d.ts +27 -0
  119. package/lib/pipes/normalize-match-score/public-api.d.ts +3 -0
  120. package/lib/pipes/normalize-match-state/index.d.ts +1 -0
  121. package/lib/pipes/normalize-match-state/normalize-match-state.constants.d.ts +7 -0
  122. package/lib/pipes/normalize-match-state/normalize-match-state.pipe.d.ts +7 -0
  123. package/lib/pipes/normalize-match-state/normalize-match-state.util.d.ts +3 -0
  124. package/lib/pipes/normalize-match-state/public-api.d.ts +3 -0
  125. package/lib/pipes/normalize-match-type/normalize-match-type.pipe.d.ts +7 -0
  126. package/lib/pipes/normalize-match-type/normalize-match-type.util.d.ts +3 -0
  127. package/lib/pipes/normalize-match-type/public-api.d.ts +2 -0
  128. package/lib/pipes/public-api.d.ts +5 -0
  129. package/lib/public-api.d.ts +1 -0
  130. package/lib/services/click-observer.service.d.ts +21 -0
  131. package/lib/services/destroy.service.d.ts +9 -0
  132. package/lib/services/public-api.d.ts +6 -3
  133. package/lib/services/router-state.service.d.ts +40 -0
  134. package/lib/services/viewport.types.d.ts +1 -1
  135. package/lib/types/angular.types.d.ts +14 -1
  136. package/lib/types/i18n.types.d.ts +4 -0
  137. package/lib/types/public-api.d.ts +2 -1
  138. package/lib/types/viewport.types.d.ts +2 -2
  139. package/lib/utils/clone.util.d.ts +15 -0
  140. package/lib/utils/cookie.util.d.ts +5 -0
  141. package/lib/utils/equal.util.d.ts +27 -0
  142. package/lib/utils/index.d.ts +1 -0
  143. package/lib/utils/public-api.d.ts +6 -1
  144. package/lib/utils/reactive-binding.util.d.ts +19 -0
  145. package/lib/utils/scrollable.utils.d.ts +1 -0
  146. package/package.json +9 -5
@@ -1,12 +1,48 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Directive, Input, Injectable, Inject, Optional, inject, EventEmitter, Output, Pipe } from '@angular/core';
3
- import { coerceNumberProperty, coerceElement, coerceBooleanProperty } from '@angular/cdk/coercion';
4
- import { BehaviorSubject, combineLatest, map, shareReplay, Observable, Subject, debounceTime } from 'rxjs';
2
+ import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding, InjectionToken, Injectable, ElementRef, Inject, Optional, EventEmitter, Directive, Output, NgZone, Pipe, QueryList } from '@angular/core';
3
+ import { DomSanitizer, Meta, Title } from '@angular/platform-browser';
4
+ import { coerceElement, coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
5
+ import { fromEvent, Observable, Subject, takeUntil, distinctUntilChanged, BehaviorSubject, filter, map, combineLatest, pairwise, debounceTime, shareReplay, startWith, tap, take } from 'rxjs';
6
+ import { DOCUMENT } from '@angular/common';
7
+ import { Router, NavigationEnd } from '@angular/router';
5
8
  import { __decorate, __metadata } from 'tslib';
6
9
  import * as i1 from '@angular/cdk/layout';
7
- import { DOCUMENT } from '@angular/common';
8
10
  import { debounceTime as debounceTime$1 } from 'rxjs/operators';
9
11
 
12
+ class StructuredDataComponent {
13
+ constructor() {
14
+ this._sanitizer = inject(DomSanitizer);
15
+ }
16
+ set data(currentValue) {
17
+ this.jsonLD = this.getSafeHTML(currentValue);
18
+ }
19
+ getSafeHTML(value) {
20
+ const json = value ? JSON.stringify(value, null, 2).replace(/<\/script>/g, '<\\/script>') : '';
21
+ const html = `<script type="application/ld+json">${json}</script>`;
22
+ return this._sanitizer.bypassSecurityTrustHtml(html);
23
+ }
24
+ }
25
+ StructuredDataComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StructuredDataComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
26
+ StructuredDataComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: StructuredDataComponent, isStandalone: true, selector: "et-structured-data", inputs: { data: "data" }, host: { properties: { "innerHTML": "this.jsonLD" }, styleAttribute: "display: none" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StructuredDataComponent, decorators: [{
28
+ type: Component,
29
+ args: [{
30
+ selector: 'et-structured-data',
31
+ standalone: true,
32
+ template: '',
33
+ changeDetection: ChangeDetectionStrategy.OnPush,
34
+ encapsulation: ViewEncapsulation.None,
35
+ host: {
36
+ style: 'display: none',
37
+ },
38
+ }]
39
+ }], propDecorators: { data: [{
40
+ type: Input
41
+ }], jsonLD: [{
42
+ type: HostBinding,
43
+ args: ['innerHTML']
44
+ }] } });
45
+
10
46
  const VIEWPORT_CONFIG = new InjectionToken('ViewportConfig');
11
47
  /**
12
48
  * Default viewport config based on Tailwind CSS.
@@ -50,127 +86,774 @@ const Memo = (config = {}) => (_, __, descriptor) => {
50
86
  return descriptor;
51
87
  };
52
88
 
53
- class LetContext {
54
- constructor() {
55
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
56
- this.$implicit = null;
57
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
58
- this.etLet = null;
89
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
90
+ class ClickObserverFactory {
91
+ create() {
92
+ return fromEvent(document, 'click');
59
93
  }
60
94
  }
61
-
62
- class LetDirective {
63
- constructor(_viewContainer, templateRef) {
64
- this._viewContainer = _viewContainer;
65
- this._context = new LetContext();
66
- this._templateRef = null;
67
- this._viewRef = null;
68
- this._templateRef = templateRef;
95
+ ClickObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
96
+ ClickObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverFactory, providedIn: 'root' });
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverFactory, decorators: [{
98
+ type: Injectable,
99
+ args: [{ providedIn: 'root' }]
100
+ }] });
101
+ class ClickObserverService {
102
+ constructor(_clickObserverFactory) {
103
+ this._clickObserverFactory = _clickObserverFactory;
104
+ this._observedElements = new Map();
69
105
  }
70
- set etLet(value) {
71
- this._context.$implicit = this._context.etLet = value;
72
- this._updateView();
106
+ ngOnDestroy() {
107
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
73
108
  }
74
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
- static ngTemplateContextGuard(dir, ctx) {
76
- return true;
109
+ observe(elementOrRef) {
110
+ const element = coerceElement(elementOrRef);
111
+ return new Observable((observer) => {
112
+ const stream = this._observeElement(element);
113
+ const subscription = stream.subscribe(observer);
114
+ return () => {
115
+ subscription.unsubscribe();
116
+ this._unobserveElement(element);
117
+ };
118
+ });
77
119
  }
78
- _updateView() {
79
- if (!this._viewRef) {
80
- this._viewContainer.clear();
81
- if (this._templateRef) {
82
- this._viewRef = this._viewContainer.createEmbeddedView(this._templateRef, this._context);
120
+ _observeElement(element) {
121
+ if (!this._observedElements.has(element)) {
122
+ const stream = new Subject();
123
+ const observer = this._clickObserverFactory.create();
124
+ const sub = observer.subscribe((event) => stream.next(event));
125
+ this._observedElements.set(element, { observer: sub, stream, count: 1 });
126
+ }
127
+ else {
128
+ this._observedElements.get(element).count++;
129
+ }
130
+ return this._observedElements.get(element).stream;
131
+ }
132
+ _unobserveElement(element) {
133
+ if (this._observedElements.has(element)) {
134
+ this._observedElements.get(element).count--;
135
+ if (!this._observedElements.get(element).count) {
136
+ this._cleanupObserver(element);
137
+ }
138
+ }
139
+ }
140
+ _cleanupObserver(element) {
141
+ if (this._observedElements.has(element)) {
142
+ const { observer, stream } = this._observedElements.get(element);
143
+ if (observer) {
144
+ observer.unsubscribe();
83
145
  }
146
+ stream.complete();
147
+ this._observedElements.delete(element);
84
148
  }
85
149
  }
86
150
  }
87
- LetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: LetDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
88
- LetDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: LetDirective, isStandalone: true, selector: "[etLet]", inputs: { etLet: "etLet" }, ngImport: i0 });
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: LetDirective, decorators: [{
90
- type: Directive,
91
- args: [{
92
- selector: '[etLet]',
93
- standalone: true,
94
- }]
95
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { etLet: [{
96
- type: Input
97
- }] } });
151
+ ClickObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverService, deps: [{ token: ClickObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
152
+ ClickObserverServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverService, providedIn: 'root' });
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickObserverService, decorators: [{
154
+ type: Injectable,
155
+ args: [{ providedIn: 'root' }]
156
+ }], ctorParameters: function () { return [{ type: ClickObserverFactory }]; } });
98
157
 
99
- class RepeatDirective {
100
- constructor(_mainTemplateRef, _viewContainerRef) {
101
- this._mainTemplateRef = _mainTemplateRef;
102
- this._viewContainerRef = _viewContainerRef;
103
- this._repeatCount = 2;
158
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
159
+ class MutationObserverFactory {
160
+ create(callback) {
161
+ return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
104
162
  }
105
- get repeatCount() {
106
- return this._repeatCount;
163
+ }
164
+ MutationObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MutationObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
165
+ MutationObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MutationObserverFactory, providedIn: 'root' });
166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MutationObserverFactory, decorators: [{
167
+ type: Injectable,
168
+ args: [{ providedIn: 'root' }]
169
+ }] });
170
+ class ContentObserverService {
171
+ constructor(_mutationObserverFactory) {
172
+ this._mutationObserverFactory = _mutationObserverFactory;
173
+ this._observedElements = new Map();
107
174
  }
108
- set repeatCount(value) {
109
- this._repeatCount = coerceNumberProperty(value);
175
+ ngOnDestroy() {
176
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
110
177
  }
111
- ngOnInit() {
112
- this._render();
178
+ observe(elementOrRef) {
179
+ const element = coerceElement(elementOrRef);
180
+ return new Observable((observer) => {
181
+ const stream = this._observeElement(element);
182
+ const subscription = stream.subscribe(observer);
183
+ return () => {
184
+ subscription.unsubscribe();
185
+ this._unobserveElement(element);
186
+ };
187
+ });
113
188
  }
114
- _render() {
115
- for (let i = 0; i < this.repeatCount; i++) {
116
- this._viewContainerRef.createEmbeddedView(this._mainTemplateRef);
189
+ _observeElement(element) {
190
+ if (!this._observedElements.has(element)) {
191
+ const stream = new Subject();
192
+ const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
193
+ if (observer) {
194
+ observer.observe(element, {
195
+ characterData: true,
196
+ childList: true,
197
+ subtree: true,
198
+ });
199
+ }
200
+ this._observedElements.set(element, { observer, stream, count: 1 });
201
+ }
202
+ else {
203
+ this._observedElements.get(element).count++;
204
+ }
205
+ return this._observedElements.get(element).stream;
206
+ }
207
+ _unobserveElement(element) {
208
+ if (this._observedElements.has(element)) {
209
+ this._observedElements.get(element).count--;
210
+ if (!this._observedElements.get(element).count) {
211
+ this._cleanupObserver(element);
212
+ }
213
+ }
214
+ }
215
+ _cleanupObserver(element) {
216
+ if (this._observedElements.has(element)) {
217
+ const { observer, stream } = this._observedElements.get(element);
218
+ if (observer) {
219
+ observer.disconnect();
220
+ }
221
+ stream.complete();
222
+ this._observedElements.delete(element);
117
223
  }
118
224
  }
119
225
  }
120
- RepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: RepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
121
- RepeatDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: RepeatDirective, isStandalone: true, selector: "[etRepeat]", inputs: { repeatCount: ["etRepeat", "repeatCount"] }, ngImport: i0 });
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: RepeatDirective, decorators: [{
123
- type: Directive,
124
- args: [{
125
- selector: '[etRepeat]',
126
- standalone: true,
127
- }]
128
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { repeatCount: [{
129
- type: Input,
130
- args: ['etRepeat']
131
- }] } });
226
+ ContentObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ContentObserverService, deps: [{ token: MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
227
+ ContentObserverServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ContentObserverService, providedIn: 'root' });
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ContentObserverService, decorators: [{
229
+ type: Injectable,
230
+ args: [{ providedIn: 'root' }]
231
+ }], ctorParameters: function () { return [{ type: MutationObserverFactory }]; } });
132
232
 
133
- class ViewportService {
134
- constructor(_viewportConfig, _breakpointObserver) {
135
- this._breakpointObserver = _breakpointObserver;
136
- this._isXs$ = new BehaviorSubject(false);
137
- this._isSm$ = new BehaviorSubject(false);
138
- this._isMd$ = new BehaviorSubject(false);
139
- this._isLg$ = new BehaviorSubject(false);
140
- this._isXl$ = new BehaviorSubject(false);
141
- this._is2Xl$ = new BehaviorSubject(false);
142
- this.currentViewport$ = combineLatest([this.isXs$, this.isSm$, this.isMd$, this.isLg$, this.isXl$, this.is2Xl$]).pipe(map((val) => this.getCurrentViewport(val)), shareReplay());
143
- this._viewportConfig = _viewportConfig || DEFAULT_VIEWPORT_CONFIG;
144
- this._observeDefaultBreakpoints();
233
+ class DestroyService {
234
+ constructor() {
235
+ this._destroy$ = new Subject();
236
+ this.destroy$ = this._destroy$.asObservable();
145
237
  }
146
- get isXs$() {
147
- return this._isXs$.asObservable();
238
+ ngOnDestroy() {
239
+ this._destroy$.next(true);
240
+ this._destroy$.unsubscribe();
148
241
  }
149
- get isXs() {
150
- return this._isXs$.value;
242
+ }
243
+ DestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DestroyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
244
+ DestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DestroyService });
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DestroyService, decorators: [{
246
+ type: Injectable
247
+ }] });
248
+
249
+ class FocusVisibleService {
250
+ get isFocusVisible() {
251
+ return this._hadKeyboardEvent;
151
252
  }
152
- get isSm$() {
153
- return this._isSm$.asObservable();
253
+ constructor() {
254
+ this._document = inject(DOCUMENT);
255
+ this._hadKeyboardEvent = false;
256
+ this._document.addEventListener('keydown', this.onKeyDown.bind(this), true);
257
+ this._document.addEventListener('mousedown', this.onPointerDown.bind(this), true);
258
+ this._document.addEventListener('pointerdown', this.onPointerDown.bind(this), true);
259
+ this._document.addEventListener('touchstart', this.onPointerDown.bind(this), true);
154
260
  }
155
- get isSm() {
156
- return this._isSm$.value;
261
+ onKeyDown(e) {
262
+ if (e.metaKey || e.altKey || e.ctrlKey) {
263
+ return;
264
+ }
265
+ this._hadKeyboardEvent = true;
157
266
  }
158
- get isMd$() {
159
- return this._isMd$.asObservable();
267
+ onPointerDown() {
268
+ this._hadKeyboardEvent = false;
160
269
  }
161
- get isMd() {
162
- return this._isMd$.value;
270
+ }
271
+ FocusVisibleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: FocusVisibleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
272
+ FocusVisibleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: FocusVisibleService, providedIn: 'root' });
273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: FocusVisibleService, decorators: [{
274
+ type: Injectable,
275
+ args: [{
276
+ providedIn: 'root',
277
+ }]
278
+ }], ctorParameters: function () { return []; } });
279
+
280
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
281
+ class ResizeObserverFactory {
282
+ create(callback) {
283
+ return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
163
284
  }
164
- get isLg$() {
165
- return this._isLg$.asObservable();
285
+ }
286
+ ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
287
+ ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverFactory, decorators: [{
289
+ type: Injectable,
290
+ args: [{ providedIn: 'root' }]
291
+ }] });
292
+ class ResizeObserverService {
293
+ constructor(_mutationObserverFactory) {
294
+ this._mutationObserverFactory = _mutationObserverFactory;
295
+ this._observedElements = new Map();
166
296
  }
167
- get isLg() {
168
- return this._isLg$.value;
297
+ ngOnDestroy() {
298
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
169
299
  }
170
- get isXl$() {
171
- return this._isXl$.asObservable();
300
+ observe(elementOrRef) {
301
+ const element = coerceElement(elementOrRef);
302
+ return new Observable((observer) => {
303
+ const stream = this._observeElement(element);
304
+ const subscription = stream.subscribe(observer);
305
+ return () => {
306
+ subscription.unsubscribe();
307
+ this._unobserveElement(element);
308
+ };
309
+ });
172
310
  }
173
- get isXl() {
311
+ _observeElement(element) {
312
+ if (!this._observedElements.has(element)) {
313
+ const stream = new Subject();
314
+ const observer = this._mutationObserverFactory.create((resizes) => stream.next(resizes));
315
+ if (observer) {
316
+ observer.observe(element);
317
+ }
318
+ this._observedElements.set(element, { observer, stream, count: 1 });
319
+ }
320
+ else {
321
+ this._observedElements.get(element).count++;
322
+ }
323
+ return this._observedElements.get(element).stream;
324
+ }
325
+ _unobserveElement(element) {
326
+ if (this._observedElements.has(element)) {
327
+ this._observedElements.get(element).count--;
328
+ if (!this._observedElements.get(element).count) {
329
+ this._cleanupObserver(element);
330
+ }
331
+ }
332
+ }
333
+ _cleanupObserver(element) {
334
+ if (this._observedElements.has(element)) {
335
+ const { observer, stream } = this._observedElements.get(element);
336
+ if (observer) {
337
+ observer.disconnect();
338
+ }
339
+ stream.complete();
340
+ this._observedElements.delete(element);
341
+ }
342
+ }
343
+ }
344
+ ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
345
+ ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ResizeObserverService, decorators: [{
347
+ type: Injectable,
348
+ args: [{ providedIn: 'root' }]
349
+ }], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
350
+
351
+ const clamp = (value, min = 0, max = 100) => {
352
+ return Math.max(min, Math.min(max, value));
353
+ };
354
+
355
+ /* eslint-disable @typescript-eslint/no-explicit-any */
356
+ /* eslint-disable no-var */
357
+ /**
358
+ * Stolen from klona to avoid adding a dependency
359
+ * https://github.com/lukeed/klona
360
+ *
361
+ * MIT License
362
+ *
363
+ * Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
364
+ *
365
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
366
+ *
367
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
368
+ *
369
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
370
+ */
371
+ const set = (obj, key, val) => {
372
+ if (typeof val.value === 'object')
373
+ val.value = clone(val.value);
374
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
375
+ Object.defineProperty(obj, key, val);
376
+ }
377
+ else
378
+ obj[key] = val.value;
379
+ };
380
+ const clone = (original) => {
381
+ if (typeof original !== 'object')
382
+ return original;
383
+ var _og = original;
384
+ var i = 0, k, list, tmp, str = Object.prototype.toString.call(_og);
385
+ if (str === '[object Object]') {
386
+ tmp = Object.create(_og.__proto__ || null);
387
+ }
388
+ else if (str === '[object Array]') {
389
+ tmp = Array(_og.length);
390
+ }
391
+ else if (str === '[object Set]') {
392
+ tmp = new Set();
393
+ _og.forEach(function (val) {
394
+ tmp.add(clone(val));
395
+ });
396
+ }
397
+ else if (str === '[object Map]') {
398
+ tmp = new Map();
399
+ _og.forEach(function (val, key) {
400
+ tmp.set(clone(key), clone(val));
401
+ });
402
+ }
403
+ else if (str === '[object Date]') {
404
+ tmp = new Date(+_og);
405
+ }
406
+ else if (str === '[object RegExp]') {
407
+ tmp = new RegExp(_og.source, _og.flags);
408
+ }
409
+ else if (str === '[object DataView]') {
410
+ tmp = new _og.constructor(clone(_og.buffer));
411
+ }
412
+ else if (str === '[object ArrayBuffer]') {
413
+ tmp = _og.slice(0);
414
+ }
415
+ else if (str.slice(-6) === 'Array]') {
416
+ // ArrayBuffer.isView(x)
417
+ // ~> `new` bcuz `Buffer.slice` => ref
418
+ tmp = new _og.constructor(_og);
419
+ }
420
+ if (tmp) {
421
+ for (list = Object.getOwnPropertySymbols(_og); i < list.length; i++) {
422
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(_og, list[i]));
423
+ }
424
+ for (i = 0, list = Object.getOwnPropertyNames(_og); i < list.length; i++) {
425
+ if (Object.hasOwnProperty.call(tmp, (k = list[i])) && tmp[k] === _og[k])
426
+ continue;
427
+ set(tmp, k, Object.getOwnPropertyDescriptor(_og, k));
428
+ }
429
+ }
430
+ return tmp || _og;
431
+ };
432
+
433
+ const hasCookie = (name) => {
434
+ if (typeof document === 'undefined') {
435
+ return false;
436
+ }
437
+ return document.cookie.split(';').some((c) => {
438
+ return c.trim().startsWith(name + '=');
439
+ });
440
+ };
441
+ const getCookie = (name) => {
442
+ var _a;
443
+ if (typeof document === 'undefined') {
444
+ return null;
445
+ }
446
+ // From https://stackoverflow.com/questions/10730362/get-cookie-by-name
447
+ return (_a = ('; ' + document.cookie).split(`; ${name}=`).pop()) === null || _a === void 0 ? void 0 : _a.split(';')[0];
448
+ };
449
+ const setCookie = (name, data, expiresInDays = 30, domain = getDomain()) => {
450
+ if (typeof document === 'undefined') {
451
+ return;
452
+ }
453
+ const date = new Date();
454
+ date.setTime(date.getTime() + expiresInDays * 24 * 60 * 60 * 1000);
455
+ document.cookie = `${name}=${data}; path=/; expires=${date.toUTCString()}; domain=${domain}; SameSite=Lax;`;
456
+ };
457
+ const deleteCookie = (name, path, domain = getDomain()) => {
458
+ if (hasCookie(name)) {
459
+ document.cookie =
460
+ name +
461
+ '=' +
462
+ (path ? ';path=' + path : '') +
463
+ (domain ? ';domain=' + domain : '') +
464
+ ';expires=Thu, 01 Jan 1970 00:00:01 GMT';
465
+ }
466
+ };
467
+ const getDomain = () => {
468
+ if (typeof navigator === 'undefined') {
469
+ return null;
470
+ }
471
+ const hostname = window.location.hostname;
472
+ if (hostname.includes('localhost')) {
473
+ return 'localhost';
474
+ }
475
+ const splitHost = hostname.split('.');
476
+ if (splitHost.length > 2) {
477
+ return `${splitHost[splitHost.length - 2]}.${splitHost[splitHost.length - 1]}`;
478
+ }
479
+ return hostname;
480
+ };
481
+
482
+ /* eslint-disable @typescript-eslint/no-explicit-any */
483
+ /* eslint-disable no-var */
484
+ /**
485
+ * Stolen from dequal to avoid adding a dependency
486
+ * https://github.com/lukeed/dequal
487
+ *
488
+ * The MIT License (MIT)
489
+ *
490
+ * Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
491
+ *
492
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
493
+ * of this software and associated documentation files (the "Software"), to deal
494
+ * in the Software without restriction, including without limitation the rights
495
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
496
+ * copies of the Software, and to permit persons to whom the Software is
497
+ * furnished to do so, subject to the following conditions:
498
+ *
499
+ * The above copyright notice and this permission notice shall be included in
500
+ * all copies or substantial portions of the Software.
501
+ *
502
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
503
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
504
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
505
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
506
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
507
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
508
+ * THE SOFTWARE.
509
+ */
510
+ const has = Object.prototype.hasOwnProperty;
511
+ function find(iter, tar, key) {
512
+ for (key of iter.keys()) {
513
+ if (equal(key, tar))
514
+ return key;
515
+ }
516
+ }
517
+ const equal = (foo, bar) => {
518
+ var ctor, len, tmp;
519
+ if (foo === bar)
520
+ return true;
521
+ if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
522
+ if (ctor === Date)
523
+ return foo.getTime() === bar.getTime();
524
+ if (ctor === RegExp)
525
+ return foo.toString() === bar.toString();
526
+ if (ctor === Array) {
527
+ if ((len = foo.length) === bar.length) {
528
+ while (len-- && equal(foo[len], bar[len]))
529
+ ;
530
+ }
531
+ return len === -1;
532
+ }
533
+ if (ctor === Set) {
534
+ if (foo.size !== bar.size) {
535
+ return false;
536
+ }
537
+ for (len of foo) {
538
+ tmp = len;
539
+ if (tmp && typeof tmp === 'object') {
540
+ tmp = find(bar, tmp);
541
+ if (!tmp)
542
+ return false;
543
+ }
544
+ if (!bar.has(tmp))
545
+ return false;
546
+ }
547
+ return true;
548
+ }
549
+ if (ctor === Map) {
550
+ if (foo.size !== bar.size) {
551
+ return false;
552
+ }
553
+ for (len of foo) {
554
+ tmp = len[0];
555
+ if (tmp && typeof tmp === 'object') {
556
+ tmp = find(bar, tmp);
557
+ if (!tmp)
558
+ return false;
559
+ }
560
+ if (!equal(len[1], bar.get(tmp))) {
561
+ return false;
562
+ }
563
+ }
564
+ return true;
565
+ }
566
+ if (ctor === ArrayBuffer) {
567
+ foo = new Uint8Array(foo);
568
+ bar = new Uint8Array(bar);
569
+ }
570
+ else if (ctor === DataView) {
571
+ if ((len = foo.byteLength) === bar.byteLength) {
572
+ while (len-- && foo.getInt8(len) === bar.getInt8(len))
573
+ ;
574
+ }
575
+ return len === -1;
576
+ }
577
+ if (ArrayBuffer.isView(foo)) {
578
+ if ((len = foo.byteLength) === bar.byteLength) {
579
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
580
+ //@ts-ignore
581
+ while (len-- && foo[len] === bar[len])
582
+ ;
583
+ }
584
+ return len === -1;
585
+ }
586
+ if (!ctor || typeof foo === 'object') {
587
+ len = 0;
588
+ for (ctor in foo) {
589
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor))
590
+ return false;
591
+ if (!(ctor in bar) || !equal(foo[ctor], bar[ctor]))
592
+ return false;
593
+ }
594
+ return Object.keys(bar).length === len;
595
+ }
596
+ }
597
+ return foo !== foo && bar !== bar;
598
+ };
599
+
600
+ const isAttributeRenderBinding = (value) => typeof value === 'boolean';
601
+ const isAttributeValueBinding = (value) => typeof value === 'object';
602
+ const createReactiveBindings = (...values) => {
603
+ const rootElementRef = inject(ElementRef);
604
+ const destroy$ = inject(DestroyService, { host: true }).destroy$;
605
+ const subscriptions = [];
606
+ const pushedAttributes = [];
607
+ const defaults = {};
608
+ const push = (value) => {
609
+ const { attribute, observable, elementRef } = value;
610
+ const elRef = elementRef || rootElementRef;
611
+ const attributes = Array.isArray(attribute) ? attribute : [attribute];
612
+ pushedAttributes.push(attributes);
613
+ for (const attribute of attributes) {
614
+ if (!defaults[attribute]) {
615
+ defaults[attribute] = elRef.nativeElement.getAttribute(attribute) || undefined;
616
+ }
617
+ }
618
+ const subscription = observable
619
+ .pipe(takeUntil(destroy$), distinctUntilChanged((a, b) => {
620
+ if (isAttributeRenderBinding(a) && isAttributeRenderBinding(b)) {
621
+ return a === b;
622
+ }
623
+ else if (isAttributeValueBinding(a) && isAttributeValueBinding(b)) {
624
+ return a.render === b.render && a.value === b.value;
625
+ }
626
+ return false;
627
+ }))
628
+ .subscribe((value) => {
629
+ const currentAttributes = pushedAttributes.find((s) => s.some((current) => attributes.includes(current))) || [];
630
+ for (const attribute of currentAttributes) {
631
+ const isSingleClassMutation = attribute.startsWith('class.');
632
+ const isMultipleClassMutation = attribute === 'class';
633
+ const render = isAttributeRenderBinding(value) ? value : value.render;
634
+ if (isSingleClassMutation) {
635
+ const className = attribute.replace('class.', '');
636
+ if (!className) {
637
+ continue;
638
+ }
639
+ if (!render) {
640
+ elRef.nativeElement.classList.remove(className);
641
+ }
642
+ else {
643
+ elRef.nativeElement.classList.add(className);
644
+ }
645
+ }
646
+ else if (isMultipleClassMutation) {
647
+ const classes = isAttributeRenderBinding(value) ? '' : `${value.value}`;
648
+ if (!classes) {
649
+ continue;
650
+ }
651
+ if (!render) {
652
+ elRef.nativeElement.classList.remove(...classes.split(' '));
653
+ }
654
+ else {
655
+ elRef.nativeElement.classList.add(...classes.split(' '));
656
+ }
657
+ }
658
+ else {
659
+ const attributeValue = isAttributeRenderBinding(value) ? true : `${value.value}`;
660
+ if (!attribute) {
661
+ continue;
662
+ }
663
+ if (!render) {
664
+ elRef.nativeElement.removeAttribute(attribute);
665
+ }
666
+ else {
667
+ elRef.nativeElement.setAttribute(attribute, `${attributeValue}`);
668
+ }
669
+ }
670
+ }
671
+ });
672
+ subscriptions.push({ attributes, subscription });
673
+ };
674
+ const remove = (...attributes) => {
675
+ for (const attribute of attributes) {
676
+ const sub = subscriptions.find((s) => s.attributes.includes(attribute));
677
+ const attributeStack = pushedAttributes.find((a) => a.includes(attribute));
678
+ if (sub) {
679
+ sub.attributes = sub.attributes.filter((a) => a !== attribute);
680
+ attributeStack === null || attributeStack === void 0 ? void 0 : attributeStack.splice(attributeStack.indexOf(attribute), 1);
681
+ if (sub.attributes.length === 0) {
682
+ sub.subscription.unsubscribe();
683
+ subscriptions.splice(subscriptions.indexOf(sub), 1);
684
+ }
685
+ }
686
+ }
687
+ };
688
+ const reset = () => {
689
+ for (const attribute in defaults) {
690
+ if (defaults[attribute] === undefined) {
691
+ rootElementRef.nativeElement.removeAttribute(attribute);
692
+ }
693
+ else {
694
+ rootElementRef.nativeElement.setAttribute(attribute, defaults[attribute]);
695
+ }
696
+ }
697
+ };
698
+ for (const value of values) {
699
+ push(value);
700
+ }
701
+ return {
702
+ push,
703
+ remove,
704
+ reset,
705
+ };
706
+ };
707
+
708
+ const elementCanScroll = (element) => {
709
+ const { scrollHeight, clientHeight, scrollWidth, clientWidth } = element;
710
+ return scrollHeight > clientHeight || scrollWidth > clientWidth;
711
+ };
712
+
713
+ const provideViewportConfig = (viewportConfig) => {
714
+ return { provide: VIEWPORT_CONFIG, useValue: viewportConfig };
715
+ };
716
+
717
+ const routerDisableScrollTop = (config = {}) => {
718
+ if (!config.asReturnRoute) {
719
+ return {
720
+ disableScrollTop: true,
721
+ };
722
+ }
723
+ return {
724
+ disableScrollTopAsReturnRoute: true,
725
+ };
726
+ };
727
+ class RouterStateService {
728
+ get route$() {
729
+ return this._route$.asObservable();
730
+ }
731
+ get state$() {
732
+ return this._state$.asObservable();
733
+ }
734
+ constructor() {
735
+ this._isScrollTopOnNavigationEnabled = false;
736
+ this._router = inject(Router);
737
+ this._route$ = new BehaviorSubject('/');
738
+ this._state$ = new BehaviorSubject({
739
+ title: null,
740
+ fragment: null,
741
+ data: {},
742
+ pathParams: {},
743
+ queryParams: {},
744
+ });
745
+ this._router.events
746
+ .pipe(filter((event) => event instanceof NavigationEnd), distinctUntilChanged((a, b) => a.url === b.url), map((event) => {
747
+ const { url } = event;
748
+ const urlWithoutQueryParams = url.split('?')[0];
749
+ const withoutFragment = urlWithoutQueryParams.split('#')[0];
750
+ return withoutFragment;
751
+ }))
752
+ .subscribe(this._route$);
753
+ this._route$
754
+ .pipe(map(() => {
755
+ let route = this._router.routerState.snapshot.root;
756
+ while (route.firstChild) {
757
+ route = route.firstChild;
758
+ }
759
+ const { data, params, queryParams, title, fragment } = route;
760
+ return {
761
+ data,
762
+ pathParams: params,
763
+ queryParams,
764
+ title: title !== null && title !== void 0 ? title : null,
765
+ fragment,
766
+ };
767
+ }))
768
+ .subscribe(this._state$);
769
+ }
770
+ enableScrollEnhancements(config = {}) {
771
+ if (this._isScrollTopOnNavigationEnabled) {
772
+ return;
773
+ }
774
+ this._isScrollTopOnNavigationEnabled = true;
775
+ combineLatest([this._state$.pipe(pairwise()), this._route$.pipe(pairwise())])
776
+ .pipe(debounceTime(1))
777
+ .subscribe(([[prevState, currState], [prevRoute, currRoute]]) => {
778
+ var _a, _b, _c, _d, _e, _f;
779
+ const sameUrlNavigation = prevRoute === currRoute && equal(prevState.pathParams, currState.pathParams);
780
+ const didFragmentChange = prevState.fragment !== currState.fragment;
781
+ if (sameUrlNavigation) {
782
+ const allQueryParams = [
783
+ ...new Set(Object.keys(prevState.queryParams).concat(Object.keys(currState.queryParams))),
784
+ ];
785
+ const changedQueryParams = allQueryParams.filter((key) => currState.queryParams[key] !== prevState.queryParams[key]);
786
+ if (!((_a = config.queryParamTriggerList) === null || _a === void 0 ? void 0 : _a.length) && !didFragmentChange) {
787
+ return;
788
+ }
789
+ const caseQueryParams = changedQueryParams.some((key) => { var _a; return (_a = config.queryParamTriggerList) === null || _a === void 0 ? void 0 : _a.includes(key); });
790
+ const caseFragment = didFragmentChange && ((_b = config.fragment) === null || _b === void 0 ? void 0 : _b.enabled);
791
+ if (caseQueryParams) {
792
+ ((_c = config.scrollElement) !== null && _c !== void 0 ? _c : document.documentElement).scrollTop = 0;
793
+ }
794
+ else if (caseFragment) {
795
+ const fragmentElement = document.getElementById((_d = currState.fragment) !== null && _d !== void 0 ? _d : '');
796
+ if (fragmentElement) {
797
+ fragmentElement.scrollIntoView({ behavior: ((_e = config.fragment) === null || _e === void 0 ? void 0 : _e.smooth) ? 'smooth' : 'auto' });
798
+ }
799
+ }
800
+ }
801
+ else {
802
+ if (!(currState.data['disableScrollTopAsReturnRoute'] && prevState.data['disableScrollTop']) &&
803
+ !currState.data['disableScrollTop']) {
804
+ ((_f = config.scrollElement) !== null && _f !== void 0 ? _f : document.documentElement).scrollTop = 0;
805
+ }
806
+ }
807
+ });
808
+ }
809
+ selectQueryParam(key) {
810
+ return this._state$.pipe(map((state) => state.queryParams[key]));
811
+ }
812
+ selectPathParam(key) {
813
+ return this._state$.pipe(map((state) => state.pathParams[key]));
814
+ }
815
+ selectData(key) {
816
+ return this._state$.pipe(map((state) => state.data[key]));
817
+ }
818
+ }
819
+ RouterStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: RouterStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
820
+ RouterStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: RouterStateService, providedIn: 'root' });
821
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: RouterStateService, decorators: [{
822
+ type: Injectable,
823
+ args: [{
824
+ providedIn: 'root',
825
+ }]
826
+ }], ctorParameters: function () { return []; } });
827
+
828
+ class ViewportService {
829
+ get isXs$() {
830
+ return this._isXs$.asObservable();
831
+ }
832
+ get isXs() {
833
+ return this._isXs$.value;
834
+ }
835
+ get isSm$() {
836
+ return this._isSm$.asObservable();
837
+ }
838
+ get isSm() {
839
+ return this._isSm$.value;
840
+ }
841
+ get isMd$() {
842
+ return this._isMd$.asObservable();
843
+ }
844
+ get isMd() {
845
+ return this._isMd$.value;
846
+ }
847
+ get isLg$() {
848
+ return this._isLg$.asObservable();
849
+ }
850
+ get isLg() {
851
+ return this._isLg$.value;
852
+ }
853
+ get isXl$() {
854
+ return this._isXl$.asObservable();
855
+ }
856
+ get isXl() {
174
857
  return this._isXl$.value;
175
858
  }
176
859
  get is2Xl$() {
@@ -182,6 +865,18 @@ class ViewportService {
182
865
  get currentViewport() {
183
866
  return this.getCurrentViewport([this.isXs, this.isSm, this.isMd, this.isLg, this.isXl, this.is2Xl]);
184
867
  }
868
+ constructor(_viewportConfig, _breakpointObserver) {
869
+ this._breakpointObserver = _breakpointObserver;
870
+ this._isXs$ = new BehaviorSubject(false);
871
+ this._isSm$ = new BehaviorSubject(false);
872
+ this._isMd$ = new BehaviorSubject(false);
873
+ this._isLg$ = new BehaviorSubject(false);
874
+ this._isXl$ = new BehaviorSubject(false);
875
+ this._is2Xl$ = new BehaviorSubject(false);
876
+ this.currentViewport$ = combineLatest([this.isXs$, this.isSm$, this.isMd$, this.isLg$, this.isXl$, this.is2Xl$]).pipe(map((val) => this.getCurrentViewport(val)), shareReplay());
877
+ this._viewportConfig = _viewportConfig || DEFAULT_VIEWPORT_CONFIG;
878
+ this._observeDefaultBreakpoints();
879
+ }
185
880
  observe(options) {
186
881
  const mediaQuery = this._buildMediaQuery(options);
187
882
  return this._breakpointObserver.observe(mediaQuery).pipe(map((x) => x.matches), shareReplay());
@@ -260,8 +955,8 @@ class ViewportService {
260
955
  return 'xs';
261
956
  }
262
957
  }
263
- ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, deps: [{ token: VIEWPORT_CONFIG, optional: true }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
264
- ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, providedIn: 'root' });
958
+ ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewportService, deps: [{ token: VIEWPORT_CONFIG, optional: true }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
959
+ ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewportService, providedIn: 'root' });
265
960
  __decorate([
266
961
  Memo(),
267
962
  __metadata("design:type", Function),
@@ -279,7 +974,7 @@ __decorate([
279
974
  __metadata("design:paramtypes", [Object]),
280
975
  __metadata("design:returntype", void 0)
281
976
  ], ViewportService.prototype, "_buildMediaQuery", null);
282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, decorators: [{
977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewportService, decorators: [{
283
978
  type: Injectable,
284
979
  args: [{
285
980
  providedIn: 'root',
@@ -293,188 +988,238 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
293
988
  }] }, { type: i1.BreakpointObserver }];
294
989
  }, propDecorators: { _getViewportSize: [], _buildMediaQuery: [] } });
295
990
 
296
- class FocusVisibleService {
991
+ class ClickOutsideDirective {
297
992
  constructor() {
298
- this._document = inject(DOCUMENT);
299
- this._hadKeyboardEvent = false;
300
- this._document.addEventListener('keydown', this.onKeyDown.bind(this), true);
301
- this._document.addEventListener('mousedown', this.onPointerDown.bind(this), true);
302
- this._document.addEventListener('pointerdown', this.onPointerDown.bind(this), true);
303
- this._document.addEventListener('touchstart', this.onPointerDown.bind(this), true);
304
- }
305
- get isFocusVisible() {
306
- return this._hadKeyboardEvent;
993
+ this._elementRef = inject(ElementRef);
994
+ this._clickObserverService = inject(ClickObserverService);
995
+ this._subscription = null;
996
+ this.etClickOutside = new EventEmitter();
307
997
  }
308
- onKeyDown(e) {
309
- if (e.metaKey || e.altKey || e.ctrlKey) {
310
- return;
311
- }
312
- this._hadKeyboardEvent = true;
998
+ ngOnInit() {
999
+ setTimeout(() => {
1000
+ this._subscription = this._clickObserverService.observe(this._elementRef.nativeElement).subscribe((event) => {
1001
+ const activeElement = event.target;
1002
+ const isInside = this._elementRef.nativeElement.contains(activeElement);
1003
+ if (!isInside) {
1004
+ this.etClickOutside.emit(event);
1005
+ }
1006
+ });
1007
+ });
313
1008
  }
314
- onPointerDown() {
315
- this._hadKeyboardEvent = false;
1009
+ ngOnDestroy() {
1010
+ var _a;
1011
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
316
1012
  }
317
1013
  }
318
- FocusVisibleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
319
- FocusVisibleServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, providedIn: 'root' });
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, decorators: [{
321
- type: Injectable,
1014
+ ClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1015
+ ClickOutsideDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ClickOutsideDirective, isStandalone: true, selector: "[etClickOutside]", outputs: { etClickOutside: "etClickOutside" }, ngImport: i0 });
1016
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ClickOutsideDirective, decorators: [{
1017
+ type: Directive,
322
1018
  args: [{
323
- providedIn: 'root',
1019
+ selector: '[etClickOutside]',
1020
+ standalone: true,
324
1021
  }]
325
- }], ctorParameters: function () { return []; } });
1022
+ }], propDecorators: { etClickOutside: [{
1023
+ type: Output
1024
+ }] } });
326
1025
 
327
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
328
- class ResizeObserverFactory {
329
- create(callback) {
330
- return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
331
- }
332
- }
333
- ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
334
- ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, decorators: [{
336
- type: Injectable,
337
- args: [{ providedIn: 'root' }]
338
- }] });
339
- class ResizeObserverService {
340
- constructor(_mutationObserverFactory) {
341
- this._mutationObserverFactory = _mutationObserverFactory;
342
- this._observedElements = new Map();
343
- }
344
- ngOnDestroy() {
345
- this._observedElements.forEach((_, element) => this._cleanupObserver(element));
346
- }
347
- observe(elementOrRef) {
348
- const element = coerceElement(elementOrRef);
349
- return new Observable((observer) => {
350
- const stream = this._observeElement(element);
351
- const subscription = stream.subscribe(observer);
352
- return () => {
353
- subscription.unsubscribe();
354
- this._unobserveElement(element);
355
- };
356
- });
1026
+ const CURSOR_DRAG_SCROLLING_CLASS = 'et-cursor-drag-scroll--scrolling';
1027
+ const CURSOR_DRAG_SCROLLING_PREPARED_CLASS = 'et-cursor-drag-scroll--prepared';
1028
+
1029
+ class CursorDragScrollDirective {
1030
+ constructor() {
1031
+ this._subscriptions = [];
1032
+ this._destroy$ = inject(DestroyService, { host: true }).destroy$;
1033
+ this._elementRef = inject(ElementRef);
1034
+ this._contentObserverService = inject(ContentObserverService);
1035
+ this._resizeObserverService = inject(ResizeObserverService);
1036
+ this._bufferUntilScroll = 5;
1037
+ this._mouseUp$ = new Subject();
1038
+ this._isScrolling = false;
1039
+ this._canScroll = false;
1040
+ this._currentScrollState = {
1041
+ top: 0,
1042
+ left: 0,
1043
+ x: 0,
1044
+ y: 0,
1045
+ };
1046
+ this._enabled = false;
1047
+ }
1048
+ get enabled() {
1049
+ return this._enabled;
1050
+ }
1051
+ set enabled(value) {
1052
+ this._enabled = coerceBooleanProperty(value);
1053
+ if (this._enabled) {
1054
+ this._enableCursorDragScroll();
1055
+ }
1056
+ else {
1057
+ this._disableCursorDragScroll();
1058
+ }
357
1059
  }
358
- _observeElement(element) {
359
- if (!this._observedElements.has(element)) {
360
- const stream = new Subject();
361
- const observer = this._mutationObserverFactory.create((resizes) => stream.next(resizes));
362
- if (observer) {
363
- observer.observe(element);
364
- }
365
- this._observedElements.set(element, { observer, stream, count: 1 });
1060
+ ngAfterViewInit() {
1061
+ if (this.enabled) {
1062
+ this._enableCursorDragScroll();
366
1063
  }
367
1064
  else {
368
- this._observedElements.get(element).count++;
1065
+ this._disableCursorDragScroll();
369
1066
  }
370
- return this._observedElements.get(element).stream;
371
1067
  }
372
- _unobserveElement(element) {
373
- if (this._observedElements.has(element)) {
374
- this._observedElements.get(element).count--;
375
- if (!this._observedElements.get(element).count) {
376
- this._cleanupObserver(element);
1068
+ _enableCursorDragScroll() {
1069
+ const contentResizeSub = combineLatest([
1070
+ this._contentObserverService.observe(this._elementRef.nativeElement).pipe(startWith(null)),
1071
+ this._resizeObserverService.observe(this._elementRef.nativeElement).pipe(startWith(null)),
1072
+ ])
1073
+ .pipe(debounceTime(25), tap(() => this._updateCanScrollState()), takeUntil(this._destroy$))
1074
+ .subscribe();
1075
+ const mousedownSub = fromEvent(this._elementRef.nativeElement, 'mousedown')
1076
+ .pipe(tap((e) => this._onMouseDown(e)), takeUntil(this._destroy$))
1077
+ .subscribe();
1078
+ this._subscriptions.push(contentResizeSub, mousedownSub);
1079
+ this._updateCanScrollState();
1080
+ }
1081
+ _disableCursorDragScroll() {
1082
+ this._subscriptions.forEach((sub) => sub.unsubscribe());
1083
+ this._subscriptions.length = 0;
1084
+ this._elementRef.nativeElement.style.cursor = 'default';
1085
+ }
1086
+ _onMouseDown(e) {
1087
+ var _a;
1088
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) || !this._canScroll) {
1089
+ return;
1090
+ }
1091
+ const element = this._elementRef.nativeElement;
1092
+ element.classList.add(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
1093
+ this._elementRef.nativeElement.style.scrollSnapType = 'none';
1094
+ this._elementRef.nativeElement.style.scrollBehavior = 'unset';
1095
+ this._currentScrollState = {
1096
+ left: this._elementRef.nativeElement.scrollLeft,
1097
+ top: this._elementRef.nativeElement.scrollTop,
1098
+ x: e.clientX,
1099
+ y: e.clientY,
1100
+ };
1101
+ fromEvent(document, 'mousemove')
1102
+ .pipe(tap((e) => this._mouseMoveHandler(e)), takeUntil(this._mouseUp$), takeUntil(this._destroy$))
1103
+ .subscribe();
1104
+ fromEvent(document, 'mouseup')
1105
+ .pipe(tap(() => this._mouseUpHandler()), take(1), takeUntil(this._destroy$))
1106
+ .subscribe();
1107
+ }
1108
+ _mouseMoveHandler(e) {
1109
+ var _a;
1110
+ e.preventDefault();
1111
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
1112
+ return;
1113
+ }
1114
+ const dx = e.clientX - this._currentScrollState.x;
1115
+ const dy = e.clientY - this._currentScrollState.y;
1116
+ if (Math.abs(dx) > this._bufferUntilScroll || Math.abs(dy) > this._bufferUntilScroll) {
1117
+ const element = this._elementRef.nativeElement;
1118
+ if (!this._isScrolling) {
1119
+ this._isScrolling = true;
1120
+ element.style.cursor = 'grabbing';
1121
+ element.classList.add(CURSOR_DRAG_SCROLLING_CLASS);
1122
+ element.scroll({
1123
+ top: this._currentScrollState.top - dy,
1124
+ left: this._currentScrollState.left - dx,
1125
+ behavior: 'smooth',
1126
+ });
1127
+ }
1128
+ else {
1129
+ element.scrollTop = this._currentScrollState.top - dy;
1130
+ element.scrollLeft = this._currentScrollState.left - dx;
377
1131
  }
378
1132
  }
379
1133
  }
380
- _cleanupObserver(element) {
381
- if (this._observedElements.has(element)) {
382
- const { observer, stream } = this._observedElements.get(element);
383
- if (observer) {
384
- observer.disconnect();
385
- }
386
- stream.complete();
387
- this._observedElements.delete(element);
1134
+ _mouseUpHandler() {
1135
+ var _a;
1136
+ this._mouseUp$.next(true);
1137
+ this._isScrolling = false;
1138
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
1139
+ return;
1140
+ }
1141
+ this._elementRef.nativeElement.style.scrollSnapType = '';
1142
+ this._elementRef.nativeElement.style.scrollBehavior = '';
1143
+ this._elementRef.nativeElement.style.cursor = 'grab';
1144
+ this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_CLASS);
1145
+ this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
1146
+ }
1147
+ _updateCanScrollState() {
1148
+ this._canScroll = elementCanScroll(this._elementRef.nativeElement);
1149
+ if (this._canScroll) {
1150
+ this._elementRef.nativeElement.style.cursor = 'grab';
1151
+ }
1152
+ else {
1153
+ this._elementRef.nativeElement.style.cursor = 'default';
388
1154
  }
389
1155
  }
390
1156
  }
391
- ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
392
- ResizeObserverServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, decorators: [{
394
- type: Injectable,
395
- args: [{ providedIn: 'root' }]
396
- }], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
1157
+ CursorDragScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CursorDragScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1158
+ CursorDragScrollDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: CursorDragScrollDirective, isStandalone: true, selector: "[etCursorDragScroll]", inputs: { enabled: ["etCursorDragScroll", "enabled"] }, providers: [DestroyService], exportAs: ["etCursorDragScroll"], ngImport: i0 });
1159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CursorDragScrollDirective, decorators: [{
1160
+ type: Directive,
1161
+ args: [{
1162
+ selector: '[etCursorDragScroll]',
1163
+ exportAs: 'etCursorDragScroll',
1164
+ standalone: true,
1165
+ providers: [DestroyService],
1166
+ }]
1167
+ }], propDecorators: { enabled: [{
1168
+ type: Input,
1169
+ args: ['etCursorDragScroll']
1170
+ }] } });
397
1171
 
398
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
399
- class MutationObserverFactory {
400
- create(callback) {
401
- return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
1172
+ class LetContext {
1173
+ constructor() {
1174
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1175
+ this.$implicit = null;
1176
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1177
+ this.etLet = null;
402
1178
  }
403
1179
  }
404
- MutationObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
405
- MutationObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, providedIn: 'root' });
406
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, decorators: [{
407
- type: Injectable,
408
- args: [{ providedIn: 'root' }]
409
- }] });
410
- class ContentObserverService {
411
- constructor(_mutationObserverFactory) {
412
- this._mutationObserverFactory = _mutationObserverFactory;
413
- this._observedElements = new Map();
414
- }
415
- ngOnDestroy() {
416
- this._observedElements.forEach((_, element) => this._cleanupObserver(element));
417
- }
418
- observe(elementOrRef) {
419
- const element = coerceElement(elementOrRef);
420
- return new Observable((observer) => {
421
- const stream = this._observeElement(element);
422
- const subscription = stream.subscribe(observer);
423
- return () => {
424
- subscription.unsubscribe();
425
- this._unobserveElement(element);
426
- };
427
- });
1180
+
1181
+ class LetDirective {
1182
+ set etLet(value) {
1183
+ this._context.$implicit = this._context.etLet = value;
1184
+ this._updateView();
428
1185
  }
429
- _observeElement(element) {
430
- if (!this._observedElements.has(element)) {
431
- const stream = new Subject();
432
- const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
433
- if (observer) {
434
- observer.observe(element, {
435
- characterData: true,
436
- childList: true,
437
- subtree: true,
438
- });
439
- }
440
- this._observedElements.set(element, { observer, stream, count: 1 });
441
- }
442
- else {
443
- this._observedElements.get(element).count++;
444
- }
445
- return this._observedElements.get(element).stream;
1186
+ constructor(_viewContainer, templateRef) {
1187
+ this._viewContainer = _viewContainer;
1188
+ this._context = new LetContext();
1189
+ this._templateRef = null;
1190
+ this._viewRef = null;
1191
+ this._templateRef = templateRef;
446
1192
  }
447
- _unobserveElement(element) {
448
- if (this._observedElements.has(element)) {
449
- this._observedElements.get(element).count--;
450
- if (!this._observedElements.get(element).count) {
451
- this._cleanupObserver(element);
452
- }
453
- }
1193
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1194
+ static ngTemplateContextGuard(dir, ctx) {
1195
+ return true;
454
1196
  }
455
- _cleanupObserver(element) {
456
- if (this._observedElements.has(element)) {
457
- const { observer, stream } = this._observedElements.get(element);
458
- if (observer) {
459
- observer.disconnect();
1197
+ _updateView() {
1198
+ if (!this._viewRef) {
1199
+ this._viewContainer.clear();
1200
+ if (this._templateRef) {
1201
+ this._viewRef = this._viewContainer.createEmbeddedView(this._templateRef, this._context);
460
1202
  }
461
- stream.complete();
462
- this._observedElements.delete(element);
463
1203
  }
464
1204
  }
465
1205
  }
466
- ContentObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, deps: [{ token: MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
467
- ContentObserverServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, providedIn: 'root' });
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, decorators: [{
469
- type: Injectable,
470
- args: [{ providedIn: 'root' }]
471
- }], ctorParameters: function () { return [{ type: MutationObserverFactory }]; } });
1206
+ LetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LetDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1207
+ LetDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: LetDirective, isStandalone: true, selector: "[etLet]", inputs: { etLet: "etLet" }, ngImport: i0 });
1208
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LetDirective, decorators: [{
1209
+ type: Directive,
1210
+ args: [{
1211
+ selector: '[etLet]',
1212
+ standalone: true,
1213
+ }]
1214
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { etLet: [{
1215
+ type: Input
1216
+ }] } });
472
1217
 
473
- class ObserveResizeDirective {
474
- constructor(_contentObserver, _elementRef, _ngZone) {
475
- this._contentObserver = _contentObserver;
476
- this._elementRef = _elementRef;
477
- this._ngZone = _ngZone;
1218
+ class ObserveContentDirective {
1219
+ constructor() {
1220
+ this._contentObserver = inject(ContentObserverService);
1221
+ this._elementRef = inject(ElementRef);
1222
+ this._ngZone = inject(NgZone);
478
1223
  this.event = new EventEmitter();
479
1224
  this._disabled = false;
480
1225
  this._debounce = null;
@@ -506,7 +1251,7 @@ class ObserveResizeDirective {
506
1251
  this._unsubscribe();
507
1252
  const stream = this._contentObserver.observe(this._elementRef);
508
1253
  this._ngZone.runOutsideAngular(() => {
509
- this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
1254
+ this._currentSubscription = (this.debounce ? stream.pipe(debounceTime$1(this.debounce)) : stream).subscribe(this.event);
510
1255
  });
511
1256
  }
512
1257
  _unsubscribe() {
@@ -514,31 +1259,31 @@ class ObserveResizeDirective {
514
1259
  (_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
515
1260
  }
516
1261
  }
517
- ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveResizeDirective, deps: [{ token: ResizeObserverService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
518
- ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { event: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
519
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveResizeDirective, decorators: [{
1262
+ ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1263
+ ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { event: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
1264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveContentDirective, decorators: [{
520
1265
  type: Directive,
521
1266
  args: [{
522
- selector: '[etObserveResize]',
523
- exportAs: 'etObserveResize',
1267
+ selector: '[etObserveContent]',
1268
+ exportAs: 'etObserveContent',
524
1269
  standalone: true,
525
1270
  }]
526
- }], ctorParameters: function () { return [{ type: ResizeObserverService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { event: [{
1271
+ }], propDecorators: { event: [{
527
1272
  type: Output,
528
- args: ['etObserveResize']
1273
+ args: ['etObserveContent']
529
1274
  }], disabled: [{
530
1275
  type: Input,
531
- args: ['etObserveResizeDisabled']
1276
+ args: ['etObserveContentDisabled']
532
1277
  }], debounce: [{
533
1278
  type: Input,
534
- args: ['etObserveResizeDebounce']
1279
+ args: ['etObserveContentDebounce']
535
1280
  }] } });
536
1281
 
537
- class ObserveContentDirective {
538
- constructor(_contentObserver, _elementRef, _ngZone) {
539
- this._contentObserver = _contentObserver;
540
- this._elementRef = _elementRef;
541
- this._ngZone = _ngZone;
1282
+ class ObserveResizeDirective {
1283
+ constructor() {
1284
+ this._resizeObserver = inject(ResizeObserverService);
1285
+ this._elementRef = inject(ElementRef);
1286
+ this._ngZone = inject(NgZone);
542
1287
  this.event = new EventEmitter();
543
1288
  this._disabled = false;
544
1289
  this._debounce = null;
@@ -568,9 +1313,9 @@ class ObserveContentDirective {
568
1313
  }
569
1314
  _subscribe() {
570
1315
  this._unsubscribe();
571
- const stream = this._contentObserver.observe(this._elementRef);
1316
+ const stream = this._resizeObserver.observe(this._elementRef);
572
1317
  this._ngZone.runOutsideAngular(() => {
573
- this._currentSubscription = (this.debounce ? stream.pipe(debounceTime$1(this.debounce)) : stream).subscribe(this.event);
1318
+ this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
574
1319
  });
575
1320
  }
576
1321
  _unsubscribe() {
@@ -578,25 +1323,785 @@ class ObserveContentDirective {
578
1323
  (_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
579
1324
  }
580
1325
  }
581
- ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveContentDirective, deps: [{ token: ContentObserverService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
582
- ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ObserveContentDirective, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { event: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
583
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveContentDirective, decorators: [{
1326
+ ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1327
+ ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { event: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
1328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveResizeDirective, decorators: [{
584
1329
  type: Directive,
585
1330
  args: [{
586
- selector: '[etObserveContent]',
587
- exportAs: 'etObserveContent',
1331
+ selector: '[etObserveResize]',
1332
+ exportAs: 'etObserveResize',
1333
+ standalone: true,
588
1334
  }]
589
- }], ctorParameters: function () { return [{ type: ContentObserverService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { event: [{
1335
+ }], propDecorators: { event: [{
590
1336
  type: Output,
591
- args: ['etObserveContent']
1337
+ args: ['etObserveResize']
592
1338
  }], disabled: [{
593
1339
  type: Input,
594
- args: ['etObserveContentDisabled']
1340
+ args: ['etObserveResizeDisabled']
595
1341
  }], debounce: [{
596
1342
  type: Input,
597
- args: ['etObserveContentDebounce']
1343
+ args: ['etObserveResizeDebounce']
1344
+ }] } });
1345
+
1346
+ const SCROLL_OBSERVER_FIRST_ELEMENT_CLASS = 'et-scroll-observer-first-element';
1347
+ class ScrollObserverFirstElementDirective {
1348
+ constructor() {
1349
+ this._isFirstElement = false;
1350
+ }
1351
+ get isFirstElement() {
1352
+ return this._isFirstElement;
1353
+ }
1354
+ set isFirstElement(value) {
1355
+ this._isFirstElement = coerceBooleanProperty(value);
1356
+ }
1357
+ }
1358
+ ScrollObserverFirstElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverFirstElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1359
+ ScrollObserverFirstElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ScrollObserverFirstElementDirective, isStandalone: true, selector: "[etScrollObserverFirstElement]", inputs: { isFirstElement: ["etScrollObserverFirstElement", "isFirstElement"] }, host: { properties: { "class.et-scroll-observer-first-element": "this.isFirstElement" } }, ngImport: i0 });
1360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverFirstElementDirective, decorators: [{
1361
+ type: Directive,
1362
+ args: [{
1363
+ selector: '[etScrollObserverFirstElement]',
1364
+ standalone: true,
1365
+ }]
1366
+ }], propDecorators: { isFirstElement: [{
1367
+ type: Input,
1368
+ args: ['etScrollObserverFirstElement']
1369
+ }, {
1370
+ type: HostBinding,
1371
+ args: [`class.${SCROLL_OBSERVER_FIRST_ELEMENT_CLASS}`]
1372
+ }] } });
1373
+
1374
+ const SCROLL_OBSERVER_IGNORE_TARGET_CLASS = 'et-scroll-observer-ignore-target';
1375
+ class ScrollObserverIgnoreTargetDirective {
1376
+ }
1377
+ ScrollObserverIgnoreTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1378
+ ScrollObserverIgnoreTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ScrollObserverIgnoreTargetDirective, isStandalone: true, selector: "[etScrollObserverIgnoreTarget]", host: { classAttribute: "et-scroll-observer-ignore-target" }, ngImport: i0 });
1379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, decorators: [{
1380
+ type: Directive,
1381
+ args: [{
1382
+ selector: '[etScrollObserverIgnoreTarget]',
1383
+ standalone: true,
1384
+ host: {
1385
+ class: SCROLL_OBSERVER_IGNORE_TARGET_CLASS,
1386
+ },
1387
+ }]
1388
+ }] });
1389
+
1390
+ const SCROLL_OBSERVER_LAST_ELEMENT_CLASS = 'et-scroll-observer-last-element';
1391
+ class ScrollObserverLastElementDirective {
1392
+ constructor() {
1393
+ this._isLastElement = false;
1394
+ }
1395
+ get isLastElement() {
1396
+ return this._isLastElement;
1397
+ }
1398
+ set isLastElement(value) {
1399
+ this._isLastElement = coerceBooleanProperty(value);
1400
+ }
1401
+ }
1402
+ ScrollObserverLastElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverLastElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1403
+ ScrollObserverLastElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ScrollObserverLastElementDirective, isStandalone: true, selector: "[etScrollObserverLastElement]", inputs: { isLastElement: ["etScrollObserverLastElement", "isLastElement"] }, host: { properties: { "class.et-scroll-observer-last-element": "this.isLastElement" }, classAttribute: "et-scroll-observer-last-element" }, ngImport: i0 });
1404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ScrollObserverLastElementDirective, decorators: [{
1405
+ type: Directive,
1406
+ args: [{
1407
+ selector: '[etScrollObserverLastElement]',
1408
+ standalone: true,
1409
+ host: {
1410
+ class: SCROLL_OBSERVER_LAST_ELEMENT_CLASS,
1411
+ },
1412
+ }]
1413
+ }], propDecorators: { isLastElement: [{
1414
+ type: Input,
1415
+ args: ['etScrollObserverLastElement']
1416
+ }, {
1417
+ type: HostBinding,
1418
+ args: [`class.${SCROLL_OBSERVER_LAST_ELEMENT_CLASS}`]
1419
+ }] } });
1420
+
1421
+ const OBSERVE_SCROLL_STATE = new InjectionToken('OBSERVE_SCROLL_STATE');
1422
+
1423
+ class ObserveScrollStateDirective {
1424
+ constructor() {
1425
+ this._destroy$ = inject(DestroyService, { host: true }).destroy$;
1426
+ this._elementRef = inject(ElementRef);
1427
+ this._contentObserverService = inject(ContentObserverService);
1428
+ this._resizeObserverService = inject(ResizeObserverService);
1429
+ this._observedChildren = {
1430
+ first: this._firstCurrentChild,
1431
+ last: this._lastCurrentChild,
1432
+ };
1433
+ this._rootMargin = 0;
1434
+ this._threshold = 1;
1435
+ this._intersectionObserver = null;
1436
+ this.etObserveScrollState = new EventEmitter();
1437
+ }
1438
+ get _firstCurrentChild() {
1439
+ const explicitFirstElement = this._elementRef.nativeElement.querySelector(`.${SCROLL_OBSERVER_FIRST_ELEMENT_CLASS}`);
1440
+ if (explicitFirstElement) {
1441
+ return explicitFirstElement;
1442
+ }
1443
+ const element = this._elementRef.nativeElement.children[0];
1444
+ return this._getNonIgnoredChild(element, 'next');
1445
+ }
1446
+ get _lastCurrentChild() {
1447
+ const explicitLastElement = this._elementRef.nativeElement.querySelector(`.${SCROLL_OBSERVER_LAST_ELEMENT_CLASS}`);
1448
+ if (explicitLastElement) {
1449
+ return explicitLastElement;
1450
+ }
1451
+ const element = this._elementRef.nativeElement.children[this._elementRef.nativeElement.children.length - 1];
1452
+ return this._getNonIgnoredChild(element, 'previous');
1453
+ }
1454
+ get observerRootMargin() {
1455
+ return this._rootMargin;
1456
+ }
1457
+ set observerRootMargin(value) {
1458
+ this._rootMargin = coerceNumberProperty(value);
1459
+ }
1460
+ get observerThreshold() {
1461
+ return this._threshold;
1462
+ }
1463
+ set observerThreshold(value) {
1464
+ this._threshold = coerceNumberProperty(value);
1465
+ }
1466
+ ngOnInit() {
1467
+ this._contentObserverService
1468
+ .observe(this._elementRef.nativeElement)
1469
+ .pipe(tap(() => this._checkChildren()), takeUntil(this._destroy$))
1470
+ .subscribe();
1471
+ this._resizeObserverService
1472
+ .observe(this._elementRef.nativeElement)
1473
+ .pipe(debounceTime(25), tap(() => {
1474
+ const canScroll = elementCanScroll(this._elementRef.nativeElement);
1475
+ if ((!this._intersectionObserver && canScroll) || (this._intersectionObserver && !canScroll)) {
1476
+ this._checkChildren();
1477
+ }
1478
+ }), takeUntil(this._destroy$))
1479
+ .subscribe();
1480
+ this._checkChildren();
1481
+ }
1482
+ ngOnDestroy() {
1483
+ this._clearIntersectionObserver();
1484
+ }
1485
+ _checkChildren() {
1486
+ this._clearIntersectionObserver();
1487
+ if (this._firstCurrentChild === this._lastCurrentChild ||
1488
+ !this._firstCurrentChild ||
1489
+ !this._lastCurrentChild ||
1490
+ !elementCanScroll(this._elementRef.nativeElement)) {
1491
+ this._unobserveChild('first');
1492
+ this._unobserveChild('last');
1493
+ this.etObserveScrollState.emit({
1494
+ isAtStart: true,
1495
+ isAtEnd: true,
1496
+ canScroll: false,
1497
+ });
1498
+ }
1499
+ else {
1500
+ this._intersectionObserver = this._initiateIntersectionObserver();
1501
+ this._observeChild('first', this._firstCurrentChild);
1502
+ this._observeChild('last', this._lastCurrentChild);
1503
+ }
1504
+ }
1505
+ _initiateIntersectionObserver() {
1506
+ const observer = new IntersectionObserver((entries) => {
1507
+ var _a, _b, _c, _d;
1508
+ const { first, last } = this._observedChildren;
1509
+ const isAtStart = (_b = (_a = entries.find((entry) => entry.target === first)) === null || _a === void 0 ? void 0 : _a.isIntersecting) !== null && _b !== void 0 ? _b : false;
1510
+ const isAtEnd = (_d = (_c = entries.find((entry) => entry.target === last)) === null || _c === void 0 ? void 0 : _c.isIntersecting) !== null && _d !== void 0 ? _d : false;
1511
+ this.etObserveScrollState.emit({
1512
+ isAtStart,
1513
+ isAtEnd,
1514
+ canScroll: !isAtStart || !isAtEnd,
1515
+ });
1516
+ }, {
1517
+ root: this._elementRef.nativeElement,
1518
+ rootMargin: `${this._rootMargin}px`,
1519
+ threshold: this._threshold,
1520
+ });
1521
+ return observer;
1522
+ }
1523
+ _observeChild(child, element) {
1524
+ var _a;
1525
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.observe(element);
1526
+ this._observedChildren[child] = element;
1527
+ element.classList.add(`et-scroll-observer-observing-${child}-element`);
1528
+ }
1529
+ _unobserveChild(child) {
1530
+ var _a;
1531
+ const observedChild = this._observedChildren[child];
1532
+ if (!observedChild) {
1533
+ return;
1534
+ }
1535
+ observedChild.classList.remove('et-scroll-observer-observing-first-element', 'et-scroll-observer-observing-last-element');
1536
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.unobserve(observedChild);
1537
+ this._observedChildren[child] = null;
1538
+ }
1539
+ _clearIntersectionObserver() {
1540
+ var _a;
1541
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1542
+ this._intersectionObserver = null;
1543
+ }
1544
+ _getNonIgnoredChild(element, direction) {
1545
+ if (!element) {
1546
+ return null;
1547
+ }
1548
+ if (element === null || element === void 0 ? void 0 : element.classList.contains(SCROLL_OBSERVER_IGNORE_TARGET_CLASS)) {
1549
+ const nextElement = element[`${direction}ElementSibling`];
1550
+ if (!nextElement) {
1551
+ return null;
1552
+ }
1553
+ return this._getNonIgnoredChild(nextElement, direction);
1554
+ }
1555
+ return element;
1556
+ }
1557
+ }
1558
+ ObserveScrollStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveScrollStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1559
+ ObserveScrollStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveScrollStateDirective, isStandalone: true, selector: "[etObserveScrollState]", inputs: { observerRootMargin: "observerRootMargin", observerThreshold: "observerThreshold" }, outputs: { etObserveScrollState: "etObserveScrollState" }, providers: [
1560
+ {
1561
+ provide: OBSERVE_SCROLL_STATE,
1562
+ useExisting: ObserveScrollStateDirective,
1563
+ },
1564
+ DestroyService,
1565
+ ], exportAs: ["etObserveScrollState"], ngImport: i0 });
1566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveScrollStateDirective, decorators: [{
1567
+ type: Directive,
1568
+ args: [{
1569
+ selector: '[etObserveScrollState]',
1570
+ exportAs: 'etObserveScrollState',
1571
+ standalone: true,
1572
+ providers: [
1573
+ {
1574
+ provide: OBSERVE_SCROLL_STATE,
1575
+ useExisting: ObserveScrollStateDirective,
1576
+ },
1577
+ DestroyService,
1578
+ ],
1579
+ }]
1580
+ }], propDecorators: { observerRootMargin: [{
1581
+ type: Input
1582
+ }], observerThreshold: [{
1583
+ type: Input
1584
+ }], etObserveScrollState: [{
1585
+ type: Output
1586
+ }] } });
1587
+
1588
+ class RepeatDirective {
1589
+ get repeatCount() {
1590
+ return this._repeatCount;
1591
+ }
1592
+ set repeatCount(value) {
1593
+ this._repeatCount = coerceNumberProperty(value);
1594
+ this._render();
1595
+ }
1596
+ constructor(_mainTemplateRef, _viewContainerRef) {
1597
+ this._mainTemplateRef = _mainTemplateRef;
1598
+ this._viewContainerRef = _viewContainerRef;
1599
+ this._repeatCount = 2;
1600
+ }
1601
+ _render() {
1602
+ this._viewContainerRef.clear();
1603
+ for (let i = 0; i < this.repeatCount; i++) {
1604
+ this._viewContainerRef.createEmbeddedView(this._mainTemplateRef);
1605
+ }
1606
+ }
1607
+ }
1608
+ RepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: RepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1609
+ RepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: RepeatDirective, isStandalone: true, selector: "[etRepeat]", inputs: { repeatCount: ["etRepeat", "repeatCount"] }, ngImport: i0 });
1610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: RepeatDirective, decorators: [{
1611
+ type: Directive,
1612
+ args: [{
1613
+ selector: '[etRepeat]',
1614
+ standalone: true,
1615
+ }]
1616
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { repeatCount: [{
1617
+ type: Input,
1618
+ args: ['etRepeat']
598
1619
  }] } });
599
1620
 
1621
+ const SEO_DIRECTIVE_TOKEN = new InjectionToken('SEO_DIRECTIVE_TOKEN');
1622
+
1623
+ const mergeSeoConfig = (config, parentConfig) => {
1624
+ return Object.assign(Object.assign({}, parentConfig), config);
1625
+ };
1626
+
1627
+ class SeoDirective {
1628
+ constructor() {
1629
+ this._metaService = inject(Meta);
1630
+ this._titleService = inject(Title);
1631
+ this._onDeactivate$ = new Subject();
1632
+ this._isDeactivated = false;
1633
+ this.parent = inject(SEO_DIRECTIVE_TOKEN, { optional: true, skipSelf: true });
1634
+ this._config = {};
1635
+ }
1636
+ get config() {
1637
+ return this._config;
1638
+ }
1639
+ ngOnInit() {
1640
+ var _a;
1641
+ (_a = this.parent) === null || _a === void 0 ? void 0 : _a._deactivate();
1642
+ }
1643
+ ngOnDestroy() {
1644
+ var _a;
1645
+ this._deactivate();
1646
+ this._cleanUp();
1647
+ (_a = this.parent) === null || _a === void 0 ? void 0 : _a._activate();
1648
+ }
1649
+ // TODO(TRB): This should get split up into multiple methods to make it more readable
1650
+ // - updateTitle
1651
+ // - updateMeta
1652
+ // - updateLink
1653
+ updateConfig(config) {
1654
+ var _a;
1655
+ this._config = mergeSeoConfig(config, ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.config) || {});
1656
+ if (this._isDeactivated) {
1657
+ return;
1658
+ }
1659
+ this._deactivate();
1660
+ this._activate();
1661
+ }
1662
+ _activate() {
1663
+ this._onDeactivate$.next(false);
1664
+ this._isDeactivated = false;
1665
+ for (const [key, value] of Object.entries(this._config)) {
1666
+ if (value instanceof Observable) {
1667
+ value.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(key, value));
1668
+ }
1669
+ else if (Array.isArray(value)) {
1670
+ value.forEach((value) => {
1671
+ if (value instanceof Observable) {
1672
+ value.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(key, value));
1673
+ }
1674
+ else {
1675
+ this._update(key, value);
1676
+ }
1677
+ });
1678
+ }
1679
+ else if (typeof value === 'object' && value !== null) {
1680
+ for (const [subKey, subValue] of Object.entries(value)) {
1681
+ if (subValue instanceof Observable) {
1682
+ subValue.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(`${key}:${subKey}`, value));
1683
+ }
1684
+ else {
1685
+ this._update(`${key}:${subKey}`, subValue);
1686
+ }
1687
+ }
1688
+ }
1689
+ else {
1690
+ this._update(key, value);
1691
+ }
1692
+ }
1693
+ }
1694
+ _deactivate() {
1695
+ this._onDeactivate$.next(true);
1696
+ this._isDeactivated = true;
1697
+ }
1698
+ _update(key, value) {
1699
+ switch (key) {
1700
+ case 'title':
1701
+ if (value && typeof value === 'string') {
1702
+ this._titleService.setTitle(value);
1703
+ }
1704
+ break;
1705
+ case 'canonical':
1706
+ {
1707
+ const link = document.querySelector(`link[rel="${key}"]`);
1708
+ if (link) {
1709
+ link.setAttribute('href', value);
1710
+ }
1711
+ else {
1712
+ const newLink = document.createElement('link');
1713
+ newLink.setAttribute('rel', key);
1714
+ newLink.setAttribute('href', value);
1715
+ document.head.appendChild(newLink);
1716
+ }
1717
+ }
1718
+ break;
1719
+ case 'alternate':
1720
+ {
1721
+ const link = document.querySelector(`link[rel="${key}"][hreflang="${value.hreflang}"]`);
1722
+ if (link) {
1723
+ link.setAttribute('href', value.href);
1724
+ }
1725
+ else {
1726
+ const newLink = document.createElement('link');
1727
+ newLink.setAttribute('rel', key);
1728
+ newLink.setAttribute('hreflang', value.hreflang);
1729
+ newLink.setAttribute('href', value.href);
1730
+ document.head.appendChild(newLink);
1731
+ }
1732
+ }
1733
+ break;
1734
+ default:
1735
+ if (value !== undefined && value !== null) {
1736
+ const val = Array.isArray(value) ? value.join(', ') : value;
1737
+ this._metaService.updateTag({ name: key, content: val });
1738
+ }
1739
+ else {
1740
+ this._metaService.removeTag(`name="${key}"`);
1741
+ }
1742
+ break;
1743
+ }
1744
+ }
1745
+ _cleanUp() {
1746
+ var _a, _b, _c, _d, _e;
1747
+ for (const key in this._config) {
1748
+ if (key === 'alternate') {
1749
+ const links = document.querySelectorAll(`link[rel="${key}"]`);
1750
+ links.forEach((link) => {
1751
+ link.remove();
1752
+ });
1753
+ continue;
1754
+ }
1755
+ if (key === 'canonical') {
1756
+ const link = document.querySelector(`link[rel="${key}"]`);
1757
+ if (link) {
1758
+ link.remove();
1759
+ }
1760
+ continue;
1761
+ }
1762
+ if (typeof this._config[key] === 'object' &&
1763
+ this._config[key] !== null &&
1764
+ !(this._config[key] instanceof Observable)) {
1765
+ for (const subKey in this._config[key]) {
1766
+ const parentValue = (_c = (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c[subKey];
1767
+ if (parentValue === undefined) {
1768
+ this._update(`${key}:${subKey}`, undefined);
1769
+ }
1770
+ }
1771
+ }
1772
+ else {
1773
+ const parentValue = (_e = (_d = this.parent) === null || _d === void 0 ? void 0 : _d.config) === null || _e === void 0 ? void 0 : _e[key];
1774
+ if (parentValue === undefined) {
1775
+ this._update(key, null);
1776
+ }
1777
+ }
1778
+ }
1779
+ }
1780
+ }
1781
+ SeoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SeoDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1782
+ SeoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: SeoDirective, isStandalone: true, providers: [{ provide: SEO_DIRECTIVE_TOKEN, useExisting: SeoDirective }], ngImport: i0 });
1783
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SeoDirective, decorators: [{
1784
+ type: Directive,
1785
+ args: [{
1786
+ standalone: true,
1787
+ providers: [{ provide: SEO_DIRECTIVE_TOKEN, useExisting: SeoDirective }],
1788
+ }]
1789
+ }] });
1790
+
1791
+ // TODO(TRB): Add correct type once provided by API
1792
+ const normalizeGameResultType = (type) => {
1793
+ if (!type) {
1794
+ return null;
1795
+ }
1796
+ switch (type) {
1797
+ case 'extra_time':
1798
+ return {
1799
+ i18n: 'game-result-type.extra-time',
1800
+ shortCode: 'AET',
1801
+ text: 'After Extra Time',
1802
+ };
1803
+ case 'penalty':
1804
+ return {
1805
+ i18n: 'game-result-type.penalty',
1806
+ shortCode: 'PSO',
1807
+ text: 'Penalty shootout',
1808
+ };
1809
+ case 'golden_goal':
1810
+ return {
1811
+ i18n: 'game-result-type.golden-goal',
1812
+ shortCode: 'GG',
1813
+ text: 'Golden Goal',
1814
+ };
1815
+ case 'default':
1816
+ default:
1817
+ return {
1818
+ i18n: 'game-result-type.full-time',
1819
+ shortCode: 'FT',
1820
+ text: 'Full Time',
1821
+ };
1822
+ }
1823
+ };
1824
+
1825
+ class NormalizeGameResultTypePipe {
1826
+ constructor() {
1827
+ this.transform = normalizeGameResultType;
1828
+ }
1829
+ }
1830
+ NormalizeGameResultTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeGameResultTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1831
+ NormalizeGameResultTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NormalizeGameResultTypePipe, isStandalone: true, name: "etNormalizeGameResultType" });
1832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeGameResultTypePipe, decorators: [{
1833
+ type: Pipe,
1834
+ args: [{ name: 'etNormalizeGameResultType', standalone: true }]
1835
+ }] });
1836
+
1837
+ const normalizeMatchState = (match) => {
1838
+ if (match === null || match === void 0 ? void 0 : match.isCompletedByReferee) {
1839
+ return "autoWin" /* MatchStateType.AUTO_WIN */;
1840
+ }
1841
+ else if ((match === null || match === void 0 ? void 0 : match.status) === 'preparing') {
1842
+ return "preMatch" /* MatchStateType.PRE_MATCH */;
1843
+ }
1844
+ else if ((match === null || match === void 0 ? void 0 : match.status) === 'started') {
1845
+ return "live" /* MatchStateType.LIVE */;
1846
+ }
1847
+ else if ((match === null || match === void 0 ? void 0 : match.status) === 'published' || (match === null || match === void 0 ? void 0 : match.status) === 'finished') {
1848
+ return "postMatch" /* MatchStateType.POST_MATCH */;
1849
+ }
1850
+ else if ((match === null || match === void 0 ? void 0 : match.round.state) !== 'preparing') {
1851
+ return "preparingRound" /* MatchStateType.PREPARING_ROUND */;
1852
+ }
1853
+ return null;
1854
+ };
1855
+
1856
+ class NormalizeMatchStatePipe {
1857
+ constructor() {
1858
+ this.transform = normalizeMatchState;
1859
+ }
1860
+ }
1861
+ NormalizeMatchStatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchStatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1862
+ NormalizeMatchStatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchStatePipe, isStandalone: true, name: "etNormalizeMatchState" });
1863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchStatePipe, decorators: [{
1864
+ type: Pipe,
1865
+ args: [{ name: 'etNormalizeMatchState', standalone: true }]
1866
+ }] });
1867
+
1868
+ const normalizeMatchParticipants = (match) => {
1869
+ const matchState = normalizeMatchState(match);
1870
+ if (!match || !matchState) {
1871
+ return null;
1872
+ }
1873
+ return {
1874
+ home: normalizeMatchParticipant(match, 'home'),
1875
+ away: normalizeMatchParticipant(match, 'away'),
1876
+ };
1877
+ };
1878
+ const normalizeMatchParticipant = (match, side) => {
1879
+ var _a, _b, _c, _d;
1880
+ const matchState = normalizeMatchState(match);
1881
+ if (!match || !matchState) {
1882
+ return null;
1883
+ }
1884
+ const participant = match[side];
1885
+ const participantType = (_d = (_b = (_a = match.home) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : (_c = match.away) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : 'unknown';
1886
+ if (!participant) {
1887
+ if (matchState === "postMatch" /* MatchStateType.POST_MATCH */ || matchState === "autoWin" /* MatchStateType.AUTO_WIN */) {
1888
+ return {
1889
+ participantType,
1890
+ type: 'none',
1891
+ i18n: 'match-participant.none',
1892
+ text: 'No opponent',
1893
+ data: participant,
1894
+ };
1895
+ }
1896
+ else {
1897
+ return {
1898
+ participantType,
1899
+ type: 'tbd',
1900
+ i18n: 'match-participant.tbd',
1901
+ text: 'TBD',
1902
+ data: participant,
1903
+ };
1904
+ }
1905
+ }
1906
+ else {
1907
+ return {
1908
+ participantType,
1909
+ type: 'participant',
1910
+ data: participant,
1911
+ };
1912
+ }
1913
+ };
1914
+
1915
+ class NormalizeMatchParticipantsPipe {
1916
+ constructor() {
1917
+ this.transform = normalizeMatchParticipants;
1918
+ }
1919
+ }
1920
+ NormalizeMatchParticipantsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchParticipantsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1921
+ NormalizeMatchParticipantsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchParticipantsPipe, isStandalone: true, name: "etNormalizeMatchParticipants" });
1922
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchParticipantsPipe, decorators: [{
1923
+ type: Pipe,
1924
+ args: [{ name: 'etNormalizeMatchParticipants', standalone: true }]
1925
+ }] });
1926
+
1927
+ const EMPTY_SCORE = {
1928
+ home: { score: 'match-score.placeholder', isWinner: false },
1929
+ away: { score: 'match-score.placeholder', isWinner: false },
1930
+ isNumeric: false,
1931
+ subLine: null,
1932
+ };
1933
+ const normalizeMatchScore = (match) => {
1934
+ var _a, _b;
1935
+ if (!match) {
1936
+ return null;
1937
+ }
1938
+ const matchState = normalizeMatchState(match);
1939
+ const subLine = getMatchScoreSubLine(match);
1940
+ if (!match.homeScore && !match.awayScore) {
1941
+ return Object.assign(Object.assign({}, EMPTY_SCORE), { subLine, isNumeric: false });
1942
+ }
1943
+ if (isKnockoutMatch(match)) {
1944
+ if (matchState === "preMatch" /* MatchStateType.PRE_MATCH */ || matchState === "live" /* MatchStateType.LIVE */) {
1945
+ return Object.assign(Object.assign({}, EMPTY_SCORE), { subLine, isNumeric: false });
1946
+ }
1947
+ return {
1948
+ home: {
1949
+ score: getKnockoutMatchScore(match.homeScore),
1950
+ isWinner: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.status) === 'won',
1951
+ },
1952
+ away: {
1953
+ score: getKnockoutMatchScore(match.awayScore),
1954
+ isWinner: ((_b = match.awayScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
1955
+ },
1956
+ subLine,
1957
+ isNumeric: false,
1958
+ };
1959
+ }
1960
+ else if (isGroupMatch(match)) {
1961
+ if (match.games.length === 1) {
1962
+ // Return the score if only one game has been played
1963
+ return Object.assign(Object.assign({}, getGroupMatchScore(match)), { subLine, isNumeric: true });
1964
+ }
1965
+ else {
1966
+ return Object.assign(Object.assign({}, getGroupMatchPoints(match)), { subLine, isNumeric: true });
1967
+ }
1968
+ }
1969
+ else {
1970
+ return Object.assign(Object.assign({}, getGroupMatchScore(match)), { subLine, isNumeric: true });
1971
+ }
1972
+ };
1973
+ const isKnockoutMatch = (match) => {
1974
+ if (!match) {
1975
+ return false;
1976
+ }
1977
+ return (match.matchType === 'single_elimination' ||
1978
+ match.matchType === 'double_elimination' ||
1979
+ match.matchType === 'fifa_swiss');
1980
+ };
1981
+ const isGroupMatch = (match) => {
1982
+ if (!match) {
1983
+ return false;
1984
+ }
1985
+ return match.matchType === 'groups' || match.matchType === 'league';
1986
+ };
1987
+ const getKnockoutMatchScore = (score) => {
1988
+ if ((score === null || score === void 0 ? void 0 : score.status) === 'won') {
1989
+ return 'match-score.knockout.won';
1990
+ }
1991
+ else if ((score === null || score === void 0 ? void 0 : score.status) === 'lost') {
1992
+ return 'match-score.knockout.lost';
1993
+ }
1994
+ else if ((score === null || score === void 0 ? void 0 : score.status) === 'tie') {
1995
+ return 'match-score.knockout.tie';
1996
+ }
1997
+ return null;
1998
+ };
1999
+ const getMatchScoreSubLine = (match) => {
2000
+ if (isKnockoutMatch(match)) {
2001
+ return null;
2002
+ }
2003
+ else if (isGroupMatch(match)) {
2004
+ return 'match-score.groups.sub-line';
2005
+ }
2006
+ else {
2007
+ return null;
2008
+ }
2009
+ };
2010
+ const getGroupMatchScore = (match) => {
2011
+ var _a, _b, _c, _d;
2012
+ if (!match) {
2013
+ return null;
2014
+ }
2015
+ return {
2016
+ home: {
2017
+ score: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.ownPoints) || 0,
2018
+ isWinner: ((_b = match.homeScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
2019
+ },
2020
+ away: {
2021
+ score: ((_c = match.awayScore) === null || _c === void 0 ? void 0 : _c.ownPoints) || 0,
2022
+ isWinner: ((_d = match.awayScore) === null || _d === void 0 ? void 0 : _d.status) === 'won',
2023
+ },
2024
+ };
2025
+ };
2026
+ const getGroupMatchPoints = (match) => {
2027
+ var _a, _b, _c, _d;
2028
+ if (!match) {
2029
+ return null;
2030
+ }
2031
+ return {
2032
+ home: {
2033
+ score: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.score) || 0,
2034
+ isWinner: ((_b = match.homeScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
2035
+ },
2036
+ away: {
2037
+ score: ((_c = match.awayScore) === null || _c === void 0 ? void 0 : _c.score) || 0,
2038
+ isWinner: ((_d = match.awayScore) === null || _d === void 0 ? void 0 : _d.status) === 'won',
2039
+ },
2040
+ };
2041
+ };
2042
+
2043
+ class NormalizeMatchScorePipe {
2044
+ constructor() {
2045
+ this.transform = normalizeMatchScore;
2046
+ }
2047
+ }
2048
+ NormalizeMatchScorePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchScorePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2049
+ NormalizeMatchScorePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchScorePipe, isStandalone: true, name: "etNormalizeMatchScore" });
2050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchScorePipe, decorators: [{
2051
+ type: Pipe,
2052
+ args: [{ name: 'etNormalizeMatchScore', standalone: true }]
2053
+ }] });
2054
+
2055
+ const normalizeMatchType = (matchType) => {
2056
+ if (!matchType) {
2057
+ return null;
2058
+ }
2059
+ switch (matchType) {
2060
+ case 'double_elimination':
2061
+ return {
2062
+ i18n: 'match-type.double-elimination',
2063
+ text: 'Double Elimination',
2064
+ };
2065
+ case 'single_elimination':
2066
+ return {
2067
+ i18n: 'match-type.single-elimination',
2068
+ text: 'Single Elimination',
2069
+ };
2070
+ case 'fifa_swiss':
2071
+ return {
2072
+ i18n: 'match-type.fifa-swiss',
2073
+ text: 'FIFA Swiss',
2074
+ };
2075
+ case 'groups':
2076
+ return {
2077
+ i18n: 'match-type.groups',
2078
+ text: 'Groups',
2079
+ };
2080
+ case 'league':
2081
+ return {
2082
+ i18n: 'match-type.league',
2083
+ text: 'League',
2084
+ };
2085
+ case 'pools':
2086
+ return {
2087
+ i18n: 'match-type.pools',
2088
+ text: 'Pools',
2089
+ };
2090
+ }
2091
+ };
2092
+
2093
+ class NormalizeMatchTypePipe {
2094
+ constructor() {
2095
+ this.transform = normalizeMatchType;
2096
+ }
2097
+ }
2098
+ NormalizeMatchTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2099
+ NormalizeMatchTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchTypePipe, isStandalone: true, name: "etNormalizeMatchType" });
2100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NormalizeMatchTypePipe, decorators: [{
2101
+ type: Pipe,
2102
+ args: [{ name: 'etNormalizeMatchType', standalone: true }]
2103
+ }] });
2104
+
600
2105
  const toArray = (value) => {
601
2106
  return Array.from({ length: value }, (_, i) => i);
602
2107
  };
@@ -607,24 +2112,51 @@ class ToArrayPipe {
607
2112
  this.transform = toArray;
608
2113
  }
609
2114
  }
610
- ToArrayPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
611
- ToArrayPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, isStandalone: true, name: "toArray" });
612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, decorators: [{
2115
+ ToArrayPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ToArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2116
+ ToArrayPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: ToArrayPipe, isStandalone: true, name: "toArray" });
2117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ToArrayPipe, decorators: [{
613
2118
  type: Pipe,
614
2119
  args: [{ name: 'toArray', standalone: true }]
615
2120
  }] });
616
2121
 
617
- const provideViewportConfig = (viewportConfig) => {
618
- return { provide: VIEWPORT_CONFIG, useValue: viewportConfig };
619
- };
620
-
621
- const clamp = (value, min = 0, max = 100) => {
622
- return Math.max(min, Math.min(max, value));
623
- };
2122
+ var _a;
2123
+ class TypedQueryList extends QueryList {
2124
+ constructor() {
2125
+ super(...arguments);
2126
+ this[_a] = () => {
2127
+ return super[Symbol.iterator]();
2128
+ };
2129
+ }
2130
+ get changes() {
2131
+ return super.changes;
2132
+ }
2133
+ toArray() {
2134
+ return super.toArray();
2135
+ }
2136
+ forEach(fn) {
2137
+ super.forEach(fn);
2138
+ }
2139
+ filter(fn) {
2140
+ return super.filter(fn);
2141
+ }
2142
+ map(fn) {
2143
+ return super.map(fn);
2144
+ }
2145
+ reduce(fn, initialValue) {
2146
+ return super.reduce(fn, initialValue);
2147
+ }
2148
+ some(fn) {
2149
+ return super.some(fn);
2150
+ }
2151
+ find(fn) {
2152
+ return super.find(fn);
2153
+ }
2154
+ }
2155
+ _a = Symbol.iterator;
624
2156
 
625
2157
  /**
626
2158
  * Generated bundle index. Do not edit.
627
2159
  */
628
2160
 
629
- export { ContentObserverService, DEFAULT_VIEWPORT_CONFIG, FocusVisibleService, LetContext, LetDirective, Memo, MutationObserverFactory, ObserveContentDirective, ObserveResizeDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, ToArrayPipe, VIEWPORT_CONFIG, ViewportService, clamp, provideViewportConfig, toArray, toArrayTrackByFn };
2161
+ export { ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DestroyService, FocusVisibleService, LetContext, LetDirective, Memo, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RouterStateService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, ViewportService, clamp, clone, createReactiveBindings, deleteCookie, elementCanScroll, equal, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isGroupMatch, isKnockoutMatch, mergeSeoConfig, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, setCookie, toArray, toArrayTrackByFn };
630
2162
  //# sourceMappingURL=ethlete-core.mjs.map