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
@@ -362,8 +362,264 @@ __export(StormcloudVideoPlayer_exports, {
362
362
  }
363
363
  });
364
364
  module.exports = __toCommonJS(StormcloudVideoPlayer_exports);
365
+ // src/utils/adIdentity.ts
366
+ var GOOGLE_ID_TYPES = [
367
+ "aaid",
368
+ "adid",
369
+ "afai",
370
+ "idfa",
371
+ "lgudid",
372
+ "msai",
373
+ "rida",
374
+ "tifa",
375
+ "tvOS",
376
+ "vaid",
377
+ "vida",
378
+ "dpid"
379
+ ];
380
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
381
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
382
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
383
+ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
384
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
385
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
386
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
387
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
388
+ "00000000-0000-0000-0000-000000000000",
389
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
390
+ ]);
391
+ var hostIdentity;
392
+ var memoryStore = {};
393
+ var lgUdidResult;
394
+ var lgUdidPromise;
395
+ var legacyCleared = false;
396
+ function isUsableAdId(value) {
397
+ if (typeof value !== "string") return false;
398
+ var t = value.trim();
399
+ if (!t) return false;
400
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
401
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
402
+ return !ZEROED_IDS.has(t.toLowerCase());
403
+ }
404
+ function isZeroedAdId(value) {
405
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
406
+ }
407
+ function normalizeIdType(value) {
408
+ if (typeof value !== "string") return void 0;
409
+ var lower = value.trim().toLowerCase();
410
+ if (!lower) return void 0;
411
+ var match = GOOGLE_ID_TYPES.find(function(t) {
412
+ return t.toLowerCase() === lower;
413
+ });
414
+ return match !== null && match !== void 0 ? match : "dpid";
415
+ }
416
+ function createUuid() {
417
+ var _bytes_, _bytes_1, _bytes_i;
418
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
419
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
420
+ var bytes = new Uint8Array(16);
421
+ if (c && typeof c.getRandomValues === "function") {
422
+ c.getRandomValues(bytes);
423
+ } else {
424
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
425
+ }
426
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
427
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
428
+ var hex = "";
429
+ 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");
430
+ 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));
431
+ }
432
+ function readStored(key) {
433
+ try {
434
+ var _window_localStorage;
435
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
436
+ if (raw) {
437
+ var parsed = JSON.parse(raw);
438
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
439
+ return {
440
+ id: parsed.id,
441
+ createdAt: parsed.createdAt
442
+ };
443
+ }
444
+ }
445
+ } catch (unused) {}
446
+ return memoryStore[key];
447
+ }
448
+ function writeStored(key, value) {
449
+ memoryStore[key] = value;
450
+ try {
451
+ if (typeof window !== "undefined") {
452
+ var _window_localStorage;
453
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
454
+ }
455
+ } catch (unused) {}
456
+ }
457
+ function removeStored(key) {
458
+ delete memoryStore[key];
459
+ try {
460
+ var _window_localStorage;
461
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
462
+ } catch (unused) {}
463
+ }
464
+ function clearLegacyIdsOnce() {
465
+ if (legacyCleared) return;
466
+ legacyCleared = true;
467
+ try {
468
+ var _window_localStorage;
469
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
470
+ } catch (unused) {}
471
+ try {
472
+ if (typeof document !== "undefined") {
473
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
474
+ }
475
+ } catch (unused) {}
476
+ }
477
+ function clampAge(value, fallback, max) {
478
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
479
+ if (max != null) v = Math.min(v, max);
480
+ return v;
481
+ }
482
+ function setHostAdIdentity(identity) {
483
+ var _normalizeIdType;
484
+ if (!identity || !isUsableAdId(identity.deviceId)) {
485
+ hostIdentity = void 0;
486
+ return;
487
+ }
488
+ var deviceId = identity.deviceId.trim();
489
+ var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
490
+ hostIdentity = _object_spread({
491
+ deviceId: deviceId,
492
+ deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
493
+ }, typeof identity.limitAdTracking === "boolean" ? {
494
+ limitAdTracking: identity.limitAdTracking
495
+ } : {});
496
+ if (changed) {
497
+ removeStored(SESSION_ID_KEY);
498
+ removeStored(FALLBACK_DEVICE_ID_KEY);
499
+ }
500
+ }
501
+ function getHostAdIdentity() {
502
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
503
+ }
504
+ function resetAdIdentity() {
505
+ removeStored(SESSION_ID_KEY);
506
+ removeStored(FALLBACK_DEVICE_ID_KEY);
507
+ }
508
+ function readSamsungTifa() {
509
+ try {
510
+ var _window_webapis;
511
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
512
+ if (!adinfo) return void 0;
513
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
514
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
515
+ if (isZeroedAdId(tifa)) return {
516
+ deviceIdType: "tifa",
517
+ limitAdTracking: true
518
+ };
519
+ if (!isUsableAdId(tifa)) return void 0;
520
+ return _object_spread({
521
+ deviceId: tifa.trim(),
522
+ deviceIdType: "tifa"
523
+ }, typeof lat === "boolean" ? {
524
+ limitAdTracking: lat
525
+ } : {});
526
+ } catch (unused) {
527
+ return void 0;
528
+ }
529
+ }
530
+ function primeLgUdid() {
531
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
532
+ if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
533
+ var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
534
+ if (!dev) return Promise.resolve();
535
+ if (typeof dev.LGUDID !== "function") {
536
+ var _dev_lgudid;
537
+ var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
538
+ if (isZeroedAdId(direct)) lgUdidResult = {
539
+ deviceIdType: "lgudid",
540
+ limitAdTracking: true
541
+ };
542
+ else if (isUsableAdId(direct)) {
543
+ lgUdidResult = {
544
+ deviceId: direct.trim(),
545
+ deviceIdType: "lgudid",
546
+ limitAdTracking: false
547
+ };
548
+ }
549
+ return Promise.resolve();
550
+ }
551
+ lgUdidPromise = new Promise(function(resolve) {
552
+ var settled = false;
553
+ var finish = function finish() {
554
+ if (settled) return;
555
+ settled = true;
556
+ clearTimeout(timer);
557
+ resolve();
558
+ };
559
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
560
+ try {
561
+ dev.LGUDID({
562
+ onSuccess: function onSuccess(res) {
563
+ var id = res === null || res === void 0 ? void 0 : res.id;
564
+ if (isZeroedAdId(id)) {
565
+ lgUdidResult = {
566
+ deviceIdType: "lgudid",
567
+ limitAdTracking: true
568
+ };
569
+ } else if (isUsableAdId(id)) {
570
+ lgUdidResult = {
571
+ deviceId: id.trim(),
572
+ deviceIdType: "lgudid",
573
+ limitAdTracking: false
574
+ };
575
+ }
576
+ finish();
577
+ },
578
+ onFailure: function onFailure() {
579
+ return finish();
580
+ }
581
+ });
582
+ } catch (unused) {
583
+ finish();
584
+ }
585
+ });
586
+ return lgUdidPromise;
587
+ }
588
+ function readCachedLgUdid() {
589
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
590
+ }
591
+ function getOrRotateFallbackDeviceId() {
592
+ 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();
593
+ clearLegacyIdsOnce();
594
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
595
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
596
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
597
+ return stored.id;
598
+ }
599
+ var id = createUuid();
600
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
601
+ id: id,
602
+ createdAt: now
603
+ });
604
+ return id;
605
+ }
606
+ function getOrRotateSessionId() {
607
+ 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();
608
+ clearLegacyIdsOnce();
609
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
610
+ var stored = readStored(SESSION_ID_KEY);
611
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
612
+ return stored.id;
613
+ }
614
+ var id = createUuid();
615
+ while(id === avoidValue)id = createUuid();
616
+ writeStored(SESSION_ID_KEY, {
617
+ id: id,
618
+ createdAt: now
619
+ });
620
+ return id;
621
+ }
365
622
  // src/utils/vastEnvironmentSignals.ts
366
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
367
623
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
368
624
  var DEVICE_ID_STORAGE_KEYS = [
369
625
  "rdid",
@@ -382,49 +638,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
382
638
  "adid"
383
639
  ]);
384
640
  function resolveVastEnvironmentSignals(isCtv) {
385
- var bridgeSignals = readNativeBridgeSignals();
386
- var platformDevice = readPlatformNativeDeviceId();
387
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
388
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
389
- var deviceId = realDeviceId;
390
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
391
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
392
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
393
- if (!deviceId && isCtv) {
394
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
395
- if (dpid) {
396
- deviceId = dpid;
397
- deviceIdType = "dpid";
398
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
399
- }
400
- }
641
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
401
642
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
643
+ var identity = resolveDeviceIdentity(isCtv, options);
644
+ var identityFields = _object_spread({}, identity.deviceId ? {
645
+ deviceId: identity.deviceId
646
+ } : {}, identity.deviceId && identity.deviceIdType ? {
647
+ deviceIdType: identity.deviceIdType
648
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
649
+ limitAdTracking: identity.limitAdTracking
650
+ } : {}, identity.source ? {
651
+ deviceIdSource: identity.source
652
+ } : {});
402
653
  if (isCtv) {
403
654
  return _object_spread_props(_object_spread({
404
655
  isCtv: true,
405
- sessionId: getOrCreateCtvSessionId()
406
- }, deviceId ? {
407
- deviceId: deviceId
408
- } : {}, deviceId && deviceIdType ? {
409
- deviceIdType: deviceIdType
410
- } : {}, deviceId && limitAdTracking != null ? {
411
- limitAdTracking: limitAdTracking
412
- } : {}), {
656
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
657
+ }, identityFields), {
413
658
  deviceTypeHint: deviceTypeHint
414
659
  });
415
660
  }
416
661
  return _object_spread_props(_object_spread({
417
662
  isCtv: false
418
- }, deviceId ? {
419
- deviceId: deviceId
420
- } : {}, deviceId && deviceIdType ? {
421
- deviceIdType: deviceIdType
422
- } : {}, deviceId && limitAdTracking != null ? {
423
- limitAdTracking: limitAdTracking
424
- } : {}), {
663
+ }, identityFields), {
425
664
  deviceTypeHint: deviceTypeHint
426
665
  });
427
666
  }
