@clickview/lite 0.0.24-rc.4 → 0.0.24

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 (194) hide show
  1. package/dist/css/11.chunk.css.map +1 -1
  2. package/dist/css/12.chunk.css.map +1 -1
  3. package/dist/css/13.chunk.css.map +1 -1
  4. package/dist/css/14.chunk.css.map +1 -1
  5. package/dist/css/15.chunk.css.map +1 -1
  6. package/dist/css/16.chunk.css.map +1 -1
  7. package/dist/css/17.chunk.css.map +1 -1
  8. package/dist/css/18.chunk.css.map +1 -1
  9. package/dist/css/20.chunk.css.map +1 -1
  10. package/dist/css/29.chunk.css.map +1 -1
  11. package/dist/css/3.chunk.css.map +1 -1
  12. package/dist/css/30.chunk.css.map +1 -1
  13. package/dist/css/31.chunk.css.map +1 -1
  14. package/dist/css/33.chunk.css.map +1 -1
  15. package/dist/css/38.chunk.css +11 -34
  16. package/dist/css/38.chunk.css.map +1 -1
  17. package/dist/css/4.chunk.css +3 -3
  18. package/dist/css/44.chunk.css +11 -3
  19. package/dist/css/44.chunk.css.map +1 -1
  20. package/dist/css/45.chunk.css +38 -0
  21. package/dist/css/45.chunk.css.map +1 -0
  22. package/dist/css/5.chunk.css.map +1 -1
  23. package/dist/css/52.chunk.css +52 -0
  24. package/dist/css/52.chunk.css.map +1 -0
  25. package/dist/css/59.chunk.css +14 -0
  26. package/dist/css/59.chunk.css.map +1 -0
  27. package/dist/css/6.chunk.css.map +1 -1
  28. package/dist/css/60.chunk.css +43 -0
  29. package/dist/css/60.chunk.css.map +1 -0
  30. package/dist/en.json +1 -1
  31. package/dist/libs/shared/src/components/curriculum-links/CurriculumLinks.d.ts +9 -0
  32. package/dist/libs/shared/src/components/widgets/items/resource-widget-item/ResourceWidgetItem.d.ts +12 -0
  33. package/dist/libs/shared/src/enums/CurriculumType.d.ts +6 -0
  34. package/dist/libs/shared/src/flight-requests/ClassificationRequests.d.ts +1 -0
  35. package/dist/libs/shared/src/flight-requests/ResourceRequests.d.ts +11 -0
  36. package/dist/libs/shared/src/interfaces/collections/SubtitleCollection.d.ts +3 -0
  37. package/dist/libs/shared/src/interfaces/models/Curriculum.d.ts +14 -0
  38. package/dist/libs/shared/src/interfaces/models/FileUpload.d.ts +20 -0
  39. package/dist/libs/shared/src/interfaces/models/Language.d.ts +4 -0
  40. package/dist/libs/shared/src/interfaces/models/Pdf.d.ts +4 -0
  41. package/dist/libs/shared/src/interfaces/models/Subtitle.d.ts +7 -0
  42. package/dist/libs/shared/src/interfaces/models/index.d.ts +1 -0
  43. package/dist/libs/shared/src/interfaces/requests/UpdateObjectChannel.d.ts +3 -0
  44. package/dist/libs/shared/src/interfaces/requests/UpdateObjectRating.d.ts +3 -0
  45. package/dist/libs/shared/src/interfaces/requests/UpdateResourceRequest.d.ts +3 -0
  46. package/dist/projects/lite/src/app.d.ts +1 -0
  47. package/dist/projects/lite/src/shared/components/play-page/PlayPage.d.ts +2 -1
  48. package/dist/projects/lite/src/shared/components/synopsis/Synopsis.d.ts +3 -1
  49. package/dist/projects/lite/src/shared/components/video-details/VideoDetails.d.ts +2 -0
  50. package/dist/projects/lite/src/shared/constants/MinimumGlanceHeight.d.ts +1 -0
  51. package/dist/projects/lite/src/shared/views/preview-pdf/PreviewPdfView.d.ts +7 -0
  52. package/dist/scripts/0-b02efe11fb.chunk.js +1 -0
  53. package/dist/scripts/1-4f19a5caea.chunk.js +17 -0
  54. package/dist/scripts/1.chunk.js.map +1 -1
  55. package/dist/scripts/10.chunk.js +484 -1203
  56. package/dist/scripts/10.chunk.js.map +1 -1
  57. package/dist/scripts/11-32e30d10ce.chunk.js +1 -0
  58. package/dist/scripts/11.chunk.js +289 -1388
  59. package/dist/scripts/11.chunk.js.map +1 -1
  60. package/dist/scripts/12-72a5373486.chunk.js +1 -0
  61. package/dist/scripts/12.chunk.js +1371 -283
  62. package/dist/scripts/12.chunk.js.map +1 -1
  63. package/dist/scripts/13-1cd85ad3ee.chunk.js +1 -0
  64. package/dist/scripts/13.chunk.js +361 -394
  65. package/dist/scripts/13.chunk.js.map +1 -1
  66. package/dist/scripts/14-3d60b8ee85.chunk.js +1 -0
  67. package/dist/scripts/14.chunk.js +793 -332
  68. package/dist/scripts/14.chunk.js.map +1 -1
  69. package/dist/scripts/15-90226fb996.chunk.js +1 -0
  70. package/dist/scripts/15.chunk.js +295 -214
  71. package/dist/scripts/15.chunk.js.map +1 -1
  72. package/dist/scripts/16-913b2535ea.chunk.js +1 -0
  73. package/dist/scripts/16.chunk.js +530 -434
  74. package/dist/scripts/16.chunk.js.map +1 -1
  75. package/dist/scripts/17-d6c19ccb60.chunk.js +1 -0
  76. package/dist/scripts/17.chunk.js +296 -170
  77. package/dist/scripts/17.chunk.js.map +1 -1
  78. package/dist/scripts/18-33efcac0c6.chunk.js +1 -0
  79. package/dist/scripts/18.chunk.js +265 -199
  80. package/dist/scripts/18.chunk.js.map +1 -1
  81. package/dist/scripts/19-2380200cfb.chunk.js +1 -0
  82. package/dist/scripts/19.chunk.js +7 -3
  83. package/dist/scripts/19.chunk.js.map +1 -1
  84. package/dist/scripts/2-53e37c2047.chunk.js +1 -0
  85. package/dist/scripts/2.chunk.js +18673 -622
  86. package/dist/scripts/2.chunk.js.map +1 -1
  87. package/dist/scripts/20-ca85f0514e.chunk.js +1 -0
  88. package/dist/scripts/20.chunk.js +1824 -221
  89. package/dist/scripts/20.chunk.js.map +1 -1
  90. package/dist/scripts/21-ef4a226771.chunk.js +1 -0
  91. package/dist/scripts/22-99c04e164f.chunk.js +1 -0
  92. package/dist/scripts/23-028eb81a43.chunk.js +1 -0
  93. package/dist/scripts/23.chunk.js +1 -1
  94. package/dist/scripts/23.chunk.js.map +1 -1
  95. package/dist/scripts/24-68f8df3eca.chunk.js +1 -0
  96. package/dist/scripts/24.chunk.js.map +1 -1
  97. package/dist/scripts/25-7ad07f87d4.chunk.js +1 -0
  98. package/dist/scripts/25.chunk.js.map +1 -1
  99. package/dist/scripts/26-f3dcacfe4f.chunk.js +1 -0
  100. package/dist/scripts/26.chunk.js +1 -1
  101. package/dist/scripts/26.chunk.js.map +1 -1
  102. package/dist/scripts/27-e844268f38.chunk.js +1 -0
  103. package/dist/scripts/28-853bc5de1f.chunk.js +1 -0
  104. package/dist/scripts/29-b164ecafe9.chunk.js +1 -0
  105. package/dist/scripts/29.chunk.js +435 -500
  106. package/dist/scripts/29.chunk.js.map +1 -1
  107. package/dist/scripts/3-a1bd8c9016.chunk.js +7 -0
  108. package/dist/scripts/3.chunk.js +625 -18676
  109. package/dist/scripts/3.chunk.js.map +1 -1
  110. package/dist/scripts/30-2cfcf52ea1.chunk.js +1 -0
  111. package/dist/scripts/30.chunk.js +634 -429
  112. package/dist/scripts/30.chunk.js.map +1 -1
  113. package/dist/scripts/31-e6a8291d2f.chunk.js +1 -0
  114. package/dist/scripts/31.chunk.js +371 -670
  115. package/dist/scripts/31.chunk.js.map +1 -1
  116. package/dist/scripts/32-7030dc98ed.chunk.js +1 -0
  117. package/dist/scripts/32.chunk.js +27 -54
  118. package/dist/scripts/32.chunk.js.map +1 -1
  119. package/dist/scripts/33-47b0ac90bd.chunk.js +1 -0
  120. package/dist/scripts/33.chunk.js +700 -312
  121. package/dist/scripts/33.chunk.js.map +1 -1
  122. package/dist/scripts/34-2de007b628.chunk.js +1 -0
  123. package/dist/scripts/34.chunk.js +3 -3
  124. package/dist/scripts/34.chunk.js.map +1 -1
  125. package/dist/scripts/35-d2fb66920b.chunk.js +1 -0
  126. package/dist/scripts/36-bc85df33de.chunk.js +1 -0
  127. package/dist/scripts/36.chunk.js.map +1 -1
  128. package/dist/scripts/37-e26652840b.chunk.js +1 -0
  129. package/dist/scripts/37.chunk.js +288 -464
  130. package/dist/scripts/37.chunk.js.map +1 -1
  131. package/dist/scripts/38-0b6a6b9619.chunk.js +1 -0
  132. package/dist/scripts/39-6549f483c6.chunk.js +1 -0
  133. package/dist/scripts/39.chunk.js +1 -1
  134. package/dist/scripts/39.chunk.js.map +1 -1
  135. package/dist/scripts/4-9e83a22d7a.chunk.js +1 -0
  136. package/dist/scripts/4.chunk.js +259 -1021
  137. package/dist/scripts/4.chunk.js.map +1 -1
  138. package/dist/scripts/40-8e6e9d285f.chunk.js +1 -0
  139. package/dist/scripts/41-2b44a2e66f.chunk.js +1 -0
  140. package/dist/scripts/42-9e75f420d8.chunk.js +1 -0
  141. package/dist/scripts/42.chunk.js.map +1 -1
  142. package/dist/scripts/43-1141245420.chunk.js +1 -0
  143. package/dist/scripts/44-9bc4201e0f.chunk.js +1 -0
  144. package/dist/scripts/45-5ded8ca3db.chunk.js +1 -0
  145. package/dist/scripts/46-2afd7ee1fb.chunk.js +1 -0
  146. package/dist/scripts/47-ab30686138.chunk.js +1 -0
  147. package/dist/scripts/48-d9cd99d55e.chunk.js +1 -0
  148. package/dist/scripts/49-f43a08f90b.chunk.js +1 -0
  149. package/dist/scripts/5-974660e17b.chunk.js +1 -0
  150. package/dist/scripts/5.chunk.js +1017 -259
  151. package/dist/scripts/5.chunk.js.map +1 -1
  152. package/dist/scripts/50-af699c531e.chunk.js +1 -0
  153. package/dist/scripts/51-aa7b835007.chunk.js +1 -0
  154. package/dist/scripts/52-805f7fe04d.chunk.js +1 -0
  155. package/dist/scripts/53-d75ca53045.chunk.js +1 -0
  156. package/dist/scripts/54-2e75bad46f.chunk.js +1 -0
  157. package/dist/scripts/55-ed637c4847.chunk.js +1 -0
  158. package/dist/scripts/55.chunk.js.map +1 -1
  159. package/dist/scripts/56-2ed3b5764b.chunk.js +1 -0
  160. package/dist/scripts/57-e51101c8a1.chunk.js +1 -0
  161. package/dist/scripts/58-9a32a6fb2d.chunk.js +1 -0
  162. package/dist/scripts/59-da8a8c97a9.chunk.js +1 -0
  163. package/dist/scripts/6-6ac39034e0.chunk.js +1 -0
  164. package/dist/scripts/6.chunk.js +291 -1250
  165. package/dist/scripts/6.chunk.js.map +1 -1
  166. package/dist/scripts/60-5713de53e2.chunk.js +1 -0
  167. package/dist/scripts/61-7d2ad17963.chunk.js +1 -0
  168. package/dist/scripts/62-a0a69501ac.chunk.js +1 -0
  169. package/dist/scripts/63-c921b87f3f.chunk.js +1 -0
  170. package/dist/scripts/64-87c1cf6985.chunk.js +1 -0
  171. package/dist/scripts/65-2322082836.chunk.js +1 -0
  172. package/dist/scripts/66-6d5356f6ce.chunk.js +1 -0
  173. package/dist/scripts/67-2e0d661c52.chunk.js +1 -0
  174. package/dist/scripts/7-5ac5be64dd.chunk.js +1 -0
  175. package/dist/scripts/7.chunk.js +1 -1
  176. package/dist/scripts/76.chunk.js +3 -3
  177. package/dist/scripts/76.chunk.js.map +1 -1
  178. package/dist/scripts/79.chunk.js +931 -347
  179. package/dist/scripts/79.chunk.js.map +1 -1
  180. package/dist/scripts/8-95563e3d36.chunk.js +1 -0
  181. package/dist/scripts/8.chunk.js +14 -920
  182. package/dist/scripts/8.chunk.js.map +1 -1
  183. package/dist/scripts/80.chunk.js +22 -313
  184. package/dist/scripts/80.chunk.js.map +1 -1
  185. package/dist/scripts/9.chunk.js +320 -17
  186. package/dist/scripts/9.chunk.js.map +1 -1
  187. package/dist/scripts/bundle-9ed1e126dd.min.js +15 -0
  188. package/dist/scripts/bundle.js +147 -121
  189. package/dist/scripts/bundle.js.map +1 -1
  190. package/dist/scripts/bundles.json +2 -2
  191. package/dist/scripts/pdf.worker.entry.worker.js +46239 -0
  192. package/dist/scripts/pdf.worker.entry.worker.js.map +1 -0
  193. package/dist/scripts/polyfills-2723daf478.min.js +1 -0
  194. package/package.json +2 -2
