stormcloud-video-player 0.8.79 → 0.8.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +4 -1
  5. package/lib/StormcloudPlayer.cjs +1459 -167
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +3 -0
  8. package/lib/index.cjs +1547 -169
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +3 -0
  11. package/lib/index.d.ts +89 -3
  12. package/lib/index.js +1547 -169
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +452 -88
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdBreakOrchestrator.d.cts +1 -0
  17. package/lib/player/AdConfigManager.cjs +1024 -97
  18. package/lib/player/AdConfigManager.cjs.map +1 -1
  19. package/lib/player/AdConfigManager.d.cts +2 -0
  20. package/lib/player/AdTimingService.cjs +0 -9
  21. package/lib/player/AdTimingService.cjs.map +1 -1
  22. package/lib/player/AdTimingService.d.cts +1 -0
  23. package/lib/player/EdgePodRequest.d.cts +1 -0
  24. package/lib/player/FloorLadder.cjs +3 -0
  25. package/lib/player/FloorLadder.cjs.map +1 -1
  26. package/lib/player/FloorLadder.d.cts +1 -0
  27. package/lib/player/HlsEngine.cjs +7 -1
  28. package/lib/player/HlsEngine.cjs.map +1 -1
  29. package/lib/player/HlsEngine.d.cts +2 -0
  30. package/lib/player/OptimizedPodRequest.cjs +21 -6
  31. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  32. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  33. package/lib/player/PlayerControls.d.cts +1 -0
  34. package/lib/player/Scte35CueManager.d.cts +1 -0
  35. package/lib/player/Scte35Parser.d.cts +1 -0
  36. package/lib/player/StormcloudVideoPlayer.cjs +1459 -167
  37. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  38. package/lib/player/StormcloudVideoPlayer.d.cts +19 -1
  39. package/lib/player/playerTypes.d.cts +1 -0
  40. package/lib/players/HlsPlayer.cjs +1459 -167
  41. package/lib/players/HlsPlayer.cjs.map +1 -1
  42. package/lib/players/HlsPlayer.d.cts +1 -0
  43. package/lib/players/index.cjs +1459 -167
  44. package/lib/players/index.cjs.map +1 -1
  45. package/lib/props.cjs +6 -0
  46. package/lib/props.cjs.map +1 -1
  47. package/lib/props.d.cts +3 -0
  48. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  49. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  50. package/lib/sdk/hlsAdPlayer.d.cts +1 -0
  51. package/lib/sdk/pal.cjs +10 -3
  52. package/lib/sdk/pal.cjs.map +1 -1
  53. package/lib/sdk/pal.d.cts +3 -0
  54. package/lib/types.d.cts +29 -1
  55. package/lib/ui/StormcloudVideoPlayer.cjs +1547 -169
  56. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  57. package/lib/ui/StormcloudVideoPlayer.d.cts +3 -0
  58. package/lib/utils/__tests__/adSignals.test.cjs +25817 -0
  59. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  60. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  61. package/lib/utils/adIdentity.cjs +421 -0
  62. package/lib/utils/adIdentity.cjs.map +1 -0
  63. package/lib/utils/adIdentity.d.cts +30 -0
  64. package/lib/utils/browserCompat.cjs +13 -0
  65. package/lib/utils/browserCompat.cjs.map +1 -1
  66. package/lib/utils/browserCompat.d.cts +2 -1
  67. package/lib/utils/contentMetadata.cjs +324 -0
  68. package/lib/utils/contentMetadata.cjs.map +1 -0
  69. package/lib/utils/contentMetadata.d.cts +51 -0
  70. package/lib/utils/ctvVastSignals.cjs +250 -181
  71. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  72. package/lib/utils/deviceInfo.cjs +698 -0
  73. package/lib/utils/deviceInfo.cjs.map +1 -0
  74. package/lib/utils/deviceInfo.d.cts +46 -0
  75. package/lib/utils/partnerSignals.cjs +294 -0
  76. package/lib/utils/partnerSignals.cjs.map +1 -0
  77. package/lib/utils/partnerSignals.d.cts +12 -0
  78. package/lib/utils/screenActivity.cjs +125 -0
  79. package/lib/utils/screenActivity.cjs.map +1 -0
  80. package/lib/utils/screenActivity.d.cts +5 -0
  81. package/lib/utils/tracking.cjs +406 -56
  82. package/lib/utils/tracking.cjs.map +1 -1
  83. package/lib/utils/tracking.d.cts +2 -1
  84. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  85. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  86. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  87. package/lib/utils/vastMacros.cjs +58 -1
  88. package/lib/utils/vastMacros.cjs.map +1 -1
  89. package/lib/utils/vastMacros.d.cts +21 -0
  90. package/package.json +1 -1
@@ -412,8 +412,264 @@ __export(StormcloudPlayer_exports, {
412
412
  });
413
413
  module.exports = __toCommonJS(StormcloudPlayer_exports);
414
414
  var import_react5 = __toESM(require("react"), 1);
415
+ // src/utils/adIdentity.ts
416
+ var GOOGLE_ID_TYPES = [
417
+ "aaid",
418
+ "adid",
419
+ "afai",
420
+ "idfa",
421
+ "lgudid",
422
+ "msai",
423
+ "rida",
424
+ "tifa",
425
+ "tvOS",
426
+ "vaid",
427
+ "vida",
428
+ "dpid"
429
+ ];
430
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
431
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
432
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
433
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
434
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
435
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
436
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
437
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
438
+ "00000000-0000-0000-0000-000000000000",
439
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
440
+ ]);
441
+ var hostIdentity;
442
+ var memoryStore = {};
443
+ var lgUdidResult;
444
+ var lgUdidPromise;
445
+ var legacyCleared = false;
446
+ function isUsableAdId(value) {
447
+ if (typeof value !== "string") return false;
448
+ var t = value.trim();
449
+ if (!t) return false;
450
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
451
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
452
+ return !ZEROED_IDS.has(t.toLowerCase());
453
+ }
454
+ function isZeroedAdId(value) {
455
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
456
+ }
457
+ function normalizeIdType(value) {
458
+ if (typeof value !== "string") return void 0;
459
+ var lower = value.trim().toLowerCase();
460
+ if (!lower) return void 0;
461
+ var match = GOOGLE_ID_TYPES.find(function(t) {
462
+ return t.toLowerCase() === lower;
463
+ });
464
+ return match !== null && match !== void 0 ? match : "dpid";
465
+ }
466
+ function createUuid() {
467
+ var _bytes_, _bytes_1, _bytes_i;
468
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
469
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
470
+ var bytes = new Uint8Array(16);
471
+ if (c && typeof c.getRandomValues === "function") {
472
+ c.getRandomValues(bytes);
473
+ } else {
474
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
475
+ }
476
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
477
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
478
+ var hex = "";
479
+ for(var i1 = 0; i1 < 16; i1++)hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
480
+ return "".concat(hex.slice(0, 8), "-").concat(hex.slice(8, 12), "-").concat(hex.slice(12, 16), "-").concat(hex.slice(16, 20), "-").concat(hex.slice(20));
481
+ }
482
+ function readStored(key) {
483
+ try {
484
+ var _window_localStorage;
485
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
486
+ if (raw) {
487
+ var parsed = JSON.parse(raw);
488
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
489
+ return {
490
+ id: parsed.id,
491
+ createdAt: parsed.createdAt
492
+ };
493
+ }
494
+ }
495
+ } catch (unused) {}
496
+ return memoryStore[key];
497
+ }
498
+ function writeStored(key, value) {
499
+ memoryStore[key] = value;
500
+ try {
501
+ if (typeof window !== "undefined") {
502
+ var _window_localStorage;
503
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
504
+ }
505
+ } catch (unused) {}
506
+ }
507
+ function removeStored(key) {
508
+ delete memoryStore[key];
509
+ try {
510
+ var _window_localStorage;
511
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
512
+ } catch (unused) {}
513
+ }
514
+ function clearLegacyIdsOnce() {
515
+ if (legacyCleared) return;
516
+ legacyCleared = true;
517
+ try {
518
+ var _window_localStorage;
519
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
520
+ } catch (unused) {}
521
+ try {
522
+ if (typeof document !== "undefined") {
523
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
524
+ }
525
+ } catch (unused) {}
526
+ }
527
+ function clampAge(value, fallback, max) {
528
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
529
+ if (max != null) v = Math.min(v, max);
530
+ return v;
531
+ }
532
+ function setHostAdIdentity(identity) {
533
+ var _normalizeIdType;
534
+ if (!identity || !isUsableAdId(identity.deviceId)) {
535
+ hostIdentity = void 0;
536
+ return;
537
+ }
538
+ var deviceId = identity.deviceId.trim();
539
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
540
+ hostIdentity = _object_spread({
541
+ deviceId: deviceId,
542
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
543
+ }, typeof identity.limitAdTracking === "boolean" ? {
544
+ limitAdTracking: identity.limitAdTracking
545
+ } : {});
546
+ if (changed) {
547
+ removeStored(SESSION_ID_KEY);
548
+ removeStored(FALLBACK_DEVICE_ID_KEY);
549
+ }
550
+ }
551
+ function getHostAdIdentity() {
552
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
553
+ }
554
+ function resetAdIdentity() {
555
+ removeStored(SESSION_ID_KEY);
556
+ removeStored(FALLBACK_DEVICE_ID_KEY);
557
+ }
558
+ function readSamsungTifa() {
559
+ try {
560
+ var _window_webapis;
561
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
562
+ if (!adinfo) return void 0;
563
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
564
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
565
+ if (isZeroedAdId(tifa)) return {
566
+ deviceIdType: "tifa",
567
+ limitAdTracking: true
568
+ };
569
+ if (!isUsableAdId(tifa)) return void 0;
570
+ return _object_spread({
571
+ deviceId: tifa.trim(),
572
+ deviceIdType: "tifa"
573
+ }, typeof lat === "boolean" ? {
574
+ limitAdTracking: lat
575
+ } : {});
576
+ } catch (unused) {
577
+ return void 0;
578
+ }
579
+ }
580
+ function primeLgUdid() {
581
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
582
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
583
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
584
+ if (!dev) return Promise.resolve();
585
+ if (typeof dev.LGUDID !== "function") {
586
+ var _dev_lgudid;
587
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
588
+ if (isZeroedAdId(direct)) lgUdidResult = {
589
+ deviceIdType: "lgudid",
590
+ limitAdTracking: true
591
+ };
592
+ else if (isUsableAdId(direct)) {
593
+ lgUdidResult = {
594
+ deviceId: direct.trim(),
595
+ deviceIdType: "lgudid",
596
+ limitAdTracking: false
597
+ };
598
+ }
599
+ return Promise.resolve();
600
+ }
601
+ lgUdidPromise = new Promise(function(resolve) {
602
+ var settled = false;
603
+ var finish = function finish() {
604
+ if (settled) return;
605
+ settled = true;
606
+ clearTimeout(timer);
607
+ resolve();
608
+ };
609
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
610
+ try {
611
+ dev.LGUDID({
612
+ onSuccess: function onSuccess(res) {
613
+ var id = res === null || res === void 0 ? void 0 : res.id;
614
+ if (isZeroedAdId(id)) {
615
+ lgUdidResult = {
616
+ deviceIdType: "lgudid",
617
+ limitAdTracking: true
618
+ };
619
+ } else if (isUsableAdId(id)) {
620
+ lgUdidResult = {
621
+ deviceId: id.trim(),
622
+ deviceIdType: "lgudid",
623
+ limitAdTracking: false
624
+ };
625
+ }
626
+ finish();
627
+ },
628
+ onFailure: function onFailure() {
629
+ return finish();
630
+ }
631
+ });
632
+ } catch (unused) {
633
+ finish();
634
+ }
635
+ });
636
+ return lgUdidPromise;
637
+ }
638
+ function readCachedLgUdid() {
639
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
640
+ }
641
+ function getOrRotateFallbackDeviceId() {
642
+ var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS, now = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Date.now();
643
+ clearLegacyIdsOnce();
644
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
645
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
646
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
647
+ return stored.id;
648
+ }
649
+ var id = createUuid();
650
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
651
+ id: id,
652
+ createdAt: now
653
+ });
654
+ return id;
655
+ }
656
+ function getOrRotateSessionId() {
657
+ var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_SESSION_ID_MAX_AGE_MS, avoidValue = arguments.length > 1 ? arguments[1] : void 0, now = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Date.now();
658
+ clearLegacyIdsOnce();
659
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
660
+ var stored = readStored(SESSION_ID_KEY);
661
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
662
+ return stored.id;
663
+ }
664
+ var id = createUuid();
665
+ while(id === avoidValue)id = createUuid();
666
+ writeStored(SESSION_ID_KEY, {
667
+ id: id,
668
+ createdAt: now
669
+ });
670
+ return id;
671
+ }
415
672
  // src/utils/vastEnvironmentSignals.ts