667
+ function resolveDeviceIdentity(isCtv, options) {
668
+ var _platform_limitAdTracking;
669
+ var host = getHostAdIdentity();
670
+ if (host) {
671
+ var _host_deviceIdType;
672
+ return _object_spread_props(_object_spread({
673
+ deviceId: host.deviceId,
674
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
675
+ }, host.limitAdTracking != null ? {
676
+ limitAdTracking: host.limitAdTracking
677
+ } : {}), {
678
+ source: "host"
679
+ });
680
+ }
681
+ var bridge = readNativeBridgeSignals();
682
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
683
+ if (bridgeDeviceId) {
684
+ var _normalizeIdType;
685
+ return _object_spread_props(_object_spread({
686
+ deviceId: bridgeDeviceId,
687
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
688
+ }, bridge.limitAdTracking != null ? {
689
+ limitAdTracking: bridge.limitAdTracking
690
+ } : {}), {
691
+ source: "bridge"
692
+ });
693
+ }
694
+ var platform = readPlatformNativeDeviceId();
695
+ var platformDeviceId = validDeviceId(platform.deviceId);
696
+ if (platformDeviceId) {
697
+ var _platform_deviceIdType;
698
+ return _object_spread_props(_object_spread({
699
+ deviceId: platformDeviceId,
700
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
701
+ }, platform.limitAdTracking != null ? {
702
+ limitAdTracking: platform.limitAdTracking
703
+ } : {}), {
704
+ source: "platform"
705
+ });
706
+ }
707
+ if (!isCtv) return {};
708
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
709
+ if (storedDeviceId) {
710
+ var _normalizeIdType1;
711
+ var storedLat = readStoredLimitAdTracking();
712
+ return _object_spread_props(_object_spread({
713
+ deviceId: storedDeviceId,
714
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
715
+ }, storedLat != null ? {
716
+ limitAdTracking: storedLat
717
+ } : {}), {
718
+ source: "stored"
719
+ });
720
+ }
721
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
722
+ return _object_spread_props(_object_spread({
723
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
724
+ deviceIdType: "dpid"
725
+ }, fallbackLat != null ? {
726
+ limitAdTracking: fallbackLat
727
+ } : {}), {
728
+ source: "generated"
729
+ });
730
+ }
428
731
  var DEVICE_TYPE_HINT = {
429
732
  FEATURE_PHONE: 1,
430
733
  SMARTPHONE: 2,
@@ -585,7 +888,7 @@ function resolveNativeDeviceId() {
585
888
  var bridgeSignals = readNativeBridgeSignals();
586
889
  var platformDevice = readPlatformNativeDeviceId();
587
890
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
588
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
891
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
589
892
  return void 0;
590
893
  }
591
894
  return deviceId;
@@ -599,20 +902,10 @@ function getOrCreateStoredUuid(storageKey) {
599
902
  writePersistentId(storageKey, existing);
600
903
  return existing;
601
904
  }
602
- var id = createUuid();
905
+ var id = createUuid2();
603
906
  writePersistentId(storageKey, id);
604
907
  return id;
605
908
  }
606
- function getOrCreateCtvSessionId() {
607
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
608
- if (existing) {
609
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
610
- return existing;
611
- }
612
- var sessionId = createUuid();
613
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
614
- return sessionId;
615
- }
616
909
  function readPersistentId(storageKey) {
617
910
  return readStoredString(storageKey) || readCookie(storageKey);
618
911
  }
@@ -665,7 +958,7 @@ function writeCookie(name, value) {
665
958
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
666
959
  } catch (unused) {}
667
960
  }
668
- function createUuid() {
961
+ function createUuid2() {
669
962
  var _bytes_, _bytes_1;
670
963
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
671
964
  return crypto.randomUUID();
@@ -699,44 +992,10 @@ function performanceNow() {
699
992
  }
700
993
  function readPlatformNativeDeviceId() {
701
994
  if (typeof window === "undefined") return {};
702
- try {
703
- var _window_webapis;
704
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
705
- if (adinfo) {
706
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
707
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
708
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
709
- return _object_spread({
710
- deviceId: tifa,
711
- deviceIdType: "tifa"
712
- }, typeof lat === "boolean" ? {
713
- limitAdTracking: lat
714
- } : {});
715
- }
716
- }
717
- } catch (unused) {}
718
- try {
719
- var webOSDev = window.webOSDev;
720
- if (webOSDev) {
721
- var _webOSDev_lgudid;
722
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
723
- if (typeof lgudid === "string" && lgudid) {
724
- if (isZeroedAdId(lgudid)) {
725
- return {
726
- deviceIdType: "lgudid",
727
- limitAdTracking: true
728
- };
729
- }
730
- if (!isMacroPlaceholder(lgudid)) {
731
- return {
732
- deviceId: lgudid,
733
- deviceIdType: "lgudid",
734
- limitAdTracking: false
735
- };
736
- }
737
- }
738
- }
739
- } catch (unused) {}
995
+ var tifa = readSamsungTifa();
996
+ if (tifa) return tifa;
997
+ var lgudid = readCachedLgUdid();
998
+ if (lgudid) return lgudid;
740
999
  try {
741
1000
  var roku = window.Roku;
742
1001
  if (roku) {
@@ -763,7 +1022,7 @@ function isMacroPlaceholder(value) {
763
1022
  function validDeviceId(value) {
764
1023
  return value && !isMacroPlaceholder(value) ? value : void 0;
765
1024
  }
766
- function isZeroedAdId(value) {
1025
+ function isZeroedAdId2(value) {
767
1026
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
768
1027
  }
769
1028
  function readNativeBridgeSignals() {
@@ -807,7 +1066,7 @@ function readNativeBridgeSignals() {
807
1066
  "deviceIdType",
808
1067
  "advertisingIdType",
809
1068
  "idType"
810
- ]) || inferDeviceIdType();
1069
+ ]) || void 0;
811
1070
  var limitAdTracking = readBridgeBoolean(source, [
812
1071
  "is_lat",
813
1072
  "limitAdTracking",
@@ -987,6 +1246,308 @@ function normalizeBoolean(value) {
987
1246
  }
988
1247
  return void 0;
989
1248
  }
1249
+ // src/utils/contentMetadata.ts
1250
+ var MAX_CONTENT_VALUE_LENGTH = 128;
1251
+ var BRIDGE_KEYS = {
1252
+ channelName: [
1253
+ "channelName",
1254
+ "ct_ch"
1255
+ ],
1256
+ programTitle: [
1257
+ "programTitle",
1258
+ "ct_ti"
1259
+ ],
1260
+ contentNetwork: [
1261
+ "contentNetwork",
1262
+ "ct_ne"
1263
+ ],
1264
+ contentType: [
1265
+ "contentType",
1266
+ "ctt"
1267
+ ],
1268
+ contentCategory: [
1269
+ "contentCategory",
1270
+ "ctc"
1271
+ ],
1272
+ contentGenre: [
1273
+ "contentGenre",
1274
+ "ctgr"
1275
+ ],
1276
+ contentLanguage: [
1277
+ "contentLanguage",
1278
+ "ctlg"
1279
+ ],
1280
+ contentDuration: [
1281
+ "contentDuration",
1282
+ "ctd"
1283
+ ],
1284
+ contentSeason: [
1285
+ "contentSeason",
1286
+ "cts"
1287
+ ],
1288
+ contentEpisode: [
1289
+ "contentEpisode",
1290
+ "cte"
1291
+ ],
1292
+ contentRating: [
1293
+ "contentRating",
1294
+ "ctr"
1295
+ ],
1296
+ contentId: [
1297
+ "contentId",
1298
+ "ctid"
1299
+ ]
1300
+ };
1301
+ function sanitizeContentValue(value) {
1302
+ if (typeof value !== "string") return void 0;
1303
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1304
+ if (!cleaned) return void 0;
1305
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1306
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
1307
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1308
+ }
1309
+ function sanitizeContentScalar(value) {
1310
+ if (typeof value === "number") {
1311
+ return Number.isFinite(value) ? String(value) : void 0;
1312
+ }
1313
+ return sanitizeContentValue(value);
1314
+ }
1315
+ function normalizeContentLanguage(value) {
1316
+ var cleaned = sanitizeContentValue(value);
1317
+ if (!cleaned) return void 0;
1318
+ var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
1319
+ return match && match[1] ? match[1].toLowerCase() : void 0;
1320
+ }
1321
+ function normalizeContentDuration(value) {
1322
+ var raw = sanitizeContentScalar(value);
1323
+ if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
1324
+ var seconds = Number(raw);
1325
+ if (seconds === -1) return -1;
1326
+ return seconds > 0 ? Math.round(seconds) : void 0;
1327
+ }
1328
+ function bridgeSources() {
1329
+ if (typeof window === "undefined") return [];
1330
+ var w = window;
1331
+ return [
1332
+ w.__STORMCLOUD_CTV__,
1333
+ w.__STORMCLOUD_CTV_AD_INFO__,
1334
+ w.stormcloudCtv
1335
+ ].filter(Boolean);
1336
+ }
1337
+ function readBridgeValue2(keys, sanitize) {
1338
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1339
+ try {
1340
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1341
+ var source = _step.value;
1342
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1343
+ try {
1344
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1345
+ var key = _step1.value;
1346
+ var value = void 0;
1347
+ try {
1348
+ value = source === null || source === void 0 ? void 0 : source[key];
1349
+ if (typeof value === "function") value = value.call(source);
1350
+ } catch (unused) {
1351
+ value = void 0;
1352
+ }
1353
+ var sanitized = sanitize(value);
1354
+ if (sanitized != null) return sanitized;
1355
+ }
1356
+ } catch (err) {
1357
+ _didIteratorError1 = true;
1358
+ _iteratorError1 = err;
1359
+ } finally{
1360
+ try {
1361
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1362
+ _iterator1.return();
1363
+ }
1364
+ } finally{
1365
+ if (_didIteratorError1) {
1366
+ throw _iteratorError1;
1367
+ }
1368
+ }
1369
+ }
1370
+ }
1371
+ } catch (err) {
1372
+ _didIteratorError = true;
1373
+ _iteratorError = err;
1374
+ } finally{
1375
+ try {
1376
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1377
+ _iterator.return();
1378
+ }
1379
+ } finally{
1380
+ if (_didIteratorError) {
1381
+ throw _iteratorError;
1382
+ }
1383
+ }
1384
+ }
1385
+ return void 0;
1386
+ }
1387
+ function readBridgeContentValue(keys) {
1388
+ return readBridgeValue2(keys, sanitizeContentValue);
1389
+ }
1390
+ function resolveContentMetadata(config) {
1391
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
1392
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1393
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1394
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1395
+ var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
1396
+ var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
1397
+ var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
1398
+ var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
1399
+ var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
1400
+ var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
1401
+ var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
1402
+ var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
1403
+ var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
1404
+ var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
1405
+ return _object_spread({}, channelName ? {
1406
+ channelName: channelName
1407
+ } : {}, programTitle ? {
1408
+ programTitle: programTitle
1409
+ } : {}, contentNetwork ? {
1410
+ contentNetwork: contentNetwork
1411
+ } : {}, contentType ? {
1412
+ contentType: contentType
1413
+ } : {}, contentCategory ? {
1414
+ contentCategory: contentCategory
1415
+ } : {}, contentGenre ? {
1416
+ contentGenre: contentGenre
1417
+ } : {}, contentLanguage ? {
1418
+ contentLanguage: contentLanguage
1419
+ } : {}, contentDurationSeconds != null ? {
1420
+ contentDurationSeconds: contentDurationSeconds
1421
+ } : {}, contentSeason ? {
1422
+ contentSeason: contentSeason
1423
+ } : {}, contentEpisode ? {
1424
+ contentEpisode: contentEpisode
1425
+ } : {}, contentRating ? {
1426
+ contentRating: contentRating
1427
+ } : {}, contentId ? {
1428
+ contentId: contentId
1429
+ } : {});
1430
+ }
1431
+ function applyContentMetadataUpdate(target, meta) {
1432
+ var apply = function apply(key, value) {
1433
+ if (value === void 0) return;
1434
+ var clean = value === null ? void 0 : sanitizeContentValue(value);
1435
+ if (clean) target[key] = clean;
1436
+ else delete target[key];
1437
+ };
1438
+ apply("channelName", meta.channelName);
1439
+ apply("programTitle", meta.programTitle);
1440
+ apply("contentNetwork", meta.contentNetwork);
1441
+ if (meta.details === void 0) return;
1442
+ if (meta.details === null) delete target.contentDetails;
1443
+ else target.contentDetails = _object_spread({}, meta.details);
1444
+ }
1445
+ function appendMissingContentParams(url, meta) {
1446
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1447
+ try {
1448
+ var parsed = new URL(url);
1449
+ var add = function add(key, value) {
1450
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1451
+ };
1452
+ add("ct_ch", meta.channelName);
1453
+ add("ct_ti", meta.programTitle);
1454
+ add("ct_ne", meta.contentNetwork);
1455
+ return parsed.toString();
1456
+ } catch (unused) {
1457
+ return url;
1458
+ }
1459
+ }
1460
+ // src/utils/partnerSignals.ts
1461
+ var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
1462
+ "aaid",
1463
+ "adid",
1464
+ "afai",
1465
+ "idfa",
1466
+ "lgudid",
1467
+ "msai",
1468
+ "rida",
1469
+ "tifa",
1470
+ "tvos",
1471
+ "vaid",
1472
+ "vida"
1473
+ ]);
1474
+ function toIabIfaType(deviceIdType, source) {
1475
+ if (!deviceIdType) return void 0;
1476
+ var type = deviceIdType.trim().toLowerCase();
1477
+ if (source === "generated") return "sessionid";
1478
+ if (PLATFORM_IFA_TYPES.has(type)) return type;
1479
+ if (source === "platform") return "dpid";
1480
+ return "ppid";
1481
+ }
1482
+ function playbackMethodCode(autoPlay, muted) {
1483
+ if (autoPlay === false) return 3;
1484
+ if (autoPlay !== true || muted == null) return void 0;
1485
+ return muted ? 2 : 1;
1486
+ }
1487
+ function resolvePlayerSize(video) {
1488
+ var width = video ? video.clientWidth : 0;
1489
+ var height = video ? video.clientHeight : 0;
1490
+ if (!(width > 0 && height > 0) && typeof window !== "undefined") {
1491
+ width = window.innerWidth;
1492
+ height = window.innerHeight;
1493
+ }
1494
+ if (!(width > 0 && height > 0)) return {};
1495
+ return {
1496
+ width: Math.round(width),
1497
+ height: Math.round(height)
1498
+ };
1499
+ }
1500
+ function sanitizeUserId(value) {
1501
+ var cleaned = sanitizeContentValue(value);
1502
+ if (!cleaned || /\s/.test(cleaned)) return void 0;
1503
+ return cleaned;
1504
+ }
1505
+ function isPublicIpv4(ip) {
1506
+ var parts = ip.split(".");
1507
+ if (parts.length !== 4) return false;
1508
+ var nums = parts.map(function(p) {
1509
+ return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
1510
+ });
1511
+ if (nums.some(function(n) {
1512
+ return !(n >= 0 && n <= 255);
1513
+ })) return false;
1514
+ var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
1515
+ if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
1516
+ if (a === 100 && b >= 64 && b <= 127) return false;
1517
+ if (a === 169 && b === 254) return false;
1518
+ if (a === 172 && b >= 16 && b <= 31) return false;
1519
+ if (a === 192 && b === 168) return false;
1520
+ return true;
1521
+ }
1522
+ function isPublicIpv6(ip) {
1523
+ var lower = ip.toLowerCase();
1524
+ if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
1525
+ if (lower === "::" || lower === "::1") return false;
1526
+ if (/^fe[89ab]/.test(lower)) return false;
1527
+ if (/^f[cd]/.test(lower)) return false;
1528
+ return true;
1529
+ }
1530
+ function sanitizePublicIp(value) {
1531
+ var cleaned = sanitizeContentValue(value);
1532
+ if (!cleaned) return void 0;
1533
+ if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
1534
+ return isPublicIpv6(cleaned) ? cleaned : void 0;
1535
+ }
1536
+ function resolveUserId(configValue) {
1537
+ var _sanitizeUserId;
1538
+ return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
1539
+ "userId",
1540
+ "uid"
1541
+ ], sanitizeUserId);
1542
+ }
1543
+ function resolveClientIp(configValue) {
1544
+ var _sanitizePublicIp;
1545
+ return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
1546
+ "ipAddress",
1547
+ "clientIp",
1548
+ "ip"
1549
+ ], sanitizePublicIp);
1550
+ }
990
1551
  // src/utils/vastMacros.ts
