@mottosports/motto-video-player 1.0.1-rc.79 → 1.0.1-rc.80

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/dist/index.js CHANGED
@@ -434,7 +434,7 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
434
434
  `);
435
435
 
436
436
  // src/Player.tsx
437
- var import_react13 = require("react");
437
+ var import_react12 = require("react");
438
438
  var import_shaka_player4 = __toESM(require("shaka-player/dist/shaka-player.ui"));
439
439
 
440
440
  // src/hooks/useShakaPlayer.ts
@@ -490,7 +490,7 @@ var supportsWidevinePersistentLicenses = () => {
490
490
  var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
491
491
 
492
492
  // package.json
493
- var version = "1.0.1-rc.79";
493
+ var version = "1.0.1-rc.80";
494
494
 
495
495
  // src/utils/licenseCache.ts
496
496
  var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
@@ -1638,176 +1638,146 @@ var useEventHandlers = (videoRef, handlers) => {
1638
1638
  };
1639
1639
  };
1640
1640
 
1641
- // src/hooks/useLiveBadge.ts
1642
- var import_react8 = require("react");
1643
- var useLiveBadge = (playerRef, options = {}) => {
1644
- const [isLive, setIsLive] = (0, import_react8.useState)(false);
1645
- const [isVisible, setIsVisible] = (0, import_react8.useState)(false);
1646
- const [isNearLiveEdge, setIsNearLiveEdge] = (0, import_react8.useState)(false);
1647
- const intervalRef = (0, import_react8.useRef)(null);
1648
- const { enabled = true, onLiveStateChange, liveThresholdSeconds = 15 } = options;
1649
- const checkLiveStatus = () => {
1650
- if (!playerRef.current || !enabled) {
1651
- return;
1652
- }
1653
- try {
1654
- const player = playerRef.current;
1655
- if (!player.getManifest || !player.getPresentationTimeline || typeof player.getPresentationTimeline !== "function") {
1656
- return;
1657
- }
1658
- const manifest = player.getManifest();
1659
- if (!manifest) {
1660
- return;
1661
- }
1662
- const timeline = player.getPresentationTimeline();
1663
- if (!timeline || typeof timeline.isLive !== "function") {
1664
- return;
1665
- }
1666
- const liveStatus = timeline.isLive();
1667
- let nearLiveEdge = false;
1668
- if (liveStatus) {
1669
- try {
1670
- const seekRange = player.getSeekRange();
1671
- const videoElement = player.getMediaElement();
1672
- if (seekRange && videoElement) {
1673
- const liveEdge = seekRange.end;
1674
- const currentTime = videoElement.currentTime;
1675
- const timeBehindLive = liveEdge - currentTime;
1676
- nearLiveEdge = timeBehindLive <= liveThresholdSeconds;
1677
- }
1678
- } catch (error) {
1679
- console.error("Error checking live edge position:", error);
1680
- nearLiveEdge = liveStatus;
1681
- }
1682
- }
1683
- if (liveStatus !== isLive) {
1684
- setIsLive(liveStatus);
1685
- onLiveStateChange?.(liveStatus);
1686
- }
1687
- if (nearLiveEdge !== isNearLiveEdge) {
1688
- setIsNearLiveEdge(nearLiveEdge);
1689
- setIsVisible(nearLiveEdge);
1690
- }
1691
- } catch (error) {
1692
- if (error instanceof Error && !error.message.includes("not a function")) {
1693
- console.error("Error checking live status:", error);
1694
- }
1695
- }
1696
- };
1697
- (0, import_react8.useEffect)(() => {
1698
- if (!enabled) {
1699
- setIsLive(false);
1700
- setIsVisible(false);
1701
- setIsNearLiveEdge(false);
1702
- return;
1703
- }
1704
- checkLiveStatus();
1705
- intervalRef.current = setInterval(checkLiveStatus, 1e3);
1706
- return () => {
1707
- if (intervalRef.current) {
1708
- clearInterval(intervalRef.current);
1709
- intervalRef.current = null;
1710
- }
1711
- };
1712
- }, [enabled, playerRef.current, liveThresholdSeconds]);
1713
- (0, import_react8.useEffect)(() => {
1714
- return () => {
1715
- if (intervalRef.current) {
1716
- clearInterval(intervalRef.current);
1717
- }
1718
- };
1719
- }, []);
1720
- const hideBadge = () => setIsVisible(false);
1721
- const showBadge = () => setIsVisible(true);
1722
- return {
1723
- isLive,
1724
- isVisible,
1725
- isNearLiveEdge,
1726
- hideBadge,
1727
- showBadge,
1728
- checkLiveStatus
1729
- };
1730
- };
1731
-
1732
1641
  // src/hooks/usePosterFallback.ts
1733
- var import_react9 = require("react");
1642
+ var import_react8 = require("react");
1734
1643
 
1735
1644
  // src/hooks/useLiveIndicator.ts
1736
- var import_react10 = require("react");
1645
+ var import_react9 = require("react");
1737
1646
  var useLiveIndicator = (containerRef, playerRef, options = {}) => {
1738
- const observerRef = (0, import_react10.useRef)(null);
1739
- const intervalRef = (0, import_react10.useRef)(null);
1647
+ const observerRef = (0, import_react9.useRef)(null);
1648
+ const intervalRef = (0, import_react9.useRef)(null);
1649
+ const lastStatusRef = (0, import_react9.useRef)(null);
1740
1650
  const {
1741
1651
  enabled = true,
1742
1652
  indicatorColor = "#ff0000",
1743
1653
  indicatorSize = 8,
1744
1654
  showPulseAnimation = true,
1745
- liveThresholdSeconds = 15
1655
+ liveThresholdSeconds = 15,
1656
+ onLiveStatusChange
1746
1657
  } = options;
1747
- const isNearLiveEdge = (player) => {
1748
- if (!player) return false;
1658
+ const getLiveStatus = (player) => {
1659
+ if (!player) {
1660
+ return { isLive: false, isNearEdge: false };
1661
+ }
1749
1662
  try {
1750
- if (!player.getManifest || !player.getPresentationTimeline || typeof player.getPresentationTimeline !== "function") {
1751
- return false;
1663
+ if (!player.getManifest || typeof player.getManifest !== "function") {
1664
+ return { isLive: false, isNearEdge: false };
1752
1665
  }
1753
1666
  const manifest = player.getManifest();
1754
1667
  if (!manifest) {
1755
- return false;
1668
+ return { isLive: false, isNearEdge: false };
1756
1669
  }
1757
- const timeline = player.getPresentationTimeline();
1670
+ const timeline = manifest.presentationTimeline;
1758
1671
  if (!timeline || typeof timeline.isLive !== "function") {
1759
- return false;
1672
+ return { isLive: false, isNearEdge: false };
1673
+ }
1674
+ const isLiveStream = timeline.isLive();
1675
+ if (!isLiveStream) return { isLive: false, isNearEdge: false };
1676
+ const videoElement = player.getMediaElement?.();
1677
+ if (!videoElement) return { isLive: true, isNearEdge: false };
1678
+ const liveEdge = timeline.getSeekRangeEnd?.() ?? timeline.getSegmentAvailabilityEnd?.();
1679
+ if (liveEdge === void 0) return { isLive: true, isNearEdge: false };
1680
+ const currentTime = videoElement.currentTime;
1681
+ const timeBehindLive = liveEdge - currentTime;
1682
+ return {
1683
+ isLive: true,
1684
+ isNearEdge: timeBehindLive <= liveThresholdSeconds,
1685
+ liveEdge
1686
+ };
1687
+ } catch (error) {
1688
+ console.error("Error checking live status:", error);
1689
+ return { isLive: false, isNearEdge: false };
1690
+ }
1691
+ };
1692
+ const seekToLiveEdge = () => {
1693
+ const player = playerRef.current;
1694
+ if (!player) return;
1695
+ try {
1696
+ const manifest = player.getManifest();
1697
+ if (!manifest) return;
1698
+ const timeline = manifest.presentationTimeline;
1699
+ const liveEdge = timeline?.getSeekRangeEnd?.() ?? timeline?.getSegmentAvailabilityEnd?.();
1700
+ if (liveEdge !== void 0) {
1701
+ const videoElement = player.getMediaElement?.();
1702
+ if (videoElement) {
1703
+ videoElement.currentTime = liveEdge;
1704
+ }
1760
1705
  }
1761
- const liveStatus = timeline.isLive();
1762
- if (!liveStatus) return false;
1763
- const seekRange = player.getSeekRange();
1764
- const videoElement = player.getMediaElement();
1765
- if (seekRange && videoElement) {
1766
- const liveEdge = seekRange.end;
1767
- const currentTime = videoElement.currentTime;
1768
- const timeBehindLive = liveEdge - currentTime;
1769
- return timeBehindLive <= liveThresholdSeconds;
1770
- }
1771
- return false;
1772
1706
  } catch (error) {
1773
- console.error("Error checking live edge position in indicator:", error);
1774
- return false;
1707
+ console.error("Error seeking to live edge:", error);
1775
1708
  }
1776
1709
  };
1777
- (0, import_react10.useEffect)(() => {
1778
- if (!containerRef.current || !playerRef.current || !enabled) {
1710
+ (0, import_react9.useEffect)(() => {
1711
+ if (!containerRef.current || !enabled) {
1779
1712
  return;
1780
1713
  }
1781
- const addLiveIndicator = (currentTimeElement) => {
1782
- if (currentTimeElement.querySelector(".live-indicator-dot")) {
1714
+ const updateLiveIndicator = (currentTimeElement, status) => {
1715
+ const parent = currentTimeElement.parentElement;
1716
+ if (!parent) return;
1717
+ const existingContainer = parent.querySelector(".live-indicator-container");
1718
+ const isCurrentlyNearEdge = existingContainer?.getAttribute("data-near-edge") === "true";
1719
+ if (existingContainer && status.isNearEdge === isCurrentlyNearEdge) {
1783
1720
  return;
1784
1721
  }
1722
+ if (existingContainer) {
1723
+ existingContainer.remove();
1724
+ }
1725
+ const container = document.createElement("span");
1726
+ container.className = "live-indicator-container";
1727
+ container.setAttribute("data-near-edge", status.isNearEdge.toString());
1728
+ container.style.cssText = `
1729
+ display: inline-flex;
1730
+ align-items: center;
1731
+ width: 80px;
1732
+ ${!status.isNearEdge ? "cursor: pointer;" : ""}
1733
+ `;
1785
1734
  const indicator = document.createElement("span");
1786
1735
  indicator.className = "live-indicator-dot";
1787
1736
  indicator.style.cssText = `
