stormcloud-video-player 0.8.26 → 0.8.28

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.
@@ -417,26 +417,98 @@ function getOrCreateStoredUuid(storageKey) {
417
417
  if (typeof window === "undefined") {
418
418
  return void 0;
419
419
  }
420
- var existing = readStoredString(storageKey);
420
+ var existing = readPersistentId(storageKey);
421
421
  if (existing) {
422
+ writePersistentId(storageKey, existing);
422
423
  return existing;
423
424
  }
424
425
  var id = createUuid();
426
+ writePersistentId(storageKey, id);
427
+ return id;
428
+ }
429
+ function readPersistentId(storageKey) {
430
+ return readStoredString(storageKey) || readCookie(storageKey);
431
+ }
432
+ function writePersistentId(storageKey, value) {
425
433
  try {
426
434
  var _window_localStorage;
427
- (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
435
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
436
+ } catch (unused) {}
437
+ writeCookie(storageKey, value);
438
+ }
439
+ var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
440
+ function readCookie(name) {
441
+ if (typeof document === "undefined") {
442
+ return void 0;
443
+ }
444
+ try {
445
+ var prefix = encodeURIComponent(name) + "=";
446
+ var parts = document.cookie ? document.cookie.split(";") : [];
447
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
448
+ try {
449
+ for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
450
+ var part = _step.value;
451
+ var entry = part.trim();
452
+ if (entry.startsWith(prefix)) {
453
+ return decodeURIComponent(entry.slice(prefix.length)) || void 0;
454
+ }
455
+ }
456
+ } catch (err) {
457
+ _didIteratorError = true;
458
+ _iteratorError = err;
459
+ } finally{
460
+ try {
461
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
462
+ _iterator.return();
463
+ }
464
+ } finally{
465
+ if (_didIteratorError) {
466
+ throw _iteratorError;
467
+ }
468
+ }
469
+ }
470
+ } catch (unused) {}
471
+ return void 0;
472
+ }
473
+ function writeCookie(name, value) {
474
+ if (typeof document === "undefined") {
475
+ return;
476
+ }
477
+ try {
478
+ document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
428
479
  } catch (unused) {}
429
- return id;
430
480
  }
431
481
  function createUuid() {
482
+ var _bytes_, _bytes_1;
432
483
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
433
484
  return crypto.randomUUID();
434
485
  }
435
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
436
- var value = Math.floor(Math.random() * 16);
437
- var nibble = char === "x" ? value : value & 3 | 8;
438
- return nibble.toString(16);
439
- });
486
+ var bytes = new Uint8Array(16);
487
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
488
+ crypto.getRandomValues(bytes);
489
+ } else {
490
+ var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
491
+ for(var i = 0; i < 16; i++){
492
+ seed = seed * 1103515245 + 12345 & 2147483647;
493
+ bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
494
+ }
495
+ }
496
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
497
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
498
+ var hex = "";
499
+ for(var i1 = 0; i1 < 16; i1++){
500
+ var _bytes_i;
501
+ hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
502
+ }
503
+ return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
504
+ }
505
+ function performanceNow() {
506
+ try {
507
+ if (typeof performance !== "undefined" && typeof performance.now === "function") {
508
+ return performance.now();
509
+ }
510
+ } catch (unused) {}
511
+ return 0;
440
512
  }
441
513
  function readPlatformNativeDeviceId() {
442
514
  if (typeof window === "undefined") return {};
@@ -1222,7 +1294,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
1222
1294
  // IMA event listeners
1223
1295
  // ───────────────────────────────────────────────────────────────
1224
1296
  function get() {
1225
- return !!this.host.config.optimizedPods;
1297
+ return this.host.config.optimizedPods !== false;
1226
1298
  }
1227
1299
  },
1228
1300
  {