@@ -1,415 +1,999 @@
1
1
  (window["webpackJsonp_clickview_lite"] = window["webpackJsonp_clickview_lite"] || []).push([[79],{
2
2
 
3
- /***/ "../../libs/shared/src/apps/playlists/components/playlist-list/PlaylistItem.tsx":
4
- /*!**************************************************************************************************************************!*\
5
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/apps/playlists/components/playlist-list/PlaylistItem.tsx ***!
6
- \**************************************************************************************************************************/
7
- /*! exports provided: PlaylistItem */
8
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
9
-
10
- "use strict";
11
- __webpack_require__.r(__webpack_exports__);
12
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlaylistItem", function() { return PlaylistItem; });
13
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
14
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
15
- /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! moment */ "moment");
16
- /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__);
17
- /* harmony import */ var _utils_ImageHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../utils/ImageHelper */ "../../libs/shared/src/utils/ImageHelper.ts");
18
- /* harmony import */ var _utils_AudienceHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../utils/AudienceHelper */ "../../libs/shared/src/utils/AudienceHelper.ts");
19
- /* harmony import */ var _enums_Images__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../enums/Images */ "../../libs/shared/src/enums/Images.ts");
20
- /* harmony import */ var _components_text_Text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../components/text/Text */ "../../libs/shared/src/components/text/Text.tsx");
21
- /* harmony import */ var _components_app_link_AppLink__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../components/app-link/AppLink */ "../../libs/shared/src/components/app-link/AppLink.tsx");
22
- /* harmony import */ var _components_thumbnails_base_BaseThumbnail__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../components/thumbnails/base/BaseThumbnail */ "../../libs/shared/src/components/thumbnails/base/BaseThumbnail.tsx");
23
- /* harmony import */ var _components_thumbnails_base_ThumbnailFallback__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../components/thumbnails/base/ThumbnailFallback */ "../../libs/shared/src/components/thumbnails/base/ThumbnailFallback.tsx");
24
- /* harmony import */ var _components_audience_label_AudienceLabel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../../components/audience-label/AudienceLabel */ "../../libs/shared/src/components/audience-label/AudienceLabel.tsx");
25
- /* harmony import */ var _PlaylistOwnerAvatar__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./PlaylistOwnerAvatar */ "../../libs/shared/src/apps/playlists/components/playlist-list/PlaylistOwnerAvatar.tsx");
26
- /* harmony import */ var _playlist_scss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./playlist.scss */ "../../libs/shared/src/apps/playlists/components/playlist-list/playlist.scss");
27
- /* harmony import */ var _playlist_scss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_playlist_scss__WEBPACK_IMPORTED_MODULE_11__);
3
+ /***/ "../../../node_modules/intersection-observer/intersection-observer.js":
4
+ /*!****************************************************************************************************!*\
5
+ !*** C:/ClickView Projects/@clickview/node_modules/intersection-observer/intersection-observer.js ***!
6
+ \****************************************************************************************************/
7
+ /*! no static exports found */
8
+ /***/ (function(module, exports) {
9
+
10
+ /**
11
+ * Copyright 2016 Google Inc. All Rights Reserved.
12
+ *
13
+ * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
14
+ *
15
+ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
16
+ *
17
+ */
18
+ (function() {
19
+ 'use strict';
20
+
21
+ // Exit early if we're not running in a browser.
22
+ if (typeof window !== 'object') {
23
+ return;
24
+ }
28
25
 
26
+ // Exit early if all IntersectionObserver and IntersectionObserverEntry
27
+ // features are natively supported.
28
+ if ('IntersectionObserver' in window &&
29
+ 'IntersectionObserverEntry' in window &&
30
+ 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
31
+
32
+ // Minimal polyfill for Edge 15's lack of `isIntersecting`
33
+ // See: https://github.com/w3c/IntersectionObserver/issues/211
34
+ if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
35
+ Object.defineProperty(window.IntersectionObserverEntry.prototype,
36
+ 'isIntersecting', {
37
+ get: function () {
38
+ return this.intersectionRatio > 0;
39
+ }
40
+ });
41
+ }
42
+ return;
43
+ }
29
44
 
45
+ /**
46
+ * Returns the embedding frame element, if any.
47
+ * @param {!Document} doc
48
+ * @return {!Element}
49
+ */
50
+ function getFrameElement(doc) {
51
+ try {
52
+ return doc.defaultView && doc.defaultView.frameElement || null;
53
+ } catch (e) {
54
+ // Ignore the error.
55
+ return null;
56
+ }
57
+ }
30
58
 
59
+ /**
60
+ * A local reference to the root document.
61
+ */
62
+ var document = (function(startDoc) {
63
+ var doc = startDoc;
64
+ var frame = getFrameElement(doc);
65
+ while (frame) {
66
+ doc = frame.ownerDocument;
67
+ frame = getFrameElement(doc);
68
+ }
69
+ return doc;
70
+ })(window.document);
71
+
72
+ /**
73
+ * An IntersectionObserver registry. This registry exists to hold a strong
74
+ * reference to IntersectionObserver instances currently observing a target
75
+ * element. Without this registry, instances without another reference may be
76
+ * garbage collected.
77
+ */
78
+ var registry = [];
79
+
80
+ /**
81
+ * The signal updater for cross-origin intersection. When not null, it means
82
+ * that the polyfill is configured to work in a cross-origin mode.
83
+ * @type {function(DOMRect|ClientRect, DOMRect|ClientRect)}
84
+ */
85
+ var crossOriginUpdater = null;
86
+
87
+ /**
88
+ * The current cross-origin intersection. Only used in the cross-origin mode.
89
+ * @type {DOMRect|ClientRect}
90
+ */
91
+ var crossOriginRect = null;
92
+
93
+
94
+ /**
95
+ * Creates the global IntersectionObserverEntry constructor.
96
+ * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
97
+ * @param {Object} entry A dictionary of instance properties.
98
+ * @constructor
99
+ */
100
+ function IntersectionObserverEntry(entry) {
101
+ this.time = entry.time;
102
+ this.target = entry.target;
103
+ this.rootBounds = ensureDOMRect(entry.rootBounds);
104
+ this.boundingClientRect = ensureDOMRect(entry.boundingClientRect);
105
+ this.intersectionRect = ensureDOMRect(entry.intersectionRect || getEmptyRect());
106
+ this.isIntersecting = !!entry.intersectionRect;
107
+
108
+ // Calculates the intersection ratio.
109
+ var targetRect = this.boundingClientRect;
110
+ var targetArea = targetRect.width * targetRect.height;
111
+ var intersectionRect = this.intersectionRect;
112
+ var intersectionArea = intersectionRect.width * intersectionRect.height;
113
+
114
+ // Sets intersection ratio.
115
+ if (targetArea) {
116
+ // Round the intersection ratio to avoid floating point math issues:
117
+ // https://github.com/w3c/IntersectionObserver/issues/324
118
+ this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));
119
+ } else {
120
+ // If area is zero and is intersecting, sets to 1, otherwise to 0
121
+ this.intersectionRatio = this.isIntersecting ? 1 : 0;
122
+ }
123
+ }
31
124
 
32
125
 
126
+ /**
127
+ * Creates the global IntersectionObserver constructor.
128
+ * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
129
+ * @param {Function} callback The function to be invoked after intersection
130
+ * changes have queued. The function is not invoked if the queue has
131
+ * been emptied by calling the `takeRecords` method.
132
+ * @param {Object=} opt_options Optional configuration options.
133
+ * @constructor
134
+ */
135
+ function IntersectionObserver(callback, opt_options) {
33
136
 
137
+ var options = opt_options || {};
34
138
 
139
+ if (typeof callback != 'function') {
140
+ throw new Error('callback must be a function');
141
+ }
35
142
 
143
+ if (options.root && options.root.nodeType != 1) {
144
+ throw new Error('root must be an Element');
145
+ }
36
146
 
147
+ // Binds and throttles `this._checkForIntersections`.
148
+ this._checkForIntersections = throttle(
149
+ this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);
150
+
151
+ // Private properties.
152
+ this._callback = callback;
153
+ this._observationTargets = [];
154
+ this._queuedEntries = [];
155
+ this._rootMarginValues = this._parseRootMargin(options.rootMargin);
156
+
157
+ // Public properties.
158
+ this.thresholds = this._initThresholds(options.threshold);
159
+ this.root = options.root || null;
160
+ this.rootMargin = this._rootMarginValues.map(function(margin) {
161
+ return margin.value + margin.unit;
162
+ }).join(' ');
163
+
164
+ /** @private @const {!Array<!Document>} */
165
+ this._monitoringDocuments = [];
166
+ /** @private @const {!Array<function()>} */
167
+ this._monitoringUnsubscribes = [];
168
+ }
37
169
 
38
170
 
171
+ /**
172
+ * The minimum interval within which the document will be checked for
173
+ * intersection changes.
174
+ */
175
+ IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;
176
+
177
+
178
+ /**
179
+ * The frequency in which the polyfill polls for intersection changes.
180
+ * this can be updated on a per instance basis and must be set prior to
181
+ * calling `observe` on the first target.
182
+ */
183
+ IntersectionObserver.prototype.POLL_INTERVAL = null;
184
+
185
+ /**
186
+ * Use a mutation observer on the root element
187
+ * to detect intersection changes.
188
+ */
189
+ IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;
190
+
191
+
192
+ /**
193
+ * Sets up the polyfill in the cross-origin mode. The result is the
194
+ * updater function that accepts two arguments: `boundingClientRect` and
195
+ * `intersectionRect` - just as these fields would be available to the
196
+ * parent via `IntersectionObserverEntry`. This function should be called
197
+ * each time the iframe receives intersection information from the parent
198
+ * window, e.g. via messaging.
199
+ * @return {function(DOMRect|ClientRect, DOMRect|ClientRect)}
200
+ */
201
+ IntersectionObserver._setupCrossOriginUpdater = function() {
202
+ if (!crossOriginUpdater) {
203
+ /**
204
+ * @param {DOMRect|ClientRect} boundingClientRect
205
+ * @param {DOMRect|ClientRect} intersectionRect
206
+ */
207
+ crossOriginUpdater = function(boundingClientRect, intersectionRect) {
208
+ if (!boundingClientRect || !intersectionRect) {
209
+ crossOriginRect = getEmptyRect();
210
+ } else {
211
+ crossOriginRect = convertFromParentRect(boundingClientRect, intersectionRect);
212
+ }
213
+ registry.forEach(function(observer) {
214
+ observer._checkForIntersections();
215
+ });
216
+ };
217
+ }
218
+ return crossOriginUpdater;
219
+ };
39
220
 
40
- var namespace = 'playlists.playlistItem';
41
221
 
42
- function getBgColourClassName(playlist, classNames) {
43
- var bgClassName = classNames[playlist.name.charCodeAt(0) % classNames.length];
44
- return "".concat(_playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.playlistItem, " ").concat(bgClassName);
45
- }
222
+ /**
223
+ * Resets the cross-origin mode.
224
+ */
225
+ IntersectionObserver._resetCrossOriginUpdater = function() {
226
+ crossOriginUpdater = null;
227
+ crossOriginRect = null;
228
+ };
46
229
 
47
- function PlaylistItem(props) {
48
- var _a, _b;
49
230
 
50
- var imageUrl = _utils_ImageHelper__WEBPACK_IMPORTED_MODULE_2__["ImageHelper"].createUrl(props.data.cover && props.data.cover.url, {
51
- size: _enums_Images__WEBPACK_IMPORTED_MODULE_4__["ImageSize"].Medium,
52
- resizeType: _enums_Images__WEBPACK_IMPORTED_MODULE_4__["ResizeType"].Cover
231
+ /**
232
+ * Starts observing a target element for intersection changes based on
233
+ * the thresholds values.
234
+ * @param {Element} target The DOM element to observe.
235
+ */
236
+ IntersectionObserver.prototype.observe = function(target) {
237
+ var isTargetAlreadyObserved = this._observationTargets.some(function(item) {
238
+ return item.element == target;
53
239
  });
54
- var audiences = props.data.subjectPresentationAudiences && props.data.subjectPresentationAudiences.data;
55
- var filteredAudiences = audiences && props.presentationAudiences && _utils_AudienceHelper__WEBPACK_IMPORTED_MODULE_3__["AudienceHelper"].getSortedPresentationAudiences(audiences, props.presentationAudiences);
56
- var mergedAudience = filteredAudiences && _utils_AudienceHelper__WEBPACK_IMPORTED_MODULE_3__["AudienceHelper"].getMergedPresentationAudienceString(filteredAudiences);
57
- var count = !!props.showCount && !!props.data.videos && props.data.videos.count;
58
- var lastUpdated = !!props.showLastUpdated && props.data.contentModifiedDate && moment__WEBPACK_IMPORTED_MODULE_1__["utc"](props.data.contentModifiedDate).fromNow();
59
- var className = _playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.playlistItem;
60
- var showImage = !!imageUrl || !!props.showFallbackImage;
61
- if (showImage) className += " ".concat(_playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.playlistItemGradient);
62
- if (!showImage && props.bgColourClassNames) className += " ".concat(getBgColourClassName(props.data, props.bgColourClassNames));
63
- var analyticsData = Object.assign(Object.assign({}, props.analyticsData), {
64
- id: (_a = props.data) === null || _a === void 0 ? void 0 : _a.id,
65
- name: (_b = props.data) === null || _b === void 0 ? void 0 : _b.name
240
+
241
+ if (isTargetAlreadyObserved) {
242
+ return;
243
+ }
244
+
245
+ if (!(target && target.nodeType == 1)) {
246
+ throw new Error('target must be an Element');
247
+ }
248
+
249
+ this._registerInstance();
250
+ this._observationTargets.push({element: target, entry: null});
251
+ this._monitorIntersections(target.ownerDocument);
252
+ this._checkForIntersections();
253
+ };
254
+
255
+
256
+ /**
257
+ * Stops observing a target element for intersection changes.
258
+ * @param {Element} target The DOM element to observe.
259
+ */
260
+ IntersectionObserver.prototype.unobserve = function(target) {
261
+ this._observationTargets =
262
+ this._observationTargets.filter(function(item) {
263
+ return item.element != target;
264
+ });
265
+ this._unmonitorIntersections(target.ownerDocument);
266
+ if (this._observationTargets.length == 0) {
267
+ this._unregisterInstance();
268
+ }
269
+ };
270
+
271
+
272
+ /**
273
+ * Stops observing all target elements for intersection changes.
274
+ */
275
+ IntersectionObserver.prototype.disconnect = function() {
276
+ this._observationTargets = [];
277
+ this._unmonitorAllIntersections();
278
+ this._unregisterInstance();
279
+ };
280
+
281
+
282
+ /**
283
+ * Returns any queue entries that have not yet been reported to the
284
+ * callback and clears the queue. This can be used in conjunction with the
285
+ * callback to obtain the absolute most up-to-date intersection information.
286
+ * @return {Array} The currently queued entries.
287
+ */
288
+ IntersectionObserver.prototype.takeRecords = function() {
289
+ var records = this._queuedEntries.slice();
290
+ this._queuedEntries = [];
291
+ return records;
292
+ };
293
+
294
+
295
+ /**
296
+ * Accepts the threshold value from the user configuration object and
297
+ * returns a sorted array of unique threshold values. If a value is not
298
+ * between 0 and 1 and error is thrown.
299
+ * @private
300
+ * @param {Array|number=} opt_threshold An optional threshold value or
301
+ * a list of threshold values, defaulting to [0].
302
+ * @return {Array} A sorted list of unique and valid threshold values.
303
+ */
304
+ IntersectionObserver.prototype._initThresholds = function(opt_threshold) {
305
+ var threshold = opt_threshold || [0];
306
+ if (!Array.isArray(threshold)) threshold = [threshold];
307
+
308
+ return threshold.sort().filter(function(t, i, a) {
309
+ if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {
310
+ throw new Error('threshold must be a number between 0 and 1 inclusively');
311
+ }
312
+ return t !== a[i - 1];
66
313
  });
67
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_text_Text__WEBPACK_IMPORTED_MODULE_5__["LanguageNamespaceContext"].Provider, {
68
- value: namespace
69
- }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_app_link_AppLink__WEBPACK_IMPORTED_MODULE_6__["AppLink"], {
70
- appLink: props.appLink,
71
- analyticsData: analyticsData,
72
- analyticsOptions: props.analyticsOptions
73
- }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_thumbnails_base_BaseThumbnail__WEBPACK_IMPORTED_MODULE_7__["BaseThumbnail"], {
74
- data: imageUrl,
75
- className: className
76
- }, !!props.showFallbackImage && react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_thumbnails_base_ThumbnailFallback__WEBPACK_IMPORTED_MODULE_8__["ThumbnailFallback"], {
77
- type: _components_thumbnails_base_ThumbnailFallback__WEBPACK_IMPORTED_MODULE_8__["ThumbnailFallbackType"].Playlist
78
- }), react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
79
- className: "text-white ".concat(_playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.playlistMetadata)
80
- }, Number.isInteger(count) && react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_text_Text__WEBPACK_IMPORTED_MODULE_5__["Text"], {
81
- phrase: 'videos',
82
- options: {
83
- smartCount: count
314
+ };
315
+
316
+
317
+ /**
318
+ * Accepts the rootMargin value from the user configuration object
319
+ * and returns an array of the four margin values as an object containing
320
+ * the value and unit properties. If any of the values are not properly
321
+ * formatted or use a unit other than px or %, and error is thrown.
322
+ * @private
323
+ * @param {string=} opt_rootMargin An optional rootMargin value,
324
+ * defaulting to '0px'.
325
+ * @return {Array<Object>} An array of margin objects with the keys
326
+ * value and unit.
327
+ */
328
+ IntersectionObserver.prototype._parseRootMargin = function(opt_rootMargin) {
329
+ var marginString = opt_rootMargin || '0px';
330
+ var margins = marginString.split(/\s+/).map(function(margin) {
331
+ var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin);
332
+ if (!parts) {
333
+ throw new Error('rootMargin must be specified in pixels or percent');
84
334
  }
85
- }), react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("h5", {
86
- className: "".concat(_playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.playlistName, " text-shadow mb-0")
87
- }, props.data.name), !!lastUpdated && react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_text_Text__WEBPACK_IMPORTED_MODULE_5__["Text"], {
88
- phrase: 'lastUpdated',
89
- options: {
90
- timeAgo: lastUpdated
335
+ return {value: parseFloat(parts[1]), unit: parts[2]};
336
+ });
337
+
338
+ // Handles shorthand.
339
+ margins[1] = margins[1] || margins[0];
340
+ margins[2] = margins[2] || margins[0];
341
+ margins[3] = margins[3] || margins[1];
342
+
343
+ return margins;
344
+ };
345
+
346
+
347
+ /**
348
+ * Starts polling for intersection changes if the polling is not already
349
+ * happening, and if the page's visibility state is visible.
350
+ * @param {!Document} doc
351
+ * @private
352
+ */
353
+ IntersectionObserver.prototype._monitorIntersections = function(doc) {
354
+ var win = doc.defaultView;
355
+ if (!win) {
356
+ // Already destroyed.
357
+ return;
358
+ }
359
+ if (this._monitoringDocuments.indexOf(doc) != -1) {
360
+ // Already monitoring.
361
+ return;
362
+ }
363
+
364
+ // Private state for monitoring.
365
+ var callback = this._checkForIntersections;
366
+ var monitoringInterval = null;
367
+ var domObserver = null;
368
+
369
+ // If a poll interval is set, use polling instead of listening to
370
+ // resize and scroll events or DOM mutations.
371
+ if (this.POLL_INTERVAL) {
372
+ monitoringInterval = win.setInterval(callback, this.POLL_INTERVAL);
373
+ } else {
374
+ addEvent(win, 'resize', callback, true);
375
+ addEvent(doc, 'scroll', callback, true);
376
+ if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in win) {
377
+ domObserver = new win.MutationObserver(callback);
378
+ domObserver.observe(doc, {
379
+ attributes: true,
380
+ childList: true,
381
+ characterData: true,
382
+ subtree: true
383
+ });
91
384
  }
92
- }), !!audiences && !!audiences.length && !!mergedAudience && react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_audience_label_AudienceLabel__WEBPACK_IMPORTED_MODULE_9__["AudienceLabel"], {
93
- audience: mergedAudience,
94
- border: 'white'
95
- })), !!props.showOwner && !!props.imageCdnUrl && react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
96
- className: _playlist_scss__WEBPACK_IMPORTED_MODULE_11___default.a.ownerAvatarContainer
97
- }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_PlaylistOwnerAvatar__WEBPACK_IMPORTED_MODULE_10__["PlaylistOwnerAvatar"], {
98
- playlist: props.data,
99
- currentUser: props.currentUser,
100
- imageCdnUrl: props.imageCdnUrl
101
- })))));
102
- }
385
+ }
103
386
 
