stormcloud-video-player 0.3.53 → 0.3.54

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.
@@ -152,12 +152,22 @@ function _object_spread_props(target, source) {
152
152
  }
153
153
  function _object_without_properties(source, excluded) {
154
154
  if (source == null) return {};
155
- var target = _object_without_properties_loose(source, excluded);
156
- var key, i;
155
+ var target = {}, sourceKeys, key, i;
156
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
157
+ sourceKeys = Reflect.ownKeys(Object(source));
158
+ for(i = 0; i < sourceKeys.length; i++){
159
+ key = sourceKeys[i];
160
+ if (excluded.indexOf(key) >= 0) continue;
161
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
162
+ target[key] = source[key];
163
+ }
164
+ return target;
165
+ }
166
+ target = _object_without_properties_loose(source, excluded);
157
167
  if (Object.getOwnPropertySymbols) {
158
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
159
- for(i = 0; i < sourceSymbolKeys.length; i++){
160
- key = sourceSymbolKeys[i];
168
+ sourceKeys = Object.getOwnPropertySymbols(source);
169
+ for(i = 0; i < sourceKeys.length; i++){
170
+ key = sourceKeys[i];
161
171
  if (excluded.indexOf(key) >= 0) continue;
162
172
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
163
173
  target[key] = source[key];
@@ -167,12 +177,11 @@ function _object_without_properties(source, excluded) {
167
177
  }
168
178
  function _object_without_properties_loose(source, excluded) {
169
179
  if (source == null) return {};
170
- var target = {};
171
- var sourceKeys = Object.keys(source);
172
- var key, i;
180
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
173
181
  for(i = 0; i < sourceKeys.length; i++){
174
182
  key = sourceKeys[i];
175
183
  if (excluded.indexOf(key) >= 0) continue;
184
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
176
185
  target[key] = source[key];
177
186
  }
178
187
  return target;
@@ -204,9 +213,17 @@ function _ts_generator(thisArg, body) {
204
213
  },
205
214
  trys: [],
206
215
  ops: []
207
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
208
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
209
- return this;
216
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
217
+ return d(g, "next", {
218
+ value: verb(0)
219
+ }), d(g, "throw", {
220
+ value: verb(1)
221
+ }), d(g, "return", {
222
+ value: verb(2)
223
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
224
+ value: function() {
225
+ return this;
226
+ }
210
227
  }), g;
211
228
  function verb(n) {
212
229
  return function(v) {
@@ -306,20 +323,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
306
323
  var __getOwnPropNames = Object.getOwnPropertyNames;
307
324
  var __getProtoOf = Object.getPrototypeOf;
308
325
  var __hasOwnProp = Object.prototype.hasOwnProperty;
309
- var __export = function(target, all) {
326
+ var __export = function __export(target, all) {
310
327
  for(var name in all)__defProp(target, name, {
311
328
  get: all[name],
312
329
  enumerable: true
313
330
  });
314
331
  };
315
- var __copyProps = function(to, from, except, desc) {
332
+ var __copyProps = function __copyProps(to, from, except, desc) {
316
333
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
317
334
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
318
335
  try {
319
336
  var _loop = function() {
320
337
  var key = _step.value;
321
338
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
322
- get: function() {
339
+ get: function get() {
323
340
  return from[key];
324
341
  },
325
342
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -343,7 +360,7 @@ var __copyProps = function(to, from, except, desc) {
343
360
  }
344
361
  return to;
345
362
  };
346
- var __toESM = function(mod, isNodeMode, target) {
363
+ var __toESM = function __toESM(mod, isNodeMode, target) {
347
364
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
348
365
  // file that has been converted to a CommonJS file using a Babel-
349
366
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -353,7 +370,7 @@ var __toESM = function(mod, isNodeMode, target) {
353
370
  enumerable: true
354
371
  }) : target, mod);
355
372
  };
356
- var __toCommonJS = function(mod) {
373
+ var __toCommonJS = function __toCommonJS(mod) {
357
374
  return __copyProps(__defProp({}, "__esModule", {
358
375
  value: true
359
376
  }), mod);
@@ -361,7 +378,7 @@ var __toCommonJS = function(mod) {
361
378
  // src/ui/StormcloudVideoPlayer.tsx
362
379
  var StormcloudVideoPlayer_exports = {};
363
380
  __export(StormcloudVideoPlayer_exports, {
364
- StormcloudVideoPlayerComponent: function() {
381
+ StormcloudVideoPlayerComponent: function StormcloudVideoPlayerComponent1() {
365
382
  return StormcloudVideoPlayerComponent;
366
383
  }
367
384
  });
@@ -696,7 +713,7 @@ function createImaController(video, options) {
696
713
  var fn = _step.value;
697
714
  try {
698
715
  fn(payload);
699
- } catch (e) {}
716
+ } catch (unused) {}
700
717
  }
701
718
  } catch (err) {
702
719
  _didIteratorError = true;
@@ -734,7 +751,7 @@ function createImaController(video, options) {
734
751
  console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
735
752
  }
736
753
  }
737
- } catch (e) {}
754
+ } catch (unused) {}
738
755
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
739
756
  var existing = document.querySelector('script[data-ima="true"]');
740
757
  if (existing) {
@@ -776,9 +793,6 @@ function createImaController(video, options) {
776
793
  var adDisplayContainer;
777
794
  var adContainerEl;
778
795
  var lastAdTagUrl;
779
- var retryAttempts = 0;
780
- var maxRetries = 2;
781
- var backoffBaseMs = 500;
782
796
  var adsLoadedPromise;
783
797
  var adsLoadedResolve;
784
798
  var adsLoadedReject;
@@ -982,7 +996,7 @@ function createImaController(video, options) {
982
996
  if (adsManager) {
983
997
  try {
984
998
  adsManager.destroy();
985
- } catch (e) {}
999
+ } catch (unused) {}
986
1000
  adsManager = void 0;
987
1001
  }
988
1002
  if (adVideoElement) {
@@ -993,7 +1007,7 @@ function createImaController(video, options) {
993
1007
  if (adsLoader) {
994
1008
  try {
995
1009
  adsLoader.destroy();
996
- } catch (e) {}
1010
+ } catch (unused) {}
997
1011
  adsLoader = void 0;
998
1012
  }
999
1013
  }
@@ -1011,7 +1025,7 @@ function createImaController(video, options) {
1011
1025
  try {
1012
1026
  var _adDisplayContainer_initialize;
1013
1027
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1014
- } catch (e) {}
1028
+ } catch (unused) {}
1015
1029
  }
1016
1030
  }).catch(function() {});
1017
1031
  },
@@ -1075,7 +1089,6 @@ function createImaController(video, options) {
1075
1089
  _state.sent();
1076
1090
  google = window.google;
1077
1091
  lastAdTagUrl = vastTagUrl;
1078
- retryAttempts = 0;
1079
1092
  if (!adDisplayContainer) {
1080
1093
  container = document.createElement("div");
1081
1094
  container.style.position = "absolute";
@@ -1159,32 +1172,23 @@ function createImaController(video, options) {
1159
1172
  }
1160
1173
  }, 300);
1161
1174
  }
1162
- hideContentVideo();
1175
+ showContentVideo();
1163
1176
  if (adsLoadedReject) {
1164
1177
  adsLoadedReject(new Error("Ad playback error"));
1165
1178
  adsLoadedReject = void 0;
1166
1179
  adsLoadedResolve = void 0;
1167
1180
  }
1168
- if (lastAdTagUrl && retryAttempts < maxRetries && !isNoFill) {
1169
- var delay = backoffBaseMs * Math.pow(2, retryAttempts++);
1170
- window.setTimeout(function() {
1171
- try {
1172
- makeAdsRequest(google, lastAdTagUrl);
1173
- } catch (e) {}
1174
- }, delay);
1175
- } else {
1176
- emit("ad_error", {
1177
- code: errorCode,
1178
- vastErrorCode: vastErrorCode,
1179
- message: errorMessage,
1180
- cause: innerError,
1181
- isNoFill: isNoFill
1182
- });
1183
- if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1184
- if (video.paused) {
1185
- var _video_play;
1186
- (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1187
- }
1181
+ emit("ad_error", {
1182
+ code: errorCode,
1183
+ vastErrorCode: vastErrorCode,
1184
+ message: errorMessage,
1185
+ cause: innerError,
1186
+ isNoFill: isNoFill
1187
+ });
1188
+ if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1189
+ if (video.paused) {
1190
+ var _video_play;
1191
+ (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1188
1192
  }
1189
1193
  }
1190
1194
  });
@@ -1202,7 +1206,7 @@ function createImaController(video, options) {
1202
1206
  if (adsManager) {
1203
1207
  try {
1204
1208
  adsManager.setVolume(adVolume);
1205
- } catch (e) {}
1209
+ } catch (unused) {}
1206
1210
  }
1207
1211
  emit("content_pause");
1208
1212
  });
@@ -1216,7 +1220,7 @@ function createImaController(video, options) {
1216
1220
  if (adsManager) {
1217
1221
  try {
1218
1222
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1219
- } catch (e) {}
1223
+ } catch (unused) {}
1220
1224
  }
1221
1225
  }
1222
1226
  if (adContainerEl) {
@@ -1230,7 +1234,7 @@ function createImaController(video, options) {
1230
1234
  adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
1231
1235
  adPlaying = false;
1232
1236
  setAdPlayingFlag(false);
1233
- hideContentVideo();
1237
+ showContentVideo();
1234
1238
  emit("content_resume");
1235
1239
  });
1236
1240
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
@@ -1246,7 +1250,7 @@ function createImaController(video, options) {
1246
1250
  }
1247
1251
  }, 300);
1248
1252
  }
1249
- hideContentVideo();
1253
+ showContentVideo();
1250
1254
  emit("all_ads_completed");
1251
1255
  });
