@eluvio/elv-player-js 1.0.140 → 2.0.1

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 (102) hide show
  1. package/README.md +35 -6
  2. package/dist/.vite/manifest.json +67 -0
  3. package/dist/Analytics-HWXR7tWt.mjs +2028 -0
  4. package/dist/Analytics-IUVysdzU.js +29 -0
  5. package/dist/dash.all.min-1QS9Xbir.js +25 -0
  6. package/dist/dash.all.min-9V1xYBRv.mjs +19428 -0
  7. package/dist/elv-player-js.cjs.js +1 -0
  8. package/dist/elv-player-js.css +1 -0
  9. package/dist/elv-player-js.es.js +5 -0
  10. package/dist/hls-1eCRapWm.mjs +15461 -0
  11. package/dist/hls-6O5SV1FQ.js +26 -0
  12. package/dist/index-6cMQneJf.mjs +2273 -0
  13. package/dist/index-C8mwW09z.js +23 -0
  14. package/dist/index-J4QpmTkA.js +367 -0
  15. package/dist/index-hvQzQ6UX.mjs +67432 -0
  16. package/lib/index.js +7 -0
  17. package/{src → lib/player}/Analytics.js +9 -8
  18. package/lib/player/Controls.js +913 -0
  19. package/{src → lib/player}/FairPlay.js +2 -0
  20. package/lib/player/Player.js +881 -0
  21. package/lib/player/PlayerParameters.js +173 -0
  22. package/lib/static/icons/Icons.js +29 -0
  23. package/lib/static/icons/svgs/backward-circle.svg +5 -0
  24. package/lib/static/icons/svgs/backward.svg +4 -0
  25. package/lib/static/icons/svgs/captions-off.svg +7 -0
  26. package/lib/static/icons/svgs/captions.svg +6 -0
  27. package/lib/static/icons/svgs/check.svg +1 -0
  28. package/lib/static/icons/svgs/chevron-left.svg +1 -0
  29. package/lib/static/icons/svgs/chevron-right.svg +1 -0
  30. package/lib/static/icons/svgs/forward-circle.svg +5 -0
  31. package/lib/static/icons/svgs/forward.svg +4 -0
  32. package/{src/static/icons/media/Full Screen icon.svg → lib/static/icons/svgs/full-screen.svg} +1 -1
  33. package/lib/static/icons/svgs/large-play-circle.svg +4 -0
  34. package/lib/static/icons/svgs/list.svg +1 -0
  35. package/{src/static/icons → lib/static/icons/svgs}/minimize.svg +1 -1
  36. package/{src/static/icons/media/Pause icon.svg → lib/static/icons/svgs/pause-circle.svg} +3 -3
  37. package/lib/static/icons/svgs/pause.svg +1 -0
  38. package/{src/static/icons/media/Play icon.svg → lib/static/icons/svgs/play-circle.svg} +1 -1
  39. package/lib/static/icons/svgs/play.svg +1 -0
  40. package/lib/static/icons/svgs/rotate-cw.svg +1 -0
  41. package/lib/static/icons/svgs/settings.svg +11 -0
  42. package/{src/static/icons/media/skip back icon.svg → lib/static/icons/svgs/skip-backward.svg} +2 -3
  43. package/{src/static/icons/media/Skip forward icon.svg → lib/static/icons/svgs/skip-forward.svg} +2 -3
  44. package/{src/static/icons/media/Volume icon.svg → lib/static/icons/svgs/volume-high.svg} +3 -3
  45. package/lib/static/icons/svgs/volume-low.svg +10 -0
  46. package/{src/static/icons/media/low volume icon.svg → lib/static/icons/svgs/volume-medium.svg} +2 -2
  47. package/{src/static/icons/media/no volume icon.svg → lib/static/icons/svgs/volume-off.svg} +3 -3
  48. package/lib/static/stylesheets/common.module.scss +486 -0
  49. package/lib/static/stylesheets/controls-tv.module.scss +488 -0
  50. package/lib/static/stylesheets/controls-web.module.scss +422 -0
  51. package/lib/static/stylesheets/player-profile-form.module.scss +141 -0
  52. package/lib/static/stylesheets/player.module.scss +92 -0
  53. package/lib/static/stylesheets/reset.module.scss +79 -0
  54. package/lib/static/stylesheets/ticket-form.module.scss +123 -0
  55. package/lib/ui/BuildIcons.cjs +44 -0
  56. package/lib/ui/Common.js +210 -0
  57. package/lib/ui/Components.jsx +342 -0
  58. package/lib/ui/Observers.js +449 -0
  59. package/lib/ui/PlayerProfileForm.jsx +106 -0
  60. package/lib/ui/PlayerUI.jsx +317 -0
  61. package/lib/ui/TVControls.jsx +337 -0
  62. package/lib/ui/TicketForm.jsx +147 -0
  63. package/lib/ui/WebControls.jsx +290 -0
  64. package/package.json +35 -47
  65. package/dist/index.js +0 -2
  66. package/dist/index.js.LICENSE.txt +0 -80
  67. package/src/BuildIcons.js +0 -27
  68. package/src/PlayerControls.js +0 -1478
  69. package/src/index.js +0 -1417
  70. package/src/static/icons/Icons.js +0 -15
  71. package/src/static/icons/Settings icon.svg +0 -4
  72. package/src/static/icons/chat icon collapse.svg +0 -1
  73. package/src/static/icons/chat icon.svg +0 -11
  74. package/src/static/icons/chat send.svg +0 -1
  75. package/src/static/icons/full screen.svg +0 -1
  76. package/src/static/icons/media/LargePlayIcon.svg +0 -4
  77. package/src/static/icons/media/Settings icon.svg +0 -4
  78. package/src/static/icons/media/Skip backward icon.svg +0 -4
  79. package/src/static/icons/media/list.svg +0 -1
  80. package/src/static/icons/media/loop icon.svg +0 -12
  81. package/src/static/icons/media/shuffle icon.svg +0 -13
  82. package/src/static/icons/muted.svg +0 -11
  83. package/src/static/icons/pause.svg +0 -1
  84. package/src/static/icons/play circle.svg +0 -1
  85. package/src/static/icons/play.svg +0 -1
  86. package/src/static/icons/settings.svg +0 -1
  87. package/src/static/icons/slider circle.svg +0 -1
  88. package/src/static/icons/unmuted.svg +0 -10
  89. package/src/static/images/ELUV.IO logo embed player.png +0 -0
  90. package/src/static/images/ELUV.IO logo embed player.svg +0 -1
  91. package/src/static/images/ELUV.IO white 20 px V2.png +0 -0
  92. package/src/static/images/ELUVIO white.svg +0 -26
  93. package/src/static/images/Logo.png +0 -0
  94. package/src/static/stylesheets/player.scss +0 -1065
  95. package/webpack.config.js +0 -152
  96. /package/{src/static/icons → lib/static/icons/svgs}/arrow-left.svg +0 -0
  97. /package/{src/static/icons/live icon.svg → lib/static/icons/svgs/live.svg} +0 -0
  98. /package/{src/static/icons → lib/static/icons/svgs}/multiview.svg +0 -0
  99. /package/{src/static/icons/media → lib/static/icons/svgs}/next.svg +0 -0
  100. /package/{src/static/icons/media → lib/static/icons/svgs}/previous.svg +0 -0
  101. /package/{src/static/icons → lib/static/icons/svgs}/x.svg +0 -0
  102. /package/{dist/5897e28fa3e8ac0a2fae.png → lib/static/images/Logo.png} +0 -0