104
- /***/ }),
387
+ this._monitoringDocuments.push(doc);
388
+ this._monitoringUnsubscribes.push(function() {
389
+ // Get the window object again. When a friendly iframe is destroyed, it
390
+ // will be null.
391
+ var win = doc.defaultView;
105
392
 
106
- /***/ "../../libs/shared/src/apps/playlists/components/playlist-list/PlaylistOwnerAvatar.tsx":
107
- /*!*********************************************************************************************************************************!*\
108
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/apps/playlists/components/playlist-list/PlaylistOwnerAvatar.tsx ***!
109
- \*********************************************************************************************************************************/
110
- /*! exports provided: PlaylistOwnerAvatar */
111
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
393
+ if (win) {
394
+ if (monitoringInterval) {
395
+ win.clearInterval(monitoringInterval);
396
+ }
397
+ removeEvent(win, 'resize', callback, true);
398
+ }
112
399
 
113
- "use strict";
114
- __webpack_require__.r(__webpack_exports__);
115
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlaylistOwnerAvatar", function() { return PlaylistOwnerAvatar; });
116
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
117
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
118
- /* harmony import */ var _components_avatar_Avatar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../components/avatar/Avatar */ "../../libs/shared/src/components/avatar/Avatar.tsx");
119
- /* harmony import */ var _utils_UserHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../utils/UserHelper */ "../../libs/shared/src/utils/UserHelper.ts");
120
- /* harmony import */ var _components_clickview_avatar_ClickViewAvatar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../components/clickview-avatar/ClickViewAvatar */ "../../libs/shared/src/components/clickview-avatar/ClickViewAvatar.tsx");
400
+ removeEvent(doc, 'scroll', callback, true);
401
+ if (domObserver) {
402
+ domObserver.disconnect();
403
+ }
404
+ });
121
405
 