1252
1256
  if (adsLoadedResolve) {
@@ -1268,7 +1272,7 @@ function createImaController(video, options) {
1268
1272
  }
1269
1273
  }, 300);
1270
1274
  }
1271
- hideContentVideo();
1275
+ showContentVideo();
1272
1276
  if (adsLoadedReject) {
1273
1277
  adsLoadedReject(new Error("Failed to setup ads manager"));
1274
1278
  adsLoadedReject = void 0;
@@ -1311,7 +1315,7 @@ function createImaController(video, options) {
1311
1315
  }
1312
1316
  }, 300);
1313
1317
  }
1314
- hideContentVideo();
1318
+ showContentVideo();
1315
1319
  if (adsLoadedReject) {
1316
1320
  adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
1317
1321
  adsLoadedReject = void 0;
@@ -1377,7 +1381,7 @@ function createImaController(video, options) {
1377
1381
  }
1378
1382
  try {
1379
1383
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1380
- } catch (e) {}
1384
+ } catch (unused) {}
1381
1385
  adsManager.start();
1382
1386
  return [
1383
1387
  2,
@@ -1459,7 +1463,7 @@ function createImaController(video, options) {
1459
1463
  try {
1460
1464
  ;
1461
1465
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1462
- } catch (e) {}
1466
+ } catch (unused) {}
1463
1467
  destroyAdsManager();
1464
1468
  return [
1465
1469
  2
@@ -1490,7 +1494,7 @@ function createImaController(video, options) {
1490
1494
  try {
1491
1495
  var _adsLoader_destroy;
1492
1496
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1493
- } catch (e) {}
1497
+ } catch (unused) {}
1494
1498
  adDisplayContainer = void 0;
1495
1499
  adsLoader = void 0;
1496
1500
  contentVideoHidden = false;
@@ -1539,7 +1543,7 @@ function createImaController(video, options) {
1539
1543
  if (adsManager && adPlaying) {
1540
1544
  try {
1541
1545
  adsManager.setVolume(clampedVolume);
1542
- } catch (e) {}
1546
+ } catch (unused) {}
1543
1547
  }
1544
1548
  },
1545
1549
  getAdVolume: function getAdVolume() {
@@ -3032,16 +3036,23 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3032
3036
  this.maxPlaceholderDurationMs = 5e3;
3033
3037
  this.isShowingPlaceholder = false;
3034
3038
  this.totalAdRequestsInBreak = 0;
3035
- this.maxTotalAdRequestsPerBreak = 20;
3039
+ this.maxTotalAdRequestsPerBreak = 10;
3036
3040
  this.pendingAdBreak = null;
3037
3041
  this.consecutiveFailures = 0;
3038
3042
  this.maxConsecutiveFailures = 5;
3039
3043
  this.lastAdRequestTime = 0;
3040
- this.minAdRequestIntervalMs = 2500;
3044
+ this.minAdRequestIntervalMs = 3e3;
3041
3045
  this.backoffBaseMs = 1e3;
3042
3046
  this.maxBackoffMs = 15e3;
3047
+ this.globalConsecutiveNoFills = 0;
3048
+ this.globalNoFillThreshold = 3;
3049
+ this.globalNoFillCooldownUntil = 0;
3050
+ this.globalNoFillBackoffBaseMs = 5e3;
3051
+ this.globalNoFillBackoffMaxMs = 6e4;
3052
+ this.globalLastGamRequestTime = 0;
3053
+ this.globalMinGamIntervalMs = 3e3;
3043
3054
  this.preloadPool = [];
3044
- this.maxPreloadPoolSize = 3;
3055
+ this.maxPreloadPoolSize = 2;
3045
3056
  this.preloadPoolActive = false;
3046
3057
  this.preloadPoolLoopRunning = false;
3047
3058
  this.continuousFetchLoopRunning = false;
@@ -3184,7 +3195,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3184
3195
  });
3185
3196
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3186
3197
  return _async_to_generator(function() {
3187
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
3198
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3188
3199
  return _ts_generator(this, function(_state) {
3189
3200
  switch(_state.label){
3190
3201
  case 0:
@@ -3193,10 +3204,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3193
3204
  } else {
3194
3205
  ;
3195
3206
  ;
3196
- this.isLiveStream = (_this_hls_levels_some = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3207
+ this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3197
3208
  var _level_details, _level_details1;
3198
3209
  return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
3199
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
3210
+ })) !== null && _ref !== void 0 ? _ref : false;
3200
3211
  }
3201
3212
  if (this.config.debugAdTiming) {
3202
3213
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -3260,9 +3271,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3260
3271
  var tag = "";
3261
3272
  var value = "";
3262
3273
  if (Array.isArray(entry)) {
3263
- var _entry_;
3274
+ var _entry_, _entry_1;
3264
3275
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3265
- var _entry_1;
3266
3276
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3267
3277
  } else if (typeof entry === "string") {
3268
3278
  var idx = entry.indexOf(":");
@@ -3385,9 +3395,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3385
3395
  var tag = "";
3386
3396
  var value = "";
3387
3397
  if (Array.isArray(entry)) {
3388
- var _entry_;
3398
+ var _entry_, _entry_1;
3389
3399
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3390
- var _entry_1;
3391
3400
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3392
3401
  } else if (typeof entry === "string") {
3393
3402
  var idx = entry.indexOf(":");
@@ -3437,10 +3446,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3437
3446
  }
3438
3447
  });
3439
3448
  } else if (tag.includes("EXT-X-DATERANGE")) {
3449
+ var _attrs_CLASS;
3440
3450
  var attrs = _this.parseAttributeList(value);
3441
3451
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3442
3452
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3443
- var _attrs_CLASS;
3444
3453
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3445
3454
  var duration = _this.toNumber(attrs["DURATION"]);
3446
3455
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3554,6 +3563,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3554
3563
  _this.clearAdRequestWatchdog();
3555
3564
  _this.activeAdRequestToken = null;
3556
3565
  _this.showAds = true;
3566
+ _this.resetGamNoFillCounter();
3557
3567
  if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3558
3568
  if (_this.adStopTimerId == null) {
3559
3569
  _this.currentAdBreakStartWallClockMs = Date.now();
@@ -3842,11 +3852,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3842
3852
  }
3843
3853
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
3844
3854
  if (daterangeMatch) {
3845
- var _daterangeMatch_;
3855
+ var _daterangeMatch_, _attrs_CLASS;
3846
3856
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
3847
3857
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3848
3858
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3849
- var _attrs_CLASS;
3850
3859
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3851
3860
  var duration = this.toNumber(attrs["DURATION"]);
3852
3861
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3922,7 +3931,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3922
3931
  var out = "";
3923
3932
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
3924
3933
  return out;
3925
- } catch (e) {
3934
+ } catch (unused) {
3926
3935
  return void 0;
3927
3936
  }
3928
3937
  }
@@ -3941,6 +3950,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3941
3950
  });
