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
@@ -409,8 +409,264 @@ __export(HlsPlayer_exports, {
409
409
  });
410
410
  module.exports = __toCommonJS(HlsPlayer_exports);
411
411
  var import_react = require("react");
412
+ // src/utils/adIdentity.ts
413
+ var GOOGLE_ID_TYPES = [
414
+ "aaid",
415
+ "adid",
416
+ "afai",
417
+ "idfa",
418
+ "lgudid",
419
+ "msai",
420
+ "rida",
421
+ "tifa",
422
+ "tvOS",
423
+ "vaid",
424
+ "vida",
425
+ "dpid"
426
+ ];
427
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
428
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
429
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
430
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
431
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
432
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
433
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
434
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
435
+ "00000000-0000-0000-0000-000000000000",
436
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
437
+ ]);
438
+ var hostIdentity;
439
+ var memoryStore = {};
440
+ var lgUdidResult;
441
+ var lgUdidPromise;
442
+ var legacyCleared = false;
443
+ function isUsableAdId(value) {
444
+ if (typeof value !== "string") return false;
445
+ var t = value.trim();
446
+ if (!t) return false;
447
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
448
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
449
+ return !ZEROED_IDS.has(t.toLowerCase());
450
+ }
451
+ function isZeroedAdId(value) {
452
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
453
+ }
454
+ function normalizeIdType(value) {
455
+ if (typeof value !== "string") return void 0;
456
+ var lower = value.trim().toLowerCase();
457
+ if (!lower) return void 0;
458
+ var match = GOOGLE_ID_TYPES.find(function(t) {
459
+ return t.toLowerCase() === lower;
460
+ });
461
+ return match !== null && match !== void 0 ? match : "dpid";
462
+ }
463
+ function createUuid() {
464
+ var _bytes_, _bytes_1, _bytes_i;
465
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
466
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
467
+ var bytes = new Uint8Array(16);
468
+ if (c && typeof c.getRandomValues === "function") {
469
+ c.getRandomValues(bytes);
470
+ } else {
471
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
472
+ }
473
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
474
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
475
+ var hex = "";
476
+ 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");
477
+ 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));
478
+ }
479
+ function readStored(key) {
480
+ try {
481
+ var _window_localStorage;
482
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
483
+ if (raw) {
484
+ var parsed = JSON.parse(raw);
485
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
486
+ return {
487
+ id: parsed.id,
488
+ createdAt: parsed.createdAt
489
+ };
490
+ }
491
+ }
492
+ } catch (unused) {}
493
+ return memoryStore[key];
494
+ }
495
+ function writeStored(key, value) {
496
+ memoryStore[key] = value;
497
+ try {
498
+ if (typeof window !== "undefined") {
499
+ var _window_localStorage;
500
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
501
+ }
502
+ } catch (unused) {}
503
+ }
504
+ function removeStored(key) {
505
+ delete memoryStore[key];
506
+ try {
507
+ var _window_localStorage;
508
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
509
+ } catch (unused) {}
510
+ }
511
+ function clearLegacyIdsOnce() {
512
+ if (legacyCleared) return;
513
+ legacyCleared = true;
514
+ try {
515
+ var _window_localStorage;
516
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
517
+ } catch (unused) {}
518
+ try {
519
+ if (typeof document !== "undefined") {
520
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
521
+ }
522
+ } catch (unused) {}
523
+ }
524
+ function clampAge(value, fallback, max) {
525
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
526
+ if (max != null) v = Math.min(v, max);
527
+ return v;
528
+ }
529
+ function setHostAdIdentity(identity) {
530
+ var _normalizeIdType;
531
+ if (!identity || !isUsableAdId(identity.deviceId)) {
532
+ hostIdentity = void 0;
533
+ return;
534
+ }
535
+ var deviceId = identity.deviceId.trim();
536
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
537
+ hostIdentity = _object_spread({
538
+ deviceId: deviceId,
539
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
540
+ }, typeof identity.limitAdTracking === "boolean" ? {
541
+ limitAdTracking: identity.limitAdTracking
542
+ } : {});
543
+ if (changed) {
544
+ removeStored(SESSION_ID_KEY);
545
+ removeStored(FALLBACK_DEVICE_ID_KEY);
546
+ }
547
+ }
548
+ function getHostAdIdentity() {
549
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
550
+ }
551
+ function resetAdIdentity() {
552
+ removeStored(SESSION_ID_KEY);
553
+ removeStored(FALLBACK_DEVICE_ID_KEY);
554
+ }
555
+ function readSamsungTifa() {
556
+ try {
557
+ var _window_webapis;
558
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
559
+ if (!adinfo) return void 0;
560
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
561
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
562
+ if (isZeroedAdId(tifa)) return {
563
+ deviceIdType: "tifa",
564
+ limitAdTracking: true
565
+ };
566
+ if (!isUsableAdId(tifa)) return void 0;
567
+ return _object_spread({
568
+ deviceId: tifa.trim(),
569
+ deviceIdType: "tifa"
570
+ }, typeof lat === "boolean" ? {
571
+ limitAdTracking: lat
572
+ } : {});
573
+ } catch (unused) {
574
+ return void 0;
575
+ }
576
+ }
577
+ function primeLgUdid() {
578
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
579
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
580
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
581
+ if (!dev) return Promise.resolve();
582
+ if (typeof dev.LGUDID !== "function") {
583
+ var _dev_lgudid;
584
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
585
+ if (isZeroedAdId(direct)) lgUdidResult = {
586
+ deviceIdType: "lgudid",
587
+ limitAdTracking: true
588
+ };
589
+ else if (isUsableAdId(direct)) {
590
+ lgUdidResult = {
591
+ deviceId: direct.trim(),
592
+ deviceIdType: "lgudid",
593
+ limitAdTracking: false
594
+ };
595
+ }
596
+ return Promise.resolve();
597
+ }
598
+ lgUdidPromise = new Promise(function(resolve) {
599
+ var settled = false;
600
+ var finish = function finish() {
601
+ if (settled) return;
602
+ settled = true;
603
+ clearTimeout(timer);
604
+ resolve();
605
+ };
606
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
607
+ try {
608
+ dev.LGUDID({
609
+ onSuccess: function onSuccess(res) {
610
+ var id = res === null || res === void 0 ? void 0 : res.id;
611
+ if (isZeroedAdId(id)) {
612
+ lgUdidResult = {
613
+ deviceIdType: "lgudid",
614
+ limitAdTracking: true
615
+ };
616
+ } else if (isUsableAdId(id)) {
617
+ lgUdidResult = {
618
+ deviceId: id.trim(),
619
+ deviceIdType: "lgudid",
620
+ limitAdTracking: false
621
+ };
622
+ }
623
+ finish();
624
+ },
625
+ onFailure: function onFailure() {
626
+ return finish();
627
+ }
628
+ });
629
+ } catch (unused) {
630
+ finish();
631
+ }
632
+ });
633
+ return lgUdidPromise;
634
+ }
635
+ function readCachedLgUdid() {
636
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
637
+ }
638
+ function getOrRotateFallbackDeviceId() {
639
+ 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();
640
+ clearLegacyIdsOnce();
641
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
642
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
643
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
644
+ return stored.id;
645
+ }
646
+ var id = createUuid();
647
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
648
+ id: id,
649
+ createdAt: now
650
+ });
651
+ return id;
652
+ }
653
+ function getOrRotateSessionId() {
654
+ 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();
655
+ clearLegacyIdsOnce();
656
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
657
+ var stored = readStored(SESSION_ID_KEY);
658
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
659
+ return stored.id;
660
+ }
661
+ var id = createUuid();
662
+ while(id === avoidValue)id = createUuid();
663
+ writeStored(SESSION_ID_KEY, {
664
+ id: id,
665
+ createdAt: now
666
+ });
667
+ return id;
668
+ }
412
669
  // src/utils/vastEnvironmentSignals.ts
413
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
414
670
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
415
671
  var DEVICE_ID_STORAGE_KEYS = [
416
672
  "rdid",
@@ -429,49 +685,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
429
685
  "adid"
430
686
  ]);
431
687
  function resolveVastEnvironmentSignals(isCtv) {
432
- var bridgeSignals = readNativeBridgeSignals();
433
- var platformDevice = readPlatformNativeDeviceId();
434
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
435
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
436
- var deviceId = realDeviceId;
437
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
438
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
439
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
440
- if (!deviceId && isCtv) {
441
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
442
- if (dpid) {
443
- deviceId = dpid;
444
- deviceIdType = "dpid";
445
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
446
- }
447
- }
688
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
448
689
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
690
+ var identity = resolveDeviceIdentity(isCtv, options);
691
+ var identityFields = _object_spread({}, identity.deviceId ? {
692
+ deviceId: identity.deviceId
693
+ } : {}, identity.deviceId && identity.deviceIdType ? {
694
+ deviceIdType: identity.deviceIdType
695
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
696
+ limitAdTracking: identity.limitAdTracking
697
+ } : {}, identity.source ? {
698
+ deviceIdSource: identity.source
699
+ } : {});
449
700
  if (isCtv) {
450
701
  return _object_spread_props(_object_spread({
451
702
  isCtv: true,
452
- sessionId: getOrCreateCtvSessionId()
453
- }, deviceId ? {
454
- deviceId: deviceId
455
- } : {}, deviceId && deviceIdType ? {
456
- deviceIdType: deviceIdType
457
- } : {}, deviceId && limitAdTracking != null ? {
458
- limitAdTracking: limitAdTracking
459
- } : {}), {
703
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
704
+ }, identityFields), {
460
705
  deviceTypeHint: deviceTypeHint
461
706
  });
462
707
  }
463
708
  return _object_spread_props(_object_spread({
464
709
  isCtv: false
465
- }, deviceId ? {
466
- deviceId: deviceId
467
- } : {}, deviceId && deviceIdType ? {
468
- deviceIdType: deviceIdType
469
- } : {}, deviceId && limitAdTracking != null ? {
470
- limitAdTracking: limitAdTracking
471
- } : {}), {
710
+ }, identityFields), {
472
711
  deviceTypeHint: deviceTypeHint
473
712
  });