406
+ // Also monitor the parent.
407
+ if (doc != (this.root && this.root.ownerDocument || document)) {
408
+ var frame = getFrameElement(doc);
409
+ if (frame) {
410
+ this._monitorIntersections(frame.ownerDocument);
411
+ }
412
+ }
413
+ };
122
414
 
123
415
 
416
+ /**
417
+ * Stops polling for intersection changes.
418
+ * @param {!Document} doc
419
+ * @private
420
+ */
421
+ IntersectionObserver.prototype._unmonitorIntersections = function(doc) {
422
+ var index = this._monitoringDocuments.indexOf(doc);
423
+ if (index == -1) {
424
+ return;
425
+ }
124
426
 
125
- function PlaylistOwnerAvatar(props) {
126
- var _a, _b;
427
+ var rootDoc = (this.root && this.root.ownerDocument || document);
127
428
 
128
- var owner = props.playlist.owner;
129
- if (!owner || !props.currentUser) return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null);
130
- var currentUserIsOwner = props.playlist.owner.id === props.currentUser.id; // TODO: Replace this with actual property.
429
+ // Check if any dependent targets are still remaining.
430
+ var hasDependentTargets =
431
+ this._observationTargets.some(function(item) {
432
+ var itemDoc = item.element.ownerDocument;
433
+ // Target is in this context.
434
+ if (itemDoc == doc) {
435
+ return true;
436
+ }
437
+ // Target is nested in this context.
438
+ while (itemDoc && itemDoc != rootDoc) {
439
+ var frame = getFrameElement(itemDoc);
440
+ itemDoc = frame && frame.ownerDocument;
441
+ if (itemDoc == doc) {
442
+ return true;
443
+ }
444
+ }
445
+ return false;
446
+ });
447
+ if (hasDependentTargets) {
448
+ return;
449
+ }
131
450
 
132
- var isClickViewPlaylist = !!((_a = props.playlist.cover) === null || _a === void 0 ? void 0 : _a.url);
133
- if (isClickViewPlaylist) return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_clickview_avatar_ClickViewAvatar__WEBPACK_IMPORTED_MODULE_3__["ClickViewAvatar"], null);
134
- if (currentUserIsOwner) return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null);
135
- var url = typeof owner.avatar === 'string' ? owner.avatar : (_b = owner.avatar) === null || _b === void 0 ? void 0 : _b.url;
136
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_avatar_Avatar__WEBPACK_IMPORTED_MODULE_1__["Avatar"], {
137
- imageUrl: url,
138
- imageCdnUrl: props.imageCdnUrl,
139
- initials: _utils_UserHelper__WEBPACK_IMPORTED_MODULE_2__["UserHelper"].getInitials(owner.name, owner.surname)
140
- });
141
- }
451
+ // Unsubscribe.
452
+ var unsubscribe = this._monitoringUnsubscribes[index];
453
+ this._monitoringDocuments.splice(index, 1);
454
+ this._monitoringUnsubscribes.splice(index, 1);
455
+ unsubscribe();
456
+
457
+ // Also unmonitor the parent.
458
+ if (doc != rootDoc) {
459
+ var frame = getFrameElement(doc);
460
+ if (frame) {
461
+ this._unmonitorIntersections(frame.ownerDocument);
462
+ }
463
+ }
464
+ };
142
465
 