416
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
417
673
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
418
674
  var DEVICE_ID_STORAGE_KEYS = [
419
675
  "rdid",
@@ -432,49 +688,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
432
688
  "adid"
433
689
  ]);
434
690
  function resolveVastEnvironmentSignals(isCtv) {
435
- var bridgeSignals = readNativeBridgeSignals();
436
- var platformDevice = readPlatformNativeDeviceId();
437
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
438
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
439
- var deviceId = realDeviceId;
440
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
441
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
442
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
443
- if (!deviceId && isCtv) {
444
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
445
- if (dpid) {
446
- deviceId = dpid;
447
- deviceIdType = "dpid";
448
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
449
- }
450
- }
691
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
451
692
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
693
+ var identity = resolveDeviceIdentity(isCtv, options);
694
+ var identityFields = _object_spread({}, identity.deviceId ? {
695
+ deviceId: identity.deviceId
696
+ } : {}, identity.deviceId && identity.deviceIdType ? {
697
+ deviceIdType: identity.deviceIdType
698
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
699
+ limitAdTracking: identity.limitAdTracking
700
+ } : {}, identity.source ? {
701
+ deviceIdSource: identity.source
702
+ } : {});
452
703
  if (isCtv) {
453
704
  return _object_spread_props(_object_spread({
454
705
  isCtv: true,
455
- sessionId: getOrCreateCtvSessionId()
456
- }, deviceId ? {
457
- deviceId: deviceId
458
- } : {}, deviceId && deviceIdType ? {
459
- deviceIdType: deviceIdType
460
- } : {}, deviceId && limitAdTracking != null ? {
461
- limitAdTracking: limitAdTracking
462
- } : {}), {
706
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
707
+ }, identityFields), {
463
708
  deviceTypeHint: deviceTypeHint
464
709
  });
465
710
  }
466
711
  return _object_spread_props(_object_spread({
467
712
  isCtv: false
468
- }, deviceId ? {
469
- deviceId: deviceId
470
- } : {}, deviceId && deviceIdType ? {
471
- deviceIdType: deviceIdType
472
- } : {}, deviceId && limitAdTracking != null ? {
473
- limitAdTracking: limitAdTracking
474
- } : {}), {
713
+ }, identityFields), {
475
714
  deviceTypeHint: deviceTypeHint
476
715
  });
477
716
  }
717
+ function resolveDeviceIdentity(isCtv, options) {
718
+ var _platform_limitAdTracking;
719
+ var host = getHostAdIdentity();
720
+ if (host) {
721
+ var _host_deviceIdType;
722
+ return _object_spread_props(_object_spread({
723
+ deviceId: host.deviceId,
724
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
725
+ }, host.limitAdTracking != null ? {
726
+ limitAdTracking: host.limitAdTracking
727
+ } : {}), {
728
+ source: "host"
729
+ });
730
+ }
731
+ var bridge = readNativeBridgeSignals();
732
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
733
+ if (bridgeDeviceId) {
734
+ var _normalizeIdType;
735
+ return _object_spread_props(_object_spread({
736
+ deviceId: bridgeDeviceId,
737
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
738
+ }, bridge.limitAdTracking != null ? {
739
+ limitAdTracking: bridge.limitAdTracking
740
+ } : {}), {
741
+ source: "bridge"
742
+ });
743
+ }
744
+ var platform = readPlatformNativeDeviceId();
745
+ var platformDeviceId = validDeviceId(platform.deviceId);
746
+ if (platformDeviceId) {
747
+ var _platform_deviceIdType;
748
+ return _object_spread_props(_object_spread({
749
+ deviceId: platformDeviceId,
750
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
751
+ }, platform.limitAdTracking != null ? {
752
+ limitAdTracking: platform.limitAdTracking
753
+ } : {}), {
754
+ source: "platform"
755
+ });
756
+ }
757
+ if (!isCtv) return {};
758
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
759
+ if (storedDeviceId) {
760
+ var _normalizeIdType1;
761
+ var storedLat = readStoredLimitAdTracking();
762
+ return _object_spread_props(_object_spread({
763
+ deviceId: storedDeviceId,
764
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
765
+ }, storedLat != null ? {
766
+ limitAdTracking: storedLat
767
+ } : {}), {
768
+ source: "stored"
769
+ });
770
+ }
771
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
772
+ return _object_spread_props(_object_spread({
773
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
774
+ deviceIdType: "dpid"
775
+ }, fallbackLat != null ? {
776
+ limitAdTracking: fallbackLat
777
+ } : {}), {
778
+ source: "generated"
779
+ });
780
+ }
478
781
  var DEVICE_TYPE_HINT = {
479
782
  FEATURE_PHONE: 1,
480
783
  SMARTPHONE: 2,
@@ -635,7 +938,7 @@ function resolveNativeDeviceId() {
635
938
  var bridgeSignals = readNativeBridgeSignals();
636
939
  var platformDevice = readPlatformNativeDeviceId();
637
940
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
638
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
941
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
639
942
  return void 0;
640
943
  }
641
944
  return deviceId;
@@ -649,20 +952,10 @@ function getOrCreateStoredUuid(storageKey) {
649
952
  writePersistentId(storageKey, existing);
650
953
  return existing;
651
954
  }
652
- var id = createUuid();
955
+ var id = createUuid2();
653
956
  writePersistentId(storageKey, id);
654
957
  return id;
655
958
  }
656
- function getOrCreateCtvSessionId() {
657
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
658
- if (existing) {
659
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
660
- return existing;
661
- }
662
- var sessionId = createUuid();
663
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
664
- return sessionId;
665
- }
666
959
  function readPersistentId(storageKey) {
667
960
  return readStoredString(storageKey) || readCookie(storageKey);
668
961
  }
@@ -715,7 +1008,7 @@ function writeCookie(name, value) {
715
1008
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
716
1009
  } catch (unused) {}
717
1010
  }
