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.
package/lib/index.cjs CHANGED
@@ -6304,7 +6304,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6304
6304
  // src/ui/StormcloudVideoPlayer.tsx
6305
6305
  var import_fa = require("react-icons/fa");
6306
6306
  // src/ui/OverlayRenderer.tsx
6307
- var import_react = require("react");
6307
+ var import_react = __toESM(require("react"), 1);
6308
6308
  // src/utils/overlays.ts
6309
6309
  var OVERLAY_API_BASE = "https://adstorm.co/api-adstorm-dev";
6310
6310
  function timeStringToSeconds(timeStr) {
@@ -6527,6 +6527,751 @@ function ScrollerOverlay(param) {
6527
6527
  ]
6528
6528
  });
6529
6529
  }
6530
+ function parseConfig(content) {
6531
+ if (!content) return null;
6532
+ try {
6533
+ return JSON.parse(content);
6534
+ } catch (unused) {
6535
+ return null;
6536
+ }
6537
+ }
6538
+ function ScoreBugOverlay(param) {
6539
+ var overlay = param.overlay, size = param.size;
6540
+ var cfg = parseConfig(overlay.content);
6541
+ if (!cfg) return null;
6542
+ var f = Math.max(6, size.w * 0.058);
6543
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6544
+ style: {
6545
+ width: "100%",
6546
+ height: "100%",
6547
+ borderRadius: Math.max(2, size.w * 0.035),
6548
+ display: "flex",
6549
+ flexDirection: "column",
6550
+ background: cfg.backgroundColor,
6551
+ color: cfg.textColor,
6552
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6553
+ overflow: "hidden",
6554
+ pointerEvents: "none",
6555
+ userSelect: "none",
6556
+ fontSize: "".concat(f, "px")
6557
+ },
6558
+ children: [
6559
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6560
+ style: {
6561
+ flex: 1,
6562
+ display: "flex",
6563
+ alignItems: "center",
6564
+ padding: "0 ".concat(f * 0.8, "px"),
6565
+ gap: f * 0.4
6566
+ },
6567
+ children: [
6568
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6569
+ style: {
6570
+ flex: 1,
6571
+ textAlign: "center"
6572
+ },
6573
+ children: [
6574
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6575
+ style: {
6576
+ fontSize: "1em",
6577
+ fontWeight: 700
6578
+ },
6579
+ children: cfg.homeTeam
6580
+ }),
6581
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6582
+ style: {
6583
+ fontSize: "1.8em",
6584
+ fontWeight: 900,
6585
+ lineHeight: 1
6586
+ },
6587
+ children: cfg.homeScore
6588
+ })
6589
+ ]
6590
+ }),
6591
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6592
+ style: {
6593
+ fontSize: "0.8em",
6594
+ textAlign: "center",
6595
+ opacity: 0.7,
6596
+ padding: "0 ".concat(f * 0.4, "px")
6597
+ },
6598
+ children: [
6599
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6600
+ children: cfg.period
6601
+ }),
6602
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6603
+ children: cfg.clock
6604
+ })
6605
+ ]
6606
+ }),
6607
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6608
+ style: {
6609
+ flex: 1,
6610
+ textAlign: "center"
6611
+ },
6612
+ children: [
6613
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6614
+ style: {
6615
+ fontSize: "1em",
6616
+ fontWeight: 700
6617
+ },
6618
+ children: cfg.awayTeam
6619
+ }),
6620
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6621
+ style: {
6622
+ fontSize: "1.8em",
6623
+ fontWeight: 900,
6624
+ lineHeight: 1
6625
+ },
6626
+ children: cfg.awayScore
6627
+ })
6628
+ ]
6629
+ })
6630
+ ]
6631
+ }),
6632
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6633
+ style: {
6634
+ fontSize: "0.7em",
6635
+ textAlign: "center",
6636
+ opacity: 0.5,
6637
+ padding: "".concat(f * 0.2, "px 0"),
6638
+ borderTop: "1px solid ".concat(cfg.accentColor, "40")
6639
+ },
6640
+ children: cfg.sponsorText
6641
+ })
6642
+ ]
6643
+ });
6644
+ }
6645
+ function LowerThirdOverlay(param) {
6646
+ var overlay = param.overlay, size = param.size;
6647
+ var cfg = parseConfig(overlay.content);
6648
+ if (!cfg) return null;
6649
+ var f = Math.max(6, size.w * 0.055);
6650
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6651
+ style: {
6652
+ width: "100%",
6653
+ height: "100%",
6654
+ borderRadius: Math.max(2, size.w * 0.02),
6655
+ display: "flex",
6656
+ flexDirection: "column",
6657
+ justifyContent: "flex-end",
6658
+ background: cfg.backgroundColor,
6659
+ color: cfg.textColor,
6660
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6661
+ overflow: "hidden",
6662
+ pointerEvents: "none",
6663
+ userSelect: "none",
6664
+ fontSize: "".concat(f, "px")
6665
+ },
6666
+ children: [
6667
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6668
+ style: {
6669
+ width: "100%",
6670
+ height: Math.max(2, size.h * 0.06),
6671
+ backgroundColor: cfg.accentColor
6672
+ }
6673
+ }),
6674
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6675
+ style: {
6676
+ flex: 1,
6677
+ display: "flex",
6678
+ flexDirection: "column",
6679
+ justifyContent: "center",
6680
+ padding: "".concat(f * 0.5, "px ").concat(f * 1.2, "px")
6681
+ },
6682
+ children: [
6683
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6684
+ style: {
6685
+ fontSize: "1.4em",
6686
+ fontWeight: 700,
6687
+ lineHeight: 1.2,
6688
+ textShadow: "0 1px 4px rgba(0,0,0,0.5)"
6689
+ },
6690
+ children: cfg.headline
6691
+ }),
6692
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6693
+ style: {
6694
+ fontSize: "1em",
6695
+ opacity: 0.7,
6696
+ marginTop: f * 0.2
6697
+ },
6698
+ children: cfg.subtitle
6699
+ })
6700
+ ]
6701
+ }),
6702
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6703
+ style: {
6704
+ fontSize: "0.7em",
6705
+ opacity: 0.4,
6706
+ padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
6707
+ },
6708
+ children: cfg.sponsorText
6709
+ })
6710
+ ]
6711
+ });
6712
+ }
6713
+ function QrCodeOverlay(param) {
6714
+ var overlay = param.overlay, size = param.size;
6715
+ var cfg = parseConfig(overlay.content);
6716
+ if (!cfg) return null;
6717
+ var qrSide = Math.max(32, Math.min(size.w, size.h) * 0.55);
6718
+ 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"));
6719
+ var f = Math.max(6, size.w * 0.06);
6720
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6721
+ style: {
6722
+ width: "100%",
6723
+ height: "100%",
6724
+ borderRadius: Math.max(2, size.w * 0.035),
6725
+ display: "flex",
6726
+ flexDirection: "column",
6727
+ alignItems: "center",
6728
+ justifyContent: "center",
6729
+ gap: f * 0.4,
6730
+ background: cfg.backgroundColor,
6731
+ color: cfg.textColor,
6732
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6733
+ padding: f * 0.6,
6734
+ boxSizing: "border-box",
6735
+ pointerEvents: "none",
6736
+ userSelect: "none",
6737
+ overflow: "hidden"
6738
+ },
6739
+ children: [
6740
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6741
+ style: {
6742
+ flexShrink: 0,
6743
+ background: "#fff",
6744
+ borderRadius: Math.max(2, qrSide * 0.06),
6745
+ padding: Math.max(2, qrSide * 0.06),
6746
+ lineHeight: 0
6747
+ },
6748
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6749
+ src: qrUrl,
6750
+ alt: "QR Code",
6751
+ style: {
6752
+ width: "".concat(qrSide, "px"),
6753
+ height: "".concat(qrSide, "px"),
6754
+ display: "block"
6755
+ }
6756
+ })
6757
+ }),
6758
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6759
+ style: {
6760
+ fontSize: "".concat(f * 1.1, "px"),
6761
+ fontWeight: 700,
6762
+ textAlign: "center",
6763
+ color: cfg.accentColor,
6764
+ overflow: "hidden",
6765
+ textOverflow: "ellipsis",
6766
+ whiteSpace: "nowrap",
6767
+ width: "100%"
6768
+ },
6769
+ children: cfg.ctaText
6770
+ }),
6771
+ cfg.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6772
+ style: {
6773
+ fontSize: "".concat(f * 0.75, "px"),
6774
+ opacity: 0.6,
6775
+ textAlign: "center",
6776
+ overflow: "hidden",
6777
+ textOverflow: "ellipsis",
6778
+ whiteSpace: "nowrap",
6779
+ width: "100%"
6780
+ },
6781
+ children: cfg.description
6782
+ })
6783
+ ]
6784
+ });
6785
+ }
6786
+ function ComingUpNextOverlay(param) {
6787
+ var overlay = param.overlay, size = param.size;
6788
+ var cfg = parseConfig(overlay.content);
6789
+ if (!cfg) return null;
6790
+ var f = Math.max(6, size.w * 0.05);
6791
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6792
+ style: {
6793
+ width: "100%",
6794
+ height: "100%",
6795
+ borderRadius: Math.max(2, size.w * 0.035),
6796
+ display: "flex",
6797
+ background: cfg.backgroundColor,
6798
+ color: cfg.textColor,
6799
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6800
+ overflow: "hidden",
6801
+ pointerEvents: "none",
6802
+ userSelect: "none",
6803
+ fontSize: "".concat(f, "px")
6804
+ },
6805
+ children: [
6806
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6807
+ style: {
6808
+ width: Math.max(2, size.w * 0.015),
6809
+ flexShrink: 0,
6810
+ backgroundColor: cfg.accentColor
6811
+ }
6812
+ }),
6813
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6814
+ style: {
6815
+ flex: 1,
6816
+ display: "flex",
6817
+ flexDirection: "column",
6818
+ justifyContent: "center",
6819
+ padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
6820
+ minWidth: 0
6821
+ },
6822
+ children: [
6823
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6824
+ style: {
6825
+ fontSize: "0.8em",
6826
+ fontWeight: 600,
6827
+ textTransform: "uppercase",
6828
+ letterSpacing: "0.05em",
6829
+ color: cfg.accentColor
6830
+ },
6831
+ children: "Coming Up Next"
6832
+ }),
6833
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6834
+ style: {
6835
+ fontSize: "1.5em",
6836
+ fontWeight: 700,
6837
+ lineHeight: 1.2,
6838
+ marginTop: f * 0.2,
6839
+ overflow: "hidden",
6840
+ textOverflow: "ellipsis",
6841
+ whiteSpace: "nowrap"
6842
+ },
6843
+ children: cfg.title
6844
+ }),
6845
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6846
+ style: {
6847
+ fontSize: "0.9em",
6848
+ opacity: 0.6,
6849
+ overflow: "hidden",
6850
+ textOverflow: "ellipsis",
6851
+ whiteSpace: "nowrap"
6852
+ },
6853
+ children: cfg.subtitle
6854
+ }),
6855
+ cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6856
+ style: {
6857
+ fontSize: "1em",
6858
+ fontWeight: 600,
6859
+ marginTop: f * 0.4,
6860
+ color: cfg.accentColor
6861
+ },
6862
+ children: cfg.scheduledTime
6863
+ })
6864
+ ]
6865
+ })
6866
+ ]
6867
+ });
6868
+ }
6869
+ function ContextualTriggerOverlay(param) {
6870
+ var overlay = param.overlay, size = param.size;
6871
+ var cfg = parseConfig(overlay.content);
6872
+ if (!cfg) return null;
6873
+ var icons = {
6874
+ alert: "\u26A0\uFE0F",
6875
+ celebration: "\uD83C\uDF89",
6876
+ info: "\u2139\uFE0F",
6877
+ warning: "\uD83D\uDD14"
6878
+ };
6879
+ var f = Math.max(6, size.w * 0.05);
6880
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6881
+ style: {
6882
+ width: "100%",
6883
+ height: "100%",
6884
+ borderRadius: Math.max(2, size.w * 0.035),
6885
+ display: "flex",
6886
+ alignItems: "center",
6887
+ gap: f * 0.8,
6888
+ padding: "0 ".concat(f * 1.2, "px"),
6889
+ background: cfg.backgroundColor,
6890
+ color: cfg.textColor,
6891
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6892
+ borderLeft: "".concat(Math.max(2, size.w * 0.02), "px solid ").concat(cfg.accentColor),
6893
+ boxSizing: "border-box",
6894
+ pointerEvents: "none",
6895
+ userSelect: "none",
6896
+ fontSize: "".concat(f, "px")
6897
+ },
6898
+ children: [
6899
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6900
+ style: {
6901
+ fontSize: "2em",
6902
+ flexShrink: 0
6903
+ },
6904
+ children: icons[cfg.iconType] || "\u26A1"
6905
+ }),
6906
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6907
+ style: {
6908
+ flex: 1,
6909
+ minWidth: 0
6910
+ },
6911
+ children: [
6912
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6913
+ style: {
6914
+ fontSize: "1.3em",
6915
+ fontWeight: 700,
6916
+ overflow: "hidden",
6917
+ textOverflow: "ellipsis",
6918
+ whiteSpace: "nowrap"
6919
+ },
6920
+ children: cfg.headline
6921
+ }),
6922
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6923
+ style: {
6924
+ fontSize: "0.9em",
6925
+ opacity: 0.7,
6926
+ overflow: "hidden",
6927
+ textOverflow: "ellipsis",
6928
+ whiteSpace: "nowrap"
6929
+ },
6930
+ children: cfg.message
6931
+ })
6932
+ ]
6933
+ })
6934
+ ]
6935
+ });
6936
+ }
6937
+ function OddsBettingOverlay(param) {
6938
+ var overlay = param.overlay, size = param.size;
6939
+ var cfg = parseConfig(overlay.content);
6940
+ if (!cfg) return null;
6941
+ var f = Math.max(6, size.w * 0.052);
6942
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6943
+ style: {
6944
+ width: "100%",
6945
+ height: "100%",
6946
+ borderRadius: Math.max(2, size.w * 0.035),
6947
+ display: "flex",
6948
+ flexDirection: "column",
6949
+ padding: f * 0.8,
6950
+ background: cfg.backgroundColor,
6951
+ color: cfg.textColor,
6952
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6953
+ boxSizing: "border-box",
6954
+ pointerEvents: "none",
6955
+ userSelect: "none",
6956
+ fontSize: "".concat(f, "px")
6957
+ },
6958
+ children: [
6959
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6960
+ style: {
6961
+ fontSize: "0.9em",
6962
+ fontWeight: 700,
6963
+ textTransform: "uppercase",
6964
+ letterSpacing: "0.05em",
6965
+ color: cfg.accentColor,
6966
+ marginBottom: f * 0.4
6967
+ },
6968
+ children: cfg.eventTitle
6969
+ }),
6970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6971
+ style: {
6972
+ flex: 1,
6973
+ display: "flex",
6974
+ flexDirection: "column",
6975
+ gap: f * 0.2,
6976
+ justifyContent: "center"
6977
+ },
6978
+ children: (cfg.options || []).slice(0, 5).map(function(opt, i) {
6979
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6980
+ style: {
6981
+ display: "flex",
6982
+ justifyContent: "space-between",
6983
+ alignItems: "center",
6984
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.6, "px"),
6985
+ borderRadius: Math.max(2, f * 0.3),
6986
+ background: "".concat(cfg.accentColor, "15"),
6987
+ fontSize: "1em"
6988
+ },
6989
+ children: [
6990
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6991
+ style: {
6992
+ overflow: "hidden",
6993
+ textOverflow: "ellipsis",
6994
+ whiteSpace: "nowrap",
6995
+ flex: 1
6996
+ },
6997
+ children: opt.label
6998
+ }),
6999
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
7000
+ style: {
7001
+ fontWeight: 700,
7002
+ marginLeft: f * 0.8,
7003
+ flexShrink: 0,
7004
+ color: cfg.accentColor
7005
+ },
7006
+ children: opt.odds
7007
+ })
7008
+ ]
7009
+ }, i);
7010
+ })
7011
+ }),
7012
+ cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7013
+ style: {
7014
+ fontSize: "0.7em",
7015
+ opacity: 0.4,
7016
+ textAlign: "center",
7017
+ marginTop: f * 0.4
7018
+ },
7019
+ children: cfg.sponsorText
7020
+ })
7021
+ ]
7022
+ });
7023
+ }
7024
+ function BreakingNewsOverlay(param) {
7025
+ var overlay = param.overlay, size = param.size;
7026
+ var cfg = parseConfig(overlay.content);
7027
+ if (!cfg) return null;
7028
+ var urgencyColors = {
7029
+ breaking: "#dc2626",
7030
+ urgent: "#ea580c",
7031
+ normal: "#2563eb"
7032
+ };
7033
+ var labelBg = urgencyColors[cfg.urgency] || urgencyColors.normal;
7034
+ var label = cfg.urgency === "breaking" ? "BREAKING" : cfg.urgency === "urgent" ? "URGENT" : "NEWS";
7035
+ var f = Math.max(6, size.w * 0.05);
7036
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7037
+ style: {
7038
+ width: "100%",
7039
+ height: "100%",
7040
+ borderRadius: Math.max(2, size.w * 0.02),
7041
+ display: "flex",
7042
+ alignItems: "center",
7043
+ background: cfg.backgroundColor,
7044
+ color: cfg.textColor,
7045
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
7046
+ overflow: "hidden",
7047
+ pointerEvents: "none",
7048
+ userSelect: "none",
7049
+ fontSize: "".concat(f, "px")
7050
+ },
7051
+ children: [
7052
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7053
+ style: {
7054
+ padding: "0 ".concat(f * 0.8, "px"),
7055
+ height: "100%",
7056
+ display: "flex",
7057
+ alignItems: "center",
7058
+ background: labelBg,
7059
+ color: "#fff",
7060
+ fontSize: "1em",
7061
+ fontWeight: 900,
7062
+ textTransform: "uppercase",
7063
+ letterSpacing: "0.05em",
7064
+ flexShrink: 0
7065
+ },
7066
+ children: label
7067
+ }),
7068
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7069
+ style: {
7070
+ flex: 1,
7071
+ padding: "0 ".concat(f * 1, "px"),
7072
+ minWidth: 0
7073
+ },
7074
+ children: [
7075
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7076
+ style: {
7077
+ fontSize: "1.3em",
7078
+ fontWeight: 700,
7079
+ overflow: "hidden",
7080
+ textOverflow: "ellipsis",
7081
+ whiteSpace: "nowrap"
7082
+ },
7083
+ children: cfg.headline
7084
+ }),
7085
+ cfg.body && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7086
+ style: {
7087
+ fontSize: "0.9em",
7088
+ opacity: 0.7,
7089
+ overflow: "hidden",
7090
+ textOverflow: "ellipsis",
7091
+ whiteSpace: "nowrap"
7092
+ },
7093
+ children: cfg.body
7094
+ })
7095
+ ]
7096
+ })
7097
+ ]
7098
+ });
7099
+ }
7100
+ function CountdownOverlay(param) {
7101
+ var overlay = param.overlay, size = param.size;
7102
+ var cfg = parseConfig(overlay.content);
7103
+ var _ref = _sliced_to_array((0, import_react.useState)({
7104
+ d: 0,
7105
+ h: 0,
7106
+ m: 0,
7107
+ s: 0
7108
+ }), 2), remaining = _ref[0], setRemaining = _ref[1];
7109
+ (0, import_react.useEffect)(function() {
7110
+ if (!cfg) return;
7111
+ var update = function update() {
7112
+ var target = new Date(cfg.targetTime).getTime();
7113
+ var now = Date.now();
7114
+ var diff = Math.max(0, target - now);
7115
+ setRemaining({
7116
+ d: Math.floor(diff / 864e5),
7117
+ h: Math.floor(diff % 864e5 / 36e5),
7118
+ m: Math.floor(diff % 36e5 / 6e4),
7119
+ s: Math.floor(diff % 6e4 / 1e3)
7120
+ });
7121
+ };
7122
+ update();
7123
+ var id = setInterval(update, 1e3);
7124
+ return function() {
7125
+ return clearInterval(id);
7126
+ };
7127
+ }, [
7128
+ cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
7129
+ ]);
7130
+ if (!cfg) return null;
7131
+ var f = Math.max(6, size.w * 0.055);
7132
+ var pad = function pad(n) {
7133
+ return String(n).padStart(2, "0");
7134
+ };
7135
+ var units = [
7136
+ {
7137
+ show: cfg.showDays,
7138
+ value: pad(remaining.d),
7139
+ label: "DAYS"
7140
+ },
7141
+ {
7142
+ show: cfg.showHours,
7143
+ value: pad(remaining.h),
7144
+ label: "HRS"
7145
+ },
7146
+ {
7147
+ show: cfg.showMinutes,
7148
+ value: pad(remaining.m),
7149
+ label: "MIN"
7150
+ },
7151
+ {
7152
+ show: cfg.showSeconds,
7153
+ value: pad(remaining.s),
7154
+ label: "SEC"
7155
+ }
7156
+ ];
7157
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7158
+ style: {
7159
+ width: "100%",
7160
+ height: "100%",
7161
+ borderRadius: Math.max(2, size.w * 0.035),
7162
+ display: "flex",
7163
+ flexDirection: "column",
7164
+ alignItems: "center",
7165
+ justifyContent: "center",
7166
+ padding: f * 0.8,
7167
+ background: cfg.backgroundColor,
7168
+ color: cfg.textColor,
7169
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
7170
+ boxSizing: "border-box",
7171
+ pointerEvents: "none",
7172
+ userSelect: "none",
7173
+ fontSize: "".concat(f, "px")
7174
+ },
7175
+ children: [
7176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7177
+ style: {
7178
+ fontSize: "0.8em",
7179
+ fontWeight: 600,
7180
+ textTransform: "uppercase",
7181
+ letterSpacing: "0.05em",
7182
+ color: cfg.accentColor,
7183
+ marginBottom: f * 0.4
7184
+ },
7185
+ children: cfg.eventName
7186
+ }),
7187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7188
+ style: {
7189
+ display: "flex",
7190
+ gap: f * 0.6,
7191
+ alignItems: "center"
7192
+ },
7193
+ children: units.filter(function(u) {
7194
+ return u.show;
7195
+ }).map(function(u, i, arr) {
7196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, {
7197
+ children: [
7198
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7199
+ style: {
7200
+ textAlign: "center"
7201
+ },
7202
+ children: [
7203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7204
+ style: {
7205
+ fontSize: "2em",
7206
+ fontWeight: 900,
7207
+ lineHeight: 1,
7208
+ borderRadius: Math.max(2, f * 0.4),
7209
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
7210
+ background: "".concat(cfg.accentColor, "20")
7211
+ },
7212
+ children: u.value
7213
+ }),
7214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7215
+ style: {
7216
+ fontSize: "0.5em",
7217
+ opacity: 0.5,
7218
+ marginTop: f * 0.2
7219
+ },
7220
+ children: u.label
7221
+ })
7222
+ ]
7223
+ }),
7224
+ i < arr.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7225
+ style: {
7226
+ fontSize: "1.8em",
7227
+ fontWeight: 700,
7228
+ opacity: 0.3
7229
+ },
7230
+ children: ":"
7231
+ })
7232
+ ]
7233
+ }, u.label);
7234
+ })
7235
+ }),
7236
+ cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7237
+ style: {
7238
+ fontSize: "0.8em",
7239
+ opacity: 0.6,
7240
+ marginTop: f * 0.4,
7241
+ textAlign: "center"
7242
+ },
7243
+ children: cfg.message
7244
+ })
7245
+ ]
7246
+ });
7247
+ }
7248
+ function ShapeOverlay(param) {
7249
+ var overlay = param.overlay, size = param.size;
7250
+ var f = Math.max(6, size.w * 0.05);
7251
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7252
+ style: {
7253
+ width: "100%",
7254
+ height: "100%",
7255
+ borderRadius: Math.max(2, size.w * 0.03),
7256
+ background: "rgba(99, 102, 241, 0.2)",
7257
+ border: "2px solid rgba(99, 102, 241, 0.4)",
7258
+ display: "flex",
7259
+ alignItems: "center",
7260
+ justifyContent: "center",
7261
+ pointerEvents: "none",
7262
+ userSelect: "none"
7263
+ },
7264
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7265
+ style: {
7266
+ fontSize: "".concat(f, "px"),
7267
+ fontWeight: 500,
7268
+ color: "rgba(163, 163, 163, 0.8)",
7269
+ textTransform: "uppercase"
7270
+ },
7271
+ children: overlay.name
7272
+ })
7273
+ });
7274
+ }
6530
7275
  function hexToRgb(hex) {
6531
7276
  if (!hex || !hex.startsWith("#")) return "0,0,0";
6532
7277
  var clean = hex.slice(1);
@@ -6591,6 +7336,10 @@ var OverlayRenderer = function OverlayRenderer(param) {
6591
7336
  var width = overlay.width * scaleX;
6592
7337
  var height = overlay.height * scaleY;
6593
7338
  var opacity = Math.max(0, Math.min(100, overlay.opacity)) / 100;
7339
+ var sz = {
7340
+ w: width,
7341
+ h: height
7342
+ };
6594
7343
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6595
7344
  style: {
6596
7345
  position: "absolute",
@@ -6611,6 +7360,42 @@ var OverlayRenderer = function OverlayRenderer(param) {
6611
7360
  }),
6612
7361
  overlay.type === "scroller" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollerOverlay, {
6613
7362
  overlay: overlay
7363
+ }),
7364
+ overlay.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapeOverlay, {
7365
+ overlay: overlay,
7366
+ size: sz
7367
+ }),
7368
+ overlay.type === "score_bug" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScoreBugOverlay, {
7369
+ overlay: overlay,
7370
+ size: sz
7371
+ }),
7372
+ overlay.type === "lower_third" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LowerThirdOverlay, {
7373
+ overlay: overlay,
7374
+ size: sz
7375
+ }),
7376
+ overlay.type === "qr_code" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QrCodeOverlay, {
7377
+ overlay: overlay,
7378
+ size: sz
7379
+ }),
7380
+ overlay.type === "coming_up_next" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComingUpNextOverlay, {
7381
+ overlay: overlay,
7382
+ size: sz
7383
+ }),
7384
+ overlay.type === "contextual_trigger" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextualTriggerOverlay, {
7385
+ overlay: overlay,
7386
+ size: sz
7387
+ }),
7388
+ overlay.type === "odds_betting" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OddsBettingOverlay, {
7389
+ overlay: overlay,
7390
+ size: sz
7391
+ }),
7392
+ overlay.type === "breaking_news" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreakingNewsOverlay, {
7393
+ overlay: overlay,
7394
+ size: sz
7395
+ }),
7396
+ overlay.type === "countdown" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountdownOverlay, {
7397
+ overlay: overlay,
7398
+ size: sz
6614
7399
  })