143
- /***/ }),
144
466
 
145
- /***/ "../../libs/shared/src/apps/playlists/components/playlist-list/playlist.scss":
146
- /*!***********************************************************************************************************************!*\
147
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/apps/playlists/components/playlist-list/playlist.scss ***!
148
- \***********************************************************************************************************************/
149
- /*! no static exports found */
150
- /***/ (function(module, exports, __webpack_require__) {
151
-
152
- // extracted by mini-css-extract-plugin
153
- module.exports = {"playlistItem":"cv--playlistItem--6o0Z2","playlistItemGradient":"cv--playlistItemGradient--2JLPt","playlistMetadata":"cv--playlistMetadata--3MCKL","playlistName":"cv--playlistName--1Ukz7","partialHeading":"cv--partialHeading--13tO6","ownerAvatarContainer":"cv--ownerAvatarContainer--CwjTl"};
154
-
155
- /***/ }),
156
-
157
- /***/ "../../libs/shared/src/components/audience-label/AudienceLabel.tsx":
158
- /*!*************************************************************************************************************!*\
159
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/components/audience-label/AudienceLabel.tsx ***!
160
- \*************************************************************************************************************/
161
- /*! exports provided: AudienceLabel, AudienceLabelList */
162
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
163
-
164
- "use strict";
165
- __webpack_require__.r(__webpack_exports__);
166
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AudienceLabel", function() { return AudienceLabel; });
167
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AudienceLabelList", function() { return AudienceLabelList; });
168
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
169
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
170
- /* harmony import */ var _audience_label_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./audience-label.scss */ "../../libs/shared/src/components/audience-label/audience-label.scss");
171
- /* harmony import */ var _audience_label_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_audience_label_scss__WEBPACK_IMPORTED_MODULE_1__);
172
-
173
-
174
- function AudienceLabel(props) {
175
- if (!props.audience) return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null);
176
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
177
- className: "border rounded-pill d-inline-block px-2 mt-1 ".concat('border-' + props.border)
178
- }, props.audience.name);
179
- }
180
- function AudienceLabelList(props) {
181
- if (!props.audiences || !props.audiences.length) return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null);
182
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, props.audiences.map(function (a, idx) {
183
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", {
184
- key: idx,
185
- className: _audience_label_scss__WEBPACK_IMPORTED_MODULE_1___default.a.audienceLabelListItem
186
- }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](AudienceLabel, {
187
- audience: a,
188
- border: props.border
189
- }));
190
- }));
191
- }
467
+ /**
468
+ * Stops polling for intersection changes.
469
+ * @param {!Document} doc
470
+ * @private
471
+ */
472
+ IntersectionObserver.prototype._unmonitorAllIntersections = function() {
473
+ var unsubscribes = this._monitoringUnsubscribes.slice(0);
474
+ this._monitoringDocuments.length = 0;
475
+ this._monitoringUnsubscribes.length = 0;
476
+ for (var i = 0; i < unsubscribes.length; i++) {
477
+ unsubscribes[i]();
478
+ }
479
+ };
192
480
 
193
- /***/ }),
194
481
 
195
- /***/ "../../libs/shared/src/components/audience-label/audience-label.scss":
196
- /*!***************************************************************************************************************!*\
197
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/components/audience-label/audience-label.scss ***!
198
- \***************************************************************************************************************/
199
- /*! no static exports found */
200
- /***/ (function(module, exports, __webpack_require__) {
482
+ /**
483
+ * Scans each observation target for intersection changes and adds them
484
+ * to the internal entries queue. If new entries are found, it
485
+ * schedules the callback to be invoked.
486
+ * @private
487
+ */
488
+ IntersectionObserver.prototype._checkForIntersections = function() {
489
+ if (!this.root && crossOriginUpdater && !crossOriginRect) {
490
+ // Cross origin monitoring, but no initial data available yet.
491
+ return;
492
+ }
201
493
 
202
- // extracted by mini-css-extract-plugin
203
- module.exports = {"audienceLabelListItem":"cv--audienceLabelListItem--2YGVO"};
494
+ var rootIsInDom = this._rootIsInDom();
495
+ var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect();
496
+
497
+ this._observationTargets.forEach(function(item) {
498
+ var target = item.element;
499
+ var targetRect = getBoundingClientRect(target);
500
+ var rootContainsTarget = this._rootContainsTarget(target);
501
+ var oldEntry = item.entry;
502
+ var intersectionRect = rootIsInDom && rootContainsTarget &&
503
+ this._computeTargetAndRootIntersection(target, targetRect, rootRect);
504
+
505
+ var newEntry = item.entry = new IntersectionObserverEntry({
506
+ time: now(),
507
+ target: target,
508
+ boundingClientRect: targetRect,
509
+ rootBounds: crossOriginUpdater && !this.root ? null : rootRect,
510
+ intersectionRect: intersectionRect
511
+ });
512
+
513
+ if (!oldEntry) {
514
+ this._queuedEntries.push(newEntry);
515
+ } else if (rootIsInDom && rootContainsTarget) {
516
+ // If the new entry intersection ratio has crossed any of the
517
+ // thresholds, add a new entry.
518
+ if (this._hasCrossedThreshold(oldEntry, newEntry)) {
519
+ this._queuedEntries.push(newEntry);
520
+ }
521
+ } else {
522
+ // If the root is not in the DOM or target is not contained within
523
+ // root but the previous entry for this target had an intersection,
524
+ // add a new record indicating removal.
525
+ if (oldEntry && oldEntry.isIntersecting) {
526
+ this._queuedEntries.push(newEntry);
527
+ }
528
+ }
529
+ }, this);
204
530
 
205
- /***/ }),
531
+ if (this._queuedEntries.length) {
532
+ this._callback(this.takeRecords(), this);
533
+ }
534
+ };
206
535
 