718
- function createUuid() {
1011
+ function createUuid2() {
719
1012
  var _bytes_, _bytes_1;
720
1013
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
721
1014
  return crypto.randomUUID();
@@ -749,44 +1042,10 @@ function performanceNow() {
749
1042
  }
750
1043
  function readPlatformNativeDeviceId() {
751
1044
  if (typeof window === "undefined") return {};
752
- try {
753
- var _window_webapis;
754
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
755
- if (adinfo) {
756
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
757
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
758
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
759
- return _object_spread({
760
- deviceId: tifa,
761
- deviceIdType: "tifa"
762
- }, typeof lat === "boolean" ? {
763
- limitAdTracking: lat
764
- } : {});
765
- }
766
- }
767
- } catch (unused) {}
768
- try {
769
- var webOSDev = window.webOSDev;
770
- if (webOSDev) {
771
- var _webOSDev_lgudid;
772
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
773
- if (typeof lgudid === "string" && lgudid) {
774
- if (isZeroedAdId(lgudid)) {
775
- return {
776
- deviceIdType: "lgudid",
777
- limitAdTracking: true
778
- };
779
- }
780
- if (!isMacroPlaceholder(lgudid)) {
781
- return {
782
- deviceId: lgudid,
783
- deviceIdType: "lgudid",
784
- limitAdTracking: false
785
- };
786
- }
787
- }
788
- }
789
- } catch (unused) {}
1045
+ var tifa = readSamsungTifa();
1046
+ if (tifa) return tifa;
1047
+ var lgudid = readCachedLgUdid();
1048
+ if (lgudid) return lgudid;
790
1049
  try {
791
1050
  var roku = window.Roku;
792
1051
  if (roku) {
@@ -813,7 +1072,7 @@ function isMacroPlaceholder(value) {
813
1072
  function validDeviceId(value) {
814
1073
  return value && !isMacroPlaceholder(value) ? value : void 0;
815
1074
  }
816
- function isZeroedAdId(value) {
1075
+ function isZeroedAdId2(value) {
817
1076
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
818
1077
  }
819
1078
  function readNativeBridgeSignals() {
@@ -857,7 +1116,7 @@ function readNativeBridgeSignals() {
857
1116
  "deviceIdType",
858
1117
  "advertisingIdType",
859
1118
  "idType"
860
- ]) || inferDeviceIdType();
1119
+ ]) || void 0;
861
1120
  var limitAdTracking = readBridgeBoolean(source, [
862
1121
  "is_lat",
863
1122
  "limitAdTracking",
@@ -1037,6 +1296,308 @@ function normalizeBoolean(value) {
1037
1296
  }
1038
1297
  return void 0;
1039
1298
  }
1299
+ // src/utils/contentMetadata.ts
1300
+ var MAX_CONTENT_VALUE_LENGTH = 128;
1301
+ var BRIDGE_KEYS = {
1302
+ channelName: [
1303
+ "channelName",
1304
+ "ct_ch"
1305
+ ],
1306
+ programTitle: [
1307
+ "programTitle",
1308
+ "ct_ti"
1309
+ ],
1310
+ contentNetwork: [
1311
+ "contentNetwork",
1312
+ "ct_ne"
1313
+ ],
1314
+ contentType: [
1315
+ "contentType",
1316
+ "ctt"
1317
+ ],
1318
+ contentCategory: [
1319
+ "contentCategory",
1320
+ "ctc"
1321
+ ],
1322
+ contentGenre: [
1323
+ "contentGenre",
1324
+ "ctgr"
1325
+ ],
1326
+ contentLanguage: [
1327
+ "contentLanguage",
1328
+ "ctlg"
1329
+ ],
1330
+ contentDuration: [
1331
+ "contentDuration",
1332
+ "ctd"
1333
+ ],
1334
+ contentSeason: [
1335
+ "contentSeason",
1336
+ "cts"
1337
+ ],
1338
+ contentEpisode: [
1339
+ "contentEpisode",
1340
+ "cte"
1341
+ ],
1342
+ contentRating: [
1343
+ "contentRating",
1344
+ "ctr"
1345
+ ],
1346
+ contentId: [
1347
+ "contentId",
1348
+ "ctid"
1349
+ ]
1350
+ };
1351
+ function sanitizeContentValue(value) {
1352
+ if (typeof value !== "string") return void 0;
1353
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1354
+ if (!cleaned) return void 0;
1355
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1356
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
1357
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1358
+ }
1359
+ function sanitizeContentScalar(value) {
1360
+ if (typeof value === "number") {
1361
+ return Number.isFinite(value) ? String(value) : void 0;
1362
+ }
1363
+ return sanitizeContentValue(value);
1364
+ }
1365
+ function normalizeContentLanguage(value) {
1366
+ var cleaned = sanitizeContentValue(value);
1367
+ if (!cleaned) return void 0;
1368
+ var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
1369
+ return match && match[1] ? match[1].toLowerCase() : void 0;
1370
+ }
1371
+ function normalizeContentDuration(value) {
1372
+ var raw = sanitizeContentScalar(value);
1373
+ if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
1374
+ var seconds = Number(raw);
1375
+ if (seconds === -1) return -1;
1376
+ return seconds > 0 ? Math.round(seconds) : void 0;
1377
+ }
1378
+ function bridgeSources() {
1379
+ if (typeof window === "undefined") return [];
1380
+ var w = window;
1381
+ return [
1382
+ w.__STORMCLOUD_CTV__,
1383
+ w.__STORMCLOUD_CTV_AD_INFO__,
1384
+ w.stormcloudCtv
1385
+ ].filter(Boolean);
1386
+ }
1387
+ function readBridgeValue2(keys, sanitize) {
1388
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1389
+ try {
1390
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1391
+ var source = _step.value;
1392
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1393
+ try {
1394
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1395
+ var key = _step1.value;
1396
+ var value = void 0;
1397
+ try {
1398
+ value = source === null || source === void 0 ? void 0 : source[key];
1399
+ if (typeof value === "function") value = value.call(source);
1400
+ } catch (unused) {
1401
+ value = void 0;
1402
+ }
1403
+ var sanitized = sanitize(value);
1404
+ if (sanitized != null) return sanitized;
1405
+ }
1406
+ } catch (err) {
1407
+ _didIteratorError1 = true;
1408
+ _iteratorError1 = err;
1409
+ } finally{
1410
+ try {
1411
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1412
+ _iterator1.return();
1413
+ }
1414
+ } finally{
1415
+ if (_didIteratorError1) {
1416
+ throw _iteratorError1;
1417
+ }
1418
+ }
1419
+ }
1420
+ }
1421
+ } catch (err) {
1422
+ _didIteratorError = true;
1423
+ _iteratorError = err;
1424
+ } finally{
1425
+ try {
1426
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1427
+ _iterator.return();
1428
+ }
1429
+ } finally{
1430
+ if (_didIteratorError) {
1431
+ throw _iteratorError;
1432
+ }
1433
+ }
1434
+ }
1435
+ return void 0;
1436
+ }
1437
+ function readBridgeContentValue(keys) {
1438
+ return readBridgeValue2(keys, sanitizeContentValue);
1439
+ }
1440
+ function resolveContentMetadata(config) {
1441
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
1442
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1443
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1444
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1445
+ var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
1446
+ var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
1447
+ var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
1448
+ var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
1449
+ var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
1450
+ var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
1451
+ var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
1452
+ var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
1453
+ var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
1454
+ var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
1455
+ return _object_spread({}, channelName ? {
1456
+ channelName: channelName
1457
+ } : {}, programTitle ? {
1458
+ programTitle: programTitle
1459
+ } : {}, contentNetwork ? {
1460
+ contentNetwork: contentNetwork
1461
+ } : {}, contentType ? {
1462
+ contentType: contentType
1463
+ } : {}, contentCategory ? {
1464
+ contentCategory: contentCategory
1465
+ } : {}, contentGenre ? {
1466
+ contentGenre: contentGenre
1467
+ } : {}, contentLanguage ? {
1468
+ contentLanguage: contentLanguage
1469
+ } : {}, contentDurationSeconds != null ? {
1470
+ contentDurationSeconds: contentDurationSeconds
1471
+ } : {}, contentSeason ? {
1472
+ contentSeason: contentSeason
1473
+ } : {}, contentEpisode ? {
1474
+ contentEpisode: contentEpisode
1475
+ } : {}, contentRating ? {
1476
+ contentRating: contentRating
1477
+ } : {}, contentId ? {
1478
+ contentId: contentId
1479
+ } : {});
1480
+ }
1481
+ function applyContentMetadataUpdate(target, meta) {
1482
+ var apply = function apply(key, value) {
1483
+ if (value === void 0) return;
1484
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
1485
+ if (clean) target[key] = clean;
1486
+ else delete target[key];
1487
+ };
1488
+ apply("channelName", meta.channelName);
1489
+ apply("programTitle", meta.programTitle);
1490
+ apply("contentNetwork", meta.contentNetwork);
1491
+ if (meta.details === void 0) return;
1492
+ if (meta.details === null) delete target.contentDetails;
1493
+ else target.contentDetails = _object_spread({}, meta.details);
1494
+ }
1495
+ function appendMissingContentParams(url, meta) {
1496
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1497
+ try {
1498
+ var parsed = new URL(url);
1499
+ var add = function add(key, value) {
1500
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1501
+ };
1502
+ add("ct_ch", meta.channelName);
1503
+ add("ct_ti", meta.programTitle);
1504
+ add("ct_ne", meta.contentNetwork);
1505
+ return parsed.toString();
1506
+ } catch (unused) {
1507
+ return url;
1508
+ }
1509
+ }
1510
+ // src/utils/partnerSignals.ts
1511
+ var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
1512
+ "aaid",
1513
+ "adid",
1514
+ "afai",
1515
+ "idfa",
1516
+ "lgudid",
1517
+ "msai",
1518
+ "rida",
1519
+ "tifa",
1520
+ "tvos",
1521
+ "vaid",
1522
+ "vida"
1523
+ ]);
1524
+ function toIabIfaType(deviceIdType, source) {
1525
+ if (!deviceIdType) return void 0;
1526
+ var type = deviceIdType.trim().toLowerCase();
1527
+ if (source === "generated") return "sessionid";
1528
+ if (PLATFORM_IFA_TYPES.has(type)) return type;
1529
+ if (source === "platform") return "dpid";
1530
+ return "ppid";
1531
+ }
1532
+ function playbackMethodCode(autoPlay, muted) {
1533
+ if (autoPlay === false) return 3;
1534
+ if (autoPlay !== true || muted == null) return void 0;
1535
+ return muted ? 2 : 1;
1536
+ }
1537
+ function resolvePlayerSize(video) {
1538
+ var width = video ? video.clientWidth : 0;
1539
+ var height = video ? video.clientHeight : 0;
1540
+ if (!(width > 0 && height > 0) && typeof window !== "undefined") {
1541
+ width = window.innerWidth;
1542
+ height = window.innerHeight;
1543
+ }
1544
+ if (!(width > 0 && height > 0)) return {};
1545
+ return {
1546
+ width: Math.round(width),
1547
+ height: Math.round(height)
1548
+ };
1549
+ }
1550
+ function sanitizeUserId(value) {
1551
+ var cleaned = sanitizeContentValue(value);
1552
+ if (!cleaned || /\s/.test(cleaned)) return void 0;
1553
+ return cleaned;
1554
+ }
1555
+ function isPublicIpv4(ip) {
1556
+ var parts = ip.split(".");
1557
+ if (parts.length !== 4) return false;
1558
+ var nums = parts.map(function(p) {
1559
+ return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
1560
+ });
1561
+ if (nums.some(function(n) {
1562
+ return !(n >= 0 && n <= 255);
1563
+ })) return false;
1564
+ var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
1565
+ if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
1566
+ if (a === 100 && b >= 64 && b <= 127) return false;
1567
+ if (a === 169 && b === 254) return false;
1568
+ if (a === 172 && b >= 16 && b <= 31) return false;
1569
+ if (a === 192 && b === 168) return false;
1570
+ return true;
1571
+ }
1572
+ function isPublicIpv6(ip) {
1573
+ var lower = ip.toLowerCase();
1574
+ if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
1575
+ if (lower === "::" || lower === "::1") return false;
1576
+ if (/^fe[89ab]/.test(lower)) return false;
1577
+ if (/^f[cd]/.test(lower)) return false;
1578
+ return true;
1579
+ }
1580
+ function sanitizePublicIp(value) {
1581
+ var cleaned = sanitizeContentValue(value);
1582
+ if (!cleaned) return void 0;
1583
+ if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
1584
+ return isPublicIpv6(cleaned) ? cleaned : void 0;
1585
+ }
1586
+ function resolveUserId(configValue) {
1587
+ var _sanitizeUserId;
1588
+ return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
1589
+ "userId",
1590
+ "uid"
1591
+ ], sanitizeUserId);
1592
+ }
1593
+ function resolveClientIp(configValue) {
1594
+ var _sanitizePublicIp;
1595
+ return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
1596
+ "ipAddress",
1597
+ "clientIp",
1598
+ "ip"
1599
+ ], sanitizePublicIp);
1600
+ }
1040
1601
  // src/utils/vastMacros.ts