6615
7400
  ]
6616
7401
  }, overlay.id);
@@ -6861,17 +7646,28 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
6861
7646
  if (!swirlProjectId) return;
6862
7647
  var player = playerRef.current;
6863
7648
  if (!player) return;
7649
+ var attempts = 0;
7650
+ var maxAttempts = 30;
6864
7651
  var tryResolve = function tryResolve() {
6865
7652
  var res = player.getMinHlsResolution();
6866
7653
  if (res) {
6867
7654
  setOverlayCoordSpace(res);
6868
7655
  return true;
6869
7656
  }
7657
+ var video = player.videoElement;
7658
+ if (video && video.videoWidth > 0 && video.videoHeight > 0) {
7659
+ setOverlayCoordSpace({
7660
+ width: video.videoWidth,
7661
+ height: video.videoHeight
7662
+ });
7663
+ return true;
7664
+ }
6870
7665
  return false;
6871
7666
  };
6872
7667
  if (tryResolve()) return;
6873
7668
  var interval = setInterval(function() {
6874
- if (tryResolve()) clearInterval(interval);
7669
+ attempts++;
7670
+ if (tryResolve() || attempts >= maxAttempts) clearInterval(interval);
6875
7671
  }, 300);
6876
7672
  return function() {
6877
7673
  return clearInterval(interval);