207
- /***/ "../../libs/shared/src/components/clickview-avatar/ClickViewAvatar.tsx":
208
- /*!*****************************************************************************************************************!*\
209
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/components/clickview-avatar/ClickViewAvatar.tsx ***!
210
- \*****************************************************************************************************************/
211
- /*! exports provided: ClickViewAvatar */
212
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
213
536
 
214
- "use strict";
215
- __webpack_require__.r(__webpack_exports__);
216
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClickViewAvatar", function() { return ClickViewAvatar; });
217
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
218
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
219
- /* harmony import */ var _svgs_clickview_logo_ClickViewLogo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../svgs/clickview-logo/ClickViewLogo */ "../../libs/shared/src/components/svgs/clickview-logo/ClickViewLogo.tsx");
220
- /* harmony import */ var _clickview_avatar_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./clickview-avatar.scss */ "../../libs/shared/src/components/clickview-avatar/clickview-avatar.scss");
221
- /* harmony import */ var _clickview_avatar_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_clickview_avatar_scss__WEBPACK_IMPORTED_MODULE_2__);
537
+ /**
538
+ * Accepts a target and root rect computes the intersection between then
539
+ * following the algorithm in the spec.
540
+ * TODO(philipwalton): at this time clip-path is not considered.
541
+ * https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo
542
+ * @param {Element} target The target DOM element
543
+ * @param {Object} targetRect The bounding rect of the target.
544
+ * @param {Object} rootRect The bounding rect of the root after being
545
+ * expanded by the rootMargin value.
546
+ * @return {?Object} The final intersection rect object or undefined if no
547
+ * intersection is found.
548
+ * @private
549
+ */
550
+ IntersectionObserver.prototype._computeTargetAndRootIntersection =
551
+ function(target, targetRect, rootRect) {
552
+ // If the element isn't displayed, an intersection can't happen.
553
+ if (window.getComputedStyle(target).display == 'none') return;
554
+
555
+ var intersectionRect = targetRect;
556
+ var parent = getParentNode(target);
557
+ var atRoot = false;
558
+
559
+ while (!atRoot && parent) {
560
+ var parentRect = null;
561
+ var parentComputedStyle = parent.nodeType == 1 ?
562
+ window.getComputedStyle(parent) : {};
563
+
564
+ // If the parent isn't displayed, an intersection can't happen.
565
+ if (parentComputedStyle.display == 'none') return null;
566
+
567
+ if (parent == this.root || parent.nodeType == /* DOCUMENT */ 9) {
568
+ atRoot = true;
569
+ if (parent == this.root || parent == document) {
570
+ if (crossOriginUpdater && !this.root) {
571
+ if (!crossOriginRect ||
572
+ crossOriginRect.width == 0 && crossOriginRect.height == 0) {
573
+ // A 0-size cross-origin intersection means no-intersection.
574
+ parent = null;
575
+ parentRect = null;
576
+ intersectionRect = null;
577
+ } else {
578
+ parentRect = crossOriginRect;
579
+ }
580
+ } else {
581
+ parentRect = rootRect;
582
+ }
583
+ } else {
584
+ // Check if there's a frame that can be navigated to.
585
+ var frame = getParentNode(parent);
586
+ var frameRect = frame && getBoundingClientRect(frame);
587
+ var frameIntersect =
588
+ frame &&
589
+ this._computeTargetAndRootIntersection(frame, frameRect, rootRect);
590
+ if (frameRect && frameIntersect) {
591
+ parent = frame;
592
+ parentRect = convertFromParentRect(frameRect, frameIntersect);
593
+ } else {
594
+ parent = null;
595
+ intersectionRect = null;
596
+ }
597
+ }
598
+ } else {
599
+ // If the element has a non-visible overflow, and it's not the <body>
600
+ // or <html> element, update the intersection rect.
601
+ // Note: <body> and <html> cannot be clipped to a rect that's not also
602
+ // the document rect, so no need to compute a new intersection.
603
+ var doc = parent.ownerDocument;
604
+ if (parent != doc.body &&
605
+ parent != doc.documentElement &&
606
+ parentComputedStyle.overflow != 'visible') {
607
+ parentRect = getBoundingClientRect(parent);
608
+ }
609
+ }
222
610
 
611
+ // If either of the above conditionals set a new parentRect,
612
+ // calculate new intersection data.
613
+ if (parentRect) {
614
+ intersectionRect = computeRectIntersection(parentRect, intersectionRect);
615
+ }
616
+ if (!intersectionRect) break;
617
+ parent = parent && getParentNode(parent);
618
+ }
619
+ return intersectionRect;
620
+ };
223
621
 
224
622
 
225
- function ClickViewAvatar() {
226
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
227
- className: _clickview_avatar_scss__WEBPACK_IMPORTED_MODULE_2__["avatar"]
228
- }, react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_svgs_clickview_logo_ClickViewLogo__WEBPACK_IMPORTED_MODULE_1__["ClickViewPlayLogo"], null));
229
- }
623
+ /**
624
+ * Returns the root rect after being expanded by the rootMargin value.
625
+ * @return {ClientRect} The expanded root rect.
626
+ * @private
627
+ */
628
+ IntersectionObserver.prototype._getRootRect = function() {
629
+ var rootRect;
630
+ if (this.root) {
631
+ rootRect = getBoundingClientRect(this.root);
632
+ } else {
633
+ // Use <html>/<body> instead of window since scroll bars affect size.
634
+ var html = document.documentElement;
635
+ var body = document.body;
636
+ rootRect = {
637
+ top: 0,
638
+ left: 0,
639
+ right: html.clientWidth || body.clientWidth,
640
+ width: html.clientWidth || body.clientWidth,
641
+ bottom: html.clientHeight || body.clientHeight,
642
+ height: html.clientHeight || body.clientHeight
643
+ };
644
+ }
645
+ return this._expandRectByRootMargin(rootRect);
646
+ };
230
647
 
231
- /***/ }),
232
648
 