@@ -0,0 +1,2028 @@
1
+ import { g as rn } from "./index-hvQzQ6UX.mjs";
2
+ var kt = { exports: {} };
3
+ /*!
4
+ * mux-embed
5
+ * @version 4.30.0
6
+ * @copyright 2023 Mux, Inc
7
+ */
8
+ (function(Ne, te) {
9
+ (function() {
10
+ var ce;
11
+ ce = function() {
12
+ return function() {
13
+ var Oe = { 80: function(L, P, x) {
14
+ L.exports = x(728).default;
15
+ }, 728: function(L, P, x) {
16
+ x.d(P, { default: function() {
17
+ return Xr;
18
+ } });
19
+ var U = x(48), y = x.n(U), M = function() {
20
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(n) {
21
+ var e = 16 * Math.random() | 0;
22
+ return (n === "x" ? e : 3 & e | 8).toString(16);
23
+ });
24
+ }, C = function() {
25
+ return ("000000" + (Math.random() * Math.pow(36, 6) << 0).toString(36)).slice(-6);
26
+ }, T = function(n) {
27
+ var e, r;
28
+ if (n && n.nodeName !== void 0)
29
+ return n.muxId || (n.muxId = C()), n.muxId;
30
+ try {
31
+ r = document.querySelector(n);
32
+ } catch {
33
+ }
34
+ return r && !r.muxId && (r.muxId = n), ((e = r) === null || e === void 0 ? void 0 : e.muxId) || n;
35
+ }, k = function(n) {
36
+ var e;
37
+ n && n.nodeName !== void 0 ? n = T(e = n) : e = document.querySelector(n);
38
+ var r = e && e.nodeName ? e.nodeName.toLowerCase() : "";
39
+ return [e, n, r];
40
+ }, E = x(640), g = x.n(E), re = g().methodFactory;
41
+ g().methodFactory = function(n, e, r) {
42
+ var t = re(n, e, r);
43
+ return function() {
44
+ for (var a = ["[mux]"], o = 0; o < arguments.length; o++)
45
+ a.push(arguments[o]);
46
+ t.apply(void 0, a);
47
+ };
48
+ }, g().setLevel(g().getLevel());
49
+ var D = g();
50
+ function ne() {
51
+ return (y().doNotTrack || y().navigator && y().navigator.doNotTrack) === "1";
52
+ }
53
+ var N = { now: function() {
54
+ var n = y().performance, e = n && n.timing, r = e && e.navigationStart, t = typeof r == "number" && typeof n.now == "function" ? r + n.now() : Date.now();
55
+ return Math.round(t);
56
+ } }, ee = function(n) {
57
+ return ue(n)[0];
58
+ }, ue = function(n) {
59
+ if (typeof n != "string" || n === "")
60
+ return ["localhost"];
61
+ var e, r = (n.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/) || [])[4];
62
+ return r && (e = (r.match(/[^\.]+\.[^\.]+$/) || [])[0]), [r, e];
63
+ }, se = { exists: function() {
64
+ var n = y().performance;
65
+ return (n && n.timing) !== void 0;
66
+ }, domContentLoadedEventEnd: function() {
67
+ var n = y().performance, e = n && n.timing;
68
+ return e && e.domContentLoadedEventEnd;
69
+ }, navigationStart: function() {
70
+ var n = y().performance, e = n && n.timing;
71
+ return e && e.navigationStart;
72
+ } };
73
+ function A(n, e, r) {
74
+ r = r === void 0 ? 1 : r, n[e] = n[e] || 0, n[e] += r;
75
+ }
76
+ var J = ["x-request-id", "cf-ray", "x-amz-cf-id", "x-akamai-request-id"], he = ["x-cdn", "content-type"].concat(J);
77
+ function S(n) {
78
+ var e = {};
79
+ return (n = n || "").trim().split(/[\r\n]+/).forEach(function(r) {
80
+ if (r) {
81
+ var t = r.split(": "), a = t.shift();
82
+ a && (he.indexOf(a.toLowerCase()) >= 0 || a.toLowerCase().indexOf("x-litix-") === 0) && (e[a] = t.join(": "));
83
+ }
84
+ }), e;
85
+ }
86
+ function W(n) {
87
+ if (n) {
88
+ var e = J.find(function(r) {
89
+ return n[r] !== void 0;
90
+ });
91
+ return e ? n[e] : void 0;
92
+ }
93
+ }
94
+ var $ = function(n) {
95
+ var e = {};
96
+ for (var r in n) {
97
+ var t = n[r];
98
+ t["DATA-ID"].search("io.litix.data.") !== -1 && (e[t["DATA-ID"].replace("io.litix.data.", "")] = t.VALUE);
99
+ }
100
+ return e;
101
+ };
102
+ function fe(n, e) {
103
+ var r = Object.keys(n);
104
+ if (Object.getOwnPropertySymbols) {
105
+ var t = Object.getOwnPropertySymbols(n);
106
+ e && (t = t.filter(function(a) {
107
+ return Object.getOwnPropertyDescriptor(n, a).enumerable;
108
+ })), r.push.apply(r, t);
109
+ }
110
+ return r;
111
+ }
112
+ function B(n) {
113
+ for (var e = 1; e < arguments.length; e++) {
114
+ var r = arguments[e] != null ? arguments[e] : {};
115
+ e % 2 ? fe(Object(r), !0).forEach(function(t) {
116
+ ae(n, t, r[t]);
117
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(r)) : fe(Object(r)).forEach(function(t) {
118
+ Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(r, t));
119
+ });
120
+ }
121
+ return n;
122
+ }
123
+ function ae(n, e, r) {
124
+ return e in n ? Object.defineProperty(n, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = r, n;
125
+ }
126
+ var ge = function(n) {
127
+ if (!n)
128
+ return {};
129
+ var e = se.navigationStart(), r = n.loading, t = r ? r.start : n.trequest, a = r ? r.first : n.tfirst, o = r ? r.end : n.tload;
130
+ return { bytesLoaded: n.total, requestStart: Math.round(e + t), responseStart: Math.round(e + a), responseEnd: Math.round(e + o) };
131
+ }, ve = function(n) {
132
+ if (n && typeof n.getAllResponseHeaders == "function")
133
+ return S(n.getAllResponseHeaders());
134
+ };
135
+ function Ie(n, e) {
136
+ var r = Object.keys(n);
137
+ if (Object.getOwnPropertySymbols) {
138
+ var t = Object.getOwnPropertySymbols(n);
139
+ e && (t = t.filter(function(a) {
140
+ return Object.getOwnPropertyDescriptor(n, a).enumerable;
141
+ })), r.push.apply(r, t);
142
+ }
143
+ return r;
144
+ }
145
+ function we(n) {
146
+ for (var e = 1; e < arguments.length; e++) {
147
+ var r = arguments[e] != null ? arguments[e] : {};
148
+ e % 2 ? Ie(Object(r), !0).forEach(function(t) {
149
+ I(n, t, r[t]);
150
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(r)) : Ie(Object(r)).forEach(function(t) {
151
+ Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(r, t));
152
+ });
153
+ }
154
+ return n;
155
+ }
156
+ function I(n, e, r) {
157
+ return e in n ? Object.defineProperty(n, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = r, n;
158
+ }
159
+ var le = function(n, e) {
160
+ if (!n || !n.requestEndDate)
161
+ return {};
162
+ var r, t = ee(n.url), a = n.url, o = n.bytesLoaded, i = new Date(n.requestStartDate).getTime(), u = new Date(n.firstByteDate).getTime(), l = new Date(n.requestEndDate).getTime(), s = isNaN(n.duration) ? 0 : n.duration, f = typeof e.getMetricsFor == "function" ? e.getMetricsFor(n.mediaType).HttpList : e.getDashMetrics().getHttpRequests(n.mediaType);
163
+ return f.length > 0 && (r = S(f[f.length - 1]._responseHeaders || "")), { requestStart: i, requestResponseStart: u, requestResponseEnd: l, requestBytesLoaded: o, requestResponseHeaders: r, requestMediaDuration: s, requestHostname: t, requestUrl: a, requestId: r ? W(r) : void 0 };
164
+ }, Te = function(n, e) {
165
+ var r = e.getQualityFor(n), t = e.getCurrentTrackFor(n).bitrateList;
166
+ return t ? { currentLevel: r, renditionWidth: t[r].width || null, renditionHeight: t[r].height || null, renditionBitrate: t[r].bandwidth } : {};
167
+ }, He = function(n) {
168
+ var e;
169
+ return (e = n.match(/.*codecs\*?="(.*)"/)) === null || e === void 0 ? void 0 : e[1];
170
+ }, Et = function(n) {
171
+ try {
172
+ var e, r;
173
+ return (e = n.getVersion) === null || e === void 0 || (r = e.call(n)) === null || r === void 0 ? void 0 : r.split(".").map(function(t) {
174
+ return parseInt(t);
175
+ })[0];
176
+ } catch {
177
+ return !1;
178
+ }
179
+ };
180
+ function Ot(n, e) {
181
+ for (var r = 0; r < e.length; r++) {
182
+ var t = e[r];
183
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
184
+ }
185
+ }
186
+ var Je = 0, xt = function() {
187
+ function n() {
188
+ (function(t, a) {
189
+ if (!(t instanceof a))
190
+ throw new TypeError("Cannot call a class as a function");
191
+ })(this, n);
192
+ }
193
+ var e, r;
194
+ return e = n, r = [{ key: "on", value: function(t, a, o) {
195
+ return a._eventEmitterGuid = a._eventEmitterGuid || ++Je, this._listeners = this._listeners || {}, this._listeners[t] = this._listeners[t] || [], o && (a = a.bind(o)), this._listeners[t].push(a), a;
196
+ } }, { key: "off", value: function(t, a) {
197
+ var o = this._listeners && this._listeners[t];
198
+ o && o.forEach(function(i, u) {
199
+ i._eventEmitterGuid === a._eventEmitterGuid && o.splice(u, 1);
200
+ });
201
+ } }, { key: "one", value: function(t, a, o) {
202
+ var i = this;
203
+ a._eventEmitterGuid = a._eventEmitterGuid || ++Je;
204
+ var u = function l() {
205
+ i.off(t, l), a.apply(o || this, arguments);
206
+ };
207
+ u._eventEmitterGuid = a._eventEmitterGuid, this.on(t, u);
208
+ } }, { key: "emit", value: function(t, a) {
209
+ var o = this;
210
+ if (this._listeners) {
211
+ a = a || {};
212
+ var i = this._listeners["before*"] || [], u = this._listeners[t] || [], l = this._listeners["after" + t] || [], s = function(f, _) {
213
+ (f = f.slice()).forEach(function(q) {
214
+ q.call(o, { type: t }, _);
215
+ });
216
+ };
217
+ s(i, a), s(u, a), s(l, a);
218
+ }
219
+ } }], r && Ot(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
220
+ }(), Dt = xt;
221
+ function St(n, e) {
222
+ for (var r = 0; r < e.length; r++) {
223
+ var t = e[r];
224
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
225
+ }
226
+ }
227
+ var qt = function() {
228
+ function n(t) {
229
+ var a = this;
230
+ (function(o, i) {
231
+ if (!(o instanceof i))
232
+ throw new TypeError("Cannot call a class as a function");
233
+ })(this, n), this.pm = t, this._playbackHeartbeatInterval = null, this._playheadShouldBeProgressing = !1, t.on("playing", function() {
234
+ a._playheadShouldBeProgressing = !0;
235
+ }), t.on("play", this._startPlaybackHeartbeatInterval.bind(this)), t.on("playing", this._startPlaybackHeartbeatInterval.bind(this)), t.on("adbreakstart", this._startPlaybackHeartbeatInterval.bind(this)), t.on("adplay", this._startPlaybackHeartbeatInterval.bind(this)), t.on("adplaying", this._startPlaybackHeartbeatInterval.bind(this)), t.on("seeking", this._startPlaybackHeartbeatInterval.bind(this)), t.on("devicewake", this._startPlaybackHeartbeatInterval.bind(this)), t.on("viewstart", this._startPlaybackHeartbeatInterval.bind(this)), t.on("rebufferstart", this._startPlaybackHeartbeatInterval.bind(this)), t.on("pause", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("ended", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("viewend", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("error", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("aderror", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("adpause", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("adended", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("adbreakend", this._stopPlaybackHeartbeatInterval.bind(this)), t.on("seeked", function() {
236
+ t.data.player_is_paused ? a._stopPlaybackHeartbeatInterval() : a._startPlaybackHeartbeatInterval();
237
+ }), t.on("timeupdate", function() {
238
+ a._playbackHeartbeatInterval !== null && t.emit("playbackheartbeat");
239
+ }), t.on("devicesleep", function(o, i) {
240
+ a._playbackHeartbeatInterval !== null && (y().clearInterval(a._playbackHeartbeatInterval), t.emit("playbackheartbeatend", { viewer_time: i.viewer_time }), a._playbackHeartbeatInterval = null);
241
+ });
242
+ }
243
+ var e, r;
244
+ return e = n, (r = [{ key: "_startPlaybackHeartbeatInterval", value: function() {
245
+ var t = this;
246
+ this._playbackHeartbeatInterval === null && (this.pm.emit("playbackheartbeat"), this._playbackHeartbeatInterval = y().setInterval(function() {
247
+ t.pm.emit("playbackheartbeat");
248
+ }, this.pm.playbackHeartbeatTime));
249
+ } }, { key: "_stopPlaybackHeartbeatInterval", value: function() {
250
+ this._playheadShouldBeProgressing = !1, this._playbackHeartbeatInterval !== null && (y().clearInterval(this._playbackHeartbeatInterval), this.pm.emit("playbackheartbeatend"), this._playbackHeartbeatInterval = null);
251
+ } }]) && St(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
252
+ }();
253
+ function Ke(n, e) {
254
+ for (var r = 0; r < e.length; r++) {
255
+ var t = e[r];
256
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
257
+ }
258
+ }
259
+ function Pt(n, e, r) {
260
+ return e && Ke(n.prototype, e), r && Ke(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
261
+ }
262
+ var At = Pt(function n(e) {
263
+ var r = this;
264
+ (function(t, a) {
265
+ if (!(t instanceof a))
266
+ throw new TypeError("Cannot call a class as a function");
267
+ })(this, n), e.on("viewinit", function() {
268
+ r.viewErrored = !1;
269
+ }), e.on("error", function(t, a) {
270
+ try {
271
+ var o = e.errorTranslator({ player_error_code: a.player_error_code, player_error_message: a.player_error_message, player_error_context: a.player_error_context });
272
+ o ? (e.data.player_error_code = o.player_error_code || a.player_error_code, e.data.player_error_message = o.player_error_message || a.player_error_message, e.data.player_error_context = o.player_error_context || a.player_error_context, r.viewErrored = !0) : (delete e.data.player_error_code, delete e.data.player_error_message, delete e.data.player_error_context);
273
+ } catch (i) {
274
+ e.mux.log.warn("Exception in error translator callback.", i), r.viewErrored = !0;
275
+ }
276
+ });
277
+ });
278
+ function Rt(n, e) {
279
+ for (var r = 0; r < e.length; r++) {
280
+ var t = e[r];
281
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
282
+ }
283
+ }
284
+ var It = function() {
285
+ function n(t) {
286
+ (function(a, o) {
287
+ if (!(a instanceof o))
288
+ throw new TypeError("Cannot call a class as a function");
289
+ })(this, n), this.pm = t, this._watchTimeTrackerLastCheckedTime = null, t.on("playbackheartbeat", this._updateWatchTime.bind(this)), t.on("playbackheartbeatend", this._clearWatchTimeState.bind(this));
290
+ }
291
+ var e, r;
292
+ return e = n, (r = [{ key: "_updateWatchTime", value: function(t, a) {
293
+ var o = a.viewer_time;
294
+ this._watchTimeTrackerLastCheckedTime === null && (this._watchTimeTrackerLastCheckedTime = o), A(this.pm.data, "view_watch_time", o - this._watchTimeTrackerLastCheckedTime), this._watchTimeTrackerLastCheckedTime = o;
295
+ } }, { key: "_clearWatchTimeState", value: function(t, a) {
296
+ this._updateWatchTime(t, a), this._watchTimeTrackerLastCheckedTime = null;
297
+ } }]) && Rt(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
298
+ }();
299
+ function Lt(n, e) {
300
+ for (var r = 0; r < e.length; r++) {
301
+ var t = e[r];
302
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
303
+ }
304
+ }
305
+ var jt = function() {
306
+ function n(t) {
307
+ var a = this;
308
+ (function(u, l) {
309
+ if (!(u instanceof l))
310
+ throw new TypeError("Cannot call a class as a function");
311
+ })(this, n), this.pm = t, this._playbackTimeTrackerLastPlayheadPosition = -1, this._lastTime = N.now(), this._isAdPlaying = !1, this._callbackUpdatePlaybackTime = null;
312
+ var o = this._startPlaybackTimeTracking.bind(this);
313
+ t.on("playing", o), t.on("adplaying", o), t.on("seeked", o);
314
+ var i = this._stopPlaybackTimeTracking.bind(this);
315
+ t.on("playbackheartbeatend", i), t.on("seeking", i), t.on("adplaying", function() {
316
+ a._isAdPlaying = !0;
317
+ }), t.on("adended", function() {
318
+ a._isAdPlaying = !1;
319
+ }), t.on("adpause", function() {
320
+ a._isAdPlaying = !1;
321
+ }), t.on("adbreakstart", function() {
322
+ a._isAdPlaying = !1;
323
+ }), t.on("adbreakend", function() {
324
+ a._isAdPlaying = !1;
325
+ }), t.on("adplay", function() {
326
+ a._isAdPlaying = !1;
327
+ }), t.on("viewinit", function() {
328
+ a._playbackTimeTrackerLastPlayheadPosition = -1, a._lastTime = N.now(), a._isAdPlaying = !1, a._callbackUpdatePlaybackTime = null;
329
+ });
330
+ }
331
+ var e, r;
332
+ return e = n, (r = [{ key: "_startPlaybackTimeTracking", value: function() {
333
+ this._callbackUpdatePlaybackTime === null && (this._callbackUpdatePlaybackTime = this._updatePlaybackTime.bind(this), this._playbackTimeTrackerLastPlayheadPosition = this.pm.data.player_playhead_time, this.pm.on("playbackheartbeat", this._callbackUpdatePlaybackTime));
334
+ } }, { key: "_stopPlaybackTimeTracking", value: function() {
335
+ this._callbackUpdatePlaybackTime && (this._updatePlaybackTime(), this.pm.off("playbackheartbeat", this._callbackUpdatePlaybackTime), this._callbackUpdatePlaybackTime = null, this._playbackTimeTrackerLastPlayheadPosition = -1);
336
+ } }, { key: "_updatePlaybackTime", value: function() {
337
+ var t = this.pm.data.player_playhead_time, a = N.now(), o = -1;
338
+ this._playbackTimeTrackerLastPlayheadPosition >= 0 && t > this._playbackTimeTrackerLastPlayheadPosition ? o = t - this._playbackTimeTrackerLastPlayheadPosition : this._isAdPlaying && (o = a - this._lastTime), o > 0 && o <= 1e3 && A(this.pm.data, "view_content_playback_time", o), this._playbackTimeTrackerLastPlayheadPosition = t, this._lastTime = a;
339
+ } }]) && Lt(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
340
+ }();
341
+ function Ct(n, e) {
342
+ for (var r = 0; r < e.length; r++) {
343
+ var t = e[r];
344
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
345
+ }
346
+ }
347
+ var Nt = function() {
348
+ function n(t) {
349
+ (function(o, i) {
350
+ if (!(o instanceof i))
351
+ throw new TypeError("Cannot call a class as a function");
352
+ })(this, n), this.pm = t;
353
+ var a = this._updatePlayheadTime.bind(this);
354
+ t.on("playbackheartbeat", a), t.on("playbackheartbeatend", a), t.on("timeupdate", a), t.on("destroy", function() {
355
+ t.off("timeupdate", a);
356
+ });
357
+ }
358
+ var e, r;
359
+ return e = n, (r = [{ key: "_updateMaxPlayheadPosition", value: function() {
360
+ this.pm.data.view_max_playhead_position = this.pm.data.view_max_playhead_position === void 0 ? this.pm.data.player_playhead_time : Math.max(this.pm.data.view_max_playhead_position, this.pm.data.player_playhead_time);
361
+ } }, { key: "_updatePlayheadTime", value: function(t, a) {
362
+ var o = this, i = function() {
363
+ o.pm.currentFragmentPDT && o.pm.currentFragmentStart && (o.pm.data.player_program_time = o.pm.currentFragmentPDT + o.pm.data.player_playhead_time - o.pm.currentFragmentStart);
364
+ };
365
+ if (a && a.player_playhead_time)
366
+ this.pm.data.player_playhead_time = a.player_playhead_time, i(), this._updateMaxPlayheadPosition();
367
+ else if (this.pm.getPlayheadTime) {
368
+ var u = this.pm.getPlayheadTime();
369
+ u !== void 0 && (this.pm.data.player_playhead_time = u, i(), this._updateMaxPlayheadPosition());
370
+ }
371
+ } }]) && Ct(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
372
+ }();
373
+ function ze(n, e) {
374
+ for (var r = 0; r < e.length; r++) {
375
+ var t = e[r];
376
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
377
+ }
378
+ }
379
+ function Ht(n, e, r) {
380
+ return e && ze(n.prototype, e), r && ze(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
381
+ }
382
+ var Ye = 3e5, Mt = Ht(function n(e) {
383
+ if (function(o, i) {
384
+ if (!(o instanceof i))
385
+ throw new TypeError("Cannot call a class as a function");
386
+ }(this, n), !e.disableRebufferTracking) {
387
+ var r, t = function(o, i) {
388
+ a(i), r = void 0;
389
+ }, a = function(o) {
390
+ if (r) {
391
+ var i = o.viewer_time - r;
392
+ A(e.data, "view_rebuffer_duration", i), r = o.viewer_time, e.data.view_rebuffer_duration > Ye && (e.emit("viewend"), e.send("viewend"), e.mux.log.warn("Ending view after rebuffering for longer than ".concat(Ye, "ms, future events will be ignored unless a programchange or videochange occurs.")));
393
+ }
394
+ e.data.view_watch_time >= 0 && e.data.view_rebuffer_count > 0 && (e.data.view_rebuffer_frequency = e.data.view_rebuffer_count / e.data.view_watch_time, e.data.view_rebuffer_percentage = e.data.view_rebuffer_duration / e.data.view_watch_time);
395
+ };
396
+ e.on("playbackheartbeat", function(o, i) {
397
+ return a(i);
398
+ }), e.on("rebufferstart", function(o, i) {
399
+ r || (A(e.data, "view_rebuffer_count", 1), r = i.viewer_time, e.one("rebufferend", t));
400
+ }), e.on("viewinit", function() {
401
+ r = void 0, e.off("rebufferend", t);
402
+ });
403
+ }
404
+ });
405
+ function Bt(n, e) {
406
+ for (var r = 0; r < e.length; r++) {
407
+ var t = e[r];
408
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
409
+ }
410
+ }
411
+ var Ut = function() {
412
+ function n(t) {
413
+ var a = this;
414
+ (function(o, i) {
415
+ if (!(o instanceof i))
416
+ throw new TypeError("Cannot call a class as a function");
417
+ })(this, n), this.pm = t, t.disableRebufferTracking || t.disablePlayheadRebufferTracking || (this._lastCheckedTime = null, this._lastPlayheadTime = null, this._lastPlayheadTimeUpdatedTime = null, t.on("playbackheartbeat", this._checkIfRebuffering.bind(this)), t.on("playbackheartbeatend", this._cleanupRebufferTracker.bind(this)), t.on("seeking", function() {
418
+ a._cleanupRebufferTracker(null, { viewer_time: N.now() });
419
+ }));
420
+ }
421
+ var e, r;
422
+ return e = n, r = [{ key: "_checkIfRebuffering", value: function(t, a) {
423
+ if (this.pm.seekingTracker.isSeeking || this.pm.adTracker.isAdBreak || !this.pm.playbackHeartbeat._playheadShouldBeProgressing)
424
+ this._cleanupRebufferTracker(t, a);
425
+ else if (this._lastCheckedTime !== null)
426
+ if (this._lastPlayheadTime === this.pm.data.player_playhead_time) {
427
+ var o = a.viewer_time - this._lastPlayheadTimeUpdatedTime;
428
+ typeof this.pm.sustainedRebufferThreshold == "number" && o >= this.pm.sustainedRebufferThreshold && (this._rebuffering || (this._rebuffering = !0, this.pm.emit("rebufferstart", { viewer_time: this._lastPlayheadTimeUpdatedTime }))), this._lastCheckedTime = a.viewer_time;
429
+ } else
430
+ this._cleanupRebufferTracker(t, a, !0);
431
+ else
432
+ this._prepareRebufferTrackerState(a.viewer_time);
433
+ } }, { key: "_clearRebufferTrackerState", value: function() {
434
+ this._lastCheckedTime = null, this._lastPlayheadTime = null, this._lastPlayheadTimeUpdatedTime = null;
435
+ } }, { key: "_prepareRebufferTrackerState", value: function(t) {
436
+ this._lastCheckedTime = t, this._lastPlayheadTime = this.pm.data.player_playhead_time, this._lastPlayheadTimeUpdatedTime = t;
437
+ } }, { key: "_cleanupRebufferTracker", value: function(t, a) {
438
+ var o = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
439
+ if (this._rebuffering)
440
+ this._rebuffering = !1, this.pm.emit("rebufferend", { viewer_time: a.viewer_time });
441
+ else {
442
+ if (this._lastCheckedTime === null)
443
+ return;
444
+ var i = this.pm.data.player_playhead_time - this._lastPlayheadTime, u = a.viewer_time - this._lastPlayheadTimeUpdatedTime;
445
+ typeof this.pm.minimumRebufferDuration == "number" && i > 0 && u - i > this.pm.minimumRebufferDuration && (this._lastCheckedTime = null, this.pm.emit("rebufferstart", { viewer_time: this._lastPlayheadTimeUpdatedTime }), this.pm.emit("rebufferend", { viewer_time: this._lastPlayheadTimeUpdatedTime + u - i }));
446
+ }
447
+ o ? this._prepareRebufferTrackerState(a.viewer_time) : this._clearRebufferTrackerState();
448
+ } }], r && Bt(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
449
+ }(), Ft = Ut;
450
+ function Wt(n, e) {
451
+ for (var r = 0; r < e.length; r++) {
452
+ var t = e[r];
453
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
454
+ }
455
+ }
456
+ var Gt = function() {
457
+ function n(t) {
458
+ var a = this;
459
+ (function(o, i) {
460
+ if (!(o instanceof i))
461
+ throw new TypeError("Cannot call a class as a function");
462
+ })(this, n), this.pm = t, t.on("viewinit", function() {
463
+ var o = t.data, i = o.view_id;
464
+ if (!o.view_program_changed) {
465
+ var u = function(l, s) {
466
+ var f = s.viewer_time;
467
+ l.type === "playing" && t.data.view_time_to_first_frame === void 0 ? a.calculateTimeToFirstFrame(f || N.now(), i) : l.type !== "adplaying" || t.data.view_time_to_first_frame !== void 0 && !a._inPrerollPosition() || a.calculateTimeToFirstFrame(f || N.now(), i);
468
+ };
469
+ t.one("playing", u), t.one("adplaying", u), t.one("viewend", function() {
470
+ t.off("playing", u), t.off("adplaying", u);
471
+ });
472
+ }
473
+ });
474
+ }
475
+ var e, r;
476
+ return e = n, (r = [{ key: "_inPrerollPosition", value: function() {
477
+ return this.pm.data.view_content_playback_time === void 0 || this.pm.data.view_content_playback_time <= 1e3;
478
+ } }, { key: "calculateTimeToFirstFrame", value: function(t, a) {
479
+ a === this.pm.data.view_id && (this.pm.watchTimeTracker._updateWatchTime(null, { viewer_time: t }), this.pm.data.view_time_to_first_frame = this.pm.data.view_watch_time, (this.pm.data.player_autoplay_on || this.pm.data.video_is_autoplay) && this.NAVIGATION_START && (this.pm.data.view_aggregate_startup_time = this.pm.data.view_start + this.pm.data.view_watch_time - this.NAVIGATION_START));
480
+ } }]) && Wt(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
481
+ }();
482
+ function Xe(n, e) {
483
+ for (var r = 0; r < e.length; r++) {
484
+ var t = e[r];
485
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
486
+ }
487
+ }
488
+ function Qt(n, e, r) {
489
+ return e && Xe(n.prototype, e), r && Xe(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
490
+ }
491
+ var Vt = Qt(function n(e) {
492
+ var r = this;
493
+ (function(t, a) {
494
+ if (!(t instanceof a))
495
+ throw new TypeError("Cannot call a class as a function");
496
+ })(this, n), e.on("viewinit", function() {
497
+ r._lastPlayheadPosition = -1;
498
+ }), ["pause", "rebufferstart", "seeking", "error", "adbreakstart", "hb"].forEach(function(t) {
499
+ e.on(t, function() {
500
+ if (r._lastPlayheadPosition >= 0 && e.data.player_playhead_time >= 0 && r._lastPlayerWidth >= 0 && r._lastSourceWidth > 0 && r._lastPlayerHeight >= 0 && r._lastSourceHeight > 0) {
501
+ var a = e.data.player_playhead_time - r._lastPlayheadPosition;
502
+ if (a < 0)
503
+ return void (r._lastPlayheadPosition = -1);
504
+ var o = Math.min(r._lastPlayerWidth / r._lastSourceWidth, r._lastPlayerHeight / r._lastSourceHeight), i = Math.max(0, o - 1), u = Math.max(0, 1 - o);
505
+ e.data.view_max_upscale_percentage = Math.max(e.data.view_max_upscale_percentage || 0, i), e.data.view_max_downscale_percentage = Math.max(e.data.view_max_downscale_percentage || 0, u), A(e.data, "view_total_content_playback_time", a), A(e.data, "view_total_upscaling", i * a), A(e.data, "view_total_downscaling", u * a);
506
+ }
507
+ r._lastPlayheadPosition = -1;
508
+ });
509
+ }), ["playing", "hb"].forEach(function(t) {
510
+ e.on(t, function() {
511
+ r._lastPlayheadPosition = e.data.player_playhead_time, r._lastPlayerWidth = e.data.player_width, r._lastPlayerHeight = e.data.player_height, r._lastSourceWidth = e.data.video_source_width, r._lastSourceHeight = e.data.video_source_height;
512
+ });
513
+ });
514
+ });
515
+ function $e(n, e) {
516
+ for (var r = 0; r < e.length; r++) {
517
+ var t = e[r];
518
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
519
+ }
520
+ }
521
+ function Jt(n, e, r) {
522
+ return e && $e(n.prototype, e), r && $e(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
523
+ }
524
+ var Kt = Jt(function n(e) {
525
+ var r = this;
526
+ (function(o, i) {
527
+ if (!(o instanceof i))
528
+ throw new TypeError("Cannot call a class as a function");
529
+ })(this, n), this.isSeeking = !1;
530
+ var t = -1, a = function() {
531
+ var o = N.now(), i = (e.data.viewer_time || o) - (t || o);
532
+ A(e.data, "view_seek_duration", i), e.data.view_max_seek_time = Math.max(e.data.view_max_seek_time || 0, i), r.isSeeking = !1, t = -1;
533
+ };
534
+ e.on("seeking", function(o, i) {
535
+ Object.assign(e.data, i), r.isSeeking && i.viewer_time - t <= 2e3 ? t = i.viewer_time : (r.isSeeking && a(), r.isSeeking = !0, t = i.viewer_time, A(e.data, "view_seek_count", 1), e.send("seeking"));
536
+ }), e.on("seeked", function() {
537
+ a();
538
+ }), e.on("viewend", function() {
539
+ r.isSeeking && (a(), e.send("seeked")), r.isSeeking = !1, t = -1;
540
+ });
541
+ });
542
+ function Ze(n, e) {
543
+ return function(r) {
544
+ if (Array.isArray(r))
545
+ return r;
546
+ }(n) || function(r, t) {
547
+ var a = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
548
+ if (a != null) {
549
+ var o, i, u = [], l = !0, s = !1;
550
+ try {
551
+ for (a = a.call(r); !(l = (o = a.next()).done) && (u.push(o.value), !t || u.length !== t); l = !0)
552
+ ;
553
+ } catch (f) {
554
+ s = !0, i = f;
555
+ } finally {
556
+ try {
557
+ l || a.return == null || a.return();
558
+ } finally {
559
+ if (s)
560
+ throw i;
561
+ }
562
+ }
563
+ return u;
564
+ }
565
+ }(n, e) || function(r, t) {
566
+ if (r) {
567
+ if (typeof r == "string")
568
+ return et(r, t);
569
+ var a = Object.prototype.toString.call(r).slice(8, -1);
570
+ return a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set" ? Array.from(r) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? et(r, t) : void 0;
571
+ }
572
+ }(n, e) || function() {
573
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
574
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
575
+ }();
576
+ }
577
+ function et(n, e) {
578
+ (e == null || e > n.length) && (e = n.length);
579
+ for (var r = 0, t = new Array(e); r < e; r++)
580
+ t[r] = n[r];
581
+ return t;
582
+ }
583
+ function zt(n, e) {
584
+ for (var r = 0; r < e.length; r++) {
585
+ var t = e[r];
586
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
587
+ }
588
+ }
589
+ var tt = function(n, e) {
590
+ n.push(e), n.sort(function(r, t) {
591
+ return r.viewer_time - t.viewer_time;
592
+ });
593
+ }, Yt = ["adbreakstart", "adrequest", "adresponse", "adplay", "adplaying", "adpause", "adended", "adbreakend", "aderror", "adclicked", "adskipped"], Xt = function() {
594
+ function n(t) {
595
+ var a = this;
596
+ (function(i, u) {
597
+ if (!(i instanceof u))
598
+ throw new TypeError("Cannot call a class as a function");
599
+ })(this, n), this.pm = t, t.on("viewinit", function() {
600
+ a.isAdBreak = !1, a._currentAdRequestNumber = 0, a._currentAdResponseNumber = 0, a._adRequests = [], a._adResponses = [], a._adHasPlayed = !1, a._wouldBeNewAdPlay = !0, a._prerollPlayTime = void 0;
601
+ }), Yt.forEach(function(i) {
602
+ return t.on(i, a._updateAdData.bind(a));
603
+ });
604
+ var o = function() {
605
+ a.isAdBreak = !1;
606
+ };
607
+ t.on("adbreakstart", function() {
608
+ a.isAdBreak = !0;
609
+ }), t.on("play", o), t.on("playing", o), t.on("viewend", o), t.on("adrequest", function(i, u) {
610
+ u = Object.assign({ ad_request_id: "generatedAdRequestId" + a._currentAdRequestNumber++ }, u), tt(a._adRequests, u), A(t.data, "view_ad_request_count"), a.inPrerollPosition() && (t.data.view_preroll_requested = !0, a._adHasPlayed || A(t.data, "view_preroll_request_count"));
611
+ }), t.on("adresponse", function(i, u) {
612
+ u = Object.assign({ ad_request_id: "generatedAdRequestId" + a._currentAdResponseNumber++ }, u), tt(a._adResponses, u);
613
+ var l = a.findAdRequest(u.ad_request_id);
614
+ l && A(t.data, "view_ad_request_time", Math.max(0, u.viewer_time - l.viewer_time));
615
+ }), t.on("adplay", function(i, u) {
616
+ a._adHasPlayed = !0, a._wouldBeNewAdPlay && (a._wouldBeNewAdPlay = !1, A(t.data, "view_ad_played_count")), a.inPrerollPosition() && !t.data.view_preroll_played && (t.data.view_preroll_played = !0, a._adRequests.length > 0 && (t.data.view_preroll_request_time = Math.max(0, u.viewer_time - a._adRequests[0].viewer_time)), t.data.view_start && (t.data.view_startup_preroll_request_time = Math.max(0, u.viewer_time - t.data.view_start)), a._prerollPlayTime = u.viewer_time);
617
+ }), t.on("adplaying", function(i, u) {
618
+ a.inPrerollPosition() && t.data.view_preroll_load_time === void 0 && a._prerollPlayTime !== void 0 && (t.data.view_preroll_load_time = u.viewer_time - a._prerollPlayTime, t.data.view_startup_preroll_load_time = u.viewer_time - a._prerollPlayTime);
619
+ }), t.on("adclicked", function(i, u) {
620
+ a._wouldBeNewAdPlay || A(t.data, "view_ad_clicked_count");
621
+ }), t.on("adskipped", function(i, u) {
622
+ a._wouldBeNewAdPlay || A(t.data, "view_ad_skipped_count");
623
+ }), t.on("adended", function() {
624
+ a._wouldBeNewAdPlay = !0;
625
+ }), t.on("aderror", function() {
626
+ a._wouldBeNewAdPlay = !0;
627
+ });
628
+ }
629
+ var e, r;
630
+ return e = n, (r = [{ key: "inPrerollPosition", value: function() {
631
+ return this.pm.data.view_content_playback_time === void 0 || this.pm.data.view_content_playback_time <= 1e3;
632
+ } }, { key: "findAdRequest", value: function(t) {
633
+ for (var a = 0; a < this._adRequests.length; a++)
634
+ if (this._adRequests[a].ad_request_id === t)
635
+ return this._adRequests[a];
636
+ } }, { key: "_updateAdData", value: function(t, a) {
637
+ if (this.inPrerollPosition()) {
638
+ if (!this.pm.data.view_preroll_ad_tag_hostname && a.ad_tag_url) {
639
+ var o = Ze(ue(a.ad_tag_url), 2), i = o[0], u = o[1];
640
+ this.pm.data.view_preroll_ad_tag_domain = u, this.pm.data.view_preroll_ad_tag_hostname = i;
641
+ }
642
+ if (!this.pm.data.view_preroll_ad_asset_hostname && a.ad_asset_url) {
643
+ var l = Ze(ue(a.ad_asset_url), 2), s = l[0], f = l[1];
644
+ this.pm.data.view_preroll_ad_asset_domain = f, this.pm.data.view_preroll_ad_asset_hostname = s;
645
+ }
646
+ }
647
+ this.pm.data.ad_asset_url = a == null ? void 0 : a.ad_asset_url, this.pm.data.ad_tag_url = a == null ? void 0 : a.ad_tag_url, this.pm.data.ad_creative_id = a == null ? void 0 : a.ad_creative_id, this.pm.data.ad_id = a == null ? void 0 : a.ad_id, this.pm.data.ad_universal_id = a == null ? void 0 : a.ad_universal_id;
648
+ } }]) && zt(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
649
+ }();
650
+ function rt(n, e) {
651
+ for (var r = 0; r < e.length; r++) {
652
+ var t = e[r];
653
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
654
+ }
655
+ }
656
+ function $t(n, e, r) {
657
+ return e && rt(n.prototype, e), r && rt(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
658
+ }
659
+ var Zt = $t(function n(e) {
660
+ var r, t;
661
+ (function(u, l) {
662
+ if (!(u instanceof l))
663
+ throw new TypeError("Cannot call a class as a function");
664
+ })(this, n);
665
+ var a = function() {
666
+ e.disableRebufferTracking || r && (A(e.data, "view_waiting_rebuffer_duration", N.now() - r), r = !1, y().clearInterval(t));
667
+ }, o = !1, i = function() {
668
+ o = !1, a();
669
+ };
670
+ e.on("waiting", function() {
671
+ o && (e.disableRebufferTracking || (A(e.data, "view_waiting_rebuffer_count", 1), r = N.now(), t = y().setInterval(function() {
672
+ if (r) {
673
+ var u = N.now();
674
+ A(e.data, "view_waiting_rebuffer_duration", u - r), r = u;
675
+ }
676
+ }, 250)));
677
+ }), e.on("playing", function() {
678
+ a(), o = !0;
679
+ }), e.on("pause", i), e.on("seeking", i);
680
+ });
681
+ function nt(n, e) {
682
+ for (var r = 0; r < e.length; r++) {
683
+ var t = e[r];
684
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
685
+ }
686
+ }
687
+ function er(n, e, r) {
688
+ return e && nt(n.prototype, e), r && nt(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
689
+ }
690
+ var tr = er(function n(e) {
691
+ var r = this;
692
+ (function(o, i) {
693
+ if (!(o instanceof i))
694
+ throw new TypeError("Cannot call a class as a function");
695
+ })(this, n);
696
+ var t = function() {
697
+ r.lastWallClockTime = N.now(), e.on("before*", a);
698
+ }, a = function(o) {
699
+ var i = N.now(), u = r.lastWallClockTime;
700
+ r.lastWallClockTime = i, i - u > 3e4 && (e.emit("devicesleep", { viewer_time: u }), Object.assign(e.data, { viewer_time: u }), e.send("devicesleep"), e.emit("devicewake", { viewer_time: i }), Object.assign(e.data, { viewer_time: i }), e.send("devicewake"));
701
+ };
702
+ e.one("playbackheartbeat", t), e.on("playbackheartbeatend", function() {
703
+ e.off("before*", a), e.one("playbackheartbeat", t);
704
+ });
705
+ }), at = x(375), rr = x(655), it = x.n(rr), ot = "muxData", st = function() {
706
+ var n;
707
+ try {
708
+ n = at.parse(it().get(ot) || "");
709
+ } catch {
710
+ n = {};
711
+ }
712
+ return n;
713
+ }, ut = function(n) {
714
+ try {
715
+ it().set(ot, at.stringify(n), { expires: 365 });
716
+ } catch {
717
+ }
718
+ }, nr = function() {
719
+ var n = st();
720
+ return n.mux_viewer_id = n.mux_viewer_id || M(), n.msn = n.msn || Math.random(), ut(n), { mux_viewer_id: n.mux_viewer_id, mux_sample_number: n.msn };
721
+ };
722
+ function ar(n, e) {
723
+ var r = e.beaconCollectionDomain, t = e.beaconDomain;
724
+ if (r)
725
+ return "https://" + r;
726
+ var a = t || "litix.io";
727
+ return (n = n || "inferred").match(/^[a-z0-9]+$/) ? "https://" + n + "." + a : "https://img.litix.io/a.gif";
728
+ }
729
+ var lt = function() {
730
+ var n;
731
+ switch (dt()) {
732
+ case "cellular":
733
+ n = "cellular";
734
+ break;
735
+ case "ethernet":
736
+ n = "wired";
737
+ break;
738
+ case "wifi":
739
+ n = "wifi";
740
+ break;
741
+ case void 0:
742
+ break;
743
+ default:
744
+ n = "other";
745
+ }
746
+ return n;
747
+ }, dt = function() {
748
+ var n = y().navigator, e = n && (n.connection || n.mozConnection || n.webkitConnection);
749
+ return e && e.type;
750
+ };
751
+ lt.getConnectionFromAPI = dt;
752
+ var ir = lt, or = ft({ a: "env", b: "beacon", c: "custom", d: "ad", e: "event", f: "experiment", i: "internal", m: "mux", n: "response", p: "player", q: "request", r: "retry", s: "session", t: "timestamp", u: "viewer", v: "video", w: "page", x: "view", y: "sub" }), ct = ft({ ad: "ad", ag: "aggregate", ap: "api", al: "application", ar: "architecture", as: "asset", au: "autoplay", av: "average", bi: "bitrate", br: "break", bw: "browser", by: "bytes", ca: "cached", cb: "cancel", cc: "codec", cd: "code", cg: "category", ch: "changed", ck: "clicked", cl: "canceled", cn: "config", co: "count", ce: "counter", cp: "complete", cr: "creative", ct: "content", cu: "current", cx: "connection", cz: "context", dg: "downscaling", dm: "domain", dn: "cdn", do: "downscale", dr: "drm", dp: "dropped", du: "duration", dv: "device", ec: "encoding", ed: "edge", en: "end", eg: "engine", em: "embed", er: "error", es: "errorcode", et: "errortext", ee: "event", ev: "events", ex: "expires", ep: "experiments", fa: "failed", fi: "first", fm: "family", ft: "format", fp: "fps", fq: "frequency", fr: "frame", fs: "fullscreen", ha: "has", hb: "holdback", he: "headers", ho: "host", hn: "hostname", ht: "height", id: "id", ii: "init", in: "instance", ip: "ip", is: "is", ke: "key", la: "language", lb: "labeled", le: "level", li: "live", ld: "loaded", lo: "load", ls: "lists", lt: "latency", ma: "max", md: "media", me: "message", mf: "manifest", mi: "mime", ml: "midroll", mm: "min", mn: "manufacturer", mo: "model", mx: "mux", ne: "newest", nm: "name", no: "number", on: "on", os: "os", pa: "paused", pb: "playback", pd: "producer", pe: "percentage", pf: "played", pg: "program", ph: "playhead", pi: "plugin", pl: "preroll", pn: "playing", po: "poster", pr: "preload", ps: "position", pt: "part", py: "property", ra: "rate", rd: "requested", re: "rebuffer", rf: "rendition", rm: "remote", ro: "ratio", rp: "response", rq: "request", rs: "requests", sa: "sample", sd: "skipped", se: "session", sk: "seek", sm: "stream", so: "source", sq: "sequence", sr: "series", st: "start", su: "startup", sv: "server", sw: "software", ta: "tag", tc: "tech", te: "text", tg: "target", th: "throughput", ti: "time", tl: "total", to: "to", tt: "title", ty: "type", ug: "upscaling", un: "universal", up: "upscale", ur: "url", us: "user", va: "variant", vd: "viewed", vi: "video", ve: "version", vw: "view", vr: "viewer", wd: "width", wa: "watch", wt: "waiting" });
753
+ function ft(n) {
754
+ var e = {};
755
+ for (var r in n)
756
+ n.hasOwnProperty(r) && (e[n[r]] = r);
757
+ return e;
758
+ }
759
+ function Me(n) {
760
+ var e = {}, r = {};
761
+ return Object.keys(n).forEach(function(t) {
762
+ var a = !1;
763
+ if (n.hasOwnProperty(t) && n[t] !== void 0) {
764
+ var o = t.split("_"), i = o[0], u = or[i];
765
+ u || (D.info("Data key word `" + o[0] + "` not expected in " + t), u = i + "_"), o.splice(1).forEach(function(l) {
766
+ l === "url" && (a = !0), ct[l] ? u += ct[l] : Number(l) && Math.floor(Number(l)) === Number(l) ? u += l : (D.info("Data key word `" + l + "` not expected in " + t), u += "_" + l + "_");
767
+ }), a ? r[u] = n[t] : e[u] = n[t];
768
+ }
769
+ }), Object.assign(e, r);
770
+ }
771
+ var sr = { maxBeaconSize: 300, maxQueueLength: 3600, baseTimeBetweenBeacons: 1e4, maxPayloadKBSize: 500 }, ur = ["hb", "requestcompleted", "requestfailed", "requestcanceled"], lr = "https://img.litix.io", pe = function(n) {
772
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
773
+ this._beaconUrl = n || lr, this._eventQueue = [], this._postInFlight = !1, this._failureCount = 0, this._sendTimeout = !1, this._options = Object.assign({}, sr, e);
774
+ };
775
+ pe.prototype.queueEvent = function(n, e) {
776
+ var r = Object.assign({}, e);
777
+ return (this._eventQueue.length <= this._options.maxQueueLength || n === "eventrateexceeded") && (this._eventQueue.push(r), this._sendTimeout || this._startBeaconSending(), this._eventQueue.length <= this._options.maxQueueLength);
778
+ }, pe.prototype.flushEvents = function() {
779
+ var n = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
780
+ n && this._eventQueue.length === 1 ? this._eventQueue.pop() : (this._eventQueue.length && this._sendBeaconQueue(), this._startBeaconSending());
781
+ }, pe.prototype.destroy = function() {
782
+ var n = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
783
+ this.destroyed = !0, n ? this._clearBeaconQueue() : this.flushEvents(), y().clearTimeout(this._sendTimeout);
784
+ }, pe.prototype._clearBeaconQueue = function() {
785
+ var n = this._eventQueue.length > this._options.maxBeaconSize ? this._eventQueue.length - this._options.maxBeaconSize : 0, e = this._eventQueue.slice(n);
786
+ n > 0 && Object.assign(e[e.length - 1], Me({ mux_view_message: "event queue truncated" }));
787
+ var r = this._createPayload(e);
788
+ pt(this._beaconUrl, r, !0, function() {
789
+ });
790
+ }, pe.prototype._sendBeaconQueue = function() {
791
+ var n = this;
792
+ if (!this._postInFlight) {
793
+ var e = this._eventQueue.slice(0, this._options.maxBeaconSize);
794
+ this._eventQueue = this._eventQueue.slice(this._options.maxBeaconSize), this._postInFlight = !0;
795
+ var r = this._createPayload(e), t = N.now();
796
+ pt(this._beaconUrl, r, !1, function(a, o) {
797
+ o ? (n._eventQueue = e.concat(n._eventQueue), n._failureCount += 1, D.info("Error sending beacon: " + o)) : n._failureCount = 0, n._roundTripTime = N.now() - t, n._postInFlight = !1;
798
+ });
799
+ }
800
+ }, pe.prototype._getNextBeaconTime = function() {
801
+ if (!this._failureCount)
802
+ return this._options.baseTimeBetweenBeacons;
803
+ var n = Math.pow(2, this._failureCount - 1);
804
+ return (1 + (n *= Math.random())) * this._options.baseTimeBetweenBeacons;
805
+ }, pe.prototype._startBeaconSending = function() {
806
+ var n = this;
807
+ y().clearTimeout(this._sendTimeout), this.destroyed || (this._sendTimeout = y().setTimeout(function() {
808
+ n._eventQueue.length && n._sendBeaconQueue(), n._startBeaconSending();
809
+ }, this._getNextBeaconTime()));
810
+ }, pe.prototype._createPayload = function(n) {
811
+ var e, r, t, a = this, o = { transmission_timestamp: Math.round(N.now()) };
812
+ this._roundTripTime && (o.rtt_ms = Math.round(this._roundTripTime));
813
+ var i = function() {
814
+ e = JSON.stringify({ metadata: o, events: r || n }), t = e.length / 1024;
815
+ }, u = function() {
816
+ return t <= a._options.maxPayloadKBSize;
817
+ };
818
+ return i(), u() || (D.info("Payload size is too big (" + t + " kb). Removing unnecessary events."), r = n.filter(function(l) {
819
+ return ur.indexOf(l.e) === -1;
820
+ }), i()), u() || (D.info("Payload size still too big (" + t + " kb). Cropping fields.."), r.forEach(function(l) {
821
+ for (var s in l) {
822
+ var f = l[s];
823
+ typeof f == "string" && f.length > 51200 && (l[s] = f.substring(0, 51200));
824
+ }
825
+ }), i()), e;
826
+ };
827
+ var dr = function(n) {
828
+ return n.length <= 57344;
829
+ }, pt = function(n, e, r, t) {
830
+ if (r && navigator && navigator.sendBeacon && navigator.sendBeacon(n, e))
831
+ t();
832
+ else if (y().fetch)
833
+ y().fetch(n, { method: "POST", body: e, headers: { "Content-Type": "text/plain" }, keepalive: dr(e) }).then(function(o) {
834
+ return t(null, o.ok ? null : "Error");
835
+ }).catch(function(o) {
836
+ return t(null, o);
837
+ });
838
+ else {
839
+ if (y().XMLHttpRequest) {
840
+ var a = new (y()).XMLHttpRequest();
841
+ return a.onreadystatechange = function() {
842
+ if (a.readyState === 4)
843
+ return t(null, a.status !== 200 ? "error" : void 0);
844
+ }, a.open("POST", n), a.setRequestHeader("Content-Type", "text/plain"), void a.send(e);
845
+ }
846
+ t();
847
+ }
848
+ }, cr = pe;
849
+ function fr(n, e) {
850
+ return function(r) {
851
+ if (Array.isArray(r))
852
+ return r;
853
+ }(n) || function(r, t) {
854
+ var a = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
855
+ if (a != null) {
856
+ var o, i, u = [], l = !0, s = !1;
857
+ try {
858
+ for (a = a.call(r); !(l = (o = a.next()).done) && (u.push(o.value), !t || u.length !== t); l = !0)
859
+ ;
860
+ } catch (f) {
861
+ s = !0, i = f;
862
+ } finally {
863
+ try {
864
+ l || a.return == null || a.return();
865
+ } finally {
866
+ if (s)
867
+ throw i;
868
+ }
869
+ }
870
+ return u;
871
+ }
872
+ }(n, e) || function(r, t) {
873
+ if (r) {
874
+ if (typeof r == "string")
875
+ return _t(r, t);
876
+ var a = Object.prototype.toString.call(r).slice(8, -1);
877
+ return a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set" ? Array.from(r) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? _t(r, t) : void 0;
878
+ }
879
+ }(n, e) || function() {
880
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
881
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
882
+ }();
883
+ }
884
+ function _t(n, e) {
885
+ (e == null || e > n.length) && (e = n.length);
886
+ for (var r = 0, t = new Array(e); r < e; r++)
887
+ t[r] = n[r];
888
+ return t;
889
+ }
890
+ function ht(n, e) {
891
+ var r = Object.keys(n);
892
+ if (Object.getOwnPropertySymbols) {
893
+ var t = Object.getOwnPropertySymbols(n);
894
+ e && (t = t.filter(function(a) {
895
+ return Object.getOwnPropertyDescriptor(n, a).enumerable;
896
+ })), r.push.apply(r, t);
897
+ }
898
+ return r;
899
+ }
900
+ function ke(n) {
901
+ for (var e = 1; e < arguments.length; e++) {
902
+ var r = arguments[e] != null ? arguments[e] : {};
903
+ e % 2 ? ht(Object(r), !0).forEach(function(t) {
904
+ Le(n, t, r[t]);
905
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(r)) : ht(Object(r)).forEach(function(t) {
906
+ Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(r, t));
907
+ });
908
+ }
909
+ return n;
910
+ }
911
+ function xe(n) {
912
+ return xe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
913
+ return typeof e;
914
+ } : function(e) {
915
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
916
+ }, xe(n);
917
+ }
918
+ function pr(n, e) {
919
+ if (!(n instanceof e))
920
+ throw new TypeError("Cannot call a class as a function");
921
+ }
922
+ function _r(n, e) {
923
+ for (var r = 0; r < e.length; r++) {
924
+ var t = e[r];
925
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
926
+ }
927
+ }
928
+ function Le(n, e, r) {
929
+ return e in n ? Object.defineProperty(n, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = r, n;
930
+ }
931
+ var hr = ["env_key", "view_id", "view_sequence_number", "player_sequence_number", "beacon_domain", "player_playhead_time", "viewer_time", "mux_api_version", "event", "video_id", "player_instance_id"], vr = ["adplay", "adplaying", "adpause", "adfirstquartile", "admidpoint", "adthirdquartile", "adended", "adresponse", "adrequest"], mr = ["ad_id", "ad_creative_id", "ad_universal_id"], yr = ["viewstart", "error", "ended", "viewend"], br = function() {
932
+ function n(t, a) {
933
+ var o, i, u, l, s, f, _, q, h, v, m, G, Z, z, H, _e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
934
+ pr(this, n), Le(this, "previousBeaconData", null), Le(this, "lastEventTime", 0), Le(this, "rateLimited", !1), this.mux = t, this.envKey = a, this.options = _e, this.eventQueue = new cr(ar(this.envKey, this.options)), this.sampleRate = (o = this.options.sampleRate) !== null && o !== void 0 ? o : 1, this.disableCookies = (i = this.options.disableCookies) !== null && i !== void 0 && i, this.respectDoNotTrack = (u = this.options.respectDoNotTrack) !== null && u !== void 0 && u, this.previousBeaconData = null, this.lastEventTime = 0, this.rateLimited = !1, this.pageLevelData = { mux_api_version: this.mux.API_VERSION, mux_embed: this.mux.NAME, mux_embed_version: this.mux.VERSION, viewer_application_name: (l = this.options.platform) === null || l === void 0 ? void 0 : l.name, viewer_application_version: (s = this.options.platform) === null || s === void 0 ? void 0 : s.version, viewer_application_engine: (f = this.options.platform) === null || f === void 0 ? void 0 : f.layout, viewer_device_name: (_ = this.options.platform) === null || _ === void 0 ? void 0 : _.product, viewer_device_category: "", viewer_device_manufacturer: (q = this.options.platform) === null || q === void 0 ? void 0 : q.manufacturer, viewer_os_family: (h = this.options.platform) === null || h === void 0 || (v = h.os) === null || v === void 0 ? void 0 : v.family, viewer_os_architecture: (m = this.options.platform) === null || m === void 0 || (G = m.os) === null || G === void 0 ? void 0 : G.architecture, viewer_os_version: (Z = this.options.platform) === null || Z === void 0 || (z = Z.os) === null || z === void 0 ? void 0 : z.version, viewer_connection_type: ir(), page_url: y() === null || y() === void 0 || (H = y().location) === null || H === void 0 ? void 0 : H.href }, this.viewerData = this.disableCookies ? {} : nr();
935
+ }
936
+ var e, r;
937
+ return e = n, (r = [{ key: "send", value: function(t, a) {
938
+ var o;
939
+ if (t && a != null && a.view_id) {
940
+ if (this.respectDoNotTrack && ne())
941
+ return D.info("Not sending `" + t + "` because Do Not Track is enabled");
942
+ if (!a || xe(a) !== "object")
943
+ return D.error("A data object was expected in send() but was not provided");
944
+ var i, u, l = this.disableCookies ? {} : (i = st(), u = N.now(), i.session_start && (i.sst = i.session_start, delete i.session_start), i.session_id && (i.sid = i.session_id, delete i.session_id), i.session_expires && (i.sex = i.session_expires, delete i.session_expires), (!i.sex || i.sex < u) && (i.sid = M(), i.sst = u), i.sex = u + 15e5, ut(i), { session_id: i.sid, session_start: i.sst, session_expires: i.sex }), s = ke(ke(ke(ke(ke({}, this.pageLevelData), a), l), this.viewerData), {}, { event: t, env_key: this.envKey });
945
+ s.user_id && (s.viewer_user_id = s.user_id, delete s.user_id);
946
+ var f = ((o = s.mux_sample_number) !== null && o !== void 0 ? o : 0) >= this.sampleRate, _ = Me(this._deduplicateBeaconData(t, s));
947
+ if (this.lastEventTime = this.mux.utils.now(), f)
948
+ return D.info("Not sending event due to sample rate restriction", t, s, _);
949
+ if (this.envKey || D.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL", t, s, _), !this.rateLimited) {
950
+ if (D.info("Sending event", t, s, _), this.rateLimited = !this.eventQueue.queueEvent(t, _), this.mux.WINDOW_UNLOADING && t === "viewend")
951
+ this.eventQueue.destroy(!0);
952
+ else if (this.mux.WINDOW_HIDDEN && t === "hb" ? this.eventQueue.flushEvents(!0) : yr.indexOf(t) >= 0 && this.eventQueue.flushEvents(), this.rateLimited)
953
+ return s.event = "eventrateexceeded", _ = Me(s), this.eventQueue.queueEvent(s.event, _), D.error("Beaconing disabled due to rate limit.");
954
+ }
955
+ }
956
+ } }, { key: "destroy", value: function() {
957
+ this.eventQueue.destroy(!1);
958
+ } }, { key: "_deduplicateBeaconData", value: function(t, a) {
959
+ var o = this, i = {}, u = a.view_id;
960
+ if (u === "-1" || t === "viewstart" || t === "viewend" || !this.previousBeaconData || this.mux.utils.now() - this.lastEventTime >= 6e5)
961
+ i = ke({}, a), u && (this.previousBeaconData = i), u && t === "viewend" && (this.previousBeaconData = null);
962
+ else {
963
+ var l = t.indexOf("request") === 0;
964
+ Object.entries(a).forEach(function(s) {
965
+ var f = fr(s, 2), _ = f[0], q = f[1];
966
+ o.previousBeaconData && (q !== o.previousBeaconData[_] || hr.indexOf(_) > -1 || o.objectHasChanged(l, _, q, o.previousBeaconData[_]) || o.eventRequiresKey(t, _)) && (i[_] = q, o.previousBeaconData[_] = q);
967
+ });
968
+ }
969
+ return i;
970
+ } }, { key: "objectHasChanged", value: function(t, a, o, i) {
971
+ return !(!t || a.indexOf("request_") !== 0 || a !== "request_response_headers" && xe(o) === "object" && xe(i) === "object" && Object.keys(o || {}).length === Object.keys(i || {}).length);
972
+ } }, { key: "eventRequiresKey", value: function(t, a) {
973
+ return t === "renditionchange" && a.indexOf("video_source_") === 0 || !(!mr.includes(a) || !vr.includes(t));
974
+ } }]) && _r(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), n;
975
+ }();
976
+ function vt(n, e) {
977
+ for (var r = 0; r < e.length; r++) {
978
+ var t = e[r];
979
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
980
+ }
981
+ }
982
+ function gr(n, e, r) {
983
+ return e && vt(n.prototype, e), r && vt(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
984
+ }
985
+ var wr = gr(function n(e) {
986
+ (function(s, f) {
987
+ if (!(s instanceof f))
988
+ throw new TypeError("Cannot call a class as a function");
989
+ })(this, n);
990
+ var r = 0, t = 0, a = 0, o = 0, i = 0, u = 0, l = 0;
991
+ e.on("requestcompleted", function(s, f) {
992
+ var _, q, h = f.request_start, v = f.request_response_start, m = f.request_response_end, G = f.request_bytes_loaded;
993
+ if (o++, v ? (_ = v - (h ?? 0), q = (m ?? 0) - v) : q = (m ?? 0) - (h ?? 0), q > 0 && G && G > 0) {
994
+ var Z = G / q * 8e3;
995
+ i++, t += G, a += q, e.data.view_min_request_throughput = Math.min(e.data.view_min_request_throughput || 1 / 0, Z), e.data.view_average_request_throughput = t / a * 8e3, e.data.view_request_count = o, _ > 0 && (r += _, e.data.view_max_request_latency = Math.max(e.data.view_max_request_latency || 0, _), e.data.view_average_request_latency = r / i);
996
+ }
997
+ }), e.on("requestfailed", function(s, f) {
998
+ o++, u++, e.data.view_request_count = o, e.data.view_request_failed_count = u;
999
+ }), e.on("requestcanceled", function(s, f) {
1000
+ o++, l++, e.data.view_request_count = o, e.data.view_request_canceled_count = l;
1001
+ });
1002
+ });
1003
+ function mt(n, e) {
1004
+ for (var r = 0; r < e.length; r++) {
1005
+ var t = e[r];
1006
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
1007
+ }
1008
+ }
1009
+ function Tr(n, e, r) {
1010
+ return e && mt(n.prototype, e), r && mt(n, r), Object.defineProperty(n, "prototype", { writable: !1 }), n;
1011
+ }
1012
+ var kr = Tr(function n(e) {
1013
+ var r = this;
1014
+ (function(t, a) {
1015
+ if (!(t instanceof a))
1016
+ throw new TypeError("Cannot call a class as a function");
1017
+ })(this, n), e.on("before*", function(t, a) {
1018
+ var o = a.viewer_time, i = N.now(), u = r._lastEventTime;
1019
+ if (r._lastEventTime = i, u && i - u > 36e5) {
1020
+ var l = Object.keys(e.data).reduce(function(s, f) {
1021
+ return f.indexOf("video_") === 0 ? Object.assign(s, function(_, q, h) {
1022
+ return q in _ ? Object.defineProperty(_, q, { value: h, enumerable: !0, configurable: !0, writable: !0 }) : _[q] = h, _;
1023
+ }({}, f, e.data[f])) : s;
1024
+ }, {});
1025
+ e.mux.log.info("Received event after at least an hour inactivity, creating a new view"), e.emit("viewinit", Object.assign({ viewer_time: o }, l)), e.playbackHeartbeat._playheadShouldBeProgressing && t.type !== "play" && t.type !== "adbreakstart" && (e.emit("play", { viewer_time: o }), t.type !== "playing" && e.emit("playing", { viewer_time: o }));
1026
+ }
1027
+ });
1028
+ });
1029
+ function Be(n) {
1030
+ return Be = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
1031
+ return typeof e;
1032
+ } : function(e) {
1033
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1034
+ }, Be(n);
1035
+ }
1036
+ function Er(n, e) {
1037
+ return function(r) {
1038
+ if (Array.isArray(r))
1039
+ return r;
1040
+ }(n) || function(r, t) {
1041
+ var a = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
1042
+ if (a != null) {
1043
+ var o, i, u = [], l = !0, s = !1;
1044
+ try {
1045
+ for (a = a.call(r); !(l = (o = a.next()).done) && (u.push(o.value), !t || u.length !== t); l = !0)
1046
+ ;
1047
+ } catch (f) {
1048
+ s = !0, i = f;
1049
+ } finally {
1050
+ try {
1051
+ l || a.return == null || a.return();
1052
+ } finally {
1053
+ if (s)
1054
+ throw i;
1055
+ }
1056
+ }
1057
+ return u;
1058
+ }
1059
+ }(n, e) || function(r, t) {
1060
+ if (r) {
1061
+ if (typeof r == "string")
1062
+ return yt(r, t);
1063
+ var a = Object.prototype.toString.call(r).slice(8, -1);
1064
+ return a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set" ? Array.from(r) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? yt(r, t) : void 0;
1065
+ }
1066
+ }(n, e) || function() {
1067
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1068
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1069
+ }();
1070
+ }
1071
+ function yt(n, e) {
1072
+ (e == null || e > n.length) && (e = n.length);
1073
+ for (var r = 0, t = new Array(e); r < e; r++)
1074
+ t[r] = n[r];
1075
+ return t;
1076
+ }
1077
+ function Or(n, e) {
1078
+ for (var r = 0; r < e.length; r++) {
1079
+ var t = e[r];
1080
+ t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
1081
+ }
1082
+ }
1083
+ function Ue(n, e) {
1084
+ return Ue = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, t) {
1085
+ return r.__proto__ = t, r;
1086
+ }, Ue(n, e);
1087
+ }
1088
+ function xr(n) {
1089
+ var e = function() {
1090
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
1091
+ return !1;
1092
+ if (typeof Proxy == "function")
1093
+ return !0;
1094
+ try {
1095
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
1096
+ })), !0;
1097
+ } catch {
1098
+ return !1;
1099
+ }
1100
+ }();
1101
+ return function() {
1102
+ var r, t = je(n);
1103
+ if (e) {
1104
+ var a = je(this).constructor;
1105
+ r = Reflect.construct(t, arguments, a);
1106
+ } else
1107
+ r = t.apply(this, arguments);
1108
+ return Dr(this, r);
1109
+ };
1110
+ }
1111
+ function Dr(n, e) {
1112
+ if (e && (Be(e) === "object" || typeof e == "function"))
1113
+ return e;
1114
+ if (e !== void 0)
1115
+ throw new TypeError("Derived constructors may only return object or undefined");
1116
+ return K(n);
1117
+ }
1118
+ function K(n) {
1119
+ if (n === void 0)
1120
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1121
+ return n;
1122
+ }
1123
+ function je(n) {
1124
+ return je = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
1125
+ return e.__proto__ || Object.getPrototypeOf(e);
1126
+ }, je(n);
1127
+ }
1128
+ var Sr = ["viewstart", "ended", "loadstart", "pause", "play", "playing", "ratechange", "waiting", "adplay", "adpause", "adended", "aderror", "adplaying", "adrequest", "adresponse", "adbreakstart", "adbreakend", "adfirstquartile", "admidpoint", "adthirdquartile", "rebufferstart", "rebufferend", "seeked", "error", "hb", "requestcompleted", "requestfailed", "requestcanceled", "renditionchange"], qr = function(n) {
1129
+ (function(o, i) {
1130
+ if (typeof i != "function" && i !== null)
1131
+ throw new TypeError("Super expression must either be null or a function");
1132
+ o.prototype = Object.create(i && i.prototype, { constructor: { value: o, writable: !0, configurable: !0 } }), Object.defineProperty(o, "prototype", { writable: !1 }), i && Ue(o, i);
1133
+ })(a, n);
1134
+ var e, r, t = xr(a);
1135
+ function a(o, i, u) {
1136
+ var l, s;
1137
+ (function(v, m) {
1138
+ if (!(v instanceof m))
1139
+ throw new TypeError("Cannot call a class as a function");
1140
+ })(this, a), (s = t.call(this)).DOM_CONTENT_LOADED_EVENT_END = se.domContentLoadedEventEnd(), s.NAVIGATION_START = se.navigationStart(), s.mux = o, s.id = i, (l = u) !== null && l !== void 0 && l.beaconDomain && s.mux.log.warn("The `beaconDomain` setting has been deprecated in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."), (u = Object.assign({ debug: !1, minimumRebufferDuration: 250, sustainedRebufferThreshold: 1e3, playbackHeartbeatTime: 25, beaconDomain: "litix.io", sampleRate: 1, disableCookies: !1, respectDoNotTrack: !1, disableRebufferTracking: !1, disablePlayheadRebufferTracking: !1, errorTranslator: function(v) {
1141
+ return v;
1142
+ } }, u)).data = u.data || {}, u.data.property_key && (u.data.env_key = u.data.property_key, delete u.data.property_key), D.setLevel(u.debug ? "debug" : "warn"), s.getPlayheadTime = u.getPlayheadTime, s.getStateData = u.getStateData || function() {
1143
+ return {};
1144
+ }, s.getAdData = u.getAdData || function() {
1145
+ }, s.minimumRebufferDuration = u.minimumRebufferDuration, s.sustainedRebufferThreshold = u.sustainedRebufferThreshold, s.playbackHeartbeatTime = u.playbackHeartbeatTime, s.disableRebufferTracking = u.disableRebufferTracking, s.disableRebufferTracking && s.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."), s.disablePlayheadRebufferTracking = u.disablePlayheadRebufferTracking, s.errorTranslator = u.errorTranslator, s.playbackEventDispatcher = new br(o, u.data.env_key, u), s.data = { player_instance_id: M(), mux_sample_rate: u.sampleRate, beacon_domain: u.beaconCollectionDomain || u.beaconDomain }, s.data.view_sequence_number = 1, s.data.player_sequence_number = 1, s.oldEmit = s.emit, s.emit = function(v, m) {
1146
+ m = Object.assign({ viewer_time: this.mux.utils.now() }, m), this.oldEmit(v, m);
1147
+ };
1148
+ var f = (function() {
1149
+ this.data.view_start === void 0 && (this.data.view_start = this.mux.utils.now(), this.emit("viewstart"));
1150
+ }).bind(K(s));
1151
+ s.on("viewinit", function(v, m) {
1152
+ this._resetVideoData(), this._resetViewData(), this._resetErrorData(), this._updateStateData(), Object.assign(this.data, m), this._initializeViewData(), this.one("play", f), this.one("adbreakstart", f);
1153
+ });
1154
+ var _ = (function(v) {
1155
+ this.emit("viewend"), this.send("viewend"), this.emit("viewinit", v);
1156
+ }).bind(K(s));
1157
+ if (s.on("videochange", function(v, m) {
1158
+ _(m);
1159
+ }), s.on("programchange", function(v, m) {
1160
+ this.data.player_is_paused && this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."), _(Object.assign(m, { view_program_changed: !0 })), f(), this.emit("play"), this.emit("playing");
1161
+ }), s.on("fragmentchange", function(v, m) {
1162
+ this.currentFragmentPDT = m.currentFragmentPDT, this.currentFragmentStart = m.currentFragmentStart;
1163
+ }), s.on("destroy", s.destroy), typeof window < "u" && typeof window.addEventListener == "function" && typeof window.removeEventListener == "function") {
1164
+ var q = function() {
1165
+ var v = s.data.view_start !== void 0;
1166
+ s.mux.WINDOW_HIDDEN = document.visibilityState === "hidden", v && s.mux.WINDOW_HIDDEN && (s.data.player_is_paused || s.emit("hb"));
1167
+ };
1168
+ window.addEventListener("visibilitychange", q, !1);
1169
+ var h = function(v) {
1170
+ v.persisted || s.destroy();
1171
+ };
1172
+ window.addEventListener("pagehide", h, !1), s.on("destroy", function() {
1173
+ window.removeEventListener("visibilitychange", q), window.removeEventListener("pagehide", h);
1174
+ });
1175
+ }
1176
+ return s.on("playerready", function(v, m) {
1177
+ Object.assign(this.data, m);
1178
+ }), Sr.forEach(function(v) {
1179
+ s.on(v, function(m, G) {
1180
+ v.indexOf("ad") !== 0 && this._updateStateData(), Object.assign(this.data, G), this._sanitizeData();
1181
+ }), s.on("after" + v, function() {
1182
+ (v !== "error" || this.errorTracker.viewErrored) && this.send(v);
1183
+ });
1184
+ }), s.on("viewend", function(v, m) {
1185
+ Object.assign(s.data, m);
1186
+ }), s.one("playerready", function(v) {
1187
+ var m = this.mux.utils.now();
1188
+ this.data.player_init_time && (this.data.player_startup_time = m - this.data.player_init_time), !this.mux.PLAYER_TRACKED && this.NAVIGATION_START && (this.mux.PLAYER_TRACKED = !0, (this.data.player_init_time || this.DOM_CONTENT_LOADED_EVENT_END) && (this.data.page_load_time = Math.min(this.data.player_init_time || 1 / 0, this.DOM_CONTENT_LOADED_EVENT_END || 1 / 0) - this.NAVIGATION_START)), this.send("playerready"), delete this.data.player_startup_time, delete this.data.page_load_time;
1189
+ }), s.longResumeTracker = new kr(K(s)), s.errorTracker = new At(K(s)), new tr(K(s)), s.seekingTracker = new Kt(K(s)), s.playheadTime = new Nt(K(s)), s.playbackHeartbeat = new qt(K(s)), new Vt(K(s)), s.watchTimeTracker = new It(K(s)), new jt(K(s)), s.adTracker = new Xt(K(s)), new Ft(K(s)), new Mt(K(s)), new Gt(K(s)), new Zt(K(s)), new wr(K(s)), u.hlsjs && s.addHLSJS(u), u.dashjs && s.addDashJS(u), s.emit("viewinit", u.data), s;
1190
+ }
1191
+ return e = a, r = [{ key: "destroy", value: function() {
1192
+ this._destroyed || (this._destroyed = !0, this.data.view_start !== void 0 && (this.emit("viewend"), this.send("viewend")), this.playbackEventDispatcher.destroy(), this.removeHLSJS(), this.removeDashJS(), window.clearTimeout(this._heartBeatTimeout));
1193
+ } }, { key: "send", value: function(o) {
1194
+ if (this.data.view_id) {
1195
+ var i = Object.assign({}, this.data);
1196
+ if (i.video_source_is_live === void 0 && (i.player_source_duration === 1 / 0 || i.video_source_duration === 1 / 0 ? i.video_source_is_live = !0 : (i.player_source_duration > 0 || i.video_source_duration > 0) && (i.video_source_is_live = !1)), i.video_source_is_live || ["player_program_time", "player_manifest_newest_program_time", "player_live_edge_program_time", "player_program_time", "video_holdback", "video_part_holdback", "video_target_duration", "video_part_target_duration"].forEach(function(f) {
1197
+ i[f] = void 0;
1198
+ }), i.video_source_url = i.video_source_url || i.player_source_url, i.video_source_url) {
1199
+ var u = Er(ue(i.video_source_url), 2), l = u[0], s = u[1];
1200
+ i.video_source_domain = s, i.video_source_hostname = l;
1201
+ }
1202
+ delete i.ad_request_id, this.playbackEventDispatcher.send(o, i), this.data.view_sequence_number++, this.data.player_sequence_number++, this._restartHeartBeat(), o === "viewend" && delete this.data.view_id;
1203
+ }
1204
+ } }, { key: "_updateStateData", value: function() {
1205
+ Object.assign(this.data, this.getStateData()), this.playheadTime._updatePlayheadTime(), this._sanitizeData();
1206
+ } }, { key: "_sanitizeData", value: function() {
1207
+ var o = this;
1208
+ ["player_width", "player_height", "video_source_width", "video_source_height", "player_playhead_time", "video_source_bitrate"].forEach(function(i) {
1209
+ var u = parseInt(o.data[i], 10);
1210
+ o.data[i] = isNaN(u) ? void 0 : u;
1211
+ }), ["player_source_url", "video_source_url"].forEach(function(i) {
1212
+ if (o.data[i]) {
1213
+ var u = o.data[i].toLowerCase();
1214
+ u.indexOf("data:") !== 0 && u.indexOf("blob:") !== 0 || (o.data[i] = "MSE style URL");
1215
+ }
1216
+ });
1217
+ } }, { key: "_resetVideoData", value: function(o, i) {
1218
+ var u = this;
1219
+ Object.keys(this.data).forEach(function(l) {
1220
+ l.indexOf("video_") === 0 && delete u.data[l];
1221
+ });
1222
+ } }, { key: "_resetViewData", value: function() {
1223
+ var o = this;
1224
+ Object.keys(this.data).forEach(function(i) {
1225
+ i.indexOf("view_") === 0 && delete o.data[i];
1226
+ }), this.data.view_sequence_number = 1;
1227
+ } }, { key: "_resetErrorData", value: function(o, i) {
1228
+ delete this.data.player_error_code, delete this.data.player_error_message;
1229
+ } }, { key: "_initializeViewData", value: function() {
1230
+ var o = this, i = this.data.view_id = M(), u = function() {
1231
+ i === o.data.view_id && A(o.data, "player_view_count", 1);
1232
+ };
1233
+ this.data.player_is_paused ? this.one("play", u) : u();
1234
+ } }, { key: "_restartHeartBeat", value: function() {
1235
+ var o = this;
1236
+ window.clearTimeout(this._heartBeatTimeout), this.errorTracker.viewErrored || (this._heartBeatTimeout = window.setTimeout(function() {
1237
+ o.data.player_is_paused || o.emit("hb");
1238
+ }, 1e4));
1239
+ } }, { key: "addHLSJS", value: function(o) {
1240
+ o.hlsjs ? this.hlsjs ? this.mux.log.warn("An instance of HLS.js is already being monitored for this player.") : (this.hlsjs = o.hlsjs, function(i, u, l) {
1241
+ var s = arguments.length > 4 ? arguments[4] : void 0, f = i.log, _ = i.utils.secondsToMs, q = function(Q) {
1242
+ var p, c = parseInt(s.version);
1243
+ return c === 1 && Q.programDateTime !== null && (p = Q.programDateTime), c === 0 && Q.pdt !== null && (p = Q.pdt), p;
1244
+ };
1245
+ if (se.exists()) {
1246
+ var h = function(Q, p) {
1247
+ return i.emit(u, Q, p);
1248
+ }, v = function(Q, p) {
1249
+ var c = p.levels, d = p.audioTracks, b = p.url, w = p.stats, O = p.networkDetails, j = p.sessionData, V = {}, F = {};
1250
+ c.forEach(function(oe, be) {
1251
+ V[be] = { width: oe.width, height: oe.height, bitrate: oe.bitrate, attrs: oe.attrs };
1252
+ }), d.forEach(function(oe, be) {
1253
+ F[be] = { name: oe.name, language: oe.lang, bitrate: oe.bitrate };
1254
+ });
1255
+ var R = ge(w), Y = R.bytesLoaded, me = R.requestStart, qe = R.responseStart, Pe = R.responseEnd;
1256
+ h("requestcompleted", B(B({}, $(j)), {}, { request_event_type: Q, request_bytes_loaded: Y, request_start: me, request_response_start: qe, request_response_end: Pe, request_type: "manifest", request_hostname: ee(b), request_response_headers: ve(O), request_rendition_lists: { media: V, audio: F, video: {} } }));
1257
+ };
1258
+ l.on(s.Events.MANIFEST_LOADED, v);
1259
+ var m = function(Q, p) {
1260
+ var c = p.details, d = p.level, b = p.networkDetails, w = p.stats, O = ge(w), j = O.bytesLoaded, V = O.requestStart, F = O.responseStart, R = O.responseEnd, Y = c.fragments[c.fragments.length - 1], me = q(Y) + _(Y.duration);
1261
+ h("requestcompleted", { request_event_type: Q, request_bytes_loaded: j, request_start: V, request_response_start: F, request_response_end: R, request_current_level: d, request_type: "manifest", request_hostname: ee(c.url), request_response_headers: ve(b), video_holdback: c.holdBack && _(c.holdBack), video_part_holdback: c.partHoldBack && _(c.partHoldBack), video_part_target_duration: c.partTarget && _(c.partTarget), video_target_duration: c.targetduration && _(c.targetduration), video_source_is_live: c.live, player_manifest_newest_program_time: isNaN(me) ? void 0 : me });
1262
+ };
1263
+ l.on(s.Events.LEVEL_LOADED, m);
1264
+ var G = function(Q, p) {
1265
+ var c = p.details, d = p.networkDetails, b = p.stats, w = ge(b), O = w.bytesLoaded, j = w.requestStart, V = w.responseStart, F = w.responseEnd;
1266
+ h("requestcompleted", { request_event_type: Q, request_bytes_loaded: O, request_start: j, request_response_start: V, request_response_end: F, request_type: "manifest", request_hostname: ee(c.url), request_response_headers: ve(d) });
1267
+ };
1268
+ l.on(s.Events.AUDIO_TRACK_LOADED, G);
1269
+ var Z = function(Q, p) {
1270
+ var c = p.stats, d = p.networkDetails, b = p.frag;
1271
+ c = c || b.stats;
1272
+ var w = ge(c), O = w.bytesLoaded, j = w.requestStart, V = w.responseStart, F = w.responseEnd, R = d ? ve(d) : void 0, Y = { request_event_type: Q, request_bytes_loaded: O, request_start: j, request_response_start: V, request_response_end: F, request_hostname: d ? ee(d.responseURL) : void 0, request_id: R ? W(R) : void 0, request_response_headers: R, request_media_duration: b.duration, request_url: d == null ? void 0 : d.responseURL };
1273
+ b.type === "main" ? (Y.request_type = "media", Y.request_current_level = b.level, Y.request_video_width = (l.levels[b.level] || {}).width, Y.request_video_height = (l.levels[b.level] || {}).height, Y.request_labeled_bitrate = (l.levels[b.level] || {}).bitrate) : Y.request_type = b.type, h("requestcompleted", Y);
1274
+ };
1275
+ l.on(s.Events.FRAG_LOADED, Z);
1276
+ var z = function(Q, p) {
1277
+ var c = p.frag, d = c.start, b = { currentFragmentPDT: q(c), currentFragmentStart: _(d) };
1278
+ h("fragmentchange", b);
1279
+ };
1280
+ l.on(s.Events.FRAG_CHANGED, z);
1281
+ var H = function(Q, p) {
1282
+ var c = p.type, d = p.details, b = p.response, w = p.fatal, O = p.frag, j = p.networkDetails, V = (O == null ? void 0 : O.url) || p.url || "", F = j ? ve(j) : void 0;
1283
+ if (d !== s.ErrorDetails.MANIFEST_LOAD_ERROR && d !== s.ErrorDetails.MANIFEST_LOAD_TIMEOUT && d !== s.ErrorDetails.FRAG_LOAD_ERROR && d !== s.ErrorDetails.FRAG_LOAD_TIMEOUT && d !== s.ErrorDetails.LEVEL_LOAD_ERROR && d !== s.ErrorDetails.LEVEL_LOAD_TIMEOUT && d !== s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR && d !== s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT && d !== s.ErrorDetails.SUBTITLE_LOAD_ERROR && d !== s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT && d !== s.ErrorDetails.KEY_LOAD_ERROR && d !== s.ErrorDetails.KEY_LOAD_TIMEOUT || h("requestfailed", { request_error: d, request_url: V, request_hostname: ee(V), request_id: F ? W(F) : void 0, request_type: d === s.ErrorDetails.FRAG_LOAD_ERROR || d === s.ErrorDetails.FRAG_LOAD_TIMEOUT ? "media" : d === s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR || d === s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT ? "audio" : d === s.ErrorDetails.SUBTITLE_LOAD_ERROR || d === s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT ? "subtitle" : d === s.ErrorDetails.KEY_LOAD_ERROR || d === s.ErrorDetails.KEY_LOAD_TIMEOUT ? "encryption" : "manifest", request_error_code: b == null ? void 0 : b.code, request_error_text: b == null ? void 0 : b.text }), w) {
1284
+ var R, Y = "".concat(V ? "url: ".concat(V, `
1285
+ `) : "") + "".concat(b && (b.code || b.text) ? "response: ".concat(b.code, ", ").concat(b.text, `
1286
+ `) : "") + "".concat(p.reason ? "failure reason: ".concat(p.reason, `
1287
+ `) : "") + "".concat(p.level ? "level: ".concat(p.level, `
1288
+ `) : "") + "".concat(p.parent ? "parent stream controller: ".concat(p.parent, `
1289
+ `) : "") + "".concat(p.buffer ? "buffer length: ".concat(p.buffer, `
1290
+ `) : "") + "".concat(p.error ? "error: ".concat(p.error, `
1291
+ `) : "") + "".concat(p.event ? "event: ".concat(p.event, `
1292
+ `) : "") + "".concat(p.err ? "error message: ".concat((R = p.err) === null || R === void 0 ? void 0 : R.message, `
1293
+ `) : "");
1294
+ h("error", { player_error_code: c, player_error_message: d, player_error_context: Y });
1295
+ }
1296
+ };
1297
+ l.on(s.Events.ERROR, H);
1298
+ var _e = function(Q, p) {
1299
+ var c = p.frag, d = c && c._url || "";
1300
+ h("requestcanceled", { request_event_type: Q, request_url: d, request_type: "media", request_hostname: ee(d) });
1301
+ };
1302
+ l.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED, _e);
1303
+ var ye = function(Q, p) {
1304
+ var c = p.level, d = l.levels[c];
1305
+ if (d && d.attrs && d.attrs.BANDWIDTH) {
1306
+ var b, w = d.attrs.BANDWIDTH, O = parseFloat(d.attrs["FRAME-RATE"]);
1307
+ isNaN(O) || (b = O), w ? h("renditionchange", { video_source_fps: b, video_source_bitrate: w, video_source_width: d.width, video_source_height: d.height, video_source_rendition_name: d.name, video_source_codec: d == null ? void 0 : d.videoCodec }) : f.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js");
1308
+ }
1309
+ };
1310
+ l.on(s.Events.LEVEL_SWITCHED, ye), l._stopMuxMonitor = function() {
1311
+ l.off(s.Events.MANIFEST_LOADED, v), l.off(s.Events.LEVEL_LOADED, m), l.off(s.Events.AUDIO_TRACK_LOADED, G), l.off(s.Events.FRAG_LOADED, Z), l.off(s.Events.FRAG_CHANGED, z), l.off(s.Events.ERROR, H), l.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED, _e), l.off(s.Events.LEVEL_SWITCHED, ye), l.off(s.Events.DESTROYING, l._stopMuxMonitor), delete l._stopMuxMonitor;
1312
+ }, l.on(s.Events.DESTROYING, l._stopMuxMonitor);
1313
+ } else
1314
+ f.warn("performance timing not supported. Not tracking HLS.js.");
1315
+ }(this.mux, this.id, o.hlsjs, {}, o.Hls || window.Hls)) : this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");
1316
+ } }, { key: "removeHLSJS", value: function() {
1317
+ var o;
1318
+ this.hlsjs && ((o = this.hlsjs) && typeof o._stopMuxMonitor == "function" && o._stopMuxMonitor(), this.hlsjs = void 0);
1319
+ } }, { key: "addDashJS", value: function(o) {
1320
+ o.dashjs ? this.dashjs ? this.mux.log.warn("An instance of Dash.js is already being monitored for this player.") : (this.dashjs = o.dashjs, function(i, u, l) {
1321
+ var s = i.log;
1322
+ if (l && l.on) {
1323
+ var f = Et(l), _ = function(c, d) {
1324
+ return i.emit(u, c, d);
1325
+ }, q = function(c) {
1326
+ var d = c.type, b = (c.data || {}).url;
1327
+ _("requestcompleted", { request_event_type: d, request_start: 0, request_response_start: 0, request_response_end: 0, request_bytes_loaded: -1, request_type: "manifest", request_hostname: ee(b), request_url: b });
1328
+ };
1329
+ l.on("manifestLoaded", q);
1330
+ var h = {}, v = function(c) {
1331
+ if (typeof c.getRequests != "function")
1332
+ return null;
1333
+ var d = c.getRequests({ state: "executed" });
1334
+ return d.length === 0 ? null : d[d.length - 1];
1335
+ }, m = function(c) {
1336
+ var d = c.type, b = c.fragmentModel, w = c.chunk, O = v(b);
1337
+ G({ type: d, request: O, chunk: w });
1338
+ }, G = function(c) {
1339
+ var d = c.type, b = c.chunk, w = c.request, O = (b || {}).mediaInfo || {}, j = O.type, V = O.bitrateList, F = {};
1340
+ (V = V || []).forEach(function(Ae, de) {
1341
+ F[de] = {}, F[de].width = Ae.width, F[de].height = Ae.height, F[de].bitrate = Ae.bandwidth, F[de].attrs = {};
1342
+ }), j === "video" ? h.video = F : j === "audio" ? h.audio = F : h.media = F;
1343
+ var R = le(w, l), Y = R.requestStart, me = R.requestResponseStart, qe = R.requestResponseEnd, Pe = R.requestResponseHeaders, oe = R.requestMediaDuration, be = R.requestHostname, Qe = R.requestUrl, Ve = R.requestId;
1344
+ _("requestcompleted", { request_event_type: d, request_start: Y, request_response_start: me, request_response_end: qe, request_bytes_loaded: -1, request_type: j + "_init", request_response_headers: Pe, request_hostname: be, request_id: Ve, request_url: Qe, request_media_duration: oe, request_rendition_lists: h });
1345
+ };
1346
+ f >= 4 ? l.on("initFragmentLoaded", G) : l.on("initFragmentLoaded", m);
1347
+ var Z = function(c) {
1348
+ var d = c.type, b = c.fragmentModel, w = c.chunk, O = v(b);
1349
+ z({ type: d, request: O, chunk: w });
1350
+ }, z = function(c) {
1351
+ var d = c.type, b = c.chunk, w = c.request, O = b || {}, j = O.mediaInfo, V = O.start, F = (j || {}).type, R = le(w, l), Y = R.requestStart, me = R.requestResponseStart, qe = R.requestResponseEnd, Pe = R.requestBytesLoaded, oe = R.requestResponseHeaders, be = R.requestMediaDuration, Qe = R.requestHostname, Ve = R.requestUrl, Ae = R.requestId, de = Te(F, l), $r = de.currentLevel, Zr = de.renditionWidth, en = de.renditionHeight, tn = de.renditionBitrate;
1352
+ _("requestcompleted", { request_event_type: d, request_start: Y, request_response_start: me, request_response_end: qe, request_bytes_loaded: Pe, request_type: F, request_response_headers: oe, request_hostname: Qe, request_id: Ae, request_url: Ve, request_media_start_time: V, request_media_duration: be, request_current_level: $r, request_labeled_bitrate: tn, request_video_width: Zr, request_video_height: en });
1353
+ };
1354
+ f >= 4 ? l.on("mediaFragmentLoaded", z) : l.on("mediaFragmentLoaded", Z);
1355
+ var H = { video: void 0, audio: void 0, totalBitrate: void 0 }, _e = function() {
1356
+ if (H.video && typeof H.video.bitrate == "number") {
1357
+ if (H.video.width && H.video.height) {
1358
+ var c = H.video.bitrate;
1359
+ return H.audio && typeof H.audio.bitrate == "number" && (c += H.audio.bitrate), c !== H.totalBitrate ? (H.totalBitrate = c, { video_source_bitrate: c, video_source_height: H.video.height, video_source_width: H.video.width, video_source_codec: He(H.video.codec) }) : void 0;
1360
+ }
1361
+ s.warn("have bitrate info for video but missing width/height");
1362
+ }
1363
+ }, ye = function(c, d, b) {
1364
+ if (typeof c.newQuality == "number") {
1365
+ var w = c.mediaType;
1366
+ if (w === "audio" || w === "video") {
1367
+ var O = l.getBitrateInfoListFor(w).find(function(V) {
1368
+ return V.qualityIndex === c.newQuality;
1369
+ });
1370
+ if (O && typeof O.bitrate == "number") {
1371
+ H[w] = we(we({}, O), {}, { codec: l.getCurrentTrackFor(w).codec });
1372
+ var j = _e();
1373
+ j && _("renditionchange", j);
1374
+ } else
1375
+ s.warn("missing bitrate info for ".concat(w));
1376
+ }
1377
+ } else
1378
+ s.warn("missing evt.newQuality in qualityChangeRendered event", c);
1379
+ };
1380
+ l.on("qualityChangeRendered", ye);
1381
+ var Q = function(c) {
1382
+ var d = c.request, b = c.mediaType;
1383
+ _("requestcanceled", { request_event_type: (d = d || {}).type + "_" + d.action, request_url: d.url, request_type: b, request_hostname: ee(d.url) });
1384
+ };
1385
+ l.on("fragmentLoadingAbandoned", Q);
1386
+ var p = function(c) {
1387
+ var d, b, w = c.error, O = (w == null || (d = w.data) === null || d === void 0 ? void 0 : d.request) || {}, j = (w == null || (b = w.data) === null || b === void 0 ? void 0 : b.response) || {};
1388
+ (w == null ? void 0 : w.code) === 27 && _("requestfailed", { request_error: O.type + "_" + O.action, request_url: O.url, request_hostname: ee(O.url), request_type: O.mediaType, request_error_code: j.status, request_error_text: j.statusText });
1389
+ var V = "".concat(O != null && O.url ? "url: ".concat(O.url, `
1390
+ `) : "") + "".concat(j != null && j.status || j != null && j.statusText ? "response: ".concat(j == null ? void 0 : j.status, ", ").concat(j == null ? void 0 : j.statusText, `
1391
+ `) : "");
1392
+ _("error", { player_error_code: w == null ? void 0 : w.code, player_error_message: w == null ? void 0 : w.message, player_error_context: V });
1393
+ };
1394
+ l.on("error", p), l._stopMuxMonitor = function() {
1395
+ l.off("manifestLoaded", q), l.off("initFragmentLoaded", G), l.off("mediaFragmentLoaded", z), l.off("qualityChangeRendered", ye), l.off("error", p), l.off("fragmentLoadingAbandoned", Q), delete l._stopMuxMonitor;
1396
+ };
1397
+ } else
1398
+ s.warn("Invalid dash.js player reference. Monitoring blocked.");
1399
+ }(this.mux, this.id, o.dashjs)) : this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");
1400
+ } }, { key: "removeDashJS", value: function() {
1401
+ var o;
1402
+ this.dashjs && ((o = this.dashjs) && typeof o._stopMuxMonitor == "function" && o._stopMuxMonitor(), this.dashjs = void 0);
1403
+ } }], r && Or(e.prototype, r), Object.defineProperty(e, "prototype", { writable: !1 }), a;
1404
+ }(Dt), Pr = qr, Ar = x(153), De = x.n(Ar);
1405
+ function Fe(n) {
1406
+ return Fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
1407
+ return typeof e;
1408
+ } : function(e) {
1409
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1410
+ }, Fe(n);
1411
+ }
1412
+ function bt(n, e) {
1413
+ return function(r) {
1414
+ if (Array.isArray(r))
1415
+ return r;
1416
+ }(n) || function(r, t) {
1417
+ var a = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
1418
+ if (a != null) {
1419
+ var o, i, u = [], l = !0, s = !1;
1420
+ try {
1421
+ for (a = a.call(r); !(l = (o = a.next()).done) && (u.push(o.value), !t || u.length !== t); l = !0)
1422
+ ;
1423
+ } catch (f) {
1424
+ s = !0, i = f;
1425
+ } finally {
1426
+ try {
1427
+ l || a.return == null || a.return();
1428
+ } finally {
1429
+ if (s)
1430
+ throw i;
1431
+ }
1432
+ }
1433
+ return u;
1434
+ }
1435
+ }(n, e) || function(r, t) {
1436
+ if (r) {
1437
+ if (typeof r == "string")
1438
+ return gt(r, t);
1439
+ var a = Object.prototype.toString.call(r).slice(8, -1);
1440
+ return a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set" ? Array.from(r) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? gt(r, t) : void 0;
1441
+ }
1442
+ }(n, e) || function() {
1443
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1444
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1445
+ }();
1446
+ }
1447
+ function gt(n, e) {
1448
+ (e == null || e > n.length) && (e = n.length);
1449
+ for (var r = 0, t = new Array(e); r < e; r++)
1450
+ t[r] = n[r];
1451
+ return t;
1452
+ }
1453
+ var Ee, Rr = ["loadstart", "pause", "play", "playing", "seeking", "seeked", "timeupdate", "ratechange", "stalled", "waiting", "error", "ended"], Ir = { 1: "MEDIA_ERR_ABORTED", 2: "MEDIA_ERR_NETWORK", 3: "MEDIA_ERR_DECODE", 4: "MEDIA_ERR_SRC_NOT_SUPPORTED" };
1454
+ y() && y().WeakMap && (Ee = /* @__PURE__ */ new WeakMap());
1455
+ var Lr = "#EXT-X-TARGETDURATION", jr = "#EXT-X-PART-INF", Cr = "#EXT-X-SERVER-CONTROL", Nr = "#EXTINF", Hr = "#EXT-X-PROGRAM-DATE-TIME", Mr = "#EXT-X-VERSION", Br = "#EXT-X-SESSION-DATA", Ce = function(n) {
1456
+ return this.buffer = "", this.manifest = { segments: [], serverControl: {}, sessionData: {} }, this.currentUri = {}, this.process(n), this.manifest;
1457
+ };
1458
+ Ce.prototype.process = function(n) {
1459
+ var e;
1460
+ for (this.buffer += n, e = this.buffer.indexOf(`
1461
+ `); e > -1; e = this.buffer.indexOf(`
1462
+ `))
1463
+ this.processLine(this.buffer.substring(0, e)), this.buffer = this.buffer.substring(e + 1);
1464
+ }, Ce.prototype.processLine = function(n) {
1465
+ var e = n.indexOf(":"), r = Gr(n, e), t = r[0], a = r.length === 2 ? Ge(r[1]) : void 0;
1466
+ if (t[0] !== "#")
1467
+ this.currentUri.uri = t, this.manifest.segments.push(this.currentUri), this.manifest.targetDuration && !("duration" in this.currentUri) && (this.currentUri.duration = this.manifest.targetDuration), this.currentUri = {};
1468
+ else
1469
+ switch (t) {
1470
+ case Lr:
1471
+ if (!isFinite(a) || a < 0)
1472
+ return;
1473
+ this.manifest.targetDuration = a, this.setHoldBack();
1474
+ break;
1475
+ case jr:
1476
+ We(this.manifest, r), this.manifest.partInf.partTarget && (this.manifest.partTargetDuration = this.manifest.partInf.partTarget), this.setHoldBack();
1477
+ break;
1478
+ case Cr:
1479
+ We(this.manifest, r), this.setHoldBack();
1480
+ break;
1481
+ case Nr:
1482
+ a === 0 ? this.currentUri.duration = 0.01 : a > 0 && (this.currentUri.duration = a);
1483
+ break;
1484
+ case Hr:
1485
+ var o = a, i = new Date(o);
1486
+ this.manifest.dateTimeString || (this.manifest.dateTimeString = o, this.manifest.dateTimeObject = i), this.currentUri.dateTimeString = o, this.currentUri.dateTimeObject = i;
1487
+ break;
1488
+ case Mr:
1489
+ We(this.manifest, r);
1490
+ break;
1491
+ case Br:
1492
+ var u = Qr(r[1]), l = $(u);
1493
+ Object.assign(this.manifest.sessionData, l);
1494
+ }
1495
+ }, Ce.prototype.setHoldBack = function() {
1496
+ var n = this.manifest, e = n.serverControl, r = n.targetDuration, t = n.partTargetDuration;
1497
+ if (e) {
1498
+ var a = "holdBack", o = "partHoldBack", i = r && 3 * r, u = t && 2 * t;
1499
+ r && !e.hasOwnProperty(a) && (e[a] = i), i && e[a] < i && (e[a] = i), t && !e.hasOwnProperty(o) && (e[o] = 3 * t), t && e[o] < u && (e[o] = u);
1500
+ }
1501
+ };
1502
+ var We = function(n, e) {
1503
+ var r, t = wt(e[0].replace("#EXT-X-", ""));
1504
+ Wr(e[1]) ? (r = {}, r = Object.assign(Fr(e[1]), r)) : r = Ge(e[1]), n[t] = r;
1505
+ }, wt = function(n) {
1506
+ return n.toLowerCase().replace(/-(\w)/g, function(e) {
1507
+ return e[1].toUpperCase();
1508
+ });
1509
+ }, Ge = function(n) {
1510
+ if (n.toLowerCase() === "yes" || n.toLowerCase() === "no")
1511
+ return n.toLowerCase() === "yes";
1512
+ var e = n.indexOf(":") !== -1 ? n : parseFloat(n);
1513
+ return isNaN(e) ? n : e;
1514
+ }, Ur = function(n) {
1515
+ var e = {}, r = n.split("=");
1516
+ return r.length > 1 && (e[wt(r[0])] = Ge(r[1])), e;
1517
+ }, Fr = function(n) {
1518
+ for (var e = n.split(","), r = {}, t = 0; e.length > t; t++) {
1519
+ var a = e[t], o = Ur(a);
1520
+ r = Object.assign(o, r);
1521
+ }
1522
+ return r;
1523
+ }, Wr = function(n) {
1524
+ return n.indexOf("=") > -1;
1525
+ }, Gr = function(n, e) {
1526
+ return e === -1 ? [n] : [n.substring(0, e), n.substring(e + 1)];
1527
+ }, Qr = function(n) {
1528
+ var e = {};
1529
+ if (n) {
1530
+ var r = n.search(",");
1531
+ return [n.slice(0, r), n.slice(r + 1)].forEach(function(t, a) {
1532
+ for (var o = t.replace(/['"]+/g, "").split("="), i = 0; i < o.length; i++)
1533
+ o[i] === "DATA-ID" && (e["DATA-ID"] = o[1 - i]), o[i] === "VALUE" && (e.VALUE = o[1 - i]);
1534
+ }), { data: e };
1535
+ }
1536
+ }, Vr = Ce, Jr = { safeCall: function(n, e, r, t) {
1537
+ var a = t;
1538
+ if (n && typeof n[e] == "function")
1539
+ try {
1540
+ a = n[e].apply(n, r);
1541
+ } catch (o) {
1542
+ D.info("safeCall error", o);
1543
+ }
1544
+ return a;
1545
+ }, safeIncrement: A, getComputedStyle: function(n, e) {
1546
+ var r;
1547
+ if (n && e && y() && typeof y().getComputedStyle == "function")
1548
+ return Ee && Ee.has(n) && (r = Ee.get(n)), r || (r = y().getComputedStyle(n, null), Ee && Ee.set(n, r)), r.getPropertyValue(e);
1549
+ }, secondsToMs: function(n) {
1550
+ return Math.floor(1e3 * n);
1551
+ }, assign: Object.assign, headersStringToObject: S, cdnHeadersToRequestId: W, extractHostnameAndDomain: ue, extractHostname: ee, manifestParser: Vr, generateShortID: C, generateUUID: M, now: N.now }, Kr = { PLAYER_READY: "playerready", VIEW_INIT: "viewinit", VIDEO_CHANGE: "videochange", PLAY: "play", PAUSE: "pause", PLAYING: "playing", TIME_UPDATE: "timeupdate", SEEKING: "seeking", SEEKED: "seeked", REBUFFER_START: "rebufferstart", REBUFFER_END: "rebufferend", ERROR: "error", ENDED: "ended", RENDITION_CHANGE: "renditionchange", ORIENTATION_CHANGE: "orientationchange", AD_REQUEST: "adrequest", AD_RESPONSE: "adresponse", AD_BREAK_START: "adbreakstart", AD_PLAY: "adplay", AD_PLAYING: "adplaying", AD_PAUSE: "adpause", AD_FIRST_QUARTILE: "adfirstquartile", AD_MID_POINT: "admidpoint", AD_THIRD_QUARTILE: "adthirdquartile", AD_ENDED: "adended", AD_BREAK_END: "adbreakend", AD_ERROR: "aderror", REQUEST_COMPLETED: "requestcompleted", REQUEST_FAILED: "requestfailed", REQUEST_CANCELLED: "requestcanceled" };
1552
+ function zr(n, e) {
1553
+ return function(r) {
1554
+ if (Array.isArray(r))
1555
+ return r;
1556
+ }(n) || function(r, t) {
1557
+ var a = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
1558
+ if (a != null) {
1559
+ var o, i, u = [], l = !0, s = !1;
1560
+ try {
1561
+ for (a = a.call(r); !(l = (o = a.next()).done) && (u.push(o.value), !t || u.length !== t); l = !0)
1562
+ ;
1563
+ } catch (f) {
1564
+ s = !0, i = f;
1565
+ } finally {
1566
+ try {
1567
+ l || a.return == null || a.return();
1568
+ } finally {
1569
+ if (s)
1570
+ throw i;
1571
+ }
1572
+ }
1573
+ return u;
1574
+ }
1575
+ }(n, e) || function(r, t) {
1576
+ if (r) {
1577
+ if (typeof r == "string")
1578
+ return Tt(r, t);
1579
+ var a = Object.prototype.toString.call(r).slice(8, -1);
1580
+ return a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set" ? Array.from(r) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? Tt(r, t) : void 0;
1581
+ }
1582
+ }(n, e) || function() {
1583
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1584
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1585
+ }();
1586
+ }
1587
+ function Tt(n, e) {
1588
+ (e == null || e > n.length) && (e = n.length);
1589
+ for (var r = 0, t = new Array(e); r < e; r++)
1590
+ t[r] = n[r];
1591
+ return t;
1592
+ }
1593
+ var ie = {}, Se = function n(e) {
1594
+ var r = arguments;
1595
+ typeof e == "string" ? n.hasOwnProperty(e) ? y().setTimeout(function() {
1596
+ r = Array.prototype.splice.call(r, 1), n[e].apply(null, r);
1597
+ }, 0) : D.warn("`" + e + "` is an unknown task") : typeof e == "function" ? y().setTimeout(function() {
1598
+ e(n);
1599
+ }, 0) : D.warn("`" + e + "` is invalid.");
1600
+ }, Yr = { loaded: N.now(), NAME: "mux-embed", VERSION: "4.30.0", API_VERSION: "2.1", PLAYER_TRACKED: !1, monitor: function(n, e) {
1601
+ return function(r, t, a) {
1602
+ var o = bt(k(t), 3), i = o[0], u = o[1], l = o[2], s = r.log, f = r.utils.getComputedStyle, _ = r.utils.secondsToMs;
1603
+ if (!i)
1604
+ return s.error("No element was found with the `" + u + "` query selector.");
1605
+ if (l !== "video" && l !== "audio")
1606
+ return s.error("The element of `" + u + "` was not a media element.");
1607
+ i.mux && (i.mux.destroy(), delete i.mux, s.warn("Already monitoring this video element, replacing existing event listeners")), (a = Object.assign({ automaticErrorTracking: !0 }, a)).data = Object.assign({ player_software: "HTML5 Video Element", player_mux_plugin_name: "VideoElementMonitor", player_mux_plugin_version: r.VERSION }, a.data), a.getPlayheadTime = function() {
1608
+ return _(i.currentTime);
1609
+ }, a.getStateData = function() {
1610
+ var h, v, m = this.hlsjs && this.hlsjs.url, G = this.dashjs && Fe(this.dashjs.getSource === "function") && this.dashjs.getSource(), Z = { player_is_paused: i.paused, player_playhead_time: _(i.currentTime), player_width: parseInt(f(i, "width")), player_height: parseInt(f(i, "height")), player_autoplay_on: i.autoplay, player_preload_on: i.preload, player_language_code: i.lang, player_is_fullscreen: De() && !!(De().fullscreenElement || De().webkitFullscreenElement || De().mozFullScreenElement || De().msFullscreenElement), video_poster_url: i.poster, video_source_url: m || G || i.currentSrc, video_source_duration: _(i.duration), video_source_height: i.videoHeight, video_source_width: i.videoWidth, view_dropped_frame_count: (h = i) === null || h === void 0 || (v = h.getVideoPlaybackQuality) === null || v === void 0 ? void 0 : v.call(h).droppedVideoFrames }, z = a.getPlayheadTime();
1611
+ if (i.getStartDate && z > 0) {
1612
+ var H = i.getStartDate();
1613
+ if (H && typeof H.getTime == "function" && H.getTime()) {
1614
+ var _e = H.getTime();
1615
+ if (Z.player_program_time = _e + z, i.seekable.length > 0) {
1616
+ var ye = _e + i.seekable.end(i.seekable.length - 1);
1617
+ Z.player_live_edge_program_time = ye;
1618
+ }
1619
+ }
1620
+ }
1621
+ return Z;
1622
+ }, i.mux = i.mux || {}, i.mux.deleted = !1, i.mux.emit = function(h, v) {
1623
+ r.emit(u, h, v);
1624
+ };
1625
+ var q = function() {
1626
+ s.error("The monitor for this video element has already been destroyed.");
1627
+ };
1628
+ i.mux.destroy = function() {
1629
+ Object.keys(i.mux.listeners).forEach(function(h) {
1630
+ i.removeEventListener(h, i.mux.listeners[h], !1);
1631
+ }), delete i.mux.listeners, i.mux.destroy = q, i.mux.swapElement = q, i.mux.emit = q, i.mux.addHLSJS = q, i.mux.addDashJS = q, i.mux.removeHLSJS = q, i.mux.removeDashJS = q, i.mux.deleted = !0, r.emit(u, "destroy");
1632
+ }, i.mux.swapElement = function(h) {
1633
+ var v = bt(k(h), 3), m = v[0], G = v[1], Z = v[2];
1634
+ return m ? Z !== "video" && Z !== "audio" ? r.log.error("The element of `" + G + "` was not a media element.") : (m.muxId = i.muxId, delete i.muxId, m.mux = m.mux || {}, m.mux.listeners = Object.assign({}, i.mux.listeners), delete i.mux.listeners, Object.keys(m.mux.listeners).forEach(function(z) {
1635
+ i.removeEventListener(z, m.mux.listeners[z], !1), m.addEventListener(z, m.mux.listeners[z], !1);
1636
+ }), m.mux.swapElement = i.mux.swapElement, m.mux.destroy = i.mux.destroy, delete i.mux, void (i = m)) : r.log.error("No element was found with the `" + G + "` query selector.");
1637
+ }, i.mux.addHLSJS = function(h) {
1638
+ r.addHLSJS(u, h);
1639
+ }, i.mux.addDashJS = function(h) {
1640
+ r.addDashJS(u, h);
1641
+ }, i.mux.removeHLSJS = function() {
1642
+ r.removeHLSJS(u);
1643
+ }, i.mux.removeDashJS = function() {
1644
+ r.removeDashJS(u);
1645
+ }, r.init(u, a), r.emit(u, "playerready"), i.paused || (r.emit(u, "play"), i.readyState > 2 && r.emit(u, "playing")), i.mux.listeners = {}, Rr.forEach(function(h) {
1646
+ (h !== "error" || a.automaticErrorTracking) && (i.mux.listeners[h] = function() {
1647
+ var v = {};
1648
+ if (h === "error") {
1649
+ if (!i.error || i.error.code === 1)
1650
+ return;
1651
+ v.player_error_code = i.error.code, v.player_error_message = Ir[i.error.code] || i.error.message;
1652
+ }
1653
+ r.emit(u, h, v);
1654
+ }, i.addEventListener(h, i.mux.listeners[h], !1));
1655
+ });
1656
+ }(Se, n, e);
1657
+ }, destroyMonitor: function(n) {
1658
+ var e = zr(k(n), 1)[0];
1659
+ e && e.mux && typeof e.mux.destroy == "function" ? e.mux.destroy() : D.error("A video element monitor for `" + n + "` has not been initialized via `mux.monitor`.");
1660
+ }, addHLSJS: function(n, e) {
1661
+ var r = T(n);
1662
+ ie[r] ? ie[r].addHLSJS(e) : D.error("A monitor for `" + r + "` has not been initialized.");
1663
+ }, addDashJS: function(n, e) {
1664
+ var r = T(n);
1665
+ ie[r] ? ie[r].addDashJS(e) : D.error("A monitor for `" + r + "` has not been initialized.");
1666
+ }, removeHLSJS: function(n) {
1667
+ var e = T(n);
1668
+ ie[e] ? ie[e].removeHLSJS() : D.error("A monitor for `" + e + "` has not been initialized.");
1669
+ }, removeDashJS: function(n) {
1670
+ var e = T(n);
1671
+ ie[e] ? ie[e].removeDashJS() : D.error("A monitor for `" + e + "` has not been initialized.");
1672
+ }, init: function(n, e) {
1673
+ ne() && e && e.respectDoNotTrack && D.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");
1674
+ var r = T(n);
1675
+ ie[r] = new Pr(Se, r, e);
1676
+ }, emit: function(n, e, r) {
1677
+ var t = T(n);
1678
+ ie[t] ? (ie[t].emit(e, r), e === "destroy" && delete ie[t]) : D.error("A monitor for `" + t + "` has not been initialized.");
1679
+ }, checkDoNotTrack: ne, log: D, utils: Jr, events: Kr, WINDOW_HIDDEN: !1, WINDOW_UNLOADING: !1 };
1680
+ Object.assign(Se, Yr), y() !== void 0 && typeof y().addEventListener == "function" && y().addEventListener("pagehide", function(n) {
1681
+ n.persisted || (Se.WINDOW_UNLOADING = !0);
1682
+ }, !1);
1683
+ var Xr = Se;
1684
+ }, 655: function(L, P, x) {
1685
+ var U, y;
1686
+ function M(C) {
1687
+ return M = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(T) {
1688
+ return typeof T;
1689
+ } : function(T) {
1690
+ return T && typeof Symbol == "function" && T.constructor === Symbol && T !== Symbol.prototype ? "symbol" : typeof T;
1691
+ }, M(C);
1692
+ /*!
1693
+ * JavaScript Cookie v2.1.3
1694
+ * https://github.com/js-cookie/js-cookie
1695
+ *
1696
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
1697
+ * Released under the MIT license
1698
+ */
1699
+ }
1700
+ (function(C) {
1701
+ var T = !1;
1702
+ if ((y = typeof (U = C) == "function" ? U.call(P, x, P, L) : U) === void 0 || (L.exports = y), T = !0, M(P) === "object" && (L.exports = C(), T = !0), !T) {
1703
+ var k = window.Cookies, E = window.Cookies = C();
1704
+ E.noConflict = function() {
1705
+ return window.Cookies = k, E;
1706
+ };
1707
+ }
1708
+ })(function() {
1709
+ var C = function() {
1710
+ for (var T = 0, k = {}; T < arguments.length; T++) {
1711
+ var E = arguments[T];
1712
+ for (var g in E)
1713
+ k[g] = E[g];
1714
+ }
1715
+ return k;
1716
+ };
1717
+ return function T(k) {
1718
+ function E(g, re, D) {
1719
+ var ne;
1720
+ if (typeof document < "u") {
1721
+ if (arguments.length > 1) {
1722
+ if (typeof (D = C({ path: "/" }, E.defaults, D)).expires == "number") {
1723
+ var N = /* @__PURE__ */ new Date();
1724
+ N.setMilliseconds(N.getMilliseconds() + 864e5 * D.expires), D.expires = N;
1725
+ }
1726
+ try {
1727
+ ne = JSON.stringify(re), /^[\{\[]/.test(ne) && (re = ne);
1728
+ } catch {
1729
+ }
1730
+ return re = k.write ? k.write(re, g) : encodeURIComponent(String(re)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), g = (g = (g = encodeURIComponent(String(g))).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)).replace(/[\(\)]/g, escape), document.cookie = [g, "=", re, D.expires ? "; expires=" + D.expires.toUTCString() : "", D.path ? "; path=" + D.path : "", D.domain ? "; domain=" + D.domain : "", D.secure ? "; secure" : ""].join("");
1731
+ }
1732
+ g || (ne = {});
1733
+ for (var ee = document.cookie ? document.cookie.split("; ") : [], ue = /(%[0-9A-Z]{2})+/g, se = 0; se < ee.length; se++) {
1734
+ var A = ee[se].split("="), J = A.slice(1).join("=");
1735
+ J.charAt(0) === '"' && (J = J.slice(1, -1));
1736
+ try {
1737
+ var he = A[0].replace(ue, decodeURIComponent);
1738
+ if (J = k.read ? k.read(J, he) : k(J, he) || J.replace(ue, decodeURIComponent), this.json)
1739
+ try {
1740
+ J = JSON.parse(J);
1741
+ } catch {
1742
+ }
1743
+ if (g === he) {
1744
+ ne = J;
1745
+ break;
1746
+ }
1747
+ g || (ne[he] = J);
1748
+ } catch {
1749
+ }
1750
+ }
1751
+ return ne;
1752
+ }
1753
+ }
1754
+ return E.set = E, E.get = function(g) {
1755
+ return E.call(E, g);
1756
+ }, E.getJSON = function() {
1757
+ return E.apply({ json: !0 }, [].slice.call(arguments));
1758
+ }, E.defaults = {}, E.remove = function(g, re) {
1759
+ E(g, "", C(re, { expires: -1 }));
1760
+ }, E.withConverter = T, E;
1761
+ }(function() {
1762
+ });
1763
+ });
1764
+ }, 153: function(L, P, x) {
1765
+ var U, y = x.g !== void 0 ? x.g : typeof window < "u" ? window : {}, M = x(558);
1766
+ typeof document < "u" ? U = document : (U = y["__GLOBAL_DOCUMENT_CACHE@4"]) || (U = y["__GLOBAL_DOCUMENT_CACHE@4"] = M), L.exports = U;
1767
+ }, 48: function(L, P, x) {
1768
+ var U;
1769
+ U = typeof window < "u" ? window : x.g !== void 0 ? x.g : typeof self < "u" ? self : {}, L.exports = U;
1770
+ }, 640: function(L, P, x) {
1771
+ var U, y;
1772
+ (function(M, C) {
1773
+ U = function() {
1774
+ var T = function() {
1775
+ }, k = "undefined", E = typeof window !== k && typeof window.navigator !== k && /Trident\/|MSIE /.test(window.navigator.userAgent), g = ["trace", "debug", "info", "warn", "error"];
1776
+ function re(S, W) {
1777
+ var $ = S[W];
1778
+ if (typeof $.bind == "function")
1779
+ return $.bind(S);
1780
+ try {
1781
+ return Function.prototype.bind.call($, S);
1782
+ } catch {
1783
+ return function() {
1784
+ return Function.prototype.apply.apply($, [S, arguments]);
1785
+ };
1786
+ }
1787
+ }
1788
+ function D() {
1789
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
1790
+ }
1791
+ function ne(S) {
1792
+ return S === "debug" && (S = "log"), typeof console !== k && (S === "trace" && E ? D : console[S] !== void 0 ? re(console, S) : console.log !== void 0 ? re(console, "log") : T);
1793
+ }
1794
+ function N(S, W) {
1795
+ for (var $ = 0; $ < g.length; $++) {
1796
+ var fe = g[$];
1797
+ this[fe] = $ < S ? T : this.methodFactory(fe, S, W);
1798
+ }
1799
+ this.log = this.debug;
1800
+ }
1801
+ function ee(S, W, $) {
1802
+ return function() {
1803
+ typeof console !== k && (N.call(this, W, $), this[S].apply(this, arguments));
1804
+ };
1805
+ }
1806
+ function ue(S, W, $) {
1807
+ return ne(S) || ee.apply(this, arguments);
1808
+ }
1809
+ function se(S, W, $) {
1810
+ var fe, B = this;
1811
+ W = W ?? "WARN";
1812
+ var ae = "loglevel";
1813
+ function ge(I) {
1814
+ var le = (g[I] || "silent").toUpperCase();
1815
+ if (typeof window !== k && ae) {
1816
+ try {
1817
+ return void (window.localStorage[ae] = le);
1818
+ } catch {
1819
+ }
1820
+ try {
1821
+ window.document.cookie = encodeURIComponent(ae) + "=" + le + ";";
1822
+ } catch {
1823
+ }
1824
+ }
1825
+ }
1826
+ function ve() {
1827
+ var I;
1828
+ if (typeof window !== k && ae) {
1829
+ try {
1830
+ I = window.localStorage[ae];
1831
+ } catch {
1832
+ }
1833
+ if (typeof I === k)
1834
+ try {
1835
+ var le = window.document.cookie, Te = le.indexOf(encodeURIComponent(ae) + "=");
1836
+ Te !== -1 && (I = /^([^;]+)/.exec(le.slice(Te))[1]);
1837
+ } catch {
1838
+ }
1839
+ return B.levels[I] === void 0 && (I = void 0), I;
1840
+ }
1841
+ }
1842
+ function Ie() {
1843
+ if (typeof window !== k && ae) {
1844
+ try {
1845
+ return void window.localStorage.removeItem(ae);
1846
+ } catch {
1847
+ }
1848
+ try {
1849
+ window.document.cookie = encodeURIComponent(ae) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
1850
+ } catch {
1851
+ }
1852
+ }
1853
+ }
1854
+ typeof S == "string" ? ae += ":" + S : typeof S == "symbol" && (ae = void 0), B.name = S, B.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, B.methodFactory = $ || ue, B.getLevel = function() {
1855
+ return fe;
1856
+ }, B.setLevel = function(I, le) {
1857
+ if (typeof I == "string" && B.levels[I.toUpperCase()] !== void 0 && (I = B.levels[I.toUpperCase()]), !(typeof I == "number" && I >= 0 && I <= B.levels.SILENT))
1858
+ throw "log.setLevel() called with invalid level: " + I;
1859
+ if (fe = I, le !== !1 && ge(I), N.call(B, I, S), typeof console === k && I < B.levels.SILENT)
1860
+ return "No console available for logging";
1861
+ }, B.setDefaultLevel = function(I) {
1862
+ W = I, ve() || B.setLevel(I, !1);
1863
+ }, B.resetLevel = function() {
1864
+ B.setLevel(W, !1), Ie();
1865
+ }, B.enableAll = function(I) {
1866
+ B.setLevel(B.levels.TRACE, I);
1867
+ }, B.disableAll = function(I) {
1868
+ B.setLevel(B.levels.SILENT, I);
1869
+ };
1870
+ var we = ve();
1871
+ we == null && (we = W), B.setLevel(we, !1);
1872
+ }
1873
+ var A = new se(), J = {};
1874
+ A.getLogger = function(S) {
1875
+ if (typeof S != "symbol" && typeof S != "string" || S === "")
1876
+ throw new TypeError("You must supply a name when creating a logger.");
1877
+ var W = J[S];
1878
+ return W || (W = J[S] = new se(S, A.getLevel(), A.methodFactory)), W;
1879
+ };
1880
+ var he = typeof window !== k ? window.log : void 0;
1881
+ return A.noConflict = function() {
1882
+ return typeof window !== k && window.log === A && (window.log = he), A;
1883
+ }, A.getLoggers = function() {
1884
+ return J;
1885
+ }, A.default = A, A;
1886
+ }, (y = typeof U == "function" ? U.call(P, x, P, L) : U) === void 0 || (L.exports = y);
1887
+ })();
1888
+ }, 375: function(L, P) {
1889
+ var x = Object.prototype.hasOwnProperty;
1890
+ function U(M) {
1891
+ try {
1892
+ return decodeURIComponent(M.replace(/\+/g, " "));
1893
+ } catch {
1894
+ return null;
1895
+ }
1896
+ }
1897
+ function y(M) {
1898
+ try {
1899
+ return encodeURIComponent(M);
1900
+ } catch {
1901
+ return null;
1902
+ }
1903
+ }
1904
+ P.stringify = function(M, C) {
1905
+ C = C || "";
1906
+ var T, k, E = [];
1907
+ for (k in typeof C != "string" && (C = "?"), M)
1908
+ if (x.call(M, k)) {
1909
+ if ((T = M[k]) || T != null && !isNaN(T) || (T = ""), k = y(k), T = y(T), k === null || T === null)
1910
+ continue;
1911
+ E.push(k + "=" + T);
1912
+ }
1913
+ return E.length ? C + E.join("&") : "";
1914
+ }, P.parse = function(M) {
1915
+ for (var C, T = /([^=?#&]+)=?([^&]*)/g, k = {}; C = T.exec(M); ) {
1916
+ var E = U(C[1]), g = U(C[2]);
1917
+ E === null || g === null || E in k || (k[E] = g);
1918
+ }
1919
+ return k;
1920
+ };
1921
+ }, 558: function() {
1922
+ } }, Re = {};
1923
+ function X(L) {
1924
+ var P = Re[L];
1925
+ if (P !== void 0)
1926
+ return P.exports;
1927
+ var x = Re[L] = { exports: {} };
1928
+ return Oe[L].call(x.exports, x, x.exports, X), x.exports;
1929
+ }
1930
+ return X.n = function(L) {
1931
+ var P = L && L.__esModule ? function() {
1932
+ return L.default;
1933
+ } : function() {
1934
+ return L;
1935
+ };
1936
+ return X.d(P, { a: P }), P;
1937
+ }, X.d = function(L, P) {
1938
+ for (var x in P)
1939
+ X.o(P, x) && !X.o(L, x) && Object.defineProperty(L, x, { enumerable: !0, get: P[x] });
1940
+ }, X.g = function() {
1941
+ if (typeof globalThis == "object")
1942
+ return globalThis;
1943
+ try {
1944
+ return this || new Function("return this")();
1945
+ } catch {
1946
+ if (typeof window == "object")
1947
+ return window;
1948
+ }
1949
+ }(), X.o = function(L, P) {
1950
+ return Object.prototype.hasOwnProperty.call(L, P);
1951
+ }, X(80);
1952
+ }();
1953
+ }, Ne.exports = ce();
1954
+ })();
1955
+ })(kt);
1956
+ var nn = kt.exports;
1957
+ const an = /* @__PURE__ */ rn(nn), sn = async ({
1958
+ appName: Ne = "elv-player-js",
1959
+ elvPlayer: te,
1960
+ playoutUrl: ce,
1961
+ authorizationToken: Oe,
1962
+ disableCookies: Re
1963
+ }) => {
1964
+ ce = new URL(ce);
1965
+ const X = await te.__Client(), L = (await X.NetworkInfo()).name === "main" ? "aq4mdjn7qo5sbkf89pkvfv93j" : "2i5480sms8vdgj0sv9bv6lpk5", P = ce.pathname.split("/").find((g) => g.startsWith("hq__")), x = X.utils.DecodeVersionHash(P).objectId, U = ce.toString().match(/\/rep\/playout\/([^/]+)/)[1] || "default", y = ce.searchParams.get("sid");
1966
+ let M = P;
1967
+ try {
1968
+ const g = await X.ContentObjectMetadata({
1969
+ versionHash: P,
1970
+ metadataSubtree: "/public",
1971
+ select: [
1972
+ "name",
1973
+ "asset_metadata/display_title",
1974
+ "asset_metadata/title"
1975
+ ],
1976
+ authorizationToken: Oe
1977
+ }) || {};
1978
+ M = (g.asset_metadata || {}).display_title || (g.asset_metadata || {}).title || g.name || P;
1979
+ } catch {
1980
+ }
1981
+ let C;
1982
+ try {
1983
+ C = await X.ContentObjectTenantId({ versionHash: P });
1984
+ } catch {
1985
+ }
1986
+ let T = await X.CurrentAccountAddress();
1987
+ if (Oe || X.staticToken)
1988
+ try {
1989
+ const { payload: g } = X.utils.DecodeSignedToken(Oe);
1990
+ T = g.adr || T;
1991
+ } catch {
1992
+ }
1993
+ let k = T;
1994
+ if (typeof crypto < "u")
1995
+ try {
1996
+ const g = new TextEncoder();
1997
+ k = Buffer.from(
1998
+ await crypto.subtle.digest("SHA-256", g.encode(T))
1999
+ ).toString("hex");
2000
+ } catch {
2001
+ }
2002
+ const E = {
2003
+ debug: !1,
2004
+ disableCookies: Re,
2005
+ data: {
2006
+ env_key: L,
2007
+ video_id: x,
2008
+ video_variant_id: P,
2009
+ video_variant_name: U,
2010
+ video_title: M,
2011
+ video_cdn: ce.hostname,
2012
+ viewer_user_id: k,
2013
+ sub_property_id: C,
2014
+ player_name: Ne,
2015
+ //player_version: version,
2016
+ player_init_time: te.initTime
2017
+ }
2018
+ };
2019
+ y && (E.data.view_session_id = y), te.player && (te.HLS ? (E.hlsjs = te.player, E.Hls = te.HLS) : te.Dash && (E.dashjs = te.player));
2020
+ try {
2021
+ an.monitor(te.video, E), te.Log("elv-player-js: Mux monitoring initialized"), te.Log(JSON.stringify({ ...E, hlsjs: {} }));
2022
+ } catch (g) {
2023
+ te.Log("elv-player-js: Failed to initialize mux monitoring:", !0), te.Log(JSON.stringify(E, null, 2), !0), te.Log(g, !0);
2024
+ }
2025
+ };
2026
+ export {
2027
+ sn as InitializeMuxMonitoring
2028
+ };