474
713
  }
714
+ function resolveDeviceIdentity(isCtv, options) {
715
+ var _platform_limitAdTracking;
716
+ var host = getHostAdIdentity();
717
+ if (host) {
718
+ var _host_deviceIdType;
719
+ return _object_spread_props(_object_spread({
720
+ deviceId: host.deviceId,
721
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
722
+ }, host.limitAdTracking != null ? {
723
+ limitAdTracking: host.limitAdTracking
724
+ } : {}), {
725
+ source: "host"
726
+ });
727
+ }
728
+ var bridge = readNativeBridgeSignals();
729
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
730
+ if (bridgeDeviceId) {
731
+ var _normalizeIdType;
732
+ return _object_spread_props(_object_spread({
733
+ deviceId: bridgeDeviceId,
734
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
735
+ }, bridge.limitAdTracking != null ? {
736
+ limitAdTracking: bridge.limitAdTracking
737
+ } : {}), {
738
+ source: "bridge"
739
+ });
740
+ }
741
+ var platform = readPlatformNativeDeviceId();
742
+ var platformDeviceId = validDeviceId(platform.deviceId);
743
+ if (platformDeviceId) {
744
+ var _platform_deviceIdType;
745
+ return _object_spread_props(_object_spread({
746
+ deviceId: platformDeviceId,
747
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
748
+ }, platform.limitAdTracking != null ? {
749
+ limitAdTracking: platform.limitAdTracking
750
+ } : {}), {
751
+ source: "platform"
752
+ });
753
+ }
754
+ if (!isCtv) return {};
755
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
756
+ if (storedDeviceId) {
757
+ var _normalizeIdType1;
758
+ var storedLat = readStoredLimitAdTracking();
759
+ return _object_spread_props(_object_spread({
760
+ deviceId: storedDeviceId,
761
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
762
+ }, storedLat != null ? {
763
+ limitAdTracking: storedLat
764
+ } : {}), {
765
+ source: "stored"
766
+ });
767
+ }
768
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
769
+ return _object_spread_props(_object_spread({
770
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
771
+ deviceIdType: "dpid"
772
+ }, fallbackLat != null ? {
773
+ limitAdTracking: fallbackLat
774
+ } : {}), {
775
+ source: "generated"
776
+ });
777
+ }
475
778
  var DEVICE_TYPE_HINT = {
476
779
  FEATURE_PHONE: 1,
477
780
  SMARTPHONE: 2,
@@ -632,7 +935,7 @@ function resolveNativeDeviceId() {
632
935
  var bridgeSignals = readNativeBridgeSignals();
633
936
  var platformDevice = readPlatformNativeDeviceId();
634
937
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
635
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
938
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
636
939
  return void 0;
637
940
  }
638
941
  return deviceId;
@@ -646,20 +949,10 @@ function getOrCreateStoredUuid(storageKey) {
646
949
  writePersistentId(storageKey, existing);
647
950
  return existing;
648
951
  }
649
- var id = createUuid();
952
+ var id = createUuid2();
650
953
  writePersistentId(storageKey, id);
651
954
  return id;
652
955
  }
653
- function getOrCreateCtvSessionId() {
654
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
655
- if (existing) {
656
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
657
- return existing;
658
- }
659
- var sessionId = createUuid();
660
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
661
- return sessionId;
662
- }
663
956
  function readPersistentId(storageKey) {
664
957
  return readStoredString(storageKey) || readCookie(storageKey);
665
958
  }
@@ -712,7 +1005,7 @@ function writeCookie(name, value) {
712
1005
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
713
1006
  } catch (unused) {}
714
1007
  }