1041
1602
  var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
1042
1603
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
@@ -1354,7 +1915,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
1354
1915
  var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
1355
1916
  "PMND",
1356
1917
  "PMXD",
1357
- "PMAD"
1918
+ "PMAD",
1919
+ "MABD"
1358
1920
  ]);
1359
1921
  function hasScvpMacros(url) {
1360
1922
  return !!url && SCVP_MACRO_DETECT.test(url);
@@ -1399,12 +1961,15 @@ function resolveScvpMacroValues(ctx) {
1399
1961
  set("RDID", deviceId);
1400
1962
  set("IDTYPE", deviceIdType);
1401
1963
  set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
1964
+ set("IFA", deviceId);
1965
+ set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
1402
1966
  }
1403
1967
  set("SID", ctx.sessionId);
1404
1968
  set("DTH", ctx.deviceTypeHint);
1405
1969
  set("GIVN", ctx.palNonce);
1406
1970
  set("CT-TI", ctx.programTitle);
1407
1971
  set("CT-CH", ctx.channelName);
1972
+ set("CT-NE", ctx.contentNetwork);
1408
1973
  set("POD", ctx.pod);
1409
1974
  set("CORRELATOR", ctx.correlator);
1410
1975
  set("SCOR", ctx.streamCorrelator);
@@ -1415,6 +1980,26 @@ function resolveScvpMacroValues(ctx) {
1415
1980
  set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
1416
1981
  set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
1417
1982
  set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
1983
+ set("PLAYER-WIDTH", ctx.playerWidth);
1984
+ set("PLAYER-HEIGHT", ctx.playerHeight);
1985
+ set("TIMESTAMP", ctx.timestamp);
1986
+ set("LIVE", toFlag(ctx.isLive));
1987
+ set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
1988
+ set("DEVICE-MAKE", ctx.deviceMake);
1989
+ set("DEVICE-MODEL", ctx.deviceModel);
1990
+ set("DEVICE-HWV", ctx.deviceHardwareVersion);
1991
+ set("UA", ctx.userAgent);
1992
+ set("IP", ctx.ipAddress);
1993
+ set("UID", ctx.userId);
1994
+ set("CT-TYPE", ctx.contentType);
1995
+ set("CT-CATEGORY", ctx.contentCategory);
1996
+ set("CT-GENRE", ctx.contentGenre);
1997
+ set("CT-LANGUAGE", ctx.contentLanguage);
1998
+ set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
1999
+ set("CT-SEASON", ctx.contentSeason);
2000
+ set("CT-EPISODE", ctx.contentEpisode);
2001
+ set("CT-RATING", ctx.contentRating);
2002
+ set("CT-ID", ctx.contentId);
1418
2003
  return values;
1419
2004
  }
1420
2005
  var keepNone = function keepNone() {
@@ -1633,6 +2218,9 @@ function applyVastMacros(baseUrl, ctx) {
1633
2218
  if (ctx.channelName) {
1634
2219
  params.set("ct_ch", ctx.channelName);
1635
2220
  }
2221
+ if (ctx.contentNetwork) {
2222
+ params.set("ct_ne", ctx.contentNetwork);
2223
+ }
1636
2224
  var staleKeys = [];
1637
2225
  params.forEach(function(value, key) {
1638
2226
  if (isMacroPlaceholder2(value)) {
@@ -2297,8 +2885,17 @@ function detectBrowser() {
2297
2885
  chromeVersion: chromeVersionNum
2298
2886
  };
2299
2887
  }
2888
+ var singleDecoderOverride;
2889
+ function setSingleDecoderOverride(value) {
2890
+ singleDecoderOverride = value;
2891
+ }
2300
2892
  function requiresMediaPipelineResetAfterAds() {
2301
2893
  var _browser_tizenVersion;
2894
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2895
+ try {
2896
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2897
+ if (typeof globalOverride === "boolean") return globalOverride;
2898
+ } catch (unused) {}
2302
2899
  var browser = detectBrowser();
2303
2900
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2304
2901
  }
@@ -2458,7 +3055,7 @@ function substituteVastTrackingMacros(url) {
2458
3055
  });
2459
3056
  }
2460
3057
  // src/player/OptimizedPodRequest.ts
2461
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
3058
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2462
3059
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2463
3060
  var POD_PARAM_KEYS = [
2464
3061
  "pmnd",
@@ -2618,15 +3215,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
2618
3215
  values.set("PMND", String(pod.pmnd));
2619
3216
  values.set("PMXD", String(pod.pmxd));
2620
3217
  if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
3218
+ values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
2621
3219
  }
2622
3220
  var substituted = substituteScvpMacros(rawUrl, values);
2623
3221
  var finalUrl;
2624
3222
  try {
2625
3223
  var url = new URL(normalizeVastTagUrl(substituted.url));
3224
+ var isGam = GAM_AD_HOSTS.has(url.hostname);
3225
+ var setPodParam = function setPodParam(key, value) {
3226
+ if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
3227
+ };
2626
3228
  if (pod) {
2627
- url.searchParams.set("pmnd", String(pod.pmnd));
2628
- url.searchParams.set("pmxd", String(pod.pmxd));
2629
- if (pod.pmad != null) url.searchParams.set("pmad", String(pod.pmad));
3229
+ setPodParam("pmnd", pod.pmnd);
3230
+ setPodParam("pmxd", pod.pmxd);
3231
+ if (pod.pmad != null) setPodParam("pmad", pod.pmad);
2630
3232
  else url.searchParams.delete("pmad");
2631
3233
  } else {
2632
3234
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -2692,7 +3294,9 @@ function validateGamRequestUrl(url, expect) {
2692
3294
  if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
2693
3295
  var params;
2694
3296
  try {
2695
- params = new URL(url).searchParams;
3297
+ var parsed = new URL(url);
3298
+ if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
3299
+ params = parsed.searchParams;
2696
3300
  } catch (unused) {
2697
3301
  return problems.concat("URL could not be parsed");
2698
3302
  }
@@ -2882,6 +3486,9 @@ function createHlsAdPlayer(contentVideo, options) {
2882
3486
  var mediaCandidateIndex = 0;
2883
3487
  var mediaStartTimerId;
2884
3488
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3489
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3490
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3491
+ var mediaStartBudgetStartedAt = 0;
2885
3492
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2886
3493
  var pendingVastRequests = /* @__PURE__ */ new Set();
2887
3494
  var pendingRequestAbortReason;
@@ -4896,12 +5503,14 @@ function createHlsAdPlayer(contentVideo, options) {
4896
5503
  clearMediaStartTimer();
4897
5504
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4898
5505
  var startedAt = Date.now();
5506
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5507
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4899
5508
  mediaStartTimerId = setTimeout(function() {
4900
5509
  mediaStartTimerId = void 0;
4901
5510
  if (!adPlaying || trackingFired.impression) return;
4902
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5511
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4903
5512
  logFunnel("play_resolved_but_never_started", {
4904
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5513
+ timeoutMs: timeoutMs,
4905
5514
  elapsedMs: Date.now() - startedAt,
4906
5515
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4907
5516
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4910,7 +5519,7 @@ function createHlsAdPlayer(contentVideo, options) {
4910
5519
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4911
5520
  });
4912
5521
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4913
- }, MEDIA_START_TIMEOUT_MS);
5522
+ }, timeoutMs);
4914
5523
  }
4915
5524
  function resetVideoElementForNextSource() {
4916
5525
  clearStallWatchdog();
@@ -4925,6 +5534,20 @@ function createHlsAdPlayer(contentVideo, options) {
4925
5534
  function tryNextMediaCandidate() {
4926
5535
  if (!currentAd || trackingFired.impression) return false;
4927
5536
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5537
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5538
+ logFunnel("media_fallback_capped", {
5539
+ reason: "max_attempts",
5540
+ attempts: mediaCandidateIndex + 1
5541
+ });
5542
+ return false;
5543
+ }
5544
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5545
+ logFunnel("media_fallback_capped", {
5546
+ reason: "time_budget",
5547
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5548
+ });
5549
+ return false;
5550
+ }
4928
5551
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4929
5552
  mediaCandidateIndex++;
4930
5553
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4958,6 +5581,7 @@ function createHlsAdPlayer(contentVideo, options) {
4958
5581
  }
4959
5582
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4960
5583
  mediaCandidateIndex = 0;
5584
+ mediaStartBudgetStartedAt = Date.now();
4961
5585
  var mediaFile = mediaCandidates[0];
4962
5586
  if (!mediaFile) {
4963
5587
  logFunnel("media_unsupported", {
@@ -5897,6 +6521,7 @@ function getOrCreateNonceLoader(allowStorage) {
5897
6521
  }
5898
6522
  function createPalNonceManager() {
5899
6523
  var currentNonce = "";
6524
+ var currentNonceCreatedAt = 0;
5900
6525
  var currentNonceManager;
5901
6526
  var pendingNonce;
5902
6527
  return {
@@ -5913,6 +6538,9 @@ function createPalNonceManager() {
5913
6538
  getCurrentNonce: function getCurrentNonce() {
5914
6539
  return currentNonce;
5915
6540
  },
6541
+ getNonceAgeMs: function getNonceAgeMs() {
6542
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6543
+ },
5916
6544
  waitForNonce: function waitForNonce(maxWaitMs) {
5917
6545
  if (currentNonce) return Promise.resolve(currentNonce);
5918
6546
  var pending = pendingNonce;
@@ -5965,13 +6593,14 @@ function createPalNonceManager() {
5965
6593
  },
5966
6594
  reset: function reset() {
5967
6595
  currentNonce = "";
6596
+ currentNonceCreatedAt = 0;
5968
6597
  currentNonceManager = void 0;
5969
6598
  pendingNonce = void 0;
5970
6599
  }
5971
6600
  };
5972
6601
  function generate(options) {
5973
6602
  return _async_to_generator(function() {
5974
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6603
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5975
6604
  return _ts_generator(this, function(_state) {
5976
6605
  switch(_state.label){
5977
6606
  case 0:
@@ -5995,10 +6624,11 @@ function createPalNonceManager() {
5995
6624
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5996
6625
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5997
6626
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5998
- request.iconsSupported = true;
6627
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5999
6628
  request.playerType = "StormcloudVideoPlayer";
6000
6629
  request.playerVersion = "1.0";
6001
- request.supportedApiFrameworks = "2,7,9";
6630
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6631
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
6002
6632
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6003
6633
  request.videoWidth = options.videoWidth || 640;
6004
6634
  request.videoHeight = options.videoHeight || 480;
@@ -6028,6 +6658,7 @@ function createPalNonceManager() {
6028
6658
  manager = _state.sent();
6029
6659
  currentNonceManager = manager;
6030
6660
  currentNonce = manager.getNonce();
6661
+ currentNonceCreatedAt = Date.now();
6031
6662
  console.log("[PAL] Nonce generated successfully");
6032
6663
  return [
6033
6664
  2,
@@ -6051,6 +6682,458 @@ function createPalNonceManager() {
6051
6682
  })();
6052
6683
  }
6053
6684
  }
6685
+ // src/utils/deviceInfo.ts
6686
+ var CATEGORY_CODES = {
6687
+ "LG TV": "lg_tv",
6688
+ "LG Set-Top Box": "lg_stb",
6689
+ "Samsung TV": "samsung_tv",
6690
+ Other: "other"
6691
+ };
6692
+ var DEVICE_CATEGORIES = [
6693
+ "LG TV",
6694
+ "LG Set-Top Box",
6695
+ "Samsung TV",
6696
+ "Other"
6697
+ ];
6698
+ var hostDeviceInfo;
6699
+ var lgDeviceInfo;
6700
+ var platformCache;
6701
+ var primePromise;
6702
+ function cleanString(value) {
6703
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6704
+ if (typeof value !== "string") return void 0;
6705
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6706
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6707
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6708
+ }
6709
+ function safeCall2(fn, thisArg) {
6710
+ if (typeof fn !== "function") return void 0;
6711
+ try {
6712
+ return fn.call(thisArg);
6713
+ } catch (unused) {
6714
+ return void 0;
6715
+ }
6716
+ }
6717
+ function userAgent() {
6718
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6719
+ }
6720
+ function bridgeSources2() {
6721
+ if (typeof window === "undefined") return [];
6722
+ var w = window;
6723
+ return [
6724
+ w.__STORMCLOUD_CTV__,
6725
+ w.__STORMCLOUD_CTV_AD_INFO__,
6726
+ w.stormcloudCtv
6727
+ ].filter(Boolean);
6728
+ }
6729
+ function readBridge(keys) {
6730
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6731
+ try {
6732
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6733
+ var source = _step.value;
6734
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6735
+ try {
6736
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6737
+ var key = _step1.value;
6738
+ var value = void 0;
6739
+ try {
6740
+ value = source === null || source === void 0 ? void 0 : source[key];
6741
+ if (typeof value === "function") value = value.call(source);
6742
+ } catch (unused) {
6743
+ value = void 0;
6744
+ }
6745
+ var clean = cleanString(value);
6746
+ if (clean) return clean;
6747
+ }
6748
+ } catch (err) {
6749
+ _didIteratorError1 = true;
6750
+ _iteratorError1 = err;
6751
+ } finally{
6752
+ try {
6753
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6754
+ _iterator1.return();
6755
+ }
6756
+ } finally{
6757
+ if (_didIteratorError1) {
6758
+ throw _iteratorError1;
6759
+ }
6760
+ }
6761
+ }
6762
+ }
6763
+ } catch (err) {
6764
+ _didIteratorError = true;
6765
+ _iteratorError = err;
6766
+ } finally{
6767
+ try {
6768
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6769
+ _iterator.return();
6770
+ }
6771
+ } finally{
6772
+ if (_didIteratorError) {
6773
+ throw _iteratorError;
6774
+ }
6775
+ }
6776
+ }
6777
+ return void 0;
6778
+ }
6779
+ function makeForCategory(category) {
6780
+ if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
6781
+ if (category === "Samsung TV") return "Samsung";
6782
+ return void 0;
6783
+ }
6784
+ function normalizeCategory(value) {
6785
+ var v = cleanString(value);
6786
+ if (!v) return void 0;
6787
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6788
+ return c.toLowerCase() === v.toLowerCase();
6789
+ });
6790
+ if (exact) return exact;
6791
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6792
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6793
+ return CATEGORY_CODES[c] === code;
6794
+ });
6795
+ return byCode;
6796
+ }
6797
+ function parseUserAgentDeviceInfo(ua) {
6798
+ var sources = [];
6799
+ var out = {
6800
+ platform: "other",
6801
+ sources: sources
6802
+ };
6803
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6804
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6805
+ if (/Web0S|webOS/i.test(ua)) {
6806
+ out.platform = "webos";
6807
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6808
+ if (lg && lg[1] && lg[2]) {
6809
+ out.model = lg[1];
6810
+ out.firmware = lg[2];
6811
+ sources.push("user_agent");
6812
+ }
6813
+ } else if (/Tizen/i.test(ua)) {
6814
+ out.platform = "tizen";
6815
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6816
+ if (tizen && tizen[1]) {
6817
+ out.osVersion = "Tizen ".concat(tizen[1]);
6818
+ sources.push("user_agent");
6819
+ }
6820
+ }
6821
+ return out;
6822
+ }
6823
+ function readSamsungProductInfo() {
6824
+ var _cleanString;
6825
+ var _window_webapis;
6826
+ if (typeof window === "undefined") return void 0;
6827
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6828
+ if (!productinfo) return void 0;
6829
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6830
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6831
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6832
+ if (!model && !firmware && !duid) return void 0;
6833
+ return _object_spread({}, model ? {
6834
+ model: model
6835
+ } : {}, firmware ? {
6836
+ firmware: firmware
6837
+ } : {}, duid ? {
6838
+ internalDeviceId: duid,
6839
+ internalDeviceIdSource: "samsung_duid"
6840
+ } : {});
6841
+ }
6842
+ function readLgDeviceInfo(timeoutMs) {
6843
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6844
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6845
+ return new Promise(function(resolve) {
6846
+ var settled = false;
6847
+ var finish = function finish() {
6848
+ if (settled) return;
6849
+ settled = true;
6850
+ clearTimeout(timer);
6851
+ resolve();
6852
+ };
6853
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6854
+ try {
6855
+ webOS.deviceInfo(function(info) {
6856
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6857
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6858
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6859
+ lgDeviceInfo = _object_spread({}, model ? {
6860
+ model: model
6861
+ } : {}, firmware ? {
6862
+ firmware: firmware
6863
+ } : {}, sdkVersion ? {
6864
+ sdkVersion: sdkVersion
6865
+ } : {});
6866
+ finish();
6867
+ });
6868
+ } catch (unused) {
6869
+ finish();
6870
+ }
6871
+ });
6872
+ }
6873
+ function computePlatformInfo() {
6874
+ var info = parseUserAgentDeviceInfo(userAgent());
6875
+ var sources = _to_consumable_array(info.sources);
6876
+ var samsung = readSamsungProductInfo();
6877
+ if (samsung) {
6878
+ info.platform = "tizen";
6879
+ if (samsung.model) info.model = samsung.model;
6880
+ if (samsung.firmware) info.firmware = samsung.firmware;
6881
+ if (samsung.internalDeviceId) {
6882
+ info.internalDeviceId = samsung.internalDeviceId;
6883
+ info.internalDeviceIdSource = "samsung_duid";
6884
+ }
6885
+ sources.push("samsung_productinfo");
6886
+ }
6887
+ if (lgDeviceInfo) {
6888
+ info.platform = "webos";
6889
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6890
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6891
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6892
+ sources.push("lg_deviceinfo");
6893
+ }
6894
+ var lgUdid = readCachedLgUdid();
6895
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6896
+ info.internalDeviceId = lgUdid.deviceId;
6897
+ info.internalDeviceIdSource = "lg_udid";
6898
+ sources.push("lg_udid");
6899
+ }
6900
+ info.sources = sources;
6901
+ return info;
6902
+ }
6903
+ function categorize(platform, model) {
6904
+ if (platform === "tizen") return "Samsung TV";
6905
+ if (platform === "webos") {
6906
+ var ua = userAgent();
6907
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6908
+ return "LG TV";
6909
+ }
6910
+ return "Other";
6911
+ }
6912
+ function setHostDeviceInfo(info) {
6913
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6914
+ }
6915
+ function primeDeviceInfo() {
6916
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6917
+ if (!primePromise) {
6918
+ primePromise = Promise.all([
6919
+ readLgDeviceInfo(timeoutMs),
6920
+ primeLgUdid(timeoutMs)
6921
+ ]).catch(function() {
6922
+ return void 0;
6923
+ }).then(function() {
6924
+ platformCache = computePlatformInfo();
6925
+ return getDeviceInfo();
6926
+ });
6927
+ }
6928
+ return primePromise;
6929
+ }
6930
+ function getDeviceInfo() {
6931
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
6932
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6933
+ if (primePromise && !platformCache) {} else {
6934
+ platformCache = platform;
6935
+ }
6936
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6937
+ var bridge = {
6938
+ terminalId: readBridge([
6939
+ "terminalId",
6940
+ "terminal_id"
6941
+ ]),
6942
+ internalDeviceId: readBridge([
6943
+ "internalDeviceId",
6944
+ "internal_device_id"
6945
+ ]),
6946
+ model: readBridge([
6947
+ "deviceModel"
6948
+ ]),
6949
+ firmware: readBridge([
6950
+ "firmwareVersion"
6951
+ ]),
6952
+ category: normalizeCategory(readBridge([
6953
+ "deviceCategory"
6954
+ ])),
6955
+ make: readBridge([
6956
+ "deviceMake"
6957
+ ]),
6958
+ hardwareVersion: readBridge([
6959
+ "deviceHardwareVersion",
6960
+ "hardwareVersion"
6961
+ ])
6962
+ };
6963
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6964
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6965
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6966
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6967
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6968
+ var sources = _to_consumable_array(platform.sources);
6969
+ var bridgeValues = [
6970
+ bridge.terminalId,
6971
+ bridge.internalDeviceId,
6972
+ bridge.model,
6973
+ bridge.firmware,
6974
+ bridge.category,
6975
+ bridge.make,
6976
+ bridge.hardwareVersion
6977
+ ];
6978
+ if (bridgeValues.some(function(v) {
6979
+ return v !== void 0;
6980
+ })) sources.unshift("bridge");
6981
+ if (hostDeviceInfo) sources.unshift("host");
6982
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6983
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6984
+ var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
6985
+ var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
6986
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6987
+ return _object_spread_props(_object_spread({
6988
+ category: category,
6989
+ categoryCode: CATEGORY_CODES[category]
6990
+ }, make ? {
6991
+ make: make
6992
+ } : {}, model ? {
6993
+ model: model
6994
+ } : {}, hardwareVersion ? {
6995
+ hardwareVersion: hardwareVersion
6996
+ } : {}, sonifiModel ? {
6997
+ sonifiModel: sonifiModel
6998
+ } : {}, firmware ? {
6999
+ firmware: firmware
7000
+ } : {}, platform.osVersion ? {
7001
+ osVersion: platform.osVersion
7002
+ } : {}, platform.browserMajorVersion != null ? {
7003
+ browserMajorVersion: platform.browserMajorVersion
7004
+ } : {}, internalDeviceId ? {
7005
+ internalDeviceId: internalDeviceId
7006
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
7007
+ internalDeviceIdSource: internalDeviceIdSource
7008
+ } : {}, terminalId ? {
7009
+ terminalId: terminalId
7010
+ } : {}), {
7011
+ sources: sources
7012
+ });
7013
+ }
7014
+ var DEVICE_KEY_VALUE_KEYS = {
7015
+ category: "sc_dev",
7016
+ model: "sc_model",
7017
+ firmware: "sc_fw"
7018
+ };
7019
+ function sanitizeKeyValue(value) {
7020
+ if (typeof value !== "string") return void 0;
7021
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
7022
+ return v ? v.slice(0, 40) : void 0;
7023
+ }
7024
+ function deviceKeyValuePairs(info) {
7025
+ var pairs = [
7026
+ [
7027
+ DEVICE_KEY_VALUE_KEYS.category,
7028
+ info.categoryCode
7029
+ ]
7030
+ ];
7031
+ var model = sanitizeKeyValue(info.model);
7032
+ var firmware = sanitizeKeyValue(info.firmware);
7033
+ if (model) pairs.push([
7034
+ DEVICE_KEY_VALUE_KEYS.model,
7035
+ model
7036
+ ]);
7037
+ if (firmware) pairs.push([
7038
+ DEVICE_KEY_VALUE_KEYS.firmware,
7039
+ firmware
7040
+ ]);
7041
+ return pairs;
7042
+ }
7043
+ function applyDeviceKeyValues(url, info) {
7044
+ try {
7045
+ var parsed = new URL(url);
7046
+ var pairs = deviceKeyValuePairs(info);
7047
+ var ours = new Set(pairs.map(function(param) {
7048
+ var _param = _sliced_to_array(param, 1), k = _param[0];
7049
+ return k;
7050
+ }));
7051
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
7052
+ var _p_split_;
7053
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
7054
+ });
7055
+ var merged = existing.concat(pairs.map(function(param) {
7056
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
7057
+ return "".concat(k, "=").concat(v);
7058
+ })).join("&");
7059
+ parsed.searchParams.set("cust_params", merged);
7060
+ return parsed.toString();
7061
+ } catch (unused) {
7062
+ return url;
7063
+ }
7064
+ }
7065
+ function deviceInfoAnalyticsFields(info) {
7066
+ return _object_spread({
7067
+ device_category: info.category
7068
+ }, info.model ? {
7069
+ device_model: info.model
7070
+ } : {}, info.sonifiModel ? {
7071
+ sonifi_model: info.sonifiModel
7072
+ } : {}, info.firmware ? {
7073
+ firmware_version: info.firmware
7074
+ } : {}, info.osVersion ? {
7075
+ os_version: info.osVersion
7076
+ } : {}, info.browserMajorVersion != null ? {
7077
+ browser_major_version: info.browserMajorVersion
7078
+ } : {}, info.internalDeviceId ? {
7079
+ internal_device_id: info.internalDeviceId
7080
+ } : {}, info.internalDeviceIdSource ? {
7081
+ internal_device_id_source: info.internalDeviceIdSource
7082
+ } : {}, info.terminalId ? {
7083
+ terminal_id: info.terminalId
7084
+ } : {});
7085
+ }
7086
+ // src/utils/screenActivity.ts
7087
+ var hostStandby = false;
7088
+ function setHostStandby(standby) {
7089
+ hostStandby = !!standby;
7090
+ }
7091
+ function toBoolean(value) {
7092
+ if (typeof value === "boolean") return value;
7093
+ if (typeof value === "number") return value === 1;
7094
+ if (typeof value === "string") {
7095
+ var v = value.trim().toLowerCase();
7096
+ if (v === "true" || v === "1" || v === "yes") return true;
7097
+ if (v === "false" || v === "0" || v === "no") return false;
7098
+ }
7099
+ return void 0;
7100
+ }
7101
+ function bridgeSaysStandby() {
7102
+ if (typeof window === "undefined") return false;
7103
+ var w = window;
7104
+ for(var _i = 0, _iter = [
7105
+ w.__STORMCLOUD_CTV__,
7106
+ w.__STORMCLOUD_CTV_AD_INFO__,
7107
+ w.stormcloudCtv
7108
+ ]; _i < _iter.length; _i++){
7109
+ var source = _iter[_i];
7110
+ if (!source) continue;
7111
+ for(var _i1 = 0, _iter1 = [
7112
+ "standby",
7113
+ "isStandby",
7114
+ "screenOff"
7115
+ ]; _i1 < _iter1.length; _i1++){
7116
+ var key = _iter1[_i1];
7117
+ var value = void 0;
7118
+ try {
7119
+ value = source[key];
7120
+ if (typeof value === "function") value = value.call(source);
7121
+ } catch (unused) {
7122
+ value = void 0;
7123
+ }
7124
+ if (toBoolean(value) === true) return true;
7125
+ }
7126
+ }
7127
+ return false;
7128
+ }
7129
+ function getScreenInactiveReason() {
7130
+ if (hostStandby) return "host_standby";
7131
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
7132
+ return "document_hidden";
7133
+ }
7134
+ if (bridgeSaysStandby()) return "bridge_standby";
7135
+ return void 0;
7136
+ }
6054
7137
  // src/utils/trackingIngest.ts
6055
7138
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6056
7139
  enabled: true,
@@ -6148,6 +7231,9 @@ function buildAnalyticsContext(config) {
6148
7231
  if (config.isLiveStream !== void 0) {
6149
7232
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6150
7233
  }
7234
+ if (config.sendDeviceInfoToAnalytics) {
7235
+ context.includeDeviceInfo = true;
7236
+ }
6151
7237
  return context;
6152
7238
  }
6153
7239
  function getClientInfo() {
@@ -6443,7 +7529,7 @@ function buildPlayerMetricEvent() {
6443
7529
  capture_at: captureAt
6444
7530
  }, context.inputStreamType ? {
6445
7531
  input_stream_type: context.inputStreamType
6446
- } : {})
7532
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6447
7533
  ];
6448
7534
  }
6449
7535
  });
@@ -7998,6 +9084,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
7998
9084
  return Scte35CueManager;
7999
9085
  }();
8000
9086
  // src/player/AdConfigManager.ts
9087
+ function isGamAdUrl(rawUrl) {
9088
+ try {
9089
+ return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
9090
+ } catch (unused) {
9091
+ return false;
9092
+ }
9093
+ }
8001
9094
  function withDeferredPodParams(rawUrl, deferNonce) {
8002
9095
  try {
8003
9096
  var url = new URL(rawUrl);
@@ -8015,11 +9108,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
8015
9108
  }
8016
9109
  var AdConfigManager = /*#__PURE__*/ function() {
8017
9110
  function AdConfigManager(config, video) {
9111
+ var _this = this;
8018
9112
  _class_call_check(this, AdConfigManager);
8019
9113
  this.vmapBreaks = [];
8020
9114
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
8021
9115
  this.streamCorrelator = generateCorrelator();
8022
9116
  this.consentSignals = {};
9117
+ this.isLiveStream = function() {
9118
+ return !!_this.config.isLiveStream;
9119
+ };
8023
9120
  this.podCounter = 0;
8024
9121
  this.podAssignedByPrefetch = false;
8025
9122
  this.lastHeartbeatTime = 0;
@@ -8470,9 +9567,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
8470
9567
  {
8471
9568
  key: "generatePodVastUrl",
8472
9569
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
9570
+ var _content_contentDurationSeconds;
8473
9571
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8474
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
8475
- var macroContext = _object_spread_props(_object_spread({
9572
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9573
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9574
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9575
+ });
9576
+ var content = resolveContentMetadata(this.config);
9577
+ var isLive = this.isLiveStream();
9578
+ var device = getDeviceInfo();
9579
+ var playerSize = resolvePlayerSize(this.video);
9580
+ var videoDuration = this.video.duration;
9581
+ var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
9582
+ var userId = resolveUserId(this.config.adUserId);
9583
+ var ipAddress = resolveClientIp(this.config.clientIpAddress);
9584
+ var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
9585
+ var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
8476
9586
  correlator: this.viewCorrelator,
8477
9587
  streamCorrelator: this.streamCorrelator,
8478
9588
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -8486,14 +9596,54 @@ var AdConfigManager = /*#__PURE__*/ function() {
8486
9596
  limitAdTracking: envSignals.limitAdTracking,
8487
9597
  deviceTypeHint: envSignals.deviceTypeHint,
8488
9598
  adTest: this.config.adTest
8489
- }, this.config.programTitle ? {
8490
- programTitle: this.config.programTitle
8491
- } : {}, this.config.channelName ? {
8492
- channelName: this.config.channelName
9599
+ }, content.programTitle ? {
9600
+ programTitle: content.programTitle
9601
+ } : {}, content.channelName ? {
9602
+ channelName: content.channelName
9603
+ } : {}, content.contentNetwork ? {
9604
+ contentNetwork: content.contentNetwork
8493
9605
  } : {}), {
8494
9606
  consent: this.consentSignals,
8495
- palNonce: palNonce.getCurrentNonce() || void 0
8496
- });
9607
+ palNonce: palNonce.getCurrentNonce() || void 0,
9608
+ deviceIdSource: envSignals.deviceIdSource,
9609
+ isLive: isLive
9610
+ }), playerSize.width ? {
9611
+ playerWidth: playerSize.width
9612
+ } : {}, playerSize.height ? {
9613
+ playerHeight: playerSize.height
9614
+ } : {}), {
9615
+ timestamp: String(Date.now())
9616
+ }), device.make ? {
9617
+ deviceMake: device.make
9618
+ } : {}, device.model ? {
9619
+ deviceModel: device.model
9620
+ } : {}, device.hardwareVersion ? {
9621
+ deviceHardwareVersion: device.hardwareVersion
9622
+ } : {}, userAgent2 ? {
9623
+ userAgent: userAgent2
9624
+ } : {}, ipAddress ? {
9625
+ ipAddress: ipAddress
9626
+ } : {}, userId ? {
9627
+ userId: userId
9628
+ } : {}, content.contentType ? {
9629
+ contentType: content.contentType
9630
+ } : {}, content.contentCategory ? {
9631
+ contentCategory: content.contentCategory
9632
+ } : {}, content.contentGenre ? {
9633
+ contentGenre: content.contentGenre
9634
+ } : {}, content.contentLanguage ? {
9635
+ contentLanguage: content.contentLanguage
9636
+ } : {}, contentDurationSeconds != null ? {
9637
+ contentDurationSeconds: contentDurationSeconds
9638
+ } : {}, content.contentSeason ? {
9639
+ contentSeason: content.contentSeason
9640
+ } : {}, content.contentEpisode ? {
9641
+ contentEpisode: content.contentEpisode
9642
+ } : {}, content.contentRating ? {
9643
+ contentRating: content.contentRating
9644
+ } : {}, content.contentId ? {
9645
+ contentId: content.contentId
9646
+ } : {});
8497
9647
  var nonceReady = !!macroContext.palNonce;
