stormcloud-video-player 0.7.0 → 0.7.1

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.
@@ -6123,7 +6123,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6123
6123
  // src/ui/StormcloudVideoPlayer.tsx
6124
6124
  var import_fa = require("react-icons/fa");
6125
6125
  // src/ui/OverlayRenderer.tsx
6126
- var import_react = require("react");
6126
+ var import_react = __toESM(require("react"), 1);
6127
6127
  // src/utils/overlays.ts
6128
6128
  var OVERLAY_API_BASE = "https://adstorm.co/api-adstorm-dev";
6129
6129
  function timeStringToSeconds(timeStr) {
@@ -6346,6 +6346,751 @@ function ScrollerOverlay(param) {
6346
6346
  ]
6347
6347
  });
6348
6348
  }
6349
+ function parseConfig(content) {
6350
+ if (!content) return null;
6351
+ try {
6352
+ return JSON.parse(content);
6353
+ } catch (unused) {
6354
+ return null;
6355
+ }
6356
+ }
6357
+ function ScoreBugOverlay(param) {
6358
+ var overlay = param.overlay, size = param.size;
6359
+ var cfg = parseConfig(overlay.content);
6360
+ if (!cfg) return null;
6361
+ var f = Math.max(6, size.w * 0.058);
6362
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6363
+ style: {
6364
+ width: "100%",
6365
+ height: "100%",
6366
+ borderRadius: Math.max(2, size.w * 0.035),
6367
+ display: "flex",
6368
+ flexDirection: "column",
6369
+ background: cfg.backgroundColor,
6370
+ color: cfg.textColor,
6371
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6372
+ overflow: "hidden",
6373
+ pointerEvents: "none",
6374
+ userSelect: "none",
6375
+ fontSize: "".concat(f, "px")
6376
+ },
6377
+ children: [
6378
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6379
+ style: {
6380
+ flex: 1,
6381
+ display: "flex",
6382
+ alignItems: "center",
6383
+ padding: "0 ".concat(f * 0.8, "px"),
6384
+ gap: f * 0.4
6385
+ },
6386
+ children: [
6387
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6388
+ style: {
6389
+ flex: 1,
6390
+ textAlign: "center"
6391
+ },
6392
+ children: [
6393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6394
+ style: {
6395
+ fontSize: "1em",
6396
+ fontWeight: 700
6397
+ },
6398
+ children: cfg.homeTeam
6399
+ }),
6400
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6401
+ style: {
6402
+ fontSize: "1.8em",
6403
+ fontWeight: 900,
6404
+ lineHeight: 1
6405
+ },
6406
+ children: cfg.homeScore
6407
+ })
6408
+ ]
6409
+ }),
6410
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6411
+ style: {
6412
+ fontSize: "0.8em",
6413
+ textAlign: "center",
6414
+ opacity: 0.7,
6415
+ padding: "0 ".concat(f * 0.4, "px")
6416
+ },
6417
+ children: [
6418
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6419
+ children: cfg.period
6420
+ }),
6421
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6422
+ children: cfg.clock
6423
+ })
6424
+ ]
6425
+ }),
6426
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6427
+ style: {
6428
+ flex: 1,
6429
+ textAlign: "center"
6430
+ },
6431
+ children: [
6432
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6433
+ style: {
6434
+ fontSize: "1em",
6435
+ fontWeight: 700
6436
+ },
6437
+ children: cfg.awayTeam
6438
+ }),
6439
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6440
+ style: {
6441
+ fontSize: "1.8em",
6442
+ fontWeight: 900,
6443
+ lineHeight: 1
6444
+ },
6445
+ children: cfg.awayScore
6446
+ })
6447
+ ]
6448
+ })
6449
+ ]
6450
+ }),
6451
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6452
+ style: {
6453
+ fontSize: "0.7em",
6454
+ textAlign: "center",
6455
+ opacity: 0.5,
6456
+ padding: "".concat(f * 0.2, "px 0"),
6457
+ borderTop: "1px solid ".concat(cfg.accentColor, "40")
6458
+ },
6459
+ children: cfg.sponsorText
6460
+ })
6461
+ ]
6462
+ });
6463
+ }
6464
+ function LowerThirdOverlay(param) {
6465
+ var overlay = param.overlay, size = param.size;
6466
+ var cfg = parseConfig(overlay.content);
6467
+ if (!cfg) return null;
6468
+ var f = Math.max(6, size.w * 0.055);
6469
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6470
+ style: {
6471
+ width: "100%",
6472
+ height: "100%",
6473
+ borderRadius: Math.max(2, size.w * 0.02),
6474
+ display: "flex",
6475
+ flexDirection: "column",
6476
+ justifyContent: "flex-end",
6477
+ background: cfg.backgroundColor,
6478
+ color: cfg.textColor,
6479
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6480
+ overflow: "hidden",
6481
+ pointerEvents: "none",
6482
+ userSelect: "none",
6483
+ fontSize: "".concat(f, "px")
6484
+ },
6485
+ children: [
6486
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6487
+ style: {
6488
+ width: "100%",
6489
+ height: Math.max(2, size.h * 0.06),
6490
+ backgroundColor: cfg.accentColor
6491
+ }
6492
+ }),
6493
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6494
+ style: {
6495
+ flex: 1,
6496
+ display: "flex",
6497
+ flexDirection: "column",
6498
+ justifyContent: "center",
6499
+ padding: "".concat(f * 0.5, "px ").concat(f * 1.2, "px")
6500
+ },
6501
+ children: [
6502
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6503
+ style: {
6504
+ fontSize: "1.4em",
6505
+ fontWeight: 700,
6506
+ lineHeight: 1.2,
6507
+ textShadow: "0 1px 4px rgba(0,0,0,0.5)"
6508
+ },
6509
+ children: cfg.headline
6510
+ }),
6511
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6512
+ style: {
6513
+ fontSize: "1em",
6514
+ opacity: 0.7,
6515
+ marginTop: f * 0.2
6516
+ },
6517
+ children: cfg.subtitle
6518
+ })
6519
+ ]
6520
+ }),
6521
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6522
+ style: {
6523
+ fontSize: "0.7em",
6524
+ opacity: 0.4,
6525
+ padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
6526
+ },
6527
+ children: cfg.sponsorText
6528
+ })
6529
+ ]
6530
+ });
6531
+ }
6532
+ function QrCodeOverlay(param) {
6533
+ var overlay = param.overlay, size = param.size;
6534
+ var cfg = parseConfig(overlay.content);
6535
+ if (!cfg) return null;
6536
+ var qrSide = Math.max(32, Math.min(size.w, size.h) * 0.55);
6537
+ var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=".concat(Math.round(qrSide * 2), "x").concat(Math.round(qrSide * 2), "&data=").concat(encodeURIComponent(cfg.url || "https://example.com"));
6538
+ var f = Math.max(6, size.w * 0.06);
6539
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6540
+ style: {
6541
+ width: "100%",
6542
+ height: "100%",
6543
+ borderRadius: Math.max(2, size.w * 0.035),
6544
+ display: "flex",
6545
+ flexDirection: "column",
6546
+ alignItems: "center",
6547
+ justifyContent: "center",
6548
+ gap: f * 0.4,
6549
+ background: cfg.backgroundColor,
6550
+ color: cfg.textColor,
6551
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6552
+ padding: f * 0.6,
6553
+ boxSizing: "border-box",
6554
+ pointerEvents: "none",
6555
+ userSelect: "none",
6556
+ overflow: "hidden"
6557
+ },
6558
+ children: [
6559
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6560
+ style: {
6561
+ flexShrink: 0,
6562
+ background: "#fff",
6563
+ borderRadius: Math.max(2, qrSide * 0.06),
6564
+ padding: Math.max(2, qrSide * 0.06),
6565
+ lineHeight: 0
6566
+ },
6567
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6568
+ src: qrUrl,
6569
+ alt: "QR Code",
6570
+ style: {
6571
+ width: "".concat(qrSide, "px"),
6572
+ height: "".concat(qrSide, "px"),
6573
+ display: "block"
6574
+ }
6575
+ })
6576
+ }),
6577
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6578
+ style: {
6579
+ fontSize: "".concat(f * 1.1, "px"),
6580
+ fontWeight: 700,
6581
+ textAlign: "center",
6582
+ color: cfg.accentColor,
6583
+ overflow: "hidden",
6584
+ textOverflow: "ellipsis",
6585
+ whiteSpace: "nowrap",
6586
+ width: "100%"
6587
+ },
6588
+ children: cfg.ctaText
6589
+ }),
6590
+ cfg.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6591
+ style: {
6592
+ fontSize: "".concat(f * 0.75, "px"),
6593
+ opacity: 0.6,
6594
+ textAlign: "center",
6595
+ overflow: "hidden",
6596
+ textOverflow: "ellipsis",
6597
+ whiteSpace: "nowrap",
6598
+ width: "100%"
6599
+ },
6600
+ children: cfg.description
6601
+ })
6602
+ ]
6603
+ });
6604
+ }
6605
+ function ComingUpNextOverlay(param) {
6606
+ var overlay = param.overlay, size = param.size;
6607
+ var cfg = parseConfig(overlay.content);
6608
+ if (!cfg) return null;
6609
+ var f = Math.max(6, size.w * 0.05);
6610
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6611
+ style: {
6612
+ width: "100%",
6613
+ height: "100%",
6614
+ borderRadius: Math.max(2, size.w * 0.035),
6615
+ display: "flex",
6616
+ background: cfg.backgroundColor,
6617
+ color: cfg.textColor,
6618
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6619
+ overflow: "hidden",
6620
+ pointerEvents: "none",
6621
+ userSelect: "none",
6622
+ fontSize: "".concat(f, "px")
6623
+ },
6624
+ children: [
6625
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6626
+ style: {
6627
+ width: Math.max(2, size.w * 0.015),
6628
+ flexShrink: 0,
6629
+ backgroundColor: cfg.accentColor
6630
+ }
6631
+ }),
6632
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6633
+ style: {
6634
+ flex: 1,
6635
+ display: "flex",
6636
+ flexDirection: "column",
6637
+ justifyContent: "center",
6638
+ padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
6639
+ minWidth: 0
6640
+ },
6641
+ children: [
6642
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6643
+ style: {
6644
+ fontSize: "0.8em",
6645
+ fontWeight: 600,
6646
+ textTransform: "uppercase",
6647
+ letterSpacing: "0.05em",
6648
+ color: cfg.accentColor
6649
+ },
6650
+ children: "Coming Up Next"
6651
+ }),
6652
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6653
+ style: {
6654
+ fontSize: "1.5em",
6655
+ fontWeight: 700,
6656
+ lineHeight: 1.2,
6657
+ marginTop: f * 0.2,
6658
+ overflow: "hidden",
6659
+ textOverflow: "ellipsis",
6660
+ whiteSpace: "nowrap"
6661
+ },
6662
+ children: cfg.title
6663
+ }),
6664
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6665
+ style: {
6666
+ fontSize: "0.9em",
6667
+ opacity: 0.6,
6668
+ overflow: "hidden",
6669
+ textOverflow: "ellipsis",
6670
+ whiteSpace: "nowrap"
6671
+ },
6672
+ children: cfg.subtitle
6673
+ }),
6674
+ cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6675
+ style: {
6676
+ fontSize: "1em",
6677
+ fontWeight: 600,
6678
+ marginTop: f * 0.4,
6679
+ color: cfg.accentColor
6680
+ },
6681
+ children: cfg.scheduledTime
6682
+ })
6683
+ ]
6684
+ })
6685
+ ]
6686
+ });
6687
+ }
6688
+ function ContextualTriggerOverlay(param) {
6689
+ var overlay = param.overlay, size = param.size;
6690
+ var cfg = parseConfig(overlay.content);
6691
+ if (!cfg) return null;
6692
+ var icons = {
6693
+ alert: "\u26A0\uFE0F",
6694
+ celebration: "\uD83C\uDF89",
6695
+ info: "\u2139\uFE0F",
6696
+ warning: "\uD83D\uDD14"
6697
+ };
6698
+ var f = Math.max(6, size.w * 0.05);
6699
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6700
+ style: {
6701
+ width: "100%",
6702
+ height: "100%",
6703
+ borderRadius: Math.max(2, size.w * 0.035),
6704
+ display: "flex",
6705
+ alignItems: "center",
6706
+ gap: f * 0.8,
6707
+ padding: "0 ".concat(f * 1.2, "px"),
6708
+ background: cfg.backgroundColor,
6709
+ color: cfg.textColor,
6710
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6711
+ borderLeft: "".concat(Math.max(2, size.w * 0.02), "px solid ").concat(cfg.accentColor),
6712
+ boxSizing: "border-box",
6713
+ pointerEvents: "none",
6714
+ userSelect: "none",
6715
+ fontSize: "".concat(f, "px")
6716
+ },
6717
+ children: [
6718
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6719
+ style: {
6720
+ fontSize: "2em",
6721
+ flexShrink: 0
6722
+ },
6723
+ children: icons[cfg.iconType] || "\u26A1"
6724
+ }),
6725
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6726
+ style: {
6727
+ flex: 1,
6728
+ minWidth: 0
6729
+ },
6730
+ children: [
6731
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6732
+ style: {
6733
+ fontSize: "1.3em",
6734
+ fontWeight: 700,
6735
+ overflow: "hidden",
6736
+ textOverflow: "ellipsis",
6737
+ whiteSpace: "nowrap"
6738
+ },
6739
+ children: cfg.headline
6740
+ }),
6741
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6742
+ style: {
6743
+ fontSize: "0.9em",
6744
+ opacity: 0.7,
6745
+ overflow: "hidden",
6746
+ textOverflow: "ellipsis",
6747
+ whiteSpace: "nowrap"
6748
+ },
6749
+ children: cfg.message
6750
+ })
6751
+ ]
6752
+ })
6753
+ ]
6754
+ });
6755
+ }
6756
+ function OddsBettingOverlay(param) {
6757
+ var overlay = param.overlay, size = param.size;
6758
+ var cfg = parseConfig(overlay.content);
6759
+ if (!cfg) return null;
6760
+ var f = Math.max(6, size.w * 0.052);
6761
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6762
+ style: {
6763
+ width: "100%",
6764
+ height: "100%",
6765
+ borderRadius: Math.max(2, size.w * 0.035),
6766
+ display: "flex",
6767
+ flexDirection: "column",
6768
+ padding: f * 0.8,
6769
+ background: cfg.backgroundColor,
6770
+ color: cfg.textColor,
6771
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6772
+ boxSizing: "border-box",
6773
+ pointerEvents: "none",
6774
+ userSelect: "none",
6775
+ fontSize: "".concat(f, "px")
6776
+ },
6777
+ children: [
6778
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6779
+ style: {
6780
+ fontSize: "0.9em",
6781
+ fontWeight: 700,
6782
+ textTransform: "uppercase",
6783
+ letterSpacing: "0.05em",
6784
+ color: cfg.accentColor,
6785
+ marginBottom: f * 0.4
6786
+ },
6787
+ children: cfg.eventTitle
6788
+ }),
6789
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6790
+ style: {
6791
+ flex: 1,
6792
+ display: "flex",
6793
+ flexDirection: "column",
6794
+ gap: f * 0.2,
6795
+ justifyContent: "center"
6796
+ },
6797
+ children: (cfg.options || []).slice(0, 5).map(function(opt, i) {
6798
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6799
+ style: {
6800
+ display: "flex",
6801
+ justifyContent: "space-between",
6802
+ alignItems: "center",
6803
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.6, "px"),
6804
+ borderRadius: Math.max(2, f * 0.3),
6805
+ background: "".concat(cfg.accentColor, "15"),
6806
+ fontSize: "1em"
6807
+ },
6808
+ children: [
6809
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6810
+ style: {
6811
+ overflow: "hidden",
6812
+ textOverflow: "ellipsis",
6813
+ whiteSpace: "nowrap",
6814
+ flex: 1
6815
+ },
6816
+ children: opt.label
6817
+ }),
6818
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6819
+ style: {
6820
+ fontWeight: 700,
6821
+ marginLeft: f * 0.8,
6822
+ flexShrink: 0,
6823
+ color: cfg.accentColor
6824
+ },
6825
+ children: opt.odds
6826
+ })
6827
+ ]
6828
+ }, i);
6829
+ })
6830
+ }),
6831
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6832
+ style: {
6833
+ fontSize: "0.7em",
6834
+ opacity: 0.4,
6835
+ textAlign: "center",
6836
+ marginTop: f * 0.4
6837
+ },
6838
+ children: cfg.sponsorText
6839
+ })
6840
+ ]
6841
+ });
6842
+ }
6843
+ function BreakingNewsOverlay(param) {
6844
+ var overlay = param.overlay, size = param.size;
6845
+ var cfg = parseConfig(overlay.content);
6846
+ if (!cfg) return null;
6847
+ var urgencyColors = {
6848
+ breaking: "#dc2626",
6849
+ urgent: "#ea580c",
6850
+ normal: "#2563eb"
6851
+ };
6852
+ var labelBg = urgencyColors[cfg.urgency] || urgencyColors.normal;
6853
+ var label = cfg.urgency === "breaking" ? "BREAKING" : cfg.urgency === "urgent" ? "URGENT" : "NEWS";
6854
+ var f = Math.max(6, size.w * 0.05);
6855
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6856
+ style: {
6857
+ width: "100%",
6858
+ height: "100%",
6859
+ borderRadius: Math.max(2, size.w * 0.02),
6860
+ display: "flex",
6861
+ alignItems: "center",
6862
+ background: cfg.backgroundColor,
6863
+ color: cfg.textColor,
6864
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6865
+ overflow: "hidden",
6866
+ pointerEvents: "none",
6867
+ userSelect: "none",
6868
+ fontSize: "".concat(f, "px")
6869
+ },
6870
+ children: [
6871
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6872
+ style: {
6873
+ padding: "0 ".concat(f * 0.8, "px"),
6874
+ height: "100%",
6875
+ display: "flex",
6876
+ alignItems: "center",
6877
+ background: labelBg,
6878
+ color: "#fff",
6879
+ fontSize: "1em",
6880
+ fontWeight: 900,
6881
+ textTransform: "uppercase",
6882
+ letterSpacing: "0.05em",
6883
+ flexShrink: 0
6884
+ },
6885
+ children: label
6886
+ }),
6887
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6888
+ style: {
6889
+ flex: 1,
6890
+ padding: "0 ".concat(f * 1, "px"),
6891
+ minWidth: 0
6892
+ },
6893
+ children: [
6894
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6895
+ style: {
6896
+ fontSize: "1.3em",
6897
+ fontWeight: 700,
6898
+ overflow: "hidden",
6899
+ textOverflow: "ellipsis",
6900
+ whiteSpace: "nowrap"
6901
+ },
6902
+ children: cfg.headline
6903
+ }),
6904
+ cfg.body && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6905
+ style: {
6906
+ fontSize: "0.9em",
6907
+ opacity: 0.7,
6908
+ overflow: "hidden",
6909
+ textOverflow: "ellipsis",
6910
+ whiteSpace: "nowrap"
6911
+ },
6912
+ children: cfg.body
6913
+ })
6914
+ ]
6915
+ })
6916
+ ]
6917
+ });
6918
+ }
6919
+ function CountdownOverlay(param) {
6920
+ var overlay = param.overlay, size = param.size;
6921
+ var cfg = parseConfig(overlay.content);
6922
+ var _ref = _sliced_to_array((0, import_react.useState)({
6923
+ d: 0,
6924
+ h: 0,
6925
+ m: 0,
6926
+ s: 0
6927
+ }), 2), remaining = _ref[0], setRemaining = _ref[1];
6928
+ (0, import_react.useEffect)(function() {
6929
+ if (!cfg) return;
6930
+ var update = function update() {
6931
+ var target = new Date(cfg.targetTime).getTime();
6932
+ var now = Date.now();
6933
+ var diff = Math.max(0, target - now);
6934
+ setRemaining({
6935
+ d: Math.floor(diff / 864e5),
6936
+ h: Math.floor(diff % 864e5 / 36e5),
6937
+ m: Math.floor(diff % 36e5 / 6e4),
6938
+ s: Math.floor(diff % 6e4 / 1e3)
6939
+ });
6940
+ };
6941
+ update();
6942
+ var id = setInterval(update, 1e3);
6943
+ return function() {
6944
+ return clearInterval(id);
6945
+ };
6946
+ }, [
6947
+ cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
6948
+ ]);
6949
+ if (!cfg) return null;
6950
+ var f = Math.max(6, size.w * 0.055);
6951
+ var pad = function pad(n) {
6952
+ return String(n).padStart(2, "0");
6953
+ };
6954
+ var units = [
6955
+ {
6956
+ show: cfg.showDays,
6957
+ value: pad(remaining.d),
6958
+ label: "DAYS"
6959
+ },
6960
+ {
6961
+ show: cfg.showHours,
6962
+ value: pad(remaining.h),
6963
+ label: "HRS"
6964
+ },
6965
+ {
6966
+ show: cfg.showMinutes,
6967
+ value: pad(remaining.m),
6968
+ label: "MIN"
6969
+ },
6970
+ {
6971
+ show: cfg.showSeconds,
6972
+ value: pad(remaining.s),
6973
+ label: "SEC"
6974
+ }
6975
+ ];
6976
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6977
+ style: {
6978
+ width: "100%",
6979
+ height: "100%",
6980
+ borderRadius: Math.max(2, size.w * 0.035),
6981
+ display: "flex",
6982
+ flexDirection: "column",
6983
+ alignItems: "center",
6984
+ justifyContent: "center",
6985
+ padding: f * 0.8,
6986
+ background: cfg.backgroundColor,
6987
+ color: cfg.textColor,
6988
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6989
+ boxSizing: "border-box",
6990
+ pointerEvents: "none",
6991
+ userSelect: "none",
6992
+ fontSize: "".concat(f, "px")
6993
+ },
6994
+ children: [
6995
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6996
+ style: {
6997
+ fontSize: "0.8em",
6998
+ fontWeight: 600,
6999
+ textTransform: "uppercase",
7000
+ letterSpacing: "0.05em",
7001
+ color: cfg.accentColor,
7002
+ marginBottom: f * 0.4
7003
+ },
7004
+ children: cfg.eventName
7005
+ }),
7006
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7007
+ style: {
7008
+ display: "flex",
7009
+ gap: f * 0.6,
7010
+ alignItems: "center"
7011
+ },
7012
+ children: units.filter(function(u) {
7013
+ return u.show;
7014
+ }).map(function(u, i, arr) {
7015
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, {
7016
+ children: [
7017
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7018
+ style: {
7019
+ textAlign: "center"
7020
+ },
7021
+ children: [
7022
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7023
+ style: {
7024
+ fontSize: "2em",
7025
+ fontWeight: 900,
7026
+ lineHeight: 1,
7027
+ borderRadius: Math.max(2, f * 0.4),
7028
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
7029
+ background: "".concat(cfg.accentColor, "20")
7030
+ },
7031
+ children: u.value
7032
+ }),
7033
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7034
+ style: {
7035
+ fontSize: "0.5em",
7036
+ opacity: 0.5,
7037
+ marginTop: f * 0.2
7038
+ },
7039
+ children: u.label
7040
+ })
7041
+ ]
7042
+ }),
7043
+ i < arr.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7044
+ style: {
7045
+ fontSize: "1.8em",
7046
+ fontWeight: 700,
7047
+ opacity: 0.3
7048
+ },
7049
+ children: ":"
7050
+ })
7051
+ ]
7052
+ }, u.label);
7053
+ })
7054
+ }),
7055
+ cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7056
+ style: {
7057
+ fontSize: "0.8em",
7058
+ opacity: 0.6,
7059
+ marginTop: f * 0.4,
7060
+ textAlign: "center"
7061
+ },
7062
+ children: cfg.message
7063
+ })
7064
+ ]
7065
+ });
7066
+ }
7067
+ function ShapeOverlay(param) {
7068
+ var overlay = param.overlay, size = param.size;
7069
+ var f = Math.max(6, size.w * 0.05);
7070
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7071
+ style: {
7072
+ width: "100%",
7073
+ height: "100%",
7074
+ borderRadius: Math.max(2, size.w * 0.03),
7075
+ background: "rgba(99, 102, 241, 0.2)",
7076
+ border: "2px solid rgba(99, 102, 241, 0.4)",
7077
+ display: "flex",
7078
+ alignItems: "center",
7079
+ justifyContent: "center",
7080
+ pointerEvents: "none",
7081
+ userSelect: "none"
7082
+ },
7083
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7084
+ style: {
7085
+ fontSize: "".concat(f, "px"),
7086
+ fontWeight: 500,
7087
+ color: "rgba(163, 163, 163, 0.8)",
7088
+ textTransform: "uppercase"
7089
+ },
7090
+ children: overlay.name
7091
+ })
7092
+ });
7093
+ }
6349
7094
  function hexToRgb(hex) {
6350
7095
  if (!hex || !hex.startsWith("#")) return "0,0,0";
6351
7096
  var clean = hex.slice(1);
@@ -6410,6 +7155,10 @@ var OverlayRenderer = function OverlayRenderer(param) {
6410
7155
  var width = overlay.width * scaleX;
6411
7156
  var height = overlay.height * scaleY;
6412
7157
  var opacity = Math.max(0, Math.min(100, overlay.opacity)) / 100;
7158
+ var sz = {
7159
+ w: width,
7160
+ h: height
7161
+ };
6413
7162
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6414
7163
  style: {
6415
7164
  position: "absolute",
@@ -6430,6 +7179,42 @@ var OverlayRenderer = function OverlayRenderer(param) {
6430
7179
  }),
6431
7180
  overlay.type === "scroller" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollerOverlay, {
6432
7181
  overlay: overlay
7182
+ }),
7183
+ overlay.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapeOverlay, {
7184
+ overlay: overlay,
7185
+ size: sz
7186
+ }),
7187
+ overlay.type === "score_bug" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScoreBugOverlay, {
7188
+ overlay: overlay,
7189
+ size: sz
7190
+ }),
7191
+ overlay.type === "lower_third" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LowerThirdOverlay, {
7192
+ overlay: overlay,
7193
+ size: sz
7194
+ }),
7195
+ overlay.type === "qr_code" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QrCodeOverlay, {
7196
+ overlay: overlay,
7197
+ size: sz
7198
+ }),
7199
+ overlay.type === "coming_up_next" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComingUpNextOverlay, {
7200
+ overlay: overlay,
7201
+ size: sz
7202
+ }),
7203
+ overlay.type === "contextual_trigger" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextualTriggerOverlay, {
7204
+ overlay: overlay,
7205
+ size: sz
7206
+ }),
7207
+ overlay.type === "odds_betting" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OddsBettingOverlay, {
7208
+ overlay: overlay,
7209
+ size: sz
7210
+ }),
7211
+ overlay.type === "breaking_news" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreakingNewsOverlay, {
7212
+ overlay: overlay,
7213
+ size: sz
7214
+ }),
7215
+ overlay.type === "countdown" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountdownOverlay, {
7216
+ overlay: overlay,
7217
+ size: sz
6433
7218
  })