715
- function createUuid() {
1008
+ function createUuid2() {
716
1009
  var _bytes_, _bytes_1;
717
1010
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
718
1011
  return crypto.randomUUID();
@@ -746,44 +1039,10 @@ function performanceNow() {
746
1039
  }
747
1040
  function readPlatformNativeDeviceId() {
748
1041
  if (typeof window === "undefined") return {};
749
- try {
750
- var _window_webapis;
751
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
752
- if (adinfo) {
753
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
754
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
755
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
756
- return _object_spread({
757
- deviceId: tifa,
758
- deviceIdType: "tifa"
759
- }, typeof lat === "boolean" ? {
760
- limitAdTracking: lat
761
- } : {});
762
- }
763
- }
764
- } catch (unused) {}
765
- try {
766
- var webOSDev = window.webOSDev;
767
- if (webOSDev) {
768
- var _webOSDev_lgudid;
769
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
770
- if (typeof lgudid === "string" && lgudid) {
771
- if (isZeroedAdId(lgudid)) {
772
- return {
773
- deviceIdType: "lgudid",
774
- limitAdTracking: true
775
- };
776
- }
777
- if (!isMacroPlaceholder(lgudid)) {
778
- return {
779
- deviceId: lgudid,
780
- deviceIdType: "lgudid",
781
- limitAdTracking: false
782
- };
783
- }
784
- }
785
- }
786
- } catch (unused) {}
1042
+ var tifa = readSamsungTifa();
1043
+ if (tifa) return tifa;
1044
+ var lgudid = readCachedLgUdid();
1045
+ if (lgudid) return lgudid;
787
1046
  try {
788
1047
  var roku = window.Roku;
789
1048
  if (roku) {
@@ -810,7 +1069,7 @@ function isMacroPlaceholder(value) {
810
1069
  function validDeviceId(value) {
811
1070
  return value && !isMacroPlaceholder(value) ? value : void 0;
812
1071
  }
813
- function isZeroedAdId(value) {
1072
+ function isZeroedAdId2(value) {
814
1073
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
815
1074
  }
816
1075
  function readNativeBridgeSignals() {
@@ -854,7 +1113,7 @@ function readNativeBridgeSignals() {
854
1113
  "deviceIdType",
855
1114
  "advertisingIdType",
856
1115
  "idType"
857
- ]) || inferDeviceIdType();
1116
+ ]) || void 0;
858
1117
  var limitAdTracking = readBridgeBoolean(source, [
859
1118
  "is_lat",
860
1119
  "limitAdTracking",
@@ -1034,6 +1293,308 @@ function normalizeBoolean(value) {
1034
1293
  }
1035
1294
  return void 0;
1036
1295
  }
1296
+ // src/utils/contentMetadata.ts
1297
+ var MAX_CONTENT_VALUE_LENGTH = 128;
1298
+ var BRIDGE_KEYS = {
1299
+ channelName: [
1300
+ "channelName",
1301
+ "ct_ch"
1302
+ ],
1303
+ programTitle: [
1304
+ "programTitle",
1305
+ "ct_ti"
1306
+ ],
1307
+ contentNetwork: [
1308
+ "contentNetwork",
1309
+ "ct_ne"
1310
+ ],
1311
+ contentType: [
1312
+ "contentType",
1313
+ "ctt"
1314
+ ],
1315
+ contentCategory: [
1316
+ "contentCategory",
1317
+ "ctc"
1318
+ ],
1319
+ contentGenre: [
1320
+ "contentGenre",
1321
+ "ctgr"
1322
+ ],
1323
+ contentLanguage: [
1324
+ "contentLanguage",
1325
+ "ctlg"
1326
+ ],
1327
+ contentDuration: [
1328
+ "contentDuration",
1329
+ "ctd"
1330
+ ],
1331
+ contentSeason: [
1332
+ "contentSeason",
1333
+ "cts"
1334
+ ],
1335
+ contentEpisode: [
1336
+ "contentEpisode",
1337
+ "cte"
1338
+ ],
1339
+ contentRating: [
1340
+ "contentRating",
1341
+ "ctr"
1342
+ ],
1343
+ contentId: [
1344
+ "contentId",
1345
+ "ctid"
1346
+ ]
1347
+ };
1348
+ function sanitizeContentValue(value) {
1349
+ if (typeof value !== "string") return void 0;
1350
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1351
+ if (!cleaned) return void 0;
1352
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1353
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
1354
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1355
+ }
1356
+ function sanitizeContentScalar(value) {
1357
+ if (typeof value === "number") {
1358
+ return Number.isFinite(value) ? String(value) : void 0;
1359
+ }
1360
+ return sanitizeContentValue(value);
1361
+ }
1362
+ function normalizeContentLanguage(value) {
1363
+ var cleaned = sanitizeContentValue(value);
1364
+ if (!cleaned) return void 0;
1365
+ var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
1366
+ return match && match[1] ? match[1].toLowerCase() : void 0;
1367
+ }
1368
+ function normalizeContentDuration(value) {
1369
+ var raw = sanitizeContentScalar(value);
1370
+ if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
1371
+ var seconds = Number(raw);
1372
+ if (seconds === -1) return -1;
1373
+ return seconds > 0 ? Math.round(seconds) : void 0;
1374
+ }
1375
+ function bridgeSources() {
1376
+ if (typeof window === "undefined") return [];
1377
+ var w = window;
1378
+ return [
1379
+ w.__STORMCLOUD_CTV__,
1380
+ w.__STORMCLOUD_CTV_AD_INFO__,
1381
+ w.stormcloudCtv
1382
+ ].filter(Boolean);
1383
+ }
1384
+ function readBridgeValue2(keys, sanitize) {
1385
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1386
+ try {
1387
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1388
+ var source = _step.value;
1389
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1390
+ try {
1391
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1392
+ var key = _step1.value;
1393
+ var value = void 0;
1394
+ try {
1395
+ value = source === null || source === void 0 ? void 0 : source[key];
1396
+ if (typeof value === "function") value = value.call(source);
1397
+ } catch (unused) {
1398
+ value = void 0;
1399
+ }
1400
+ var sanitized = sanitize(value);
1401
+ if (sanitized != null) return sanitized;
1402
+ }
1403
+ } catch (err) {
1404
+ _didIteratorError1 = true;
1405
+ _iteratorError1 = err;
1406
+ } finally{
1407
+ try {
1408
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1409
+ _iterator1.return();
1410
+ }
1411
+ } finally{
1412
+ if (_didIteratorError1) {
1413
+ throw _iteratorError1;
1414
+ }
1415
+ }
1416
+ }
1417
+ }
1418
+ } catch (err) {
1419
+ _didIteratorError = true;
1420
+ _iteratorError = err;
1421
+ } finally{
1422
+ try {
1423
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1424
+ _iterator.return();
1425
+ }
1426
+ } finally{
1427
+ if (_didIteratorError) {
1428
+ throw _iteratorError;
1429
+ }
1430
+ }
1431
+ }
1432
+ return void 0;
1433
+ }
1434
+ function readBridgeContentValue(keys) {
1435
+ return readBridgeValue2(keys, sanitizeContentValue);
1436
+ }
1437
+ function resolveContentMetadata(config) {
1438
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
1439
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1440
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1441
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1442
+ var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
1443
+ var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
1444
+ var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
1445
+ var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
1446
+ var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
1447
+ var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
1448
+ var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
1449
+ var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
1450
+ var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
1451
+ var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
1452
+ return _object_spread({}, channelName ? {
1453
+ channelName: channelName
1454
+ } : {}, programTitle ? {
1455
+ programTitle: programTitle
1456
+ } : {}, contentNetwork ? {
1457
+ contentNetwork: contentNetwork
1458
+ } : {}, contentType ? {
1459
+ contentType: contentType
1460
+ } : {}, contentCategory ? {
1461
+ contentCategory: contentCategory
1462
+ } : {}, contentGenre ? {
1463
+ contentGenre: contentGenre
1464
+ } : {}, contentLanguage ? {
1465
+ contentLanguage: contentLanguage
1466
+ } : {}, contentDurationSeconds != null ? {
1467
+ contentDurationSeconds: contentDurationSeconds
1468
+ } : {}, contentSeason ? {
1469
+ contentSeason: contentSeason
1470
+ } : {}, contentEpisode ? {
1471
+ contentEpisode: contentEpisode
1472
+ } : {}, contentRating ? {
1473
+ contentRating: contentRating
1474
+ } : {}, contentId ? {
1475
+ contentId: contentId
1476
+ } : {});
1477
+ }
1478
+ function applyContentMetadataUpdate(target, meta) {
1479
+ var apply = function apply(key, value) {
1480
+ if (value === void 0) return;
1481
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
1482
+ if (clean) target[key] = clean;
1483
+ else delete target[key];
1484
+ };
1485
+ apply("channelName", meta.channelName);
1486
+ apply("programTitle", meta.programTitle);
1487
+ apply("contentNetwork", meta.contentNetwork);
1488
+ if (meta.details === void 0) return;
1489
+ if (meta.details === null) delete target.contentDetails;
1490
+ else target.contentDetails = _object_spread({}, meta.details);
1491
+ }
1492
+ function appendMissingContentParams(url, meta) {
1493
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1494
+ try {
1495
+ var parsed = new URL(url);
1496
+ var add = function add(key, value) {
1497
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1498
+ };
1499
+ add("ct_ch", meta.channelName);
1500
+ add("ct_ti", meta.programTitle);
1501
+ add("ct_ne", meta.contentNetwork);
1502
+ return parsed.toString();
1503
+ } catch (unused) {
1504
+ return url;
1505
+ }
1506
+ }
1507
+ // src/utils/partnerSignals.ts
1508
+ var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
1509
+ "aaid",
1510
+ "adid",
1511
+ "afai",
1512
+ "idfa",
1513
+ "lgudid",
1514
+ "msai",
1515
+ "rida",
1516
+ "tifa",
1517
+ "tvos",
1518
+ "vaid",
1519
+ "vida"
1520
+ ]);
1521
+ function toIabIfaType(deviceIdType, source) {
1522
+ if (!deviceIdType) return void 0;
1523
+ var type = deviceIdType.trim().toLowerCase();
1524
+ if (source === "generated") return "sessionid";
1525
+ if (PLATFORM_IFA_TYPES.has(type)) return type;
1526
+ if (source === "platform") return "dpid";
1527
+ return "ppid";
1528
+ }
1529
+ function playbackMethodCode(autoPlay, muted) {
1530
+ if (autoPlay === false) return 3;
1531
+ if (autoPlay !== true || muted == null) return void 0;
1532
+ return muted ? 2 : 1;
1533
+ }
1534
+ function resolvePlayerSize(video) {
1535
+ var width = video ? video.clientWidth : 0;
1536
+ var height = video ? video.clientHeight : 0;
1537
+ if (!(width > 0 && height > 0) && typeof window !== "undefined") {
1538
+ width = window.innerWidth;
1539
+ height = window.innerHeight;
1540
+ }
1541
+ if (!(width > 0 && height > 0)) return {};
1542
+ return {
1543
+ width: Math.round(width),
1544
+ height: Math.round(height)
1545
+ };
1546
+ }
1547
+ function sanitizeUserId(value) {
1548
+ var cleaned = sanitizeContentValue(value);
1549
+ if (!cleaned || /\s/.test(cleaned)) return void 0;
1550
+ return cleaned;
1551
+ }
1552
+ function isPublicIpv4(ip) {
1553
+ var parts = ip.split(".");
1554
+ if (parts.length !== 4) return false;
1555
+ var nums = parts.map(function(p) {
1556
+ return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
1557
+ });
1558
+ if (nums.some(function(n) {
1559
+ return !(n >= 0 && n <= 255);
1560
+ })) return false;
1561
+ var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
1562
+ if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
1563
+ if (a === 100 && b >= 64 && b <= 127) return false;
1564
+ if (a === 169 && b === 254) return false;
1565
+ if (a === 172 && b >= 16 && b <= 31) return false;
1566
+ if (a === 192 && b === 168) return false;
1567
+ return true;
1568
+ }
1569
+ function isPublicIpv6(ip) {
1570
+ var lower = ip.toLowerCase();
1571
+ if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
1572
+ if (lower === "::" || lower === "::1") return false;
1573
+ if (/^fe[89ab]/.test(lower)) return false;
1574
+ if (/^f[cd]/.test(lower)) return false;
1575
+ return true;
1576
+ }
1577
+ function sanitizePublicIp(value) {
1578
+ var cleaned = sanitizeContentValue(value);
1579
+ if (!cleaned) return void 0;
1580
+ if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
1581
+ return isPublicIpv6(cleaned) ? cleaned : void 0;
1582
+ }
1583
+ function resolveUserId(configValue) {
1584
+ var _sanitizeUserId;
1585
+ return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
1586
+ "userId",
1587
+ "uid"
1588
+ ], sanitizeUserId);
1589
+ }
1590
+ function resolveClientIp(configValue) {
1591
+ var _sanitizePublicIp;
1592
+ return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
1593
+ "ipAddress",
1594
+ "clientIp",
1595
+ "ip"
1596
+ ], sanitizePublicIp);
1597
+ }
1037
1598
  // src/utils/vastMacros.ts
1038
1599
  var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
1039
1600
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
@@ -1351,7 +1912,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
1351
1912
  var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
1352
1913
  "PMND",
1353
1914
  "PMXD",
1354
- "PMAD"
1915
+ "PMAD",
1916
+ "MABD"
1355
1917
  ]);