8498
9648
  var finalUrl;
8499
9649
  if (hasScvpMacros(baseUrl)) {
@@ -8507,6 +9657,31 @@ var AdConfigManager = /*#__PURE__*/ function() {
8507
9657
  } else {
8508
9658
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8509
9659
  }
9660
+ if (isGamAdUrl(finalUrl)) {
9661
+ finalUrl = appendMissingContentParams(finalUrl, content);
9662
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9663
+ finalUrl = applyDeviceKeyValues(finalUrl, device);
9664
+ }
9665
+ }
9666
+ if (this.debug) {
9667
+ var id = envSignals.deviceId;
9668
+ console.log("[AD-IDENTITY]", {
9669
+ source: envSignals.deviceIdSource,
9670
+ idtype: envSignals.deviceIdType,
9671
+ rdidTail: id ? id.slice(-4) : void 0,
9672
+ isLat: envSignals.limitAdTracking,
9673
+ dth: envSignals.deviceTypeHint,
9674
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9675
+ ct_ch: content.channelName,
9676
+ ct_ti: content.programTitle,
9677
+ ct_ne: content.contentNetwork,
9678
+ ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
9679
+ live: isLive,
9680
+ player: playerSize,
9681
+ make: device.make,
9682
+ model: device.model
9683
+ });
9684
+ }
8510
9685
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8511
9686
  return finalUrl;