1788
1737
  display: inline-block;
1789
1738
  width: ${indicatorSize}px;
1790
1739
  height: ${indicatorSize}px;
1791
- background-color: ${indicatorColor};
1740
+ background-color: ${status.isNearEdge ? indicatorColor : "#888888"};
1792
1741
  border-radius: 50%;
1793
1742
  margin-right: 6px;
1794
- vertical-align: middle;
1795
- ${showPulseAnimation ? "animation: pulse-live 2s infinite;" : ""}
1743
+ ${status.isNearEdge && showPulseAnimation ? "animation: pulse-live 2s infinite;" : ""}
1796
1744
  `;
1797
- currentTimeElement.insertBefore(indicator, currentTimeElement.firstChild);
1745
+ const liveText = document.createElement("span");
1746
+ liveText.className = "live-indicator-text";
1747
+ liveText.textContent = status.isNearEdge ? "LIVE" : "GO TO LIVE";
1748
+ container.appendChild(indicator);
1749
+ container.appendChild(liveText);
1750
+ if (!status.isNearEdge) {
1751
+ container.addEventListener("click", seekToLiveEdge);
1752
+ }
1753
+ if (status.isNearEdge) {
1754
+ parent.insertBefore(container, currentTimeElement);
1755
+ currentTimeElement.style.display = "none";
1756
+ } else {
1757
+ currentTimeElement.insertAdjacentElement("afterend", container);
1758
+ currentTimeElement.style.display = "";
1759
+ }
1798
1760
  };
1799
1761
  const removeLiveIndicator = (currentTimeElement) => {
1800
- const indicator = currentTimeElement.querySelector(".live-indicator-dot");
1801
- if (indicator) {
1802
- indicator.remove();
1762
+ const parent = currentTimeElement.parentElement;
1763
+ if (!parent) return;
1764
+ const container = parent.querySelector(".live-indicator-container");
1765
+ if (container) {
1766
+ container.remove();
1767
+ currentTimeElement.style.display = "";
1803
1768
  }
1804
1769
  };
1805
1770
  const checkForLiveContent = () => {
1806
1771
  const currentTimeElements = containerRef.current?.querySelectorAll(".shaka-current-time");
1772
+ const status = getLiveStatus(playerRef.current);
1773
+ const lastStatus = lastStatusRef.current;
1774
+ if (onLiveStatusChange && (!lastStatus || lastStatus.isLive !== status.isLive || lastStatus.isNearEdge !== status.isNearEdge)) {
1775
+ onLiveStatusChange(status);
1776
+ lastStatusRef.current = { isLive: status.isLive, isNearEdge: status.isNearEdge };
1777
+ }
1807
1778
  currentTimeElements?.forEach((element) => {
1808
- const textContent = element.textContent?.trim() || "";
1809
- if (textContent.toLowerCase().includes("live") && isNearLiveEdge(playerRef.current)) {
1810
- addLiveIndicator(element);
1779
+ if (status.isLive) {
1780
+ updateLiveIndicator(element, status);
1811
1781
  } else {
1812
1782
  removeLiveIndicator(element);
1813
1783
  }
@@ -1848,28 +1818,21 @@ var useLiveIndicator = (containerRef, playerRef, options = {}) => {
1848
1818
  clearInterval(intervalRef.current);
1849
1819
  }
1850
1820
  };
1851
- }, [containerRef, playerRef, enabled, indicatorColor, indicatorSize, showPulseAnimation, liveThresholdSeconds]);
1821
+ }, [containerRef, enabled, indicatorColor, indicatorSize, showPulseAnimation, liveThresholdSeconds]);
1852
1822
  return {
1853
- // Expose method to manually trigger check if needed
1854
- checkForLiveContent: () => {
1855
- const currentTimeElements = containerRef.current?.querySelectorAll(".shaka-current-time");
1856
- currentTimeElements?.forEach((element) => {
1857
- const textContent = element.textContent?.trim() || "";
1858
- if (textContent.toLowerCase().includes("live") && isNearLiveEdge(playerRef.current)) {
1859
- }
1860
- });
1861
- }
1823
+ seekToLiveEdge,
1824
+ getLiveStatus: () => getLiveStatus(playerRef.current)
1862
1825
  };
1863
1826
  };
1864
1827
 
1865
1828
  // src/hooks/useKeyboardControls.ts
1866
- var import_react11 = require("react");
1829
+ var import_react10 = require("react");
1867
1830
  var useKeyboardControls = (videoRef, options = {}) => {
1868
1831
  const { skipBack, skipForward, enabled = true } = options;
1869
- const isDesktop = (0, import_react11.useCallback)(() => {
1832
+ const isDesktop = (0, import_react10.useCallback)(() => {
1870
1833
  return window.innerWidth > 767 && !/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1871
1834
  }, []);
1872
- const handleKeydown = (0, import_react11.useCallback)((event) => {
1835
+ const handleKeydown = (0, import_react10.useCallback)((event) => {
1873
1836
  if (!enabled || !isDesktop() || !videoRef.current) return;
1874
1837
  const activeElement = document.activeElement;
1875
1838
  if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || activeElement.isContentEditable)) {
@@ -1895,7 +1858,7 @@ var useKeyboardControls = (videoRef, options = {}) => {
1895
1858
  break;
1896
1859
  }
1897
1860
  }, [enabled, videoRef, skipBack, skipForward, isDesktop]);
1898
- (0, import_react11.useEffect)(() => {
1861
+ (0, import_react10.useEffect)(() => {
1899
1862
  if (!enabled || !isDesktop()) return;
1900
1863
  document.addEventListener("keydown", handleKeydown);
1901
1864
  return () => {
@@ -1908,10 +1871,10 @@ var useKeyboardControls = (videoRef, options = {}) => {
1908
1871
  };
1909
1872
 
1910
1873
  // src/hooks/useAdEvents.ts
1911
- var import_react12 = require("react");
1874
+ var import_react11 = require("react");
1912
1875
  var useAdEvents = (playerRef, handlers) => {
1913
- const listenersRef = (0, import_react12.useRef)([]);
1914
- const setupAdEventListeners = (0, import_react12.useCallback)(() => {
1876
+ const listenersRef = (0, import_react11.useRef)([]);
1877
+ const setupAdEventListeners = (0, import_react11.useCallback)(() => {
1915
1878
  const player = playerRef.current;
1916
1879
  if (!player) return;
1917
1880
  const adManager = player.getAdManager();
@@ -2017,7 +1980,7 @@ var useAdEvents = (playerRef, handlers) => {
2017
1980
  console.warn("Error setting up ad event listeners:", error);
2018
1981
  }
2019
1982
  }, [playerRef, handlers]);
2020
- const cleanupAdEventListeners = (0, import_react12.useCallback)(() => {
1983
+ const cleanupAdEventListeners = (0, import_react11.useCallback)(() => {
2021
1984
  try {
2022
1985
  listenersRef.current.forEach((listenerGroup) => {
2023
1986
  if (listenerGroup.type === "shaka" && listenerGroup.player) {
@@ -2050,117 +2013,6 @@ var useAdEvents = (playerRef, handlers) => {
2050
2013
  };
2051
2014
  };
2052
2015
 
2053
- // src/components/Loading.tsx
2054
- var import_tailwind_merge = require("tailwind-merge");
2055
- var import_jsx_runtime4 = require("react/jsx-runtime");
2056
- var Loading = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2057
- "div",
2058
- {
2059
- className: (0, import_tailwind_merge.twMerge)(
2060
- "relative bg-[#151515] md:rounded-2xl! overflow-hidden aspect-video text-white w-full h-full flex justify-center items-center text-[10px]",
2061
- className
2062
- ),
2063
- role: "status",
2064
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: " flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2065
- "svg",
2066
- {
2067
- className: "shaka-spinner-svg animate-spin h-12 w-12",
2068
- viewBox: "0 0 64 64",
2069
- xmlns: "http://www.w3.org/2000/svg",
2070
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2071
- "circle",
2072
- {
2073
- className: "shaka-spinner-path",
2074
- cx: "32",
2075
- cy: "32",
2076
- r: "28",
2077
- strokeWidth: "4",
2078
- strokeLinecap: "round",
2079
- stroke: "currentColor",
2080
- fill: "none",
2081
- strokeDasharray: "176",
2082
- strokeDashoffset: "120"
2083
- }
2084
- )
2085
- }
2086
- ) })
2087
- }
2088
- );
2089
-
2090
- // src/components/ErrorScreen.tsx
2091
- var import_jsx_runtime5 = require("react/jsx-runtime");
2092
- var ErrorScreen = ({ title, description }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full h-full md:rounded-2xl! aspect-video bg-black flex", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "bg-[#151515] text-white w-full h-full flex justify-center items-center", children: [
2093
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2094
- "svg",
2095
- {
2096
- className: "w-24 h-24 m-6",
2097
- fill: "none",
2098
- stroke: "currentColor",
2099
- strokeWidth: "2",
2100
- style: { width: 96 },
2101
- viewBox: "0 0 24 24",
2102
- xmlns: "http://www.w3.org/2000/svg",
2103
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2104
- "path",
2105
- {
2106
- d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z",
2107
- strokeLinecap: "round",
2108
- strokeLinejoin: "round"
2109
- }
2110
- )
2111
- }
2112
- ),
2113
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
2114
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-2xl mb-2", children: title || "Playback Error" }),
2115
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-lg", children: description || "Unable to play the video. Please try again later." })
2116
- ] })
2117
- ] }) });
2118
-
2119
- // src/components/Title.tsx
2120
- var import_jsx_runtime6 = require("react/jsx-runtime");
2121
- var Title = ({ title }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "text-white text-xl font-semibold", children: title }) });
2122
-
2123
- // src/components/LiveBadge.tsx
2124
- var import_jsx_runtime7 = require("react/jsx-runtime");
2125
- var LiveBadge = ({
2126
- isVisible,
2127
- position = "top-right",
2128
- className = "",
2129
- style = {},
2130
- text = "LIVE"
2131
- }) => {
2132
- if (!isVisible) return null;
2133
- const positionClasses = {
2134
- "top-left": "top-4 left-4",
2135
- "top-right": "top-4 right-4",
2136
- "bottom-left": "bottom-4 left-4",
2137
- "bottom-right": "bottom-4 right-4"
2138
- };
2139
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2140
- "div",
2141
- {
2142
- className: `
2143
- absolute z-50
2144
- ${positionClasses[position]}
2145
- bg-red-600 text-white
2146
- px-2 py-1
2147
- rounded-md
2148
- text-xs font-bold
2149
- uppercase tracking-wide
2150
- shadow-lg
2151
- animate-pulse
2152
- pointer-events-none
2153
- ${className}
2154
- `,
2155
- style,
2156
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex items-center gap-1", children: [
2157
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w-2 h-2 bg-white rounded-full animate-pulse" }),
2158
- text
2159
- ] })
2160
- }
2161
- );
2162
- };
2163
-
2164
2016
  // src/Player.tsx
2165
2017
  var import_tailwind_merge2 = require("tailwind-merge");
2166
2018
 
@@ -2237,9 +2089,79 @@ async function waitForGlobals(globalNames, timeout = 5e3) {
2237
2089
  await Promise.all(promises);
2238
2090
  }
2239
2091
 
2092
+ // src/components/Loading.tsx
2093
+ var import_tailwind_merge = require("tailwind-merge");
2094
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2095
+ var Loading = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2096
+ "div",
2097
+ {
2098
+ className: (0, import_tailwind_merge.twMerge)(
2099
+ "relative bg-[#151515] md:rounded-2xl! overflow-hidden aspect-video text-white w-full h-full flex justify-center items-center text-[10px]",
2100
+ className
2101
+ ),
2102
+ role: "status",
2103
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: " flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2104
+ "svg",
2105
+ {
2106
+ className: "shaka-spinner-svg animate-spin h-12 w-12",
2107
+ viewBox: "0 0 64 64",
2108
+ xmlns: "http://www.w3.org/2000/svg",
2109
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2110
+ "circle",
2111
+ {
2112
+ className: "shaka-spinner-path",
2113
+ cx: "32",
2114
+ cy: "32",
2115
+ r: "28",
2116
+ strokeWidth: "4",
2117
+ strokeLinecap: "round",
2118
+ stroke: "currentColor",
2119
+ fill: "none",
2120
+ strokeDasharray: "176",
2121
+ strokeDashoffset: "120"
2122
+ }
2123
+ )
2124
+ }
2125
+ ) })
2126
+ }
2127
+ );
2128
+
2129
+ // src/components/ErrorScreen.tsx
2130
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2131
+ var ErrorScreen = ({ title, description }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full h-full md:rounded-2xl! aspect-video bg-black flex", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "bg-[#151515] text-white w-full h-full flex justify-center items-center", children: [
2132
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2133
+ "svg",
2134
+ {
2135
+ className: "w-24 h-24 m-6",
2136
+ fill: "none",
2137
+ stroke: "currentColor",
2138
+ strokeWidth: "2",
2139
+ style: { width: 96 },
2140
+ viewBox: "0 0 24 24",
2141
+ xmlns: "http://www.w3.org/2000/svg",
2142
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2143
+ "path",
2144
+ {
2145
+ d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z",
2146
+ strokeLinecap: "round",
2147
+ strokeLinejoin: "round"
2148
+ }
2149
+ )
2150
+ }
2151
+ ),
2152
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
2153
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-2xl mb-2", children: title || "Playback Error" }),
2154
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-lg", children: description || "Unable to play the video. Please try again later." })
2155
+ ] })
2156
+ ] }) });
2157
+
2158
+ // src/components/Title.tsx
2159
+ var import_jsx_runtime6 = require("react/jsx-runtime");
2160
+ var Title = ({ title }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "text-white text-xl font-semibold", children: title }) });
2161
+
2240
2162
  // src/Player.tsx
2241
- var import_jsx_runtime8 = require("react/jsx-runtime");
2242
- var Player = (0, import_react13.forwardRef)(
2163
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2164
+ var Player = (0, import_react12.forwardRef)(
2243
2165
  ({
2244
2166
  src,
2245
2167
  managedMode = false,
@@ -2263,17 +2185,18 @@ var Player = (0, import_react13.forwardRef)(
2263
2185
  events,
2264
2186
  locale = "en",
2265
2187
  containerClassName,
2188
+ liveThresholdSeconds = 15,
2266
2189
  publicKey,
2267
2190
  auth,
2268
2191
  ...videoProps
2269
2192
  }, ref) => {
2270
- const videoRef = (0, import_react13.useRef)(null);
2271
- const containerRef = (0, import_react13.useRef)(null);
2272
- const [isScriptsLoaded, setIsScriptsLoaded] = (0, import_react13.useState)(false);
2273
- const [isInitialLoading, setIsInitialLoading] = (0, import_react13.useState)(true);
2274
- const [bfResetKey, setBfResetKey] = (0, import_react13.useState)(0);
2193
+ const videoRef = (0, import_react12.useRef)(null);
2194
+ const containerRef = (0, import_react12.useRef)(null);
2195
+ const [isScriptsLoaded, setIsScriptsLoaded] = (0, import_react12.useState)(false);
2196
+ const [isInitialLoading, setIsInitialLoading] = (0, import_react12.useState)(true);
2197
+ const [bfResetKey, setBfResetKey] = (0, import_react12.useState)(0);
2275
2198
  const hasPlaylist = !!src && (typeof src === "string" || !!(src.url || src.drm?.widevine?.playlistUrl || src.drm?.playready?.playlistUrl || src.drm?.fairplay?.playlistUrl));
2276
- (0, import_react13.useImperativeHandle)(ref, () => videoRef.current, []);
2199
+ (0, import_react12.useImperativeHandle)(ref, () => videoRef.current, []);
2277
2200
  const { playerRef, initializePlayer, loadManifest, destroyPlayer, isRetrying } = useShakaPlayer({
2278
2201
  src,
2279
2202
  shakaConfig,
@@ -2331,19 +2254,13 @@ var Player = (0, import_react13.forwardRef)(
2331
2254
  iconSizes,
2332
2255
  locale
2333
2256
  );
2334
- const { isLive, isVisible: isLiveBadgeVisible } = useLiveBadge(playerRef, {
2335
- enabled: true,
2336
- liveThresholdSeconds: 15,
2337
- onLiveStateChange: (isLive2) => {
2338
- events?.onLiveStateChange?.(isLive2);
2339
- }
2340
- });
2341
- useLiveIndicator(containerRef, playerRef, {
2257
+ const { getLiveStatus, seekToLiveEdge } = useLiveIndicator(containerRef, playerRef, {
2342
2258
  enabled: true,
2343
2259
  indicatorColor: "#ff0000",
2344
2260
  indicatorSize: 8,
2345
2261
  showPulseAnimation: true,
2346
- liveThresholdSeconds: 15
2262
+ liveThresholdSeconds,
2263
+ onLiveStatusChange: events?.onLiveStatusChange
2347
2264
  });
2348
2265
  const { setupAdEventListeners, cleanupAdEventListeners } = useAdEvents(playerRef, {
2349
2266
  onAdStart: events?.onAdStart,
@@ -2355,7 +2272,7 @@ var Player = (0, import_react13.forwardRef)(
2355
2272
  onAdProgress: events?.onAdProgress,
2356
2273
  onAllAdsCompleted: events?.onAllAdsCompleted
2357
2274
  });
2358
- const initializeSystem73 = (0, import_react13.useCallback)((playerConfig) => {
2275
+ const initializeSystem73 = (0, import_react12.useCallback)((playerConfig) => {
2359
2276
  if (!system73Config?.apiKey || !window.S73ShakaPlayerWrapper) {
2360
2277
  return null;
2361
2278
  }
@@ -2375,7 +2292,7 @@ var Player = (0, import_react13.forwardRef)(
2375
2292
  return null;
2376
2293
  }
2377
2294
  }, [system73Config]);
2378
- const initializeAds = (0, import_react13.useCallback)(async () => {
2295
+ const initializeAds = (0, import_react12.useCallback)(async () => {
2379
2296
  if (!imaConfig?.adTagUrl || !playerRef.current || !videoRef.current || !uiRef.current) {
2380
2297
  return;
2381
2298
  }
@@ -2413,7 +2330,7 @@ var Player = (0, import_react13.forwardRef)(
2413
2330
  console.error("Error initializing ads:", error);
2414
2331
  }
2415
2332
  }, [imaConfig, autoPlay, setupAdEventListeners, loadManifest]);
2416
- (0, import_react13.useEffect)(() => {
2333
+ (0, import_react12.useEffect)(() => {
2417
2334
  const loadRequiredScripts = async () => {
2418
2335
  try {
2419
2336
  const scriptLoaders = getRequiredScriptLoaders(!!imaConfig?.adTagUrl, !!system73Config?.apiKey);
@@ -2436,7 +2353,7 @@ var Player = (0, import_react13.forwardRef)(
2436
2353
  };
2437
2354
  loadRequiredScripts();
2438
2355
  }, [imaConfig?.adTagUrl, system73Config?.apiKey]);
2439
- (0, import_react13.useEffect)(() => {
2356
+ (0, import_react12.useEffect)(() => {
2440
2357
  const onPageShow = (e) => {
2441
2358
  if (e && e.persisted) {
2442
2359
  setBfResetKey((k) => k + 1);
@@ -2445,7 +2362,7 @@ var Player = (0, import_react13.forwardRef)(
2445
2362
  window.addEventListener("pageshow", onPageShow);
2446
2363
  return () => window.removeEventListener("pageshow", onPageShow);
2447
2364
  }, []);
2448
- (0, import_react13.useEffect)(() => {
2365
+ (0, import_react12.useEffect)(() => {
2449
2366
  const video = videoRef.current;
2450
2367
  if (!video || !isScriptsLoaded) return;
2451
2368
  const initialize = async () => {
@@ -2504,7 +2421,7 @@ var Player = (0, import_react13.forwardRef)(
2504
2421
  destroyPlayer();
2505
2422
  };
2506
2423
  }, [managedMode ? hasPlaylist : src, isScriptsLoaded, bfResetKey, managedMode]);
2507
- (0, import_react13.useEffect)(() => {
2424
+ (0, import_react12.useEffect)(() => {
2508
2425
  const video = videoRef.current;
2509
2426
  if (!video) return;
2510
2427
  const onLoadStart = () => {
@@ -2525,7 +2442,7 @@ var Player = (0, import_react13.forwardRef)(
2525
2442
  video.removeEventListener("playing", onPlaying);
2526
2443
  };
2527
2444
  }, []);
2528
- (0, import_react13.useEffect)(() => {
2445
+ (0, import_react12.useEffect)(() => {
2529
2446
  const video = videoRef.current;
2530
2447
  if (!video) return;
2531
2448
  video.autoplay = autoPlay;
@@ -2533,7 +2450,7 @@ var Player = (0, import_react13.forwardRef)(
2533
2450
  video.controls = false;
2534
2451
  if (poster) video.poster = poster;
2535
2452
  }, [autoPlay, loop, muted, poster, imaConfig?.adTagUrl]);
2536
- (0, import_react13.useEffect)(() => {
2453
+ (0, import_react12.useEffect)(() => {
2537
2454
  const video = videoRef.current;
2538
2455
  if (!video) return;
2539
2456
  video.controls = false;
@@ -2557,7 +2474,7 @@ var Player = (0, import_react13.forwardRef)(
2557
2474
  observer.disconnect();
2558
2475
  };
2559
2476
  }, []);
2560
- (0, import_react13.useImperativeHandle)(ref, () => ({
2477
+ (0, import_react12.useImperativeHandle)(ref, () => ({
2561
2478
  ...videoRef.current,
2562
2479
  // Custom methods for quality control
2563
2480
  getAvailableQualities,
@@ -2567,10 +2484,13 @@ var Player = (0, import_react13.forwardRef)(
2567
2484
  skipForward,
2568
2485
  // Mux methods
2569
2486
  updateMuxData,
2487
+ // Live status methods
2488
+ getLiveStatus,
2489
+ seekToLiveEdge,
2570
2490
  // Access to underlying instances
2571
2491
  getPlayer: () => playerRef.current,
2572
2492
  getMuxMonitor: () => null
2573
- }), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
2493
+ }), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData, getLiveStatus, seekToLiveEdge]);
2574
2494
  const isResponsive = !width && !height;
2575
2495
  const containerClasses = (0, import_tailwind_merge2.twMerge)(containerClassName, "motto-video-container relative bg-[#111111] ");
2576
2496
  const containerStyle = isResponsive ? {
@@ -2580,14 +2500,14 @@ var Player = (0, import_react13.forwardRef)(
2580
2500
  const videoStyle = isResponsive ? {} : { width, height };
2581
2501
  const filteredVideoProps = { ...videoProps };
2582
2502
  delete filteredVideoProps.controls;
2583
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2503
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2584
2504
  "div",
2585
2505
  {
2586
2506
  ref: containerRef,
2587
2507
  className: containerClasses,
2588
2508
  style: containerStyle,
2589
2509
  children: [
2590
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2510
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2591
2511
  "video",
2592
2512
  {
2593
2513
  ref: videoRef,
@@ -2600,8 +2520,7 @@ var Player = (0, import_react13.forwardRef)(
2600
2520
  ...filteredVideoProps
2601
2521
  }
2602
2522
  ),
2603
- isInitialLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loading, { className: "bg-transparent" }) }),
2604
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LiveBadge, { isVisible: isLiveBadgeVisible })
2523
+ isInitialLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, { className: "bg-transparent" }) })
2605
2524
  ]
2606
2525
  }
2607
2526
  );
@@ -2610,7 +2529,7 @@ var Player = (0, import_react13.forwardRef)(
2610
2529
  Player.displayName = "Player";
2611
2530
 
2612
2531
  // src/Video.tsx
2613
- var import_react15 = require("react");
2532
+ var import_react14 = require("react");
2614
2533
  var import_tailwind_merge3 = require("tailwind-merge");
2615
2534
  var import_react_query = require("@tanstack/react-query");
2616
2535
 
@@ -2751,7 +2670,7 @@ var getErrorType = (error, video) => {
2751
2670
  };
2752
2671
 
2753
2672
  // src/messages/useMessages.tsx
2754
- var import_react14 = require("react");
2673
+ var import_react13 = require("react");
2755
2674
 
2756
2675
  // src/messages/en.json
2757
2676
  var en_default = {
@@ -3053,9 +2972,9 @@ var getBrowserLanguage = () => {
3053
2972
  return availableLanguages[language] ? language : "en";
3054
2973
  };
3055
2974
  var useMessages = (locale) => {
3056
- const [language, setLanguage] = (0, import_react14.useState)("en");
3057
- const [translations, setTranslations] = (0, import_react14.useState)(availableLanguages.en);
3058
- (0, import_react14.useEffect)(() => {
2975
+ const [language, setLanguage] = (0, import_react13.useState)("en");
2976
+ const [translations, setTranslations] = (0, import_react13.useState)(availableLanguages.en);
2977
+ (0, import_react13.useEffect)(() => {
3059
2978
  const lang = !!availableLanguages?.[locale] ? locale : getBrowserLanguage();
3060
2979
  ;
3061
2980
  setLanguage(lang);
@@ -3081,7 +3000,7 @@ var useMessages = (locale) => {
3081
3000
  var useMessages_default = useMessages;
3082
3001
 
3083
3002
  // src/Video.tsx
3084
- var import_jsx_runtime9 = require("react/jsx-runtime");
3003
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3085
3004
  var Video = ({
3086
3005
  videoId,
3087
3006
  publicKey,
@@ -3120,13 +3039,13 @@ var Video = ({
3120
3039
  const activePlaylist = findHLSPlaylist(video);
3121
3040
  const activePlaylistUrl = activePlaylist?.url ?? activePlaylist?.drm?.widevine?.playlistUrl ?? activePlaylist?.drm?.playready?.playlistUrl ?? activePlaylist?.drm?.fairplay?.playlistUrl;
3122
3041
  const activePlaylistHasUrl = !!activePlaylistUrl;
3123
- (0, import_react15.useEffect)(() => {
3042
+ (0, import_react14.useEffect)(() => {
3124
3043
  if (events?.onVideoData && video) {
3125
3044
  events.onVideoData(video);
3126
3045
  }
3127
3046
  }, [video, events]);
3128
3047
  if (isLoading || !providedVideoData && !video) {
3129
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Loading, {}) }) });
3048
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loading, {}) }) });
3130
3049
  }
3131
3050
  if (!isLoading && video && !activePlaylistHasUrl && events?.onEmptyPlaylists) {
3132
3051
  events.onEmptyPlaylists();
@@ -3139,8 +3058,8 @@ var Video = ({
3139
3058
  }
3140
3059
  const title = t(errorKey) || t("DEFAULT_ERROR");
3141
3060
  const description = t(`${errorKey}_DESCRIPTION`) || t("DEFAULT_ERROR_DESCRIPTION");
3142
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative w-full h-full", children: [
3143
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3061
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative w-full h-full", children: [
3062
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3144
3063
  ErrorScreen,
3145
3064
  {
3146
3065
  title,
@@ -3151,12 +3070,12 @@ var Video = ({
3151
3070
  ] }) });
3152
3071
  }
3153
3072
  if (!activePlaylist || !activePlaylistHasUrl) {
3154
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative w-full h-full bg-[#151515]", children: [
3155
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Title, { title: video?.name || "" }),
3073
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative w-full h-full bg-[#151515]", children: [
3074
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Title, { title: video?.name || "" }),
3156
3075
  children
3157
3076
  ] }) });
3158
3077
  }
3159
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3078
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_tailwind_merge3.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3160
3079
  Player,
3161
3080
  {
3162
3081
  ...props,
@@ -3175,10 +3094,10 @@ var Video = ({
3175
3094
  };
3176
3095
 
3177
3096
  // src/Event.tsx
3178
- var import_react16 = require("react");
3097
+ var import_react15 = require("react");
3179
3098
  var import_tailwind_merge4 = require("tailwind-merge");
3180
3099
  var import_react_query2 = require("@tanstack/react-query");
3181
- var import_jsx_runtime10 = require("react/jsx-runtime");
3100
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3182
3101
  var Event = ({
3183
3102
  publicKey,
3184
3103
  eventId,
@@ -3209,8 +3128,8 @@ var Event = ({
3209
3128
  retry: queryOptions.retry ?? 3,
3210
3129
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
3211
3130
  });
3212
- const [activePlaylist, setActivePlaylist] = (0, import_react16.useState)();
3213
- const [activeVideoId, setActiveVideoId] = (0, import_react16.useState)();
3131
+ const [activePlaylist, setActivePlaylist] = (0, import_react15.useState)();
3132
+ const [activeVideoId, setActiveVideoId] = (0, import_react15.useState)();
3214
3133
  const videoIds = eventData?.videoIds ?? [];
3215
3134
  const {
3216
3135
  data: videosData,
@@ -3226,8 +3145,8 @@ var Event = ({
3226
3145
  retry: queryOptions.retry ?? 3,
3227
3146
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
3228
3147
  });
3229
- const [loadingApisState, setLoadingApisState] = (0, import_react16.useState)(true);
3230
- (0, import_react16.useEffect)(() => {
3148
+ const [loadingApisState, setLoadingApisState] = (0, import_react15.useState)(true);
3149
+ (0, import_react15.useEffect)(() => {
3231
3150
  if (videosData !== void 0) {
3232
3151
  setLoadingApisState(false);
3233
3152
  const videosWithPlaylists = videosData.filter(
@@ -3261,12 +3180,12 @@ var Event = ({
3261
3180
  }
3262
3181
  }, [videosData, eventData]);
3263
3182
  const { t } = useMessages_default(locale);
3264
- (0, import_react16.useEffect)(() => {
3183
+ (0, import_react15.useEffect)(() => {
3265
3184
  if (events?.onEventData && eventData) {
3266
3185
  events.onEventData(eventData);
3267
3186
  }
3268
3187
  }, [eventData, events]);
3269
- (0, import_react16.useEffect)(() => {
3188
+ (0, import_react15.useEffect)(() => {
3270
3189
  if (events?.onVideoData && activeVideoId && videosData) {
3271
3190
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
3272
3191
  if (activeVideo) {
@@ -3274,10 +3193,10 @@ var Event = ({
3274
3193
  }
3275
3194
  }
3276
3195
  }, [activeVideoId, videosData, events]);
3277
- const [error, setError] = (0, import_react16.useState)(null);
3278
- const [loadingPlaylist, setLoadingPlaylist] = (0, import_react16.useState)(true);
3196
+ const [error, setError] = (0, import_react15.useState)(null);
3197
+ const [loadingPlaylist, setLoadingPlaylist] = (0, import_react15.useState)(true);
3279
3198
  const videosDataError = videosData?.some((video) => !!video.error);
3280
- (0, import_react16.useEffect)(() => {
3199
+ (0, import_react15.useEffect)(() => {
3281
3200
  if (isEventLoading || videosIsLoading || loadingApisState) {
3282
3201
  return;
3283
3202
  }
@@ -3303,7 +3222,7 @@ var Event = ({
3303
3222
  videosIsLoading,
3304
3223
  loadingApisState
3305
3224
  ]);
3306
- (0, import_react16.useEffect)(() => {
3225
+ (0, import_react15.useEffect)(() => {
3307
3226
  const eventLoadedWithNoVideos = !isEventLoading && eventData && eventData.videoIds && (!eventData.videoIds || eventData?.videoIds?.length === 0) && !loadingApisState;
3308
3227
  const allApisLoadedWithPotentialVideos = !isEventLoading && !videosIsLoading && eventData && !loadingApisState;
3309
3228
  if (eventLoadedWithNoVideos || allApisLoadedWithPotentialVideos) {
@@ -3313,7 +3232,7 @@ var Event = ({
3313
3232
  if (error) {
3314
3233
  const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
3315
3234
  const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
3316
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3235
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3317
3236
  ErrorScreen,
3318
3237
  {
3319
3238
  title,
@@ -3325,13 +3244,13 @@ var Event = ({
3325
3244
  events.onEmptyPlaylists();
3326
3245
  }
3327
3246
  if (loadingPlaylist) {
3328
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Loading, {}) }) });
3247
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Loading, {}) }) });
3329
3248
  }
3330
3249
  if (activePlaylist && activeVideoId && videosData) {
3331
3250
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
3332
3251
  console.log("activeVideo?.ad?.adTagUrl", activeVideo?.ad?.adTagUrl);
3333
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: [
3334
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3252
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: [
3253
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3335
3254
  Player,
3336
3255
  {
3337
3256
  ...props,
@@ -3346,7 +3265,7 @@ var Event = ({
3346
3265
  ...adsEnabled && activeVideo ? { imaConfig: { adTagUrl: activeVideo?.ad?.adTagUrl } } : {}
3347
3266
  }
3348
3267
  ) }),
3349
- !hideTitle && eventData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3268
+ !hideTitle && eventData && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3350
3269
  TitleAndDescription,
3351
3270
  {
3352
3271
  title: eventData.title,
@@ -3358,7 +3277,7 @@ var Event = ({
3358
3277
  ] });
3359
3278
  }
3360
3279
  if (eventData) {
3361
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3280
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3362
3281
  PreEvent,
3363
3282
  {
3364
3283
  event: eventData,
@@ -3380,12 +3299,12 @@ function PreEvent({
3380
3299
  }) {
3381
3300
  const date = new Date(event.startTime);
3382
3301
  const now = /* @__PURE__ */ new Date();
3383
- const [remainingTime, setRemainingTime] = (0, import_react16.useState)(
3302
+ const [remainingTime, setRemainingTime] = (0, import_react15.useState)(
3384
3303
  date.getTime() - now.getTime()
3385
3304
  );
3386
3305
  const shouldBeStarted = remainingTime < 0;
3387
3306
  const { t } = useMessages_default(locale);
3388
- (0, import_react16.useEffect)(() => {
3307
+ (0, import_react15.useEffect)(() => {
3389
3308
  const interval = setInterval(() => {
3390
3309
  if (remainingTime < 0) {
3391
3310
  clearInterval(interval);
@@ -3395,17 +3314,17 @@ function PreEvent({
3395
3314
  }, 1e3);
3396
3315
  return () => clearInterval(interval);
3397
3316
  }, [date, remainingTime]);
3398
- const renderCountdown = (0, import_react16.useCallback)(() => {
3317
+ const renderCountdown = (0, import_react15.useCallback)(() => {
3399
3318
  if (shouldBeStarted) {
3400
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
3319
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
3401
3320
  }
3402
3321
  const seconds = Math.floor(remainingTime / 1e3) % 60;
3403
3322
  const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
3404
3323
  const hours = Math.floor(remainingTime / 1e3 / 60 / 60) % 24;
3405
3324
  const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
3406
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-flow-col gap-1 md:gap-5 text-center auto-cols-max", children: [
3407
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3408
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3325
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-flow-col gap-1 md:gap-5 text-center auto-cols-max", children: [
3326
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3327
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3409
3328
  "span",
3410
3329
  {
3411
3330
  "aria-live": "polite",
@@ -3413,10 +3332,10 @@ function PreEvent({
3413
3332
  children: days.toString()
3414
3333
  }
3415
3334
  ) }),
3416
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
3335
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
3417
3336
  ] }),
3418
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3419
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3337
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3338
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3420
3339
  "span",
3421
3340
  {
3422
3341
  style: { "--value": hours },
@@ -3425,10 +3344,10 @@ function PreEvent({
3425
3344
  children: hours?.toString()?.padStart(2, "0")
3426
3345
  }
3427
3346
  ) }),
3428
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
3347
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
3429
3348
  ] }),
3430
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3431
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3349
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3350
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3432
3351
  "span",
3433
3352
  {
3434
3353
  style: { "--value": minutes },
@@ -3437,10 +3356,10 @@ function PreEvent({
3437
3356
  children: minutes?.toString()?.padStart(2, "0")
3438
3357
  }
3439
3358
  ) }),
3440
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
3359
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
3441
3360
  ] }),
3442
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3443
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3361
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3362
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3444
3363
  "span",
3445
3364
  {
3446
3365
  style: { "--value": seconds },
@@ -3449,12 +3368,12 @@ function PreEvent({
3449
3368
  children: seconds?.toString()?.padStart(2, "0")
3450
3369
  }
3451
3370
  ) }),
3452
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
3371
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
3453
3372
  ] })
3454
3373
  ] });
3455
3374
  }, [remainingTime, shouldBeStarted, t]);
3456
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: event?.posterUrl ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3457
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3375
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: event?.posterUrl ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3376
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3458
3377
  "div",
3459
3378
  {
3460
3379
  className: "relative overflow-hidden bg-base-200 aspect-video text-base-content w-full h-full flex justify-center items-center flex-col bg-no-repeat bg-cover md:rounded-2xl",
@@ -3463,10 +3382,10 @@ function PreEvent({
3463
3382
  backgroundRepeat: "no-repeat",
3464
3383
  backgroundSize: "cover"
3465
3384
  },
3466
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3385
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3467
3386
  }
3468
3387
  ),
3469
- !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3388
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3470
3389
  TitleAndDescription,
3471
3390
  {
3472
3391
  title: event.title,
@@ -3475,18 +3394,18 @@ function PreEvent({
3475
3394
  locale
3476
3395
  }
3477
3396
  )
3478
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3479
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3397
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3398
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3480
3399
  "div",
3481
3400
  {
3482
3401
  className: "relative overflow-hidden md:rounded-2xl bg-base-200 aspect-video text-base-content flex flex-col justify-center items-center w-full h-full bg-cover bg-center bg-no-repeat",
3483
3402
  style: {
3484
3403
  backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
3485
3404
  },
3486
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3405
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3487
3406
  }
3488
3407
  ),
3489
- !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3408
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3490
3409
  TitleAndDescription,
3491
3410
  {
3492
3411
  title: event.title,
@@ -3504,9 +3423,9 @@ var TitleAndDescription = ({
3504
3423
  locale = "en",
3505
3424
  className
3506
3425
  }) => {
3507
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
3508
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
3509
- startTime ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs md:text-base text-base-content/70 m-event-start-time", children: [
3426
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
3427
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
3428
+ startTime ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs md:text-base text-base-content/70 m-event-start-time", children: [
3510
3429
  new Date(startTime || "").toLocaleDateString(locale || "default", {
3511
3430
  month: "long",
3512
3431
  year: "numeric",
@@ -3519,15 +3438,15 @@ var TitleAndDescription = ({
3519
3438
  minute: "2-digit"
3520
3439
  })
3521
3440
  ] }) : null,
3522
- description && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-xs md:text-xs text-base-content/60 uppercase", children: description })
3441
+ description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-xs md:text-xs text-base-content/60 uppercase", children: description })
3523
3442
  ] });
3524
3443
  };
3525
3444
 
3526
3445
  // src/CreativeWork.tsx
3527
- var import_react17 = require("react");
3446
+ var import_react16 = require("react");
3528
3447
  var import_tailwind_merge5 = require("tailwind-merge");
3529
3448
  var import_react_query3 = require("@tanstack/react-query");
3530
- var import_jsx_runtime11 = require("react/jsx-runtime");
3449
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3531
3450
  var CreativeWork = ({
3532
3451
  publicKey,
3533
3452
  creativeWorkId,
@@ -3558,9 +3477,9 @@ var CreativeWork = ({
3558
3477
  retry: queryOptions.retry ?? 3,
3559
3478
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
3560
3479
  });
3561
- const [activePlaylist, setActivePlaylist] = (0, import_react17.useState)();
3562
- const [activeVideoId, setActiveVideoId] = (0, import_react17.useState)();
3563
- const [showCountDown, setShowCountDown] = (0, import_react17.useState)(false);
3480
+ const [activePlaylist, setActivePlaylist] = (0, import_react16.useState)();
3481
+ const [activeVideoId, setActiveVideoId] = (0, import_react16.useState)();
3482
+ const [showCountDown, setShowCountDown] = (0, import_react16.useState)(false);
3564
3483
  const videoIds = creativeWorkData?.videoIds ?? [];
3565
3484
  const {
3566
3485
  data: videosData,
@@ -3576,8 +3495,8 @@ var CreativeWork = ({
3576
3495
  retry: queryOptions.retry ?? 3,
3577
3496
  retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
3578
3497
  });
3579
- const [loadingApisState, setLoadingApisState] = (0, import_react17.useState)(true);
3580
- (0, import_react17.useEffect)(() => {
3498
+ const [loadingApisState, setLoadingApisState] = (0, import_react16.useState)(true);
3499
+ (0, import_react16.useEffect)(() => {
3581
3500
  if (videosData !== void 0) {
3582
3501
  setLoadingApisState(false);
3583
3502
  const videosWithPlaylists = videosData.filter(
@@ -3611,7 +3530,7 @@ var CreativeWork = ({
3611
3530
  }
3612
3531
  }, [videosData, creativeWorkData]);
3613
3532
  const { t } = useMessages_default(locale);
3614
- (0, import_react17.useEffect)(() => {
3533
+ (0, import_react16.useEffect)(() => {
3615
3534
  if (events?.onCreativeWorkData && creativeWorkData) {
3616
3535
  events.onCreativeWorkData(creativeWorkData);
3617
3536
  }
@@ -3619,7 +3538,7 @@ var CreativeWork = ({
3619
3538
  setShowCountDown(true);
3620
3539
  }
3621
3540
  }, [creativeWorkData, events]);
3622
- (0, import_react17.useEffect)(() => {
3541
+ (0, import_react16.useEffect)(() => {
3623
3542
  if (events?.onVideoData && activeVideoId && videosData) {
3624
3543
  const activeVideo = videosData.find((video) => video.id === activeVideoId);
3625
3544
  if (activeVideo) {
@@ -3627,9 +3546,9 @@ var CreativeWork = ({
3627
3546
  }
3628
3547
  }
3629
3548
  }, [activeVideoId, videosData, events]);
3630
- const [error, setError] = (0, import_react17.useState)(null);
3549
+ const [error, setError] = (0, import_react16.useState)(null);
3631
3550
  const videosDataError = videosData?.some((video) => !!video.error);
3632
- (0, import_react17.useEffect)(() => {
3551
+ (0, import_react16.useEffect)(() => {
3633
3552
  if (creativeWorkError || videosError || videosDataError) {
3634
3553
  const errorObj = creativeWorkError || videosError || videosData?.find((video) => !!video.error)?.error && new Error(videosData?.find((video) => !!video.error)?.error) || new Error("default");
3635
3554
  setError(errorObj);
@@ -3643,7 +3562,7 @@ var CreativeWork = ({
3643
3562
  if (error) {
3644
3563
  const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
3645
3564
  const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
3646
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3565
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3647
3566
  ErrorScreen,
3648
3567
  {
3649
3568
  title,
@@ -3651,8 +3570,8 @@ var CreativeWork = ({
3651
3570
  }
3652
3571
  ) }) });
3653
3572
  }
3654
- const [loadingPlaylist, setLoadingPlaylist] = (0, import_react17.useState)(true);
3655
- (0, import_react17.useEffect)(() => {
3573
+ const [loadingPlaylist, setLoadingPlaylist] = (0, import_react16.useState)(true);
3574
+ (0, import_react16.useEffect)(() => {
3656
3575
  const creativeWorkLoadedWithNoVideos = !isCreativeWorkLoading && creativeWorkData && creativeWorkData.videoIds && creativeWorkData.videoIds.length === 0;
3657
3576
  const creativeWorkLoadedWithNoData = !isCreativeWorkLoading && creativeWorkData && !creativeWorkData.videoIds;
3658
3577
  const isEventsFinished = !videosIsLoading && videosData && videosData.length > 0 && videosData.every((video) => video.playlists && video.playlists.length === 0);
@@ -3673,10 +3592,10 @@ var CreativeWork = ({
3673
3592
  events
3674
3593
  ]);
3675
3594
  if (isCreativeWorkLoading || videosIsLoading || loadingApisState) {
3676
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loading, {}) }) });
3595
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Loading, {}) }) });
3677
3596
  }
3678
3597
  if (showCountDown && creativeWorkData) {
3679
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3598
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3680
3599
  PreCreativeWork,
3681
3600
  {
3682
3601
  creativeWork: creativeWorkData,
@@ -3689,8 +3608,8 @@ var CreativeWork = ({
3689
3608
  }
3690
3609
  if (activeVideoId && activePlaylist && !loadingPlaylist) {
3691
3610
  const activeVideo = videosData?.find((video) => video.id === activeVideoId);
3692
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative w-full h-full", children: [
3693
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3611
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative w-full h-full", children: [
3612
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3694
3613
  Player,
3695
3614
  {
3696
3615
  ...props,
@@ -3707,7 +3626,7 @@ var CreativeWork = ({
3707
3626
  ...adsEnabled && activeVideo?.ad?.adTagUrl ? { imaConfig: { adTagUrl: activeVideo?.ad?.adTagUrl } } : {}
3708
3627
  }
3709
3628
  ),
3710
- !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3629
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3711
3630
  TitleAndDescription2,
3712
3631
  {
3713
3632
  title: creativeWorkData?.title || "",
@@ -3720,7 +3639,7 @@ var CreativeWork = ({
3720
3639
  ] }) });
3721
3640
  }
3722
3641
  if (loadingPlaylist) {
3723
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loading, {}) }) });
3642
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Loading, {}) }) });
3724
3643
  }
3725
3644
  return null;
3726
3645
  };
@@ -3733,12 +3652,12 @@ function PreCreativeWork({
3733
3652
  }) {
3734
3653
  const date = new Date(creativeWork.releaseTime);
3735
3654
  const now = /* @__PURE__ */ new Date();
3736
- const [remainingTime, setRemainingTime] = (0, import_react17.useState)(
3655
+ const [remainingTime, setRemainingTime] = (0, import_react16.useState)(
3737
3656
  date.getTime() - now.getTime()
3738
3657
  );
3739
3658
  const shouldBeStarted = remainingTime < 0;
3740
3659
  const { t } = useMessages_default(locale);
3741
- (0, import_react17.useEffect)(() => {
3660
+ (0, import_react16.useEffect)(() => {
3742
3661
  const interval = setInterval(() => {
3743
3662
  if (remainingTime < 0) {
3744
3663
  clearInterval(interval);
@@ -3752,15 +3671,15 @@ function PreCreativeWork({
3752
3671
  }, [date, remainingTime]);
3753
3672
  const renderCountdown = () => {
3754
3673
  if (shouldBeStarted) {
3755
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
3674
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
3756
3675
  }
3757
3676
  const seconds = Math.floor(remainingTime / 1e3) % 60;
3758
3677
  const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
3759
3678
  const hours = Math.floor(remainingTime / 1e3 / 60 / 60) % 24;
3760
3679
  const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
3761
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid grid-flow-col md:gap-5 gap-1 text-center auto-cols-max", children: [
3762
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3763
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3680
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-flow-col md:gap-5 gap-1 text-center auto-cols-max", children: [
3681
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3682
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3764
3683
  "span",
3765
3684
  {
3766
3685
  "aria-live": "polite",
@@ -3768,10 +3687,10 @@ function PreCreativeWork({
3768
3687
  children: days.toString()
3769
3688
  }
3770
3689
  ) }),
3771
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
3690
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
3772
3691
  ] }),
3773
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3774
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3692
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3693
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3775
3694
  "span",
3776
3695
  {
3777
3696
  style: { "--value": hours },
@@ -3780,10 +3699,10 @@ function PreCreativeWork({
3780
3699
  children: hours?.toString()?.padStart(2, "0")
3781
3700
  }
3782
3701
  ) }),
3783
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
3702
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
3784
3703
  ] }),
3785
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3786
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3704
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3705
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3787
3706
  "span",
3788
3707
  {
3789
3708
  style: { "--value": minutes },
@@ -3792,10 +3711,10 @@ function PreCreativeWork({
3792
3711
  children: minutes?.toString()?.padStart(2, "0")
3793
3712
  }
3794
3713
  ) }),
3795
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
3714
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
3796
3715
  ] }),
3797
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3798
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3716
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
3717
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3799
3718
  "span",
3800
3719
  {
3801
3720
  style: { "--value": seconds },
@@ -3804,12 +3723,12 @@ function PreCreativeWork({
3804
3723
  children: seconds?.toString()?.padStart(2, "0")
3805
3724
  }
3806
3725
  ) }),
3807
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
3726
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
3808
3727
  ] })
3809
3728
  ] });
3810
3729
  };
3811
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
3812
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3730
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3813
3732
  "div",
3814
3733
  {
3815
3734
  className: "relative overflow-hidden md:rounded-2xl bg-base-200 aspect-video text-base-content flex flex-col justify-center items-center w-full h-full bg-cover bg-center bg-no-repeat",
@@ -3817,12 +3736,12 @@ function PreCreativeWork({
3817
3736
  backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
3818
3737
  },
3819
3738
  children: [
3820
- backgroundImageUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
3821
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3739
+ backgroundImageUrl && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
3740
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative z-10", children: renderCountdown() })
3822
3741
  ]
3823
3742
  }
3824
3743
  ),
3825
- !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3744
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3826
3745
  TitleAndDescription2,
3827
3746
  {
3828
3747
  title: creativeWork.title,
@@ -3840,9 +3759,9 @@ var TitleAndDescription2 = ({
3840
3759
  locale = "en",
3841
3760
  className
3842
3761
  }) => {
3843
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_tailwind_merge5.twMerge)("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
3844
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
3845
- releaseTime ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "text-sm md:text-base text-base-content/70 m-event-start-time", children: [
3762
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_tailwind_merge5.twMerge)("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
3764
+ releaseTime ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-sm md:text-base text-base-content/70 m-event-start-time", children: [
3846
3765
  new Date(releaseTime || "").toLocaleDateString(locale || "default", {
3847
3766
  month: "long",
3848
3767
  year: "numeric",
@@ -3855,13 +3774,13 @@ var TitleAndDescription2 = ({
3855
3774
  minute: "2-digit"
3856
3775
  })
3857
3776
  ] }) : null,
3858
- description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
3777
+ description && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
3859
3778
  ] });
3860
3779
  };
3861
3780
 
3862
3781
  // src/QueryProvider.tsx
3863
3782
  var import_react_query4 = require("@tanstack/react-query");
3864
- var import_jsx_runtime12 = require("react/jsx-runtime");
3783
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3865
3784
  var queryClient = new import_react_query4.QueryClient({
3866
3785
  defaultOptions: {
3867
3786
  queries: {
@@ -3875,7 +3794,7 @@ var queryClient = new import_react_query4.QueryClient({
3875
3794
  }
3876
3795
  });
3877
3796
  var QueryProvider = ({ children }) => {
3878
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_query4.QueryClientProvider, { client: queryClient, children });
3797
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_query4.QueryClientProvider, { client: queryClient, children });
3879
3798
  };
3880
3799
  // Annotate the CommonJS export names for ESM import in node:
3881
3800
  0 && (module.exports = {