1356
1918
  function hasScvpMacros(url) {
1357
1919
  return !!url && SCVP_MACRO_DETECT.test(url);
@@ -1396,12 +1958,15 @@ function resolveScvpMacroValues(ctx) {
1396
1958
  set("RDID", deviceId);
1397
1959
  set("IDTYPE", deviceIdType);
1398
1960
  set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
1961
+ set("IFA", deviceId);
1962
+ set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
1399
1963
  }
1400
1964
  set("SID", ctx.sessionId);
1401
1965
  set("DTH", ctx.deviceTypeHint);
1402
1966
  set("GIVN", ctx.palNonce);
1403
1967
  set("CT-TI", ctx.programTitle);
1404
1968
  set("CT-CH", ctx.channelName);
1969
+ set("CT-NE", ctx.contentNetwork);
1405
1970
  set("POD", ctx.pod);
1406
1971
  set("CORRELATOR", ctx.correlator);
1407
1972
  set("SCOR", ctx.streamCorrelator);
@@ -1412,6 +1977,26 @@ function resolveScvpMacroValues(ctx) {
1412
1977
  set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
1413
1978
  set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
1414
1979
  set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
1980
+ set("PLAYER-WIDTH", ctx.playerWidth);
1981
+ set("PLAYER-HEIGHT", ctx.playerHeight);
1982
+ set("TIMESTAMP", ctx.timestamp);
1983
+ set("LIVE", toFlag(ctx.isLive));
1984
+ set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
1985
+ set("DEVICE-MAKE", ctx.deviceMake);
1986
+ set("DEVICE-MODEL", ctx.deviceModel);
1987
+ set("DEVICE-HWV", ctx.deviceHardwareVersion);
1988
+ set("UA", ctx.userAgent);
1989
+ set("IP", ctx.ipAddress);
1990
+ set("UID", ctx.userId);
1991
+ set("CT-TYPE", ctx.contentType);
1992
+ set("CT-CATEGORY", ctx.contentCategory);
1993
+ set("CT-GENRE", ctx.contentGenre);
1994
+ set("CT-LANGUAGE", ctx.contentLanguage);
1995
+ set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
1996
+ set("CT-SEASON", ctx.contentSeason);
1997
+ set("CT-EPISODE", ctx.contentEpisode);
1998
+ set("CT-RATING", ctx.contentRating);
1999
+ set("CT-ID", ctx.contentId);
1415
2000
  return values;
1416
2001
  }
1417
2002
  var keepNone = function keepNone() {
@@ -1630,6 +2215,9 @@ function applyVastMacros(baseUrl, ctx) {
1630
2215
  if (ctx.channelName) {
1631
2216
  params.set("ct_ch", ctx.channelName);
1632
2217
  }
2218
+ if (ctx.contentNetwork) {
2219
+ params.set("ct_ne", ctx.contentNetwork);
2220
+ }
1633
2221
  var staleKeys = [];
1634
2222
  params.forEach(function(value, key) {
1635
2223
  if (isMacroPlaceholder2(value)) {
@@ -2294,8 +2882,17 @@ function detectBrowser() {
2294
2882
  chromeVersion: chromeVersionNum
2295
2883
  };
2296
2884
  }
2885
+ var singleDecoderOverride;
2886
+ function setSingleDecoderOverride(value) {
2887
+ singleDecoderOverride = value;
2888
+ }
2297
2889
  function requiresMediaPipelineResetAfterAds() {
2298
2890
  var _browser_tizenVersion;
2891
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2892
+ try {
2893
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2894
+ if (typeof globalOverride === "boolean") return globalOverride;
2895
+ } catch (unused) {}
2299
2896
  var browser = detectBrowser();
2300
2897
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2301
2898
  }
@@ -2455,7 +3052,7 @@ function substituteVastTrackingMacros(url) {
2455
3052
  });
2456
3053
  }
2457
3054
  // src/player/OptimizedPodRequest.ts
2458
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
3055
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2459
3056
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2460
3057
  var POD_PARAM_KEYS = [
2461
3058
  "pmnd",
@@ -2615,15 +3212,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
2615
3212
  values.set("PMND", String(pod.pmnd));
2616
3213
  values.set("PMXD", String(pod.pmxd));
2617
3214
  if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
3215
+ values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
2618
3216
  }
2619
3217
  var substituted = substituteScvpMacros(rawUrl, values);
2620
3218
  var finalUrl;
2621
3219
  try {
2622
3220
  var url = new URL(normalizeVastTagUrl(substituted.url));
3221
+ var isGam = GAM_AD_HOSTS.has(url.hostname);
3222
+ var setPodParam = function setPodParam(key, value) {
3223
+ if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
3224
+ };
2623
3225
  if (pod) {
2624
- url.searchParams.set("pmnd", String(pod.pmnd));
2625
- url.searchParams.set("pmxd", String(pod.pmxd));
2626
- if (pod.pmad != null) url.searchParams.set("pmad", String(pod.pmad));
3226
+ setPodParam("pmnd", pod.pmnd);
3227
+ setPodParam("pmxd", pod.pmxd);
3228
+ if (pod.pmad != null) setPodParam("pmad", pod.pmad);
2627
3229
  else url.searchParams.delete("pmad");
2628
3230
  } else {
2629
3231
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -2689,7 +3291,9 @@ function validateGamRequestUrl(url, expect) {
2689
3291
  if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
2690
3292
  var params;
2691
3293
  try {
2692
- params = new URL(url).searchParams;
3294
+ var parsed = new URL(url);
3295
+ if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
3296
+ params = parsed.searchParams;
2693
3297
  } catch (unused) {
2694
3298
  return problems.concat("URL could not be parsed");
2695
3299
  }
@@ -2879,6 +3483,9 @@ function createHlsAdPlayer(contentVideo, options) {
2879
3483
  var mediaCandidateIndex = 0;
2880
3484
  var mediaStartTimerId;
2881
3485
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3486
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3487
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3488
+ var mediaStartBudgetStartedAt = 0;
2882
3489
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2883
3490
  var pendingVastRequests = /* @__PURE__ */ new Set();
2884
3491
  var pendingRequestAbortReason;
@@ -4893,12 +5500,14 @@ function createHlsAdPlayer(contentVideo, options) {
4893
5500
  clearMediaStartTimer();
4894
5501
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4895
5502
  var startedAt = Date.now();
5503
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5504
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4896
5505
  mediaStartTimerId = setTimeout(function() {
4897
5506
  mediaStartTimerId = void 0;
4898
5507
  if (!adPlaying || trackingFired.impression) return;
4899
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5508
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4900
5509
  logFunnel("play_resolved_but_never_started", {
4901
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5510
+ timeoutMs: timeoutMs,
4902
5511
  elapsedMs: Date.now() - startedAt,
4903
5512
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4904
5513
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4907,7 +5516,7 @@ function createHlsAdPlayer(contentVideo, options) {
4907
5516
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4908
5517
  });
4909
5518
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4910
- }, MEDIA_START_TIMEOUT_MS);
5519
+ }, timeoutMs);
4911
5520
  }
4912
5521
  function resetVideoElementForNextSource() {
4913
5522
  clearStallWatchdog();
@@ -4922,6 +5531,20 @@ function createHlsAdPlayer(contentVideo, options) {
4922
5531
  function tryNextMediaCandidate() {
4923
5532
  if (!currentAd || trackingFired.impression) return false;
4924
5533
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5534
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5535
+ logFunnel("media_fallback_capped", {
5536
+ reason: "max_attempts",
5537
+ attempts: mediaCandidateIndex + 1
5538
+ });
5539
+ return false;
5540
+ }
5541
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5542
+ logFunnel("media_fallback_capped", {
5543
+ reason: "time_budget",
5544
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5545
+ });
5546
+ return false;
5547
+ }
4925
5548
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4926
5549
  mediaCandidateIndex++;
4927
5550
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4955,6 +5578,7 @@ function createHlsAdPlayer(contentVideo, options) {
4955
5578
  }
4956
5579
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4957
5580
  mediaCandidateIndex = 0;
5581
+ mediaStartBudgetStartedAt = Date.now();
4958
5582
  var mediaFile = mediaCandidates[0];
4959
5583
  if (!mediaFile) {
4960
5584
  logFunnel("media_unsupported", {
@@ -5894,6 +6518,7 @@ function getOrCreateNonceLoader(allowStorage) {
5894
6518
  }
5895
6519
  function createPalNonceManager() {
5896
6520
  var currentNonce = "";
6521
+ var currentNonceCreatedAt = 0;
5897
6522
  var currentNonceManager;
5898
6523
  var pendingNonce;
5899
6524
  return {
@@ -5910,6 +6535,9 @@ function createPalNonceManager() {
5910
6535
  getCurrentNonce: function getCurrentNonce() {
5911
6536
  return currentNonce;
5912
6537
  },
6538
+ getNonceAgeMs: function getNonceAgeMs() {
6539
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6540
+ },
5913
6541
  waitForNonce: function waitForNonce(maxWaitMs) {
5914
6542
  if (currentNonce) return Promise.resolve(currentNonce);
5915
6543
  var pending = pendingNonce;
@@ -5962,13 +6590,14 @@ function createPalNonceManager() {
5962
6590
  },
5963
6591
  reset: function reset() {
5964
6592
  currentNonce = "";
6593
+ currentNonceCreatedAt = 0;
5965
6594
  currentNonceManager = void 0;
5966
6595
  pendingNonce = void 0;
5967
6596
  }
5968
6597
  };
5969
6598
  function generate(options) {
5970
6599
  return _async_to_generator(function() {
5971
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6600
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5972
6601
  return _ts_generator(this, function(_state) {
5973
6602
  switch(_state.label){
5974
6603
  case 0:
@@ -5992,10 +6621,11 @@ function createPalNonceManager() {
5992
6621
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5993
6622
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5994
6623
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5995
- request.iconsSupported = true;
6624
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5996
6625
  request.playerType = "StormcloudVideoPlayer";
5997
6626
  request.playerVersion = "1.0";
5998
- request.supportedApiFrameworks = "2,7,9";
6627
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6628
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
5999
6629
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
6000
6630
  request.videoWidth = options.videoWidth || 640;
6001
6631
  request.videoHeight = options.videoHeight || 480;
@@ -6025,6 +6655,7 @@ function createPalNonceManager() {
6025
6655
  manager = _state.sent();
6026
6656
  currentNonceManager = manager;
6027
6657
  currentNonce = manager.getNonce();
6658
+ currentNonceCreatedAt = Date.now();
6028
6659
  console.log("[PAL] Nonce generated successfully");
6029
6660
  return [
6030
6661
  2,
@@ -6048,6 +6679,458 @@ function createPalNonceManager() {
6048
6679
  })();
6049
6680
  }
6050
6681
  }
6682
+ // src/utils/deviceInfo.ts
6683
+ var CATEGORY_CODES = {
6684
+ "LG TV": "lg_tv",
6685
+ "LG Set-Top Box": "lg_stb",
6686
+ "Samsung TV": "samsung_tv",
6687
+ Other: "other"
6688
+ };
6689
+ var DEVICE_CATEGORIES = [
6690
+ "LG TV",
6691
+ "LG Set-Top Box",
6692
+ "Samsung TV",
6693
+ "Other"
6694
+ ];
6695
+ var hostDeviceInfo;
6696
+ var lgDeviceInfo;
6697
+ var platformCache;
6698
+ var primePromise;
6699
+ function cleanString(value) {
6700
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6701
+ if (typeof value !== "string") return void 0;
6702
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6703
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6704
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6705
+ }
6706
+ function safeCall2(fn, thisArg) {
6707
+ if (typeof fn !== "function") return void 0;
6708
+ try {
6709
+ return fn.call(thisArg);
6710
+ } catch (unused) {
6711
+ return void 0;
6712
+ }
6713
+ }
6714
+ function userAgent() {
6715
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6716
+ }
6717
+ function bridgeSources2() {
6718
+ if (typeof window === "undefined") return [];
6719
+ var w = window;
6720
+ return [
6721
+ w.__STORMCLOUD_CTV__,
6722
+ w.__STORMCLOUD_CTV_AD_INFO__,
6723
+ w.stormcloudCtv
6724
+ ].filter(Boolean);
6725
+ }
6726
+ function readBridge(keys) {
6727
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6728
+ try {
6729
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6730
+ var source = _step.value;
6731
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6732
+ try {
6733
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6734
+ var key = _step1.value;
6735
+ var value = void 0;
6736
+ try {
6737
+ value = source === null || source === void 0 ? void 0 : source[key];
6738
+ if (typeof value === "function") value = value.call(source);
6739
+ } catch (unused) {
6740
+ value = void 0;
6741
+ }
6742
+ var clean = cleanString(value);
6743
+ if (clean) return clean;
6744
+ }
6745
+ } catch (err) {
6746
+ _didIteratorError1 = true;
6747
+ _iteratorError1 = err;
6748
+ } finally{
6749
+ try {
6750
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6751
+ _iterator1.return();
6752
+ }
6753
+ } finally{
6754
+ if (_didIteratorError1) {
6755
+ throw _iteratorError1;
6756
+ }
6757
+ }
6758
+ }
6759
+ }
6760
+ } catch (err) {
6761
+ _didIteratorError = true;
6762
+ _iteratorError = err;
6763
+ } finally{
6764
+ try {
6765
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6766
+ _iterator.return();
6767
+ }
6768
+ } finally{
6769
+ if (_didIteratorError) {
6770
+ throw _iteratorError;
6771
+ }
6772
+ }
6773
+ }
6774
+ return void 0;
6775
+ }
6776
+ function makeForCategory(category) {
6777
+ if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
6778
+ if (category === "Samsung TV") return "Samsung";
6779
+ return void 0;
6780
+ }
6781
+ function normalizeCategory(value) {
6782
+ var v = cleanString(value);
6783
+ if (!v) return void 0;
6784
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6785
+ return c.toLowerCase() === v.toLowerCase();
6786
+ });
6787
+ if (exact) return exact;
6788
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6789
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6790
+ return CATEGORY_CODES[c] === code;
6791
+ });
6792
+ return byCode;
6793
+ }
6794
+ function parseUserAgentDeviceInfo(ua) {
6795
+ var sources = [];
6796
+ var out = {
6797
+ platform: "other",
6798
+ sources: sources
6799
+ };
6800
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6801
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6802
+ if (/Web0S|webOS/i.test(ua)) {
6803
+ out.platform = "webos";
6804
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6805
+ if (lg && lg[1] && lg[2]) {
6806
+ out.model = lg[1];
6807
+ out.firmware = lg[2];
6808
+ sources.push("user_agent");
6809
+ }
6810
+ } else if (/Tizen/i.test(ua)) {
6811
+ out.platform = "tizen";
6812
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6813
+ if (tizen && tizen[1]) {
6814
+ out.osVersion = "Tizen ".concat(tizen[1]);
6815
+ sources.push("user_agent");
6816
+ }
6817
+ }
6818
+ return out;
6819
+ }
6820
+ function readSamsungProductInfo() {
6821
+ var _cleanString;
6822
+ var _window_webapis;
6823
+ if (typeof window === "undefined") return void 0;
6824
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6825
+ if (!productinfo) return void 0;
6826
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6827
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6828
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6829
+ if (!model && !firmware && !duid) return void 0;
6830
+ return _object_spread({}, model ? {
6831
+ model: model
6832
+ } : {}, firmware ? {
6833
+ firmware: firmware
6834
+ } : {}, duid ? {
6835
+ internalDeviceId: duid,
6836
+ internalDeviceIdSource: "samsung_duid"
6837
+ } : {});
6838
+ }
6839
+ function readLgDeviceInfo(timeoutMs) {
6840
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6841
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6842
+ return new Promise(function(resolve) {
6843
+ var settled = false;
6844
+ var finish = function finish() {
6845
+ if (settled) return;
6846
+ settled = true;
6847
+ clearTimeout(timer);
6848
+ resolve();
6849
+ };
6850
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6851
+ try {
6852
+ webOS.deviceInfo(function(info) {
6853
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6854
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6855
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6856
+ lgDeviceInfo = _object_spread({}, model ? {
6857
+ model: model
6858
+ } : {}, firmware ? {
6859
+ firmware: firmware
6860
+ } : {}, sdkVersion ? {
6861
+ sdkVersion: sdkVersion
6862
+ } : {});
6863
+ finish();
6864
+ });
6865
+ } catch (unused) {
6866
+ finish();
6867
+ }
6868
+ });
6869
+ }
6870
+ function computePlatformInfo() {
6871
+ var info = parseUserAgentDeviceInfo(userAgent());
6872
+ var sources = _to_consumable_array(info.sources);
6873
+ var samsung = readSamsungProductInfo();
6874
+ if (samsung) {
6875
+ info.platform = "tizen";
6876
+ if (samsung.model) info.model = samsung.model;
6877
+ if (samsung.firmware) info.firmware = samsung.firmware;
6878
+ if (samsung.internalDeviceId) {
6879
+ info.internalDeviceId = samsung.internalDeviceId;
6880
+ info.internalDeviceIdSource = "samsung_duid";
6881
+ }
6882
+ sources.push("samsung_productinfo");
6883
+ }
6884
+ if (lgDeviceInfo) {
6885
+ info.platform = "webos";
6886
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6887
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6888
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6889
+ sources.push("lg_deviceinfo");
6890
+ }
6891
+ var lgUdid = readCachedLgUdid();
6892
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6893
+ info.internalDeviceId = lgUdid.deviceId;
6894
+ info.internalDeviceIdSource = "lg_udid";
6895
+ sources.push("lg_udid");
6896
+ }
6897
+ info.sources = sources;
6898
+ return info;
6899
+ }
6900
+ function categorize(platform, model) {
6901
+ if (platform === "tizen") return "Samsung TV";
6902
+ if (platform === "webos") {
6903
+ var ua = userAgent();
6904
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6905
+ return "LG TV";
6906
+ }
6907
+ return "Other";
6908
+ }
6909
+ function setHostDeviceInfo(info) {
6910
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6911
+ }
6912
+ function primeDeviceInfo() {
6913
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6914
+ if (!primePromise) {
6915
+ primePromise = Promise.all([
6916
+ readLgDeviceInfo(timeoutMs),
6917
+ primeLgUdid(timeoutMs)
6918
+ ]).catch(function() {
6919
+ return void 0;
6920
+ }).then(function() {
6921
+ platformCache = computePlatformInfo();
6922
+ return getDeviceInfo();
6923
+ });
6924
+ }
6925
+ return primePromise;
6926
+ }
6927
+ function getDeviceInfo() {
6928
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
6929
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6930
+ if (primePromise && !platformCache) {} else {
6931
+ platformCache = platform;
6932
+ }
6933
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6934
+ var bridge = {
6935
+ terminalId: readBridge([
6936
+ "terminalId",
6937
+ "terminal_id"
6938
+ ]),
6939
+ internalDeviceId: readBridge([
6940
+ "internalDeviceId",
6941
+ "internal_device_id"
6942
+ ]),
6943
+ model: readBridge([
6944
+ "deviceModel"
6945
+ ]),
6946
+ firmware: readBridge([
6947
+ "firmwareVersion"
6948
+ ]),
6949
+ category: normalizeCategory(readBridge([
6950
+ "deviceCategory"
6951
+ ])),
6952
+ make: readBridge([
6953
+ "deviceMake"
6954
+ ]),
6955
+ hardwareVersion: readBridge([
6956
+ "deviceHardwareVersion",
6957
+ "hardwareVersion"
6958
+ ])
6959
+ };
6960
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6961
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6962
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6963
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6964
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6965
+ var sources = _to_consumable_array(platform.sources);
6966
+ var bridgeValues = [
6967
+ bridge.terminalId,
6968
+ bridge.internalDeviceId,
6969
+ bridge.model,
6970
+ bridge.firmware,
6971
+ bridge.category,
6972
+ bridge.make,
6973
+ bridge.hardwareVersion
6974
+ ];
6975
+ if (bridgeValues.some(function(v) {
6976
+ return v !== void 0;
6977
+ })) sources.unshift("bridge");
6978
+ if (hostDeviceInfo) sources.unshift("host");
6979
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6980
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6981
+ var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
6982
+ var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
6983
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6984
+ return _object_spread_props(_object_spread({
6985
+ category: category,
6986
+ categoryCode: CATEGORY_CODES[category]
6987
+ }, make ? {
6988
+ make: make
6989
+ } : {}, model ? {
6990
+ model: model
6991
+ } : {}, hardwareVersion ? {
6992
+ hardwareVersion: hardwareVersion
6993
+ } : {}, sonifiModel ? {
6994
+ sonifiModel: sonifiModel
6995
+ } : {}, firmware ? {
6996
+ firmware: firmware
6997
+ } : {}, platform.osVersion ? {
6998
+ osVersion: platform.osVersion
6999
+ } : {}, platform.browserMajorVersion != null ? {
7000
+ browserMajorVersion: platform.browserMajorVersion
7001
+ } : {}, internalDeviceId ? {
7002
+ internalDeviceId: internalDeviceId
7003
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
7004
+ internalDeviceIdSource: internalDeviceIdSource
7005
+ } : {}, terminalId ? {
7006
+ terminalId: terminalId
7007
+ } : {}), {
7008
+ sources: sources
7009
+ });
7010
+ }
7011
+ var DEVICE_KEY_VALUE_KEYS = {
7012
+ category: "sc_dev",
7013
+ model: "sc_model",
7014
+ firmware: "sc_fw"
7015
+ };
7016
+ function sanitizeKeyValue(value) {
7017
+ if (typeof value !== "string") return void 0;
7018
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
7019
+ return v ? v.slice(0, 40) : void 0;
7020
+ }
7021
+ function deviceKeyValuePairs(info) {
7022
+ var pairs = [
7023
+ [
7024
+ DEVICE_KEY_VALUE_KEYS.category,
7025
+ info.categoryCode
7026
+ ]
7027
+ ];
7028
+ var model = sanitizeKeyValue(info.model);
7029
+ var firmware = sanitizeKeyValue(info.firmware);
7030
+ if (model) pairs.push([
7031
+ DEVICE_KEY_VALUE_KEYS.model,
7032
+ model
7033
+ ]);
7034
+ if (firmware) pairs.push([
7035
+ DEVICE_KEY_VALUE_KEYS.firmware,
7036
+ firmware
7037
+ ]);
7038
+ return pairs;
7039
+ }
7040
+ function applyDeviceKeyValues(url, info) {
7041
+ try {
7042
+ var parsed = new URL(url);
7043
+ var pairs = deviceKeyValuePairs(info);
7044
+ var ours = new Set(pairs.map(function(param) {
7045
+ var _param = _sliced_to_array(param, 1), k = _param[0];
7046
+ return k;
7047
+ }));
7048
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
7049
+ var _p_split_;
7050
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
7051
+ });
7052
+ var merged = existing.concat(pairs.map(function(param) {
7053
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
7054
+ return "".concat(k, "=").concat(v);
7055
+ })).join("&");
7056
+ parsed.searchParams.set("cust_params", merged);
7057
+ return parsed.toString();
7058
+ } catch (unused) {
7059
+ return url;
7060
+ }
7061
+ }
7062
+ function deviceInfoAnalyticsFields(info) {
7063
+ return _object_spread({
7064
+ device_category: info.category
7065
+ }, info.model ? {
7066
+ device_model: info.model
7067
+ } : {}, info.sonifiModel ? {
7068
+ sonifi_model: info.sonifiModel
7069
+ } : {}, info.firmware ? {
7070
+ firmware_version: info.firmware
7071
+ } : {}, info.osVersion ? {
7072
+ os_version: info.osVersion
7073
+ } : {}, info.browserMajorVersion != null ? {
7074
+ browser_major_version: info.browserMajorVersion
7075
+ } : {}, info.internalDeviceId ? {
7076
+ internal_device_id: info.internalDeviceId
7077
+ } : {}, info.internalDeviceIdSource ? {
7078
+ internal_device_id_source: info.internalDeviceIdSource
7079
+ } : {}, info.terminalId ? {
7080
+ terminal_id: info.terminalId
7081
+ } : {});
7082
+ }
7083
+ // src/utils/screenActivity.ts
7084
+ var hostStandby = false;
7085
+ function setHostStandby(standby) {
7086
+ hostStandby = !!standby;
7087
+ }
7088
+ function toBoolean(value) {
7089
+ if (typeof value === "boolean") return value;
7090
+ if (typeof value === "number") return value === 1;
7091
+ if (typeof value === "string") {
7092
+ var v = value.trim().toLowerCase();
7093
+ if (v === "true" || v === "1" || v === "yes") return true;
7094
+ if (v === "false" || v === "0" || v === "no") return false;
7095
+ }
7096
+ return void 0;
7097
+ }
7098
+ function bridgeSaysStandby() {
7099
+ if (typeof window === "undefined") return false;
7100
+ var w = window;
7101
+ for(var _i = 0, _iter = [
7102
+ w.__STORMCLOUD_CTV__,
7103
+ w.__STORMCLOUD_CTV_AD_INFO__,
7104
+ w.stormcloudCtv
7105
+ ]; _i < _iter.length; _i++){
7106
+ var source = _iter[_i];
7107
+ if (!source) continue;
7108
+ for(var _i1 = 0, _iter1 = [
7109
+ "standby",
7110
+ "isStandby",
7111
+ "screenOff"
7112
+ ]; _i1 < _iter1.length; _i1++){
7113
+ var key = _iter1[_i1];
7114
+ var value = void 0;
7115
+ try {
7116
+ value = source[key];
7117
+ if (typeof value === "function") value = value.call(source);
7118
+ } catch (unused) {
7119
+ value = void 0;
7120
+ }
7121
+ if (toBoolean(value) === true) return true;
7122
+ }
7123
+ }
7124
+ return false;
7125
+ }
7126
+ function getScreenInactiveReason() {
7127
+ if (hostStandby) return "host_standby";
7128
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
7129
+ return "document_hidden";
7130
+ }
7131
+ if (bridgeSaysStandby()) return "bridge_standby";
7132
+ return void 0;
7133
+ }
6051
7134
  // src/utils/trackingIngest.ts
6052
7135
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6053
7136
  enabled: true,
@@ -6145,6 +7228,9 @@ function buildAnalyticsContext(config) {
6145
7228
  if (config.isLiveStream !== void 0) {
6146
7229
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6147
7230
  }
7231
+ if (config.sendDeviceInfoToAnalytics) {
7232
+ context.includeDeviceInfo = true;
7233
+ }
6148
7234
  return context;
6149
7235
  }
6150
7236
  function getClientInfo() {
@@ -6440,7 +7526,7 @@ function buildPlayerMetricEvent() {
6440
7526
  capture_at: captureAt
6441
7527
  }, context.inputStreamType ? {
6442
7528
  input_stream_type: context.inputStreamType
6443
- } : {})
7529
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6444
7530
  ];
6445
7531
  }
6446
7532
  });
@@ -7995,6 +9081,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
7995
9081
  return Scte35CueManager;
7996
9082
  }();
7997
9083
  // src/player/AdConfigManager.ts
9084
+ function isGamAdUrl(rawUrl) {
9085
+ try {
9086
+ return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
9087
+ } catch (unused) {
9088
+ return false;
9089
+ }
9090
+ }
7998
9091
  function withDeferredPodParams(rawUrl, deferNonce) {
7999
9092
  try {
8000
9093
  var url = new URL(rawUrl);
@@ -8012,11 +9105,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
8012
9105
  }
8013
9106
  var AdConfigManager = /*#__PURE__*/ function() {
8014
9107
  function AdConfigManager(config, video) {
9108
+ var _this = this;
8015
9109
  _class_call_check(this, AdConfigManager);
8016
9110
  this.vmapBreaks = [];
8017
9111
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
8018
9112
  this.streamCorrelator = generateCorrelator();
8019
9113
  this.consentSignals = {};
9114
+ this.isLiveStream = function() {
9115
+ return !!_this.config.isLiveStream;
9116
+ };
8020
9117
  this.podCounter = 0;
8021
9118
  this.podAssignedByPrefetch = false;
8022
9119
  this.lastHeartbeatTime = 0;
@@ -8467,9 +9564,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
8467
9564
  {
8468
9565
  key: "generatePodVastUrl",
8469
9566
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
9567
+ var _content_contentDurationSeconds;
8470
9568
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8471
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
8472
- var macroContext = _object_spread_props(_object_spread({
9569
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9570
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9571
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9572
+ });
9573
+ var content = resolveContentMetadata(this.config);
9574
+ var isLive = this.isLiveStream();
9575
+ var device = getDeviceInfo();
9576
+ var playerSize = resolvePlayerSize(this.video);
9577
+ var videoDuration = this.video.duration;
9578
+ var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
9579
+ var userId = resolveUserId(this.config.adUserId);
9580
+ var ipAddress = resolveClientIp(this.config.clientIpAddress);
9581
+ var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
9582
+ var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
8473
9583
  correlator: this.viewCorrelator,
8474
9584
  streamCorrelator: this.streamCorrelator,
8475
9585
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -8483,14 +9593,54 @@ var AdConfigManager = /*#__PURE__*/ function() {
8483
9593
  limitAdTracking: envSignals.limitAdTracking,
8484
9594
  deviceTypeHint: envSignals.deviceTypeHint,
8485
9595
  adTest: this.config.adTest
8486
- }, this.config.programTitle ? {
8487
- programTitle: this.config.programTitle
8488
- } : {}, this.config.channelName ? {
8489
- channelName: this.config.channelName
9596
+ }, content.programTitle ? {
9597
+ programTitle: content.programTitle
9598
+ } : {}, content.channelName ? {
9599
+ channelName: content.channelName
9600
+ } : {}, content.contentNetwork ? {
9601
+ contentNetwork: content.contentNetwork
8490
9602
  } : {}), {
8491
9603
  consent: this.consentSignals,
8492
- palNonce: palNonce.getCurrentNonce() || void 0
8493
- });
9604
+ palNonce: palNonce.getCurrentNonce() || void 0,
9605
+ deviceIdSource: envSignals.deviceIdSource,
9606
+ isLive: isLive
9607
+ }), playerSize.width ? {
9608
+ playerWidth: playerSize.width
9609
+ } : {}, playerSize.height ? {
9610
+ playerHeight: playerSize.height
9611
+ } : {}), {
9612
+ timestamp: String(Date.now())
9613
+ }), device.make ? {
9614
+ deviceMake: device.make
9615
+ } : {}, device.model ? {
9616
+ deviceModel: device.model
9617
+ } : {}, device.hardwareVersion ? {
9618
+ deviceHardwareVersion: device.hardwareVersion
9619
+ } : {}, userAgent2 ? {
9620
+ userAgent: userAgent2
9621
+ } : {}, ipAddress ? {
9622
+ ipAddress: ipAddress
9623
+ } : {}, userId ? {
9624
+ userId: userId
9625
+ } : {}, content.contentType ? {
9626
+ contentType: content.contentType
9627
+ } : {}, content.contentCategory ? {
9628
+ contentCategory: content.contentCategory
9629
+ } : {}, content.contentGenre ? {
9630
+ contentGenre: content.contentGenre
9631
+ } : {}, content.contentLanguage ? {
9632
+ contentLanguage: content.contentLanguage
9633
+ } : {}, contentDurationSeconds != null ? {
9634
+ contentDurationSeconds: contentDurationSeconds
9635
+ } : {}, content.contentSeason ? {
9636
+ contentSeason: content.contentSeason
9637
+ } : {}, content.contentEpisode ? {
9638
+ contentEpisode: content.contentEpisode
9639
+ } : {}, content.contentRating ? {
9640
+ contentRating: content.contentRating
9641
+ } : {}, content.contentId ? {
9642
+ contentId: content.contentId
9643
+ } : {});
8494
9644
  var nonceReady = !!macroContext.palNonce;