233
- /***/ "../../libs/shared/src/components/clickview-avatar/clickview-avatar.scss":
234
- /*!*******************************************************************************************************************!*\
235
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/components/clickview-avatar/clickview-avatar.scss ***!
236
- \*******************************************************************************************************************/
237
- /*! no static exports found */
238
- /***/ (function(module, exports, __webpack_require__) {
239
-
240
- // extracted by mini-css-extract-plugin
241
- module.exports = {"avatar":"cv--avatar--1IfFN"};
242
-
243
- /***/ }),
244
-
245
- /***/ "../../libs/shared/src/utils/AudienceHelper.ts":
246
- /*!*****************************************************************************************!*\
247
- !*** C:/ClickView Projects/@clickview/packages/libs/shared/src/utils/AudienceHelper.ts ***!
248
- \*****************************************************************************************/
249
- /*! exports provided: AudienceHelper */
250
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
251
-
252
- "use strict";
253
- __webpack_require__.r(__webpack_exports__);
254
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AudienceHelper", function() { return AudienceHelper; });
255
- /* harmony import */ var _common_src_react_utils_ArrayHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../common/src/react/utils/ArrayHelper */ "../../libs/common/src/react/utils/ArrayHelper.ts");
256
-
257
- var DIGIT_REGEX = /([0-9]+)/ig;
258
- var NAME_REGEX = /(^\w+)/ig;
259
- var COUNT_OFFSET = 1;
260
-
261
- function processAudienceRanges(audienceValues) {
262
- /**
263
- * Lookahead by increments of offset
264
- */
265
- var offset = COUNT_OFFSET;
266
- var initialVal, nextVal;
267
- var isContinguous = false;
268
- var ranges = []; // Audience values need to be in ascending order
269
-
270
- audienceValues = audienceValues.sort(function (a, b) {
271
- return a - b;
649
+ /**
650
+ * Accepts a rect and expands it by the rootMargin value.
651
+ * @param {DOMRect|ClientRect} rect The rect object to expand.
652
+ * @return {ClientRect} The expanded rect.
653
+ * @private
654
+ */
655
+ IntersectionObserver.prototype._expandRectByRootMargin = function(rect) {
656
+ var margins = this._rootMarginValues.map(function(margin, i) {
657
+ return margin.unit == 'px' ? margin.value :
658
+ margin.value * (i % 2 ? rect.width : rect.height) / 100;
272
659
  });
273
- var i, j;
660
+ var newRect = {
661
+ top: rect.top - margins[0],
662
+ right: rect.right + margins[1],
663
+ bottom: rect.bottom + margins[2],
664
+ left: rect.left - margins[3]
665
+ };
666
+ newRect.width = newRect.right - newRect.left;
667
+ newRect.height = newRect.bottom - newRect.top;
668
+
669
+ return newRect;
670
+ };
274
671
 
275
- for (i = 0; i < audienceValues.length; i++) {
276
- j = i + 1; // Set our lower boundary to compare against
277
672
 
278
- if (!isContinguous) initialVal = audienceValues[i];
279
- nextVal = audienceValues[j];
280
- /**
281
- * Where the next number is also the next incremental value
282
- * we're going to continue iterating until the next value
283
- * is no longer contiguos.
284
- */
673
+ /**
674
+ * Accepts an old and new entry and returns true if at least one of the
675
+ * threshold values has been crossed.
676
+ * @param {?IntersectionObserverEntry} oldEntry The previous entry for a
677
+ * particular target element or null if no previous entry exists.
678
+ * @param {IntersectionObserverEntry} newEntry The current entry for a
679
+ * particular target element.
680
+ * @return {boolean} Returns true if a any threshold has been crossed.
681
+ * @private
682
+ */
683
+ IntersectionObserver.prototype._hasCrossedThreshold =
684
+ function(oldEntry, newEntry) {
685
+
686
+ // To make comparing easier, an entry that has a ratio of 0
687
+ // but does not actually intersect is given a value of -1
688
+ var oldRatio = oldEntry && oldEntry.isIntersecting ?
689
+ oldEntry.intersectionRatio || 0 : -1;
690
+ var newRatio = newEntry.isIntersecting ?
691
+ newEntry.intersectionRatio || 0 : -1;
692
+
693
+ // Ignore unchanged ratios
694
+ if (oldRatio === newRatio) return;
695
+
696
+ for (var i = 0; i < this.thresholds.length; i++) {
697
+ var threshold = this.thresholds[i];
698
+
699
+ // Return true if an entry matches a threshold or if the new ratio
700
+ // and the old ratio are on the opposite sides of a threshold.
701
+ if (threshold == oldRatio || threshold == newRatio ||
702
+ threshold < oldRatio !== threshold < newRatio) {
703
+ return true;
704
+ }
705
+ }
706
+ };
285
707
 
286
- if (audienceValues[i] + offset === nextVal) {
287
- isContinguous = true;
288
- } else if (isContinguous) {
289
- /**
290
- * Where we were tracking a contiguous set, format appropriately
291
- * and store the vals
292
- */
293
- ranges.push("".concat(initialVal, " - ").concat(audienceValues[i]));
294
- isContinguous = false;
295
- } else {
296
- /**
297
- * Where the values arent contiguous, just store the current value
298
- */
299
- ranges.push("".concat(audienceValues[i]));
300
- isContinguous = false;
708
+
709
+ /**
710
+ * Returns whether or not the root element is an element and is in the DOM.
711
+ * @return {boolean} True if the root element is an element and is in the DOM.
712
+ * @private
713
+ */
714
+ IntersectionObserver.prototype._rootIsInDom = function() {
715
+ return !this.root || containsDeep(document, this.root);
716
+ };
717
+
718
+
719
+ /**
720
+ * Returns whether or not the target element is a child of root.
721
+ * @param {Element} target The target element to check.
722
+ * @return {boolean} True if the target element is a child of root.
723
+ * @private
724
+ */
725
+ IntersectionObserver.prototype._rootContainsTarget = function(target) {
726
+ return containsDeep(this.root || document, target) &&
727
+ (!this.root || this.root.ownerDocument == target.ownerDocument);
728
+ };
729
+
730
+
731
+ /**
732
+ * Adds the instance to the global IntersectionObserver registry if it isn't
733
+ * already present.
734
+ * @private
735
+ */
736
+ IntersectionObserver.prototype._registerInstance = function() {
737
+ if (registry.indexOf(this) < 0) {
738
+ registry.push(this);
739
+ }
740
+ };
741
+
742
+
743
+ /**
744
+ * Removes the instance from the global IntersectionObserver registry.
745
+ * @private
746
+ */
747
+ IntersectionObserver.prototype._unregisterInstance = function() {
748
+ var index = registry.indexOf(this);
749
+ if (index != -1) registry.splice(index, 1);
750
+ };
751
+
752
+
753
+ /**
754
+ * Returns the result of the performance.now() method or null in browsers
755
+ * that don't support the API.
756
+ * @return {number} The elapsed time since the page was requested.
757
+ */
758
+ function now() {
759
+ return window.performance && performance.now && performance.now();
760
+ }
761
+
762
+
763
+ /**
764
+ * Throttles a function and delays its execution, so it's only called at most
765
+ * once within a given time period.
766
+ * @param {Function} fn The function to throttle.
767
+ * @param {number} timeout The amount of time that must pass before the
768
+ * function can be called again.
769
+ * @return {Function} The throttled function.
770
+ */
771
+ function throttle(fn, timeout) {
772
+ var timer = null;
773
+ return function () {
774
+ if (!timer) {
775
+ timer = setTimeout(function() {
776
+ fn();
777
+ timer = null;
778
+ }, timeout);
301
779
  }
780
+ };
781
+ }
782
+
783
+
784
+ /**
785
+ * Adds an event handler to a DOM node ensuring cross-browser compatibility.
786
+ * @param {Node} node The DOM node to add the event handler to.
787
+ * @param {string} event The event name.
788
+ * @param {Function} fn The event handler to add.
789
+ * @param {boolean} opt_useCapture Optionally adds the even to the capture
790
+ * phase. Note: this only works in modern browsers.
791
+ */
792
+ function addEvent(node, event, fn, opt_useCapture) {
793
+ if (typeof node.addEventListener == 'function') {
794
+ node.addEventListener(event, fn, opt_useCapture || false);
795
+ }
796
+ else if (typeof node.attachEvent == 'function') {
797
+ node.attachEvent('on' + event, fn);
302
798
  }
799
+ }
800
+
303
801
 
304
- return ranges;
802
+ /**
803
+ * Removes a previously added event handler from a DOM node.
804
+ * @param {Node} node The DOM node to remove the event handler from.
805
+ * @param {string} event The event name.
806
+ * @param {Function} fn The event handler to remove.
807
+ * @param {boolean} opt_useCapture If the event handler was added with this
808
+ * flag set to true, it should be set to true here in order to remove it.
809
+ */
810
+ function removeEvent(node, event, fn, opt_useCapture) {
811
+ if (typeof node.removeEventListener == 'function') {
812
+ node.removeEventListener(event, fn, opt_useCapture || false);
813
+ }
814
+ else if (typeof node.detatchEvent == 'function') {
815
+ node.detatchEvent('on' + event, fn);
816
+ }
305
817
  }
306
818
 
307
- var AudienceHelper = {
308
- /**
309
- * This is needed to sort an object's audiences, as they are not sorted by the backend.
310
- * To do this, we take the presentation audiences (sorted) and filter them by the object's
311
- * audiences, leaving behind a sorted array of object audiences.
312
- */
313
- getSortedPresentationAudiences: function getSortedPresentationAudiences(objectAudiences, presentationAudiences) {
314
- var objectAudienceIds = objectAudiences.map(function (audience) {
315
- return audience.id.toString();
316
- });
317
- /**
318
- * Remove audiences that aren't relevant for the user's current presentation
319
- */
320
819
 
321
- var filteredAudiences = presentationAudiences.filter(function (presAudience) {
322
- return objectAudienceIds.includes(presAudience.masterId.toString());
323
- });
324
- return filteredAudiences;
325
- },
326
- getMergedPresentationAudienceString: function getMergedPresentationAudienceString(presentationAudiences) {
327
- if (presentationAudiences.length === 1) return presentationAudiences[0];
328
- /**
329
- * Create a string with all of the audiences
330
- */
820
+ /**
821
+ * Returns the intersection between two rect objects.
822
+ * @param {Object} rect1 The first rect.
823
+ * @param {Object} rect2 The second rect.
824
+ * @return {?Object|?ClientRect} The intersection rect or undefined if no
825
+ * intersection is found.
826
+ */
827
+ function computeRectIntersection(rect1, rect2) {
828
+ var top = Math.max(rect1.top, rect2.top);
829
+ var bottom = Math.min(rect1.bottom, rect2.bottom);
830
+ var left = Math.max(rect1.left, rect2.left);
831
+ var right = Math.min(rect1.right, rect2.right);
832
+ var width = right - left;
833
+ var height = bottom - top;
834
+
835
+ return (width >= 0 && height >= 0) && {
836
+ top: top,
837
+ bottom: bottom,
838
+ left: left,
839
+ right: right,
840
+ width: width,
841
+ height: height
842
+ } || null;
843
+ }
331
844
 
332
- var valuesStr = presentationAudiences.map(function (a) {
333
- return a.name;
334
- }).join(',');
335
- /**
336
- * Extract all the numbers and matches from the string
337
- * Where there aren't matches, just return the first Audience.
338
- */
339
845
 
340
- var valMatches = valuesStr.match(DIGIT_REGEX);
341
- var nameMatches = valuesStr.match(NAME_REGEX);
342
- if (!valMatches || !nameMatches) return presentationAudiences[0];
343
- var audienceValues = valMatches.map(function (l) {
344
- return +l;
345
- }) || [];
346
- /**
347
- * Build set of logical audience ranges
348
- */
846
+ /**
847
+ * Shims the native getBoundingClientRect for compatibility with older IE.
848
+ * @param {Element} el The element whose bounding rect to get.
849
+ * @return {DOMRect|ClientRect} The (possibly shimmed) rect of the element.
850
+ */
851
+ function getBoundingClientRect(el) {
852
+ var rect;
349
853
 
350
- var audienceRange = processAudienceRanges(audienceValues);
351
- /**
352
- * Get matches name
353
- */
854
+ try {
855
+ rect = el.getBoundingClientRect();
856
+ } catch (err) {
857
+ // Ignore Windows 7 IE11 "Unspecified error"
858
+ // https://github.com/w3c/IntersectionObserver/pull/205
859
+ }
354
860
 
355
- var audienceName = nameMatches[0];
356
- return {
357
- name: "".concat(audienceName, " ").concat(audienceRange.join(' , '))
861
+ if (!rect) return getEmptyRect();
862
+
863
+ // Older IE
864
+ if (!(rect.width && rect.height)) {
865
+ rect = {
866
+ top: rect.top,
867
+ right: rect.right,
868
+ bottom: rect.bottom,
869
+ left: rect.left,
870
+ width: rect.right - rect.left,
871
+ height: rect.bottom - rect.top
358
872
  };
359
- },
360
-
361
- /**
362
- * This function assumes the members array passed in is ordered by `name`.
363
- */
364
- sortMembersWithDuplicateNamesByAudience: function sortMembersWithDuplicateNamesByAudience(members) {
365
- // Returns the lowest level audience out of an array of audience objects by looking at the name
366
- var getLowestAudience = function getLowestAudience(audiences) {
367
- if (!audiences.length) return null;
368
- var lowestAudience;
369
- var lowestAudienceDigit;
370
- audiences.forEach(function (audience) {
371
- var digit = +_common_src_react_utils_ArrayHelper__WEBPACK_IMPORTED_MODULE_0__["ArrayHelper"].first(audience.name.match(DIGIT_REGEX));
372
-
373
- if (!lowestAudience) {
374
- lowestAudience = audience;
375
- lowestAudienceDigit = digit;
376
- return;
377
- }
873
+ }
874
+ return rect;
875
+ }
378
876
 
379
- if (digit < lowestAudienceDigit) lowestAudience = audience;
380
- });
381
- return lowestAudience;
382
- }; // This is used to track how many times a member's name appears in the collection
383
877
 
878
+ /**
879
+ * Returns an empty rect object. An empty rect is returned when an element
880
+ * is not in the DOM.
881
+ * @return {ClientRect} The empty rect.
882
+ */
883
+ function getEmptyRect() {
884
+ return {
885
+ top: 0,
886
+ bottom: 0,
887
+ left: 0,
888
+ right: 0,
889
+ width: 0,
890
+ height: 0
891
+ };
892
+ }
384
893
 
385
- var nameCountMap = {};
386
- var sorted = [];
387
- members.forEach(function (member) {
388
- if (!nameCountMap[member.name]) {
389
- nameCountMap[member.name] = 1;
390
- sorted.push(member);
391
- return;
392
- }
393
894
 
394
- sorted.push(member);
395
- nameCountMap[member.name]++; // Take the slice of duplicates that we want to sort by audience
895
+ /**
896
+ * Ensure that the result has all of the necessary fields of the DOMRect.
897
+ * Specifically this ensures that `x` and `y` fields are set.
898
+ *
899
+ * @param {?DOMRect|?ClientRect} rect
900
+ * @return {?DOMRect}
901
+ */
902
+ function ensureDOMRect(rect) {
903
+ // A `DOMRect` object has `x` and `y` fields.
904
+ if (!rect || 'x' in rect) {
905
+ return rect;
906
+ }
907
+ // A IE's `ClientRect` type does not have `x` and `y`. The same is the case
908
+ // for internally calculated Rect objects. For the purposes of
909
+ // `IntersectionObserver`, it's sufficient to simply mirror `left` and `top`
910
+ // for these fields.
911
+ return {
912
+ top: rect.top,
913
+ y: rect.top,
914
+ bottom: rect.bottom,
915
+ left: rect.left,
916
+ x: rect.left,
917
+ right: rect.right,
918
+ width: rect.width,
919
+ height: rect.height
920
+ };
921
+ }
396
922
 
397
- var slice = sorted.splice(sorted.length - nameCountMap[member.name]); // Sort the slice by lowest audience
398
923
 
399
- var sortedSlice = slice.sort(function (a, b) {
400
- var firstObjLowestAudience = getLowestAudience(a.subjectPresentationAudiences.data);
401
- var secondObjLowestAudience = getLowestAudience(b.subjectPresentationAudiences.data);
402
- if (!firstObjLowestAudience && secondObjLowestAudience) return 1;
403
- if (!secondObjLowestAudience) return -1;
404
- var comparison = firstObjLowestAudience.name.localeCompare(secondObjLowestAudience.name);
405
- if (comparison === 0) return comparison;
406
- return comparison > 0 ? -1 : 1;
407
- });
408
- sorted = sorted.concat(sortedSlice);
409
- });
410
- return sorted;
924
+ /**
925
+ * Inverts the intersection and bounding rect from the parent (frame) BCR to
926
+ * the local BCR space.
927
+ * @param {DOMRect|ClientRect} parentBoundingRect The parent's bound client rect.
928
+ * @param {DOMRect|ClientRect} parentIntersectionRect The parent's own intersection rect.
929
+ * @return {ClientRect} The local root bounding rect for the parent's children.
930
+ */
931
+ function convertFromParentRect(parentBoundingRect, parentIntersectionRect) {
932
+ var top = parentIntersectionRect.top - parentBoundingRect.top;
933
+ var left = parentIntersectionRect.left - parentBoundingRect.left;
934
+ return {
935
+ top: top,
936
+ left: left,
937
+ height: parentIntersectionRect.height,
938
+ width: parentIntersectionRect.width,
939
+ bottom: top + parentIntersectionRect.height,
940
+ right: left + parentIntersectionRect.width
941
+ };
942
+ }
943
+
944
+
945
+ /**
946
+ * Checks to see if a parent element contains a child element (including inside
947
+ * shadow DOM).
948
+ * @param {Node} parent The parent element.
949
+ * @param {Node} child The child element.
950
+ * @return {boolean} True if the parent node contains the child node.
951
+ */
952
+ function containsDeep(parent, child) {
953
+ var node = child;
954
+ while (node) {
955
+ if (node == parent) return true;
956
+
957
+ node = getParentNode(node);
411
958
  }
412
- };
959
+ return false;
960
+ }
961
+
962
+
963
+ /**
964
+ * Gets the parent node of an element or its host element if the parent node
965
+ * is a shadow root.
966
+ * @param {Node} node The node whose parent to get.
967
+ * @return {Node|null} The parent node or null if no parent exists.
968
+ */
969
+ function getParentNode(node) {
970
+ var parent = node.parentNode;
971
+
972
+ if (node.nodeType == /* DOCUMENT */ 9 && node != document) {
973
+ // If this node is a document node, look for the embedding frame.
974
+ return getFrameElement(node);
975
+ }
976
+
977
+ if (parent && parent.nodeType == 11 && parent.host) {
978
+ // If the parent is a shadow root, return the host element.
979
+ return parent.host;
980
+ }
981
+
982
+ if (parent && parent.assignedSlot) {
983
+ // If the parent is distributed in a <slot>, return the parent of a slot.
984
+ return parent.assignedSlot.parentNode;
985
+ }
986
+
987
+ return parent;
988
+ }
989
+
990
+
991
+ // Exposes the constructors globally.
992
+ window.IntersectionObserver = IntersectionObserver;
993
+ window.IntersectionObserverEntry = IntersectionObserverEntry;
994
+
995
+ }());
996
+
413
997
 
414
998
  /***/ })
415
999