8512
9687
  }
@@ -8558,7 +9733,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8558
9733
  }
8559
9734
  },
8560
9735
  {
8561
- // --- Tracking ---
8562
9736
  key: "initializeTracking",
8563
9737
  value: function initializeTracking() {
8564
9738
  var _this = this;
@@ -8650,7 +9824,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8650
9824
  }
8651
9825
  },
8652
9826
  {
8653
- // --- Ad stop timer ---
8654
9827
  key: "scheduleAdStopCountdown",
8655
9828
  value: function scheduleAdStopCountdown(remainingMs) {
8656
9829
  var _this = this;
@@ -8682,7 +9855,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8682
9855
  }
8683
9856
  },
8684
9857
  {
8685
- // --- Ad start timer ---
8686
9858
  key: "scheduleAdStartIn",
8687
9859
  value: function scheduleAdStartIn(delayMs) {
8688
9860
  var _this = this;
@@ -8710,7 +9882,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8710
9882
  }
8711
9883
  },
8712
9884
  {
8713
- // --- PTS drift ---
8714
9885
  key: "updatePtsDrift",
8715
9886
  value: function updatePtsDrift(ptsSecondsSample) {
8716
9887
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8736,7 +9907,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8736
9907
  }
8737
9908
  },
8738
9909
  {
8739
- // --- Duration boundary ---
8740
9910
  key: "beginBreakTiming",
8741
9911
  value: function beginBreakTiming(startWallClockMs) {
8742
9912
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8784,7 +9954,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8784
9954
  }
8785
9955
  },
