stormcloud-video-player 0.6.6 → 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.js CHANGED
@@ -367,7 +367,7 @@ function _ts_values(o) {
367
367
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
368
368
  }
369
369
  // src/ui/StormcloudVideoPlayer.tsx
370
- import React, { useEffect, useRef, useMemo, useCallback } from "react";
370
+ import React2, { useEffect as useEffect2, useRef as useRef2, useMemo, useCallback as useCallback2 } from "react";
371
371
  // src/player/StormcloudVideoPlayer.ts
372
372
  import Hls2 from "hls.js";
373
373
  // src/sdk/vastParser.ts
@@ -6032,6 +6032,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6032
6032
  return this.isLiveStream;
6033
6033
  }
6034
6034
  },
6035
+ {
6036
+ key: "getMinHlsResolution",
6037
+ value: function getMinHlsResolution() {
6038
+ var _this_hls;
6039
+ var levels = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.levels;
6040
+ if (!levels || levels.length === 0) return null;
6041
+ var min = null;
6042
+ var minPixels = Infinity;
6043
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6044
+ try {
6045
+ for(var _iterator = levels[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6046
+ var level = _step.value;
6047
+ if (level.width && level.height) {
6048
+ var pixels = level.width * level.height;
6049
+ if (pixels < minPixels) {
6050
+ minPixels = pixels;
6051
+ min = {
6052
+ width: level.width,
6053
+ height: level.height
6054
+ };
6055
+ }
6056
+ }
6057
+ }
6058
+ } catch (err) {
6059
+ _didIteratorError = true;
6060
+ _iteratorError = err;
6061
+ } finally{
6062
+ try {
6063
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
6064
+ _iterator.return();
6065
+ }
6066
+ } finally{
6067
+ if (_didIteratorError) {
6068
+ throw _iteratorError;
6069
+ }
6070
+ }
6071
+ }
6072
+ return min;
6073
+ }
6074
+ },
6035
6075
  {
6036
6076
  key: "videoElement",
6037
6077
  get: function get() {
@@ -6094,7 +6134,1107 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6094
6134
  }();
6095
6135
  // src/ui/StormcloudVideoPlayer.tsx
6096
6136
  import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute, FaVolumeDown, FaExpand, FaCompress, FaSpinner } from "react-icons/fa";