3942
3951
  }
3943
3952
  if (marker.type === "start") {
3953
+ var _this_config_immediateManifestAds;
3944
3954
  var _this_pendingAdBreak;
3945
3955
  if (!this.video.muted) {
3946
3956
  this.video.muted = true;
@@ -3965,7 +3975,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3965
3975
  this.expectedAdBreakDurationMs = durationMs;
3966
3976
  this.currentAdBreakStartWallClockMs = Date.now();
3967
3977
  var isManifestMarker = this.isManifestBasedMarker(marker);
3968
- var _this_config_immediateManifestAds;
3969
3978
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
3970
3979
  if (this.config.debugAdTiming) {
3971
3980
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -4120,9 +4129,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4120
4129
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
4121
4130
  var match;
4122
4131
  while((match = regex.exec(value)) !== null){
4123
- var _match_;
4132
+ var _match_, _ref, _match_1;
4124
4133
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
4125
- var _match_1, _ref;
4126
4134
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
4127
4135
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
4128
4136
  rawVal = rawVal.slice(1, -1);
@@ -4467,13 +4475,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4467
4475
  {
4468
4476
  key: "shouldShowNativeControls",
4469
4477
  value: function shouldShowNativeControls() {
4478
+ var _this_config_showCustomControls;
4470
4479
  var streamType = this.getStreamType();
4471
4480
  if (streamType === "other") {
4472
- var _this_config_showCustomControls;
4473
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
4481
+ var _this_config_showCustomControls1;
4482
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
4474
4483
  }
4475
- var _this_config_showCustomControls1;
4476
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
4484
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
4477
4485
  }
4478
4486
  },
4479
4487
  {
@@ -4581,6 +4589,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4581
4589
  var _this, loadPromise;
4582
4590
  return _ts_generator(this, function(_state) {
4583
4591
  _this = this;
4592
+ if (this.isGamInCooldown()) {
4593
+ if (this.config.debugAdTiming) {
4594
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
4595
+ }
4596
+ return [
4597
+ 2
4598
+ ];
4599
+ }
4584
4600
  if (this.preloadPool.some(function(entry) {
4585
4601
  return entry.vastUrl === vastUrl;
4586
4602
  }) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
@@ -4610,26 +4626,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4610
4626
  case 1:
4611
4627
  _state.trys.push([
4612
4628
  1,
4613
- 4,
4629
+ 5,
4614
4630
  ,
4615
- 5
4631
+ 6
4616
4632
  ]);
4617
4633
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
4618
4634
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
4619
4635
  preloadIma.initialize();
4620
- errorListener = function(payload) {
4636
+ errorListener = function errorListener(payload) {
4621
4637
  hasAdError = true;
4622
4638
  adErrorPayload = payload;
4623
4639
  };
4624
4640
  preloadIma.on("ad_error", errorListener);
4625
- errorListenerCleanup = function() {
4641
+ errorListenerCleanup = function errorListenerCleanup() {
4626
4642
  return preloadIma.off("ad_error", errorListener);
4627
4643
  };
4628
4644
  return [
4629
4645
  4,
4630
- preloadIma.requestAds(vastUrl)
4646
+ this.enforceGlobalRateLimit()
4631
4647
  ];
4632
4648
  case 2:
4649
+ _state.sent();
4650
+ return [
4651
+ 4,
4652
+ preloadIma.requestAds(vastUrl)
4653
+ ];
4654
+ case 3:
4633
4655
  _state.sent();
4634
4656
  preloadIma.pause();
4635
4657
  return [
@@ -4638,7 +4660,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4638
4660
  return setTimeout(resolve, 1500);
4639
4661
  })
4640
4662
  ];
4641
- case 3:
4663
+ case 4:
4642
4664
  _state.sent();
4643
4665
  preloadIma.pause();
4644
4666
  if (hasAdError) {
@@ -4647,6 +4669,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4647
4669
  errorListenerCleanup();
4648
4670
  }
4649
4671
  preloadIma.destroy();
4672
+ this.recordGamNoFill();
4650
4673
  if (isNoFill) {
4651
4674
  if (this.config.debugAdTiming) {
4652
4675
  console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
@@ -4673,7 +4696,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4673
4696
  isReady: true,
4674
4697
  loadPromise: Promise.resolve()
4675
4698
  };
4676
- lateErrorListener = function(payload) {
4699
+ lateErrorListener = function lateErrorListener(payload) {
4677
4700
  var index = _this.preloadPool.findIndex(function(entry) {
4678
4701
  return entry.vastUrl === vastUrl;
4679
4702
  });
@@ -4684,7 +4707,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4684
4707
  }
4685
4708
  try {
4686
4709
  preloadIma.destroy();
4687
- } catch (e) {}
4710
+ } catch (unused) {}
4688
4711
  }
4689
4712
  };
4690
4713
  preloadIma.on("ad_error", lateErrorListener);
@@ -4697,13 +4720,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4697
4720
  }
4698
4721
  return [
4699
4722
  3,
4700
- 5
4723
+ 6
4701
4724
  ];
4702
- case 4:
4725
+ case 5:
4703
4726
  error = _state.sent();
4704
4727
  if (errorListenerCleanup) {
4705
4728
  errorListenerCleanup();
4706
4729
  }
4730
+ this.recordGamNoFill();
4707
4731
  if (this.config.debugAdTiming) {
4708
4732
  console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
4709
4733
  }
@@ -4714,9 +4738,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4714
4738
  }
4715
4739
  return [
4716
4740
  3,
4717
- 5
4741
+ 6
4718
4742
  ];
4719
- case 5:
4743
+ case 6:
4720
4744
  return [
4721
4745
  2
4722
4746
  ];
@@ -4755,6 +4779,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4755
4779
  3,
4756
4780
  10
4757
4781
  ];
4782
+ if (this.isGamInCooldown()) {
4783
+ if (this.config.debugAdTiming) {
4784
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
4785
+ }
4786
+ return [
4787
+ 3,
4788
+ 10
4789
+ ];
4790
+ }
4758
4791
  if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
4759
4792
  3,
4760
4793
  3
@@ -4787,7 +4820,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4787
4820
  3,
4788
4821
  8
4789
4822
  ];
4790
- if (!this.preloadPoolActive) {
4823
+ if (!this.preloadPoolActive || this.isGamInCooldown()) {
4791
4824
  return [
4792
4825
  3,
4793
4826
  8
@@ -5003,9 +5036,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5003
5036
  case 1:
5004
5037
  _state.trys.push([
5005
5038
  1,
5006
- 7,
5039
+ 8,
5007
5040
  ,
5008
- 13
5041
+ 14
5009
5042
  ]);
5010
5043
  if (!(usePreloadedAd && preloadedController)) return [
5011
5044
  3,
@@ -5041,15 +5074,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5041
5074
  this.ima.setAdVolume(adVolume);
5042
5075
  return [
5043
5076
  3,
5044
- 6
5077
+ 7
5045
5078
  ];
5046
5079
  case 3:
5080
+ return [
5081
+ 4,
5082
+ this.enforceGlobalRateLimit()
5083
+ ];
5084
+ case 4:
5085
+ _state.sent();
5047
5086
  this.lastAdRequestTime = Date.now();
5048
5087
  return [
5049
5088
  4,
5050
5089
  this.ima.requestAds(firstAdUrl)
5051
5090
  ];
5052
- case 4:
5091
+ case 5:
5053
5092
  _state.sent();
5054
5093
  if (this.config.debugAdTiming) {
5055
5094
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
@@ -5064,7 +5103,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5064
5103
  4,
5065
5104
  this.ima.play()
5066
5105
  ];
5067
- case 5:
5106
+ case 6:
5068
5107
  _state.sent();
5069
5108
  if (this.expectedAdBreakDurationMs != null) {
5070
5109
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5072,36 +5111,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5072
5111
  }
5073
5112
  adVolume1 = currentMuted ? 0 : currentVolume;
5074
5113
  this.ima.setAdVolume(adVolume1);
5075
- _state.label = 6;
5076
- case 6:
5114
+ _state.label = 7;
5115
+ case 7:
5077
5116
  return [
5078
5117
  3,
5079
- 13
5118
+ 14
5080
5119
  ];
5081
- case 7:
5120
+ case 8:
5082
5121
  error = _state.sent();
5083
5122
  if (this.config.debugAdTiming) {
5084
5123
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
5085
5124
  }
5086
5125
  if (!!usePreloadedAd) return [
5087
5126
  3,
5088
- 11
5127
+ 12
5089
5128
  ];
5090
5129
  fallbackPreloaded = this.getPreloadedAd();
5091
5130
  if (!fallbackPreloaded) return [
5092
5131
  3,
5093
- 11
5132
+ 12
5094
5133
  ];
5095
5134
  if (this.config.debugAdTiming) {
5096
5135
  console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
5097
5136
  }
5098
- _state.label = 8;
5099
- case 8:
5137
+ _state.label = 9;
5138
+ case 9:
5100
5139
  _state.trys.push([
5101
- 8,
5102
- 10,
5140
+ 9,
5141
+ 11,
5103
5142
  ,
5104
- 11
5143
+ 12
5105
5144
  ]);
5106
5145
  this.ima.destroy();
5107
5146
  this.video.muted = true;
@@ -5120,7 +5159,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5120
5159
  4,
5121
5160
  this.ima.play()
5122
5161
  ];
5123
- case 9:
5162
+ case 10:
5124
5163
  _state.sent();
5125
5164
  if (this.expectedAdBreakDurationMs != null) {
5126
5165
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5131,16 +5170,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5131
5170
  return [
5132
5171
  2
5133
5172
  ];
5134
- case 10:
5173
+ case 11:
5135
5174
  fallbackError = _state.sent();
5136
5175
  if (this.config.debugAdTiming) {
5137
5176
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
5138
5177
  }
5139
5178
  return [
5140
5179
  3,
5141
- 11
5180
+ 12
5142
5181
  ];
5143
- case 11:
5182
+ case 12:
5144
5183
  if (this.isTemporaryAdError(error)) {
5145
5184
  this.temporaryFailureUrls.set(firstAdUrl, Date.now());
5146
5185
  if (this.config.debugAdTiming) {
@@ -5158,13 +5197,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5158
5197
  4,
5159
5198
  this.tryNextAvailableAdWithRateLimit()
5160
5199
  ];
5161
- case 12:
5200
+ case 13:
5162
5201
  _state.sent();
5163
5202
  return [
5164
5203
  3,
5165
- 13
5204
+ 14
5166
5205
  ];
5167
- case 13:
5206
+ case 14:
5168
5207
  return [
5169
5208
  2
5170
5209
  ];
@@ -5215,6 +5254,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5215
5254
  "break"
5216
5255
  ];
5217
5256
  }
5257
+ if (_this.isGamInCooldown()) {
5258
+ if (_this.config.debugAdTiming) {
5259
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
5260
+ }
5261
+ return [
5262
+ 2,
5263
+ "break"
5264
+ ];
5265
+ }
5218
5266
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5219
5267
  if (_this.config.debugAdTiming) {
5220
5268
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -5411,6 +5459,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5411
5459
  2
5412
5460
  ];
5413
5461
  }
5462
+ if (this.isGamInCooldown()) {
5463
+ if (this.config.debugAdTiming) {
5464
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
5465
+ }
5466
+ this.handleAdPodComplete();
5467
+ return [
5468
+ 2
5469
+ ];
5470
+ }
5414
5471
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5415
5472
  if (this.config.debugAdTiming) {
5416
5473
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
@@ -5607,6 +5664,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5607
5664
  case 0:
5608
5665
  remaining = this.getRemainingAdMs();
5609
5666
  waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
5667
+ if (this.isGamInCooldown()) {
5668
+ if (this.config.debugAdTiming) {
5669
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
5670
+ }
5671
+ this.handleAdPodComplete();
5672
+ return [
5673
+ 2
5674
+ ];
5675
+ }
5610
5676
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5611
5677
  if (this.config.debugAdTiming) {
5612
5678
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
@@ -5870,11 +5936,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5870
5936
  {
5871
5937
  key: "ensureAdStoppedByTimer",
5872
5938
  value: function ensureAdStoppedByTimer() {
5939
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
5873
5940
  if (!this.inAdBreak) return;
5874
5941
  this.adStopTimerId = void 0;
5875
5942
  var adPlaying = this.ima.isAdPlaying();
5876
5943
  var pendingAds = this.adPodQueue.length > 0;
5877
- var _this_config_adBreakCheckIntervalMs;
5878
5944
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
5879
5945
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
5880
5946
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -5882,7 +5948,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5882
5948
  if (this.currentAdBreakStartWallClockMs != null) {
5883
5949
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
5884
5950
  }
5885
- var _this_expectedAdBreakDurationMs;
5886
5951
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
5887
5952
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
5888
5953
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -5996,6 +6061,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5996
6061
  }
5997
6062
  }
5998
6063
  },
6064
+ {
6065
+ key: "isGamInCooldown",
6066
+ value: function isGamInCooldown() {
6067
+ return Date.now() < this.globalNoFillCooldownUntil;
6068
+ }
6069
+ },
6070
+ {
6071
+ key: "recordGamNoFill",
6072
+ value: function recordGamNoFill() {
6073
+ this.globalConsecutiveNoFills++;
6074
+ if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
6075
+ var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
6076
+ var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
6077
+ this.globalNoFillCooldownUntil = Date.now() + backoff;
6078
+ if (this.config.debugAdTiming) {
6079
+ console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
6080
+ }
6081
+ }
6082
+ }
6083
+ },
6084
+ {
6085
+ key: "resetGamNoFillCounter",
6086
+ value: function resetGamNoFillCounter() {
6087
+ if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
6088
+ console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
6089
+ }
6090
+ this.globalConsecutiveNoFills = 0;
6091
+ this.globalNoFillCooldownUntil = 0;
6092
+ }
6093
+ },
6094
+ {
6095
+ key: "enforceGlobalRateLimit",
6096
+ value: function enforceGlobalRateLimit() {
6097
+ return _async_to_generator(function() {
6098
+ var now, elapsed, waitMs;
6099
+ return _ts_generator(this, function(_state) {
6100
+ switch(_state.label){
6101
+ case 0:
6102
+ now = Date.now();
6103
+ elapsed = now - this.globalLastGamRequestTime;
6104
+ if (!(elapsed < this.globalMinGamIntervalMs)) return [
6105
+ 3,
6106
+ 2
6107
+ ];
6108
+ waitMs = this.globalMinGamIntervalMs - elapsed;
6109
+ if (this.config.debugAdTiming) {
6110
+ console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
6111
+ }
6112
+ return [
6113
+ 4,
6114
+ new Promise(function(resolve) {
6115
+ return setTimeout(resolve, waitMs);
6116
+ })
6117
+ ];
6118
+ case 1:
6119
+ _state.sent();
6120
+ _state.label = 2;
6121
+ case 2:
6122
+ this.globalLastGamRequestTime = Date.now();
6123
+ return [
6124
+ 2
6125
+ ];
6126
+ }
6127
+ });
6128
+ }).call(this);
6129
+ }
6130
+ },
5999
6131
  {
6000
6132
  key: "playSingleAd",
6001
6133
  value: function playSingleAd(vastTagUrl) {
@@ -6027,6 +6159,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6027
6159
  }
6028
6160
  throw new Error("Too many consecutive failures");
6029
6161
  }
6162
+ if (this.isGamInCooldown()) {
6163
+ if (this.config.debugAdTiming) {
6164
+ console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
6165
+ }
6166
+ throw new Error("GAM in cooldown");
6167
+ }
6030
6168
  this.recreateImaController();
6031
6169
  requestToken = ++this.adRequestTokenCounter;
6032
6170
  this.activeAdRequestToken = requestToken;
@@ -6035,16 +6173,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6035
6173
  case 1:
6036
6174
  _state.trys.push([
6037
6175
  1,
6038
- 11,
6176
+ 12,
6039
6177
  ,
6040
- 16
6178
+ 17
6041
6179
  ]);
6180
+ return [
6181
+ 4,
6182
+ this.enforceGlobalRateLimit()
6183
+ ];
6184
+ case 2:
6185
+ _state.sent();
6042
6186
  this.lastAdRequestTime = Date.now();
6043
6187
  return [
6044
6188
  4,
6045
6189
  this.ima.requestAds(vastTagUrl)
6046
6190
  ];
6047
- case 2:
6191
+ case 3:
6048
6192
  _state.sent();
6049
6193
  this.clearAdRequestWatchdog();
6050
6194
  if (this.activeAdRequestToken !== requestToken) {
@@ -6052,20 +6196,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6052
6196
  2
6053
6197
  ];
6054
6198
  }
6055
- _state.label = 3;
6056
- case 3:
6199
+ _state.label = 4;
6200
+ case 4:
6057
6201
  _state.trys.push([
6058
- 3,
6059
- 5,
6202
+ 4,
6203
+ 6,
6060
6204
  ,
6061
- 10
6205
+ 11
6062
6206
  ]);
6063
6207
  this.startAdFailsafeTimer(requestToken);
6064
6208
  return [
6065
6209
  4,
6066
6210
  this.ima.play()
6067
6211
  ];
6068
- case 4:
6212
+ case 5:
6069
6213
  _state.sent();
6070
6214
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6071
6215
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6079,9 +6223,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6079
6223
  this.temporaryFailureUrls.delete(vastTagUrl);
6080
6224
  return [
6081
6225
  3,
6082
- 10
6226
+ 11
6083
6227
  ];
6084
- case 5:
6228
+ case 6:
6085
6229
  playError = _state.sent();
6086
6230
  if (this.config.debugAdTiming) {
6087
6231
  console.error("[AD-ERROR] Failed to play ad:", playError);
@@ -6089,18 +6233,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6089
6233
  preloadedFallback = this.getPreloadedAd();
6090
6234
  if (!preloadedFallback) return [
6091
6235
  3,
6092
- 9
6236
+ 10
6093
6237
  ];
6094
6238
  if (this.config.debugAdTiming) {
6095
6239
  console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
6096
6240
  }
6097
- _state.label = 6;
6098
- case 6:
6241
+ _state.label = 7;
6242
+ case 7:
6099
6243
  _state.trys.push([
6100
- 6,
6101
- 8,
6244
+ 7,
6245
+ 9,
6102
6246
  ,
6103
- 9
6247
+ 10
6104
6248
  ]);
6105
6249
  this.clearAdFailsafeTimer();
6106
6250
  this.ima.destroy();
@@ -6116,7 +6260,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6116
6260
  4,
6117
6261
  this.ima.play()
6118
6262
  ];
6119
- case 7:
6263
+ case 8:
6120
6264
  _state.sent();
6121
6265
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6122
6266
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6129,16 +6273,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6129
6273
  return [
6130
6274
  2
6131
6275
  ];
6132
- case 8:
6276
+ case 9:
6133
6277
  fallbackError = _state.sent();
6134
6278
  if (this.config.debugAdTiming) {
6135
6279
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
6136
6280
  }
6137
6281
  return [
6138
6282
  3,
6139
- 9
6283
+ 10
6140
6284
  ];
6141
- case 9:
6285
+ case 10:
6142
6286
  if (this.isTemporaryAdError(playError)) {
6143
6287
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6144
6288
  if (this.config.debugAdTiming) {
@@ -6155,12 +6299,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6155
6299
  this.activeAdRequestToken = null;
6156
6300
  }
6157
6301
  throw playError;
6158
- case 10:
6302
+ case 11:
6159
6303
  return [
6160
6304
  3,
6161
- 16
6305
+ 17
6162
6306
  ];
6163
- case 11:
6307
+ case 12:
6164
6308
  error = _state.sent();
6165
6309
  errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
6166
6310
  if (this.config.debugAdTiming) {
@@ -6169,18 +6313,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6169
6313
  preloadedFallback1 = this.getPreloadedAd();
6170
6314
  if (!preloadedFallback1) return [
6171
6315
  3,
6172
- 15
6316
+ 16
6173
6317
  ];
6174
6318
  if (this.config.debugAdTiming) {
6175
6319
  console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
6176
6320
  }
6177
- _state.label = 12;
6178
- case 12:
6321
+ _state.label = 13;
6322
+ case 13:
6179
6323
  _state.trys.push([
6180
- 12,
6181
- 14,
6324
+ 13,
6325
+ 15,
6182
6326
  ,
6183
- 15
6327
+ 16
6184
6328
  ]);
6185
6329
  this.clearAdRequestWatchdog();
6186
6330
  this.clearAdFailsafeTimer();
@@ -6197,7 +6341,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6197
6341
  4,
6198
6342
  this.ima.play()
6199
6343
  ];
6200
- case 13:
6344
+ case 14:
6201
6345
  _state.sent();
6202
6346
  currentMuted2 = this.video.muted;
6203
6347
  currentVolume2 = this.video.volume;
@@ -6206,16 +6350,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6206
6350
  return [
6207
6351
  2
6208
6352
  ];
6209
- case 14:
6353
+ case 15:
6210
6354
  fallbackError1 = _state.sent();
6211
6355
  if (this.config.debugAdTiming) {
6212
6356
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
6213
6357
  }
6214
6358
  return [
6215
6359
  3,
6216
- 15
6360
+ 16
6217
6361
  ];
6218
- case 15:
6362
+ case 16:
6219
6363
  if (this.isTemporaryAdError(error)) {
6220
6364
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6221
6365
  if (this.config.debugAdTiming) {
@@ -6233,7 +6377,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6233
6377
  this.activeAdRequestToken = null;
6234
6378
  }
6235
6379
  throw error;
6236
- case 16:
6380
+ case 17:
6237
6381
  return [
6238
6382
  2
6239
6383
  ];
@@ -6269,6 +6413,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6269
6413
  this.currentAdIndex = 0;
6270
6414
  this.totalAdsInBreak = 0;
6271
6415
  this.consecutiveFailures = 0;
6416
+ this.globalConsecutiveNoFills = 0;
6272
6417
  this.ima.stop().catch(function() {});
6273
6418
  var restoredMuted = this.ima.getOriginalMutedState();
6274
6419
  var restoredVolume = this.ima.getOriginalVolume();
@@ -6300,6 +6445,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6300
6445
  key: "handleAdFailure",
6301
6446
  value: function handleAdFailure() {
6302
6447
  this.consecutiveFailures++;
6448
+ this.recordGamNoFill();
6303
6449
  var remaining = this.getRemainingAdMs();
6304
6450
  if (this.config.debugAdTiming) {
6305
6451
  console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
@@ -6327,8 +6473,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6327
6473
  key: "startAdRequestWatchdog",
6328
6474
  value: function startAdRequestWatchdog(token) {
6329
6475
  var _this = this;
6330
- this.clearAdRequestWatchdog();
6331
6476
  var _this_config_adFailsafeTimeoutMs;
6477
+ this.clearAdRequestWatchdog();
6332
6478
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6333
6479
  this.adRequestWatchdogToken = token;
6334
6480
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -6371,8 +6517,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6371
6517
  key: "startAdFailsafeTimer",
6372
6518
  value: function startAdFailsafeTimer(token) {
6373
6519
  var _this = this;
6374
- this.clearAdFailsafeTimer();
6375
6520
  var _this_config_adFailsafeTimeoutMs;
6521
+ this.clearAdFailsafeTimer();
6376
6522
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6377
6523
  this.adFailsafeToken = token;
6378
6524
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -6752,21 +6898,21 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6752
6898
  var _import_react_default_useState14 = _sliced_to_array(import_react.default.useState(false), 2), showLicenseWarning = _import_react_default_useState14[0], setShowLicenseWarning = _import_react_default_useState14[1];
6753
6899
  var _import_react_default_useState15 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _import_react_default_useState15[0], setViewportWidth = _import_react_default_useState15[1];
6754
6900
  var _import_react_default_useState16 = _sliced_to_array(import_react.default.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _import_react_default_useState16[0], setIsPortrait = _import_react_default_useState16[1];
6755
- var getResponsiveScale = function() {
6901
+ var getResponsiveScale = function getResponsiveScale() {
6756
6902
  if (viewportWidth < 480) return 0.7;
6757
6903
  if (viewportWidth < 768) return 0.8;
6758
6904
  if (viewportWidth < 1024) return 0.9;
6759
6905
  return 1;
6760
6906
  };
6761
6907
  var responsiveScale = getResponsiveScale();
6762
- var formatTime = function(seconds) {
6908
+ var formatTime = function formatTime(seconds) {
6763
6909
  if (!isFinite(seconds)) return "0:00:00";
6764
6910
  var hours = Math.floor(seconds / 3600);
6765
6911
  var minutes = Math.floor(seconds % 3600 / 60);
6766
6912
  var remainingSeconds = Math.floor(seconds % 60);
6767
6913
  return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
6768
6914
  };
6769
- var handlePlayPause = function() {
6915
+ var handlePlayPause = function handlePlayPause() {
6770
6916
  if (videoRef.current) {
6771
6917
  if (videoRef.current.paused) {
6772
6918
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
@@ -6785,7 +6931,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6785
6931
  }
6786
6932
  }
6787
6933
  };
6788
- var handleCenterPlayClick = function() {
6934
+ var handleCenterPlayClick = function handleCenterPlayClick() {
6789
6935
  if (videoRef.current && videoRef.current.paused) {
6790
6936
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
6791
6937
  if (hasValidSource) {
@@ -6799,7 +6945,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6799
6945
  }
6800
6946
  }
6801
6947
  };
6802
- var handleTimelineSeek = function(e) {
6948
+ var handleTimelineSeek = function handleTimelineSeek(e) {
6803
6949
  if (videoRef.current && duration > 0 && isFinite(duration)) {
6804
6950
  var rect = e.currentTarget.getBoundingClientRect();
6805
6951
  var clickX = e.clientX - rect.left;
@@ -6810,13 +6956,13 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6810
6956
  }
6811
6957
  }
6812
6958
  };
6813
- var handleVolumeChange = function(newVolume) {
6959
+ var handleVolumeChange = function handleVolumeChange(newVolume) {
6814
6960
  if (playerRef.current && isFinite(newVolume)) {
6815
6961
  var clampedVolume = Math.max(0, Math.min(1, newVolume));
6816
6962
  playerRef.current.setVolume(clampedVolume);
6817
6963
  }
6818
6964
  };
6819
- var handlePlaybackRateChange = function(rate) {
6965
+ var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
6820
6966
  if (videoRef.current && isFinite(rate) && rate > 0) {
6821
6967
  videoRef.current.playbackRate = rate;
6822
6968
  }
@@ -6853,7 +6999,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6853
6999
  if (playerRef.current) {
6854
7000
  try {
6855
7001
  playerRef.current.destroy();
6856
- } catch (e) {}
7002
+ } catch (unused) {}
6857
7003
  playerRef.current = null;
6858
7004
  }
6859
7005
  var cfg = {
@@ -6893,7 +7039,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6893
7039
  return function() {
6894
7040
  try {
6895
7041
  player.destroy();
6896
- } catch (e) {}
7042
+ } catch (unused) {}
6897
7043
  playerRef.current = null;
6898
7044
  };
6899
7045
  }, [
@@ -6917,7 +7063,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6917
7063
  ]);
6918
7064
  (0, import_react.useEffect)(function() {
6919
7065
  if (!playerRef.current) return;
6920
- var checkAdStatus = function() {
7066
+ var checkAdStatus = function checkAdStatus() {
6921
7067
  if (playerRef.current) {
6922
7068
  var _videoRef_current_dataset, _videoRef_current;
6923
7069
  var showAdsFromMethod = playerRef.current.isShowingAds();
@@ -6947,7 +7093,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6947
7093
  }, []);
6948
7094
  (0, import_react.useEffect)(function() {
6949
7095
  if (typeof window === "undefined" || !playerRef.current) return;
6950
- var handleResize = function() {
7096
+ var handleResize = function handleResize() {
6951
7097
  if (playerRef.current && videoRef.current) {
6952
7098
  if (typeof playerRef.current.resize === "function") {
6953
7099
  playerRef.current.resize();
@@ -6963,7 +7109,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6963
7109
  }, []);
6964
7110
  (0, import_react.useEffect)(function() {
6965
7111
  if (!playerRef.current || !videoRef.current) return;
6966
- var updateStates = function() {
7112
+ var updateStates = function updateStates() {
6967
7113
  var _videoRef_current;
6968
7114
  if (playerRef.current && videoRef.current) {
6969
7115
  setIsMuted(playerRef.current.isMuted());
@@ -6980,7 +7126,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6980
7126
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
6981
7127
  };
6982
7128
  var interval = setInterval(updateStates, 200);
6983
- var handleFullscreenChange = function() {
7129
+ var handleFullscreenChange = function handleFullscreenChange() {
6984
7130
  var _videoRef_current;
6985
7131
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
6986
7132
  };
@@ -6992,7 +7138,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6992
7138
  }, []);
6993
7139
  (0, import_react.useEffect)(function() {
6994
7140
  if (!videoRef.current) return;
6995
- var handleLoadedMetadata = function() {
7141
+ var handleLoadedMetadata = function handleLoadedMetadata() {
6996
7142
  if (videoRef.current) {
6997
7143
  var video2 = videoRef.current;
6998
7144
  void video2.offsetHeight;
@@ -7002,19 +7148,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7002
7148
  console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7003
7149
  }
7004
7150
  };
7005
- var handleLoadedData = function() {
7151
+ var handleLoadedData = function handleLoadedData() {
7006
7152
  if (debugAdTiming) {
7007
7153
  var _videoRef_current;
7008
7154
  console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7009
7155
  }
7010
7156
  };
7011
- var handleLoadStart = function() {
7157
+ var handleLoadStart = function handleLoadStart() {
7012
7158
  if (debugAdTiming) {
7013
7159
  var _videoRef_current;
7014
7160
  console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7015
7161
  }
7016
7162
  };
7017
- var handleCanPlay = function() {
7163
+ var handleCanPlay = function handleCanPlay() {
7018
7164
  setIsLoading(false);
7019
7165
  if (bufferingTimeoutRef.current) {
7020
7166
  clearTimeout(bufferingTimeoutRef.current);
@@ -7026,7 +7172,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7026
7172
  console.log("[StormcloudUI] Video event: canplay, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
7027
7173
  }
7028
7174
  };
7029
- var handleCanPlayThrough = function() {
7175
+ var handleCanPlayThrough = function handleCanPlayThrough() {
7030
7176
  setIsLoading(false);
7031
7177
  if (bufferingTimeoutRef.current) {
7032
7178
  clearTimeout(bufferingTimeoutRef.current);
@@ -7038,7 +7184,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7038
7184
  console.log("[StormcloudUI] Video event: canplaythrough, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
7039
7185
  }
7040
7186
  };
7041
- var handleWaiting = function() {
7187
+ var handleWaiting = function handleWaiting() {
7042
7188
  if (bufferingTimeoutRef.current) {
7043
7189
  clearTimeout(bufferingTimeoutRef.current);
7044
7190
  }
@@ -7054,7 +7200,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7054
7200
  console.log("[StormcloudUI] Video event: waiting, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- buffering delay started (300ms)");
7055
7201
  }
7056
7202
  };
7057
- var handlePlaying = function() {
7203
+ var handlePlaying = function handlePlaying() {
7058
7204
  setIsLoading(false);
7059
7205
  if (bufferingTimeoutRef.current) {
7060
7206
  clearTimeout(bufferingTimeoutRef.current);
@@ -7067,7 +7213,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7067
7213
  console.log("[StormcloudUI] Video event: playing, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- playback started, isLoading=false, isBuffering=false");
7068
7214
  }
7069
7215
  };
7070
- var handlePause = function() {
7216
+ var handlePause = function handlePause() {
7071
7217
  var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
7072
7218
  var isAdActive = ((_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.isShowingAds()) || ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
7073
7219
  if (playerRef.current && !isAdActive) {
@@ -7076,7 +7222,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7076
7222
  setShowCenterPlay(false);
7077
7223
  }
7078
7224
  };
7079
- var handleEnded = function() {
7225
+ var handleEnded = function handleEnded() {
7080
7226
  setShowCenterPlay(true);
7081
7227
  };
7082
7228
  var video = videoRef.current;
@@ -7234,14 +7380,14 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7234
7380
  boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
7235
7381
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
7236
7382
  },
7237
- onMouseEnter: function(e) {
7383
+ onMouseEnter: function onMouseEnter(e) {
7238
7384
  var target = e.currentTarget;
7239
7385
  target.style.transform = "translate(-50%, -50%)";
7240
7386
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
7241
7387
  target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7242
7388
  target.style.borderColor = "rgba(255, 255, 255, 0.9)";
7243
7389
  },
7244
- onMouseLeave: function(e) {
7390
+ onMouseLeave: function onMouseLeave(e) {
7245
7391
  var target = e.currentTarget;
7246
7392
  target.style.transform = "translate(-50%, -50%)";
7247
7393
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
@@ -7348,12 +7494,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7348
7494
  minWidth: "".concat(48 * responsiveScale, "px"),
7349
7495
  minHeight: "".concat(48 * responsiveScale, "px")
7350
7496
  },
7351
- onMouseEnter: function(e) {
7497
+ onMouseEnter: function onMouseEnter(e) {
7352
7498
  var target = e.target;
7353
7499
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7354
7500
  target.style.boxShadow = "0 12px 48px rgba(0, 0, 0, 0.6), 0 6px 24px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7355
7501
  },
7356
- onMouseLeave: function(e) {
7502
+ onMouseLeave: function onMouseLeave(e) {
7357
7503
  var target = e.target;
7358
7504
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
7359
7505
  target.style.boxShadow = "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
@@ -7379,15 +7525,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7379
7525
  padding: "8px",
7380
7526
  margin: "-8px"
7381
7527
  },
7382
- onMouseEnter: function() {
7528
+ onMouseEnter: function onMouseEnter() {
7383
7529
  return setShowVolumeSlider(true);
7384
7530
  },
7385
- onMouseLeave: function() {
7531
+ onMouseLeave: function onMouseLeave() {
7386
7532
  return setShowVolumeSlider(false);
7387
7533
  },
7388
7534
  children: [
7389
7535
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7390
- onClick: function() {
7536
+ onClick: function onClick() {
7391
7537
  if (playerRef.current) {
7392
7538
  playerRef.current.toggleMute();
7393
7539
  }
@@ -7411,12 +7557,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7411
7557
  minWidth: "".concat(44 * responsiveScale, "px"),
7412
7558
  minHeight: "".concat(44 * responsiveScale, "px")
7413
7559
  },
7414
- onMouseEnter: function(e) {
7560
+ onMouseEnter: function onMouseEnter(e) {
7415
7561
  var target = e.target;
7416
7562
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7417
7563
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7418
7564
  },
7419
- onMouseLeave: function(e) {
7565
+ onMouseLeave: function onMouseLeave(e) {
7420
7566
  var target = e.target;
7421
7567
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7422
7568
  target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -7452,10 +7598,10 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7452
7598
  marginBottom: "-16px",
7453
7599
  zIndex: 9
7454
7600
  },
7455
- onMouseEnter: function() {
7601
+ onMouseEnter: function onMouseEnter() {
7456
7602
  return setShowVolumeSlider(true);
7457
7603
  },
7458
- onMouseLeave: function() {
7604
+ onMouseLeave: function onMouseLeave() {
7459
7605
  return setShowVolumeSlider(false);
7460
7606
  }
7461
7607
  }),
@@ -7480,12 +7626,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7480
7626
  zIndex: 10,
7481
7627
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7482
7628
  },
7483
- onMouseEnter: function(e) {
7629
+ onMouseEnter: function onMouseEnter(e) {
7484
7630
  setShowVolumeSlider(true);
7485
7631
  e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 24px rgba(59, 130, 246, 0.3)";
7486
7632
  e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
7487
7633
  },
7488
- onMouseLeave: function(e) {
7634
+ onMouseLeave: function onMouseLeave(e) {
7489
7635
  setShowVolumeSlider(false);
7490
7636
  e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15)";
7491
7637
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
@@ -7498,19 +7644,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7498
7644
  cursor: "pointer",
7499
7645
  transition: "transform 0.2s ease-in-out"
7500
7646
  },
7501
- onMouseEnter: function(e) {},
7502
- onMouseLeave: function(e) {},
7503
- onMouseDown: function(e) {
7647
+ onMouseEnter: function onMouseEnter(e) {},
7648
+ onMouseLeave: function onMouseLeave(e) {},
7649
+ onMouseDown: function onMouseDown(e) {
7504
7650
  e.preventDefault();
7505
7651
  var sliderElement = e.currentTarget;
7506
- var handleMouseMove = function(moveEvent) {
7652
+ var handleMouseMove = function handleMouseMove(moveEvent) {
7507
7653
  if (!sliderElement) return;
7508
7654
  var rect2 = sliderElement.getBoundingClientRect();
7509
7655
  var y2 = moveEvent.clientY - rect2.top;
7510
7656
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7511
7657
  handleVolumeChange(percentage2);
7512
7658
  };
7513
- var handleMouseUp = function() {
7659
+ var handleMouseUp = function handleMouseUp1() {
7514
7660
  document.removeEventListener("mousemove", handleMouseMove);
7515
7661
  document.removeEventListener("mouseup", handleMouseUp);
7516
7662
  };
@@ -7521,7 +7667,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7521
7667
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7522
7668
  handleVolumeChange(percentage);
7523
7669
  },
7524
- onClick: function(e) {
7670
+ onClick: function onClick(e) {
7525
7671
  e.stopPropagation();
7526
7672
  var rect = e.currentTarget.getBoundingClientRect();
7527
7673
  var y = e.clientY - rect.top;
@@ -7568,17 +7714,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7568
7714
  transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
7569
7715
  cursor: "grab"
7570
7716
  },
7571
- onMouseEnter: function(e) {
7717
+ onMouseEnter: function onMouseEnter(e) {
7572
7718
  e.currentTarget.style.boxShadow = "0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.6)";
7573
7719
  e.currentTarget.style.cursor = "grab";
7574
7720
  },
7575
- onMouseLeave: function(e) {
7721
+ onMouseLeave: function onMouseLeave(e) {
7576
7722
  e.currentTarget.style.boxShadow = "0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4)";
7577
7723
  },
7578
- onMouseDown: function(e) {
7724
+ onMouseDown: function onMouseDown(e) {
7579
7725
  e.currentTarget.style.cursor = "grabbing";
7580
7726
  },
7581
- onMouseUp: function(e) {
7727
+ onMouseUp: function onMouseUp(e) {
7582
7728
  e.currentTarget.style.cursor = "grab";
7583
7729
  }
7584
7730
  })
@@ -7618,7 +7764,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7618
7764
  },
7619
7765
  children: [
7620
7766
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7621
- onClick: function() {
7767
+ onClick: function onClick() {
7622
7768
  return setShowSpeedMenu(!showSpeedMenu);
7623
7769
  },
7624
7770
  style: {
@@ -7637,12 +7783,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7637
7783
  minWidth: "".concat(56 * responsiveScale, "px"),
7638
7784
  minHeight: "".concat(40 * responsiveScale, "px")
7639
7785
  },
7640
- onMouseEnter: function(e) {
7786
+ onMouseEnter: function onMouseEnter(e) {
7641
7787
  var target = e.target;
7642
7788
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7643
7789
  target.style.boxShadow = "0 10px 32px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7644
7790
  },
7645
- onMouseLeave: function(e) {
7791
+ onMouseLeave: function onMouseLeave(e) {
7646
7792
  var target = e.target;
7647
7793
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7648
7794
  target.style.boxShadow = "0 6px 24px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -7678,7 +7824,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7678
7824
  2
7679
7825
  ].map(function(speed) {
7680
7826
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7681
- onClick: function() {
7827
+ onClick: function onClick() {
7682
7828
  return handlePlaybackRateChange(speed);
7683
7829
  },
7684
7830
  style: {
@@ -7696,12 +7842,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7696
7842
  transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7697
7843
  borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
7698
7844
  },
7699
- onMouseEnter: function(e) {
7845
+ onMouseEnter: function onMouseEnter(e) {
7700
7846
  if (playbackRate !== speed) {
7701
7847
  e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
7702
7848
  }
7703
7849
  },
7704
- onMouseLeave: function(e) {
7850
+ onMouseLeave: function onMouseLeave(e) {
7705
7851
  if (playbackRate !== speed) {
7706
7852
  e.target.style.background = "transparent";
7707
7853
  }
@@ -7716,7 +7862,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7716
7862
  ]
7717
7863
  }),
7718
7864
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7719
- onClick: function() {
7865
+ onClick: function onClick() {
7720
7866
  if (onFullscreenToggle) {
7721
7867
  onFullscreenToggle();
7722
7868
  } else if (playerRef.current) {
@@ -7741,12 +7887,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7741
7887
  minWidth: "".concat(44 * responsiveScale, "px"),
7742
7888
  minHeight: "".concat(44 * responsiveScale, "px")
7743
7889
  },
7744
- onMouseEnter: function(e) {
7890
+ onMouseEnter: function onMouseEnter(e) {
7745
7891
  var target = e.target;
7746
7892
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7747
7893
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
7748
7894
  },
7749
- onMouseLeave: function(e) {
7895
+ onMouseLeave: function onMouseLeave(e) {
7750
7896
  var target = e.target;
7751
7897
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7752
7898
  target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -7790,15 +7936,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7790
7936
  padding: "8px",
7791
7937
  margin: "-8px"
7792
7938
  },
7793
- onMouseEnter: function() {
7939
+ onMouseEnter: function onMouseEnter() {
7794
7940
  return setShowVolumeSlider(true);
7795
7941
  },
7796
- onMouseLeave: function() {
7942
+ onMouseLeave: function onMouseLeave() {
7797
7943
  return setShowVolumeSlider(false);
7798
7944
  },
7799
7945
  children: [
7800
7946
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7801
- onClick: function() {
7947
+ onClick: function onClick() {
7802
7948
  if (playerRef.current) {
7803
7949
  playerRef.current.toggleMute();
7804
7950
  }
@@ -7806,12 +7952,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7806
7952
  onVolumeToggle();
7807
7953
  }
7808
7954
  },
7809
- onMouseEnter: function(e) {
7955
+ onMouseEnter: function onMouseEnter(e) {
7810
7956
  var target = e.currentTarget;
7811
7957
  target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7812
7958
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7813
7959
  },
7814
- onMouseLeave: function(e) {
7960
+ onMouseLeave: function onMouseLeave(e) {
7815
7961
  var target = e.currentTarget;
7816
7962
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
7817
7963
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
@@ -7866,10 +8012,10 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7866
8012
  marginBottom: "-16px",
7867
8013
  zIndex: 9
7868
8014
  },
7869
- onMouseEnter: function() {
8015
+ onMouseEnter: function onMouseEnter() {
7870
8016
  return setShowVolumeSlider(true);
7871
8017
  },
7872
- onMouseLeave: function() {
8018
+ onMouseLeave: function onMouseLeave() {
7873
8019
  return setShowVolumeSlider(false);
7874
8020
  }
7875
8021
  }),
@@ -7894,12 +8040,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7894
8040
  zIndex: 10,
7895
8041
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7896
8042
  },
7897
- onMouseEnter: function(e) {
8043
+ onMouseEnter: function onMouseEnter(e) {
7898
8044
  setShowVolumeSlider(true);
7899
8045
  e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 24px rgba(96, 165, 250, 0.4)";
7900
8046
  e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
7901
8047
  },
7902
- onMouseLeave: function(e) {
8048
+ onMouseLeave: function onMouseLeave(e) {
7903
8049
  setShowVolumeSlider(false);
7904
8050
  e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35)";
7905
8051
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
@@ -7912,17 +8058,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7912
8058
  cursor: "pointer",
7913
8059
  transition: "transform 0.2s ease-in-out"
7914
8060
  },
7915
- onMouseDown: function(e) {
8061
+ onMouseDown: function onMouseDown(e) {
7916
8062
  e.preventDefault();
7917
8063
  var sliderElement = e.currentTarget;
7918
- var handleMouseMove = function(moveEvent) {
8064
+ var handleMouseMove = function handleMouseMove(moveEvent) {
7919
8065
  if (!sliderElement) return;
7920
8066
  var rect2 = sliderElement.getBoundingClientRect();
7921
8067
  var y2 = moveEvent.clientY - rect2.top;
7922
8068
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7923
8069
  handleVolumeChange(percentage2);
7924
8070
  };
7925
- var handleMouseUp = function() {
8071
+ var handleMouseUp = function handleMouseUp1() {
7926
8072
  document.removeEventListener("mousemove", handleMouseMove);
7927
8073
  document.removeEventListener("mouseup", handleMouseUp);
7928
8074
  };
@@ -7933,7 +8079,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7933
8079
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7934
8080
  handleVolumeChange(percentage);
7935
8081
  },
7936
- onClick: function(e) {
8082
+ onClick: function onClick(e) {
7937
8083
  e.stopPropagation();
7938
8084
  var rect = e.currentTarget.getBoundingClientRect();
7939
8085
  var y = e.clientY - rect.top;
@@ -7982,17 +8128,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7982
8128
  transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
7983
8129
  cursor: "grab"
7984
8130
  },
7985
- onMouseEnter: function(e) {
8131
+ onMouseEnter: function onMouseEnter(e) {
7986
8132
  e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(96, 165, 250, 0.6), 0 0 24px rgba(96, 165, 250, 0.7)";
7987
8133
  e.currentTarget.style.cursor = "grab";
7988
8134
  },
7989
- onMouseLeave: function(e) {
8135
+ onMouseLeave: function onMouseLeave(e) {
7990
8136
  e.currentTarget.style.boxShadow = "0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(96, 165, 250, 0.4), 0 0 16px rgba(96, 165, 250, 0.5)";
7991
8137
  },
7992
- onMouseDown: function(e) {
8138
+ onMouseDown: function onMouseDown(e) {
7993
8139
  e.currentTarget.style.cursor = "grabbing";
7994
8140
  },
7995
- onMouseUp: function(e) {
8141
+ onMouseUp: function onMouseUp(e) {
7996
8142
  e.currentTarget.style.cursor = "grab";
7997
8143
  }
7998
8144
  })
@@ -8004,7 +8150,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8004
8150
  ]
8005
8151
  }),
8006
8152
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
8007
- onClick: function() {
8153
+ onClick: function onClick() {
8008
8154
  if (onFullscreenToggle) {
8009
8155
  onFullscreenToggle();
8010
8156
  } else if (playerRef.current) {
@@ -8013,12 +8159,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8013
8159
  });
8014
8160
  }
8015
8161
  },
8016
- onMouseEnter: function(e) {
8162
+ onMouseEnter: function onMouseEnter(e) {
8017
8163
  var target = e.currentTarget;
8018
8164
  target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
8019
8165
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8020
8166
  },
8021
- onMouseLeave: function(e) {
8167
+ onMouseLeave: function onMouseLeave(e) {
8022
8168
  var target = e.currentTarget;
8023
8169
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
8024
8170
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";