8786
9956
  {
8787
- // --- Duration budget ---
8788
9957
  key: "getWallClockRemainingAdMs",
8789
9958
  value: function getWallClockRemainingAdMs() {
8790
9959
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8933,7 +10102,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8933
10102
  }
8934
10103
  },
8935
10104
  {
8936
- // --- Circuit breaker ---
8937
10105
  key: "isTemporaryAdError",
8938
10106
  value: function isTemporaryAdError(error) {
8939
10107
  var _error_message;
@@ -9067,7 +10235,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9067
10235
  }
9068
10236
  },
9069
10237
  {
9070
- // --- Watchdog ---
9071
10238
  key: "startAdRequestWatchdog",
9072
10239
  value: function startAdRequestWatchdog(token) {
9073
10240
  var _this = this;
@@ -9112,7 +10279,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9112
10279
  }
9113
10280
  },
9114
10281
  {
9115
- // --- Failsafe ---
9116
10282
  key: "startAdFailsafeTimer",
9117
10283
  value: function startAdFailsafeTimer(token) {
9118
10284
  var _this = this;
@@ -9174,7 +10340,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9174
10340
  }
9175
10341
  },
9176
10342
  {
9177
- // --- Reset for ad break end ---
9178
10343
  key: "resetForBreakEnd",
9179
10344
  value: function resetForBreakEnd() {
9180
10345
  this.clearAdStopTimer();
@@ -9373,7 +10538,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9373
10538
  adBehavior: adBehavior
9374
10539
  });
9375
10540
  }
9376
- if (!this.config.autoplay) return [
10541
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9377
10542
  3,
9378
10543
  2
9379
10544
  ];
@@ -9564,6 +10729,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9564
10729
  2
9565
10730
  ];
9566
10731
  this.hasInitialBufferCompleted = true;
10732
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10733
+ this.shouldAutoplayAfterBuffering = false;
10734
+ if (this.debug) {
10735
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10736
+ }
10737
+ }
9567
10738
  if (!this.shouldAutoplayAfterBuffering) return [
9568
10739
  3,
9569
10740
  2
@@ -10221,9 +11392,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10221
11392
  }
10222
11393
  },
10223
11394
  {
10224
- // ───────────────────────────────────────────────────────────────
10225
- // IMA event listeners
10226
- // ───────────────────────────────────────────────────────────────
10227
11395
  key: "nextAdRequestUrl",
10228
11396
  value: function nextAdRequestUrl(baseVastUrl) {
10229
11397
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10459,9 +11627,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10459
11627
  }
10460
11628
  },