8495
9645
  var finalUrl;
8496
9646
  if (hasScvpMacros(baseUrl)) {
@@ -8504,6 +9654,31 @@ var AdConfigManager = /*#__PURE__*/ function() {
8504
9654
  } else {
8505
9655
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8506
9656
  }
9657
+ if (isGamAdUrl(finalUrl)) {
9658
+ finalUrl = appendMissingContentParams(finalUrl, content);
9659
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9660
+ finalUrl = applyDeviceKeyValues(finalUrl, device);
9661
+ }
9662
+ }
9663
+ if (this.debug) {
9664
+ var id = envSignals.deviceId;
9665
+ console.log("[AD-IDENTITY]", {
9666
+ source: envSignals.deviceIdSource,
9667
+ idtype: envSignals.deviceIdType,
9668
+ rdidTail: id ? id.slice(-4) : void 0,
9669
+ isLat: envSignals.limitAdTracking,
9670
+ dth: envSignals.deviceTypeHint,
9671
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9672
+ ct_ch: content.channelName,
9673
+ ct_ti: content.programTitle,
9674
+ ct_ne: content.contentNetwork,
9675
+ ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
9676
+ live: isLive,
9677
+ player: playerSize,
9678
+ make: device.make,
9679
+ model: device.model
9680
+ });
9681
+ }
8507
9682
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8508
9683
  return finalUrl;