991
1552
  var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
992
1553
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
@@ -1304,7 +1865,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
1304
1865
  var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
1305
1866
  "PMND",
1306
1867
  "PMXD",
1307
- "PMAD"
1868
+ "PMAD",
1869
+ "MABD"
1308
1870
  ]);
1309
1871
  function hasScvpMacros(url) {
1310
1872
  return !!url && SCVP_MACRO_DETECT.test(url);
@@ -1349,12 +1911,15 @@ function resolveScvpMacroValues(ctx) {
1349
1911
  set("RDID", deviceId);
1350
1912
  set("IDTYPE", deviceIdType);
1351
1913
  set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
1914
+ set("IFA", deviceId);
1915
+ set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
1352
1916
  }
1353
1917
  set("SID", ctx.sessionId);
1354
1918
  set("DTH", ctx.deviceTypeHint);
1355
1919
  set("GIVN", ctx.palNonce);
1356
1920
  set("CT-TI", ctx.programTitle);
1357
1921
  set("CT-CH", ctx.channelName);
1922
+ set("CT-NE", ctx.contentNetwork);
1358
1923
  set("POD", ctx.pod);
1359
1924
  set("CORRELATOR", ctx.correlator);
1360
1925
  set("SCOR", ctx.streamCorrelator);
@@ -1365,6 +1930,26 @@ function resolveScvpMacroValues(ctx) {
1365
1930
  set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
1366
1931
  set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
1367
1932
  set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
1933
+ set("PLAYER-WIDTH", ctx.playerWidth);
1934
+ set("PLAYER-HEIGHT", ctx.playerHeight);
1935
+ set("TIMESTAMP", ctx.timestamp);
1936
+ set("LIVE", toFlag(ctx.isLive));
1937
+ set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
1938
+ set("DEVICE-MAKE", ctx.deviceMake);
1939
+ set("DEVICE-MODEL", ctx.deviceModel);
1940
+ set("DEVICE-HWV", ctx.deviceHardwareVersion);
1941
+ set("UA", ctx.userAgent);
1942
+ set("IP", ctx.ipAddress);
1943
+ set("UID", ctx.userId);
1944
+ set("CT-TYPE", ctx.contentType);
1945
+ set("CT-CATEGORY", ctx.contentCategory);
1946
+ set("CT-GENRE", ctx.contentGenre);
1947
+ set("CT-LANGUAGE", ctx.contentLanguage);
1948
+ set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
1949
+ set("CT-SEASON", ctx.contentSeason);
1950
+ set("CT-EPISODE", ctx.contentEpisode);
1951
+ set("CT-RATING", ctx.contentRating);
1952
+ set("CT-ID", ctx.contentId);
1368
1953
  return values;
1369
1954
  }
1370
1955
  var keepNone = function keepNone() {
@@ -1583,6 +2168,9 @@ function applyVastMacros(baseUrl, ctx) {
1583
2168
  if (ctx.channelName) {
1584
2169
  params.set("ct_ch", ctx.channelName);
1585
2170
  }
2171
+ if (ctx.contentNetwork) {
2172
+ params.set("ct_ne", ctx.contentNetwork);
2173
+ }
1586
2174
  var staleKeys = [];
1587
2175
  params.forEach(function(value, key) {
1588
2176
  if (isMacroPlaceholder2(value)) {
@@ -2247,8 +2835,17 @@ function detectBrowser() {
2247
2835
  chromeVersion: chromeVersionNum
2248
2836
  };
2249
2837
  }
2838
+ var singleDecoderOverride;
2839
+ function setSingleDecoderOverride(value) {
2840
+ singleDecoderOverride = value;
2841
+ }
2250
2842
  function requiresMediaPipelineResetAfterAds() {
2251
2843
  var _browser_tizenVersion;
2844
+ if (singleDecoderOverride != null) return singleDecoderOverride;
2845
+ try {
2846
+ var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
2847
+ if (typeof globalOverride === "boolean") return globalOverride;
2848
+ } catch (unused) {}
2252
2849
  var browser = detectBrowser();
2253
2850
  return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
2254
2851
  }
@@ -2408,7 +3005,7 @@ function substituteVastTrackingMacros(url) {
2408
3005
  });
2409
3006
  }
2410
3007
  // src/player/OptimizedPodRequest.ts
2411
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
3008
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
2412
3009
  var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
2413
3010
  var POD_PARAM_KEYS = [
2414
3011
  "pmnd",
@@ -2568,15 +3165,20 @@ function finalizeGamRequestUrl(rawUrl, ctx) {
2568
3165
  values.set("PMND", String(pod.pmnd));
2569
3166
  values.set("PMXD", String(pod.pmxd));
2570
3167
  if (pod.pmad != null) values.set("PMAD", String(pod.pmad));
3168
+ values.set("MABD", String(Math.max(1, Math.floor(pod.pmxd / 1e3))));
2571
3169
  }
2572
3170
  var substituted = substituteScvpMacros(rawUrl, values);
2573
3171
  var finalUrl;
2574
3172
  try {
2575
3173
  var url = new URL(normalizeVastTagUrl(substituted.url));
3174
+ var isGam = GAM_AD_HOSTS.has(url.hostname);
3175
+ var setPodParam = function setPodParam(key, value) {
3176
+ if (isGam || url.searchParams.has(key)) url.searchParams.set(key, String(value));
3177
+ };
2576
3178
  if (pod) {
2577
- url.searchParams.set("pmnd", String(pod.pmnd));
2578
- url.searchParams.set("pmxd", String(pod.pmxd));
2579
- if (pod.pmad != null) url.searchParams.set("pmad", String(pod.pmad));
3179
+ setPodParam("pmnd", pod.pmnd);
3180
+ setPodParam("pmxd", pod.pmxd);
3181
+ if (pod.pmad != null) setPodParam("pmad", pod.pmad);
2580
3182
  else url.searchParams.delete("pmad");
2581
3183
  } else {
2582
3184
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -2642,7 +3244,9 @@ function validateGamRequestUrl(url, expect) {
2642
3244
  if (leftover.length > 0) problems.push("unresolved SCVP macros: ".concat(leftover.join(", ")));
2643
3245
  var params;
2644
3246
  try {
2645
- params = new URL(url).searchParams;
3247
+ var parsed = new URL(url);
3248
+ if (!GAM_AD_HOSTS.has(parsed.hostname)) return problems;
3249
+ params = parsed.searchParams;
2646
3250
  } catch (unused) {
2647
3251
  return problems.concat("URL could not be parsed");
2648
3252
  }
@@ -2832,6 +3436,9 @@ function createHlsAdPlayer(contentVideo, options) {
2832
3436
  var mediaCandidateIndex = 0;
2833
3437
  var mediaStartTimerId;
2834
3438
  var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
3439
+ var MAX_MEDIA_START_ATTEMPTS = 2;
3440
+ var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
3441
+ var mediaStartBudgetStartedAt = 0;
2835
3442
  var VAST_ERROR_MEDIA_TIMEOUT = 402;
2836
3443
  var pendingVastRequests = /* @__PURE__ */ new Set();
2837
3444
  var pendingRequestAbortReason;
@@ -4846,12 +5453,14 @@ function createHlsAdPlayer(contentVideo, options) {
4846
5453
  clearMediaStartTimer();
4847
5454
  if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
4848
5455
  var startedAt = Date.now();
5456
+ var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
5457
+ var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
4849
5458
  mediaStartTimerId = setTimeout(function() {
4850
5459
  mediaStartTimerId = void 0;
4851
5460
  if (!adPlaying || trackingFired.impression) return;
4852
- console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
5461
+ console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
4853
5462
  logFunnel("play_resolved_but_never_started", {
4854
- timeoutMs: MEDIA_START_TIMEOUT_MS,
5463
+ timeoutMs: timeoutMs,
4855
5464
  elapsedMs: Date.now() - startedAt,
4856
5465
  readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
4857
5466
  networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
@@ -4860,7 +5469,7 @@ function createHlsAdPlayer(contentVideo, options) {
4860
5469
  vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
4861
5470
  });
4862
5471
  recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
4863
- }, MEDIA_START_TIMEOUT_MS);
5472
+ }, timeoutMs);
4864
5473
  }
4865
5474
  function resetVideoElementForNextSource() {
4866
5475
  clearStallWatchdog();
@@ -4875,6 +5484,20 @@ function createHlsAdPlayer(contentVideo, options) {
4875
5484
  function tryNextMediaCandidate() {
4876
5485
  if (!currentAd || trackingFired.impression) return false;
4877
5486
  if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
5487
+ if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
5488
+ logFunnel("media_fallback_capped", {
5489
+ reason: "max_attempts",
5490
+ attempts: mediaCandidateIndex + 1
5491
+ });
5492
+ return false;
5493
+ }
5494
+ if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
5495
+ logFunnel("media_fallback_capped", {
5496
+ reason: "time_budget",
5497
+ elapsedMs: Date.now() - mediaStartBudgetStartedAt
5498
+ });
5499
+ return false;
5500
+ }
4878
5501
  var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
4879
5502
  mediaCandidateIndex++;
4880
5503
  var next = mediaCandidates[mediaCandidateIndex];
@@ -4908,6 +5531,7 @@ function createHlsAdPlayer(contentVideo, options) {
4908
5531
  }
4909
5532
  mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
4910
5533
  mediaCandidateIndex = 0;
5534
+ mediaStartBudgetStartedAt = Date.now();
4911
5535
  var mediaFile = mediaCandidates[0];
4912
5536
  if (!mediaFile) {
4913
5537
  logFunnel("media_unsupported", {
@@ -5847,6 +6471,7 @@ function getOrCreateNonceLoader(allowStorage) {
5847
6471
  }
5848
6472
  function createPalNonceManager() {
5849
6473
  var currentNonce = "";
6474
+ var currentNonceCreatedAt = 0;
5850
6475
  var currentNonceManager;
5851
6476
  var pendingNonce;
5852
6477
  return {
@@ -5863,6 +6488,9 @@ function createPalNonceManager() {
5863
6488
  getCurrentNonce: function getCurrentNonce() {
5864
6489
  return currentNonce;
5865
6490
  },
6491
+ getNonceAgeMs: function getNonceAgeMs() {
6492
+ return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
6493
+ },
5866
6494
  waitForNonce: function waitForNonce(maxWaitMs) {
5867
6495
  if (currentNonce) return Promise.resolve(currentNonce);
5868
6496
  var pending = pendingNonce;
@@ -5915,13 +6543,14 @@ function createPalNonceManager() {
5915
6543
  },
5916
6544
  reset: function reset() {
5917
6545
  currentNonce = "";
6546
+ currentNonceCreatedAt = 0;
5918
6547
  currentNonceManager = void 0;
5919
6548
  pendingNonce = void 0;
5920
6549
  }
5921
6550
  };
5922
6551
  function generate(options) {
5923
6552
  return _async_to_generator(function() {
5924
- var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
6553
+ var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
5925
6554
  return _ts_generator(this, function(_state) {
5926
6555
  switch(_state.label){
5927
6556
  case 0:
@@ -5945,10 +6574,11 @@ function createPalNonceManager() {
5945
6574
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
5946
6575
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
5947
6576
  request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5948
- request.iconsSupported = true;
6577
+ request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
5949
6578
  request.playerType = "StormcloudVideoPlayer";
5950
6579
  request.playerVersion = "1.0";
5951
- request.supportedApiFrameworks = "2,7,9";
6580
+ apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
6581
+ if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
5952
6582
  request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
5953
6583
  request.videoWidth = options.videoWidth || 640;
5954
6584
  request.videoHeight = options.videoHeight || 480;
@@ -5978,6 +6608,7 @@ function createPalNonceManager() {
5978
6608
  manager = _state.sent();
5979
6609
  currentNonceManager = manager;
5980
6610
  currentNonce = manager.getNonce();
6611
+ currentNonceCreatedAt = Date.now();
5981
6612
  console.log("[PAL] Nonce generated successfully");
5982
6613
  return [
5983
6614
  2,
@@ -6001,6 +6632,458 @@ function createPalNonceManager() {
6001
6632
  })();
6002
6633
  }
6003
6634
  }
6635
+ // src/utils/deviceInfo.ts
6636
+ var CATEGORY_CODES = {
6637
+ "LG TV": "lg_tv",
6638
+ "LG Set-Top Box": "lg_stb",
6639
+ "Samsung TV": "samsung_tv",
6640
+ Other: "other"
6641
+ };
6642
+ var DEVICE_CATEGORIES = [
6643
+ "LG TV",
6644
+ "LG Set-Top Box",
6645
+ "Samsung TV",
6646
+ "Other"
6647
+ ];
6648
+ var hostDeviceInfo;
6649
+ var lgDeviceInfo;
6650
+ var platformCache;
6651
+ var primePromise;
6652
+ function cleanString(value) {
6653
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
6654
+ if (typeof value !== "string") return void 0;
6655
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
6656
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
6657
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
6658
+ }
6659
+ function safeCall2(fn, thisArg) {
6660
+ if (typeof fn !== "function") return void 0;
6661
+ try {
6662
+ return fn.call(thisArg);
6663
+ } catch (unused) {
6664
+ return void 0;
6665
+ }
6666
+ }
6667
+ function userAgent() {
6668
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
6669
+ }
6670
+ function bridgeSources2() {
6671
+ if (typeof window === "undefined") return [];
6672
+ var w = window;
6673
+ return [
6674
+ w.__STORMCLOUD_CTV__,
6675
+ w.__STORMCLOUD_CTV_AD_INFO__,
6676
+ w.stormcloudCtv
6677
+ ].filter(Boolean);
6678
+ }
6679
+ function readBridge(keys) {
6680
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6681
+ try {
6682
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6683
+ var source = _step.value;
6684
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6685
+ try {
6686
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6687
+ var key = _step1.value;
6688
+ var value = void 0;
6689
+ try {
6690
+ value = source === null || source === void 0 ? void 0 : source[key];
6691
+ if (typeof value === "function") value = value.call(source);
6692
+ } catch (unused) {
6693
+ value = void 0;
6694
+ }
6695
+ var clean = cleanString(value);
6696
+ if (clean) return clean;
6697
+ }
6698
+ } catch (err) {
6699
+ _didIteratorError1 = true;
6700
+ _iteratorError1 = err;
6701
+ } finally{
6702
+ try {
6703
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6704
+ _iterator1.return();
6705
+ }
6706
+ } finally{
6707
+ if (_didIteratorError1) {
6708
+ throw _iteratorError1;
6709
+ }
6710
+ }
6711
+ }
6712
+ }
6713
+ } catch (err) {
6714
+ _didIteratorError = true;
6715
+ _iteratorError = err;
6716
+ } finally{
6717
+ try {
6718
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6719
+ _iterator.return();
6720
+ }
6721
+ } finally{
6722
+ if (_didIteratorError) {
6723
+ throw _iteratorError;
6724
+ }
6725
+ }
6726
+ }
6727
+ return void 0;
6728
+ }
6729
+ function makeForCategory(category) {
6730
+ if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
6731
+ if (category === "Samsung TV") return "Samsung";
6732
+ return void 0;
6733
+ }
6734
+ function normalizeCategory(value) {
6735
+ var v = cleanString(value);
6736
+ if (!v) return void 0;
6737
+ var exact = DEVICE_CATEGORIES.find(function(c) {
6738
+ return c.toLowerCase() === v.toLowerCase();
6739
+ });
6740
+ if (exact) return exact;
6741
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
6742
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
6743
+ return CATEGORY_CODES[c] === code;
6744
+ });
6745
+ return byCode;
6746
+ }
6747
+ function parseUserAgentDeviceInfo(ua) {
6748
+ var sources = [];
6749
+ var out = {
6750
+ platform: "other",
6751
+ sources: sources
6752
+ };
6753
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
6754
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
6755
+ if (/Web0S|webOS/i.test(ua)) {
6756
+ out.platform = "webos";
6757
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
6758
+ if (lg && lg[1] && lg[2]) {
6759
+ out.model = lg[1];
6760
+ out.firmware = lg[2];
6761
+ sources.push("user_agent");
6762
+ }
6763
+ } else if (/Tizen/i.test(ua)) {
6764
+ out.platform = "tizen";
6765
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
6766
+ if (tizen && tizen[1]) {
6767
+ out.osVersion = "Tizen ".concat(tizen[1]);
6768
+ sources.push("user_agent");
6769
+ }
6770
+ }
6771
+ return out;
6772
+ }
6773
+ function readSamsungProductInfo() {
6774
+ var _cleanString;
6775
+ var _window_webapis;
6776
+ if (typeof window === "undefined") return void 0;
6777
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
6778
+ if (!productinfo) return void 0;
6779
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
6780
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
6781
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
6782
+ if (!model && !firmware && !duid) return void 0;
6783
+ return _object_spread({}, model ? {
6784
+ model: model
6785
+ } : {}, firmware ? {
6786
+ firmware: firmware
6787
+ } : {}, duid ? {
6788
+ internalDeviceId: duid,
6789
+ internalDeviceIdSource: "samsung_duid"
6790
+ } : {});
6791
+ }
6792
+ function readLgDeviceInfo(timeoutMs) {
6793
+ var webOS = typeof window !== "undefined" ? window.webOS : void 0;
6794
+ if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
6795
+ return new Promise(function(resolve) {
6796
+ var settled = false;
6797
+ var finish = function finish() {
6798
+ if (settled) return;
6799
+ settled = true;
6800
+ clearTimeout(timer);
6801
+ resolve();
6802
+ };
6803
+ var timer = setTimeout(finish, Math.max(0, timeoutMs));
6804
+ try {
6805
+ webOS.deviceInfo(function(info) {
6806
+ var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
6807
+ var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
6808
+ var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
6809
+ lgDeviceInfo = _object_spread({}, model ? {
6810
+ model: model
6811
+ } : {}, firmware ? {
6812
+ firmware: firmware
6813
+ } : {}, sdkVersion ? {
6814
+ sdkVersion: sdkVersion
6815
+ } : {});
6816
+ finish();
6817
+ });
6818
+ } catch (unused) {
6819
+ finish();
6820
+ }
6821
+ });
6822
+ }
6823
+ function computePlatformInfo() {
6824
+ var info = parseUserAgentDeviceInfo(userAgent());
6825
+ var sources = _to_consumable_array(info.sources);
6826
+ var samsung = readSamsungProductInfo();
6827
+ if (samsung) {
6828
+ info.platform = "tizen";
6829
+ if (samsung.model) info.model = samsung.model;
6830
+ if (samsung.firmware) info.firmware = samsung.firmware;
6831
+ if (samsung.internalDeviceId) {
6832
+ info.internalDeviceId = samsung.internalDeviceId;
6833
+ info.internalDeviceIdSource = "samsung_duid";
6834
+ }
6835
+ sources.push("samsung_productinfo");
6836
+ }
6837
+ if (lgDeviceInfo) {
6838
+ info.platform = "webos";
6839
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
6840
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
6841
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
6842
+ sources.push("lg_deviceinfo");
6843
+ }
6844
+ var lgUdid = readCachedLgUdid();
6845
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
6846
+ info.internalDeviceId = lgUdid.deviceId;
6847
+ info.internalDeviceIdSource = "lg_udid";
6848
+ sources.push("lg_udid");
6849
+ }
6850
+ info.sources = sources;
6851
+ return info;
6852
+ }
6853
+ function categorize(platform, model) {
6854
+ if (platform === "tizen") return "Samsung TV";
6855
+ if (platform === "webos") {
6856
+ var ua = userAgent();
6857
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
6858
+ return "LG TV";
6859
+ }
6860
+ return "Other";
6861
+ }
6862
+ function setHostDeviceInfo(info) {
6863
+ hostDeviceInfo = info ? _object_spread({}, info) : void 0;
6864
+ }
6865
+ function primeDeviceInfo() {
6866
+ var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
6867
+ if (!primePromise) {
6868
+ primePromise = Promise.all([
6869
+ readLgDeviceInfo(timeoutMs),
6870
+ primeLgUdid(timeoutMs)
6871
+ ]).catch(function() {
6872
+ return void 0;
6873
+ }).then(function() {
6874
+ platformCache = computePlatformInfo();
6875
+ return getDeviceInfo();
6876
+ });
6877
+ }
6878
+ return primePromise;
6879
+ }
6880
+ function getDeviceInfo() {
6881
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
6882
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
6883
+ if (primePromise && !platformCache) {} else {
6884
+ platformCache = platform;
6885
+ }
6886
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
6887
+ var bridge = {
6888
+ terminalId: readBridge([
6889
+ "terminalId",
6890
+ "terminal_id"
6891
+ ]),
6892
+ internalDeviceId: readBridge([
6893
+ "internalDeviceId",
6894
+ "internal_device_id"
6895
+ ]),
6896
+ model: readBridge([
6897
+ "deviceModel"
6898
+ ]),
6899
+ firmware: readBridge([
6900
+ "firmwareVersion"
6901
+ ]),
6902
+ category: normalizeCategory(readBridge([
6903
+ "deviceCategory"
6904
+ ])),
6905
+ make: readBridge([
6906
+ "deviceMake"
6907
+ ]),
6908
+ hardwareVersion: readBridge([
6909
+ "deviceHardwareVersion",
6910
+ "hardwareVersion"
6911
+ ])
6912
+ };
6913
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
6914
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
6915
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
6916
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
6917
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
6918
+ var sources = _to_consumable_array(platform.sources);
6919
+ var bridgeValues = [
6920
+ bridge.terminalId,
6921
+ bridge.internalDeviceId,
6922
+ bridge.model,
6923
+ bridge.firmware,
6924
+ bridge.category,
6925
+ bridge.make,
6926
+ bridge.hardwareVersion
6927
+ ];
6928
+ if (bridgeValues.some(function(v) {
6929
+ return v !== void 0;
6930
+ })) sources.unshift("bridge");
6931
+ if (hostDeviceInfo) sources.unshift("host");
6932
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
6933
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
6934
+ var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
6935
+ var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
6936
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
6937
+ return _object_spread_props(_object_spread({
6938
+ category: category,
6939
+ categoryCode: CATEGORY_CODES[category]
6940
+ }, make ? {
6941
+ make: make
6942
+ } : {}, model ? {
6943
+ model: model
6944
+ } : {}, hardwareVersion ? {
6945
+ hardwareVersion: hardwareVersion
6946
+ } : {}, sonifiModel ? {
6947
+ sonifiModel: sonifiModel
6948
+ } : {}, firmware ? {
6949
+ firmware: firmware
6950
+ } : {}, platform.osVersion ? {
6951
+ osVersion: platform.osVersion
6952
+ } : {}, platform.browserMajorVersion != null ? {
6953
+ browserMajorVersion: platform.browserMajorVersion
6954
+ } : {}, internalDeviceId ? {
6955
+ internalDeviceId: internalDeviceId
6956
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
6957
+ internalDeviceIdSource: internalDeviceIdSource
6958
+ } : {}, terminalId ? {
6959
+ terminalId: terminalId
6960
+ } : {}), {
6961
+ sources: sources
6962
+ });
6963
+ }
6964
+ var DEVICE_KEY_VALUE_KEYS = {
6965
+ category: "sc_dev",
6966
+ model: "sc_model",
6967
+ firmware: "sc_fw"
6968
+ };
6969
+ function sanitizeKeyValue(value) {
6970
+ if (typeof value !== "string") return void 0;
6971
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
6972
+ return v ? v.slice(0, 40) : void 0;
6973
+ }
6974
+ function deviceKeyValuePairs(info) {
6975
+ var pairs = [
6976
+ [
6977
+ DEVICE_KEY_VALUE_KEYS.category,
6978
+ info.categoryCode
6979
+ ]
6980
+ ];
6981
+ var model = sanitizeKeyValue(info.model);
6982
+ var firmware = sanitizeKeyValue(info.firmware);
6983
+ if (model) pairs.push([
6984
+ DEVICE_KEY_VALUE_KEYS.model,
6985
+ model
6986
+ ]);
6987
+ if (firmware) pairs.push([
6988
+ DEVICE_KEY_VALUE_KEYS.firmware,
6989
+ firmware
6990
+ ]);
6991
+ return pairs;
6992
+ }
6993
+ function applyDeviceKeyValues(url, info) {
6994
+ try {
6995
+ var parsed = new URL(url);
6996
+ var pairs = deviceKeyValuePairs(info);
6997
+ var ours = new Set(pairs.map(function(param) {
6998
+ var _param = _sliced_to_array(param, 1), k = _param[0];
6999
+ return k;
7000
+ }));
7001
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
7002
+ var _p_split_;
7003
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
7004
+ });
7005
+ var merged = existing.concat(pairs.map(function(param) {
7006
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
7007
+ return "".concat(k, "=").concat(v);
7008
+ })).join("&");
7009
+ parsed.searchParams.set("cust_params", merged);
7010
+ return parsed.toString();
7011
+ } catch (unused) {
7012
+ return url;
7013
+ }
7014
+ }
7015
+ function deviceInfoAnalyticsFields(info) {
7016
+ return _object_spread({
7017
+ device_category: info.category
7018
+ }, info.model ? {
7019
+ device_model: info.model
7020
+ } : {}, info.sonifiModel ? {
7021
+ sonifi_model: info.sonifiModel
7022
+ } : {}, info.firmware ? {
7023
+ firmware_version: info.firmware
7024
+ } : {}, info.osVersion ? {
7025
+ os_version: info.osVersion
7026
+ } : {}, info.browserMajorVersion != null ? {
7027
+ browser_major_version: info.browserMajorVersion
7028
+ } : {}, info.internalDeviceId ? {
7029
+ internal_device_id: info.internalDeviceId
7030
+ } : {}, info.internalDeviceIdSource ? {
7031
+ internal_device_id_source: info.internalDeviceIdSource
7032
+ } : {}, info.terminalId ? {
7033
+ terminal_id: info.terminalId
7034
+ } : {});
7035
+ }
7036
+ // src/utils/screenActivity.ts
7037
+ var hostStandby = false;
7038
+ function setHostStandby(standby) {
7039
+ hostStandby = !!standby;
7040
+ }
7041
+ function toBoolean(value) {
7042
+ if (typeof value === "boolean") return value;
7043
+ if (typeof value === "number") return value === 1;
7044
+ if (typeof value === "string") {
7045
+ var v = value.trim().toLowerCase();
7046
+ if (v === "true" || v === "1" || v === "yes") return true;
7047
+ if (v === "false" || v === "0" || v === "no") return false;
7048
+ }
7049
+ return void 0;
7050
+ }
7051
+ function bridgeSaysStandby() {
7052
+ if (typeof window === "undefined") return false;
7053
+ var w = window;
7054
+ for(var _i = 0, _iter = [
7055
+ w.__STORMCLOUD_CTV__,
7056
+ w.__STORMCLOUD_CTV_AD_INFO__,
7057
+ w.stormcloudCtv
7058
+ ]; _i < _iter.length; _i++){
7059
+ var source = _iter[_i];
7060
+ if (!source) continue;
7061
+ for(var _i1 = 0, _iter1 = [
7062
+ "standby",
7063
+ "isStandby",
7064
+ "screenOff"
7065
+ ]; _i1 < _iter1.length; _i1++){
7066
+ var key = _iter1[_i1];
7067
+ var value = void 0;
7068
+ try {
7069
+ value = source[key];
7070
+ if (typeof value === "function") value = value.call(source);
7071
+ } catch (unused) {
7072
+ value = void 0;
7073
+ }
7074
+ if (toBoolean(value) === true) return true;
7075
+ }
7076
+ }
7077
+ return false;
7078
+ }
7079
+ function getScreenInactiveReason() {
7080
+ if (hostStandby) return "host_standby";
7081
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
7082
+ return "document_hidden";
7083
+ }
7084
+ if (bridgeSaysStandby()) return "bridge_standby";
7085
+ return void 0;
7086
+ }
6004
7087
  // src/utils/trackingIngest.ts
6005
7088
  var DEFAULT_TRACKING_INGEST_CONFIG = {
6006
7089
  enabled: true,
@@ -6098,6 +7181,9 @@ function buildAnalyticsContext(config) {
6098
7181
  if (config.isLiveStream !== void 0) {
6099
7182
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
6100
7183
  }
7184
+ if (config.sendDeviceInfoToAnalytics) {
7185
+ context.includeDeviceInfo = true;
7186
+ }
6101
7187
  return context;
6102
7188
  }
6103
7189
  function getClientInfo() {
@@ -6393,7 +7479,7 @@ function buildPlayerMetricEvent() {
6393
7479
  capture_at: captureAt
6394
7480
  }, context.inputStreamType ? {
6395
7481
  input_stream_type: context.inputStreamType
6396
- } : {})
7482
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
6397
7483
  ];
6398
7484
  }
6399
7485
  });
@@ -7948,6 +9034,13 @@ var Scte35CueManager = /*#__PURE__*/ function() {
7948
9034
  return Scte35CueManager;
7949
9035
  }();
7950
9036
  // src/player/AdConfigManager.ts
9037
+ function isGamAdUrl(rawUrl) {
9038
+ try {
9039
+ return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
9040
+ } catch (unused) {
9041
+ return false;
9042
+ }
9043
+ }
7951
9044
  function withDeferredPodParams(rawUrl, deferNonce) {
7952
9045
  try {
7953
9046
  var url = new URL(rawUrl);
@@ -7965,11 +9058,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
7965
9058
  }
7966
9059
  var AdConfigManager = /*#__PURE__*/ function() {
7967
9060
  function AdConfigManager(config, video) {
9061
+ var _this = this;
7968
9062
  _class_call_check(this, AdConfigManager);
7969
9063
  this.vmapBreaks = [];
7970
9064
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
7971
9065
  this.streamCorrelator = generateCorrelator();
7972
9066
  this.consentSignals = {};
9067
+ this.isLiveStream = function() {
9068
+ return !!_this.config.isLiveStream;
9069
+ };
7973
9070
  this.podCounter = 0;
7974
9071
  this.podAssignedByPrefetch = false;
7975
9072
  this.lastHeartbeatTime = 0;
@@ -8420,9 +9517,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
8420
9517
  {
8421
9518
  key: "generatePodVastUrl",
8422
9519
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
9520
+ var _content_contentDurationSeconds;
8423
9521
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
8424
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
8425
- var macroContext = _object_spread_props(_object_spread({
9522
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
9523
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
9524
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
9525
+ });
9526
+ var content = resolveContentMetadata(this.config);
9527
+ var isLive = this.isLiveStream();
9528
+ var device = getDeviceInfo();
9529
+ var playerSize = resolvePlayerSize(this.video);
9530
+ var videoDuration = this.video.duration;
9531
+ var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
9532
+ var userId = resolveUserId(this.config.adUserId);
9533
+ var ipAddress = resolveClientIp(this.config.clientIpAddress);
9534
+ var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
9535
+ var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
8426
9536
  correlator: this.viewCorrelator,
8427
9537
  streamCorrelator: this.streamCorrelator,
8428
9538
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -8436,14 +9546,54 @@ var AdConfigManager = /*#__PURE__*/ function() {
8436
9546
  limitAdTracking: envSignals.limitAdTracking,
8437
9547
  deviceTypeHint: envSignals.deviceTypeHint,
8438
9548
  adTest: this.config.adTest
8439
- }, this.config.programTitle ? {
8440
- programTitle: this.config.programTitle
8441
- } : {}, this.config.channelName ? {
8442
- channelName: this.config.channelName
9549
+ }, content.programTitle ? {
9550
+ programTitle: content.programTitle
9551
+ } : {}, content.channelName ? {
9552
+ channelName: content.channelName
9553
+ } : {}, content.contentNetwork ? {
9554
+ contentNetwork: content.contentNetwork
8443
9555
  } : {}), {
8444
9556
  consent: this.consentSignals,
8445
- palNonce: palNonce.getCurrentNonce() || void 0
8446
- });
9557
+ palNonce: palNonce.getCurrentNonce() || void 0,
9558
+ deviceIdSource: envSignals.deviceIdSource,
9559
+ isLive: isLive
9560
+ }), playerSize.width ? {
9561
+ playerWidth: playerSize.width
9562
+ } : {}, playerSize.height ? {
9563
+ playerHeight: playerSize.height
9564
+ } : {}), {
9565
+ timestamp: String(Date.now())
9566
+ }), device.make ? {
9567
+ deviceMake: device.make
9568
+ } : {}, device.model ? {
9569
+ deviceModel: device.model
9570
+ } : {}, device.hardwareVersion ? {
9571
+ deviceHardwareVersion: device.hardwareVersion
9572
+ } : {}, userAgent2 ? {
9573
+ userAgent: userAgent2
9574
+ } : {}, ipAddress ? {
9575
+ ipAddress: ipAddress
9576
+ } : {}, userId ? {
9577
+ userId: userId
9578
+ } : {}, content.contentType ? {
9579
+ contentType: content.contentType
9580
+ } : {}, content.contentCategory ? {
9581
+ contentCategory: content.contentCategory
9582
+ } : {}, content.contentGenre ? {
9583
+ contentGenre: content.contentGenre
9584
+ } : {}, content.contentLanguage ? {
9585
+ contentLanguage: content.contentLanguage
9586
+ } : {}, contentDurationSeconds != null ? {
9587
+ contentDurationSeconds: contentDurationSeconds
9588
+ } : {}, content.contentSeason ? {
9589
+ contentSeason: content.contentSeason
9590
+ } : {}, content.contentEpisode ? {
9591
+ contentEpisode: content.contentEpisode
9592
+ } : {}, content.contentRating ? {
9593
+ contentRating: content.contentRating
9594
+ } : {}, content.contentId ? {
9595
+ contentId: content.contentId
9596
+ } : {});
8447
9597
  var nonceReady = !!macroContext.palNonce;
8448
9598
  var finalUrl;
8449
9599
  if (hasScvpMacros(baseUrl)) {
@@ -8457,6 +9607,31 @@ var AdConfigManager = /*#__PURE__*/ function() {
8457
9607
  } else {
8458
9608
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
8459
9609
  }
9610
+ if (isGamAdUrl(finalUrl)) {
9611
+ finalUrl = appendMissingContentParams(finalUrl, content);
9612
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
9613
+ finalUrl = applyDeviceKeyValues(finalUrl, device);
9614
+ }
9615
+ }
9616
+ if (this.debug) {
9617
+ var id = envSignals.deviceId;
9618
+ console.log("[AD-IDENTITY]", {
9619
+ source: envSignals.deviceIdSource,
9620
+ idtype: envSignals.deviceIdType,
9621
+ rdidTail: id ? id.slice(-4) : void 0,
9622
+ isLat: envSignals.limitAdTracking,
9623
+ dth: envSignals.deviceTypeHint,
9624
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
9625
+ ct_ch: content.channelName,
9626
+ ct_ti: content.programTitle,
9627
+ ct_ne: content.contentNetwork,
9628
+ ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
9629
+ live: isLive,
9630
+ player: playerSize,
9631
+ make: device.make,
9632
+ model: device.model
9633
+ });
9634
+ }
8460
9635
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
8461
9636
  return finalUrl;
8462
9637
  }
@@ -8508,7 +9683,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
8508
9683
  }
8509
9684
  },
8510
9685
  {
8511
- // --- Tracking ---
8512
9686
  key: "initializeTracking",
8513
9687
  value: function initializeTracking() {
8514
9688
  var _this = this;
@@ -8600,7 +9774,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8600
9774
  }
8601
9775
  },
8602
9776
  {
8603
- // --- Ad stop timer ---
8604
9777
  key: "scheduleAdStopCountdown",
8605
9778
  value: function scheduleAdStopCountdown(remainingMs) {
8606
9779
  var _this = this;
@@ -8632,7 +9805,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8632
9805
  }
8633
9806
  },
8634
9807
  {
8635
- // --- Ad start timer ---
8636
9808
  key: "scheduleAdStartIn",
8637
9809
  value: function scheduleAdStartIn(delayMs) {
8638
9810
  var _this = this;
@@ -8660,7 +9832,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8660
9832
  }
8661
9833
  },
8662
9834
  {
8663
- // --- PTS drift ---
8664
9835
  key: "updatePtsDrift",
8665
9836
  value: function updatePtsDrift(ptsSecondsSample) {
8666
9837
  var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
@@ -8686,7 +9857,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8686
9857
  }
8687
9858
  },
8688
9859
  {
8689
- // --- Duration boundary ---
8690
9860
  key: "beginBreakTiming",
8691
9861
  value: function beginBreakTiming(startWallClockMs) {
8692
9862
  this.currentAdBreakStartWallClockMs = startWallClockMs;
@@ -8734,7 +9904,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8734
9904
  }
8735
9905
  },
8736
9906
  {
8737
- // --- Duration budget ---
8738
9907
  key: "getWallClockRemainingAdMs",
8739
9908
  value: function getWallClockRemainingAdMs() {
8740
9909
  var endWallClockMs = this.getAdBreakEndWallClockMs();
@@ -8883,7 +10052,6 @@ var AdTimingService = /*#__PURE__*/ function() {
8883
10052
  }
8884
10053
  },
8885
10054
  {
8886
- // --- Circuit breaker ---
8887
10055
  key: "isTemporaryAdError",
8888
10056
  value: function isTemporaryAdError(error) {
8889
10057
  var _error_message;
@@ -9017,7 +10185,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9017
10185
  }
9018
10186
  },
9019
10187
  {
9020
- // --- Watchdog ---
9021
10188
  key: "startAdRequestWatchdog",
9022
10189
  value: function startAdRequestWatchdog(token) {
9023
10190
  var _this = this;
@@ -9062,7 +10229,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9062
10229
  }
9063
10230
  },
9064
10231
  {
9065
- // --- Failsafe ---
9066
10232
  key: "startAdFailsafeTimer",
9067
10233
  value: function startAdFailsafeTimer(token) {
9068
10234
  var _this = this;
@@ -9124,7 +10290,6 @@ var AdTimingService = /*#__PURE__*/ function() {
9124
10290
  }
9125
10291
  },
9126
10292
  {
9127
- // --- Reset for ad break end ---
9128
10293
  key: "resetForBreakEnd",
9129
10294
  value: function resetForBreakEnd() {
9130
10295
  this.clearAdStopTimer();
@@ -9323,7 +10488,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9323
10488
  adBehavior: adBehavior
9324
10489
  });
9325
10490
  }
9326
- if (!this.config.autoplay) return [
10491
+ if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
9327
10492
  3,
9328
10493
  2
9329
10494
  ];
@@ -9514,6 +10679,12 @@ var HlsEngine = /*#__PURE__*/ function() {
9514
10679
  2
9515
10680
  ];
9516
10681
  this.hasInitialBufferCompleted = true;
10682
+ if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
10683
+ this.shouldAutoplayAfterBuffering = false;
10684
+ if (this.debug) {
10685
+ console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
10686
+ }
10687
+ }
9517
10688
  if (!this.shouldAutoplayAfterBuffering) return [
9518
10689
  3,
9519
10690
  2
@@ -10171,9 +11342,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10171
11342
  }
10172
11343
  },
10173
11344
  {
10174
- // ───────────────────────────────────────────────────────────────
10175
- // IMA event listeners
10176
- // ───────────────────────────────────────────────────────────────
10177
11345
  key: "nextAdRequestUrl",
10178
11346
  value: function nextAdRequestUrl(baseVastUrl) {
10179
11347
  return this.host.generatePodVastUrl(baseVastUrl);
@@ -10409,9 +11577,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10409
11577
  }
10410
11578
  },
10411
11579
  {
10412
- // ───────────────────────────────────────────────────────────────
10413
- // Ad break start
10414
- // ───────────────────────────────────────────────────────────────
10415
11580
  key: "isBreakActive",
10416
11581
  value: function isBreakActive() {
10417
11582
  return this.slotState !== "IDLE";
@@ -10439,7 +11604,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10439
11604
  key: "handleAdStart",
10440
11605
  value: function handleAdStart(marker) {
10441
11606
  return _async_to_generator(function() {
10442
- var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
11607
+ var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
10443
11608
  return _ts_generator(this, function(_state) {
10444
11609
  switch(_state.label){
10445
11610
  case 0:
@@ -10452,6 +11617,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10452
11617
  2
10453
11618
  ];
10454
11619
  }
11620
+ screenInactiveReason = getScreenInactiveReason();
11621
+ if (screenInactiveReason) {
11622
+ this.logOrchestratorFunnel("break_skipped_screen_inactive", {
11623
+ reason: screenInactiveReason
11624
+ });
11625
+ this.clearPendingAdBreak();
11626
+ return [
11627
+ 2
11628
+ ];
11629
+ }
10455
11630
  baseVastUrl = this.adConfig.apiVastTagUrl;
10456
11631
  edgeConfigured = !!this.host.getEdgePodBaseUrl();
10457
11632
  if (!baseVastUrl && !edgeConfigured) {
@@ -10612,12 +11787,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10612
11787
  },
10613
11788
  {
10614
11789
  key: "startOptimizedPod",
10615
- value: // ───────────────────────────────────────────────────────────────
10616
- // Optimized pod (single multi-ad request)
10617
- // ───────────────────────────────────────────────────────────────
10618
- function startOptimizedPod(baseVastUrl) {
11790
+ value: function startOptimizedPod(baseVastUrl) {
10619
11791
  return _async_to_generator(function() {
10620
- var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
11792
+ var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
10621
11793
  return _ts_generator(this, function(_state) {
10622
11794
  switch(_state.label){
10623
11795
  case 0:
@@ -10725,6 +11897,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10725
11897
  false
10726
11898
  ];
10727
11899
  }
11900
+ if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
11901
+ ;
11902
+ remainingMs = this.timing.getRemainingAdMs();
11903
+ overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
11904
+ maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
11905
+ maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
11906
+ if (Number.isFinite(remainingMs)) {
11907
+ podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
11908
+ if (podCount < 1) {
11909
+ if (this.timing.activeAdRequestToken === requestToken) {
11910
+ this.timing.activeAdRequestToken = null;
11911
+ }
11912
+ this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
11913
+ return [
11914
+ 2,
11915
+ false
11916
+ ];
11917
+ }
11918
+ }
11919
+ }
10728
11920
  this.setSlotState("READY", "vast_ready");
10729
11921
  if (this.debug) {
10730
11922
  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"));
@@ -10794,9 +11986,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
10794
11986
  }
10795
11987
  },
10796
11988
  {
10797
- // ───────────────────────────────────────────────────────────────
10798
- // Edge-first pods (live SCTE-35 only, GAM fallback)
10799
- // ───────────────────────────────────────────────────────────────
10800
11989
  key: "resetEdgeStateForBreak",
10801
11990
  value: function resetEdgeStateForBreak() {
10802
11991
  this.edgeExhaustedForBreak = false;
@@ -11014,9 +12203,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11014
12203
  }
11015
12204
  },
11016
12205
  {
11017
- // ───────────────────────────────────────────────────────────────
11018
- // Next-ad scheduling (single flight)
11019
- // ───────────────────────────────────────────────────────────────
11020
12206
  key: "setSlotState",
11021
12207
  value: function setSlotState(next, reason) {
11022
12208
  if (this.slotState === next) return;
@@ -11066,6 +12252,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11066
12252
  {
11067
12253
  key: "getStopRequestingReason",
11068
12254
  value: function getStopRequestingReason(remainingMs) {
12255
+ var screenInactiveReason = getScreenInactiveReason();
12256
+ if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
11069
12257
  if (this.breakSource === "vmap") {
11070
12258
  if (this.adPodQueue.length === 0) return "vmap_queue_empty";
11071
12259
  } else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
@@ -11339,9 +12527,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11339
12527
  }
11340
12528
  },
11341
12529
  {
11342
- // ───────────────────────────────────────────────────────────────
11343
- // Per-request diagnostics
11344
- // ───────────────────────────────────────────────────────────────
11345
12530
  key: "recordRequestDiagnostic",
11346
12531
  value: function recordRequestDiagnostic(payload) {
11347
12532
  var requestId = payload.requestId;
@@ -11415,9 +12600,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11415
12600
  }
11416
12601
  },
11417
12602
  {
11418
- // ───────────────────────────────────────────────────────────────
11419
- // Single ad playback
11420
- // ───────────────────────────────────────────────────────────────
11421
12603
  key: "createGamDispatchFinalizer",
11422
12604
  value: function createGamDispatchFinalizer(requestToken) {
11423
12605
  var _this = this;
@@ -11880,9 +13062,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
11880
13062
  }
11881
13063
  },
11882
13064
  {
11883
- // ───────────────────────────────────────────────────────────────
11884
- // Ad break completion
11885
- // ───────────────────────────────────────────────────────────────
11886
13065
  key: "logBreakFunnel",
11887
13066
  value: function logBreakFunnel(endReason) {
11888
13067
  var funnel = this.breakFunnel;
@@ -12528,6 +13707,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
12528
13707
  return ContentHealthWatchdog;
12529
13708
  }();
12530
13709
  // src/player/StormcloudVideoPlayer.ts
13710
+ var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
13711
+ var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
12531
13712
  var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12532
13713
  function StormcloudVideoPlayer(config) {
12533
13714
  var _this = this;
@@ -12538,6 +13719,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12538
13719
  var browserOverrides = getBrowserConfigOverrides();
12539
13720
  this.config = _object_spread({}, browserOverrides, config);
12540
13721
  this.video = config.videoElement;
13722
+ if (this.config.forceSingleDecoderMode != null) {
13723
+ setSingleDecoderOverride(this.config.forceSingleDecoderMode);
13724
+ }
13725
+ if (this.config.adDeviceId) {
13726
+ setHostAdIdentity({
13727
+ deviceId: this.config.adDeviceId,
13728
+ deviceIdType: this.config.adDeviceIdType,
13729
+ limitAdTracking: this.config.adLimitAdTracking
13730
+ });
13731
+ }
13732
+ if (this.config.deviceInfo) {
13733
+ setHostDeviceInfo(this.config.deviceInfo);
13734
+ }
12541
13735
  logBrowserInfo(config.debugAdTiming);
12542
13736
  this.floorLadder = new FloorLadderController();
12543
13737
  this.adPlayer = this.createAdPlayer(false);
@@ -12601,8 +13795,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12601
13795
  },
12602
13796
  hasPendingAdBreak: function hasPendingAdBreak() {
12603
13797
  return _this.adBreak.pendingAdBreak !== null;
13798
+ },
13799
+ shouldHoldContentForAds: function shouldHoldContentForAds() {
13800
+ return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
12604
13801
  }
12605
13802
  });
13803
+ this.adConfig.isLiveStream = function() {
13804
+ return _this.hlsEngine.isLiveStream;
13805
+ };
12606
13806
  this.adBreak = new AdBreakOrchestrator({
12607
13807
  config: this.config,
12608
13808
  video: this.video,
@@ -12796,10 +13996,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12796
13996
  },
12797
13997
  {
12798
13998
  key: "load",
12799
- value: // ───────────────────────────────────────────────────────────────
12800
- // Lifecycle
12801
- // ───────────────────────────────────────────────────────────────
12802
- function load() {
13999
+ value: function load() {
12803
14000
  return _async_to_generator(function() {
12804
14001
  var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
12805
14002
  return _ts_generator(this, function(_state) {
@@ -12809,6 +14006,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12809
14006
  if (!this.attached) {
12810
14007
  this.attach();
12811
14008
  }
14009
+ primeDeviceInfo().then(function(info) {
14010
+ if (_this.debug) {
14011
+ console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
14012
+ internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
14013
+ }));
14014
+ }
14015
+ }).catch(function() {});
12812
14016
  _state.label = 1;
12813
14017
  case 1:
12814
14018
  _state.trys.push([
@@ -12843,21 +14047,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12843
14047
  fetchConsentSignals().catch(function() {
12844
14048
  return {};
12845
14049
  }).then(function(signals) {
12846
- var _this_config_lowLatencyMode;
14050
+ var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
12847
14051
  _this.adConfig.consentSignals = signals;
12848
14052
  var muted = _this.video.muted;
12849
- return _this.palNonce.generateNonce(_object_spread({
14053
+ var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
14054
+ var palOptions = _object_spread({
12850
14055
  videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
12851
14056
  videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
12852
14057
  adWillAutoPlay: !!_this.config.autoplay,
12853
14058
  adWillPlayMuted: muted,
12854
14059
  playerVolume: muted ? 0 : _this.video.volume,
12855
- continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
14060
+ 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,
14061
+ iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
14062
+ supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
12856
14063
  }, palDescriptionUrl ? {
12857
14064
  descriptionUrl: palDescriptionUrl
12858
14065
  } : {}, signals.storageAllowed != null ? {
12859
14066
  allowStorage: signals.storageAllowed
12860
- } : {}));
14067
+ } : {}, palSessionId ? {
14068
+ sessionId: palSessionId
14069
+ } : {});
14070
+ _this.lastPalOptions = palOptions;
14071
+ _this.palSessionId = palSessionId;
14072
+ _this.startPalNonceRefresh();
14073
+ return _this.palNonce.generateNonce(palOptions);
12861
14074
  }).catch(function() {});
12862
14075
  this.adConfig.initializeTracking();
12863
14076
  if (!this.hlsEngine.shouldUseNativeHls(function() {
@@ -12895,6 +14108,96 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
12895
14108
  }).call(this);
12896
14109
  }
12897
14110
  },
14111
+ {
14112
+ key: "startPalNonceRefresh",
14113
+ value: function startPalNonceRefresh() {
14114
+ var _this = this;
14115
+ if (this.palRefreshTimer != null || typeof window === "undefined") return;
14116
+ this.palRefreshTimer = window.setInterval(function() {
14117
+ return _this.refreshPalNonceIfStale();
14118
+ }, PAL_NONCE_CHECK_INTERVAL_MS);
14119
+ }
14120
+ },
14121
+ {
14122
+ key: "refreshPalNonceIfStale",
14123
+ value: function refreshPalNonceIfStale() {
14124
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
14125
+ var _this_config_palNonceMaxAgeMs;
14126
+ var options = this.lastPalOptions;
14127
+ if (!options) return;
14128
+ var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
14129
+ var ageMs = this.palNonce.getNonceAgeMs();
14130
+ var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
14131
+ var sessionChanged = sessionId !== this.palSessionId;
14132
+ var stale = ageMs === void 0 || ageMs >= maxAgeMs;
14133
+ if (!force && !stale && !sessionChanged) return;
14134
+ var next = _object_spread({}, options);
14135
+ if (sessionId) next.sessionId = sessionId;
14136
+ else delete next.sessionId;
14137
+ this.lastPalOptions = next;
14138
+ this.palSessionId = sessionId;
14139
+ if (this.debug) {
14140
+ console.log("[PAL] Regenerating nonce", {
14141
+ force: force,
14142
+ stale: stale,
14143
+ sessionChanged: sessionChanged,
14144
+ ageMs: ageMs
14145
+ });
14146
+ }
14147
+ this.palNonce.generateNonce(next).catch(function() {});
14148
+ }
14149
+ },
14150
+ {
14151
+ key: "setAdIdentity",
14152
+ value: function setAdIdentity(identity) {
14153
+ setHostAdIdentity(identity);
14154
+ this.refreshPalNonceIfStale();
14155
+ }
14156
+ },
14157
+ {
14158
+ key: "resetAdIdentity",
14159
+ value: function resetAdIdentity1() {
14160
+ resetAdIdentity();
14161
+ this.refreshPalNonceIfStale(true);
14162
+ }
14163
+ },
14164
+ {
14165
+ key: "setContentMetadata",
14166
+ value: function setContentMetadata(meta) {
14167
+ applyContentMetadataUpdate(this.config, meta);
14168
+ }
14169
+ },
14170
+ {
14171
+ key: "setRequestSignals",
14172
+ value: function setRequestSignals(signals) {
14173
+ if (signals.userId !== void 0) {
14174
+ if (signals.userId) this.config.adUserId = signals.userId;
14175
+ else delete this.config.adUserId;
14176
+ }
14177
+ if (signals.ipAddress !== void 0) {
14178
+ if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
14179
+ else delete this.config.clientIpAddress;
14180
+ }
14181
+ }
14182
+ },
14183
+ {
14184
+ key: "setScreenStandby",
14185
+ value: function setScreenStandby(standby) {
14186
+ setHostStandby(standby);
14187
+ }
14188
+ },
14189
+ {
14190
+ key: "getDeviceInfo",
14191
+ value: function getDeviceInfo1() {
14192
+ return getDeviceInfo();
14193
+ }
14194
+ },
14195
+ {
14196
+ key: "setDeviceInfo",
14197
+ value: function setDeviceInfo(info) {
14198
+ setHostDeviceInfo(info);
14199
+ }
14200
+ },
12898
14201
  {
12899
14202
  key: "onManifestParsed",
12900
14203
  value: function onManifestParsed(isLive) {
@@ -13029,9 +14332,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13029
14332
  }
13030
14333
  },
13031
14334
  {
13032
- // ───────────────────────────────────────────────────────────────
13033
- // SCTE-35 marker orchestration
13034
- // ───────────────────────────────────────────────────────────────
13035
14335
  key: "onScte35Marker",
13036
14336
  value: function onScte35Marker(marker, cueKey) {
13037
14337
  if (this.debug) {
@@ -13210,9 +14510,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13210
14510
  }
13211
14511
  },
13212
14512
  {
13213
- // ───────────────────────────────────────────────────────────────
13214
- // Ad prefetch
13215
- // ───────────────────────────────────────────────────────────────
13216
14513
  key: "startAdPrefetch",
13217
14514
  value: function startAdPrefetch(marker, fragmentSn, cueKey) {
13218
14515
  if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
@@ -13251,9 +14548,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13251
14548
  }
13252
14549
  },
13253
14550
  {
13254
- // ───────────────────────────────────────────────────────────────
13255
- // VMAP time-based ad breaks
13256
- // ───────────────────────────────────────────────────────────────
13257
14551
  key: "onTimeUpdate",
13258
14552
  value: function onTimeUpdate(currentTimeSec) {
13259
14553
  var _this = this;
@@ -13367,9 +14661,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13367
14661
  }
13368
14662
  },
13369
14663
  {
13370
- // ───────────────────────────────────────────────────────────────
13371
- // Public API
13372
- // ───────────────────────────────────────────────────────────────
13373
14664
  key: "getCurrentAdIndex",
13374
14665
  value: function getCurrentAdIndex() {
13375
14666
  return this.timing.currentAdIndex;
@@ -13488,12 +14779,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
13488
14779
  }
13489
14780
  },
13490
14781
  {
13491
- // ───────────────────────────────────────────────────────────────
13492
- // Destroy
13493
- // ───────────────────────────────────────────────────────────────
13494
14782
  key: "destroy",
13495
14783
  value: function destroy() {
13496
14784
  var _this_adPlayer;
14785
+ if (this.palRefreshTimer != null) {
14786
+ clearInterval(this.palRefreshTimer);
14787
+ this.palRefreshTimer = void 0;
14788
+ }
13497
14789
  this.contentWatchdog.stop();
13498
14790
  this.adBreak.cancelScheduledRequest();
13499
14791
  this.timing.destroy();