10461
11629
  {
10462
- // ───────────────────────────────────────────────────────────────
10463
- // Ad break start
10464
- // ───────────────────────────────────────────────────────────────
10465
11630
  key: "isBreakActive",
10466
11631
  value: function isBreakActive() {
10467
11632
  return this.slotState !== "IDLE";
@@ -10489,7 +11654,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10489
11654
  key: "handleAdStart",
10490
11655
  value: function handleAdStart(marker) {
10491
11656
  return _async_to_generator(function() {
10492
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11657
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10493
11658
  return _ts_generator(this, function(_state) {
10494
11659
  switch(_state.label){
10495
11660
  case 0:
@@ -10502,6 +11667,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10502
11667
  2
10503
11668
  ];
10504
11669
  }
11670
+ screenInactiveReason = getScreenInactiveReason();
11671
+ if (screenInactiveReason) {
11672
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11673
+ reason: screenInactiveReason
11674
+ });
11675
+ this.clearPendingAdBreak();
11676
+ return [
11677
+ 2
11678
+ ];
11679
+ }
10505
11680
  baseVastUrl = this.adConfig.apiVastTagUrl;
10506
11681
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10507
11682
  if (!baseVastUrl && !edgeConfigured) {
@@ -10662,12 +11837,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10662
11837
  },
10663
11838
  {
10664
11839
  key: "startOptimizedPod",
10665
- value: // ───────────────────────────────────────────────────────────────
10666
- // Optimized pod (single multi-ad request)
10667
- // ───────────────────────────────────────────────────────────────
10668
- function startOptimizedPod(baseVastUrl) {
11840
+ value: function startOptimizedPod(baseVastUrl) {
10669
11841
  return _async_to_generator(function() {
10670
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11842
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10671
11843
  return _ts_generator(this, function(_state) {
10672
11844
  switch(_state.label){
10673
11845
  case 0:
@@ -10775,6 +11947,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10775
11947
  false
10776
11948
  ];
10777
11949
  }
11950
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11951
+ ;
11952
+ remainingMs = this.timing.getRemainingAdMs();
11953
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11954
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11955
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11956
+ if (Number.isFinite(remainingMs)) {
11957
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11958
+ if (podCount < 1) {
11959
+ if (this.timing.activeAdRequestToken === requestToken) {
11960
+ this.timing.activeAdRequestToken = null;
11961
+ }
11962
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11963
+ return [
11964
+ 2,
11965
+ false
11966
+ ];
11967
+ }
11968
+ }
11969
+ }
10778
11970
  this.setSlotState("READY", "vast_ready");
10779
11971
  if (this.debug) {
10780
11972
  console.log(podCount === 1 ? "[POD] Response contained a single ad; playing it and enabling pod top-up" : "[POD] Optimized pod returned ".concat(podCount, " ads; playing pod in one controller"));
@@ -10844,9 +12036,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10844
12036
  }
10845
12037
  },
10846
12038
  {
10847
- // ───────────────────────────────────────────────────────────────
10848
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10849
- // ───────────────────────────────────────────────────────────────
10850
12039
  key: "resetEdgeStateForBreak",
10851
12040
  value: function resetEdgeStateForBreak() {
10852
12041
  this.edgeExhaustedForBreak = false;
@@ -11064,9 +12253,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11064
12253
  }
11065
12254
  },
11066
12255
  {
11067
- // ───────────────────────────────────────────────────────────────
11068
- // Next-ad scheduling (single flight)
11069
- // ───────────────────────────────────────────────────────────────
11070
12256
  key: "setSlotState",
11071
12257
  value: function setSlotState(next, reason) {
11072
12258
  if (this.slotState === next) return;
@@ -11116,6 +12302,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11116
12302
  {
11117
12303
  key: "getStopRequestingReason",
11118
12304
  value: function getStopRequestingReason(remainingMs) {
12305
+ var screenInactiveReason = getScreenInactiveReason();
12306
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11119
12307
  if (this.breakSource === "vmap") {
11120
12308
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11121
12309
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11389,9 +12577,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11389
12577
  }
11390
12578
  },
11391
12579
  {
11392
- // ───────────────────────────────────────────────────────────────
11393
- // Per-request diagnostics
11394
- // ───────────────────────────────────────────────────────────────
11395
12580
  key: "recordRequestDiagnostic",
11396
12581
  value: function recordRequestDiagnostic(payload) {
11397
12582
  var requestId = payload.requestId;
@@ -11465,9 +12650,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11465
12650
  }
11466
12651
  },
11467
12652
  {
11468
- // ───────────────────────────────────────────────────────────────
11469
- // Single ad playback
11470
- // ───────────────────────────────────────────────────────────────
11471
12653
  key: "createGamDispatchFinalizer",
11472
12654
  value: function createGamDispatchFinalizer(requestToken) {
11473
12655
  var _this = this;
@@ -11930,9 +13112,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11930
13112
  }
11931
13113
  },
11932
13114
  {
11933
- // ───────────────────────────────────────────────────────────────
11934
- // Ad break completion
11935
- // ───────────────────────────────────────────────────────────────
11936
13115
  key: "logBreakFunnel",
11937
13116
  value: function logBreakFunnel(endReason) {
11938
13117
  var funnel = this.breakFunnel;
@@ -12578,6 +13757,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12578
13757
  return ContentHealthWatchdog;
12579
13758
  }();
12580
13759
  // src/player/StormcloudVideoPlayer.ts
13760
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13761
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12581
13762
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12582
13763
  function StormcloudVideoPlayer(config) {
12583
13764
  var _this = this;
@@ -12588,6 +13769,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12588
13769
  var browserOverrides = getBrowserConfigOverrides();
12589
13770
  this.config = _object_spread({}, browserOverrides, config);
12590
13771
  this.video = config.videoElement;
13772
+ if (this.config.forceSingleDecoderMode != null) {
13773
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13774
+ }
13775
+ if (this.config.adDeviceId) {
13776
+ setHostAdIdentity({
13777
+ deviceId: this.config.adDeviceId,
13778
+ deviceIdType: this.config.adDeviceIdType,
13779
+ limitAdTracking: this.config.adLimitAdTracking
13780
+ });
13781
+ }
13782
+ if (this.config.deviceInfo) {
13783
+ setHostDeviceInfo(this.config.deviceInfo);
13784
+ }
12591
13785
  logBrowserInfo(config.debugAdTiming);
12592
13786
  this.floorLadder = new FloorLadderController();
12593
13787
  this.adPlayer = this.createAdPlayer(false);
@@ -12651,8 +13845,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12651
13845
  },
12652
13846
  hasPendingAdBreak: function hasPendingAdBreak() {
12653
13847
  return _this.adBreak.pendingAdBreak !== null;
13848
+ },
13849
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13850
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12654
13851
  }
12655
13852
  });
13853
+ this.adConfig.isLiveStream = function() {
13854
+ return _this.hlsEngine.isLiveStream;
13855
+ };
12656
13856
  this.adBreak = new AdBreakOrchestrator({
12657
13857
  config: this.config,
12658
13858
  video: this.video,
@@ -12846,10 +14046,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12846
14046
  },
12847
14047
  {
12848
14048
  key: "load",
12849
- value: // ───────────────────────────────────────────────────────────────
12850
- // Lifecycle
12851
- // ───────────────────────────────────────────────────────────────
12852
- function load() {
14049
+ value: function load() {
12853
14050
  return _async_to_generator(function() {
12854
14051
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12855
14052
  return _ts_generator(this, function(_state) {
@@ -12859,6 +14056,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12859
14056
  if (!this.attached) {
12860
14057
  this.attach();
12861
14058
  }
14059
+ primeDeviceInfo().then(function(info) {
14060
+ if (_this.debug) {
14061
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
14062
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
14063
+ }));
14064
+ }
14065
+ }).catch(function() {});
12862
14066
  _state.label = 1;
12863
14067
  case 1:
12864
14068
  _state.trys.push([
@@ -12893,21 +14097,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12893
14097
  fetchConsentSignals().catch(function() {
12894
14098
  return {};
12895
14099
  }).then(function(signals) {
12896
- var _this_config_lowLatencyMode;
14100
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12897
14101
  _this.adConfig.consentSignals = signals;
12898
14102
  var muted = _this.video.muted;
12899
- return _this.palNonce.generateNonce(_object_spread({
14103
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
14104
+ var palOptions = _object_spread({
12900
14105
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12901
14106
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12902
14107
  adWillAutoPlay: !!_this.config.autoplay,
12903
14108
  adWillPlayMuted: muted,
12904
14109
  playerVolume: muted ? 0 : _this.video.volume,
12905
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
14110
+ continuousPlayback: (_this_config_palContinuousPlayback = _this.config.palContinuousPlayback) !== null && _this_config_palContinuousPlayback !== void 0 ? _this_config_palContinuousPlayback : _this.config.ctvAdRequest ? true : (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false,
14111
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
14112
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12906
14113
  }, palDescriptionUrl ? {
12907
14114
  descriptionUrl: palDescriptionUrl
12908
14115
  } : {}, signals.storageAllowed != null ? {
12909
14116
  allowStorage: signals.storageAllowed
12910
- } : {}));
14117
+ } : {}, palSessionId ? {
14118
+ sessionId: palSessionId
14119
+ } : {});
14120
+ _this.lastPalOptions = palOptions;
14121
+ _this.palSessionId = palSessionId;
14122
+ _this.startPalNonceRefresh();
14123
+ return _this.palNonce.generateNonce(palOptions);
12911
14124
  }).catch(function() {});
12912
14125
  this.adConfig.initializeTracking();
12913
14126
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12945,6 +14158,96 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12945
14158
  }).call(this);
12946
14159
  }
12947
14160
  },
14161
+ {
14162
+ key: "startPalNonceRefresh",
14163
+ value: function startPalNonceRefresh() {
14164
+ var _this = this;
14165
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
14166
+ this.palRefreshTimer = window.setInterval(function() {
14167
+ return _this.refreshPalNonceIfStale();
14168
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
14169
+ }
14170
+ },
14171
+ {
14172
+ key: "refreshPalNonceIfStale",
14173
+ value: function refreshPalNonceIfStale() {
14174
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
14175
+ var _this_config_palNonceMaxAgeMs;
14176
+ var options = this.lastPalOptions;
14177
+ if (!options) return;
14178
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
14179
+ var ageMs = this.palNonce.getNonceAgeMs();
14180
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
14181
+ var sessionChanged = sessionId !== this.palSessionId;
14182
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
14183
+ if (!force && !stale && !sessionChanged) return;
14184
+ var next = _object_spread({}, options);
14185
+ if (sessionId) next.sessionId = sessionId;
14186
+ else delete next.sessionId;
14187
+ this.lastPalOptions = next;
14188
+ this.palSessionId = sessionId;
14189
+ if (this.debug) {
14190
+ console.log("[PAL] Regenerating nonce", {
14191
+ force: force,
14192
+ stale: stale,
14193
+ sessionChanged: sessionChanged,
14194
+ ageMs: ageMs
14195
+ });
14196
+ }
14197
+ this.palNonce.generateNonce(next).catch(function() {});
14198
+ }
14199
+ },
14200
+ {
14201
+ key: "setAdIdentity",
14202
+ value: function setAdIdentity(identity) {
14203
+ setHostAdIdentity(identity);
14204
+ this.refreshPalNonceIfStale();
14205
+ }
14206
+ },
14207
+ {
14208
+ key: "resetAdIdentity",
14209
+ value: function resetAdIdentity1() {
14210
+ resetAdIdentity();
14211
+ this.refreshPalNonceIfStale(true);
14212
+ }
14213
+ },
14214
+ {
14215
+ key: "setContentMetadata",
14216
+ value: function setContentMetadata(meta) {
14217
+ applyContentMetadataUpdate(this.config, meta);
14218
+ }
14219
+ },
14220
+ {
14221
+ key: "setRequestSignals",
14222
+ value: function setRequestSignals(signals) {
14223
+ if (signals.userId !== void 0) {
14224
+ if (signals.userId) this.config.adUserId = signals.userId;
14225
+ else delete this.config.adUserId;
14226
+ }
14227
+ if (signals.ipAddress !== void 0) {
14228
+ if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
14229
+ else delete this.config.clientIpAddress;
14230
+ }
14231
+ }
14232
+ },
14233
+ {
14234
+ key: "setScreenStandby",
14235
+ value: function setScreenStandby(standby) {
14236
+ setHostStandby(standby);
14237
+ }
14238
+ },
14239
+ {
14240
+ key: "getDeviceInfo",
14241
+ value: function getDeviceInfo1() {
14242
+ return getDeviceInfo();
14243
+ }
14244
+ },
14245
+ {
14246
+ key: "setDeviceInfo",
14247
+ value: function setDeviceInfo(info) {
14248
+ setHostDeviceInfo(info);
14249
+ }
14250
+ },
12948
14251
  {
12949
14252
  key: "onManifestParsed",
12950
14253
  value: function onManifestParsed(isLive) {
@@ -13079,9 +14382,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13079
14382
  }
13080
14383
  },
13081
14384
  {
13082
- // ───────────────────────────────────────────────────────────────
13083
- // SCTE-35 marker orchestration
13084
- // ───────────────────────────────────────────────────────────────
13085
14385
  key: "onScte35Marker",
13086
14386
  value: function onScte35Marker(marker, cueKey) {
13087
14387
  if (this.debug) {
@@ -13260,9 +14560,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13260
14560
  }
13261
14561
  },
13262
14562
  {
13263
- // ───────────────────────────────────────────────────────────────
13264
- // Ad prefetch
13265
- // ───────────────────────────────────────────────────────────────
13266
14563
  key: "startAdPrefetch",
13267
14564
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13268
14565
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13301,9 +14598,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13301
14598
  }
13302
14599
  },
13303
14600
  {
13304
- // ───────────────────────────────────────────────────────────────
13305
- // VMAP time-based ad breaks
13306
- // ───────────────────────────────────────────────────────────────
13307
14601
  key: "onTimeUpdate",
13308
14602
  value: function onTimeUpdate(currentTimeSec) {
13309
14603
  var _this = this;
@@ -13417,9 +14711,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13417
14711
  }
13418
14712
  },
13419
14713
  {
13420
- // ───────────────────────────────────────────────────────────────
13421
- // Public API
13422
- // ───────────────────────────────────────────────────────────────
13423
14714
  key: "getCurrentAdIndex",
13424
14715
  value: function getCurrentAdIndex() {
13425
14716
  return this.timing.currentAdIndex;
@@ -13538,12 +14829,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13538
14829
  }
13539
14830
  },
13540
14831
  {
13541
- // ───────────────────────────────────────────────────────────────
13542
- // Destroy
13543
- // ───────────────────────────────────────────────────────────────
13544
14832
  key: "destroy",
13545
14833
  value: function destroy() {
13546
14834
  var _this_adPlayer;
14835
+ if (this.palRefreshTimer != null) {
14836
+ clearInterval(this.palRefreshTimer);
14837
+ this.palRefreshTimer = void 0;
14838
+ }
13547
14839
  this.contentWatchdog.stop();
13548
14840
  this.adBreak.cancelScheduledRequest();
13549
14841
  this.timing.destroy();