8509
9684
  }
@@ -8555,7 +9730,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8555
9730
  }
8556
9731
  },
8557
9732
  {
8558
- // --- Tracking ---
8559
9733
  key: "initializeTracking",
8560
9734
  value: function initializeTracking() {
8561
9735
  var _this = this;
@@ -8647,7 +9821,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8647
9821
  }
8648
9822
  },
8649
9823
  {
8650
- // --- Ad stop timer ---
8651
9824
  key: "scheduleAdStopCountdown",
8652
9825
  value: function scheduleAdStopCountdown(remainingMs) {
8653
9826
  var _this = this;
@@ -8679,7 +9852,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8679
9852
  }
8680
9853
  },
8681
9854
  {
8682
- // --- Ad start timer ---
8683
9855
  key: "scheduleAdStartIn",
8684
9856
  value: function scheduleAdStartIn(delayMs) {
8685
9857
  var _this = this;
@@ -8707,7 +9879,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8707
9879
  }
8708
9880
  },
8709
9881
  {
8710
- // --- PTS drift ---
8711
9882
  key: "updatePtsDrift",
8712
9883
  value: function updatePtsDrift(ptsSecondsSample) {
8713
9884
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8733,7 +9904,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8733
9904
  }
8734
9905
  },
8735
9906
  {
8736
- // --- Duration boundary ---
8737
9907
  key: "beginBreakTiming",
8738
9908
  value: function beginBreakTiming(startWallClockMs) {
8739
9909
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8781,7 +9951,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8781
9951
  }
8782
9952
  },
