stormcloud-video-player 0.3.52 → 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.
package/lib/index.cjs CHANGED
@@ -181,12 +181,22 @@ function _object_spread_props(target, source) {
181
181
  }
182
182
  function _object_without_properties(source, excluded) {
183
183
  if (source == null) return {};
184
- var target = _object_without_properties_loose(source, excluded);
185
- var key, i;
184
+ var target = {}, sourceKeys, key, i;
185
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
186
+ sourceKeys = Reflect.ownKeys(Object(source));
187
+ for(i = 0; i < sourceKeys.length; i++){
188
+ key = sourceKeys[i];
189
+ if (excluded.indexOf(key) >= 0) continue;
190
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
191
+ target[key] = source[key];
192
+ }
193
+ return target;
194
+ }
195
+ target = _object_without_properties_loose(source, excluded);
186
196
  if (Object.getOwnPropertySymbols) {
187
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
188
- for(i = 0; i < sourceSymbolKeys.length; i++){
189
- key = sourceSymbolKeys[i];
197
+ sourceKeys = Object.getOwnPropertySymbols(source);
198
+ for(i = 0; i < sourceKeys.length; i++){
199
+ key = sourceKeys[i];
190
200
  if (excluded.indexOf(key) >= 0) continue;
191
201
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
192
202
  target[key] = source[key];
@@ -196,12 +206,11 @@ function _object_without_properties(source, excluded) {
196
206
  }
197
207
  function _object_without_properties_loose(source, excluded) {
198
208
  if (source == null) return {};
199
- var target = {};
200
- var sourceKeys = Object.keys(source);
201
- var key, i;
209
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
202
210
  for(i = 0; i < sourceKeys.length; i++){
203
211
  key = sourceKeys[i];
204
212
  if (excluded.indexOf(key) >= 0) continue;
213
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
205
214
  target[key] = source[key];
206
215
  }
207
216
  return target;
@@ -254,9 +263,17 @@ function _ts_generator(thisArg, body) {
254
263
  },
255
264
  trys: [],
256
265
  ops: []
257
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
258
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
259
- return this;
266
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
267
+ return d(g, "next", {
268
+ value: verb(0)
269
+ }), d(g, "throw", {
270
+ value: verb(1)
271
+ }), d(g, "return", {
272
+ value: verb(2)
273
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
274
+ value: function() {
275
+ return this;
276
+ }
260
277
  }), g;
261
278
  function verb(n) {
262
279
  return function(v) {
@@ -356,20 +373,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
356
373
  var __getOwnPropNames = Object.getOwnPropertyNames;
357
374
  var __getProtoOf = Object.getPrototypeOf;
358
375
  var __hasOwnProp = Object.prototype.hasOwnProperty;
359
- var __export = function(target, all) {
376
+ var __export = function __export(target, all) {
360
377
  for(var name in all)__defProp(target, name, {
361
378
  get: all[name],
362
379
  enumerable: true
363
380
  });
364
381
  };
365
- var __copyProps = function(to, from, except, desc) {
382
+ var __copyProps = function __copyProps(to, from, except, desc) {
366
383
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
367
384
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
368
385
  try {
369
386
  var _loop = function() {
370
387
  var key = _step.value;
371
388
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
372
- get: function() {
389
+ get: function get() {
373
390
  return from[key];
374
391
  },
375
392
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -393,7 +410,7 @@ var __copyProps = function(to, from, except, desc) {
393
410
  }
394
411
  return to;
395
412
  };
396
- var __toESM = function(mod, isNodeMode, target) {
413
+ var __toESM = function __toESM(mod, isNodeMode, target) {
397
414
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
398
415
  // file that has been converted to a CommonJS file using a Babel-
399
416
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -403,7 +420,7 @@ var __toESM = function(mod, isNodeMode, target) {
403
420
  enumerable: true
404
421
  }) : target, mod);
405
422
  };
406
- var __toCommonJS = function(mod) {
423
+ var __toCommonJS = function __toCommonJS(mod) {
407
424
  return __copyProps(__defProp({}, "__esModule", {
408
425
  value: true
409
426
  }), mod);
@@ -411,106 +428,106 @@ var __toCommonJS = function(mod) {
411
428
  // src/index.ts
412
429
  var index_exports = {};
413
430
  __export(index_exports, {
414
- IS_BROWSER: function() {
431
+ IS_BROWSER: function IS_BROWSER1() {
415
432
  return IS_BROWSER;
416
433
  },
417
- IS_GLOBAL: function() {
434
+ IS_GLOBAL: function IS_GLOBAL1() {
418
435
  return IS_GLOBAL;
419
436
  },
420
- IS_IOS: function() {
437
+ IS_IOS: function IS_IOS1() {
421
438
  return IS_IOS;
422
439
  },
423
- IS_SAFARI: function() {
440
+ IS_SAFARI: function IS_SAFARI1() {
424
441
  return IS_SAFARI;
425
442
  },
426
- SUPPORTS_DASH: function() {
443
+ SUPPORTS_DASH: function SUPPORTS_DASH1() {
427
444
  return SUPPORTS_DASH;
428
445
  },
429
- SUPPORTS_HLS: function() {
446
+ SUPPORTS_HLS: function SUPPORTS_HLS1() {
430
447
  return SUPPORTS_HLS;
431
448
  },
432
- StormcloudPlayer: function() {
449
+ StormcloudPlayer: function StormcloudPlayer() {
433
450
  return StormcloudPlayer_default;
434
451
  },
435
- StormcloudVideoPlayer: function() {
452
+ StormcloudVideoPlayer: function StormcloudVideoPlayer1() {
436
453
  return StormcloudVideoPlayer;
437
454
  },
438
- StormcloudVideoPlayerComponent: function() {
455
+ StormcloudVideoPlayerComponent: function StormcloudVideoPlayerComponent1() {
439
456
  return StormcloudVideoPlayerComponent;
440
457
  },
441
- canPlay: function() {
458
+ canPlay: function canPlay1() {
442
459
  return canPlay;
443
460
  },
444
- createHlsAdPlayer: function() {
461
+ createHlsAdPlayer: function createHlsAdPlayer1() {
445
462
  return createHlsAdPlayer;
446
463
  },
447
- createImaController: function() {
464
+ createImaController: function createImaController1() {
448
465
  return createImaController;
449
466
  },
450
- createStormcloudPlayer: function() {
467
+ createStormcloudPlayer: function createStormcloudPlayer1() {
451
468
  return createStormcloudPlayer;
452
469
  },
453
- default: function() {
470
+ default: function _default() {
454
471
  return StormcloudVideoPlayerComponent;
455
472
  },
456
- detectBrowser: function() {
473
+ detectBrowser: function detectBrowser1() {
457
474
  return detectBrowser;
458
475
  },
459
- getBrowserConfigOverrides: function() {
476
+ getBrowserConfigOverrides: function getBrowserConfigOverrides1() {
460
477
  return getBrowserConfigOverrides;
461
478
  },
462
- getBrowserID: function() {
479
+ getBrowserID: function getBrowserID1() {
463
480
  return getBrowserID;
464
481
  },
465
- getClientInfo: function() {
482
+ getClientInfo: function getClientInfo1() {
466
483
  return getClientInfo;
467
484
  },
468
- getRecommendedAdPlayer: function() {
485
+ getRecommendedAdPlayer: function getRecommendedAdPlayer1() {
469
486
  return getRecommendedAdPlayer;
470
487
  },
471
- initializePolyfills: function() {
488
+ initializePolyfills: function initializePolyfills1() {
472
489
  return initializePolyfills;
473
490
  },
474
- isMediaStream: function() {
491
+ isMediaStream: function isMediaStream1() {
475
492
  return isMediaStream;
476
493
  },
477
- lazy: function() {
494
+ lazy: function lazy1() {
478
495
  return lazy;
479
496
  },
480
- logBrowserInfo: function() {
497
+ logBrowserInfo: function logBrowserInfo1() {
481
498
  return logBrowserInfo;
482
499
  },
483
- merge: function() {
500
+ merge: function merge1() {
484
501
  return merge;
485
502
  },
486
- omit: function() {
503
+ omit: function omit1() {
487
504
  return omit;
488
505
  },
489
- parseQuery: function() {
506
+ parseQuery: function parseQuery1() {
490
507
  return parseQuery;
491
508
  },
492
- players: function() {
509
+ players: function players() {
493
510
  return players_default;
494
511
  },
495
- randomString: function() {
512
+ randomString: function randomString1() {
496
513
  return randomString;
497
514
  },
498
- sendHeartbeat: function() {
515
+ sendHeartbeat: function sendHeartbeat1() {
499
516
  return sendHeartbeat;
500
517
  },
501
- sendInitialTracking: function() {
518
+ sendInitialTracking: function sendInitialTracking1() {
502
519
  return sendInitialTracking;
503
520
  },
504
- supportsFeature: function() {
521
+ supportsFeature: function supportsFeature1() {
505
522
  return supportsFeature;
506
523
  },
507
- supportsGoogleIMA: function() {
524
+ supportsGoogleIMA: function supportsGoogleIMA1() {
508
525
  return supportsGoogleIMA;
509
526
  },
510
- supportsModernJS: function() {
527
+ supportsModernJS: function supportsModernJS1() {
511
528
  return supportsModernJS;
512
529
  },
513
- supportsWebKitPresentationMode: function() {
530
+ supportsWebKitPresentationMode: function supportsWebKitPresentationMode1() {
514
531
  return supportsWebKitPresentationMode;
515
532
  }
516
533
  });
@@ -875,7 +892,7 @@ function createImaController(video, options) {
875
892
  var fn = _step.value;
876
893
  try {
877
894
  fn(payload);
878
- } catch (e) {}
895
+ } catch (unused) {}
879
896
  }
880
897
  } catch (err) {
881
898
  _didIteratorError = true;
@@ -913,7 +930,7 @@ function createImaController(video, options) {
913
930
  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'.");
914
931
  }
915
932
  }
916
- } catch (e) {}
933
+ } catch (unused) {}
917
934
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
918
935
  var existing = document.querySelector('script[data-ima="true"]');
919
936
  if (existing) {
@@ -955,9 +972,6 @@ function createImaController(video, options) {
955
972
  var adDisplayContainer;
956
973
  var adContainerEl;
957
974
  var lastAdTagUrl;
958
- var retryAttempts = 0;
959
- var maxRetries = 2;
960
- var backoffBaseMs = 500;
961
975
  var adsLoadedPromise;
962
976
  var adsLoadedResolve;
963
977
  var adsLoadedReject;
@@ -1161,7 +1175,7 @@ function createImaController(video, options) {
1161
1175
  if (adsManager) {
1162
1176
  try {
1163
1177
  adsManager.destroy();
1164
- } catch (e) {}
1178
+ } catch (unused) {}
1165
1179
  adsManager = void 0;
1166
1180
  }
1167
1181
  if (adVideoElement) {
@@ -1172,7 +1186,7 @@ function createImaController(video, options) {
1172
1186
  if (adsLoader) {
1173
1187
  try {
1174
1188
  adsLoader.destroy();
1175
- } catch (e) {}
1189
+ } catch (unused) {}
1176
1190
  adsLoader = void 0;
1177
1191
  }
1178
1192
  }
@@ -1190,7 +1204,7 @@ function createImaController(video, options) {
1190
1204
  try {
1191
1205
  var _adDisplayContainer_initialize;
1192
1206
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1193
- } catch (e) {}
1207
+ } catch (unused) {}
1194
1208
  }
1195
1209
  }).catch(function() {});
1196
1210
  },
@@ -1254,7 +1268,6 @@ function createImaController(video, options) {
1254
1268
  _state.sent();
1255
1269
  google = window.google;
1256
1270
  lastAdTagUrl = vastTagUrl;
1257
- retryAttempts = 0;
1258
1271
  if (!adDisplayContainer) {
1259
1272
  container = document.createElement("div");
1260
1273
  container.style.position = "absolute";
@@ -1338,32 +1351,23 @@ function createImaController(video, options) {
1338
1351
  }
1339
1352
  }, 300);
1340
1353
  }
1341
- hideContentVideo();
1354
+ showContentVideo();
1342
1355
  if (adsLoadedReject) {
1343
1356
  adsLoadedReject(new Error("Ad playback error"));
1344
1357
  adsLoadedReject = void 0;
1345
1358
  adsLoadedResolve = void 0;
1346
1359
  }
1347
- if (lastAdTagUrl && retryAttempts < maxRetries && !isNoFill) {
1348
- var delay = backoffBaseMs * Math.pow(2, retryAttempts++);
1349
- window.setTimeout(function() {
1350
- try {
1351
- makeAdsRequest(google, lastAdTagUrl);
1352
- } catch (e) {}
1353
- }, delay);
1354
- } else {
1355
- emit("ad_error", {
1356
- code: errorCode,
1357
- vastErrorCode: vastErrorCode,
1358
- message: errorMessage,
1359
- cause: innerError,
1360
- isNoFill: isNoFill
1361
- });
1362
- if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1363
- if (video.paused) {
1364
- var _video_play;
1365
- (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1366
- }
1360
+ emit("ad_error", {
1361
+ code: errorCode,
1362
+ vastErrorCode: vastErrorCode,
1363
+ message: errorMessage,
1364
+ cause: innerError,
1365
+ isNoFill: isNoFill
1366
+ });
1367
+ if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
1368
+ if (video.paused) {
1369
+ var _video_play;
1370
+ (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
1367
1371
  }
1368
1372
  }
1369
1373
  });
@@ -1381,7 +1385,7 @@ function createImaController(video, options) {
1381
1385
  if (adsManager) {
1382
1386
  try {
1383
1387
  adsManager.setVolume(adVolume);
1384
- } catch (e) {}
1388
+ } catch (unused) {}
1385
1389
  }
1386
1390
  emit("content_pause");
1387
1391
  });
@@ -1395,7 +1399,7 @@ function createImaController(video, options) {
1395
1399
  if (adsManager) {
1396
1400
  try {
1397
1401
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1398
- } catch (e) {}
1402
+ } catch (unused) {}
1399
1403
  }
1400
1404
  }
1401
1405
  if (adContainerEl) {
@@ -1409,7 +1413,7 @@ function createImaController(video, options) {
1409
1413
  adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
1410
1414
  adPlaying = false;
1411
1415
  setAdPlayingFlag(false);
1412
- hideContentVideo();
1416
+ showContentVideo();
1413
1417
  emit("content_resume");
1414
1418
  });
1415
1419
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
@@ -1425,7 +1429,7 @@ function createImaController(video, options) {
1425
1429
  }
1426
1430
  }, 300);
1427
1431
  }
1428
- hideContentVideo();
1432
+ showContentVideo();
1429
1433
  emit("all_ads_completed");
1430
1434
  });
1431
1435
  if (adsLoadedResolve) {
@@ -1447,7 +1451,7 @@ function createImaController(video, options) {
1447
1451
  }
1448
1452
  }, 300);
1449
1453
  }
1450
- hideContentVideo();
1454
+ showContentVideo();
1451
1455
  if (adsLoadedReject) {
1452
1456
  adsLoadedReject(new Error("Failed to setup ads manager"));
1453
1457
  adsLoadedReject = void 0;
@@ -1490,7 +1494,7 @@ function createImaController(video, options) {
1490
1494
  }
1491
1495
  }, 300);
1492
1496
  }
1493
- hideContentVideo();
1497
+ showContentVideo();
1494
1498
  if (adsLoadedReject) {
1495
1499
  adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
1496
1500
  adsLoadedReject = void 0;
@@ -1556,7 +1560,7 @@ function createImaController(video, options) {
1556
1560
  }
1557
1561
  try {
1558
1562
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1559
- } catch (e) {}
1563
+ } catch (unused) {}
1560
1564
  adsManager.start();
1561
1565
  return [
1562
1566
  2,
@@ -1638,7 +1642,7 @@ function createImaController(video, options) {
1638
1642
  try {
1639
1643
  ;
1640
1644
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1641
- } catch (e) {}
1645
+ } catch (unused) {}
1642
1646
  destroyAdsManager();
1643
1647
  return [
1644
1648
  2
@@ -1669,7 +1673,7 @@ function createImaController(video, options) {
1669
1673
  try {
1670
1674
  var _adsLoader_destroy;
1671
1675
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1672
- } catch (e) {}
1676
+ } catch (unused) {}
1673
1677
  adDisplayContainer = void 0;
1674
1678
  adsLoader = void 0;
1675
1679
  contentVideoHidden = false;
@@ -1718,7 +1722,7 @@ function createImaController(video, options) {
1718
1722
  if (adsManager && adPlaying) {
1719
1723
  try {
1720
1724
  adsManager.setVolume(clampedVolume);
1721
- } catch (e) {}
1725
+ } catch (unused) {}
1722
1726
  }
1723
1727
  },
1724
1728
  getAdVolume: function getAdVolume() {
@@ -3211,22 +3215,29 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3211
3215
  this.maxPlaceholderDurationMs = 5e3;
3212
3216
  this.isShowingPlaceholder = false;
3213
3217
  this.totalAdRequestsInBreak = 0;
3214
- this.maxTotalAdRequestsPerBreak = 20;
3218
+ this.maxTotalAdRequestsPerBreak = 10;
3215
3219
  this.pendingAdBreak = null;
3216
3220
  this.consecutiveFailures = 0;
3217
3221
  this.maxConsecutiveFailures = 5;
3218
3222
  this.lastAdRequestTime = 0;
3219
- this.minAdRequestIntervalMs = 2500;
3223
+ this.minAdRequestIntervalMs = 3e3;
3220
3224
  this.backoffBaseMs = 1e3;
3221
3225
  this.maxBackoffMs = 15e3;
3226
+ this.globalConsecutiveNoFills = 0;
3227
+ this.globalNoFillThreshold = 3;
3228
+ this.globalNoFillCooldownUntil = 0;
3229
+ this.globalNoFillBackoffBaseMs = 5e3;
3230
+ this.globalNoFillBackoffMaxMs = 6e4;
3231
+ this.globalLastGamRequestTime = 0;
3232
+ this.globalMinGamIntervalMs = 3e3;
3222
3233
  this.preloadPool = [];
3223
- this.maxPreloadPoolSize = 3;
3234
+ this.maxPreloadPoolSize = 2;
3224
3235
  this.preloadPoolActive = false;
3225
3236
  this.preloadPoolLoopRunning = false;
3226
3237
  this.continuousFetchLoopRunning = false;
3227
3238
  initializePolyfills();
3228
3239
  var browserOverrides = getBrowserConfigOverrides();
3229
- this.config = _object_spread({}, config, browserOverrides);
3240
+ this.config = _object_spread({}, browserOverrides, config);
3230
3241
  this.video = config.videoElement;
3231
3242
  logBrowserInfo(config.debugAdTiming);
3232
3243
  this.ima = this.createAdPlayer(false);
@@ -3363,7 +3374,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3363
3374
  });
3364
3375
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3365
3376
  return _async_to_generator(function() {
3366
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
3377
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3367
3378
  return _ts_generator(this, function(_state) {
3368
3379
  switch(_state.label){
3369
3380
  case 0:
@@ -3372,10 +3383,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3372
3383
  } else {
3373
3384
  ;
3374
3385
  ;
3375
- 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) {
3386
+ 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) {
3376
3387
  var _level_details, _level_details1;
3377
3388
  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";
3378
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
3389
+ })) !== null && _ref !== void 0 ? _ref : false;
3379
3390
  }
3380
3391
  if (this.config.debugAdTiming) {
3381
3392
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -3439,9 +3450,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3439
3450
  var tag = "";
3440
3451
  var value = "";
3441
3452
  if (Array.isArray(entry)) {
3442
- var _entry_;
3453
+ var _entry_, _entry_1;
3443
3454
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3444
- var _entry_1;
3445
3455
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3446
3456
  } else if (typeof entry === "string") {
3447
3457
  var idx = entry.indexOf(":");
@@ -3564,9 +3574,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3564
3574
  var tag = "";
3565
3575
  var value = "";
3566
3576
  if (Array.isArray(entry)) {
3567
- var _entry_;
3577
+ var _entry_, _entry_1;
3568
3578
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
3569
- var _entry_1;
3570
3579
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
3571
3580
  } else if (typeof entry === "string") {
3572
3581
  var idx = entry.indexOf(":");
@@ -3616,10 +3625,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3616
3625
  }
3617
3626
  });
3618
3627
  } else if (tag.includes("EXT-X-DATERANGE")) {
3628
+ var _attrs_CLASS;
3619
3629
  var attrs = _this.parseAttributeList(value);
3620
3630
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
3621
3631
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
3622
- var _attrs_CLASS;
3623
3632
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
3624
3633
  var duration = _this.toNumber(attrs["DURATION"]);
3625
3634
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -3733,6 +3742,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3733
3742
  _this.clearAdRequestWatchdog();
3734
3743
  _this.activeAdRequestToken = null;
3735
3744
  _this.showAds = true;
3745
+ _this.resetGamNoFillCounter();
3736
3746
  if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3737
3747
  if (_this.adStopTimerId == null) {
3738
3748
  _this.currentAdBreakStartWallClockMs = Date.now();
@@ -4021,11 +4031,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4021
4031
  }
4022
4032
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4023
4033
  if (daterangeMatch) {
4024
- var _daterangeMatch_;
4034
+ var _daterangeMatch_, _attrs_CLASS;
4025
4035
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4026
4036
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4027
4037
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4028
- var _attrs_CLASS;
4029
4038
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4030
4039
  var duration = this.toNumber(attrs["DURATION"]);
4031
4040
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4101,7 +4110,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4101
4110
  var out = "";
4102
4111
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
4103
4112
  return out;
4104
- } catch (e) {
4113
+ } catch (unused) {
4105
4114
  return void 0;
4106
4115
  }
4107
4116
  }
@@ -4120,6 +4129,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4120
4129
  });
4121
4130
  }
4122
4131
  if (marker.type === "start") {
4132
+ var _this_config_immediateManifestAds;
4123
4133
  var _this_pendingAdBreak;
4124
4134
  if (!this.video.muted) {
4125
4135
  this.video.muted = true;
@@ -4144,7 +4154,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4144
4154
  this.expectedAdBreakDurationMs = durationMs;
4145
4155
  this.currentAdBreakStartWallClockMs = Date.now();
4146
4156
  var isManifestMarker = this.isManifestBasedMarker(marker);
4147
- var _this_config_immediateManifestAds;
4148
4157
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
4149
4158
  if (this.config.debugAdTiming) {
4150
4159
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -4299,9 +4308,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4299
4308
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
4300
4309
  var match;
4301
4310
  while((match = regex.exec(value)) !== null){
4302
- var _match_;
4311
+ var _match_, _ref, _match_1;
4303
4312
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
4304
- var _match_1, _ref;
4305
4313
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
4306
4314
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
4307
4315
  rawVal = rawVal.slice(1, -1);
@@ -4646,13 +4654,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4646
4654
  {
4647
4655
  key: "shouldShowNativeControls",
4648
4656
  value: function shouldShowNativeControls() {
4657
+ var _this_config_showCustomControls;
4649
4658
  var streamType = this.getStreamType();
4650
4659
  if (streamType === "other") {
4651
- var _this_config_showCustomControls;
4652
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
4660
+ var _this_config_showCustomControls1;
4661
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
4653
4662
  }
4654
- var _this_config_showCustomControls1;
4655
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
4663
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
4656
4664
  }
4657
4665
  },
4658
4666
  {
@@ -4760,6 +4768,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4760
4768
  var _this, loadPromise;
4761
4769
  return _ts_generator(this, function(_state) {
4762
4770
  _this = this;
4771
+ if (this.isGamInCooldown()) {
4772
+ if (this.config.debugAdTiming) {
4773
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
4774
+ }
4775
+ return [
4776
+ 2
4777
+ ];
4778
+ }
4763
4779
  if (this.preloadPool.some(function(entry) {
4764
4780
  return entry.vastUrl === vastUrl;
4765
4781
  }) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
@@ -4789,26 +4805,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4789
4805
  case 1:
4790
4806
  _state.trys.push([
4791
4807
  1,
4792
- 4,
4808
+ 5,
4793
4809
  ,
4794
- 5
4810
+ 6
4795
4811
  ]);
4796
4812
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
4797
4813
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
4798
4814
  preloadIma.initialize();
4799
- errorListener = function(payload) {
4815
+ errorListener = function errorListener(payload) {
4800
4816
  hasAdError = true;
4801
4817
  adErrorPayload = payload;
4802
4818
  };
4803
4819
  preloadIma.on("ad_error", errorListener);
4804
- errorListenerCleanup = function() {
4820
+ errorListenerCleanup = function errorListenerCleanup() {
4805
4821
  return preloadIma.off("ad_error", errorListener);
4806
4822
  };
4807
4823
  return [
4808
4824
  4,
4809
- preloadIma.requestAds(vastUrl)
4825
+ this.enforceGlobalRateLimit()
4810
4826
  ];
4811
4827
  case 2:
4828
+ _state.sent();
4829
+ return [
4830
+ 4,
4831
+ preloadIma.requestAds(vastUrl)
4832
+ ];
4833
+ case 3:
4812
4834
  _state.sent();
4813
4835
  preloadIma.pause();
4814
4836
  return [
@@ -4817,7 +4839,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4817
4839
  return setTimeout(resolve, 1500);
4818
4840
  })
4819
4841
  ];
4820
- case 3:
4842
+ case 4:
4821
4843
  _state.sent();
4822
4844
  preloadIma.pause();
4823
4845
  if (hasAdError) {
@@ -4826,6 +4848,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4826
4848
  errorListenerCleanup();
4827
4849
  }
4828
4850
  preloadIma.destroy();
4851
+ this.recordGamNoFill();
4829
4852
  if (isNoFill) {
4830
4853
  if (this.config.debugAdTiming) {
4831
4854
  console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
@@ -4852,7 +4875,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4852
4875
  isReady: true,
4853
4876
  loadPromise: Promise.resolve()
4854
4877
  };
4855
- lateErrorListener = function(payload) {
4878
+ lateErrorListener = function lateErrorListener(payload) {
4856
4879
  var index = _this.preloadPool.findIndex(function(entry) {
4857
4880
  return entry.vastUrl === vastUrl;
4858
4881
  });
@@ -4863,7 +4886,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4863
4886
  }
4864
4887
  try {
4865
4888
  preloadIma.destroy();
4866
- } catch (e) {}
4889
+ } catch (unused) {}
4867
4890
  }
4868
4891
  };
4869
4892
  preloadIma.on("ad_error", lateErrorListener);
@@ -4876,13 +4899,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4876
4899
  }
4877
4900
  return [
4878
4901
  3,
4879
- 5
4902
+ 6
4880
4903
  ];
4881
- case 4:
4904
+ case 5:
4882
4905
  error = _state.sent();
4883
4906
  if (errorListenerCleanup) {
4884
4907
  errorListenerCleanup();
4885
4908
  }
4909
+ this.recordGamNoFill();
4886
4910
  if (this.config.debugAdTiming) {
4887
4911
  console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
4888
4912
  }
@@ -4893,9 +4917,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4893
4917
  }
4894
4918
  return [
4895
4919
  3,
4896
- 5
4920
+ 6
4897
4921
  ];
4898
- case 5:
4922
+ case 6:
4899
4923
  return [
4900
4924
  2
4901
4925
  ];
@@ -4934,6 +4958,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4934
4958
  3,
4935
4959
  10
4936
4960
  ];
4961
+ if (this.isGamInCooldown()) {
4962
+ if (this.config.debugAdTiming) {
4963
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
4964
+ }
4965
+ return [
4966
+ 3,
4967
+ 10
4968
+ ];
4969
+ }
4937
4970
  if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
4938
4971
  3,
4939
4972
  3
@@ -4966,7 +4999,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4966
4999
  3,
4967
5000
  8
4968
5001
  ];
4969
- if (!this.preloadPoolActive) {
5002
+ if (!this.preloadPoolActive || this.isGamInCooldown()) {
4970
5003
  return [
4971
5004
  3,
4972
5005
  8
@@ -5182,9 +5215,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5182
5215
  case 1:
5183
5216
  _state.trys.push([
5184
5217
  1,
5185
- 7,
5218
+ 8,
5186
5219
  ,
5187
- 13
5220
+ 14
5188
5221
  ]);
5189
5222
  if (!(usePreloadedAd && preloadedController)) return [
5190
5223
  3,
@@ -5220,15 +5253,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5220
5253
  this.ima.setAdVolume(adVolume);
5221
5254
  return [
5222
5255
  3,
5223
- 6
5256
+ 7
5224
5257
  ];
5225
5258
  case 3:
5259
+ return [
5260
+ 4,
5261
+ this.enforceGlobalRateLimit()
5262
+ ];
5263
+ case 4:
5264
+ _state.sent();
5226
5265
  this.lastAdRequestTime = Date.now();
5227
5266
  return [
5228
5267
  4,
5229
5268
  this.ima.requestAds(firstAdUrl)
5230
5269
  ];
5231
- case 4:
5270
+ case 5:
5232
5271
  _state.sent();
5233
5272
  if (this.config.debugAdTiming) {
5234
5273
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
@@ -5243,7 +5282,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5243
5282
  4,
5244
5283
  this.ima.play()
5245
5284
  ];
5246
- case 5:
5285
+ case 6:
5247
5286
  _state.sent();
5248
5287
  if (this.expectedAdBreakDurationMs != null) {
5249
5288
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5251,36 +5290,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5251
5290
  }
5252
5291
  adVolume1 = currentMuted ? 0 : currentVolume;
5253
5292
  this.ima.setAdVolume(adVolume1);
5254
- _state.label = 6;
5255
- case 6:
5293
+ _state.label = 7;
5294
+ case 7:
5256
5295
  return [
5257
5296
  3,
5258
- 13
5297
+ 14
5259
5298
  ];
5260
- case 7:
5299
+ case 8:
5261
5300
  error = _state.sent();
5262
5301
  if (this.config.debugAdTiming) {
5263
5302
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
5264
5303
  }
5265
5304
  if (!!usePreloadedAd) return [
5266
5305
  3,
5267
- 11
5306
+ 12
5268
5307
  ];
5269
5308
  fallbackPreloaded = this.getPreloadedAd();
5270
5309
  if (!fallbackPreloaded) return [
5271
5310
  3,
5272
- 11
5311
+ 12
5273
5312
  ];
5274
5313
  if (this.config.debugAdTiming) {
5275
5314
  console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
5276
5315
  }
5277
- _state.label = 8;
5278
- case 8:
5316
+ _state.label = 9;
5317
+ case 9:
5279
5318
  _state.trys.push([
5280
- 8,
5281
- 10,
5319
+ 9,
5320
+ 11,
5282
5321
  ,
5283
- 11
5322
+ 12
5284
5323
  ]);
5285
5324
  this.ima.destroy();
5286
5325
  this.video.muted = true;
@@ -5299,7 +5338,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5299
5338
  4,
5300
5339
  this.ima.play()
5301
5340
  ];
5302
- case 9:
5341
+ case 10:
5303
5342
  _state.sent();
5304
5343
  if (this.expectedAdBreakDurationMs != null) {
5305
5344
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -5310,16 +5349,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5310
5349
  return [
5311
5350
  2
5312
5351
  ];
5313
- case 10:
5352
+ case 11:
5314
5353
  fallbackError = _state.sent();
5315
5354
  if (this.config.debugAdTiming) {
5316
5355
  console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
5317
5356
  }
5318
5357
  return [
5319
5358
  3,
5320
- 11
5359
+ 12
5321
5360
  ];
5322
- case 11:
5361
+ case 12:
5323
5362
  if (this.isTemporaryAdError(error)) {
5324
5363
  this.temporaryFailureUrls.set(firstAdUrl, Date.now());
5325
5364
  if (this.config.debugAdTiming) {
@@ -5337,13 +5376,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5337
5376
  4,
5338
5377
  this.tryNextAvailableAdWithRateLimit()
5339
5378
  ];
5340
- case 12:
5379
+ case 13:
5341
5380
  _state.sent();
5342
5381
  return [
5343
5382
  3,
5344
- 13
5383
+ 14
5345
5384
  ];
5346
- case 13:
5385
+ case 14:
5347
5386
  return [
5348
5387
  2
5349
5388
  ];
@@ -5394,6 +5433,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5394
5433
  "break"
5395
5434
  ];
5396
5435
  }
5436
+ if (_this.isGamInCooldown()) {
5437
+ if (_this.config.debugAdTiming) {
5438
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
5439
+ }
5440
+ return [
5441
+ 2,
5442
+ "break"
5443
+ ];
5444
+ }
5397
5445
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
5398
5446
  if (_this.config.debugAdTiming) {
5399
5447
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -5590,6 +5638,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5590
5638
  2
5591
5639
  ];
5592
5640
  }
5641
+ if (this.isGamInCooldown()) {
5642
+ if (this.config.debugAdTiming) {
5643
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
5644
+ }
5645
+ this.handleAdPodComplete();
5646
+ return [
5647
+ 2
5648
+ ];
5649
+ }
5593
5650
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5594
5651
  if (this.config.debugAdTiming) {
5595
5652
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
@@ -5786,6 +5843,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5786
5843
  case 0:
5787
5844
  remaining = this.getRemainingAdMs();
5788
5845
  waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
5846
+ if (this.isGamInCooldown()) {
5847
+ if (this.config.debugAdTiming) {
5848
+ console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
5849
+ }
5850
+ this.handleAdPodComplete();
5851
+ return [
5852
+ 2
5853
+ ];
5854
+ }
5789
5855
  if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
5790
5856
  if (this.config.debugAdTiming) {
5791
5857
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
@@ -6049,11 +6115,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6049
6115
  {
6050
6116
  key: "ensureAdStoppedByTimer",
6051
6117
  value: function ensureAdStoppedByTimer() {
6118
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
6052
6119
  if (!this.inAdBreak) return;
6053
6120
  this.adStopTimerId = void 0;
6054
6121
  var adPlaying = this.ima.isAdPlaying();
6055
6122
  var pendingAds = this.adPodQueue.length > 0;
6056
- var _this_config_adBreakCheckIntervalMs;
6057
6123
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
6058
6124
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
6059
6125
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -6061,7 +6127,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6061
6127
  if (this.currentAdBreakStartWallClockMs != null) {
6062
6128
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
6063
6129
  }
6064
- var _this_expectedAdBreakDurationMs;
6065
6130
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
6066
6131
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
6067
6132
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -6175,6 +6240,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6175
6240
  }
6176
6241
  }
6177
6242
  },
6243
+ {
6244
+ key: "isGamInCooldown",
6245
+ value: function isGamInCooldown() {
6246
+ return Date.now() < this.globalNoFillCooldownUntil;
6247
+ }
6248
+ },
6249
+ {
6250
+ key: "recordGamNoFill",
6251
+ value: function recordGamNoFill() {
6252
+ this.globalConsecutiveNoFills++;
6253
+ if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
6254
+ var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
6255
+ var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
6256
+ this.globalNoFillCooldownUntil = Date.now() + backoff;
6257
+ if (this.config.debugAdTiming) {
6258
+ console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
6259
+ }
6260
+ }
6261
+ }
6262
+ },
6263
+ {
6264
+ key: "resetGamNoFillCounter",
6265
+ value: function resetGamNoFillCounter() {
6266
+ if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
6267
+ console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
6268
+ }
6269
+ this.globalConsecutiveNoFills = 0;
6270
+ this.globalNoFillCooldownUntil = 0;
6271
+ }
6272
+ },
6273
+ {
6274
+ key: "enforceGlobalRateLimit",
6275
+ value: function enforceGlobalRateLimit() {
6276
+ return _async_to_generator(function() {
6277
+ var now, elapsed, waitMs;
6278
+ return _ts_generator(this, function(_state) {
6279
+ switch(_state.label){
6280
+ case 0:
6281
+ now = Date.now();
6282
+ elapsed = now - this.globalLastGamRequestTime;
6283
+ if (!(elapsed < this.globalMinGamIntervalMs)) return [
6284
+ 3,
6285
+ 2
6286
+ ];
6287
+ waitMs = this.globalMinGamIntervalMs - elapsed;
6288
+ if (this.config.debugAdTiming) {
6289
+ console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
6290
+ }
6291
+ return [
6292
+ 4,
6293
+ new Promise(function(resolve) {
6294
+ return setTimeout(resolve, waitMs);
6295
+ })
6296
+ ];
6297
+ case 1:
6298
+ _state.sent();
6299
+ _state.label = 2;
6300
+ case 2:
6301
+ this.globalLastGamRequestTime = Date.now();
6302
+ return [
6303
+ 2
6304
+ ];
6305
+ }
6306
+ });
6307
+ }).call(this);
6308
+ }
6309
+ },
6178
6310
  {
6179
6311
  key: "playSingleAd",
6180
6312
  value: function playSingleAd(vastTagUrl) {
@@ -6206,6 +6338,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6206
6338
  }
6207
6339
  throw new Error("Too many consecutive failures");
6208
6340
  }
6341
+ if (this.isGamInCooldown()) {
6342
+ if (this.config.debugAdTiming) {
6343
+ console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
6344
+ }
6345
+ throw new Error("GAM in cooldown");
6346
+ }
6209
6347
  this.recreateImaController();
6210
6348
  requestToken = ++this.adRequestTokenCounter;
6211
6349
  this.activeAdRequestToken = requestToken;
@@ -6214,16 +6352,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6214
6352
  case 1:
6215
6353
  _state.trys.push([
6216
6354
  1,
6217
- 11,
6355
+ 12,
6218
6356
  ,
6219
- 16
6357
+ 17
6220
6358
  ]);
6359
+ return [
6360
+ 4,
6361
+ this.enforceGlobalRateLimit()
6362
+ ];
6363
+ case 2:
6364
+ _state.sent();
6221
6365
  this.lastAdRequestTime = Date.now();
6222
6366
  return [
6223
6367
  4,
6224
6368
  this.ima.requestAds(vastTagUrl)
6225
6369
  ];
6226
- case 2:
6370
+ case 3:
6227
6371
  _state.sent();
6228
6372
  this.clearAdRequestWatchdog();
6229
6373
  if (this.activeAdRequestToken !== requestToken) {
@@ -6231,20 +6375,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6231
6375
  2
6232
6376
  ];
6233
6377
  }
6234
- _state.label = 3;
6235
- case 3:
6378
+ _state.label = 4;
6379
+ case 4:
6236
6380
  _state.trys.push([
6237
- 3,
6238
- 5,
6381
+ 4,
6382
+ 6,
6239
6383
  ,
6240
- 10
6384
+ 11
6241
6385
  ]);
6242
6386
  this.startAdFailsafeTimer(requestToken);
6243
6387
  return [
6244
6388
  4,
6245
6389
  this.ima.play()
6246
6390
  ];
6247
- case 4:
6391
+ case 5:
6248
6392
  _state.sent();
6249
6393
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6250
6394
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6258,9 +6402,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6258
6402
  this.temporaryFailureUrls.delete(vastTagUrl);
6259
6403
  return [
6260
6404
  3,
6261
- 10
6405
+ 11
6262
6406
  ];
6263
- case 5:
6407
+ case 6:
6264
6408
  playError = _state.sent();
6265
6409
  if (this.config.debugAdTiming) {
6266
6410
  console.error("[AD-ERROR] Failed to play ad:", playError);
@@ -6268,18 +6412,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6268
6412
  preloadedFallback = this.getPreloadedAd();
6269
6413
  if (!preloadedFallback) return [
6270
6414
  3,
6271
- 9
6415
+ 10
6272
6416
  ];
6273
6417
  if (this.config.debugAdTiming) {
6274
6418
  console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
6275
6419
  }
6276
- _state.label = 6;
6277
- case 6:
6420
+ _state.label = 7;
6421
+ case 7:
6278
6422
  _state.trys.push([
6279
- 6,
6280
- 8,
6423
+ 7,
6424
+ 9,
6281
6425
  ,
6282
- 9
6426
+ 10
6283
6427
  ]);
6284
6428
  this.clearAdFailsafeTimer();
6285
6429
  this.ima.destroy();
@@ -6295,7 +6439,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6295
6439
  4,
6296
6440
  this.ima.play()
6297
6441
  ];
6298
- case 7:
6442
+ case 8:
6299
6443
  _state.sent();
6300
6444
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6301
6445
  this.currentAdBreakStartWallClockMs = Date.now();
@@ -6308,16 +6452,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6308
6452
  return [
6309
6453
  2
6310
6454
  ];
6311
- case 8:
6455
+ case 9:
6312
6456
  fallbackError = _state.sent();
6313
6457
  if (this.config.debugAdTiming) {
6314
6458
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
6315
6459
  }
6316
6460
  return [
6317
6461
  3,
6318
- 9
6462
+ 10
6319
6463
  ];
6320
- case 9:
6464
+ case 10:
6321
6465
  if (this.isTemporaryAdError(playError)) {
6322
6466
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6323
6467
  if (this.config.debugAdTiming) {
@@ -6334,12 +6478,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6334
6478
  this.activeAdRequestToken = null;
6335
6479
  }
6336
6480
  throw playError;
6337
- case 10:
6481
+ case 11:
6338
6482
  return [
6339
6483
  3,
6340
- 16
6484
+ 17
6341
6485
  ];
6342
- case 11:
6486
+ case 12:
6343
6487
  error = _state.sent();
6344
6488
  errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
6345
6489
  if (this.config.debugAdTiming) {
@@ -6348,18 +6492,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6348
6492
  preloadedFallback1 = this.getPreloadedAd();
6349
6493
  if (!preloadedFallback1) return [
6350
6494
  3,
6351
- 15
6495
+ 16
6352
6496
  ];
6353
6497
  if (this.config.debugAdTiming) {
6354
6498
  console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
6355
6499
  }
6356
- _state.label = 12;
6357
- case 12:
6500
+ _state.label = 13;
6501
+ case 13:
6358
6502
  _state.trys.push([
6359
- 12,
6360
- 14,
6503
+ 13,
6504
+ 15,
6361
6505
  ,
6362
- 15
6506
+ 16
6363
6507
  ]);
6364
6508
  this.clearAdRequestWatchdog();
6365
6509
  this.clearAdFailsafeTimer();
@@ -6376,7 +6520,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6376
6520
  4,
6377
6521
  this.ima.play()
6378
6522
  ];
6379
- case 13:
6523
+ case 14:
6380
6524
  _state.sent();
6381
6525
  currentMuted2 = this.video.muted;
6382
6526
  currentVolume2 = this.video.volume;
@@ -6385,16 +6529,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6385
6529
  return [
6386
6530
  2
6387
6531
  ];
6388
- case 14:
6532
+ case 15:
6389
6533
  fallbackError1 = _state.sent();
6390
6534
  if (this.config.debugAdTiming) {
6391
6535
  console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
6392
6536
  }
6393
6537
  return [
6394
6538
  3,
6395
- 15
6539
+ 16
6396
6540
  ];
6397
- case 15:
6541
+ case 16:
6398
6542
  if (this.isTemporaryAdError(error)) {
6399
6543
  this.temporaryFailureUrls.set(vastTagUrl, Date.now());
6400
6544
  if (this.config.debugAdTiming) {
@@ -6412,7 +6556,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6412
6556
  this.activeAdRequestToken = null;
6413
6557
  }
6414
6558
  throw error;
6415
- case 16:
6559
+ case 17:
6416
6560
  return [
6417
6561
  2
6418
6562
  ];
@@ -6448,6 +6592,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6448
6592
  this.currentAdIndex = 0;
6449
6593
  this.totalAdsInBreak = 0;
6450
6594
  this.consecutiveFailures = 0;
6595
+ this.globalConsecutiveNoFills = 0;
6451
6596
  this.ima.stop().catch(function() {});
6452
6597
  var restoredMuted = this.ima.getOriginalMutedState();
6453
6598
  var restoredVolume = this.ima.getOriginalVolume();
@@ -6479,6 +6624,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6479
6624
  key: "handleAdFailure",
6480
6625
  value: function handleAdFailure() {
6481
6626
  this.consecutiveFailures++;
6627
+ this.recordGamNoFill();
6482
6628
  var remaining = this.getRemainingAdMs();
6483
6629
  if (this.config.debugAdTiming) {
6484
6630
  console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
@@ -6506,8 +6652,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6506
6652
  key: "startAdRequestWatchdog",
6507
6653
  value: function startAdRequestWatchdog(token) {
6508
6654
  var _this = this;
6509
- this.clearAdRequestWatchdog();
6510
6655
  var _this_config_adFailsafeTimeoutMs;
6656
+ this.clearAdRequestWatchdog();
6511
6657
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6512
6658
  this.adRequestWatchdogToken = token;
6513
6659
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -6550,8 +6696,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6550
6696
  key: "startAdFailsafeTimer",
6551
6697
  value: function startAdFailsafeTimer(token) {
6552
6698
  var _this = this;
6553
- this.clearAdFailsafeTimer();
6554
6699
  var _this_config_adFailsafeTimeoutMs;
6700
+ this.clearAdFailsafeTimer();
6555
6701
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
6556
6702
  this.adFailsafeToken = token;
6557
6703
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -6931,21 +7077,21 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6931
7077
  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];
6932
7078
  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];
6933
7079
  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];
6934
- var getResponsiveScale = function() {
7080
+ var getResponsiveScale = function getResponsiveScale() {
6935
7081
  if (viewportWidth < 480) return 0.7;
6936
7082
  if (viewportWidth < 768) return 0.8;
6937
7083
  if (viewportWidth < 1024) return 0.9;
6938
7084
  return 1;
6939
7085
  };
6940
7086
  var responsiveScale = getResponsiveScale();
6941
- var formatTime = function(seconds) {
7087
+ var formatTime = function formatTime(seconds) {
6942
7088
  if (!isFinite(seconds)) return "0:00:00";
6943
7089
  var hours = Math.floor(seconds / 3600);
6944
7090
  var minutes = Math.floor(seconds % 3600 / 60);
6945
7091
  var remainingSeconds = Math.floor(seconds % 60);
6946
7092
  return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
6947
7093
  };
6948
- var handlePlayPause = function() {
7094
+ var handlePlayPause = function handlePlayPause() {
6949
7095
  if (videoRef.current) {
6950
7096
  if (videoRef.current.paused) {
6951
7097
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
@@ -6964,7 +7110,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6964
7110
  }
6965
7111
  }
6966
7112
  };
6967
- var handleCenterPlayClick = function() {
7113
+ var handleCenterPlayClick = function handleCenterPlayClick() {
6968
7114
  if (videoRef.current && videoRef.current.paused) {
6969
7115
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
6970
7116
  if (hasValidSource) {
@@ -6978,7 +7124,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6978
7124
  }
6979
7125
  }
6980
7126
  };
6981
- var handleTimelineSeek = function(e) {
7127
+ var handleTimelineSeek = function handleTimelineSeek(e) {
6982
7128
  if (videoRef.current && duration > 0 && isFinite(duration)) {
6983
7129
  var rect = e.currentTarget.getBoundingClientRect();
6984
7130
  var clickX = e.clientX - rect.left;
@@ -6989,13 +7135,13 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6989
7135
  }
6990
7136
  }
6991
7137
  };
6992
- var handleVolumeChange = function(newVolume) {
7138
+ var handleVolumeChange = function handleVolumeChange(newVolume) {
6993
7139
  if (playerRef.current && isFinite(newVolume)) {
6994
7140
  var clampedVolume = Math.max(0, Math.min(1, newVolume));
6995
7141
  playerRef.current.setVolume(clampedVolume);
6996
7142
  }
6997
7143
  };
6998
- var handlePlaybackRateChange = function(rate) {
7144
+ var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
6999
7145
  if (videoRef.current && isFinite(rate) && rate > 0) {
7000
7146
  videoRef.current.playbackRate = rate;
7001
7147
  }
@@ -7032,7 +7178,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7032
7178
  if (playerRef.current) {
7033
7179
  try {
7034
7180
  playerRef.current.destroy();
7035
- } catch (e) {}
7181
+ } catch (unused) {}
7036
7182
  playerRef.current = null;
7037
7183
  }
7038
7184
  var cfg = {
@@ -7072,7 +7218,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7072
7218
  return function() {
7073
7219
  try {
7074
7220
  player.destroy();
7075
- } catch (e) {}
7221
+ } catch (unused) {}
7076
7222
  playerRef.current = null;
7077
7223
  };
7078
7224
  }, [
@@ -7096,7 +7242,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7096
7242
  ]);
7097
7243
  (0, import_react.useEffect)(function() {
7098
7244
  if (!playerRef.current) return;
7099
- var checkAdStatus = function() {
7245
+ var checkAdStatus = function checkAdStatus() {
7100
7246
  if (playerRef.current) {
7101
7247
  var _videoRef_current_dataset, _videoRef_current;
7102
7248
  var showAdsFromMethod = playerRef.current.isShowingAds();
@@ -7126,7 +7272,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7126
7272
  }, []);
7127
7273
  (0, import_react.useEffect)(function() {
7128
7274
  if (typeof window === "undefined" || !playerRef.current) return;
7129
- var handleResize = function() {
7275
+ var handleResize = function handleResize() {
7130
7276
  if (playerRef.current && videoRef.current) {
7131
7277
  if (typeof playerRef.current.resize === "function") {
7132
7278
  playerRef.current.resize();
@@ -7142,7 +7288,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7142
7288
  }, []);
7143
7289
  (0, import_react.useEffect)(function() {
7144
7290
  if (!playerRef.current || !videoRef.current) return;
7145
- var updateStates = function() {
7291
+ var updateStates = function updateStates() {
7146
7292
  var _videoRef_current;
7147
7293
  if (playerRef.current && videoRef.current) {
7148
7294
  setIsMuted(playerRef.current.isMuted());
@@ -7159,7 +7305,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7159
7305
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7160
7306
  };
7161
7307
  var interval = setInterval(updateStates, 200);
7162
- var handleFullscreenChange = function() {
7308
+ var handleFullscreenChange = function handleFullscreenChange() {
7163
7309
  var _videoRef_current;
7164
7310
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
7165
7311
  };
@@ -7171,7 +7317,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7171
7317
  }, []);
7172
7318
  (0, import_react.useEffect)(function() {
7173
7319
  if (!videoRef.current) return;
7174
- var handleLoadedMetadata = function() {
7320
+ var handleLoadedMetadata = function handleLoadedMetadata() {
7175
7321
  if (videoRef.current) {
7176
7322
  var video2 = videoRef.current;
7177
7323
  void video2.offsetHeight;
@@ -7181,19 +7327,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7181
7327
  console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7182
7328
  }
7183
7329
  };
7184
- var handleLoadedData = function() {
7330
+ var handleLoadedData = function handleLoadedData() {
7185
7331
  if (debugAdTiming) {
7186
7332
  var _videoRef_current;
7187
7333
  console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7188
7334
  }
7189
7335
  };
7190
- var handleLoadStart = function() {
7336
+ var handleLoadStart = function handleLoadStart() {
7191
7337
  if (debugAdTiming) {
7192
7338
  var _videoRef_current;
7193
7339
  console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
7194
7340
  }
7195
7341
  };
7196
- var handleCanPlay = function() {
7342
+ var handleCanPlay = function handleCanPlay() {
7197
7343
  setIsLoading(false);
7198
7344
  if (bufferingTimeoutRef.current) {
7199
7345
  clearTimeout(bufferingTimeoutRef.current);
@@ -7205,7 +7351,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7205
7351
  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");
7206
7352
  }
7207
7353
  };
7208
- var handleCanPlayThrough = function() {
7354
+ var handleCanPlayThrough = function handleCanPlayThrough() {
7209
7355
  setIsLoading(false);
7210
7356
  if (bufferingTimeoutRef.current) {
7211
7357
  clearTimeout(bufferingTimeoutRef.current);
@@ -7217,7 +7363,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7217
7363
  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");
7218
7364
  }
7219
7365
  };
7220
- var handleWaiting = function() {
7366
+ var handleWaiting = function handleWaiting() {
7221
7367
  if (bufferingTimeoutRef.current) {
7222
7368
  clearTimeout(bufferingTimeoutRef.current);
7223
7369
  }
@@ -7233,7 +7379,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7233
7379
  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)");
7234
7380
  }
7235
7381
  };
7236
- var handlePlaying = function() {
7382
+ var handlePlaying = function handlePlaying() {
7237
7383
  setIsLoading(false);
7238
7384
  if (bufferingTimeoutRef.current) {
7239
7385
  clearTimeout(bufferingTimeoutRef.current);
@@ -7246,7 +7392,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7246
7392
  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");
7247
7393
  }
7248
7394
  };
7249
- var handlePause = function() {
7395
+ var handlePause = function handlePause() {
7250
7396
  var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
7251
7397
  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";
7252
7398
  if (playerRef.current && !isAdActive) {
@@ -7255,7 +7401,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7255
7401
  setShowCenterPlay(false);
7256
7402
  }
7257
7403
  };
7258
- var handleEnded = function() {
7404
+ var handleEnded = function handleEnded() {
7259
7405
  setShowCenterPlay(true);
7260
7406
  };
7261
7407
  var video = videoRef.current;
@@ -7413,14 +7559,14 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7413
7559
  boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
7414
7560
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
7415
7561
  },
7416
- onMouseEnter: function(e) {
7562
+ onMouseEnter: function onMouseEnter(e) {
7417
7563
  var target = e.currentTarget;
7418
7564
  target.style.transform = "translate(-50%, -50%)";
7419
7565
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
7420
7566
  target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
7421
7567
  target.style.borderColor = "rgba(255, 255, 255, 0.9)";
7422
7568
  },
7423
- onMouseLeave: function(e) {
7569
+ onMouseLeave: function onMouseLeave(e) {
7424
7570
  var target = e.currentTarget;
7425
7571
  target.style.transform = "translate(-50%, -50%)";
7426
7572
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
@@ -7527,12 +7673,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7527
7673
  minWidth: "".concat(48 * responsiveScale, "px"),
7528
7674
  minHeight: "".concat(48 * responsiveScale, "px")
7529
7675
  },
7530
- onMouseEnter: function(e) {
7676
+ onMouseEnter: function onMouseEnter(e) {
7531
7677
  var target = e.target;
7532
7678
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7533
7679
  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)";
7534
7680
  },
7535
- onMouseLeave: function(e) {
7681
+ onMouseLeave: function onMouseLeave(e) {
7536
7682
  var target = e.target;
7537
7683
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
7538
7684
  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)";
@@ -7558,15 +7704,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7558
7704
  padding: "8px",
7559
7705
  margin: "-8px"
7560
7706
  },
7561
- onMouseEnter: function() {
7707
+ onMouseEnter: function onMouseEnter() {
7562
7708
  return setShowVolumeSlider(true);
7563
7709
  },
7564
- onMouseLeave: function() {
7710
+ onMouseLeave: function onMouseLeave() {
7565
7711
  return setShowVolumeSlider(false);
7566
7712
  },
7567
7713
  children: [
7568
7714
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7569
- onClick: function() {
7715
+ onClick: function onClick() {
7570
7716
  if (playerRef.current) {
7571
7717
  playerRef.current.toggleMute();
7572
7718
  }
@@ -7590,12 +7736,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7590
7736
  minWidth: "".concat(44 * responsiveScale, "px"),
7591
7737
  minHeight: "".concat(44 * responsiveScale, "px")
7592
7738
  },
7593
- onMouseEnter: function(e) {
7739
+ onMouseEnter: function onMouseEnter(e) {
7594
7740
  var target = e.target;
7595
7741
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7596
7742
  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)";
7597
7743
  },
7598
- onMouseLeave: function(e) {
7744
+ onMouseLeave: function onMouseLeave(e) {
7599
7745
  var target = e.target;
7600
7746
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7601
7747
  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)";
@@ -7631,10 +7777,10 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7631
7777
  marginBottom: "-16px",
7632
7778
  zIndex: 9
7633
7779
  },
7634
- onMouseEnter: function() {
7780
+ onMouseEnter: function onMouseEnter() {
7635
7781
  return setShowVolumeSlider(true);
7636
7782
  },
7637
- onMouseLeave: function() {
7783
+ onMouseLeave: function onMouseLeave() {
7638
7784
  return setShowVolumeSlider(false);
7639
7785
  }
7640
7786
  }),
@@ -7659,12 +7805,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7659
7805
  zIndex: 10,
7660
7806
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
7661
7807
  },
7662
- onMouseEnter: function(e) {
7808
+ onMouseEnter: function onMouseEnter(e) {
7663
7809
  setShowVolumeSlider(true);
7664
7810
  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)";
7665
7811
  e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
7666
7812
  },
7667
- onMouseLeave: function(e) {
7813
+ onMouseLeave: function onMouseLeave(e) {
7668
7814
  setShowVolumeSlider(false);
7669
7815
  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)";
7670
7816
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
@@ -7677,19 +7823,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7677
7823
  cursor: "pointer",
7678
7824
  transition: "transform 0.2s ease-in-out"
7679
7825
  },
7680
- onMouseEnter: function(e) {},
7681
- onMouseLeave: function(e) {},
7682
- onMouseDown: function(e) {
7826
+ onMouseEnter: function onMouseEnter(e) {},
7827
+ onMouseLeave: function onMouseLeave(e) {},
7828
+ onMouseDown: function onMouseDown(e) {
7683
7829
  e.preventDefault();
7684
7830
  var sliderElement = e.currentTarget;
7685
- var handleMouseMove = function(moveEvent) {
7831
+ var handleMouseMove = function handleMouseMove(moveEvent) {
7686
7832
  if (!sliderElement) return;
7687
7833
  var rect2 = sliderElement.getBoundingClientRect();
7688
7834
  var y2 = moveEvent.clientY - rect2.top;
7689
7835
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
7690
7836
  handleVolumeChange(percentage2);
7691
7837
  };
7692
- var handleMouseUp = function() {
7838
+ var handleMouseUp = function handleMouseUp1() {
7693
7839
  document.removeEventListener("mousemove", handleMouseMove);
7694
7840
  document.removeEventListener("mouseup", handleMouseUp);
7695
7841
  };
@@ -7700,7 +7846,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7700
7846
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
7701
7847
  handleVolumeChange(percentage);
7702
7848
  },
7703
- onClick: function(e) {
7849
+ onClick: function onClick(e) {
7704
7850
  e.stopPropagation();
7705
7851
  var rect = e.currentTarget.getBoundingClientRect();
7706
7852
  var y = e.clientY - rect.top;
@@ -7747,17 +7893,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7747
7893
  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",
7748
7894
  cursor: "grab"
7749
7895
  },
7750
- onMouseEnter: function(e) {
7896
+ onMouseEnter: function onMouseEnter(e) {
7751
7897
  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)";
7752
7898
  e.currentTarget.style.cursor = "grab";
7753
7899
  },
7754
- onMouseLeave: function(e) {
7900
+ onMouseLeave: function onMouseLeave(e) {
7755
7901
  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)";
7756
7902
  },
7757
- onMouseDown: function(e) {
7903
+ onMouseDown: function onMouseDown(e) {
7758
7904
  e.currentTarget.style.cursor = "grabbing";
7759
7905
  },
7760
- onMouseUp: function(e) {
7906
+ onMouseUp: function onMouseUp(e) {
7761
7907
  e.currentTarget.style.cursor = "grab";
7762
7908
  }
7763
7909
  })
@@ -7797,7 +7943,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7797
7943
  },
7798
7944
  children: [
7799
7945
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7800
- onClick: function() {
7946
+ onClick: function onClick() {
7801
7947
  return setShowSpeedMenu(!showSpeedMenu);
7802
7948
  },
7803
7949
  style: {
@@ -7816,12 +7962,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7816
7962
  minWidth: "".concat(56 * responsiveScale, "px"),
7817
7963
  minHeight: "".concat(40 * responsiveScale, "px")
7818
7964
  },
7819
- onMouseEnter: function(e) {
7965
+ onMouseEnter: function onMouseEnter(e) {
7820
7966
  var target = e.target;
7821
7967
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7822
7968
  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)";
7823
7969
  },
7824
- onMouseLeave: function(e) {
7970
+ onMouseLeave: function onMouseLeave(e) {
7825
7971
  var target = e.target;
7826
7972
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7827
7973
  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)";
@@ -7857,7 +8003,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7857
8003
  2
7858
8004
  ].map(function(speed) {
7859
8005
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
7860
- onClick: function() {
8006
+ onClick: function onClick() {
7861
8007
  return handlePlaybackRateChange(speed);
7862
8008
  },
7863
8009
  style: {
@@ -7875,12 +8021,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7875
8021
  transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
7876
8022
  borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
7877
8023
  },
7878
- onMouseEnter: function(e) {
8024
+ onMouseEnter: function onMouseEnter(e) {
7879
8025
  if (playbackRate !== speed) {
7880
8026
  e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
7881
8027
  }
7882
8028
  },
7883
- onMouseLeave: function(e) {
8029
+ onMouseLeave: function onMouseLeave(e) {
7884
8030
  if (playbackRate !== speed) {
7885
8031
  e.target.style.background = "transparent";
7886
8032
  }
@@ -7895,7 +8041,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7895
8041
  ]
7896
8042
  }),
7897
8043
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7898
- onClick: function() {
8044
+ onClick: function onClick() {
7899
8045
  if (onFullscreenToggle) {
7900
8046
  onFullscreenToggle();
7901
8047
  } else if (playerRef.current) {
@@ -7920,12 +8066,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7920
8066
  minWidth: "".concat(44 * responsiveScale, "px"),
7921
8067
  minHeight: "".concat(44 * responsiveScale, "px")
7922
8068
  },
7923
- onMouseEnter: function(e) {
8069
+ onMouseEnter: function onMouseEnter(e) {
7924
8070
  var target = e.target;
7925
8071
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
7926
8072
  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)";
7927
8073
  },
7928
- onMouseLeave: function(e) {
8074
+ onMouseLeave: function onMouseLeave(e) {
7929
8075
  var target = e.target;
7930
8076
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
7931
8077
  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)";
@@ -7969,15 +8115,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7969
8115
  padding: "8px",
7970
8116
  margin: "-8px"
7971
8117
  },
7972
- onMouseEnter: function() {
8118
+ onMouseEnter: function onMouseEnter() {
7973
8119
  return setShowVolumeSlider(true);
7974
8120
  },
7975
- onMouseLeave: function() {
8121
+ onMouseLeave: function onMouseLeave() {
7976
8122
  return setShowVolumeSlider(false);
7977
8123
  },
7978
8124
  children: [
7979
8125
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7980
- onClick: function() {
8126
+ onClick: function onClick() {
7981
8127
  if (playerRef.current) {
7982
8128
  playerRef.current.toggleMute();
7983
8129
  }
@@ -7985,12 +8131,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
7985
8131
  onVolumeToggle();
7986
8132
  }
7987
8133
  },
7988
- onMouseEnter: function(e) {
8134
+ onMouseEnter: function onMouseEnter(e) {
7989
8135
  var target = e.currentTarget;
7990
8136
  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)";
7991
8137
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
7992
8138
  },
7993
- onMouseLeave: function(e) {
8139
+ onMouseLeave: function onMouseLeave(e) {
7994
8140
  var target = e.currentTarget;
7995
8141
  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)";
7996
8142
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
@@ -8045,10 +8191,10 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8045
8191
  marginBottom: "-16px",
8046
8192
  zIndex: 9
8047
8193
  },
8048
- onMouseEnter: function() {
8194
+ onMouseEnter: function onMouseEnter() {
8049
8195
  return setShowVolumeSlider(true);
8050
8196
  },
8051
- onMouseLeave: function() {
8197
+ onMouseLeave: function onMouseLeave() {
8052
8198
  return setShowVolumeSlider(false);
8053
8199
  }
8054
8200
  }),
@@ -8073,12 +8219,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8073
8219
  zIndex: 10,
8074
8220
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
8075
8221
  },
8076
- onMouseEnter: function(e) {
8222
+ onMouseEnter: function onMouseEnter(e) {
8077
8223
  setShowVolumeSlider(true);
8078
8224
  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)";
8079
8225
  e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
8080
8226
  },
8081
- onMouseLeave: function(e) {
8227
+ onMouseLeave: function onMouseLeave(e) {
8082
8228
  setShowVolumeSlider(false);
8083
8229
  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)";
8084
8230
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
@@ -8091,17 +8237,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8091
8237
  cursor: "pointer",
8092
8238
  transition: "transform 0.2s ease-in-out"
8093
8239
  },
8094
- onMouseDown: function(e) {
8240
+ onMouseDown: function onMouseDown(e) {
8095
8241
  e.preventDefault();
8096
8242
  var sliderElement = e.currentTarget;
8097
- var handleMouseMove = function(moveEvent) {
8243
+ var handleMouseMove = function handleMouseMove(moveEvent) {
8098
8244
  if (!sliderElement) return;
8099
8245
  var rect2 = sliderElement.getBoundingClientRect();
8100
8246
  var y2 = moveEvent.clientY - rect2.top;
8101
8247
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
8102
8248
  handleVolumeChange(percentage2);
8103
8249
  };
8104
- var handleMouseUp = function() {
8250
+ var handleMouseUp = function handleMouseUp1() {
8105
8251
  document.removeEventListener("mousemove", handleMouseMove);
8106
8252
  document.removeEventListener("mouseup", handleMouseUp);
8107
8253
  };
@@ -8112,7 +8258,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8112
8258
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
8113
8259
  handleVolumeChange(percentage);
8114
8260
  },
8115
- onClick: function(e) {
8261
+ onClick: function onClick(e) {
8116
8262
  e.stopPropagation();
8117
8263
  var rect = e.currentTarget.getBoundingClientRect();
8118
8264
  var y = e.clientY - rect.top;
@@ -8161,17 +8307,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8161
8307
  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",
8162
8308
  cursor: "grab"
8163
8309
  },
8164
- onMouseEnter: function(e) {
8310
+ onMouseEnter: function onMouseEnter(e) {
8165
8311
  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)";
8166
8312
  e.currentTarget.style.cursor = "grab";
8167
8313
  },
8168
- onMouseLeave: function(e) {
8314
+ onMouseLeave: function onMouseLeave(e) {
8169
8315
  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)";
8170
8316
  },
8171
- onMouseDown: function(e) {
8317
+ onMouseDown: function onMouseDown(e) {
8172
8318
  e.currentTarget.style.cursor = "grabbing";
8173
8319
  },
8174
- onMouseUp: function(e) {
8320
+ onMouseUp: function onMouseUp(e) {
8175
8321
  e.currentTarget.style.cursor = "grab";
8176
8322
  }
8177
8323
  })
@@ -8183,7 +8329,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8183
8329
  ]
8184
8330
  }),
8185
8331
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
8186
- onClick: function() {
8332
+ onClick: function onClick() {
8187
8333
  if (onFullscreenToggle) {
8188
8334
  onFullscreenToggle();
8189
8335
  } else if (playerRef.current) {
@@ -8192,12 +8338,12 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8192
8338
  });
8193
8339
  }
8194
8340
  },
8195
- onMouseEnter: function(e) {
8341
+ onMouseEnter: function onMouseEnter(e) {
8196
8342
  var target = e.currentTarget;
8197
8343
  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)";
8198
8344
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8199
8345
  },
8200
- onMouseLeave: function(e) {
8346
+ onMouseLeave: function onMouseLeave(e) {
8201
8347
  var target = e.currentTarget;
8202
8348
  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)";
8203
8349
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
@@ -8343,7 +8489,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
8343
8489
  // src/StormcloudPlayer.tsx
8344
8490
  var import_react6 = __toESM(require("react"), 1);
8345
8491
  // src/props.ts
8346
- var noop = function() {};
8492
+ var noop = function noop() {};
8347
8493
  var defaultProps = {
8348
8494
  playing: false,
8349
8495
  loop: false,
@@ -8389,29 +8535,29 @@ var defaultProps = {
8389
8535
  // src/utils.ts
8390
8536
  var import_react2 = require("react");
8391
8537
  var lazy = import_react2.lazy;
8392
- var omit = function(object, keys) {
8538
+ var omit = function omit(object, keys) {
8393
8539
  var result = _object_spread({}, object);
8394
8540
  keys.forEach(function(key) {
8395
8541
  delete result[key];
8396
8542
  });
8397
8543
  return result;
8398
8544
  };
8399
- var isMediaStream = function(url) {
8545
+ var isMediaStream = function isMediaStream(url) {
8400
8546
  return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
8401
8547
  };
8402
- var supportsWebKitPresentationMode = function() {
8548
+ var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
8403
8549
  if (typeof window === "undefined") return false;
8404
8550
  var video = document.createElement("video");
8405
8551
  return "webkitSupportsPresentationMode" in video;
8406
8552
  };
8407
- var randomString = function() {
8553
+ var randomString = function randomString() {
8408
8554
  return Math.random().toString(36).substr(2, 9);
8409
8555
  };
8410
- var parseQuery = function(url) {
8556
+ var parseQuery = function parseQuery(url) {
8411
8557
  var query = {};
8412
8558
  var queryString = url.split("?")[1] || "";
8413
8559
  if (!queryString) return query;
8414
- var manualParse = function(qs) {
8560
+ var manualParse = function manualParse(qs) {
8415
8561
  qs.split("&").forEach(function(param) {
8416
8562
  var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
8417
8563
  if (key) {
@@ -8438,7 +8584,7 @@ var parseQuery = function(url) {
8438
8584
  }
8439
8585
  return query;
8440
8586
  };
8441
- var merge = function(target) {
8587
+ var merge = function merge1(target) {
8442
8588
  for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
8443
8589
  sources[_key - 1] = arguments[_key];
8444
8590
  }
@@ -8458,19 +8604,19 @@ var merge = function(target) {
8458
8604
  target
8459
8605
  ].concat(_to_consumable_array(sources)));
8460
8606
  };
8461
- var isObject = function(item) {
8607
+ var isObject = function isObject(item) {
8462
8608
  return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
8463
8609
  };
8464
8610
  var IS_BROWSER = typeof window !== "undefined" && window.document;
8465
8611
  var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
8466
8612
  var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
8467
8613
  var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8468
- var SUPPORTS_HLS = function() {
8614
+ var SUPPORTS_HLS = function SUPPORTS_HLS() {
8469
8615
  if (!IS_BROWSER) return false;
8470
8616
  var video = document.createElement("video");
8471
8617
  return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
8472
8618
  };
8473
- var SUPPORTS_DASH = function() {
8619
+ var SUPPORTS_DASH = function SUPPORTS_DASH() {
8474
8620
  if (!IS_BROWSER) return false;
8475
8621
  var video = document.createElement("video");
8476
8622
  return Boolean(video.canPlayType("application/dash+xml"));
@@ -8482,23 +8628,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
8482
8628
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
8483
8629
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
8484
8630
  var canPlay = {
8485
- hls: function(url) {
8631
+ hls: function hls(url) {
8486
8632
  if (!url || typeof url !== "string") return false;
8487
8633
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
8488
8634
  },
8489
- dash: function(url) {
8635
+ dash: function dash(url) {
8490
8636
  if (!url || typeof url !== "string") return false;
8491
8637
  return DASH_EXTENSIONS.test(url);
8492
8638
  },
8493
- video: function(url) {
8639
+ video: function video(url) {
8494
8640
  if (!url || typeof url !== "string") return false;
8495
8641
  return VIDEO_EXTENSIONS.test(url);
8496
8642
  },
8497
- audio: function(url) {
8643
+ audio: function audio(url) {
8498
8644
  if (!url || typeof url !== "string") return false;
8499
8645
  return AUDIO_EXTENSIONS.test(url);
8500
8646
  },
8501
- file: function(url) {
8647
+ file: function file(url) {
8502
8648
  if (!url || typeof url !== "string") return false;
8503
8649
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
8504
8650
  }
@@ -8510,11 +8656,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
8510
8656
  function HlsPlayer() {
8511
8657
  _class_call_check(this, HlsPlayer);
8512
8658
  var _this;
8513
- var _this1, _arguments = arguments;
8514
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
8515
- _this1.player = null;
8516
- _this1.mounted = false;
8517
- _this1.load = function() {
8659
+ var _this1;
8660
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
8661
+ _this.player = null;
8662
+ _this.mounted = false;
8663
+ _this.load = function() {
8518
8664
  return _async_to_generator(function() {
8519
8665
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
8520
8666
  return _ts_generator(this, function(_state) {
@@ -8587,87 +8733,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
8587
8733
  });
8588
8734
  })();
8589
8735
  };
8590
- _this1.play = function() {
8591
- if (_this1.props.videoElement) {
8592
- var video = _this1.props.videoElement;
8736
+ _this.play = function() {
8737
+ if (_this.props.videoElement) {
8738
+ var video = _this.props.videoElement;
8593
8739
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8594
8740
  if (hasValidSource) {
8595
8741
  var _video_play, _this_props_onPlay, _this_props;
8596
8742
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8597
8743
  var _this_props_onError, _this_props;
8598
8744
  console.error("[HlsPlayer] Failed to play:", error);
8599
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8745
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8600
8746
  });
8601
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8747
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8602
8748
  } else {
8603
8749
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
8604
8750
  }
8605
8751
  }
8606
8752
  };
8607
- _this1.pause = function() {
8608
- if (_this1.props.videoElement) {
8753
+ _this.pause = function() {
8754
+ if (_this.props.videoElement) {
8609
8755
  var _this_props_onPause, _this_props;
8610
- _this1.props.videoElement.pause();
8611
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8756
+ _this.props.videoElement.pause();
8757
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8612
8758
  }
8613
8759
  };
8614
- _this1.stop = function() {
8615
- _this1.pause();
8616
- if (_this1.props.videoElement) {
8617
- _this1.props.videoElement.currentTime = 0;
8760
+ _this.stop = function() {
8761
+ _this.pause();
8762
+ if (_this.props.videoElement) {
8763
+ _this.props.videoElement.currentTime = 0;
8618
8764
  }
8619
8765
  };
8620
- _this1.seekTo = function(seconds, keepPlaying) {
8621
- if (_this1.props.videoElement) {
8622
- _this1.props.videoElement.currentTime = seconds;
8766
+ _this.seekTo = function(seconds, keepPlaying) {
8767
+ if (_this.props.videoElement) {
8768
+ _this.props.videoElement.currentTime = seconds;
8623
8769
  if (!keepPlaying) {
8624
- _this1.pause();
8770
+ _this.pause();
8625
8771
  }
8626
8772
  }
8627
8773
  };
8628
- _this1.setVolume = function(volume) {
8629
- if (_this1.props.videoElement) {
8630
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8774
+ _this.setVolume = function(volume) {
8775
+ if (_this.props.videoElement) {
8776
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8631
8777
  }
8632
8778
  };
8633
- _this1.mute = function() {
8634
- if (_this1.props.videoElement) {
8635
- _this1.props.videoElement.muted = true;
8779
+ _this.mute = function() {
8780
+ if (_this.props.videoElement) {
8781
+ _this.props.videoElement.muted = true;
8636
8782
  }
8637
8783
  };
8638
- _this1.unmute = function() {
8639
- if (_this1.props.videoElement) {
8640
- _this1.props.videoElement.muted = false;
8784
+ _this.unmute = function() {
8785
+ if (_this.props.videoElement) {
8786
+ _this.props.videoElement.muted = false;
8641
8787
  }
8642
8788
  };
8643
- _this1.setPlaybackRate = function(rate) {
8644
- if (_this1.props.videoElement && rate > 0) {
8645
- _this1.props.videoElement.playbackRate = rate;
8789
+ _this.setPlaybackRate = function(rate) {
8790
+ if (_this.props.videoElement && rate > 0) {
8791
+ _this.props.videoElement.playbackRate = rate;
8646
8792
  }
8647
8793
  };
8648
- _this1.getDuration = function() {
8649
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8650
- return _this1.props.videoElement.duration;
8794
+ _this.getDuration = function() {
8795
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8796
+ return _this.props.videoElement.duration;
8651
8797
  }
8652
8798
  return null;
8653
8799
  };
8654
- _this1.getCurrentTime = function() {
8655
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8656
- return _this1.props.videoElement.currentTime;
8800
+ _this.getCurrentTime = function() {
8801
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8802
+ return _this.props.videoElement.currentTime;
8657
8803
  }
8658
8804
  return null;
8659
8805
  };
8660
- _this1.getSecondsLoaded = function() {
8661
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8662
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8806
+ _this.getSecondsLoaded = function() {
8807
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8808
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8663
8809
  }
8664
8810
  return null;
8665
8811
  };
8666
- _this1.getInternalPlayer = function() {
8812
+ _this.getInternalPlayer = function() {
8667
8813
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8668
- if (key === "player") return _this1.player;
8669
- if (key === "video") return _this1.props.videoElement;
8670
- if (key === "hls" && _this1.player) return _this1.player.hls;
8814
+ if (key === "player") return _this.player;
8815
+ if (key === "video") return _this.props.videoElement;
8816
+ if (key === "hls" && _this.player) return _this.player.hls;
8671
8817
  return null;
8672
8818
  };
8673
8819
  return _this;
@@ -8716,49 +8862,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8716
8862
  function FilePlayer() {
8717
8863
  _class_call_check(this, FilePlayer);
8718
8864
  var _this;
8719
- var _this1, _arguments = arguments;
8720
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
8721
- _this1.mounted = false;
8722
- _this1.ready = false;
8723
- _this1.load = function() {
8865
+ var _this1;
8866
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
8867
+ _this.mounted = false;
8868
+ _this.ready = false;
8869
+ _this.load = function() {
8724
8870
  var _this_props_onMount, _this_props;
8725
- if (!_this1.props.videoElement || !_this1.props.src) return;
8726
- var video = _this1.props.videoElement;
8727
- var handleLoadedMetadata = function() {
8728
- if (_this1.mounted && !_this1.ready) {
8871
+ if (!_this.props.videoElement || !_this.props.src) return;
8872
+ var video = _this.props.videoElement;
8873
+ var handleLoadedMetadata = function handleLoadedMetadata() {
8874
+ if (_this.mounted && !_this.ready) {
8729
8875
  var _this_props_onReady, _this_props;
8730
- _this1.ready = true;
8731
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8876
+ _this.ready = true;
8877
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8732
8878
  }
8733
8879
  };
8734
- var handlePlay = function() {
8735
- if (_this1.mounted) {
8880
+ var handlePlay = function handlePlay() {
8881
+ if (_this.mounted) {
8736
8882
  var _this_props_onPlay, _this_props;
8737
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8883
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8738
8884
  }
8739
8885
  };
8740
- var handlePause = function() {
8741
- if (_this1.mounted) {
8886
+ var handlePause = function handlePause() {
8887
+ if (_this.mounted) {
8742
8888
  var _this_props_onPause, _this_props;
8743
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8889
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8744
8890
  }
8745
8891
  };
8746
- var handleEnded = function() {
8747
- if (_this1.mounted) {
8892
+ var handleEnded = function handleEnded() {
8893
+ if (_this.mounted) {
8748
8894
  var _this_props_onEnded, _this_props;
8749
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8895
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8750
8896
  }
8751
8897
  };
8752
- var handleError = function(error) {
8753
- if (_this1.mounted) {
8898
+ var handleError = function handleError(error) {
8899
+ if (_this.mounted) {
8754
8900
  var _this_props_onError, _this_props;
8755
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8901
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8756
8902
  }
8757
8903
  };
8758
- var handleLoadedData = function() {
8759
- if (_this1.mounted) {
8904
+ var handleLoadedData = function handleLoadedData() {
8905
+ if (_this.mounted) {
8760
8906
  var _this_props_onLoaded, _this_props;
8761
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8907
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8762
8908
  }
8763
8909
  };
8764
8910
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -8767,15 +8913,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8767
8913
  video.addEventListener("ended", handleEnded);
8768
8914
  video.addEventListener("error", handleError);
8769
8915
  video.addEventListener("loadeddata", handleLoadedData);
8770
- video.src = _this1.props.src;
8771
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
8772
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
8773
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
8774
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
8775
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
8776
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
8777
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
8778
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
8916
+ video.src = _this.props.src;
8917
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
8918
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
8919
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
8920
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
8921
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
8922
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
8923
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
8924
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
8779
8925
  return function() {
8780
8926
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
8781
8927
  video.removeEventListener("play", handlePlay);
@@ -8785,90 +8931,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8785
8931
  video.removeEventListener("loadeddata", handleLoadedData);
8786
8932
  };
8787
8933
  };
8788
- _this1.play = function() {
8789
- if (_this1.props.videoElement) {
8790
- var video = _this1.props.videoElement;
8934
+ _this.play = function() {
8935
+ if (_this.props.videoElement) {
8936
+ var video = _this.props.videoElement;
8791
8937
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8792
8938
  if (hasValidSource) {
8793
8939
  var _video_play;
8794
8940
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8795
8941
  var _this_props_onError, _this_props;
8796
8942
  console.error("[FilePlayer] Failed to play:", error);
8797
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8943
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8798
8944
  });
8799
8945
  } else {
8800
8946
  console.warn("[FilePlayer] Cannot play: video has no valid source");
8801
8947
  }
8802
8948
  }
8803
8949
  };
8804
- _this1.pause = function() {
8805
- if (_this1.props.videoElement) {
8806
- _this1.props.videoElement.pause();
8950
+ _this.pause = function() {
8951
+ if (_this.props.videoElement) {
8952
+ _this.props.videoElement.pause();
8807
8953
  }
8808
8954
  };
8809
- _this1.stop = function() {
8810
- _this1.pause();
8811
- if (_this1.props.videoElement) {
8812
- _this1.props.videoElement.currentTime = 0;
8955
+ _this.stop = function() {
8956
+ _this.pause();
8957
+ if (_this.props.videoElement) {
8958
+ _this.props.videoElement.currentTime = 0;
8813
8959
  }
8814
8960
  };
8815
- _this1.seekTo = function(seconds, keepPlaying) {
8816
- if (_this1.props.videoElement) {
8817
- _this1.props.videoElement.currentTime = seconds;
8961
+ _this.seekTo = function(seconds, keepPlaying) {
8962
+ if (_this.props.videoElement) {
8963
+ _this.props.videoElement.currentTime = seconds;
8818
8964
  if (!keepPlaying) {
8819
- _this1.pause();
8965
+ _this.pause();
8820
8966
  }
8821
8967
  }
8822
8968
  };
8823
- _this1.setVolume = function(volume) {
8824
- if (_this1.props.videoElement) {
8825
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8969
+ _this.setVolume = function(volume) {
8970
+ if (_this.props.videoElement) {
8971
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8826
8972
  }
8827
8973
  };
8828
- _this1.mute = function() {
8829
- if (_this1.props.videoElement) {
8830
- _this1.props.videoElement.muted = true;
8974
+ _this.mute = function() {
8975
+ if (_this.props.videoElement) {
8976
+ _this.props.videoElement.muted = true;
8831
8977
  }
8832
8978
  };
8833
- _this1.unmute = function() {
8834
- if (_this1.props.videoElement) {
8835
- _this1.props.videoElement.muted = false;
8979
+ _this.unmute = function() {
8980
+ if (_this.props.videoElement) {
8981
+ _this.props.videoElement.muted = false;
8836
8982
  }
8837
8983
  };
8838
- _this1.setPlaybackRate = function(rate) {
8839
- if (_this1.props.videoElement && rate > 0) {
8840
- _this1.props.videoElement.playbackRate = rate;
8984
+ _this.setPlaybackRate = function(rate) {
8985
+ if (_this.props.videoElement && rate > 0) {
8986
+ _this.props.videoElement.playbackRate = rate;
8841
8987
  }
8842
8988
  };
8843
- _this1.setLoop = function(loop) {
8844
- if (_this1.props.videoElement) {
8845
- _this1.props.videoElement.loop = loop;
8989
+ _this.setLoop = function(loop) {
8990
+ if (_this.props.videoElement) {
8991
+ _this.props.videoElement.loop = loop;
8846
8992
  }
8847
8993
  };
8848
- _this1.getDuration = function() {
8849
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8850
- return _this1.props.videoElement.duration;
8994
+ _this.getDuration = function() {
8995
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8996
+ return _this.props.videoElement.duration;
8851
8997
  }
8852
8998
  return null;
8853
8999
  };
8854
- _this1.getCurrentTime = function() {
8855
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8856
- return _this1.props.videoElement.currentTime;
9000
+ _this.getCurrentTime = function() {
9001
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
9002
+ return _this.props.videoElement.currentTime;
8857
9003
  }
8858
9004
  return null;
8859
9005
  };
8860
- _this1.getSecondsLoaded = function() {
8861
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8862
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
9006
+ _this.getSecondsLoaded = function() {
9007
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
9008
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8863
9009
  }
8864
9010
  return null;
8865
9011
  };
8866
- _this1.getInternalPlayer = function() {
9012
+ _this.getInternalPlayer = function() {
8867
9013
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8868
- if (key === "video") return _this1.props.videoElement;
9014
+ if (key === "video") return _this.props.videoElement;
8869
9015
  return null;
8870
9016
  };
8871
- _this1.enablePIP = function() {
9017
+ _this.enablePIP = function() {
8872
9018
  return _async_to_generator(function() {
8873
9019
  var error;
8874
9020
  return _ts_generator(this, function(_state) {
@@ -8911,7 +9057,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react4_Component) {
8911
9057
  });
8912
9058
  })();
8913
9059
  };
8914
- _this1.disablePIP = function() {
9060
+ _this.disablePIP = function() {
8915
9061
  return _async_to_generator(function() {
8916
9062
  var error;
8917
9063
  return _ts_generator(this, function(_state) {
@@ -9005,7 +9151,7 @@ var players = [
9005
9151
  key: "file",
9006
9152
  name: "File Player",
9007
9153
  canPlay: canPlay.file,
9008
- canEnablePIP: function(url) {
9154
+ canEnablePIP: function canEnablePIP(url) {
9009
9155
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
9010
9156
  },
9011
9157
  lazyPlayer: lazy(function() {
@@ -9331,7 +9477,7 @@ var SUPPORTED_PROPS = [
9331
9477
  "onControlClick"
9332
9478
  ];
9333
9479
  var customPlayers = [];
9334
- var createStormcloudPlayer = function(playerList, fallback) {
9480
+ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
9335
9481
  var _a;
9336
9482
  return _a = /*#__PURE__*/ function(_import_react6_Component) {
9337
9483
  _inherits(_a, _import_react6_Component);
@@ -9343,10 +9489,10 @@ var createStormcloudPlayer = function(playerList, fallback) {
9343
9489
  showPreview: false
9344
9490
  };
9345
9491
  _this.references = {
9346
- wrapper: function(wrapper) {
9492
+ wrapper: function wrapper(wrapper) {
9347
9493
  _this.wrapper = wrapper;
9348
9494
  },
9349
- player: function(player) {
9495
+ player: function player(player) {
9350
9496
  _this.player = player;
9351
9497
  }
9352
9498
  };