6137
+ // src/ui/OverlayRenderer.tsx
6138
+ import React, { useEffect, useRef, useState, useCallback } from "react";
6139
+ // src/utils/overlays.ts
6140
+ var OVERLAY_API_BASE = "https://adstorm.co/api-adstorm-dev";
6141
+ function timeStringToSeconds(timeStr) {
6142
+ if (!timeStr) return 0;
6143
+ var parts = timeStr.split(":");
6144
+ if (parts.length >= 3) {
6145
+ var _parts_, _parts_1, _parts_2;
6146
+ var hours = parseInt((_parts_ = parts[0]) !== null && _parts_ !== void 0 ? _parts_ : "0", 10) || 0;
6147
+ var minutes = parseInt((_parts_1 = parts[1]) !== null && _parts_1 !== void 0 ? _parts_1 : "0", 10) || 0;
6148
+ var secStr = (_parts_2 = parts[2]) !== null && _parts_2 !== void 0 ? _parts_2 : "0";
6149
+ var dotIdx = secStr.indexOf(".");
6150
+ var seconds = parseInt(dotIdx >= 0 ? secStr.substring(0, dotIdx) : secStr, 10) || 0;
6151
+ var msFrag = dotIdx >= 0 ? secStr.substring(dotIdx + 1) : "";
6152
+ var ms = msFrag ? parseInt(msFrag.padEnd(3, "0").substring(0, 3), 10) || 0 : 0;
6153
+ return hours * 3600 + minutes * 60 + seconds + ms / 1e3;
6154
+ }
6155
+ if (parts.length === 2) {
6156
+ var _parts_3, _parts_4;
6157
+ var minutes1 = parseInt((_parts_3 = parts[0]) !== null && _parts_3 !== void 0 ? _parts_3 : "0", 10) || 0;
6158
+ var secStr1 = (_parts_4 = parts[1]) !== null && _parts_4 !== void 0 ? _parts_4 : "0";
6159
+ var dotIdx1 = secStr1.indexOf(".");
6160
+ var seconds1 = parseInt(dotIdx1 >= 0 ? secStr1.substring(0, dotIdx1) : secStr1, 10) || 0;
6161
+ var msFrag1 = dotIdx1 >= 0 ? secStr1.substring(dotIdx1 + 1) : "";
6162
+ var ms1 = msFrag1 ? parseInt(msFrag1.padEnd(3, "0").substring(0, 3), 10) || 0 : 0;
6163
+ return minutes1 * 60 + seconds1 + ms1 / 1e3;
6164
+ }
6165
+ var num = parseFloat(timeStr);
6166
+ return isFinite(num) ? Math.max(0, num) : 0;
6167
+ }
6168
+ function isOverlayActive(overlay, currentTime) {
6169
+ if (!overlay.visible) return false;
6170
+ var startSec = timeStringToSeconds(overlay.start_time);
6171
+ var durationSec = timeStringToSeconds(overlay.duration);
6172
+ if (durationSec <= 0) return false;
6173
+ return currentTime >= startSec && currentTime < startSec + durationSec;
6174
+ }
6175
+ function fetchProjectOverlays(_0) {
6176
+ return _async_to_generator(function(projectId) {
6177
+ var apiBaseUrl, response, data;
6178
+ var _arguments = arguments;
6179
+ return _ts_generator(this, function(_state) {
6180
+ switch(_state.label){
6181
+ case 0:
6182
+ apiBaseUrl = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : OVERLAY_API_BASE;
6183
+ return [
6184
+ 4,
6185
+ fetch("".concat(apiBaseUrl, "/adstorm/swirl/projects/").concat(projectId, "/overlays"))
6186
+ ];
6187
+ case 1:
6188
+ response = _state.sent();
6189
+ if (!response.ok) {
6190
+ throw new Error("Failed to fetch overlays: ".concat(response.status, " ").concat(response.statusText));
6191
+ }
6192
+ return [
6193
+ 4,
6194
+ response.json()
6195
+ ];
6196
+ case 2:
6197
+ data = _state.sent();
6198
+ return [
6199
+ 2,
6200
+ Array.isArray(data) ? data : []
6201
+ ];
6202
+ }
6203
+ });
6204
+ }).apply(this, arguments);
6205
+ }
6206
+ function resolveImageUrl(imageUrl) {
6207
+ var apiBaseUrl = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : OVERLAY_API_BASE;
6208
+ if (!imageUrl) return "";
6209
+ if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
6210
+ return imageUrl;
6211
+ }
6212
+ if (imageUrl.startsWith("/")) {
6213
+ try {
6214
+ var url = new URL(apiBaseUrl);
6215
+ return "".concat(url.origin).concat(imageUrl);
6216
+ } catch (unused) {
6217
+ return imageUrl;
6218
+ }
6219
+ }
6220
+ return "".concat(apiBaseUrl, "/").concat(imageUrl);
6221
+ }
6222
+ // src/ui/OverlayRenderer.tsx
6097
6223
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6224
+ function computeVideoDimensions(video) {
6225
+ var nativeWidth = video.videoWidth;
6226
+ var nativeHeight = video.videoHeight;
6227
+ if (!nativeWidth || !nativeHeight) return null;
6228
+ var displayWidth = video.offsetWidth;
6229
+ var displayHeight = video.offsetHeight;
6230
+ if (!displayWidth || !displayHeight) return null;
6231
+ var videoAspect = nativeWidth / nativeHeight;
6232
+ var displayAspect = displayWidth / displayHeight;
6233
+ var renderWidth;
6234
+ var renderHeight;
6235
+ var offsetX;
6236
+ var offsetY;
6237
+ if (videoAspect > displayAspect) {
6238
+ renderWidth = displayWidth;
6239
+ renderHeight = displayWidth / videoAspect;
6240
+ offsetX = 0;
6241
+ offsetY = (displayHeight - renderHeight) / 2;
6242
+ } else {
6243
+ renderHeight = displayHeight;
6244
+ renderWidth = displayHeight * videoAspect;
6245
+ offsetX = (displayWidth - renderWidth) / 2;
6246
+ offsetY = 0;
6247
+ }
6248
+ return {
6249
+ nativeWidth: nativeWidth,
6250
+ nativeHeight: nativeHeight,
6251
+ displayWidth: renderWidth,
6252
+ displayHeight: renderHeight,
6253
+ offsetX: offsetX,
6254
+ offsetY: offsetY,
6255
+ scaleX: renderWidth / nativeWidth,
6256
+ scaleY: renderHeight / nativeHeight
6257
+ };
6258
+ }
6259
+ function ImageOverlay(param) {
6260
+ var overlay = param.overlay;
6261
+ var src = resolveImageUrl(overlay.image_url || "");
6262
+ if (!src) return null;
6263
+ return /* @__PURE__ */ jsx("img", {
6264
+ src: src,
6265
+ alt: overlay.name,
6266
+ draggable: false,
6267
+ style: {
6268
+ width: "100%",
6269
+ height: "100%",
6270
+ objectFit: "contain",
6271
+ display: "block",
6272
+ pointerEvents: "none",
6273
+ userSelect: "none"
6274
+ }
6275
+ });
6276
+ }
6277
+ function TextOverlay(param) {
6278
+ var overlay = param.overlay;
6279
+ var text = overlay.content || "";
6280
+ return /* @__PURE__ */ jsx("div", {
6281
+ style: {
6282
+ width: "100%",
6283
+ height: "100%",
6284
+ display: "flex",
6285
+ alignItems: "center",
6286
+ justifyContent: "center",
6287
+ color: "#ffffff",
6288
+ fontSize: "clamp(10px, 1.4vw, 20px)",
6289
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6290
+ fontWeight: 600,
6291
+ textAlign: "center",
6292
+ padding: "4px 8px",
6293
+ boxSizing: "border-box",
6294
+ wordBreak: "break-word",
6295
+ textShadow: "0 1px 4px rgba(0,0,0,0.7)",
6296
+ pointerEvents: "none",
6297
+ userSelect: "none",
6298
+ lineHeight: 1.3
6299
+ },
6300
+ children: text
6301
+ });
6302
+ }
6303
+ function ScrollerOverlay(param) {
6304
+ var overlay = param.overlay;
6305
+ var _ref, _ref1, _ref2, _ref3, _ref4;
6306
+ var cfg = overlay.scroller_config;
6307
+ var text = (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && cfg.custom_text ? cfg.custom_text : overlay.content || (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text) || "";
6308
+ var scrollSpeed = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref !== void 0 ? _ref : 50;
6309
+ var direction = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref1 !== void 0 ? _ref1 : "left";
6310
+ var fontSize = (cfg === null || cfg === void 0 ? void 0 : cfg.font_size) ? "".concat(cfg.font_size, "px") : "clamp(10px, 1.2vw, 18px)";
6311
+ var fontFamily = (cfg === null || cfg === void 0 ? void 0 : cfg.font_family) || "Roboto, 'Segoe UI', Arial, sans-serif";
6312
+ var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "600";
6313
+ var textColor = (cfg === null || cfg === void 0 ? void 0 : cfg.text_color) || "#ffffff";
6314
+ var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "transparent";
6315
+ var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0;
6316
+ var borderColor = (cfg === null || cfg === void 0 ? void 0 : cfg.border_color) || "transparent";
6317
+ var borderWidth = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.border_width) !== null && _ref2 !== void 0 ? _ref2 : 0;
6318
+ var borderRadius = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref3 !== void 0 ? _ref3 : 0;
6319
+ var padding = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.padding) !== null && _ref4 !== void 0 ? _ref4 : 4;
6320
+ var isVertical = direction === "up" || direction === "down";
6321
+ var isReverse = direction === "right" || direction === "down";
6322
+ var durationSec = Math.max(3, 120 - scrollSpeed);
6323
+ var animId = "sc-scroller-".concat(overlay.id);
6324
+ var keyframes = isVertical ? "@keyframes ".concat(animId, " {\n 0% { transform: translateY(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateY(").concat(isReverse ? "100%" : "-100%", "); }\n }") : "@keyframes ".concat(animId, " {\n 0% { transform: translateX(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateX(").concat(isReverse ? "100%" : "-100%", "); }\n }");
6325
+ return /* @__PURE__ */ jsxs(Fragment, {
6326
+ children: [
6327
+ /* @__PURE__ */ jsx("style", {
6328
+ children: keyframes
6329
+ }),
6330
+ /* @__PURE__ */ jsx("div", {
6331
+ style: {
6332
+ width: "100%",
6333
+ height: "100%",
6334
+ overflow: "hidden",
6335
+ display: "flex",
6336
+ alignItems: "center",
6337
+ backgroundColor: bgOpacity > 0 ? "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")") : void 0,
6338
+ border: borderWidth > 0 ? "".concat(borderWidth, "px solid ").concat(borderColor) : void 0,
6339
+ borderRadius: borderRadius > 0 ? "".concat(borderRadius, "px") : void 0,
6340
+ padding: "".concat(padding, "px"),
6341
+ boxSizing: "border-box",
6342
+ pointerEvents: "none"
6343
+ },
6344
+ children: /* @__PURE__ */ jsx("div", {
6345
+ style: {
6346
+ whiteSpace: "nowrap",
6347
+ fontSize: fontSize,
6348
+ fontFamily: fontFamily,
6349
+ fontWeight: fontWeight,
6350
+ color: textColor,
6351
+ animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
6352
+ textShadow: "0 1px 4px rgba(0,0,0,0.5)",
6353
+ userSelect: "none"
6354
+ },
6355
+ children: text
6356
+ })
6357
+ })
6358
+ ]
6359
+ });
6360
+ }
6361
+ function parseConfig(content) {
6362
+ if (!content) return null;
6363
+ try {
6364
+ return JSON.parse(content);
6365
+ } catch (unused) {
6366
+ return null;
6367
+ }
6368
+ }
6369
+ function ScoreBugOverlay(param) {
6370
+ var overlay = param.overlay, size = param.size;
6371
+ var cfg = parseConfig(overlay.content);
6372
+ if (!cfg) return null;
6373
+ var f = Math.max(6, size.w * 0.058);
6374
+ return /* @__PURE__ */ jsxs("div", {
6375
+ style: {
6376
+ width: "100%",
6377
+ height: "100%",
6378
+ borderRadius: Math.max(2, size.w * 0.035),
6379
+ display: "flex",
6380
+ flexDirection: "column",
6381
+ background: cfg.backgroundColor,
6382
+ color: cfg.textColor,
6383
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6384
+ overflow: "hidden",
6385
+ pointerEvents: "none",
6386
+ userSelect: "none",
6387
+ fontSize: "".concat(f, "px")
6388
+ },
6389
+ children: [
6390
+ /* @__PURE__ */ jsxs("div", {
6391
+ style: {
6392
+ flex: 1,
6393
+ display: "flex",
6394
+ alignItems: "center",
6395
+ padding: "0 ".concat(f * 0.8, "px"),
6396
+ gap: f * 0.4
6397
+ },
6398
+ children: [
6399
+ /* @__PURE__ */ jsxs("div", {
6400
+ style: {
6401
+ flex: 1,
6402
+ textAlign: "center"
6403
+ },
6404
+ children: [
6405
+ /* @__PURE__ */ jsx("div", {
6406
+ style: {
6407
+ fontSize: "1em",
6408
+ fontWeight: 700
6409
+ },
6410
+ children: cfg.homeTeam
6411
+ }),
6412
+ /* @__PURE__ */ jsx("div", {
6413
+ style: {
6414
+ fontSize: "1.8em",
6415
+ fontWeight: 900,
6416
+ lineHeight: 1
6417
+ },
6418
+ children: cfg.homeScore
6419
+ })
6420
+ ]
6421
+ }),
6422
+ /* @__PURE__ */ jsxs("div", {
6423
+ style: {
6424
+ fontSize: "0.8em",
6425
+ textAlign: "center",
6426
+ opacity: 0.7,
6427
+ padding: "0 ".concat(f * 0.4, "px")
6428
+ },
6429
+ children: [
6430
+ /* @__PURE__ */ jsx("div", {
6431
+ children: cfg.period
6432
+ }),
6433
+ /* @__PURE__ */ jsx("div", {
6434
+ children: cfg.clock
6435
+ })
6436
+ ]
6437
+ }),
6438
+ /* @__PURE__ */ jsxs("div", {
6439
+ style: {
6440
+ flex: 1,
6441
+ textAlign: "center"
6442
+ },
6443
+ children: [
6444
+ /* @__PURE__ */ jsx("div", {
6445
+ style: {
6446
+ fontSize: "1em",
6447
+ fontWeight: 700
6448
+ },
6449
+ children: cfg.awayTeam
6450
+ }),
6451
+ /* @__PURE__ */ jsx("div", {
6452
+ style: {
6453
+ fontSize: "1.8em",
6454
+ fontWeight: 900,
6455
+ lineHeight: 1
6456
+ },
6457
+ children: cfg.awayScore
6458
+ })
6459
+ ]
6460
+ })
6461
+ ]
6462
+ }),
6463
+ cfg.sponsorText && /* @__PURE__ */ jsx("div", {
6464
+ style: {
6465
+ fontSize: "0.7em",
6466
+ textAlign: "center",
6467
+ opacity: 0.5,
6468
+ padding: "".concat(f * 0.2, "px 0"),
6469
+ borderTop: "1px solid ".concat(cfg.accentColor, "40")
6470
+ },
6471
+ children: cfg.sponsorText
6472
+ })
6473
+ ]
6474
+ });
6475
+ }
6476
+ function LowerThirdOverlay(param) {
6477
+ var overlay = param.overlay, size = param.size;
6478
+ var cfg = parseConfig(overlay.content);
6479
+ if (!cfg) return null;
6480
+ var f = Math.max(6, size.w * 0.055);
6481
+ return /* @__PURE__ */ jsxs("div", {
6482
+ style: {
6483
+ width: "100%",
6484
+ height: "100%",
6485
+ borderRadius: Math.max(2, size.w * 0.02),
6486
+ display: "flex",
6487
+ flexDirection: "column",
6488
+ justifyContent: "flex-end",
6489
+ background: cfg.backgroundColor,
6490
+ color: cfg.textColor,
6491
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6492
+ overflow: "hidden",
6493
+ pointerEvents: "none",
6494
+ userSelect: "none",
6495
+ fontSize: "".concat(f, "px")
6496
+ },
6497
+ children: [
6498
+ /* @__PURE__ */ jsx("div", {
6499
+ style: {
6500
+ width: "100%",
6501
+ height: Math.max(2, size.h * 0.06),
6502
+ backgroundColor: cfg.accentColor
6503
+ }
6504
+ }),
6505
+ /* @__PURE__ */ jsxs("div", {
6506
+ style: {
6507
+ flex: 1,
6508
+ display: "flex",
6509
+ flexDirection: "column",
6510
+ justifyContent: "center",
6511
+ padding: "".concat(f * 0.5, "px ").concat(f * 1.2, "px")
6512
+ },
6513
+ children: [
6514
+ /* @__PURE__ */ jsx("div", {
6515
+ style: {
6516
+ fontSize: "1.4em",
6517
+ fontWeight: 700,
6518
+ lineHeight: 1.2,
6519
+ textShadow: "0 1px 4px rgba(0,0,0,0.5)"
6520
+ },
6521
+ children: cfg.headline
6522
+ }),
6523
+ /* @__PURE__ */ jsx("div", {
6524
+ style: {
6525
+ fontSize: "1em",
6526
+ opacity: 0.7,
6527
+ marginTop: f * 0.2
6528
+ },
6529
+ children: cfg.subtitle
6530
+ })
6531
+ ]
6532
+ }),
6533
+ cfg.sponsorText && /* @__PURE__ */ jsx("div", {
6534
+ style: {
6535
+ fontSize: "0.7em",
6536
+ opacity: 0.4,
6537
+ padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
6538
+ },
6539
+ children: cfg.sponsorText
6540
+ })
6541
+ ]
6542
+ });
6543
+ }
6544
+ function QrCodeOverlay(param) {
6545
+ var overlay = param.overlay, size = param.size;
6546
+ var cfg = parseConfig(overlay.content);
6547
+ if (!cfg) return null;
6548
+ var qrSide = Math.max(32, Math.min(size.w, size.h) * 0.55);
6549
+ 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"));
6550
+ var f = Math.max(6, size.w * 0.06);
6551
+ return /* @__PURE__ */ jsxs("div", {
6552
+ style: {
6553
+ width: "100%",
6554
+ height: "100%",
6555
+ borderRadius: Math.max(2, size.w * 0.035),
6556
+ display: "flex",
6557
+ flexDirection: "column",
6558
+ alignItems: "center",
6559
+ justifyContent: "center",
6560
+ gap: f * 0.4,
6561
+ background: cfg.backgroundColor,
6562
+ color: cfg.textColor,
6563
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6564
+ padding: f * 0.6,
6565
+ boxSizing: "border-box",
6566
+ pointerEvents: "none",
6567
+ userSelect: "none",
6568
+ overflow: "hidden"
6569
+ },
6570
+ children: [
6571
+ /* @__PURE__ */ jsx("div", {
6572
+ style: {
6573
+ flexShrink: 0,
6574
+ background: "#fff",
6575
+ borderRadius: Math.max(2, qrSide * 0.06),
6576
+ padding: Math.max(2, qrSide * 0.06),
6577
+ lineHeight: 0
6578
+ },
6579
+ children: /* @__PURE__ */ jsx("img", {
6580
+ src: qrUrl,
6581
+ alt: "QR Code",
6582
+ style: {
6583
+ width: "".concat(qrSide, "px"),
6584
+ height: "".concat(qrSide, "px"),
6585
+ display: "block"
6586
+ }
6587
+ })
6588
+ }),
6589
+ /* @__PURE__ */ jsx("div", {
6590
+ style: {
6591
+ fontSize: "".concat(f * 1.1, "px"),
6592
+ fontWeight: 700,
6593
+ textAlign: "center",
6594
+ color: cfg.accentColor,
6595
+ overflow: "hidden",
6596
+ textOverflow: "ellipsis",
6597
+ whiteSpace: "nowrap",
6598
+ width: "100%"
6599
+ },
6600
+ children: cfg.ctaText
6601
+ }),
6602
+ cfg.description && /* @__PURE__ */ jsx("div", {
6603
+ style: {
6604
+ fontSize: "".concat(f * 0.75, "px"),
6605
+ opacity: 0.6,
6606
+ textAlign: "center",
6607
+ overflow: "hidden",
6608
+ textOverflow: "ellipsis",
6609
+ whiteSpace: "nowrap",
6610
+ width: "100%"
6611
+ },
6612
+ children: cfg.description
6613
+ })
6614
+ ]
6615
+ });
6616
+ }
6617
+ function ComingUpNextOverlay(param) {
6618
+ var overlay = param.overlay, size = param.size;
6619
+ var cfg = parseConfig(overlay.content);
6620
+ if (!cfg) return null;
6621
+ var f = Math.max(6, size.w * 0.05);
6622
+ return /* @__PURE__ */ jsxs("div", {
6623
+ style: {
6624
+ width: "100%",
6625
+ height: "100%",
6626
+ borderRadius: Math.max(2, size.w * 0.035),
6627
+ display: "flex",
6628
+ background: cfg.backgroundColor,
6629
+ color: cfg.textColor,
6630
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6631
+ overflow: "hidden",
6632
+ pointerEvents: "none",
6633
+ userSelect: "none",
6634
+ fontSize: "".concat(f, "px")
6635
+ },
6636
+ children: [
6637
+ /* @__PURE__ */ jsx("div", {
6638
+ style: {
6639
+ width: Math.max(2, size.w * 0.015),
6640
+ flexShrink: 0,
6641
+ backgroundColor: cfg.accentColor
6642
+ }
6643
+ }),
6644
+ /* @__PURE__ */ jsxs("div", {
6645
+ style: {
6646
+ flex: 1,
6647
+ display: "flex",
6648
+ flexDirection: "column",
6649
+ justifyContent: "center",
6650
+ padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
6651
+ minWidth: 0
6652
+ },
6653
+ children: [
6654
+ /* @__PURE__ */ jsx("div", {
6655
+ style: {
6656
+ fontSize: "0.8em",
6657
+ fontWeight: 600,
6658
+ textTransform: "uppercase",
6659
+ letterSpacing: "0.05em",
6660
+ color: cfg.accentColor
6661
+ },
6662
+ children: "Coming Up Next"
6663
+ }),
6664
+ /* @__PURE__ */ jsx("div", {
6665
+ style: {
6666
+ fontSize: "1.5em",
6667
+ fontWeight: 700,
6668
+ lineHeight: 1.2,
6669
+ marginTop: f * 0.2,
6670
+ overflow: "hidden",
6671
+ textOverflow: "ellipsis",
6672
+ whiteSpace: "nowrap"
6673
+ },
6674
+ children: cfg.title
6675
+ }),
6676
+ /* @__PURE__ */ jsx("div", {
6677
+ style: {
6678
+ fontSize: "0.9em",
6679
+ opacity: 0.6,
6680
+ overflow: "hidden",
6681
+ textOverflow: "ellipsis",
6682
+ whiteSpace: "nowrap"
6683
+ },
6684
+ children: cfg.subtitle
6685
+ }),
6686
+ cfg.scheduledTime && /* @__PURE__ */ jsx("div", {
6687
+ style: {
6688
+ fontSize: "1em",
6689
+ fontWeight: 600,
6690
+ marginTop: f * 0.4,
6691
+ color: cfg.accentColor
6692
+ },
6693
+ children: cfg.scheduledTime
6694
+ })
6695
+ ]
6696
+ })
6697
+ ]
6698
+ });
6699
+ }
6700
+ function ContextualTriggerOverlay(param) {
6701
+ var overlay = param.overlay, size = param.size;
6702
+ var cfg = parseConfig(overlay.content);
6703
+ if (!cfg) return null;
6704
+ var icons = {
6705
+ alert: "\u26A0\uFE0F",
6706
+ celebration: "\uD83C\uDF89",
6707
+ info: "\u2139\uFE0F",
6708
+ warning: "\uD83D\uDD14"
6709
+ };
6710
+ var f = Math.max(6, size.w * 0.05);
6711
+ return /* @__PURE__ */ jsxs("div", {
6712
+ style: {
6713
+ width: "100%",
6714
+ height: "100%",
6715
+ borderRadius: Math.max(2, size.w * 0.035),
6716
+ display: "flex",
6717
+ alignItems: "center",
6718
+ gap: f * 0.8,
6719
+ padding: "0 ".concat(f * 1.2, "px"),
6720
+ background: cfg.backgroundColor,
6721
+ color: cfg.textColor,
6722
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6723
+ borderLeft: "".concat(Math.max(2, size.w * 0.02), "px solid ").concat(cfg.accentColor),
6724
+ boxSizing: "border-box",
6725
+ pointerEvents: "none",
6726
+ userSelect: "none",
6727
+ fontSize: "".concat(f, "px")
6728
+ },
6729
+ children: [
6730
+ /* @__PURE__ */ jsx("span", {
6731
+ style: {
6732
+ fontSize: "2em",
6733
+ flexShrink: 0
6734
+ },
6735
+ children: icons[cfg.iconType] || "\u26A1"
6736
+ }),
6737
+ /* @__PURE__ */ jsxs("div", {
6738
+ style: {
6739
+ flex: 1,
6740
+ minWidth: 0
6741
+ },
6742
+ children: [
6743
+ /* @__PURE__ */ jsx("div", {
6744
+ style: {
6745
+ fontSize: "1.3em",
6746
+ fontWeight: 700,
6747
+ overflow: "hidden",
6748
+ textOverflow: "ellipsis",
6749
+ whiteSpace: "nowrap"
6750
+ },
6751
+ children: cfg.headline
6752
+ }),
6753
+ /* @__PURE__ */ jsx("div", {
6754
+ style: {
6755
+ fontSize: "0.9em",
6756
+ opacity: 0.7,
6757
+ overflow: "hidden",
6758
+ textOverflow: "ellipsis",
6759
+ whiteSpace: "nowrap"
6760
+ },
6761
+ children: cfg.message
6762
+ })
6763
+ ]
6764
+ })
6765
+ ]
6766
+ });
6767
+ }
6768
+ function OddsBettingOverlay(param) {
6769
+ var overlay = param.overlay, size = param.size;
6770
+ var cfg = parseConfig(overlay.content);
6771
+ if (!cfg) return null;
6772
+ var f = Math.max(6, size.w * 0.052);
6773
+ return /* @__PURE__ */ jsxs("div", {
6774
+ style: {
6775
+ width: "100%",
6776
+ height: "100%",
6777
+ borderRadius: Math.max(2, size.w * 0.035),
6778
+ display: "flex",
6779
+ flexDirection: "column",
6780
+ padding: f * 0.8,
6781
+ background: cfg.backgroundColor,
6782
+ color: cfg.textColor,
6783
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6784
+ boxSizing: "border-box",
6785
+ pointerEvents: "none",
6786
+ userSelect: "none",
6787
+ fontSize: "".concat(f, "px")
6788
+ },
6789
+ children: [
6790
+ /* @__PURE__ */ jsx("div", {
6791
+ style: {
6792
+ fontSize: "0.9em",
6793
+ fontWeight: 700,
6794
+ textTransform: "uppercase",
6795
+ letterSpacing: "0.05em",
6796
+ color: cfg.accentColor,
6797
+ marginBottom: f * 0.4
6798
+ },
6799
+ children: cfg.eventTitle
6800
+ }),
6801
+ /* @__PURE__ */ jsx("div", {
6802
+ style: {
6803
+ flex: 1,
6804
+ display: "flex",
6805
+ flexDirection: "column",
6806
+ gap: f * 0.2,
6807
+ justifyContent: "center"
6808
+ },
6809
+ children: (cfg.options || []).slice(0, 5).map(function(opt, i) {
6810
+ return /* @__PURE__ */ jsxs("div", {
6811
+ style: {
6812
+ display: "flex",
6813
+ justifyContent: "space-between",
6814
+ alignItems: "center",
6815
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.6, "px"),
6816
+ borderRadius: Math.max(2, f * 0.3),
6817
+ background: "".concat(cfg.accentColor, "15"),
6818
+ fontSize: "1em"
6819
+ },
6820
+ children: [
6821
+ /* @__PURE__ */ jsx("span", {
6822
+ style: {
6823
+ overflow: "hidden",
6824
+ textOverflow: "ellipsis",
6825
+ whiteSpace: "nowrap",
6826
+ flex: 1
6827
+ },
6828
+ children: opt.label
6829
+ }),
6830
+ /* @__PURE__ */ jsx("span", {
6831
+ style: {
6832
+ fontWeight: 700,
6833
+ marginLeft: f * 0.8,
6834
+ flexShrink: 0,
6835
+ color: cfg.accentColor
6836
+ },
6837
+ children: opt.odds
6838
+ })
6839
+ ]
6840
+ }, i);
6841
+ })
6842
+ }),
6843
+ cfg.sponsorText && /* @__PURE__ */ jsx("div", {
6844
+ style: {
6845
+ fontSize: "0.7em",
6846
+ opacity: 0.4,
6847
+ textAlign: "center",
6848
+ marginTop: f * 0.4
6849
+ },
6850
+ children: cfg.sponsorText
6851
+ })
6852
+ ]
6853
+ });
6854
+ }
6855
+ function BreakingNewsOverlay(param) {
6856
+ var overlay = param.overlay, size = param.size;
6857
+ var cfg = parseConfig(overlay.content);
6858
+ if (!cfg) return null;
6859
+ var urgencyColors = {
6860
+ breaking: "#dc2626",
6861
+ urgent: "#ea580c",
6862
+ normal: "#2563eb"
6863
+ };
6864
+ var labelBg = urgencyColors[cfg.urgency] || urgencyColors.normal;
6865
+ var label = cfg.urgency === "breaking" ? "BREAKING" : cfg.urgency === "urgent" ? "URGENT" : "NEWS";
6866
+ var f = Math.max(6, size.w * 0.05);
6867
+ return /* @__PURE__ */ jsxs("div", {
6868
+ style: {
6869
+ width: "100%",
6870
+ height: "100%",
6871
+ borderRadius: Math.max(2, size.w * 0.02),
6872
+ display: "flex",
6873
+ alignItems: "center",
6874
+ background: cfg.backgroundColor,
6875
+ color: cfg.textColor,
6876
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6877
+ overflow: "hidden",
6878
+ pointerEvents: "none",
6879
+ userSelect: "none",
6880
+ fontSize: "".concat(f, "px")
6881
+ },
6882
+ children: [
6883
+ /* @__PURE__ */ jsx("div", {
6884
+ style: {
6885
+ padding: "0 ".concat(f * 0.8, "px"),
6886
+ height: "100%",
6887
+ display: "flex",
6888
+ alignItems: "center",
6889
+ background: labelBg,
6890
+ color: "#fff",
6891
+ fontSize: "1em",
6892
+ fontWeight: 900,
6893
+ textTransform: "uppercase",
6894
+ letterSpacing: "0.05em",
6895
+ flexShrink: 0
6896
+ },
6897
+ children: label
6898
+ }),
6899
+ /* @__PURE__ */ jsxs("div", {
6900
+ style: {
6901
+ flex: 1,
6902
+ padding: "0 ".concat(f * 1, "px"),
6903
+ minWidth: 0
6904
+ },
6905
+ children: [
6906
+ /* @__PURE__ */ jsx("div", {
6907
+ style: {
6908
+ fontSize: "1.3em",
6909
+ fontWeight: 700,
6910
+ overflow: "hidden",
6911
+ textOverflow: "ellipsis",
6912
+ whiteSpace: "nowrap"
6913
+ },
6914
+ children: cfg.headline
6915
+ }),
6916
+ cfg.body && /* @__PURE__ */ jsx("div", {
6917
+ style: {
6918
+ fontSize: "0.9em",
6919
+ opacity: 0.7,
6920
+ overflow: "hidden",
6921
+ textOverflow: "ellipsis",
6922
+ whiteSpace: "nowrap"
6923
+ },
6924
+ children: cfg.body
6925
+ })
6926
+ ]
6927
+ })
6928
+ ]
6929
+ });
6930
+ }
6931
+ function CountdownOverlay(param) {
6932
+ var overlay = param.overlay, size = param.size;
6933
+ var cfg = parseConfig(overlay.content);
6934
+ var _useState = _sliced_to_array(useState({
6935
+ d: 0,
6936
+ h: 0,
6937
+ m: 0,
6938
+ s: 0
6939
+ }), 2), remaining = _useState[0], setRemaining = _useState[1];
6940
+ useEffect(function() {
6941
+ if (!cfg) return;
6942
+ var update = function update() {
6943
+ var target = new Date(cfg.targetTime).getTime();
6944
+ var now = Date.now();
6945
+ var diff = Math.max(0, target - now);
6946
+ setRemaining({
6947
+ d: Math.floor(diff / 864e5),
6948
+ h: Math.floor(diff % 864e5 / 36e5),
6949
+ m: Math.floor(diff % 36e5 / 6e4),
6950
+ s: Math.floor(diff % 6e4 / 1e3)
6951
+ });
6952
+ };
6953
+ update();
6954
+ var id = setInterval(update, 1e3);
6955
+ return function() {
6956
+ return clearInterval(id);
6957
+ };
6958
+ }, [
6959
+ cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
6960
+ ]);
6961
+ if (!cfg) return null;
6962
+ var f = Math.max(6, size.w * 0.055);
6963
+ var pad = function pad(n) {
6964
+ return String(n).padStart(2, "0");
6965
+ };
6966
+ var units = [
6967
+ {
6968
+ show: cfg.showDays,
6969
+ value: pad(remaining.d),
6970
+ label: "DAYS"
6971
+ },
6972
+ {
6973
+ show: cfg.showHours,
6974
+ value: pad(remaining.h),
6975
+ label: "HRS"
6976
+ },
6977
+ {
6978
+ show: cfg.showMinutes,
6979
+ value: pad(remaining.m),
6980
+ label: "MIN"
6981
+ },
6982
+ {
6983
+ show: cfg.showSeconds,
6984
+ value: pad(remaining.s),
6985
+ label: "SEC"
6986
+ }
6987
+ ];
6988
+ return /* @__PURE__ */ jsxs("div", {
6989
+ style: {
6990
+ width: "100%",
6991
+ height: "100%",
6992
+ borderRadius: Math.max(2, size.w * 0.035),
6993
+ display: "flex",
6994
+ flexDirection: "column",
6995
+ alignItems: "center",
6996
+ justifyContent: "center",
6997
+ padding: f * 0.8,
6998
+ background: cfg.backgroundColor,
6999
+ color: cfg.textColor,
7000
+ fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
7001
+ boxSizing: "border-box",
7002
+ pointerEvents: "none",
7003
+ userSelect: "none",
7004
+ fontSize: "".concat(f, "px")
7005
+ },
7006
+ children: [
7007
+ /* @__PURE__ */ jsx("div", {
7008
+ style: {
7009
+ fontSize: "0.8em",
7010
+ fontWeight: 600,
7011
+ textTransform: "uppercase",
7012
+ letterSpacing: "0.05em",
7013
+ color: cfg.accentColor,
7014
+ marginBottom: f * 0.4
7015
+ },
7016
+ children: cfg.eventName
7017
+ }),
7018
+ /* @__PURE__ */ jsx("div", {
7019
+ style: {
7020
+ display: "flex",
7021
+ gap: f * 0.6,
7022
+ alignItems: "center"
7023
+ },
7024
+ children: units.filter(function(u) {
7025
+ return u.show;
7026
+ }).map(function(u, i, arr) {
7027
+ return /* @__PURE__ */ jsxs(React.Fragment, {
7028
+ children: [
7029
+ /* @__PURE__ */ jsxs("div", {
7030
+ style: {
7031
+ textAlign: "center"
7032
+ },
7033
+ children: [
7034
+ /* @__PURE__ */ jsx("div", {
7035
+ style: {
7036
+ fontSize: "2em",
7037
+ fontWeight: 900,
7038
+ lineHeight: 1,
7039
+ borderRadius: Math.max(2, f * 0.4),
7040
+ padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
7041
+ background: "".concat(cfg.accentColor, "20")
7042
+ },
7043
+ children: u.value
7044
+ }),
7045
+ /* @__PURE__ */ jsx("div", {
7046
+ style: {
7047
+ fontSize: "0.5em",
7048
+ opacity: 0.5,
7049
+ marginTop: f * 0.2
7050
+ },
7051
+ children: u.label
7052
+ })
7053
+ ]
7054
+ }),
7055
+ i < arr.length - 1 && /* @__PURE__ */ jsx("div", {
7056
+ style: {
7057
+ fontSize: "1.8em",
7058
+ fontWeight: 700,
7059
+ opacity: 0.3
7060
+ },
7061
+ children: ":"
7062
+ })
7063
+ ]
7064
+ }, u.label);
7065
+ })
7066
+ }),
7067
+ cfg.message && /* @__PURE__ */ jsx("div", {
7068
+ style: {
7069
+ fontSize: "0.8em",
7070
+ opacity: 0.6,
7071
+ marginTop: f * 0.4,
7072
+ textAlign: "center"
7073
+ },
7074
+ children: cfg.message
7075
+ })
7076
+ ]
7077
+ });
7078
+ }
7079
+ function ShapeOverlay(param) {
7080
+ var overlay = param.overlay, size = param.size;
7081
+ var f = Math.max(6, size.w * 0.05);
7082
+ return /* @__PURE__ */ jsx("div", {
7083
+ style: {
7084
+ width: "100%",
7085
+ height: "100%",
7086
+ borderRadius: Math.max(2, size.w * 0.03),
7087
+ background: "rgba(99, 102, 241, 0.2)",
7088
+ border: "2px solid rgba(99, 102, 241, 0.4)",
7089
+ display: "flex",
7090
+ alignItems: "center",
7091
+ justifyContent: "center",
7092
+ pointerEvents: "none",
7093
+ userSelect: "none"
7094
+ },
7095
+ children: /* @__PURE__ */ jsx("div", {
7096
+ style: {
7097
+ fontSize: "".concat(f, "px"),
7098
+ fontWeight: 500,
7099
+ color: "rgba(163, 163, 163, 0.8)",
7100
+ textTransform: "uppercase"
7101
+ },
7102
+ children: overlay.name
7103
+ })
7104
+ });
7105
+ }
7106
+ function hexToRgb(hex) {
7107
+ if (!hex || !hex.startsWith("#")) return "0,0,0";
7108
+ var clean = hex.slice(1);
7109
+ var num = parseInt(clean.length === 3 ? clean.replace(/./g, "$&$&") : clean, 16);
7110
+ return "".concat(num >> 16 & 255, ",").concat(num >> 8 & 255, ",").concat(num & 255);
7111
+ }
7112
+ var OverlayRenderer = function OverlayRenderer(param) {
7113
+ var overlays = param.overlays, currentTime = param.currentTime, videoRef = param.videoRef, coordinateSpace = param.coordinateSpace;
7114
+ var _useState = _sliced_to_array(useState(null), 2), dims = _useState[0], setDims = _useState[1];
7115
+ var rafRef = useRef(null);
7116
+ var updateDims = useCallback(function() {
7117
+ var video = videoRef.current;
7118
+ if (video) {
7119
+ var computed = computeVideoDimensions(video);
7120
+ setDims(function(prev) {
7121
+ if (!computed || prev && prev.nativeWidth === computed.nativeWidth && prev.nativeHeight === computed.nativeHeight && prev.displayWidth === computed.displayWidth && prev.displayHeight === computed.displayHeight && prev.offsetX === computed.offsetX && prev.offsetY === computed.offsetY) {
7122
+ return prev;
7123
+ }
7124
+ return computed;
7125
+ });
7126
+ }
7127
+ }, [
7128
+ videoRef
7129
+ ]);
7130
+ useEffect(function() {
7131
+ updateDims();
7132
+ var interval = setInterval(updateDims, 500);
7133
+ var handleResize = function handleResize() {
7134
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
7135
+ rafRef.current = requestAnimationFrame(updateDims);
7136
+ };
7137
+ window.addEventListener("resize", handleResize);
7138
+ return function() {
7139
+ clearInterval(interval);
7140
+ window.removeEventListener("resize", handleResize);
7141
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
7142
+ };
7143
+ }, [
7144
+ updateDims
7145
+ ]);
7146
+ var activeOverlays = overlays.filter(function(o) {
7147
+ return isOverlayActive(o, currentTime);
7148
+ });
7149
+ if (!dims || activeOverlays.length === 0) return null;
7150
+ return /* @__PURE__ */ jsx("div", {
7151
+ "aria-hidden": "true",
7152
+ style: {
7153
+ position: "absolute",
7154
+ left: "".concat(dims.offsetX, "px"),
7155
+ top: "".concat(dims.offsetY, "px"),
7156
+ width: "".concat(dims.displayWidth, "px"),
7157
+ height: "".concat(dims.displayHeight, "px"),
7158
+ pointerEvents: "none",
7159
+ overflow: "hidden",
7160
+ zIndex: 8
7161
+ },
7162
+ children: activeOverlays.map(function(overlay) {
7163
+ var scaleX = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.width) ? dims.displayWidth / coordinateSpace.width : dims.scaleX;
7164
+ var scaleY = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.height) ? dims.displayHeight / coordinateSpace.height : dims.scaleY;
7165
+ var left = overlay.x * scaleX;
7166
+ var top = overlay.y * scaleY;
7167
+ var width = overlay.width * scaleX;
7168
+ var height = overlay.height * scaleY;
7169
+ var opacity = Math.max(0, Math.min(100, overlay.opacity)) / 100;
7170
+ var sz = {
7171
+ w: width,
7172
+ h: height
7173
+ };
7174
+ return /* @__PURE__ */ jsxs("div", {
7175
+ style: {
7176
+ position: "absolute",
7177
+ left: "".concat(left, "px"),
7178
+ top: "".concat(top, "px"),
7179
+ width: "".concat(width, "px"),
7180
+ height: "".concat(height, "px"),
7181
+ opacity: opacity,
7182
+ zIndex: overlay.z_index,
7183
+ overflow: "hidden"
7184
+ },
7185
+ children: [
7186
+ overlay.type === "image" && /* @__PURE__ */ jsx(ImageOverlay, {
7187
+ overlay: overlay
7188
+ }),
7189
+ overlay.type === "text" && /* @__PURE__ */ jsx(TextOverlay, {
7190
+ overlay: overlay
7191
+ }),
7192
+ overlay.type === "scroller" && /* @__PURE__ */ jsx(ScrollerOverlay, {
7193
+ overlay: overlay
7194
+ }),
7195
+ overlay.type === "shape" && /* @__PURE__ */ jsx(ShapeOverlay, {
7196
+ overlay: overlay,
7197
+ size: sz
7198
+ }),
7199
+ overlay.type === "score_bug" && /* @__PURE__ */ jsx(ScoreBugOverlay, {
7200
+ overlay: overlay,
7201
+ size: sz
7202
+ }),
7203
+ overlay.type === "lower_third" && /* @__PURE__ */ jsx(LowerThirdOverlay, {
7204
+ overlay: overlay,
7205
+ size: sz
7206
+ }),
7207
+ overlay.type === "qr_code" && /* @__PURE__ */ jsx(QrCodeOverlay, {
7208
+ overlay: overlay,
7209
+ size: sz
7210
+ }),
7211
+ overlay.type === "coming_up_next" && /* @__PURE__ */ jsx(ComingUpNextOverlay, {
7212
+ overlay: overlay,
7213
+ size: sz
7214
+ }),
7215
+ overlay.type === "contextual_trigger" && /* @__PURE__ */ jsx(ContextualTriggerOverlay, {
7216
+ overlay: overlay,
7217
+ size: sz
7218
+ }),
7219
+ overlay.type === "odds_betting" && /* @__PURE__ */ jsx(OddsBettingOverlay, {
7220
+ overlay: overlay,
7221
+ size: sz
7222
+ }),
7223
+ overlay.type === "breaking_news" && /* @__PURE__ */ jsx(BreakingNewsOverlay, {
7224
+ overlay: overlay,
7225
+ size: sz
7226
+ }),
7227
+ overlay.type === "countdown" && /* @__PURE__ */ jsx(CountdownOverlay, {
7228
+ overlay: overlay,
7229
+ size: sz
7230
+ })
7231
+ ]
7232
+ }, overlay.id);
7233
+ })
7234
+ });
7235
+ };
7236
+ // src/ui/StormcloudVideoPlayer.tsx
7237
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
6098
7238
  var CRITICAL_PROPS = [
6099
7239
  "src",
6100
7240
  "allowNativeHls",
@@ -6103,8 +7243,8 @@ var CRITICAL_PROPS = [
6103
7243
  "driftToleranceMs"
6104
7244
  ];
6105
7245
  var CONTROLS_HIDE_DELAY = 3e3;
6106
- var StormcloudVideoPlayerComponent = React.memo(function(props) {
6107
- var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, restVideoAttrs = _object_without_properties(props, [
7246
+ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
7247
+ var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, swirlProjectId = props.swirlProjectId, restVideoAttrs = _object_without_properties(props, [
6108
7248
  "src",
6109
7249
  "autoplay",
6110
7250
  "muted",
@@ -6131,35 +7271,38 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6131
7271
  "licenseKey",
6132
7272
  "minSegmentsBeforePlay",
6133
7273
  "disableAds",
6134
- "disableFiller"
7274
+ "disableFiller",
7275
+ "swirlProjectId"
6135
7276
  ]);
6136
- var videoRef = useRef(null);
6137
- var playerRef = useRef(null);
6138
- var bufferingTimeoutRef = useRef(null);
6139
- var controlsTimerRef = useRef(null);
6140
- var wrapperRef = useRef(null);
6141
- var _React_useState = _sliced_to_array(React.useState({
7277
+ var videoRef = useRef2(null);
7278
+ var playerRef = useRef2(null);
7279
+ var bufferingTimeoutRef = useRef2(null);
7280
+ var controlsTimerRef = useRef2(null);
7281
+ var wrapperRef = useRef2(null);
7282
+ var _React2_useState = _sliced_to_array(React2.useState({
6142
7283
  showAds: false,
6143
7284
  currentIndex: 0,
6144
7285
  totalAds: 0
6145
- }), 2), adStatus = _React_useState[0], setAdStatus = _React_useState[1];
6146
- var _React_useState1 = _sliced_to_array(React.useState(true), 2), shouldShowNativeControls = _React_useState1[0], setShouldShowNativeControls = _React_useState1[1];
6147
- var _React_useState2 = _sliced_to_array(React.useState(false), 2), isMuted = _React_useState2[0], setIsMuted = _React_useState2[1];
6148
- var _React_useState3 = _sliced_to_array(React.useState(false), 2), isFullscreen = _React_useState3[0], setIsFullscreen = _React_useState3[1];
6149
- var _React_useState4 = _sliced_to_array(React.useState(false), 2), isPlaying = _React_useState4[0], setIsPlaying = _React_useState4[1];
6150
- var _React_useState5 = _sliced_to_array(React.useState(0), 2), currentTime = _React_useState5[0], setCurrentTime = _React_useState5[1];
6151
- var _React_useState6 = _sliced_to_array(React.useState(0), 2), duration = _React_useState6[0], setDuration = _React_useState6[1];
6152
- var _React_useState7 = _sliced_to_array(React.useState(1), 2), volume = _React_useState7[0], setVolume = _React_useState7[1];
6153
- var _React_useState8 = _sliced_to_array(React.useState(1), 2), playbackRate = _React_useState8[0], setPlaybackRate = _React_useState8[1];
6154
- var _React_useState9 = _sliced_to_array(React.useState(false), 2), showVolumeSlider = _React_useState9[0], setShowVolumeSlider = _React_useState9[1];
6155
- var _React_useState10 = _sliced_to_array(React.useState(false), 2), showSpeedMenu = _React_useState10[0], setShowSpeedMenu = _React_useState10[1];
6156
- var _React_useState11 = _sliced_to_array(React.useState(true), 2), isLoading = _React_useState11[0], setIsLoading = _React_useState11[1];
6157
- var _React_useState12 = _sliced_to_array(React.useState(false), 2), isBuffering = _React_useState12[0], setIsBuffering = _React_useState12[1];
6158
- var _React_useState13 = _sliced_to_array(React.useState(false), 2), showCenterPlay = _React_useState13[0], setShowCenterPlay = _React_useState13[1];
6159
- var _React_useState14 = _sliced_to_array(React.useState(false), 2), showLicenseWarning = _React_useState14[0], setShowLicenseWarning = _React_useState14[1];
6160
- var _React_useState15 = _sliced_to_array(React.useState(true), 2), controlsVisible = _React_useState15[0], setControlsVisible = _React_useState15[1];
6161
- var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState16[0], setViewportWidth = _React_useState16[1];
6162
- var _React_useState17 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState17[0], setIsPortrait = _React_useState17[1];
7286
+ }), 2), adStatus = _React2_useState[0], setAdStatus = _React2_useState[1];
7287
+ var _React2_useState1 = _sliced_to_array(React2.useState(true), 2), shouldShowNativeControls = _React2_useState1[0], setShouldShowNativeControls = _React2_useState1[1];
7288
+ var _React2_useState2 = _sliced_to_array(React2.useState(false), 2), isMuted = _React2_useState2[0], setIsMuted = _React2_useState2[1];
7289
+ var _React2_useState3 = _sliced_to_array(React2.useState(false), 2), isFullscreen = _React2_useState3[0], setIsFullscreen = _React2_useState3[1];
7290
+ var _React2_useState4 = _sliced_to_array(React2.useState(false), 2), isPlaying = _React2_useState4[0], setIsPlaying = _React2_useState4[1];
7291
+ var _React2_useState5 = _sliced_to_array(React2.useState(0), 2), currentTime = _React2_useState5[0], setCurrentTime = _React2_useState5[1];
7292
+ var _React2_useState6 = _sliced_to_array(React2.useState(0), 2), duration = _React2_useState6[0], setDuration = _React2_useState6[1];
7293
+ var _React2_useState7 = _sliced_to_array(React2.useState(1), 2), volume = _React2_useState7[0], setVolume = _React2_useState7[1];
7294
+ var _React2_useState8 = _sliced_to_array(React2.useState(1), 2), playbackRate = _React2_useState8[0], setPlaybackRate = _React2_useState8[1];
7295
+ var _React2_useState9 = _sliced_to_array(React2.useState(false), 2), showVolumeSlider = _React2_useState9[0], setShowVolumeSlider = _React2_useState9[1];
7296
+ var _React2_useState10 = _sliced_to_array(React2.useState(false), 2), showSpeedMenu = _React2_useState10[0], setShowSpeedMenu = _React2_useState10[1];
7297
+ var _React2_useState11 = _sliced_to_array(React2.useState(true), 2), isLoading = _React2_useState11[0], setIsLoading = _React2_useState11[1];
7298
+ var _React2_useState12 = _sliced_to_array(React2.useState(false), 2), isBuffering = _React2_useState12[0], setIsBuffering = _React2_useState12[1];
7299
+ var _React2_useState13 = _sliced_to_array(React2.useState(false), 2), showCenterPlay = _React2_useState13[0], setShowCenterPlay = _React2_useState13[1];
7300
+ var _React2_useState14 = _sliced_to_array(React2.useState(false), 2), showLicenseWarning = _React2_useState14[0], setShowLicenseWarning = _React2_useState14[1];
7301
+ var _React2_useState15 = _sliced_to_array(React2.useState(true), 2), controlsVisible = _React2_useState15[0], setControlsVisible = _React2_useState15[1];
7302
+ var _React2_useState16 = _sliced_to_array(React2.useState([]), 2), overlays = _React2_useState16[0], setOverlays = _React2_useState16[1];
7303
+ var _React2_useState17 = _sliced_to_array(React2.useState(null), 2), overlayCoordSpace = _React2_useState17[0], setOverlayCoordSpace = _React2_useState17[1];
7304
+ var _React2_useState18 = _sliced_to_array(React2.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React2_useState18[0], setViewportWidth = _React2_useState18[1];
7305
+ var _React2_useState19 = _sliced_to_array(React2.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React2_useState19[0], setIsPortrait = _React2_useState19[1];
6163
7306
  var getResponsiveScale = function getResponsiveScale() {
6164
7307
  if (viewportWidth < 480) return 0.7;
6165
7308
  if (viewportWidth < 768) return 0.8;
@@ -6167,7 +7310,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6167
7310
  return 1;
6168
7311
  };
6169
7312
  var responsiveScale = getResponsiveScale();
6170
- var resetControlsTimer = useCallback(function() {
7313
+ var resetControlsTimer = useCallback2(function() {
6171
7314
  if (controlsTimerRef.current) {
6172
7315
  clearTimeout(controlsTimerRef.current);
6173
7316
  }
@@ -6255,7 +7398,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6255
7398
  lowLatencyMode,
6256
7399
  driftToleranceMs
6257
7400
  ]);
6258
- useEffect(function() {
7401
+ useEffect2(function() {
6259
7402
  if (typeof window === "undefined") return;
6260
7403
  var el = videoRef.current;
6261
7404
  if (!el || !src) return;
@@ -6310,7 +7453,61 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6310
7453
  }, [
6311
7454
  criticalPropsKey
6312
7455
  ]);
6313
- useEffect(function() {
7456
+ useEffect2(function() {
7457
+ if (!swirlProjectId) {
7458
+ setOverlays([]);
7459
+ setOverlayCoordSpace(null);
7460
+ return;
7461
+ }
7462
+ var cancelled = false;
7463
+ fetchProjectOverlays(swirlProjectId).then(function(data) {
7464
+ if (!cancelled) setOverlays(data);
7465
+ }).catch(function(err) {
7466
+ if (!cancelled) {
7467
+ console.warn("[StormcloudVideoPlayer] Failed to fetch overlays:", err);
7468
+ }
7469
+ });
7470
+ return function() {
7471
+ cancelled = true;
7472
+ };
7473
+ }, [
7474
+ swirlProjectId
7475
+ ]);
7476
+ useEffect2(function() {
7477
+ if (!swirlProjectId) return;
7478
+ var player = playerRef.current;
7479
+ if (!player) return;
7480
+ var attempts = 0;
7481
+ var maxAttempts = 30;
7482
+ var tryResolve = function tryResolve() {
7483
+ var res = player.getMinHlsResolution();
7484
+ if (res) {
7485
+ setOverlayCoordSpace(res);
7486
+ return true;
7487
+ }
7488
+ var video = player.videoElement;
7489
+ if (video && video.videoWidth > 0 && video.videoHeight > 0) {
7490
+ setOverlayCoordSpace({
7491
+ width: video.videoWidth,
7492
+ height: video.videoHeight
7493
+ });
7494
+ return true;
7495
+ }
7496
+ return false;
7497
+ };
7498
+ if (tryResolve()) return;
7499
+ var interval = setInterval(function() {
7500
+ attempts++;
7501
+ if (tryResolve() || attempts >= maxAttempts) clearInterval(interval);
7502
+ }, 300);
7503
+ return function() {
7504
+ return clearInterval(interval);
7505
+ };
7506
+ }, [
7507
+ swirlProjectId,
7508
+ criticalPropsKey
7509
+ ]);
7510
+ useEffect2(function() {
6314
7511
  if (!playerRef.current) return;
6315
7512
  try {
6316
7513
  if (autoplay !== void 0 && playerRef.current.videoElement) {
@@ -6326,7 +7523,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6326
7523
  autoplay,
6327
7524
  muted
6328
7525
  ]);
6329
- useEffect(function() {
7526
+ useEffect2(function() {
6330
7527
  if (!playerRef.current) return;
6331
7528
  var checkAdStatus = function checkAdStatus() {
6332
7529
  if (playerRef.current) {
@@ -6356,7 +7553,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6356
7553
  return clearInterval(interval);
6357
7554
  };
6358
7555
  }, []);
6359
- useEffect(function() {
7556
+ useEffect2(function() {
6360
7557
  if (typeof window === "undefined" || !playerRef.current) return;
6361
7558
  var handleResize = function handleResize() {
6362
7559
  if (playerRef.current && videoRef.current) {
@@ -6372,7 +7569,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6372
7569
  return window.removeEventListener("resize", handleResize);
6373
7570
  };
6374
7571
  }, []);
6375
- useEffect(function() {
7572
+ useEffect2(function() {
6376
7573
  if (!playerRef.current || !videoRef.current) return;
6377
7574
  var updateStates = function updateStates() {
6378
7575
  if (playerRef.current && videoRef.current) {
@@ -6399,7 +7596,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6399
7596
  document.removeEventListener("fullscreenchange", handleFullscreenChange);
6400
7597
  };
6401
7598
  }, []);
6402
- useEffect(function() {
7599
+ useEffect2(function() {
6403
7600
  if (!videoRef.current) return;
6404
7601
  var handleCanPlay = function handleCanPlay() {
6405
7602
  setIsLoading(false);
@@ -6471,19 +7668,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6471
7668
  }, [
6472
7669
  debugAdTiming
6473
7670
  ]);
6474
- useEffect(function() {
7671
+ useEffect2(function() {
6475
7672
  return function() {
6476
7673
  if (controlsTimerRef.current) {
6477
7674
  clearTimeout(controlsTimerRef.current);
6478
7675
  }
6479
7676
  };
6480
7677
  }, []);
6481
- var handleWrapperMouseMove = useCallback(function() {
7678
+ var handleWrapperMouseMove = useCallback2(function() {
6482
7679
  resetControlsTimer();
6483
7680
  }, [
6484
7681
  resetControlsTimer
6485
7682
  ]);
6486
- var handleWrapperMouseLeave = useCallback(function() {
7683
+ var handleWrapperMouseLeave = useCallback2(function() {
6487
7684
  if (!showVolumeSlider && !showSpeedMenu) {
6488
7685
  setControlsVisible(false);
6489
7686
  }
@@ -6493,12 +7690,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6493
7690
  ]);
6494
7691
  var progressPercent = duration > 0 ? currentTime / duration * 100 : 0;
6495
7692
  var VolumeIcon = isMuted || volume === 0 ? FaVolumeMute : volume < 0.5 ? FaVolumeDown : FaVolumeUp;
6496
- return /* @__PURE__ */ jsxs(Fragment, {
7693
+ return /* @__PURE__ */ jsxs2(Fragment2, {
6497
7694
  children: [
6498
- /* @__PURE__ */ jsx("style", {
7695
+ /* @__PURE__ */ jsx2("style", {
6499
7696
  children: "\n @keyframes sc-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes sc-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n }\n @keyframes sc-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .sc-wrapper:fullscreen,\n .sc-wrapper:has(*:fullscreen) {\n border-radius: 0 !important;\n box-shadow: none !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n }\n .sc-ctrl-btn {\n background: none;\n border: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n padding: 8px;\n transition: background 0.15s ease, opacity 0.15s ease;\n opacity: 0.9;\n }\n .sc-ctrl-btn:hover {\n opacity: 1;\n background: rgba(255, 255, 255, 0.1);\n }\n .sc-ctrl-btn:active {\n opacity: 0.7;\n }\n .sc-controls-bar {\n transition: opacity 0.35s ease, transform 0.35s ease;\n }\n .sc-progress-track:hover .sc-progress-thumb {\n transform: translate(-50%, -50%) scale(1) !important;\n }\n .sc-loading-hidden .sc-loading-indicator {\n display: none !important;\n }\n "
6500
7697
  }),
6501
- /* @__PURE__ */ jsxs("div", {
7698
+ /* @__PURE__ */ jsxs2("div", {
6502
7699
  ref: wrapperRef,
6503
7700
  className: "sc-wrapper ".concat(wrapperClassName || ""),
6504
7701
  onMouseMove: handleWrapperMouseMove,
@@ -6522,10 +7719,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6522
7719
  boxShadow: isFullscreen ? "none" : void 0
6523
7720
  }, wrapperStyle),
6524
7721
  children: [
6525
- /* @__PURE__ */ jsx("video", _object_spread_props(_object_spread({
7722
+ /* @__PURE__ */ jsx2("video", _object_spread_props(_object_spread({
6526
7723
  ref: videoRef,
6527
7724
  className: className,
6528
7725
  style: _object_spread({
7726
+ position: "relative",
7727
+ zIndex: 1,
6529
7728
  display: "block",
6530
7729
  width: "100%",
6531
7730
  height: isFullscreen ? "100%" : "auto",
@@ -6542,7 +7741,13 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6542
7741
  }, restVideoAttrs), {
6543
7742
  children: children
6544
7743
  })),
6545
- (isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ jsx(FaSpinner, {
7744
+ overlays.length > 0 && !adStatus.showAds && /* @__PURE__ */ jsx2(OverlayRenderer, {
7745
+ overlays: overlays,
7746
+ currentTime: currentTime,
7747
+ videoRef: videoRef,
7748
+ coordinateSpace: overlayCoordSpace
7749
+ }),
7750
+ (isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ jsx2(FaSpinner, {
6546
7751
  className: "sc-loading-indicator",
6547
7752
  size: 40,
6548
7753
  color: "rgba(255, 255, 255, 0.85)",
@@ -6555,7 +7760,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6555
7760
  filter: "drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6))"
6556
7761
  }
6557
7762
  }),
6558
- showLicenseWarning && /* @__PURE__ */ jsxs("div", {
7763
+ showLicenseWarning && /* @__PURE__ */ jsxs2("div", {
6559
7764
  style: {
6560
7765
  position: "absolute",
6561
7766
  top: "50%",
@@ -6574,7 +7779,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6574
7779
  margin: "0 16px"
6575
7780
  },
6576
7781
  children: [
6577
- /* @__PURE__ */ jsx("div", {
7782
+ /* @__PURE__ */ jsx2("div", {
6578
7783
  style: {
6579
7784
  fontSize: "18px",
6580
7785
  fontWeight: "700",
@@ -6583,7 +7788,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6583
7788
  },
6584
7789
  children: "License Key Required"
6585
7790
  }),
6586
- /* @__PURE__ */ jsxs("div", {
7791
+ /* @__PURE__ */ jsxs2("div", {
6587
7792
  style: {
6588
7793
  fontSize: "13px",
6589
7794
  lineHeight: "1.6",
@@ -6591,13 +7796,13 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6591
7796
  },
6592
7797
  children: [
6593
7798
  "Please provide a valid license key to use the Stormcloud Video Player.",
6594
- /* @__PURE__ */ jsx("br", {}),
7799
+ /* @__PURE__ */ jsx2("br", {}),
6595
7800
  "Contact your administrator for licensing information."
6596
7801
  ]
6597
7802
  })
6598
7803
  ]
6599
7804
  }),
6600
- showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ jsx("div", {
7805
+ showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ jsx2("div", {
6601
7806
  onClick: handleCenterPlayClick,
6602
7807
  style: {
6603
7808
  position: "absolute",
@@ -6632,7 +7837,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6632
7837
  el.style.transform = "translate(-50%, -50%) scale(1)";
6633
7838
  },
6634
7839
  title: "Play",
6635
- children: /* @__PURE__ */ jsx(FaPlay, {
7840
+ children: /* @__PURE__ */ jsx2(FaPlay, {
6636
7841
  size: Math.max(22, 28 * responsiveScale),
6637
7842
  color: "white",
6638
7843
  style: {
@@ -6641,7 +7846,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6641
7846
  }
6642
7847
  })
6643
7848
  }),
6644
- adStatus.showAds && /* @__PURE__ */ jsxs("div", {
7849
+ adStatus.showAds && /* @__PURE__ */ jsxs2("div", {
6645
7850
  style: {
6646
7851
  position: "absolute",
6647
7852
  top: "".concat(12 * responsiveScale, "px"),
@@ -6653,7 +7858,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6653
7858
  animation: "sc-fade-in 0.3s ease"
6654
7859
  },
6655
7860
  children: [
6656
- /* @__PURE__ */ jsx("div", {
7861
+ /* @__PURE__ */ jsx2("div", {
6657
7862
  style: {
6658
7863
  background: "rgba(234, 179, 8, 0.9)",
6659
7864
  backdropFilter: "blur(12px)",
@@ -6668,7 +7873,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6668
7873
  },
6669
7874
  children: "Ad"
6670
7875
  }),
6671
- adStatus.currentIndex > 0 && /* @__PURE__ */ jsxs("div", {
7876
+ adStatus.currentIndex > 0 && /* @__PURE__ */ jsxs2("div", {
6672
7877
  style: {
6673
7878
  background: "rgba(0, 0, 0, 0.5)",
6674
7879
  backdropFilter: "blur(12px)",
@@ -6687,7 +7892,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6687
7892
  })
6688
7893
  ]
6689
7894
  }),
6690
- shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ jsxs("div", {
7895
+ shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ jsxs2("div", {
6691
7896
  className: "sc-controls-bar",
6692
7897
  style: {
6693
7898
  position: "absolute",
@@ -6702,7 +7907,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6702
7907
  pointerEvents: controlsVisible || adStatus.showAds ? "auto" : "none"
6703
7908
  },
6704
7909
  children: [
6705
- /* @__PURE__ */ jsxs("div", {
7910
+ /* @__PURE__ */ jsxs2("div", {
6706
7911
  className: "sc-progress-track",
6707
7912
  style: {
6708
7913
  width: "100%",
@@ -6722,7 +7927,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6722
7927
  e.currentTarget.style.height = "3px";
6723
7928
  },
6724
7929
  children: [
6725
- /* @__PURE__ */ jsx("div", {
7930
+ /* @__PURE__ */ jsx2("div", {
6726
7931
  style: {
6727
7932
  position: "absolute",
6728
7933
  top: 0,
@@ -6734,7 +7939,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6734
7939
  transition: "width 0.15s linear"
6735
7940
  }
6736
7941
  }),
6737
- /* @__PURE__ */ jsx("div", {
7942
+ /* @__PURE__ */ jsx2("div", {
6738
7943
  className: "sc-progress-thumb",
6739
7944
  style: {
6740
7945
  position: "absolute",
@@ -6751,7 +7956,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6751
7956
  })
6752
7957
  ]
6753
7958
  }),
6754
- /* @__PURE__ */ jsxs("div", {
7959
+ /* @__PURE__ */ jsxs2("div", {
6755
7960
  style: {
6756
7961
  display: "flex",
6757
7962
  alignItems: "center",
@@ -6760,14 +7965,14 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6760
7965
  gap: "".concat(8 * responsiveScale, "px")
6761
7966
  },
6762
7967
  children: [
6763
- /* @__PURE__ */ jsxs("div", {
7968
+ /* @__PURE__ */ jsxs2("div", {
6764
7969
  style: {
6765
7970
  display: "flex",
6766
7971
  alignItems: "center",
6767
7972
  gap: "".concat(8 * responsiveScale, "px")
6768
7973
  },
6769
7974
  children: [
6770
- /* @__PURE__ */ jsx("button", {
7975
+ /* @__PURE__ */ jsx2("button", {
6771
7976
  className: "sc-ctrl-btn",
6772
7977
  onClick: handlePlayPause,
6773
7978
  style: {
@@ -6777,16 +7982,16 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6777
7982
  minHeight: "".concat(36 * responsiveScale, "px")
6778
7983
  },
6779
7984
  title: isPlaying ? "Pause" : "Play",
6780
- children: isPlaying ? /* @__PURE__ */ jsx(FaPause, {
7985
+ children: isPlaying ? /* @__PURE__ */ jsx2(FaPause, {
6781
7986
  size: Math.max(14, 18 * responsiveScale)
6782
- }) : /* @__PURE__ */ jsx(FaPlay, {
7987
+ }) : /* @__PURE__ */ jsx2(FaPlay, {
6783
7988
  size: Math.max(14, 18 * responsiveScale),
6784
7989
  style: {
6785
7990
  marginLeft: "2px"
6786
7991
  }
6787
7992
  })
6788
7993
  }),
6789
- /* @__PURE__ */ jsxs("div", {
7994
+ /* @__PURE__ */ jsxs2("div", {
6790
7995
  style: {
6791
7996
  display: "flex",
6792
7997
  alignItems: "center"
@@ -6798,7 +8003,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6798
8003
  return setShowVolumeSlider(false);
6799
8004
  },
6800
8005
  children: [
6801
- /* @__PURE__ */ jsx("button", {
8006
+ /* @__PURE__ */ jsx2("button", {
6802
8007
  className: "sc-ctrl-btn",
6803
8008
  onClick: function onClick() {
6804
8009
  if (playerRef.current) {
@@ -6814,11 +8019,11 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6814
8019
  minHeight: "".concat(36 * responsiveScale, "px")
6815
8020
  },
6816
8021
  title: isMuted ? "Unmute" : "Mute",
6817
- children: /* @__PURE__ */ jsx(VolumeIcon, {
8022
+ children: /* @__PURE__ */ jsx2(VolumeIcon, {
6818
8023
  size: Math.max(14, 18 * responsiveScale)
6819
8024
  })
6820
8025
  }),
6821
- /* @__PURE__ */ jsx("div", {
8026
+ /* @__PURE__ */ jsx2("div", {
6822
8027
  style: {
6823
8028
  width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
6824
8029
  overflow: "hidden",
@@ -6828,7 +8033,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6828
8033
  paddingLeft: showVolumeSlider ? "2px" : "0",
6829
8034
  paddingRight: showVolumeSlider ? "4px" : "0"
6830
8035
  },
6831
- children: /* @__PURE__ */ jsxs("div", {
8036
+ children: /* @__PURE__ */ jsxs2("div", {
6832
8037
  style: {
6833
8038
  position: "relative",
6834
8039
  width: "".concat(56 * responsiveScale, "px"),
@@ -6858,7 +8063,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6858
8063
  handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
6859
8064
  },
6860
8065
  children: [
6861
- /* @__PURE__ */ jsx("div", {
8066
+ /* @__PURE__ */ jsx2("div", {
6862
8067
  style: {
6863
8068
  position: "absolute",
6864
8069
  inset: 0,
@@ -6866,7 +8071,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6866
8071
  borderRadius: "1.5px"
6867
8072
  }
6868
8073
  }),
6869
- /* @__PURE__ */ jsx("div", {
8074
+ /* @__PURE__ */ jsx2("div", {
6870
8075
  style: {
6871
8076
  position: "absolute",
6872
8077
  top: 0,
@@ -6878,7 +8083,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6878
8083
  transition: "width 0.1s ease-out"
6879
8084
  }
6880
8085
  }),
6881
- /* @__PURE__ */ jsx("div", {
8086
+ /* @__PURE__ */ jsx2("div", {
6882
8087
  style: {
6883
8088
  position: "absolute",
6884
8089
  top: "50%",
@@ -6897,7 +8102,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6897
8102
  })
6898
8103
  ]
6899
8104
  }),
6900
- /* @__PURE__ */ jsxs("div", {
8105
+ /* @__PURE__ */ jsxs2("div", {
6901
8106
  style: {
6902
8107
  fontSize: "".concat(13 * responsiveScale, "px"),
6903
8108
  fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
@@ -6910,7 +8115,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6910
8115
  children: [
6911
8116
  formatTime(currentTime),
6912
8117
  " ",
6913
- /* @__PURE__ */ jsx("span", {
8118
+ /* @__PURE__ */ jsx2("span", {
6914
8119
  style: {
6915
8120
  color: "rgba(255,255,255,0.5)"
6916
8121
  },
@@ -6922,20 +8127,20 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6922
8127
  })
6923
8128
  ]
6924
8129
  }),
6925
- /* @__PURE__ */ jsxs("div", {
8130
+ /* @__PURE__ */ jsxs2("div", {
6926
8131
  style: {
6927
8132
  display: "flex",
6928
8133
  alignItems: "center",
6929
8134
  gap: "".concat(8 * responsiveScale, "px")
6930
8135
  },
6931
8136
  children: [
6932
- /* @__PURE__ */ jsxs("div", {
8137
+ /* @__PURE__ */ jsxs2("div", {
6933
8138
  style: {
6934
8139
  position: "relative",
6935
8140
  display: viewportWidth < 600 ? "none" : "block"
6936
8141
  },
6937
8142
  children: [
6938
- /* @__PURE__ */ jsxs("button", {
8143
+ /* @__PURE__ */ jsxs2("button", {
6939
8144
  className: "sc-ctrl-btn",
6940
8145
  onClick: function onClick() {
6941
8146
  setShowSpeedMenu(!showSpeedMenu);
@@ -6955,7 +8160,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6955
8160
  "x"
6956
8161
  ]
6957
8162
  }),
6958
- showSpeedMenu && /* @__PURE__ */ jsx("div", {
8163
+ showSpeedMenu && /* @__PURE__ */ jsx2("div", {
6959
8164
  style: {
6960
8165
  position: "absolute",
6961
8166
  bottom: "100%",
@@ -6981,7 +8186,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
6981
8186
  1.75,
6982
8187
  2
6983
8188
  ].map(function(speed) {
6984
- return /* @__PURE__ */ jsxs("button", {
8189
+ return /* @__PURE__ */ jsxs2("button", {
6985
8190
  onClick: function onClick() {
6986
8191
  return handlePlaybackRateChange(speed);
6987
8192
  },
@@ -7020,7 +8225,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7020
8225
  })
7021
8226
  ]
7022
8227
  }),
7023
- /* @__PURE__ */ jsx("button", {
8228
+ /* @__PURE__ */ jsx2("button", {
7024
8229
  className: "sc-ctrl-btn",
7025
8230
  onClick: function onClick() {
7026
8231
  if (onFullscreenToggle) {
@@ -7041,9 +8246,9 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7041
8246
  minHeight: "".concat(36 * responsiveScale, "px")
7042
8247
  },
7043
8248
  title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
7044
- children: isFullscreen ? /* @__PURE__ */ jsx(FaCompress, {
8249
+ children: isFullscreen ? /* @__PURE__ */ jsx2(FaCompress, {
7045
8250
  size: Math.max(14, 18 * responsiveScale)
7046
- }) : /* @__PURE__ */ jsx(FaExpand, {
8251
+ }) : /* @__PURE__ */ jsx2(FaExpand, {
7047
8252
  size: Math.max(14, 18 * responsiveScale)
7048
8253
  })
7049
8254
  })
@@ -7052,7 +8257,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7052
8257
  ]
7053
8258
  })
7054
8259
  ]
7055
- }) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ jsxs("div", {
8260
+ }) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ jsxs2("div", {
7056
8261
  className: "sc-controls-bar",
7057
8262
  style: {
7058
8263
  position: "absolute",
@@ -7067,7 +8272,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7067
8272
  pointerEvents: controlsVisible ? "auto" : "none"
7068
8273
  },
7069
8274
  children: [
7070
- /* @__PURE__ */ jsxs("div", {
8275
+ /* @__PURE__ */ jsxs2("div", {
7071
8276
  style: {
7072
8277
  display: "flex",
7073
8278
  alignItems: "center",
@@ -7082,7 +8287,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7082
8287
  return setShowVolumeSlider(false);
7083
8288
  },
7084
8289
  children: [
7085
- /* @__PURE__ */ jsx("button", {
8290
+ /* @__PURE__ */ jsx2("button", {
7086
8291
  className: "sc-ctrl-btn",
7087
8292
  onClick: function onClick() {
7088
8293
  if (playerRef.current) playerRef.current.toggleMute();
@@ -7096,11 +8301,11 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7096
8301
  minHeight: "".concat(36 * responsiveScale, "px")
7097
8302
  },
7098
8303
  title: isMuted ? "Unmute" : "Mute",
7099
- children: /* @__PURE__ */ jsx(VolumeIcon, {
8304
+ children: /* @__PURE__ */ jsx2(VolumeIcon, {
7100
8305
  size: Math.max(14, 18 * responsiveScale)
7101
8306
  })
7102
8307
  }),
7103
- /* @__PURE__ */ jsx("div", {
8308
+ /* @__PURE__ */ jsx2("div", {
7104
8309
  style: {
7105
8310
  width: showVolumeSlider ? "".concat(62 * responsiveScale, "px") : "0px",
7106
8311
  overflow: "hidden",
@@ -7110,7 +8315,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7110
8315
  paddingLeft: showVolumeSlider ? "2px" : "0",
7111
8316
  paddingRight: showVolumeSlider ? "6px" : "0"
7112
8317
  },
7113
- children: /* @__PURE__ */ jsxs("div", {
8318
+ children: /* @__PURE__ */ jsxs2("div", {
7114
8319
  style: {
7115
8320
  position: "relative",
7116
8321
  width: "".concat(56 * responsiveScale, "px"),
@@ -7140,7 +8345,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7140
8345
  handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
7141
8346
  },
7142
8347
  children: [
7143
- /* @__PURE__ */ jsx("div", {
8348
+ /* @__PURE__ */ jsx2("div", {
7144
8349
  style: {
7145
8350
  position: "absolute",
7146
8351
  inset: 0,
@@ -7148,7 +8353,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7148
8353
  borderRadius: "1.5px"
7149
8354
  }
7150
8355
  }),
7151
- /* @__PURE__ */ jsx("div", {
8356
+ /* @__PURE__ */ jsx2("div", {
7152
8357
  style: {
7153
8358
  position: "absolute",
7154
8359
  top: 0,
@@ -7160,7 +8365,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7160
8365
  transition: "width 0.1s ease-out"
7161
8366
  }
7162
8367
  }),
7163
- /* @__PURE__ */ jsx("div", {
8368
+ /* @__PURE__ */ jsx2("div", {
7164
8369
  style: {
7165
8370
  position: "absolute",
7166
8371
  top: "50%",
@@ -7179,7 +8384,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7179
8384
  })
7180
8385
  ]
7181
8386
  }),
7182
- /* @__PURE__ */ jsx("button", {
8387
+ /* @__PURE__ */ jsx2("button", {
7183
8388
  className: "sc-ctrl-btn",
7184
8389
  onClick: function onClick() {
7185
8390
  if (onFullscreenToggle) {
@@ -7201,15 +8406,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7201
8406
  background: "rgba(0, 0, 0, 0.6)"
7202
8407
  },
7203
8408
  title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
7204
- children: isFullscreen ? /* @__PURE__ */ jsx(FaCompress, {
8409
+ children: isFullscreen ? /* @__PURE__ */ jsx2(FaCompress, {
7205
8410
  size: Math.max(14, 18 * responsiveScale)
7206
- }) : /* @__PURE__ */ jsx(FaExpand, {
8411
+ }) : /* @__PURE__ */ jsx2(FaExpand, {
7207
8412
  size: Math.max(14, 18 * responsiveScale)
7208
8413
  })
7209
8414
  })
7210
8415
  ]
7211
8416
  }),
7212
- onControlClick && /* @__PURE__ */ jsx("div", {
8417
+ onControlClick && /* @__PURE__ */ jsx2("div", {
7213
8418
  onClick: onControlClick,
7214
8419
  style: {
7215
8420
  position: "absolute",
@@ -7260,7 +8465,8 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7260
8465
  "playsInline",
7261
8466
  "preload",
7262
8467
  "poster",
7263
- "children"
8468
+ "children",
8469
+ "swirlProjectId"
7264
8470
  ];
7265
8471
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7266
8472
  try {
@@ -7315,7 +8521,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7315
8521
  return true;
7316
8522
  });
7317
8523
  // src/StormcloudPlayer.tsx
7318
- import React3, { Component as Component4, Suspense } from "react";
8524
+ import React4, { Component as Component4, Suspense } from "react";
7319
8525
  // src/props.ts
7320
8526
  var noop = function noop() {};
7321
8527
  var defaultProps = {
@@ -7996,7 +9202,7 @@ var players = [
7996
9202
  ];
7997
9203
  var players_default = players;
7998
9204
  // src/Player.tsx
7999
- import React2, { Component as Component3 } from "react";
9205
+ import React3, { Component as Component3 } from "react";
8000
9206
  var SEEK_ON_PLAY_EXPIRY = 5e3;
8001
9207
  var Player = /*#__PURE__*/ function(Component3) {
8002
9208
  "use strict";
@@ -8245,7 +9451,7 @@ var Player = /*#__PURE__*/ function(Component3) {
8245
9451
  if (!Player2) {
8246
9452
  return null;
8247
9453
  }
8248
- return React2.createElement(Player2, _object_spread_props(_object_spread({}, this.props), {
9454
+ return React3.createElement(Player2, _object_spread_props(_object_spread({}, this.props), {
8249
9455
  onMount: this.handlePlayerMount,
8250
9456
  onReady: this.handleReady,
8251
9457
  onPlay: this.handlePlay,
@@ -8392,7 +9598,7 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
8392
9598
  if (!src) return null;
8393
9599
  var activePlayer = _this.getActivePlayer(src);
8394
9600
  if (!activePlayer) return null;
8395
- return React3.createElement(Player, _object_spread_props(_object_spread({}, _this.props), {
9601
+ return React4.createElement(Player, _object_spread_props(_object_spread({}, _this.props), {
8396
9602
  key: activePlayer.key,
8397
9603
  ref: _this.references.player,
8398
9604
  activePlayer: activePlayer.lazyPlayer || activePlayer,
@@ -8408,13 +9614,13 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
8408
9614
  var _this_props = this.props, src = _this_props.src, style = _this_props.style, width = _this_props.width, height = _this_props.height, fallbackElement = _this_props.fallback, Wrapper = _this_props.wrapper;
8409
9615
  var attributes = this.getAttributes(src);
8410
9616
  var wrapperRef = typeof Wrapper === "string" ? this.references.wrapper : void 0;
8411
- return React3.createElement(Wrapper, _object_spread({
9617
+ return React4.createElement(Wrapper, _object_spread({
8412
9618
  ref: wrapperRef,
8413
9619
  style: _object_spread_props(_object_spread({}, style), {
8414
9620
  width: width,
8415
9621
  height: height
8416
9622
  })
8417
- }, attributes), React3.createElement(UniversalSuspense, {
9623
+ }, attributes), React4.createElement(UniversalSuspense, {
8418
9624
  fallback: fallbackElement
8419
9625
  }, this.renderActivePlayer(src)));
8420
9626
  }
@@ -8480,5 +9686,5 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
8480
9686
  };
8481
9687
  var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
8482
9688
  var StormcloudPlayer_default = StormcloudPlayer;
8483
- export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createStormcloudPlayer, createVastAdLayer, createVastManager, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode };
9689
+ export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createStormcloudPlayer, createVastAdLayer, createVastManager, StormcloudVideoPlayerComponent as default, detectBrowser, fetchProjectOverlays, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, isOverlayActive, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, resolveImageUrl, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, timeStringToSeconds };
8484
9690
  //# sourceMappingURL=index.js.map