8783
9953
  {
8784
- // --- Duration budget ---
8785
9954
  key: "getWallClockRemainingAdMs",
8786
9955
  value: function getWallClockRemainingAdMs() {
8787
9956
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8930,7 +10099,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8930
10099
  }
8931
10100
  },
8932
10101
  {
8933
- // --- Circuit breaker ---
8934
10102
  key: "isTemporaryAdError",
8935
10103
  value: function isTemporaryAdError(error) {
8936
10104
  var _error_message;
@@ -9064,7 +10232,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9064
10232
  }
9065
10233
  },
9066
10234
  {
9067
- // --- Watchdog ---
9068
10235
  key: "startAdRequestWatchdog",
9069
10236
  value: function startAdRequestWatchdog(token) {
9070
10237
  var _this = this;
@@ -9109,7 +10276,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9109
10276
  }
9110
10277
  },
9111
10278
  {
9112
- // --- Failsafe ---
9113
10279
  key: "startAdFailsafeTimer",
9114
10280
  value: function startAdFailsafeTimer(token) {
9115
10281
  var _this = this;
@@ -9171,7 +10337,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9171
10337
  }
9172
10338
  },
9173
10339
  {
9174
- // --- Reset for ad break end ---
9175
10340
  key: "resetForBreakEnd",
9176
10341
  value: function resetForBreakEnd() {
9177
10342
  this.clearAdStopTimer();
@@ -9370,7 +10535,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9370
10535
  adBehavior: adBehavior
9371
10536
  });
9372
10537
  }
9373
- if (!this.config.autoplay) return [
10538
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9374
10539
  3,
9375
10540
  2
9376
10541
  ];
@@ -9561,6 +10726,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9561
10726
  2
9562
10727
  ];
9563
10728
  this.hasInitialBufferCompleted = true;
10729
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10730
+ this.shouldAutoplayAfterBuffering = false;
10731
+ if (this.debug) {
10732
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10733
+ }
10734
+ }
9564
10735
  if (!this.shouldAutoplayAfterBuffering) return [
9565
10736
  3,
9566
10737
  2
@@ -10218,9 +11389,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10218
11389
  }
10219
11390
  },
10220
11391
  {
10221
- // ───────────────────────────────────────────────────────────────
10222
- // IMA event listeners
10223
- // ───────────────────────────────────────────────────────────────
10224
11392
  key: "nextAdRequestUrl",
10225
11393
  value: function nextAdRequestUrl(baseVastUrl) {
10226
11394
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10456,9 +11624,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10456
11624
  }
10457
11625
  },