6434
7219
  ]
6435
7220
  }, overlay.id);
@@ -6680,17 +7465,28 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
6680
7465
  if (!swirlProjectId) return;
6681
7466
  var player = playerRef.current;
6682
7467
  if (!player) return;
7468
+ var attempts = 0;
7469
+ var maxAttempts = 30;
6683
7470
  var tryResolve = function tryResolve() {
6684
7471
  var res = player.getMinHlsResolution();
6685
7472
  if (res) {
6686
7473
  setOverlayCoordSpace(res);
6687
7474
  return true;
6688
7475
  }
7476
+ var video = player.videoElement;
7477
+ if (video && video.videoWidth > 0 && video.videoHeight > 0) {
7478
+ setOverlayCoordSpace({
7479
+ width: video.videoWidth,
7480
+ height: video.videoHeight
7481
+ });
7482
+ return true;
7483
+ }
6689
7484
  return false;
6690
7485
  };
6691
7486
  if (tryResolve()) return;
6692
7487
  var interval = setInterval(function() {
6693
- if (tryResolve()) clearInterval(interval);
7488
+ attempts++;
7489
+ if (tryResolve() || attempts >= maxAttempts) clearInterval(interval);
6694
7490
  }, 300);
6695
7491
  return function() {
6696
7492
  return clearInterval(interval);