10458
11626
  {
10459
- // ───────────────────────────────────────────────────────────────
10460
- // Ad break start
10461
- // ───────────────────────────────────────────────────────────────
10462
11627
  key: "isBreakActive",
10463
11628
  value: function isBreakActive() {
10464
11629
  return this.slotState !== "IDLE";
@@ -10486,7 +11651,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10486
11651
  key: "handleAdStart",
10487
11652
  value: function handleAdStart(marker) {
10488
11653
  return _async_to_generator(function() {
10489
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11654
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10490
11655
  return _ts_generator(this, function(_state) {
10491
11656
  switch(_state.label){
10492
11657
  case 0:
@@ -10499,6 +11664,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10499
11664
  2
10500
11665
  ];
10501
11666
  }
11667
+ screenInactiveReason = getScreenInactiveReason();
11668
+ if (screenInactiveReason) {
11669
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11670
+ reason: screenInactiveReason
11671
+ });
11672
+ this.clearPendingAdBreak();
11673
+ return [
11674
+ 2
11675
+ ];
11676
+ }
10502
11677
  baseVastUrl = this.adConfig.apiVastTagUrl;
10503
11678
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10504
11679
  if (!baseVastUrl && !edgeConfigured) {
@@ -10659,12 +11834,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10659
11834
  },
10660
11835
  {
10661
11836
  key: "startOptimizedPod",
10662
- value: // ───────────────────────────────────────────────────────────────
10663
- // Optimized pod (single multi-ad request)
10664
- // ───────────────────────────────────────────────────────────────
10665
- function startOptimizedPod(baseVastUrl) {
11837
+ value: function startOptimizedPod(baseVastUrl) {
10666
11838
  return _async_to_generator(function() {
10667
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11839
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10668
11840
  return _ts_generator(this, function(_state) {
10669
11841
  switch(_state.label){
10670
11842
  case 0:
@@ -10772,6 +11944,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10772
11944
  false
10773
11945
  ];
10774
11946
  }
11947
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11948
+ ;
11949
+ remainingMs = this.timing.getRemainingAdMs();
11950
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11951
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11952
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11953
+ if (Number.isFinite(remainingMs)) {
11954
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11955
+ if (podCount < 1) {
11956
+ if (this.timing.activeAdRequestToken === requestToken) {
11957
+ this.timing.activeAdRequestToken = null;
11958
+ }
11959
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11960
+ return [
11961
+ 2,
11962
+ false
11963
+ ];
11964
+ }
11965
+ }
11966
+ }
10775
11967
  this.setSlotState("READY", "vast_ready");
10776
11968
  if (this.debug) {
10777
11969
  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"));
@@ -10841,9 +12033,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10841
12033
  }
10842
12034
  },
10843
12035
  {
10844
- // ───────────────────────────────────────────────────────────────
10845
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10846
- // ───────────────────────────────────────────────────────────────
10847
12036
  key: "resetEdgeStateForBreak",
10848
12037
  value: function resetEdgeStateForBreak() {
10849
12038
  this.edgeExhaustedForBreak = false;
@@ -11061,9 +12250,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11061
12250
  }
11062
12251
  },
11063
12252
  {
11064
- // ───────────────────────────────────────────────────────────────
11065
- // Next-ad scheduling (single flight)
11066
- // ───────────────────────────────────────────────────────────────
11067
12253
  key: "setSlotState",
11068
12254
  value: function setSlotState(next, reason) {
11069
12255
  if (this.slotState === next) return;
@@ -11113,6 +12299,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11113
12299
  {
11114
12300
  key: "getStopRequestingReason",
11115
12301
  value: function getStopRequestingReason(remainingMs) {
12302
+ var screenInactiveReason = getScreenInactiveReason();
12303
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11116
12304
  if (this.breakSource === "vmap") {
11117
12305
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11118
12306
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11386,9 +12574,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11386
12574
  }
11387
12575
  },
11388
12576
  {
11389
- // ───────────────────────────────────────────────────────────────
11390
- // Per-request diagnostics
11391
- // ───────────────────────────────────────────────────────────────
11392
12577
  key: "recordRequestDiagnostic",
11393
12578
  value: function recordRequestDiagnostic(payload) {
11394
12579
  var requestId = payload.requestId;
@@ -11462,9 +12647,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11462
12647
  }
11463
12648
  },
11464
12649
  {
11465
- // ───────────────────────────────────────────────────────────────
11466
- // Single ad playback
11467
- // ───────────────────────────────────────────────────────────────
11468
12650
  key: "createGamDispatchFinalizer",
11469
12651
  value: function createGamDispatchFinalizer(requestToken) {
11470
12652
  var _this = this;
@@ -11927,9 +13109,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11927
13109
  }
11928
13110
  },
11929
13111
  {
11930
- // ───────────────────────────────────────────────────────────────
11931
- // Ad break completion
11932
- // ───────────────────────────────────────────────────────────────
11933
13112
  key: "logBreakFunnel",
11934
13113
  value: function logBreakFunnel(endReason) {
11935
13114
  var funnel = this.breakFunnel;
@@ -12575,6 +13754,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12575
13754
  return ContentHealthWatchdog;
12576
13755
  }();
12577
13756
  // src/player/StormcloudVideoPlayer.ts
13757
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13758
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12578
13759
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12579
13760
  function StormcloudVideoPlayer(config) {
12580
13761
  var _this = this;
@@ -12585,6 +13766,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12585
13766
  var browserOverrides = getBrowserConfigOverrides();
12586
13767
  this.config = _object_spread({}, browserOverrides, config);
12587
13768
  this.video = config.videoElement;
13769
+ if (this.config.forceSingleDecoderMode != null) {
13770
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13771
+ }
13772
+ if (this.config.adDeviceId) {
13773
+ setHostAdIdentity({
13774
+ deviceId: this.config.adDeviceId,
13775
+ deviceIdType: this.config.adDeviceIdType,
13776
+ limitAdTracking: this.config.adLimitAdTracking
13777
+ });
13778
+ }
13779
+ if (this.config.deviceInfo) {
13780
+ setHostDeviceInfo(this.config.deviceInfo);
13781
+ }
12588
13782
  logBrowserInfo(config.debugAdTiming);
12589
13783
  this.floorLadder = new FloorLadderController();
12590
13784
  this.adPlayer = this.createAdPlayer(false);
@@ -12648,8 +13842,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12648
13842
  },
12649
13843
  hasPendingAdBreak: function hasPendingAdBreak() {
12650
13844
  return _this.adBreak.pendingAdBreak !== null;
13845
+ },
13846
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13847
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12651
13848
  }
12652
13849
  });
13850
+ this.adConfig.isLiveStream = function() {
13851
+ return _this.hlsEngine.isLiveStream;
13852
+ };
12653
13853
  this.adBreak = new AdBreakOrchestrator({
12654
13854
  config: this.config,
12655
13855
  video: this.video,
@@ -12843,10 +14043,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12843
14043
  },
12844
14044
  {
12845
14045
  key: "load",
12846
- value: // ───────────────────────────────────────────────────────────────
12847
- // Lifecycle
12848
- // ───────────────────────────────────────────────────────────────
12849
- function load() {
14046
+ value: function load() {
12850
14047
  return _async_to_generator(function() {
12851
14048
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12852
14049
  return _ts_generator(this, function(_state) {
@@ -12856,6 +14053,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12856
14053
  if (!this.attached) {
12857
14054
  this.attach();
12858
14055
  }
14056
+ primeDeviceInfo().then(function(info) {
14057
+ if (_this.debug) {
14058
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
14059
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
14060
+ }));
14061
+ }
14062
+ }).catch(function() {});
12859
14063
  _state.label = 1;
12860
14064
  case 1:
12861
14065
  _state.trys.push([
@@ -12890,21 +14094,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12890
14094
  fetchConsentSignals().catch(function() {
12891
14095
  return {};
12892
14096
  }).then(function(signals) {
12893
- var _this_config_lowLatencyMode;
14097
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12894
14098
  _this.adConfig.consentSignals = signals;
12895
14099
  var muted = _this.video.muted;
12896
- return _this.palNonce.generateNonce(_object_spread({
14100
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
14101
+ var palOptions = _object_spread({
12897
14102
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12898
14103
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12899
14104
  adWillAutoPlay: !!_this.config.autoplay,
12900
14105
  adWillPlayMuted: muted,
12901
14106
  playerVolume: muted ? 0 : _this.video.volume,
12902
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
14107
+ 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,
14108
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
14109
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12903
14110
  }, palDescriptionUrl ? {
12904
14111
  descriptionUrl: palDescriptionUrl
12905
14112
  } : {}, signals.storageAllowed != null ? {
12906
14113
  allowStorage: signals.storageAllowed
12907
- } : {}));
14114
+ } : {}, palSessionId ? {
14115
+ sessionId: palSessionId
14116
+ } : {});
14117
+ _this.lastPalOptions = palOptions;
14118
+ _this.palSessionId = palSessionId;
14119
+ _this.startPalNonceRefresh();
14120
+ return _this.palNonce.generateNonce(palOptions);
12908
14121
  }).catch(function() {});
12909
14122
  this.adConfig.initializeTracking();
12910
14123
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12942,6 +14155,96 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12942
14155
  }).call(this);
12943
14156
  }
12944
14157
  },
14158
+ {
14159
+ key: "startPalNonceRefresh",
14160
+ value: function startPalNonceRefresh() {
14161
+ var _this = this;
14162
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
14163
+ this.palRefreshTimer = window.setInterval(function() {
14164
+ return _this.refreshPalNonceIfStale();
14165
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
14166
+ }
14167
+ },
14168
+ {
14169
+ key: "refreshPalNonceIfStale",
14170
+ value: function refreshPalNonceIfStale() {
14171
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
14172
+ var _this_config_palNonceMaxAgeMs;
14173
+ var options = this.lastPalOptions;
14174
+ if (!options) return;
14175
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
14176
+ var ageMs = this.palNonce.getNonceAgeMs();
14177
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
14178
+ var sessionChanged = sessionId !== this.palSessionId;
14179
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
14180
+ if (!force && !stale && !sessionChanged) return;
14181
+ var next = _object_spread({}, options);
14182
+ if (sessionId) next.sessionId = sessionId;
14183
+ else delete next.sessionId;
14184
+ this.lastPalOptions = next;
14185
+ this.palSessionId = sessionId;
14186
+ if (this.debug) {
14187
+ console.log("[PAL] Regenerating nonce", {
14188
+ force: force,
14189
+ stale: stale,
14190
+ sessionChanged: sessionChanged,
14191
+ ageMs: ageMs
14192
+ });
14193
+ }
14194
+ this.palNonce.generateNonce(next).catch(function() {});
14195
+ }
14196
+ },
14197
+ {
14198
+ key: "setAdIdentity",
14199
+ value: function setAdIdentity(identity) {
14200
+ setHostAdIdentity(identity);
14201
+ this.refreshPalNonceIfStale();
14202
+ }
14203
+ },
14204
+ {
14205
+ key: "resetAdIdentity",
14206
+ value: function resetAdIdentity1() {
14207
+ resetAdIdentity();
14208
+ this.refreshPalNonceIfStale(true);
14209
+ }
14210
+ },
14211
+ {
14212
+ key: "setContentMetadata",
14213
+ value: function setContentMetadata(meta) {
14214
+ applyContentMetadataUpdate(this.config, meta);
14215
+ }
14216
+ },
14217
+ {
14218
+ key: "setRequestSignals",
14219
+ value: function setRequestSignals(signals) {
14220
+ if (signals.userId !== void 0) {
14221
+ if (signals.userId) this.config.adUserId = signals.userId;
14222
+ else delete this.config.adUserId;
14223
+ }
14224
+ if (signals.ipAddress !== void 0) {
14225
+ if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
14226
+ else delete this.config.clientIpAddress;
14227
+ }
14228
+ }
14229
+ },
14230
+ {
14231
+ key: "setScreenStandby",
14232
+ value: function setScreenStandby(standby) {
14233
+ setHostStandby(standby);
14234
+ }
14235
+ },
14236
+ {
14237
+ key: "getDeviceInfo",
14238
+ value: function getDeviceInfo1() {
14239
+ return getDeviceInfo();
14240
+ }
14241
+ },
14242
+ {
14243
+ key: "setDeviceInfo",
14244
+ value: function setDeviceInfo(info) {
14245
+ setHostDeviceInfo(info);
14246
+ }
14247
+ },
12945
14248
  {
12946
14249
  key: "onManifestParsed",
12947
14250
  value: function onManifestParsed(isLive) {
@@ -13076,9 +14379,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13076
14379
  }
13077
14380
  },
13078
14381
  {
13079
- // ───────────────────────────────────────────────────────────────
13080
- // SCTE-35 marker orchestration
13081
- // ───────────────────────────────────────────────────────────────
13082
14382
  key: "onScte35Marker",
13083
14383
  value: function onScte35Marker(marker, cueKey) {
13084
14384
  if (this.debug) {
@@ -13257,9 +14557,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13257
14557
  }
13258
14558
  },
13259
14559
  {
13260
- // ───────────────────────────────────────────────────────────────
13261
- // Ad prefetch
13262
- // ───────────────────────────────────────────────────────────────
13263
14560
  key: "startAdPrefetch",
13264
14561
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13265
14562
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13298,9 +14595,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13298
14595
  }
13299
14596
  },
13300
14597
  {
13301
- // ───────────────────────────────────────────────────────────────
13302
- // VMAP time-based ad breaks
13303
- // ───────────────────────────────────────────────────────────────
13304
14598
  key: "onTimeUpdate",
13305
14599
  value: function onTimeUpdate(currentTimeSec) {
13306
14600
  var _this = this;
@@ -13414,9 +14708,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13414
14708
  }
13415
14709
  },
13416
14710
  {
13417
- // ───────────────────────────────────────────────────────────────
13418
- // Public API
13419
- // ───────────────────────────────────────────────────────────────
13420
14711
  key: "getCurrentAdIndex",
13421
14712
  value: function getCurrentAdIndex() {
13422
14713
  return this.timing.currentAdIndex;
@@ -13535,12 +14826,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13535
14826
  }
13536
14827
  },
13537
14828
  {
13538
- // ───────────────────────────────────────────────────────────────
13539
- // Destroy
13540
- // ───────────────────────────────────────────────────────────────
13541
14829
  key: "destroy",
13542
14830
  value: function destroy() {
13543
14831
  var _this_adPlayer;
14832
+ if (this.palRefreshTimer != null) {
14833
+ clearInterval(this.palRefreshTimer);
14834
+ this.palRefreshTimer = void 0;
14835
+ }
13544
14836
  this.contentWatchdog.stop();
13545
14837
  this.adBreak.cancelScheduledRequest();
13546
14838
  this.timing.destroy();