playron 1.0.38 → 1.0.39

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.
@@ -3,7 +3,7 @@
3
3
  0% { transform: rotate(0deg); }
4
4
  100% { transform: rotate(360deg); }
5
5
  }
6
- `})]})}function ar({children:a,zIndex:e=2e3,backgroundColor:t="rgba(0, 0, 0, 0.8)",onClick:r,style:n}){return i.jsx("div",{onClick:r,style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:e,backgroundColor:t,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",...n},children:a})}const lr="_overlay_3mfq6_3",cr="_iconContainer_3mfq6_17",dr="_loading_3mfq6_30",ur="_icon_3mfq6_17",hr="_customIcon_3mfq6_46",J={overlay:lr,iconContainer:cr,loading:dr,icon:ur,customIcon:hr};function pr({config:a,isAdLoading:e}){const t=O(L=>L.isPlaying),{togglePlay:r,toggleFullscreen:n,getPlayer:s}=U(),[o,l]=c.useState(!1),[d,u]=c.useState("play"),[h,p]=c.useState(!1),g=c.useRef(null);c.useEffect(()=>{console.log("[VideoOverlay] isAdLoading changed:",e),e?(console.log("[VideoOverlay] ✅ Showing ad loading icon"),p(!0),u("loading"),l(!0)):(console.log("[VideoOverlay] ❌ Hiding ad loading icon"),p(!1),l(!1))},[e]);const m=a?.ui?.showOverlayIcons!==!1,w=a?.ui?.showPlayPauseIcons!==!1,j=a?.ui?.overlayIcons?.playIcon,S=a?.ui?.overlayIcons?.pauseIcon,A=a?.ui?.overlayIcons?.iconSize||40,b=a?.ui?.overlayIcons?.containerSize||80;c.useEffect(()=>{const L=s();if(!L)return;const k=L.video||L.videoElement;if(!k)return;const R=()=>{p(!0),u("loading"),l(!0),g.current&&clearTimeout(g.current)},N=()=>{g.current=window.setTimeout(()=>{p(!1),l(!1)},300)},x=()=>{p(!0),u("loading"),l(!0)},C=()=>{h&&(g.current=window.setTimeout(()=>{p(!1),l(!1)},300))},I=()=>{h&&(g.current=window.setTimeout(()=>{p(!1),l(!1)},300))},$=()=>{p(!0),u("loading"),l(!0)};return k.addEventListener(E.SEEKING,R),k.addEventListener(E.SEEKED,N),k.addEventListener(E.WAITING,x),k.addEventListener(E.PLAYING,C),k.addEventListener(E.CAN_PLAY,I),k.addEventListener(E.LOAD_START,$),()=>{k.removeEventListener(E.SEEKING,R),k.removeEventListener(E.SEEKED,N),k.removeEventListener(E.WAITING,x),k.removeEventListener(E.PLAYING,C),k.removeEventListener(E.CAN_PLAY,I),k.removeEventListener(E.LOAD_START,$),g.current&&clearTimeout(g.current)}},[s,h]),c.useEffect(()=>{if(!h){u(t?"pause":"play"),l(!0);const L=setTimeout(()=>{l(!1)},600);return()=>clearTimeout(L)}},[t,h]);const y=c.useCallback(async()=>{await r()},[r]),q=c.useCallback(()=>{n()},[n]),z=L=>{const k=L==="play"?j:S;return k?/^https?:\/\//.test(k)||/\.(jpg|jpeg|png|svg|gif|webp)$/i.test(k)?i.jsx("img",{src:k,alt:L==="play"?"Play":"Pause",className:J.customIcon,style:{"--icon-size":`${A}px`}}):i.jsx("div",{dangerouslySetInnerHTML:{__html:k},className:J.customIcon,style:{"--icon-size":`${A}px`}}):L==="play"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:J.icon,style:{"--icon-size":`${A}px`},viewBox:"0 0 24 24",children:i.jsx("path",{fillRule:"evenodd",d:"M8.6 5.2A1 1 0 0 0 7 6v12a1 1 0 0 0 1.6.8l8-6a1 1 0 0 0 0-1.6l-8-6Z",clipRule:"evenodd"})}):i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:J.icon,style:{"--icon-size":`${A}px`},viewBox:"0 0 24 24",children:i.jsx("path",{fillRule:"evenodd",d:"M8 5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H8Zm7 0a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1Z",clipRule:"evenodd"})})};return i.jsxs(i.Fragment,{children:[e&&m&&i.jsx(ar,{children:i.jsx("div",{className:`${J.iconContainer} ${J.loading}`,style:{"--icon-container-size":`${b}px`,"--icon-size":`${A}px`},children:i.jsx(Ue,{size:A})})}),i.jsx("div",{className:`virtus-video-overlay ${J.overlay}`,onClick:y,onDoubleClick:q,children:m&&o&&!e&&(d==="loading"||w)&&i.jsx("div",{className:`${J.iconContainer} ${h?J.loading:""}`,style:{"--icon-container-size":`${b}px`,"--icon-size":`${A}px`},children:d==="loading"?i.jsx(Ue,{size:A}):z(d)})})]})}const gr=c.memo(pr);function pe(){const a=c.useContext(it);if(!a)throw new Error("usePlayer must be used within PlayerProvider");return a}const fr="_errorOverlay_4djr8_5",mr="_variant_drm_4djr8_19",yr="_variant_network_4djr8_23",vr="_variant_decode_4djr8_27",xr="_variant_generic_4djr8_31",br="_errorContent_4djr8_37",Er="_errorIcon_4djr8_51",wr="_iconPulse_4djr8_1",kr="_drmGlow_4djr8_1",Sr="_netGlow_4djr8_1",Ar="_errorTitle_4djr8_86",Cr="_errorMessage_4djr8_100",Tr="_errorHint_4djr8_109",Mr="_browserList_4djr8_117",Pr="_browserItem_4djr8_126",Lr="_errorCode_4djr8_142",jr="_retryButton_4djr8_152",Q={errorOverlay:fr,variant_drm:mr,variant_network:yr,variant_decode:vr,variant_generic:xr,errorContent:br,errorIcon:Er,iconPulse:wr,drmGlow:kr,netGlow:Sr,errorTitle:Ar,errorMessage:Cr,errorHint:Tr,browserList:Mr,browserItem:Pr,errorCode:Lr,retryButton:jr};function Rr(a,e){const t=a.code.toUpperCase(),r=(a.message??"").toUpperCase();if(t.startsWith("DRM_")||t.includes("LICENSE")||t.includes("ENCRYPTED")||t.includes("KEY_SYSTEM")||t.includes("KEYSYSTEM")||r.includes("DRM")||r.includes("LICENSE")||r.includes("ENCRYPTED")){if(e){if(e.fairplay&&!e.widevine&&!e.playready)return"drm_fairplay_needed";if(!e.widevine&&!e.fairplay&&!e.playready)return"drm_browser_unsupported"}return t.includes("LICENSE")||t==="DRM_LICENSE_FAILED"||t==="LICENSE_REQUEST_FAILED"?"drm_license_failed":"drm_generic"}return t.includes("MEDIA_ERR_NETWORK")||t.includes("NETWORK")||t.includes("FETCH")?"network":t.includes("MEDIA_ERR_DECODE")||t.includes("DECODE")||t.includes("CODEC")||t.includes("MEDIA_ERR_SRC_NOT_SUPPORTED")?"decode":"generic"}function Oe(a,e){if(!a?.enabled)return null;const t=!!a.widevine,r=!!a.playready,n=!!a.fairplay;return t&&!e.widevine||r&&!e.playready&&!t?e.fairplay?"drm_fairplay_needed":"drm_browser_unsupported":n&&!e.fairplay&&!t?"drm_browser_unsupported":null}function Dr(a){switch(a){case"drm_fairplay_needed":return{icon:"🔒",title:"DRM Protected Content",message:"This content is protected with Widevine DRM. Your browser (Safari) does not support this DRM system.",hint:"Please use one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_browser_unsupported":return{icon:"🔒",title:"DRM Not Supported",message:"Your browser does not support the DRM system required to play this protected content.",hint:"Please try one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_license_failed":return{icon:"🔐",title:"License Verification Failed",message:"A license could not be obtained for this content. Please check your connection and try again.",showRetry:!0,variant:"drm"};case"drm_generic":return{icon:"🔒",title:"Content Protection Error",message:"A DRM error occurred while trying to play this content. Please try again.",showRetry:!0,variant:"drm"};case"network":return{icon:"📡",title:"Connection Error",message:"A network error occurred while loading the video. Please check your internet connection and try again.",showRetry:!0,variant:"network"};case"decode":return{icon:"⚙️",title:"Format Not Supported",message:"This video format or codec is not supported by your browser.",showRetry:!1,variant:"decode"};default:return{icon:"⚠️",title:"Playback Error",message:"An error occurred while playing the video. Please try again.",showRetry:!0,variant:"generic"}}}const Ir=12e3;function _r({onRetry:a,drmConfig:e}){const t=pe(),[r,n]=c.useState(null),[s,o]=c.useState(null),l=c.useRef(null),d=c.useRef(null);d.current=r,c.useEffect(()=>{et().then(g=>{o(g);const m=Oe(e,g);m&&n({type:m,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})}).catch(()=>o(null))},[]),c.useEffect(()=>{if(!s||!e?.enabled)return;const g=Oe(e,s);g&&!d.current&&n({type:g,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})},[e,s]),c.useEffect(()=>{if(!t||!e?.enabled)return;const g=t.getVideoElement();if(!g)return;const m=()=>{g.currentTime>.5||(l.current=setTimeout(()=>{if(d.current)return;const j=s,S=j?j.fairplay&&!j.widevine&&!j.playready?"drm_fairplay_needed":!j.widevine&&!j.fairplay&&!j.playready?"drm_browser_unsupported":"drm_generic":"drm_generic";n({type:S,code:"DRM_TIMEOUT",rawMessage:"Playback stalled — possible DRM or network issue.",persistent:!0})},Ir))},w=()=>{l.current&&(clearTimeout(l.current),l.current=null)};return g.addEventListener("waiting",m),g.addEventListener("playing",w),g.addEventListener("timeupdate",w),()=>{g.removeEventListener("waiting",m),g.removeEventListener("playing",w),g.removeEventListener("timeupdate",w),w()}},[t,e,s]),c.useEffect(()=>{if(!t)return;const g=m=>{console.error("[ErrorOverlay] Player error:",m);const w=Rr(m,s);n({type:w,code:m.code,rawMessage:m.message??"Unknown error"})};return t.events.on("error",g),()=>{t.events.off("error",g)}},[t,s]),c.useEffect(()=>{if(!t)return;const g=()=>n(m=>m?.persistent?m:null);return t.events.on("play",g),t.events.on("loadedmetadata",g),()=>{t.events.off("play",g),t.events.off("loadedmetadata",g)}},[t]);const u=c.useCallback(()=>{if(n(null),a){a();return}if(t){const g=t.getVideoElement();if(g?.src){const m=g.src;g.src="",g.load(),setTimeout(()=>{g&&(g.src=m,g.load())},100)}}},[t,a]);if(!r)return null;const h=Dr(r.type),p=Q[`variant_${h.variant}`]??"";return i.jsx("div",{className:`${Q.errorOverlay} ${p}`,children:i.jsxs("div",{className:Q.errorContent,children:[i.jsx("div",{className:Q.errorIcon,children:h.icon}),i.jsx("h3",{className:Q.errorTitle,children:h.title}),i.jsx("p",{className:Q.errorMessage,children:h.message}),h.hint&&i.jsx("p",{className:Q.errorHint,children:h.hint}),h.browsers&&i.jsx("ul",{className:Q.browserList,children:h.browsers.map(g=>i.jsx("li",{className:Q.browserItem,children:g},g))}),r.code&&h.variant!=="drm"&&i.jsx("p",{className:Q.errorCode,children:r.code}),h.showRetry&&i.jsx("button",{onClick:u,className:Q.retryButton,children:"↻ Try Again"})]})})}const ee={play:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"5 3 19 12 5 21 5 3"}),i.jsx("line",{x1:"19",y1:"3",x2:"19",y2:"21"}),i.jsx("line",{x1:"5",y1:"3",x2:"5",y2:"21"})]}),rewind:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),i.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]}),forward:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),i.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]}),volUp:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),i.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),volDown:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),i.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),mute:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),i.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),fullscreen:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}),shortcuts:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),i.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),close:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),i.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},Vr=[{key:"Space / K",description:"Play / Pause",icon:ee.play},{key:"←",description:"Rewind 10 seconds",icon:ee.rewind},{key:"→",description:"Forward 10 seconds",icon:ee.forward},{key:"↑",description:"Volume up 10%",icon:ee.volUp},{key:"↓",description:"Volume down 10%",icon:ee.volDown},{key:"M",description:"Mute / Unmute",icon:ee.mute},{key:"F",description:"Toggle fullscreen",icon:ee.fullscreen},{key:"?",description:"Show keyboard shortcuts",icon:ee.shortcuts},{key:"Esc",description:"Close overlays",icon:ee.close}];function lt({isOpen:a,onClose:e}){const t=c.useCallback(r=>{r.key==="Escape"&&e()},[e]);return c.useEffect(()=>{if(a)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a,t]),a?i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",onClick:e,style:{position:"absolute",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)"},children:[i.jsxs("div",{onClick:r=>r.stopPropagation(),style:{background:"rgba(12, 12, 20, 0.97)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"14px",boxShadow:"0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08)",width:"320px",fontFamily:"system-ui, -apple-system, sans-serif",animation:"kbdFadeIn 0.18s ease-out",overflow:"hidden",backdropFilter:"blur(16px)"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"11px 14px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#fff",fontSize:"13px",fontWeight:600},children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),i.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Keyboard Shortcuts"]}),i.jsx("button",{"aria-label":"Close",onClick:e,style:{background:"rgba(255,255,255,0.08)",border:"none",borderRadius:"6px",color:"rgba(255,255,255,0.6)",cursor:"pointer",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},onMouseEnter:r=>r.currentTarget.style.background="rgba(255,255,255,0.15)",onMouseLeave:r=>r.currentTarget.style.background="rgba(255,255,255,0.08)",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsx("div",{style:{padding:"4px 0"},children:Vr.map(({key:r,description:n,icon:s})=>i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"9px 14px",gap:"10px",transition:"background 0.12s"},onMouseEnter:o=>o.currentTarget.style.background="rgba(255,255,255,0.05)",onMouseLeave:o=>o.currentTarget.style.background="transparent",children:[i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"rgba(255,255,255,0.65)"},children:s}),i.jsx("span",{style:{color:"rgba(255,255,255,0.7)",fontSize:"13.5px"},children:n})]}),i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"6px",color:"rgba(255,255,255,0.75)",fontFamily:"ui-monospace, SF Mono, monospace",fontSize:"11.5px",fontWeight:600,padding:"3px 9px",whiteSpace:"nowrap",flexShrink:0},children:r})]},r))}),i.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.07)",fontSize:"11px",color:"rgba(255,255,255,0.28)",textAlign:"center"},children:["Press"," ",i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"?"})," ","or"," ",i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"Esc"})," ","to dismiss"]})]}),i.jsx("style",{children:`
6
+ `})]})}function ar({children:a,zIndex:e=2e3,backgroundColor:t="rgba(0, 0, 0, 0.8)",onClick:r,style:n}){return i.jsx("div",{onClick:r,style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:e,backgroundColor:t,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",...n},children:a})}const lr="_overlay_3mfq6_3",cr="_iconContainer_3mfq6_17",dr="_loading_3mfq6_30",ur="_icon_3mfq6_17",hr="_customIcon_3mfq6_46",J={overlay:lr,iconContainer:cr,loading:dr,icon:ur,customIcon:hr};function pr({config:a,isAdLoading:e}){const t=O(j=>j.isPlaying),{togglePlay:r,toggleFullscreen:n,getPlayer:s}=U(),[o,l]=c.useState(!1),[d,u]=c.useState("play"),[h,p]=c.useState(!1),g=c.useRef(null);c.useEffect(()=>{console.log("[VideoOverlay] isAdLoading changed:",e),e?(console.log("[VideoOverlay] ✅ Showing ad loading icon"),p(!0),u("loading"),l(!0)):(console.log("[VideoOverlay] ❌ Hiding ad loading icon"),p(!1),l(!1))},[e]);const m=a?.ui?.showOverlayIcons!==!1,w=a?.ui?.showPlayPauseIcons!==!1,P=a?.ui?.overlayIcons?.playIcon,S=a?.ui?.overlayIcons?.pauseIcon,A=a?.ui?.overlayIcons?.iconSize||40,b=a?.ui?.overlayIcons?.containerSize||80;c.useEffect(()=>{const j=s();if(!j)return;const k=j.video||j.videoElement;if(!k)return;const R=()=>{p(!0),u("loading"),l(!0),g.current&&clearTimeout(g.current)},N=()=>{g.current=window.setTimeout(()=>{p(!1),l(!1)},300)},x=()=>{p(!0),u("loading"),l(!0)},C=()=>{h&&(g.current=window.setTimeout(()=>{p(!1),l(!1)},300))},I=()=>{h&&(g.current=window.setTimeout(()=>{p(!1),l(!1)},300))},$=()=>{p(!0),u("loading"),l(!0)};return k.addEventListener(E.SEEKING,R),k.addEventListener(E.SEEKED,N),k.addEventListener(E.WAITING,x),k.addEventListener(E.PLAYING,C),k.addEventListener(E.CAN_PLAY,I),k.addEventListener(E.LOAD_START,$),()=>{k.removeEventListener(E.SEEKING,R),k.removeEventListener(E.SEEKED,N),k.removeEventListener(E.WAITING,x),k.removeEventListener(E.PLAYING,C),k.removeEventListener(E.CAN_PLAY,I),k.removeEventListener(E.LOAD_START,$),g.current&&clearTimeout(g.current)}},[s,h]),c.useEffect(()=>{if(!h){u(t?"pause":"play"),l(!0);const j=setTimeout(()=>{l(!1)},600);return()=>clearTimeout(j)}},[t,h]);const y=c.useCallback(async()=>{await r()},[r]),q=c.useCallback(()=>{n()},[n]),z=j=>{const k=j==="play"?P:S;return k?/^https?:\/\//.test(k)||/\.(jpg|jpeg|png|svg|gif|webp)$/i.test(k)?i.jsx("img",{src:k,alt:j==="play"?"Play":"Pause",className:J.customIcon,style:{"--icon-size":`${A}px`}}):i.jsx("div",{dangerouslySetInnerHTML:{__html:k},className:J.customIcon,style:{"--icon-size":`${A}px`}}):j==="play"?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:J.icon,style:{"--icon-size":`${A}px`},viewBox:"0 0 24 24",children:i.jsx("path",{fillRule:"evenodd",d:"M8.6 5.2A1 1 0 0 0 7 6v12a1 1 0 0 0 1.6.8l8-6a1 1 0 0 0 0-1.6l-8-6Z",clipRule:"evenodd"})}):i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:J.icon,style:{"--icon-size":`${A}px`},viewBox:"0 0 24 24",children:i.jsx("path",{fillRule:"evenodd",d:"M8 5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H8Zm7 0a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1Z",clipRule:"evenodd"})})};return i.jsxs(i.Fragment,{children:[e&&m&&i.jsx(ar,{children:i.jsx("div",{className:`${J.iconContainer} ${J.loading}`,style:{"--icon-container-size":`${b}px`,"--icon-size":`${A}px`},children:i.jsx(Ue,{size:A})})}),i.jsx("div",{className:`virtus-video-overlay ${J.overlay}`,onClick:y,onDoubleClick:q,children:m&&o&&!e&&(d==="loading"||w)&&i.jsx("div",{className:`${J.iconContainer} ${h?J.loading:""}`,style:{"--icon-container-size":`${b}px`,"--icon-size":`${A}px`},children:d==="loading"?i.jsx(Ue,{size:A}):z(d)})})]})}const gr=c.memo(pr);function pe(){const a=c.useContext(it);if(!a)throw new Error("usePlayer must be used within PlayerProvider");return a}const fr="_errorOverlay_4djr8_5",mr="_variant_drm_4djr8_19",yr="_variant_network_4djr8_23",vr="_variant_decode_4djr8_27",xr="_variant_generic_4djr8_31",br="_errorContent_4djr8_37",Er="_errorIcon_4djr8_51",wr="_iconPulse_4djr8_1",kr="_drmGlow_4djr8_1",Sr="_netGlow_4djr8_1",Ar="_errorTitle_4djr8_86",Cr="_errorMessage_4djr8_100",Tr="_errorHint_4djr8_109",Mr="_browserList_4djr8_117",Pr="_browserItem_4djr8_126",Lr="_errorCode_4djr8_142",jr="_retryButton_4djr8_152",Q={errorOverlay:fr,variant_drm:mr,variant_network:yr,variant_decode:vr,variant_generic:xr,errorContent:br,errorIcon:Er,iconPulse:wr,drmGlow:kr,netGlow:Sr,errorTitle:Ar,errorMessage:Cr,errorHint:Tr,browserList:Mr,browserItem:Pr,errorCode:Lr,retryButton:jr};function Rr(a,e){const t=a.code.toUpperCase(),r=(a.message??"").toUpperCase();if(t.startsWith("DRM_")||t.includes("LICENSE")||t.includes("ENCRYPTED")||t.includes("KEY_SYSTEM")||t.includes("KEYSYSTEM")||r.includes("DRM")||r.includes("LICENSE")||r.includes("ENCRYPTED")){if(e){if(e.fairplay&&!e.widevine&&!e.playready)return"drm_fairplay_needed";if(!e.widevine&&!e.fairplay&&!e.playready)return"drm_browser_unsupported"}return t.includes("LICENSE")||t==="DRM_LICENSE_FAILED"||t==="LICENSE_REQUEST_FAILED"?"drm_license_failed":"drm_generic"}return t.includes("MEDIA_ERR_NETWORK")||t.includes("NETWORK")||t.includes("FETCH")?"network":t.includes("MEDIA_ERR_DECODE")||t.includes("DECODE")||t.includes("CODEC")||t.includes("MEDIA_ERR_SRC_NOT_SUPPORTED")?"decode":"generic"}function Oe(a,e){if(!a?.enabled)return null;const t=!!a.widevine,r=!!a.playready,n=!!a.fairplay;return t&&!e.widevine||r&&!e.playready&&!t?e.fairplay?"drm_fairplay_needed":"drm_browser_unsupported":n&&!e.fairplay&&!t?"drm_browser_unsupported":null}function Dr(a){switch(a){case"drm_fairplay_needed":return{icon:"🔒",title:"DRM Protected Content",message:"This content is protected with Widevine DRM. Your browser (Safari) does not support this DRM system.",hint:"Please use one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_browser_unsupported":return{icon:"🔒",title:"DRM Not Supported",message:"Your browser does not support the DRM system required to play this protected content.",hint:"Please try one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_license_failed":return{icon:"🔐",title:"License Verification Failed",message:"A license could not be obtained for this content. Please check your connection and try again.",showRetry:!0,variant:"drm"};case"drm_generic":return{icon:"🔒",title:"Content Protection Error",message:"A DRM error occurred while trying to play this content. Please try again.",showRetry:!0,variant:"drm"};case"network":return{icon:"📡",title:"Connection Error",message:"A network error occurred while loading the video. Please check your internet connection and try again.",showRetry:!0,variant:"network"};case"decode":return{icon:"⚙️",title:"Format Not Supported",message:"This video format or codec is not supported by your browser.",showRetry:!1,variant:"decode"};default:return{icon:"⚠️",title:"Playback Error",message:"An error occurred while playing the video. Please try again.",showRetry:!0,variant:"generic"}}}const Ir=12e3;function _r({onRetry:a,drmConfig:e}){const t=pe(),[r,n]=c.useState(null),[s,o]=c.useState(null),l=c.useRef(null),d=c.useRef(null);d.current=r,c.useEffect(()=>{et().then(g=>{o(g);const m=Oe(e,g);m&&n({type:m,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})}).catch(()=>o(null))},[]),c.useEffect(()=>{if(!s||!e?.enabled)return;const g=Oe(e,s);g&&!d.current&&n({type:g,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})},[e,s]),c.useEffect(()=>{if(!t||!e?.enabled)return;const g=t.getVideoElement();if(!g)return;const m=()=>{g.currentTime>.5||(l.current=setTimeout(()=>{if(d.current)return;const P=s,S=P?P.fairplay&&!P.widevine&&!P.playready?"drm_fairplay_needed":!P.widevine&&!P.fairplay&&!P.playready?"drm_browser_unsupported":"drm_generic":"drm_generic";n({type:S,code:"DRM_TIMEOUT",rawMessage:"Playback stalled — possible DRM or network issue.",persistent:!0})},Ir))},w=()=>{l.current&&(clearTimeout(l.current),l.current=null)};return g.addEventListener("waiting",m),g.addEventListener("playing",w),g.addEventListener("timeupdate",w),()=>{g.removeEventListener("waiting",m),g.removeEventListener("playing",w),g.removeEventListener("timeupdate",w),w()}},[t,e,s]),c.useEffect(()=>{if(!t)return;const g=m=>{console.error("[ErrorOverlay] Player error:",m);const w=Rr(m,s);n({type:w,code:m.code,rawMessage:m.message??"Unknown error"})};return t.events.on("error",g),()=>{t.events.off("error",g)}},[t,s]),c.useEffect(()=>{if(!t)return;const g=()=>n(m=>m?.persistent?m:null);return t.events.on("play",g),t.events.on("loadedmetadata",g),()=>{t.events.off("play",g),t.events.off("loadedmetadata",g)}},[t]);const u=c.useCallback(()=>{if(n(null),a){a();return}if(t){const g=t.getVideoElement();if(g?.src){const m=g.src;g.src="",g.load(),setTimeout(()=>{g&&(g.src=m,g.load())},100)}}},[t,a]);if(!r)return null;const h=Dr(r.type),p=Q[`variant_${h.variant}`]??"";return i.jsx("div",{className:`${Q.errorOverlay} ${p}`,children:i.jsxs("div",{className:Q.errorContent,children:[i.jsx("div",{className:Q.errorIcon,children:h.icon}),i.jsx("h3",{className:Q.errorTitle,children:h.title}),i.jsx("p",{className:Q.errorMessage,children:h.message}),h.hint&&i.jsx("p",{className:Q.errorHint,children:h.hint}),h.browsers&&i.jsx("ul",{className:Q.browserList,children:h.browsers.map(g=>i.jsx("li",{className:Q.browserItem,children:g},g))}),r.code&&h.variant!=="drm"&&i.jsx("p",{className:Q.errorCode,children:r.code}),h.showRetry&&i.jsx("button",{onClick:u,className:Q.retryButton,children:"↻ Try Again"})]})})}const ee={play:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"5 3 19 12 5 21 5 3"}),i.jsx("line",{x1:"19",y1:"3",x2:"19",y2:"21"}),i.jsx("line",{x1:"5",y1:"3",x2:"5",y2:"21"})]}),rewind:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),i.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]}),forward:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),i.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]}),volUp:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),i.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),volDown:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),i.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),mute:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),i.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),i.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),fullscreen:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}),shortcuts:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),i.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),close:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),i.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},Vr=[{key:"Space / K",description:"Play / Pause",icon:ee.play},{key:"←",description:"Rewind 10 seconds",icon:ee.rewind},{key:"→",description:"Forward 10 seconds",icon:ee.forward},{key:"↑",description:"Volume up 10%",icon:ee.volUp},{key:"↓",description:"Volume down 10%",icon:ee.volDown},{key:"M",description:"Mute / Unmute",icon:ee.mute},{key:"F",description:"Toggle fullscreen",icon:ee.fullscreen},{key:"?",description:"Show keyboard shortcuts",icon:ee.shortcuts},{key:"Esc",description:"Close overlays",icon:ee.close}];function lt({isOpen:a,onClose:e}){const t=c.useCallback(r=>{r.key==="Escape"&&e()},[e]);return c.useEffect(()=>{if(a)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a,t]),a?i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",onClick:e,style:{position:"absolute",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)"},children:[i.jsxs("div",{onClick:r=>r.stopPropagation(),style:{background:"rgba(12, 12, 20, 0.97)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"14px",boxShadow:"0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08)",width:"320px",fontFamily:"system-ui, -apple-system, sans-serif",animation:"kbdFadeIn 0.18s ease-out",overflow:"hidden",backdropFilter:"blur(16px)"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"11px 14px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#fff",fontSize:"13px",fontWeight:600},children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),i.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Keyboard Shortcuts"]}),i.jsx("button",{"aria-label":"Close",onClick:e,style:{background:"rgba(255,255,255,0.08)",border:"none",borderRadius:"6px",color:"rgba(255,255,255,0.6)",cursor:"pointer",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},onMouseEnter:r=>r.currentTarget.style.background="rgba(255,255,255,0.15)",onMouseLeave:r=>r.currentTarget.style.background="rgba(255,255,255,0.08)",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsx("div",{style:{padding:"4px 0"},children:Vr.map(({key:r,description:n,icon:s})=>i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"9px 14px",gap:"10px",transition:"background 0.12s"},onMouseEnter:o=>o.currentTarget.style.background="rgba(255,255,255,0.05)",onMouseLeave:o=>o.currentTarget.style.background="transparent",children:[i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"rgba(255,255,255,0.65)"},children:s}),i.jsx("span",{style:{color:"rgba(255,255,255,0.7)",fontSize:"13.5px"},children:n})]}),i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"6px",color:"rgba(255,255,255,0.75)",fontFamily:"ui-monospace, SF Mono, monospace",fontSize:"11.5px",fontWeight:600,padding:"3px 9px",whiteSpace:"nowrap",flexShrink:0},children:r})]},r))}),i.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.07)",fontSize:"11px",color:"rgba(255,255,255,0.28)",textAlign:"center"},children:["Press"," ",i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"?"})," ","or"," ",i.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"Esc"})," ","to dismiss"]})]}),i.jsx("style",{children:`
7
7
  @keyframes kbdFadeIn {
8
8
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
9
9
  to { opacity: 1; transform: scale(1) translateY(0); }
@@ -13,7 +13,7 @@
13
13
  from { opacity: 0; }
14
14
  to { opacity: 1; }
15
15
  }
16
- `})]})}function dt({type:a,value:e}){if(!a)return null;const t=a==="seek-forward";return i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:9985,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:t?"flex-end":"flex-start"},children:i.jsxs("div",{style:{width:"38%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6px",background:t?"radial-gradient(ellipse at right, rgba(255,255,255,0.18) 0%, transparent 70%)":"radial-gradient(ellipse at left, rgba(255,255,255,0.18) 0%, transparent 70%)",animation:"gestureHintFade 0.9s ease-out forwards"},children:[i.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"rgba(255,255,255,0.9)",style:{transform:t?"none":"scaleX(-1)"},children:i.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM12 6l6 6-6 6 1.41 1.41L20.83 12 13.41 4.59z"})}),i.jsx("span",{style:{color:"#fff",fontWeight:700,fontSize:"16px",textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e})]})})}function ut({player:a,skipSec:e=10}){const[t,r]=c.useState(null),n=c.useRef(null),s=c.useCallback(p=>{r(p),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>r(null),900)},[]),o=c.useRef(null),l=300,d=c.useCallback(p=>{if(!a)return;const g=p.touches[0],m=Date.now(),w=o.current;if(w&&m-w.time<l){const S=p.currentTarget.getBoundingClientRect();if(g.clientX-S.left>S.width/2){const b=a.getVideoElement();b&&a.seekTo(Math.min(b.duration||0,b.currentTime+e)),s({type:"seek-forward",value:`+${e}s`})}else{const b=a.getVideoElement();b&&a.seekTo(Math.max(0,b.currentTime-e)),s({type:"seek-backward",value:`-${e}s`})}o.current=null;return}o.current={time:m,x:g.clientX}},[a,e,s]),u=c.useCallback(p=>{},[]),h=c.useCallback(()=>{},[]);return{onTouchStart:d,onTouchMove:u,onTouchEnd:h,gestureHint:t}}function Br(a,e){let t;return function(...r){t||(a.apply(this,r),t=!0,setTimeout(()=>t=!1,e))}}function Nr({timeout:a=3e3,initialVisible:e=!0}={}){const[t,r]=c.useState(e),n=c.useRef(null),s=c.useCallback(()=>{n.current&&clearTimeout(n.current),r(!0),n.current=window.setTimeout(()=>{r(!1)},a)},[a]);return c.useEffect(()=>{const o=Br(()=>{s()},100),l=()=>{r(!0),n.current&&clearTimeout(n.current)};return window.addEventListener("mousemove",o,{passive:!0}),window.addEventListener("mouseenter",l,{passive:!0}),s(),()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseenter",l),n.current&&clearTimeout(n.current)}},[s]),{isActive:t,setIsActive:r}}function $r({player:a,seekStep:e=10,enabled:t=!0,onShowShortcuts:r}){c.useEffect(()=>{if(!a||!t)return;const n=s=>{const o=s.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;const l=a.getVideoElement();if(l)switch(s.code){case"Space":s.preventDefault(),l.paused?a.play():a.pause();break;case"ArrowLeft":s.preventDefault();const d=Math.max(0,l.currentTime-e);a.seekTo(d);break;case"ArrowRight":s.preventDefault();const u=Math.min(l.duration,l.currentTime+e);a.seekTo(u);break;case"ArrowUp":s.preventDefault();const h=l.volume;a.setVolume(Math.min(1,h+.1));break;case"ArrowDown":s.preventDefault();const p=l.volume;a.setVolume(Math.max(0,p-.1));break;case"KeyM":s.preventDefault(),a.toggleMute();break;case"KeyF":s.preventDefault(),a.toggleFullscreen();break;case"Slash":s.shiftKey&&(s.preventDefault(),r?.());break}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[a,e,t,r])}class Fr{timeout;maxWrapperDepth;constructor(e=5e3,t=5){this.timeout=e,this.maxWrapperDepth=t}async parse(e,t=0,r=0){if(t>this.maxWrapperDepth)throw new Error(`VAST wrapper depth exceeded (max: ${this.maxWrapperDepth})`);try{const s=await this.fetchVAST(e),o=this.parseXML(s),l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(!d)throw new Error("Wrapper missing VASTAdTagURI");return this.parse(d,t+1,r)}return this.parseInline(o)}catch(s){if(s instanceof Error&&s.message.includes("No ads available")&&r<2)return console.warn(`[VASTParser] ⚠️ No ads on attempt ${r+1}/3, retrying in 1500ms...`),await new Promise(l=>setTimeout(l,1500)),this.parse(e,t,r+1);throw s}}async fetchVAST(e){const t=new AbortController,r=setTimeout(()=>t.abort(),this.timeout);try{const n=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(r),!n.ok)throw new Error(`VAST fetch failed: ${n.status} ${n.statusText}`);const s=await n.text();if(!s||s.trim().length===0)throw new Error("VAST response is empty");return s}catch(n){throw clearTimeout(r),n instanceof Error&&n.name==="AbortError"?new Error("VAST request timeout"):n}}parseXML(e){const r=new DOMParser().parseFromString(e,"text/xml"),n=r.querySelector("parsererror");if(n){const l=n.textContent||"Unknown parse error";throw console.error("[VASTParser] XML parse error:",l),console.error("[VASTParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VAST XML parse error: ${l}`)}if(!r.querySelector("VAST"))throw console.error("[VASTParser] No VAST element found in XML"),console.error("[VASTParser] XML content:",e.substring(0,500)),new Error("Invalid VAST XML: No VAST element found");if(r.querySelectorAll("Ad").length===0)throw console.warn("[VASTParser] No Ad elements found in VAST response (empty ad pod)"),console.log("[VASTParser] Full XML:",e),new Error("No ads available in VAST response");return r}async parseAdPod(e){const t=await this.fetchVAST(e),r=this.parseXML(t),n=Array.from(r.querySelectorAll("Ad"));if(n.length===0)throw new Error("No ads available in VAST response");const s=[];for(const o of n)try{const l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(d){const u=await this.parse(d,1);s.push(u)}}else{const d=this.parseAdElement(o,r);d&&s.push(d)}}catch(l){console.warn("[VASTParser] Failed to parse Ad in pod, skipping:",l)}if(s.length===0)throw new Error("No ads available in VAST response");return s.sort((o,l)=>(o.podSequence??0)-(l.podSequence??0)),s}parseInline(e){const t=e.querySelector("Ad");if(!t)throw new Error("VAST Ad element not found");const r=this.parseAdElement(t,e);if(!r)throw new Error("VAST Ad element is empty (no ads available)");return r}parseAdElement(e,t){const r=e.getAttribute("sequence"),n=r!==null?parseInt(r,10):void 0,s=e.querySelector("InLine")??e.querySelector("Inline")??e.querySelector("inline")??t.querySelector("InLine")??t.querySelector("Inline");if(!s){const A=Array.from(e.children).map(b=>b.tagName);throw A.length===0?new Error("VAST Ad element is empty (no ads available)"):new Error(`VAST InLine not found. Found: ${A.join(", ")}`)}const o=e.getAttribute("id")||`ad-${Date.now()}`,l=s.querySelector("AdTitle")?.textContent?.trim(),d=s.querySelector("Duration")?.textContent?.trim(),u=this.parseDuration(d||"00:00:00"),{mediaFile:h,isVpaid:p,vpaidUrl:g}=this.getMediaFileInfo(s);if(!h)throw new Error("VAST MediaFile not found");const m=s.querySelector("ClickThrough")?.textContent?.trim(),w=this.parseTrackingEvents(s,t),j=this.getErrorUrls(t),S=this.parseCompanions(s);return{id:o,title:l,duration:u,mediaFile:h,clickThrough:m,trackingEvents:w,errorUrls:j,companions:S.length>0?S:void 0,isVpaid:p,vpaidUrl:g,podSequence:n}}parseCompanions(e){const t=[];return e.querySelectorAll("CompanionAds > Companion").forEach(n=>{const s=parseInt(n.getAttribute("width")||"0",10),o=parseInt(n.getAttribute("height")||"0",10),l=n.getAttribute("id")??void 0,d=n.querySelector("StaticResource"),u=n.querySelector("HTMLResource"),h=n.querySelector("IFrameResource"),p=d?.textContent?.trim()??void 0,g=u?.textContent?.trim()??void 0,m=h?.textContent?.trim()??void 0,w=d?.getAttribute("creativeType")??void 0,j=n.querySelector("CompanionClickThrough")?.textContent?.trim()??void 0,S=n.querySelector("AltText")?.textContent?.trim()??void 0,A=[];n.querySelectorAll('TrackingEvents > Tracking[event="creativeView"]').forEach(b=>{const y=b.textContent?.trim();y&&A.push(y)}),(p||g||m)&&t.push({id:l,width:s,height:o,staticResource:p,htmlResource:g,iFrameResource:m,type:w,clickThrough:j,altText:S,viewTrackingUrls:A.length>0?A:void 0})}),t}parseDuration(e){const t=e.split(":").map(Number);if(t.length===3){const[r,n,s]=t;return r*3600+n*60+s}return 0}getMediaFileInfo(e){const t=Array.from(e.querySelectorAll("MediaFile"));if(t.length===0)return{mediaFile:null,isVpaid:!1,vpaidUrl:void 0};const r=t.find(o=>o.getAttribute("apiFramework")?.toUpperCase()==="VPAID"&&(o.getAttribute("type")?.includes("javascript")||o.getAttribute("type")?.includes("application/javascript")));if(r){const o=r.textContent?.trim()||void 0;return console.log("[VASTParser] VPAID 2.0 creative detected:",o),{mediaFile:o??null,isVpaid:!0,vpaidUrl:o}}const n=t.filter(o=>o.getAttribute("delivery")==="progressive"&&o.getAttribute("type")?.includes("mp4"));return{mediaFile:(n.length>0?n[0]:t[0]).textContent?.trim()||null,isVpaid:!1,vpaidUrl:void 0}}parseTrackingEvents(e,t){const r={},n=t.querySelectorAll("Impression");n.length>0&&(r.impression=Array.from(n).map(o=>o.textContent?.trim()).filter(Boolean));const s=["start","firstQuartile","midpoint","thirdQuartile","complete","skip","pause","resume"];return e.querySelectorAll("Tracking").forEach(o=>{const l=o.getAttribute("event"),d=o.textContent?.trim();!l||!d||!s.includes(l)||(r[l]||(r[l]=[]),r[l].push(d))}),r}getErrorUrls(e){const t=[];return e.querySelectorAll("Error").forEach(r=>{const n=r.textContent?.trim();n&&t.push(n)}),t}}class Ur{timeout;constructor(e=5e3){this.timeout=e}async parse(e){const t=await this.fetchVMAP(e),r=this.parseXML(t),n="http://www.iab.net/videosuite/vmap";let s=r.querySelector("vmap\\:VMAP, VMAP");if(!s){const d=r.getElementsByTagNameNS(n,"VMAP");if(d.length>0)s=d[0];else{const u=r.getElementsByTagName("VMAP");u.length>0&&(s=u[0])}}if(!s)throw console.error("[VMAPParser] VMAP element not found. XML:",t.substring(0,500)),new Error("VMAP element not found");const o=s.getAttribute("version")||"1.0",l=this.parseAdBreaks(r);return l.length===0?(console.warn("[VMAPParser] ⚠️ No ad breaks found in VMAP"),console.warn("[VMAPParser] This might mean:"),console.warn("[VMAPParser] 1. The VMAP URL returned an empty response (common with test URLs)"),console.warn("[VMAPParser] 2. The VMAP structure is different than expected"),console.warn("[VMAPParser] 3. There are no ads available at this time"),console.warn("[VMAPParser] VMAP XML (first 1000 chars):",t.substring(0,1e3)),t.includes("AdBreak")||t.includes("adBreak")||t.includes("AdSource")||(console.error("[VMAPParser] ❌ VMAP appears to be completely empty - no AdBreak elements found"),console.error("[VMAPParser] This is likely a test URL issue. Try using a local VMAP file or a different test URL."))):console.log(`[VMAPParser] ✅ Successfully parsed ${l.length} ad break(s)`),{version:o,adBreaks:l}}async fetchVMAP(e){const t=new AbortController,r=setTimeout(()=>t.abort(),this.timeout);try{console.log("[VMAPParser] Fetching VMAP from:",e);const n=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(r),!n.ok)throw console.error("[VMAPParser] VMAP fetch failed:",{status:n.status,statusText:n.statusText,url:e}),new Error(`VMAP fetch failed: ${n.status} ${n.statusText}`);const s=await n.text();if(!s||s.trim().length===0)throw console.error("[VMAPParser] VMAP response is empty"),new Error("VMAP response is empty");return console.log("[VMAPParser] VMAP fetched successfully, length:",s.length),s}catch(n){throw clearTimeout(r),n instanceof Error&&n.name==="AbortError"?(console.error("[VMAPParser] VMAP request timeout after",this.timeout,"ms"),new Error(`VMAP request timeout (${this.timeout}ms)`)):n instanceof TypeError?(console.error("[VMAPParser] Network error fetching VMAP:",n.message),new Error(`VMAP network error: ${n.message}`)):n}}parseXML(e){const r=new DOMParser().parseFromString(e,"text/xml"),n=r.querySelector("parsererror");if(n){const s=n.textContent||"Unknown parse error";throw console.error("[VMAPParser] XML parse error:",s),console.error("[VMAPParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VMAP XML parse error: ${s}`)}return r}parseAdBreaks(e){const t=[],r="http://www.iab.net/videosuite/vmap";let n=e.querySelectorAll("vmap\\:AdBreak, AdBreak");if(n.length===0&&e.documentElement){const o=e.getElementsByTagNameNS(r,"AdBreak");if(o.length>0)n=o;else{const l=e.getElementsByTagName("AdBreak");l.length>0&&(n=l)}}return Array.from(n).forEach(s=>{const o=this.parseAdBreak(s);o&&t.push(o)}),t}parseAdBreak(e){const t=e.getAttribute("timeOffset");if(!t)return console.warn("[VMAPParser] AdBreak missing timeOffset, skipping"),null;const r=this.parseTimeOffset(t),n="http://www.iab.net/videosuite/vmap";let s=e.querySelector("vmap\\:AdSource, AdSource");if(!s){const u=e.getElementsByTagNameNS(n,"AdSource");if(u.length>0)s=u[0];else{const h=e.getElementsByTagName("AdSource");h.length>0&&(s=h[0])}}if(!s)return console.warn("[VMAPParser] AdBreak missing AdSource, skipping"),null;let o=s.querySelector("vmap\\:AdTagURI, AdTagURI");if(!o){const u=s.getElementsByTagNameNS(n,"AdTagURI");if(u.length>0)o=u[0];else{const h=s.getElementsByTagName("AdTagURI");h.length>0&&(o=h[0])}}if(!o)return console.warn("[VMAPParser] AdSource missing AdTagURI, skipping"),console.warn("[VMAPParser] AdSource children:",Array.from(s.children).map(u=>u.tagName)),null;let l=o.textContent?.trim()||o.innerHTML?.trim();if(!l)return console.warn("[VMAPParser] AdTagURI is empty, skipping"),null;l=l.replace(/<!\\[CDATA\\[(.*?)\\]\\]>/g,"$1").trim();const d=document.createElement("textarea");return d.innerHTML=l,l=d.value,console.log("[VMAPParser] AdBreak parsed:",{timeOffset:r,timeOffsetStr:t,vastUrl:l.substring(0,100)+(l.length>100?"...":"")}),{timeOffset:r,vastUrl:l}}parseTimeOffset(e){const t=e.trim().toLowerCase();if(t==="start")return 0;if(t==="end")return-1;const r=t.split(":").map(Number);if(r.length===1)return r[0];if(r.length===2){const[n,s]=r;return n*60+s}else if(r.length===3){const[n,s,o]=r;return n*3600+s*60+o}return console.warn(`[VMAPParser] Invalid timeOffset format: ${e}, defaulting to 0`),0}}class Or{trackingEnabled;constructor(e=!0){this.trackingEnabled=e}trackImpression(e){!this.trackingEnabled||!e.trackingEvents.impression||e.trackingEvents.impression.forEach(t=>{this.fireTrackingPixel(t)})}trackStart(e){!this.trackingEnabled||!e.trackingEvents.start||e.trackingEvents.start.forEach(t=>{this.fireTrackingPixel(t)})}trackComplete(e){!this.trackingEnabled||!e.trackingEvents.complete||e.trackingEvents.complete.forEach(t=>{this.fireTrackingPixel(t)})}trackSkip(e){!this.trackingEnabled||!e.trackingEvents.skip||e.trackingEvents.skip.forEach(t=>{this.fireTrackingPixel(t)})}trackError(e,t){!this.trackingEnabled||!e.errorUrls||e.errorUrls.forEach(r=>{const n=r.replace("[ERRORCODE]",t);this.fireTrackingPixel(n)})}fireTrackingPixel(e){if(e)try{const t=new Image;t.src=e}catch(t){console.warn("[AdTracker] Failed to fire tracking pixel:",e,t)}}reset(){}}class Wr{player;config;tracker;hideLoadingCallback;adVideo=null;adContainer=null;companionContainer=null;mainVideoElement=null;skipButton=null;countdownElement=null;vpaidIframe=null;vpaidCreative=null;state={isPlaying:!1,ad:null,position:null,currentTime:0,canSkip:!1,remainingTime:0};constructor(e,t,r){this.player=e,this.config=t,this.tracker=new Or(!0),this.hideLoadingCallback=r}async play(e,t){if(console.log(`[AdPlayer] Playing ${t} ad:`,e.title||e.id),this.mainVideoElement=this.player.getVideoElement(),!this.mainVideoElement&&this.player.videoElement&&(this.mainVideoElement=this.player.videoElement),!this.mainVideoElement)throw new Error("Main video element not found. Player may not be initialized.");this.player.getState()?.isPlaying&&this.player.pause(),this.state={isPlaying:!0,ad:e,position:t,currentTime:0,canSkip:!1,remainingTime:e.duration},this.tracker.reset();try{this.createAdUI(),e.companions?.length&&this.showCompanionBanners(e.companions),this.tracker.trackImpression(e),e.isVpaid&&e.vpaidUrl?await this.playVpaidCreative(e):await this.playAdVideo(e),this.tracker.trackComplete(e),console.log("[AdPlayer] Ad completed")}catch(n){throw console.error("[AdPlayer] Ad playback error:",n),this.tracker.trackError(e,"400"),n}finally{this.destroyAdUI(),this.state.isPlaying=!1,this.state.ad=null,t!=="postroll"&&setTimeout(()=>{try{this.player&&typeof this.player.play=="function"&&this.player.play().catch(n=>{console.warn("[AdPlayer] Failed to resume main video:",n.message)})}catch(n){console.warn("[AdPlayer] Error resuming main video:",n)}},100)}}async playAdPod(e,t){console.log(`[AdPlayer] Playing ad pod: ${e.length} ads at ${t}`);for(const r of e)try{await this.play(r,t)}catch(n){console.warn("[AdPlayer] Ad pod: ad failed, continuing with next:",n)}console.log("[AdPlayer] Ad pod complete")}showCompanionBanners(e){if(!this.mainVideoElement)return;const r=document.getElementById("virtus-companion-slot")??this.mainVideoElement.parentElement;if(r){this.companionContainer=document.createElement("div"),this.companionContainer.className="virtus-companion-container",this.companionContainer.style.cssText=`
16
+ `})]})}function dt({type:a,value:e}){if(!a)return null;const t=a==="seek-forward";return i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:9985,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:t?"flex-end":"flex-start"},children:i.jsxs("div",{style:{width:"38%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6px",background:t?"radial-gradient(ellipse at right, rgba(255,255,255,0.18) 0%, transparent 70%)":"radial-gradient(ellipse at left, rgba(255,255,255,0.18) 0%, transparent 70%)",animation:"gestureHintFade 0.9s ease-out forwards"},children:[i.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"rgba(255,255,255,0.9)",style:{transform:t?"none":"scaleX(-1)"},children:i.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM12 6l6 6-6 6 1.41 1.41L20.83 12 13.41 4.59z"})}),i.jsx("span",{style:{color:"#fff",fontWeight:700,fontSize:"16px",textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e})]})})}function ut({player:a,skipSec:e=10}){const[t,r]=c.useState(null),n=c.useRef(null),s=c.useCallback(p=>{r(p),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>r(null),900)},[]),o=c.useRef(null),l=300,d=c.useCallback(p=>{if(!a)return;const g=p.touches[0],m=Date.now(),w=o.current;if(w&&m-w.time<l){const S=p.currentTarget.getBoundingClientRect();if(g.clientX-S.left>S.width/2){const b=a.getVideoElement();b&&a.seekTo(Math.min(b.duration||0,b.currentTime+e)),s({type:"seek-forward",value:`+${e}s`})}else{const b=a.getVideoElement();b&&a.seekTo(Math.max(0,b.currentTime-e)),s({type:"seek-backward",value:`-${e}s`})}o.current=null;return}o.current={time:m,x:g.clientX}},[a,e,s]),u=c.useCallback(p=>{},[]),h=c.useCallback(()=>{},[]);return{onTouchStart:d,onTouchMove:u,onTouchEnd:h,gestureHint:t}}function Br(a,e){let t;return function(...r){t||(a.apply(this,r),t=!0,setTimeout(()=>t=!1,e))}}function Nr({timeout:a=3e3,initialVisible:e=!0}={}){const[t,r]=c.useState(e),n=c.useRef(null),s=c.useCallback(()=>{n.current&&clearTimeout(n.current),r(!0),n.current=window.setTimeout(()=>{r(!1)},a)},[a]);return c.useEffect(()=>{const o=Br(()=>{s()},100),l=()=>{r(!0),n.current&&clearTimeout(n.current)};return window.addEventListener("mousemove",o,{passive:!0}),window.addEventListener("mouseenter",l,{passive:!0}),s(),()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseenter",l),n.current&&clearTimeout(n.current)}},[s]),{isActive:t,setIsActive:r}}function $r({player:a,seekStep:e=10,enabled:t=!0,onShowShortcuts:r}){c.useEffect(()=>{if(!a||!t)return;const n=s=>{const o=s.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;const l=a.getVideoElement();if(l)switch(s.code){case"Space":s.preventDefault(),l.paused?a.play():a.pause();break;case"ArrowLeft":s.preventDefault();const d=Math.max(0,l.currentTime-e);a.seekTo(d);break;case"ArrowRight":s.preventDefault();const u=Math.min(l.duration,l.currentTime+e);a.seekTo(u);break;case"ArrowUp":s.preventDefault();const h=l.volume;a.setVolume(Math.min(1,h+.1));break;case"ArrowDown":s.preventDefault();const p=l.volume;a.setVolume(Math.max(0,p-.1));break;case"KeyM":s.preventDefault(),a.toggleMute();break;case"KeyF":s.preventDefault(),a.toggleFullscreen();break;case"Slash":s.shiftKey&&(s.preventDefault(),r?.());break}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[a,e,t,r])}class Fr{timeout;maxWrapperDepth;constructor(e=5e3,t=5){this.timeout=e,this.maxWrapperDepth=t}async parse(e,t=0,r=0){if(t>this.maxWrapperDepth)throw new Error(`VAST wrapper depth exceeded (max: ${this.maxWrapperDepth})`);try{const s=await this.fetchVAST(e),o=this.parseXML(s),l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(!d)throw new Error("Wrapper missing VASTAdTagURI");return this.parse(d,t+1,r)}return this.parseInline(o)}catch(s){if(s instanceof Error&&s.message.includes("No ads available")&&r<2)return console.warn(`[VASTParser] ⚠️ No ads on attempt ${r+1}/3, retrying in 1500ms...`),await new Promise(l=>setTimeout(l,1500)),this.parse(e,t,r+1);throw s}}async fetchVAST(e){const t=new AbortController,r=setTimeout(()=>t.abort(),this.timeout);try{const n=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(r),!n.ok)throw new Error(`VAST fetch failed: ${n.status} ${n.statusText}`);const s=await n.text();if(!s||s.trim().length===0)throw new Error("VAST response is empty");return s}catch(n){throw clearTimeout(r),n instanceof Error&&n.name==="AbortError"?new Error("VAST request timeout"):n}}parseXML(e){const r=new DOMParser().parseFromString(e,"text/xml"),n=r.querySelector("parsererror");if(n){const l=n.textContent||"Unknown parse error";throw console.error("[VASTParser] XML parse error:",l),console.error("[VASTParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VAST XML parse error: ${l}`)}if(!r.querySelector("VAST"))throw console.error("[VASTParser] No VAST element found in XML"),console.error("[VASTParser] XML content:",e.substring(0,500)),new Error("Invalid VAST XML: No VAST element found");if(r.querySelectorAll("Ad").length===0)throw console.warn("[VASTParser] No Ad elements found in VAST response (empty ad pod)"),console.log("[VASTParser] Full XML:",e),new Error("No ads available in VAST response");return r}async parseAdPod(e){const t=await this.fetchVAST(e),r=this.parseXML(t),n=Array.from(r.querySelectorAll("Ad"));if(n.length===0)throw new Error("No ads available in VAST response");const s=[];for(const o of n)try{const l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(d){const u=await this.parse(d,1);s.push(u)}}else{const d=this.parseAdElement(o,r);d&&s.push(d)}}catch(l){console.warn("[VASTParser] Failed to parse Ad in pod, skipping:",l)}if(s.length===0)throw new Error("No ads available in VAST response");return s.sort((o,l)=>(o.podSequence??0)-(l.podSequence??0)),s}parseInline(e){const t=e.querySelector("Ad");if(!t)throw new Error("VAST Ad element not found");const r=this.parseAdElement(t,e);if(!r)throw new Error("VAST Ad element is empty (no ads available)");return r}parseAdElement(e,t){const r=e.getAttribute("sequence"),n=r!==null?parseInt(r,10):void 0,s=e.querySelector("InLine")??e.querySelector("Inline")??e.querySelector("inline")??t.querySelector("InLine")??t.querySelector("Inline");if(!s){const A=Array.from(e.children).map(b=>b.tagName);throw A.length===0?new Error("VAST Ad element is empty (no ads available)"):new Error(`VAST InLine not found. Found: ${A.join(", ")}`)}const o=e.getAttribute("id")||`ad-${Date.now()}`,l=s.querySelector("AdTitle")?.textContent?.trim(),d=s.querySelector("Duration")?.textContent?.trim(),u=this.parseDuration(d||"00:00:00"),{mediaFile:h,isVpaid:p,vpaidUrl:g}=this.getMediaFileInfo(s);if(!h)throw new Error("VAST MediaFile not found");const m=s.querySelector("ClickThrough")?.textContent?.trim(),w=this.parseTrackingEvents(s,t),P=this.getErrorUrls(t),S=this.parseCompanions(s);return{id:o,title:l,duration:u,mediaFile:h,clickThrough:m,trackingEvents:w,errorUrls:P,companions:S.length>0?S:void 0,isVpaid:p,vpaidUrl:g,podSequence:n}}parseCompanions(e){const t=[];return e.querySelectorAll("CompanionAds > Companion").forEach(n=>{const s=parseInt(n.getAttribute("width")||"0",10),o=parseInt(n.getAttribute("height")||"0",10),l=n.getAttribute("id")??void 0,d=n.querySelector("StaticResource"),u=n.querySelector("HTMLResource"),h=n.querySelector("IFrameResource"),p=d?.textContent?.trim()??void 0,g=u?.textContent?.trim()??void 0,m=h?.textContent?.trim()??void 0,w=d?.getAttribute("creativeType")??void 0,P=n.querySelector("CompanionClickThrough")?.textContent?.trim()??void 0,S=n.querySelector("AltText")?.textContent?.trim()??void 0,A=[];n.querySelectorAll('TrackingEvents > Tracking[event="creativeView"]').forEach(b=>{const y=b.textContent?.trim();y&&A.push(y)}),(p||g||m)&&t.push({id:l,width:s,height:o,staticResource:p,htmlResource:g,iFrameResource:m,type:w,clickThrough:P,altText:S,viewTrackingUrls:A.length>0?A:void 0})}),t}parseDuration(e){const t=e.split(":").map(Number);if(t.length===3){const[r,n,s]=t;return r*3600+n*60+s}return 0}getMediaFileInfo(e){const t=Array.from(e.querySelectorAll("MediaFile"));if(t.length===0)return{mediaFile:null,isVpaid:!1,vpaidUrl:void 0};const r=t.find(o=>o.getAttribute("apiFramework")?.toUpperCase()==="VPAID"&&(o.getAttribute("type")?.includes("javascript")||o.getAttribute("type")?.includes("application/javascript")));if(r){const o=r.textContent?.trim()||void 0;return console.log("[VASTParser] VPAID 2.0 creative detected:",o),{mediaFile:o??null,isVpaid:!0,vpaidUrl:o}}const n=t.filter(o=>o.getAttribute("delivery")==="progressive"&&o.getAttribute("type")?.includes("mp4"));return{mediaFile:(n.length>0?n[0]:t[0]).textContent?.trim()||null,isVpaid:!1,vpaidUrl:void 0}}parseTrackingEvents(e,t){const r={},n=t.querySelectorAll("Impression");n.length>0&&(r.impression=Array.from(n).map(o=>o.textContent?.trim()).filter(Boolean));const s=["start","firstQuartile","midpoint","thirdQuartile","complete","skip","pause","resume"];return e.querySelectorAll("Tracking").forEach(o=>{const l=o.getAttribute("event"),d=o.textContent?.trim();!l||!d||!s.includes(l)||(r[l]||(r[l]=[]),r[l].push(d))}),r}getErrorUrls(e){const t=[];return e.querySelectorAll("Error").forEach(r=>{const n=r.textContent?.trim();n&&t.push(n)}),t}}class Ur{timeout;constructor(e=5e3){this.timeout=e}async parse(e){const t=await this.fetchVMAP(e),r=this.parseXML(t),n="http://www.iab.net/videosuite/vmap";let s=r.querySelector("vmap\\:VMAP, VMAP");if(!s){const d=r.getElementsByTagNameNS(n,"VMAP");if(d.length>0)s=d[0];else{const u=r.getElementsByTagName("VMAP");u.length>0&&(s=u[0])}}if(!s)throw console.error("[VMAPParser] VMAP element not found. XML:",t.substring(0,500)),new Error("VMAP element not found");const o=s.getAttribute("version")||"1.0",l=this.parseAdBreaks(r);return l.length===0?(console.warn("[VMAPParser] ⚠️ No ad breaks found in VMAP"),console.warn("[VMAPParser] This might mean:"),console.warn("[VMAPParser] 1. The VMAP URL returned an empty response (common with test URLs)"),console.warn("[VMAPParser] 2. The VMAP structure is different than expected"),console.warn("[VMAPParser] 3. There are no ads available at this time"),console.warn("[VMAPParser] VMAP XML (first 1000 chars):",t.substring(0,1e3)),t.includes("AdBreak")||t.includes("adBreak")||t.includes("AdSource")||(console.error("[VMAPParser] ❌ VMAP appears to be completely empty - no AdBreak elements found"),console.error("[VMAPParser] This is likely a test URL issue. Try using a local VMAP file or a different test URL."))):console.log(`[VMAPParser] ✅ Successfully parsed ${l.length} ad break(s)`),{version:o,adBreaks:l}}async fetchVMAP(e){const t=new AbortController,r=setTimeout(()=>t.abort(),this.timeout);try{console.log("[VMAPParser] Fetching VMAP from:",e);const n=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(r),!n.ok)throw console.error("[VMAPParser] VMAP fetch failed:",{status:n.status,statusText:n.statusText,url:e}),new Error(`VMAP fetch failed: ${n.status} ${n.statusText}`);const s=await n.text();if(!s||s.trim().length===0)throw console.error("[VMAPParser] VMAP response is empty"),new Error("VMAP response is empty");return console.log("[VMAPParser] VMAP fetched successfully, length:",s.length),s}catch(n){throw clearTimeout(r),n instanceof Error&&n.name==="AbortError"?(console.error("[VMAPParser] VMAP request timeout after",this.timeout,"ms"),new Error(`VMAP request timeout (${this.timeout}ms)`)):n instanceof TypeError?(console.error("[VMAPParser] Network error fetching VMAP:",n.message),new Error(`VMAP network error: ${n.message}`)):n}}parseXML(e){const r=new DOMParser().parseFromString(e,"text/xml"),n=r.querySelector("parsererror");if(n){const s=n.textContent||"Unknown parse error";throw console.error("[VMAPParser] XML parse error:",s),console.error("[VMAPParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VMAP XML parse error: ${s}`)}return r}parseAdBreaks(e){const t=[],r="http://www.iab.net/videosuite/vmap";let n=e.querySelectorAll("vmap\\:AdBreak, AdBreak");if(n.length===0&&e.documentElement){const o=e.getElementsByTagNameNS(r,"AdBreak");if(o.length>0)n=o;else{const l=e.getElementsByTagName("AdBreak");l.length>0&&(n=l)}}return Array.from(n).forEach(s=>{const o=this.parseAdBreak(s);o&&t.push(o)}),t}parseAdBreak(e){const t=e.getAttribute("timeOffset");if(!t)return console.warn("[VMAPParser] AdBreak missing timeOffset, skipping"),null;const r=this.parseTimeOffset(t),n="http://www.iab.net/videosuite/vmap";let s=e.querySelector("vmap\\:AdSource, AdSource");if(!s){const u=e.getElementsByTagNameNS(n,"AdSource");if(u.length>0)s=u[0];else{const h=e.getElementsByTagName("AdSource");h.length>0&&(s=h[0])}}if(!s)return console.warn("[VMAPParser] AdBreak missing AdSource, skipping"),null;let o=s.querySelector("vmap\\:AdTagURI, AdTagURI");if(!o){const u=s.getElementsByTagNameNS(n,"AdTagURI");if(u.length>0)o=u[0];else{const h=s.getElementsByTagName("AdTagURI");h.length>0&&(o=h[0])}}if(!o)return console.warn("[VMAPParser] AdSource missing AdTagURI, skipping"),console.warn("[VMAPParser] AdSource children:",Array.from(s.children).map(u=>u.tagName)),null;let l=o.textContent?.trim()||o.innerHTML?.trim();if(!l)return console.warn("[VMAPParser] AdTagURI is empty, skipping"),null;l=l.replace(/<!\\[CDATA\\[(.*?)\\]\\]>/g,"$1").trim();const d=document.createElement("textarea");return d.innerHTML=l,l=d.value,console.log("[VMAPParser] AdBreak parsed:",{timeOffset:r,timeOffsetStr:t,vastUrl:l.substring(0,100)+(l.length>100?"...":"")}),{timeOffset:r,vastUrl:l}}parseTimeOffset(e){const t=e.trim().toLowerCase();if(t==="start")return 0;if(t==="end")return-1;const r=t.split(":").map(Number);if(r.length===1)return r[0];if(r.length===2){const[n,s]=r;return n*60+s}else if(r.length===3){const[n,s,o]=r;return n*3600+s*60+o}return console.warn(`[VMAPParser] Invalid timeOffset format: ${e}, defaulting to 0`),0}}class Or{trackingEnabled;constructor(e=!0){this.trackingEnabled=e}trackImpression(e){!this.trackingEnabled||!e.trackingEvents.impression||e.trackingEvents.impression.forEach(t=>{this.fireTrackingPixel(t)})}trackStart(e){!this.trackingEnabled||!e.trackingEvents.start||e.trackingEvents.start.forEach(t=>{this.fireTrackingPixel(t)})}trackComplete(e){!this.trackingEnabled||!e.trackingEvents.complete||e.trackingEvents.complete.forEach(t=>{this.fireTrackingPixel(t)})}trackSkip(e){!this.trackingEnabled||!e.trackingEvents.skip||e.trackingEvents.skip.forEach(t=>{this.fireTrackingPixel(t)})}trackError(e,t){!this.trackingEnabled||!e.errorUrls||e.errorUrls.forEach(r=>{const n=r.replace("[ERRORCODE]",t);this.fireTrackingPixel(n)})}fireTrackingPixel(e){if(e)try{const t=new Image;t.src=e}catch(t){console.warn("[AdTracker] Failed to fire tracking pixel:",e,t)}}reset(){}}class Wr{player;config;tracker;hideLoadingCallback;adVideo=null;adContainer=null;companionContainer=null;mainVideoElement=null;skipButton=null;countdownElement=null;vpaidIframe=null;vpaidCreative=null;state={isPlaying:!1,ad:null,position:null,currentTime:0,canSkip:!1,remainingTime:0};constructor(e,t,r){this.player=e,this.config=t,this.tracker=new Or(!0),this.hideLoadingCallback=r}async play(e,t){if(console.log(`[AdPlayer] Playing ${t} ad:`,e.title||e.id),this.mainVideoElement=this.player.getVideoElement(),!this.mainVideoElement&&this.player.videoElement&&(this.mainVideoElement=this.player.videoElement),!this.mainVideoElement)throw new Error("Main video element not found. Player may not be initialized.");this.player.getState()?.isPlaying&&this.player.pause(),this.state={isPlaying:!0,ad:e,position:t,currentTime:0,canSkip:!1,remainingTime:e.duration},this.tracker.reset();try{this.createAdUI(),e.companions?.length&&this.showCompanionBanners(e.companions),this.tracker.trackImpression(e),e.isVpaid&&e.vpaidUrl?await this.playVpaidCreative(e):await this.playAdVideo(e),this.tracker.trackComplete(e),console.log("[AdPlayer] Ad completed")}catch(n){throw console.error("[AdPlayer] Ad playback error:",n),this.tracker.trackError(e,"400"),n}finally{this.destroyAdUI(),this.state.isPlaying=!1,this.state.ad=null,t!=="postroll"&&setTimeout(()=>{try{this.player&&typeof this.player.play=="function"&&this.player.play().catch(n=>{console.warn("[AdPlayer] Failed to resume main video:",n.message)})}catch(n){console.warn("[AdPlayer] Error resuming main video:",n)}},100)}}async playAdPod(e,t){console.log(`[AdPlayer] Playing ad pod: ${e.length} ads at ${t}`);for(const r of e)try{await this.play(r,t)}catch(n){console.warn("[AdPlayer] Ad pod: ad failed, continuing with next:",n)}console.log("[AdPlayer] Ad pod complete")}showCompanionBanners(e){if(!this.mainVideoElement)return;const r=document.getElementById("virtus-companion-slot")??this.mainVideoElement.parentElement;if(r){this.companionContainer=document.createElement("div"),this.companionContainer.className="virtus-companion-container",this.companionContainer.style.cssText=`
17
17
  position: absolute;
18
18
  top: 0;
19
19
  right: -320px;
@@ -113,7 +113,7 @@
113
113
  0% { transform: rotate(0deg); }
114
114
  100% { transform: rotate(360deg); }
115
115
  }
116
- `,document.head.appendChild(r)}t.appendChild(this.loadingContainer),console.log("[AdManager] Loading spinner shown")}}hideAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!1),console.log("[AdManager] External loading callback triggered (false)");return}this.loadingContainer&&(this.loadingContainer.remove(),this.loadingContainer=null,console.log("[AdManager] Loading spinner hidden"))}destroy(){this.hideAdLoading(),this.adPlayer.destroy(),this.preRollPlayed=!1,this.midRollsPlayed.clear(),this.postRollPlayed=!1,this.vmapData=null,console.log("[AdManager] Destroyed")}}const ht={bottomOffset:110,fontSize:18,color:"#ffffff",background:"rgba(0,0,0,0.75)"},pt=c.createContext({style:ht,setStyle:()=>{}});function zr({children:a}){const[e,t]=c.useState(ht),r=n=>t(s=>({...s,...n}));return i.jsx(pt.Provider,{value:{style:e,setStyle:r},children:a})}function gt(){return c.useContext(pt)}function qr({videoElement:a}){const{style:e}=gt(),[t,r]=c.useState([]),n=c.useRef(""),s=c.useRef(0);return c.useEffect(()=>{if(!a)return;const o=()=>{const l=a.textTracks,d=[];for(let h=0;h<l.length;h++){const p=l[h];if(p.kind!=="subtitles"&&p.kind!=="captions"||p.mode==="disabled")continue;p.mode==="showing"&&(p.mode="hidden");const g=p.activeCues;if(g)for(let m=0;m<g.length;m++){const w=g[m];w.text&&d.push(w.text)}}const u=d.join("\0");u!==n.current&&(n.current=u,r(d)),s.current=requestAnimationFrame(o)};return s.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(s.current)}},[a]),t.length===0?null:i.jsx("div",{"aria-live":"polite",style:{position:"absolute",bottom:e.bottomOffset,left:"50%",transform:"translateX(-50%)",textAlign:"center",pointerEvents:"none",zIndex:200,maxWidth:"85%",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px"},children:t.map((o,l)=>i.jsx("span",{style:{display:"inline-block",fontSize:e.fontSize,lineHeight:1.4,color:e.color,background:e.background||"transparent",padding:e.background?"2px 10px":"0",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",textShadow:e.background?"none":"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.8)"},dangerouslySetInnerHTML:{__html:o}},l))})}const be=c.createContext(!0);function ft({src:a="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",defaultControls:e=!1,autoplay:t=!1,muted:r=!1,poster:n,className:s,children:o,config:l,onAdLoading:d,onNextEpisode:u,nextEpisodeTitle:h,nextEpisodeThumbnail:p,endCardCountdown:g=5,crossOrigin:m}){const w=c.useRef(null),j=c.useRef(null),[S,A]=c.useState(null),b=c.useRef(null),[y,q]=c.useState(!1),[z,L]=c.useState(!1),k=c.useCallback(()=>L(!0),[]),R=c.useCallback(()=>L(!1),[]),[N,x]=c.useState(!1),{onTouchStart:C,onTouchMove:I,onTouchEnd:$,gestureHint:K}=ut({player:S,skipSec:10}),{isActive:M}=Nr({timeout:3e3,initialVisible:!0});$r({player:S,seekStep:10,enabled:!0,onShowShortcuts:k});const _=c.useMemo(()=>!l?.ads?.enabled||!l.ads.vastUrl&&!l.ads.vmapUrl?null:{enabled:!0,vastUrl:l.ads.vastUrl,vmapUrl:l.ads.vmapUrl,skipAfter:l.ads.skipAfter,timeout:l.ads.timeout,maxWrapperDepth:l.ads.maxWrapperDepth},[l?.ads?.enabled,l?.ads?.vastUrl,l?.ads?.vmapUrl,l?.ads?.skipAfter,l?.ads?.timeout,l?.ads?.maxWrapperDepth]);c.useEffect(()=>{if(!j.current||!w.current)return;console.log("[Player] Initializing PlayerCore");const V=new ne(j.current);return ne.preloadEngines(),V.container=w.current,A(V),()=>{console.log("[Player] Cleanup called - destroying PlayerCore"),b.current&&(console.log("[Player] Destroying AdManager"),b.current.destroy(),b.current=null),V.destroy(),A(null)}},[]),c.useEffect(()=>{if(!S||!_)return;console.log("[Player] Setting up ads");const V=G=>{q(G),d?.(G)},Y=new Hr(S,_,V);return b.current=Y,Y.setup().catch(G=>{console.error("[Player] Failed to setup ads:",G)}),()=>{b.current&&(console.log("[Player] Cleaning up ads"),b.current.destroy(),b.current=null)}},[S,_]),c.useEffect(()=>{!S||!l||S.setConfig(l)},[S,l]);const T=c.useMemo(()=>l?.drm??null,[l?.drm]);return c.useEffect(()=>{!S||!T?.enabled||S.setupDrm(T)},[S,T]),c.useEffect(()=>{S&&a&&(console.log("[Player] Setting source:",a),S.setSource(a).catch(V=>{console.error("[Player] setSource failed:",V)}))},[S,a]),c.useEffect(()=>{if(!S||!u)return;const V=S.getVideoElement();if(!V)return;const Y=()=>x(!0);return V.addEventListener("ended",Y),()=>V.removeEventListener("ended",Y)},[S,u]),i.jsxs(zr,{children:[i.jsxs("div",{ref:w,role:"region","aria-label":"Video Player",className:`playron-wrapper ${s||""}`,onTouchStart:C,onTouchMove:I,onTouchEnd:$,style:{position:"relative",backgroundColor:"#000",overflow:"hidden",cursor:M?"default":"none"},children:[i.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),i.jsx("video",{ref:j,className:`virtus-video-element ${s||""}`,style:{width:"100%",height:"100%",display:"block",aspectRatio:"16/9",objectFit:"cover",objectPosition:"center"},autoPlay:t,muted:r,controls:e,poster:n,playsInline:!0,crossOrigin:m,tabIndex:e?0:-1}),S?i.jsx(at,{playerInstance:S,children:i.jsxs(be.Provider,{value:M,children:[i.jsx(qr,{videoElement:j.current}),i.jsx(gr,{config:l,isAdLoading:y}),i.jsx(dt,{type:K?.type??null,value:K?.value??""}),i.jsx(_r,{drmConfig:l?.drm}),i.jsx(lt,{isOpen:z,onClose:R}),u&&i.jsx(ct,{isVisible:N,onNextEpisode:()=>{x(!1),u()},onDismiss:()=>x(!1),countdownSec:g,nextTitle:h,thumbnail:p}),o]})}):null]}),i.jsx("style",{children:`
116
+ `,document.head.appendChild(r)}t.appendChild(this.loadingContainer),console.log("[AdManager] Loading spinner shown")}}hideAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!1),console.log("[AdManager] External loading callback triggered (false)");return}this.loadingContainer&&(this.loadingContainer.remove(),this.loadingContainer=null,console.log("[AdManager] Loading spinner hidden"))}destroy(){this.hideAdLoading(),this.adPlayer.destroy(),this.preRollPlayed=!1,this.midRollsPlayed.clear(),this.postRollPlayed=!1,this.vmapData=null,console.log("[AdManager] Destroyed")}}const ht={bottomOffset:110,fontSize:18,color:"#ffffff",background:"rgba(0,0,0,0.75)"},pt=c.createContext({style:ht,setStyle:()=>{}});function zr({children:a}){const[e,t]=c.useState(ht),r=n=>t(s=>({...s,...n}));return i.jsx(pt.Provider,{value:{style:e,setStyle:r},children:a})}function gt(){return c.useContext(pt)}function qr({videoElement:a}){const{style:e}=gt(),[t,r]=c.useState([]),n=c.useRef(""),s=c.useRef(0);return c.useEffect(()=>{if(!a)return;const o=()=>{const l=a.textTracks,d=[];for(let h=0;h<l.length;h++){const p=l[h];if(p.kind!=="subtitles"&&p.kind!=="captions"||p.mode==="disabled")continue;p.mode==="showing"&&(p.mode="hidden");const g=p.activeCues;if(g)for(let m=0;m<g.length;m++){const w=g[m];w.text&&d.push(w.text)}}const u=d.join("\0");u!==n.current&&(n.current=u,r(d)),s.current=requestAnimationFrame(o)};return s.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(s.current)}},[a]),t.length===0?null:i.jsx("div",{"aria-live":"polite",style:{position:"absolute",bottom:e.bottomOffset,left:"50%",transform:"translateX(-50%)",textAlign:"center",pointerEvents:"none",zIndex:200,maxWidth:"85%",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px"},children:t.map((o,l)=>i.jsx("span",{style:{display:"inline-block",fontSize:e.fontSize,lineHeight:1.4,color:e.color,background:e.background||"transparent",padding:e.background?"2px 10px":"0",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",textShadow:e.background?"none":"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.8)"},dangerouslySetInnerHTML:{__html:o}},l))})}const be=c.createContext(!0);function ft({src:a="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",defaultControls:e=!1,autoplay:t=!1,muted:r=!1,poster:n,className:s,children:o,config:l,onAdLoading:d,onNextEpisode:u,nextEpisodeTitle:h,nextEpisodeThumbnail:p,endCardCountdown:g=5,crossOrigin:m}){const w=c.useRef(null),P=c.useRef(null),[S,A]=c.useState(null),b=c.useRef(null),[y,q]=c.useState(!1),[z,j]=c.useState(!1),k=c.useCallback(()=>j(!0),[]),R=c.useCallback(()=>j(!1),[]),[N,x]=c.useState(!1),{onTouchStart:C,onTouchMove:I,onTouchEnd:$,gestureHint:K}=ut({player:S,skipSec:10}),{isActive:M}=Nr({timeout:3e3,initialVisible:!0});$r({player:S,seekStep:10,enabled:!0,onShowShortcuts:k});const _=c.useMemo(()=>!l?.ads?.enabled||!l.ads.vastUrl&&!l.ads.vmapUrl?null:{enabled:!0,vastUrl:l.ads.vastUrl,vmapUrl:l.ads.vmapUrl,skipAfter:l.ads.skipAfter,timeout:l.ads.timeout,maxWrapperDepth:l.ads.maxWrapperDepth},[l?.ads?.enabled,l?.ads?.vastUrl,l?.ads?.vmapUrl,l?.ads?.skipAfter,l?.ads?.timeout,l?.ads?.maxWrapperDepth]);c.useEffect(()=>{P.current&&(P.current.muted=r)},[r]),c.useEffect(()=>{if(!P.current||!w.current)return;console.log("[Player] Initializing PlayerCore");const V=new ne(P.current);return ne.preloadEngines(),V.container=w.current,A(V),()=>{console.log("[Player] Cleanup called - destroying PlayerCore"),b.current&&(console.log("[Player] Destroying AdManager"),b.current.destroy(),b.current=null),V.destroy(),A(null)}},[]),c.useEffect(()=>{if(!S||!_)return;console.log("[Player] Setting up ads");const V=G=>{q(G),d?.(G)},Y=new Hr(S,_,V);return b.current=Y,Y.setup().catch(G=>{console.error("[Player] Failed to setup ads:",G)}),()=>{b.current&&(console.log("[Player] Cleaning up ads"),b.current.destroy(),b.current=null)}},[S,_]),c.useEffect(()=>{!S||!l||S.setConfig(l)},[S,l]);const T=c.useMemo(()=>l?.drm??null,[l?.drm]);return c.useEffect(()=>{!S||!T?.enabled||S.setupDrm(T)},[S,T]),c.useEffect(()=>{S&&a&&(console.log("[Player] Setting source:",a),S.setSource(a).catch(V=>{console.error("[Player] setSource failed:",V)}))},[S,a]),c.useEffect(()=>{if(!S||!u)return;const V=S.getVideoElement();if(!V)return;const Y=()=>x(!0);return V.addEventListener("ended",Y),()=>V.removeEventListener("ended",Y)},[S,u]),i.jsxs(zr,{children:[i.jsxs("div",{ref:w,role:"region","aria-label":"Video Player",className:`playron-wrapper ${s||""}`,onTouchStart:C,onTouchMove:I,onTouchEnd:$,style:{position:"relative",backgroundColor:"#000",overflow:"hidden",cursor:M?"default":"none"},children:[i.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),i.jsx("video",{ref:P,className:`virtus-video-element ${s||""}`,style:{width:"100%",height:"100%",display:"block",aspectRatio:"16/9",objectFit:"cover",objectPosition:"center"},autoPlay:t,muted:r,controls:e,poster:n,playsInline:!0,crossOrigin:m,tabIndex:e?0:-1}),S?i.jsx(at,{playerInstance:S,children:i.jsxs(be.Provider,{value:M,children:[i.jsx(qr,{videoElement:P.current}),i.jsx(gr,{config:l,isAdLoading:y}),i.jsx(dt,{type:K?.type??null,value:K?.value??""}),i.jsx(_r,{drmConfig:l?.drm}),i.jsx(lt,{isOpen:z,onClose:R}),u&&i.jsx(ct,{isVisible:N,onNextEpisode:()=>{x(!1),u()},onDismiss:()=>x(!1),countdownSec:g,nextTitle:h,thumbnail:p}),o]})}):null]}),i.jsx("style",{children:`
117
117
  @keyframes gestureHintFade {
118
118
  0% { opacity: 1; }
119
119
  60% { opacity: 1; }
@@ -167,7 +167,7 @@
167
167
  `).replace(/\r/g,`
168
168
  `).split(`
169
169
  `);let s=0;for(;s<n.length&&!n[s].includes("-->");)s++;for(;s<n.length;){const o=n[s].trim();if(o.includes("-->")){const[l,d]=o.split("-->").map(m=>m.trim()),u=this.parseTime(l),h=this.parseTime(d);s++;const p=[];for(;s<n.length&&n[s].trim()!==""&&!n[s].includes("-->");)p.push(n[s].trim()),s++;const g=p.join(`
170
- `).trim();if(g&&u>=0&&h>u){const m=this.parseCueLine(g,t);m&&r.push({startTime:u,endTime:h,...m})}}else s++}return r}parseCueLine(e,t){const r=e.lastIndexOf("#xywh=");let n,s=0,o=0,l=0,d=0;if(r!==-1){n=e.slice(0,r);const h=e.slice(r+6).split(",").map(Number);h.length===4&&h.every(p=>!isNaN(p))&&([s,o,l,d]=h)}else n=e;const u=this.resolveUrl(n.trim(),t);return u?{url:u,x:s,y:o,w:l,h:d}:null}resolveUrl(e,t){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))return e;try{return new URL(e,t).href}catch{return e}}parseTime(e){const t=e.trim().split(":").map(Number);return t.length===3?t[0]*3600+t[1]*60+t[2]:t.length===2?t[0]*60+t[1]:-1}}const He=160,li=90;function Tt({mode:a="vod",chapters:e=[],timelineEvents:t=[],showTimelineMarkers:r=!1,markerSize:n=12,thumbnailsVttUrl:s,seekBarStyle:o}){const l=c.useContext(be),d=c.useRef(null),[u,h]=c.useState(!1),[p,g]=c.useState(null),[m,w]=c.useState(null),[j,S]=c.useState([]),A=c.useRef(null),{currentTime:b,duration:y,isLive:q,isPlaying:z,playbackRate:L}=O(),{seekTo:k,getDVRRange:R,getBufferedRanges:N}=U(),[x,C]=c.useState(b),I=c.useRef(null),$=c.useRef({time:b,ts:performance.now()});c.useEffect(()=>{$.current={time:b,ts:performance.now()},C(b)},[b]);const K=c.useCallback(()=>{if(z){const{time:v,ts:P}=$.current,D=L??1,B=(performance.now()-P)/1e3,X=Math.min(y||1/0,v+B*D);C(X)}I.current=requestAnimationFrame(K)},[z,L,y]);c.useEffect(()=>(I.current=requestAnimationFrame(K),()=>{I.current!==null&&cancelAnimationFrame(I.current)}),[K]),c.useEffect(()=>{if(!s)return;const v=new Ct;return A.current=v,v.load(s),()=>{v.destroy(),A.current=null}},[s]),c.useEffect(()=>{const v=setInterval(()=>{S(N())},500);return()=>clearInterval(v)},[N]);const M=a==="live"||!!q,_=M?R():null,T=_!==null&&_.end-_.start>5,V=T?_.end-_.start:0,Y=T&&V>0?(x-_.start)/V*100:0,G=M?Math.min(100,Math.max(0,Y)):y>0?x/y*100:0,fe=o?.trackColor??"rgba(255, 255, 255, 0.3)",te=o?.progressColor??(M?"#ff2020":"#6366f1"),se=o?.bufferedColor??"rgba(255, 255, 255, 0.25)",W=o?.handleColor??"#ffffff",we=o?.height??4,oe=o?.borderRadius??2,ce=o?.showHandle!==!1,ke=o?.showTooltip!==!1,de=o?.paddingX??20,Se=o?.paddingY??0,Ae=o?.bottom??64,re=v=>{if(!isFinite(v)||isNaN(v))return"0:00";const P=Math.floor(v/3600),D=Math.floor(v%3600/60),B=Math.floor(v%60);return P>0?`${P}:${D.toString().padStart(2,"0")}:${B.toString().padStart(2,"0")}`:`${D}:${B.toString().padStart(2,"0")}`},ue=v=>{if(!d.current)return 0;const P=d.current.getBoundingClientRect(),D=(v.clientX-P.left)/P.width;return Math.max(0,Math.min(1,D))},me=v=>{if(!(M&&!T)){if(M&&T){k(_.start+v*V);return}y!==0&&k(v*y)}},Ce=v=>{if(M&&!T)return;v.preventDefault(),h(!0);const P=ue(v);me(P)},Te=v=>{if(!d.current)return;const P=ue(v);if(g(P),A.current){const D=T?_.start+P*V:P*y;w(A.current.getThumbnailAt(D))}},Me=()=>{g(null),w(null)};return c.useEffect(()=>{if(!u)return;const v=D=>{if(!d.current)return;const B=ue(D);g(B),me(B)},P=()=>{h(!1)};return window.addEventListener("mousemove",v),window.addEventListener("mouseup",P),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",P)}},[u,y]),i.jsxs("div",{style:{position:"absolute",bottom:`${Ae}px`,left:0,right:0,padding:`${Se}px ${de}px`,zIndex:50,opacity:l?1:0,transition:"opacity 0.3s ease",pointerEvents:l?"auto":"none"},children:[M&&!T&&i.jsxs("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",gap:"8px",padding:"6px 18px",background:"rgba(255, 30, 30, 0.95)",borderRadius:"20px",fontSize:"12px",fontWeight:"700",color:"#fff",letterSpacing:"1.5px",zIndex:10,boxShadow:"0 0 20px rgba(255, 30, 30, 0.6), 0 2px 8px rgba(0,0,0,0.4)"},children:[i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#fff",boxShadow:"0 0 6px rgba(255,255,255,0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),i.jsx("span",{children:"LIVE"})]}),M&&T&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexShrink:0},children:[i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#ff2020",boxShadow:"0 0 10px rgba(255, 32, 32, 0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),i.jsx("span",{style:{fontSize:"11px",fontWeight:"700",color:"#fff",letterSpacing:"1px"},children:"LIVE"})]}),i.jsx(At,{}),i.jsx("div",{style:{flex:1}}),i.jsx(St,{})]}),i.jsxs("div",{ref:d,role:M&&!T?void 0:"slider",tabIndex:M&&!T?void 0:0,"aria-label":M?"DVR seek":"Seek","aria-valuemin":M&&!T?void 0:T?Math.floor(_.start):0,"aria-valuemax":M&&!T?void 0:T?Math.floor(_.end):Math.floor(y)||0,"aria-valuenow":M&&!T?void 0:Math.floor(b),"aria-valuetext":M&&!T?"LIVE":T?`${re(b)} (DVR)`:`${re(b)} of ${re(y)}`,"aria-disabled":M&&!T?!0:void 0,onMouseDown:Ce,onMouseMove:Te,onMouseLeave:Me,onKeyDown:v=>{if(M&&!T)return;const P=5,D=30,B=T?_.start:0,X=T?_.end:y;if(X!==0)switch(v.key){case"ArrowLeft":case"ArrowDown":v.preventDefault(),k(Math.max(B,b-P));break;case"ArrowRight":case"ArrowUp":v.preventDefault(),k(Math.min(X,b+P));break;case"PageDown":v.preventDefault(),k(Math.max(B,b-D));break;case"PageUp":v.preventDefault(),k(Math.min(X,b+D));break;case"Home":v.preventDefault(),k(B);break;case"End":v.preventDefault(),k(X);break}},style:{width:"100%",height:"32px",display:"flex",alignItems:"center",cursor:M&&!T?"default":"pointer",position:"relative",outline:"none"},children:[i.jsxs("div",{style:{position:"absolute",left:0,right:0,height:`${we}px`,backgroundColor:fe,borderRadius:`${oe}px`},children:[!M&&j.map((v,P)=>{if(y<=0)return null;const D=v.start/y*100,B=(v.end-v.start)/y*100;return i.jsx("div",{style:{position:"absolute",left:`${D}%`,top:0,height:"100%",width:`${B}%`,backgroundColor:se,borderRadius:`${oe}px`,pointerEvents:"none"}},P)}),i.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${G}%`,backgroundColor:te,borderRadius:`${oe}px`,transition:"none"}}),!M&&e.map(v=>{const P=y>0?v.startTime/y*100:0;return i.jsx("div",{style:{position:"absolute",left:`${P}%`,top:"50%",transform:"translate(-50%, -50%)",width:"3px",height:"12px",backgroundColor:"rgba(255, 255, 255, 0.8)",borderRadius:"1px",pointerEvents:"none"}},v.id)}),r&&!M&&y>0&&t.map((v,P)=>{const D=v.time/y*100;return D<0||D>100?null:i.jsx(ai,{event:v,position:D,size:n,showTooltip:!0,onClick:B=>k(B)},`timeline-${P}-${v.time}`)}),T&&i.jsx("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:"3px",height:"14px",backgroundColor:"#ff2020",boxShadow:"0 0 8px rgba(255,32,32,0.7)",borderRadius:"1px",pointerEvents:"none",zIndex:5},title:"Live edge"}),ce&&(!M||T)&&p!==null&&i.jsx("div",{style:{position:"absolute",left:`${p*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"14px",height:"14px",backgroundColor:W,borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:999}}),ce&&(!M||T)&&i.jsx("div",{style:{position:"absolute",left:`${G}%`,top:"50%",transform:"translate(-50%, -50%)",width:u?"16px":"14px",height:u?"16px":"14px",backgroundColor:W,borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:1e3,opacity:u||p!==null?1:0,transition:u?"none":"all 0.15s ease"}})]}),ke&&(!M||T)&&p!==null&&(()=>{const v=T?_.start+p*V:p*y,P=d.current?.offsetWidth??0,D=p*100,B=p*P,X=He/2;let ae="-50%";return B<X?ae="0%":P-B<X&&(ae="-100%"),m?i.jsxs("div",{style:{position:"absolute",left:`${D}%`,bottom:"24px",transform:`translateX(${ae})`,pointerEvents:"none",zIndex:2e3,display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[i.jsx("div",{style:{width:`${m.w||He}px`,height:`${m.h||li}px`,backgroundImage:`url("${m.url}")`,backgroundPosition:m.w?`-${m.x}px -${m.y}px`:"center center",backgroundRepeat:"no-repeat",backgroundSize:m.w?"auto":"cover",borderRadius:"4px",boxShadow:"0 4px 16px rgba(0,0,0,0.6)",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0}}),i.jsx("div",{style:{padding:"2px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"600",borderRadius:"3px",whiteSpace:"nowrap"},children:re(v)})]}):i.jsx("div",{style:{position:"absolute",left:`${D}%`,bottom:"20px",transform:`translateX(${ae})`,padding:"4px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"500",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:2e3},children:re(v)})})()]}),i.jsx("style",{children:`
170
+ `).trim();if(g&&u>=0&&h>u){const m=this.parseCueLine(g,t);m&&r.push({startTime:u,endTime:h,...m})}}else s++}return r}parseCueLine(e,t){const r=e.lastIndexOf("#xywh=");let n,s=0,o=0,l=0,d=0;if(r!==-1){n=e.slice(0,r);const h=e.slice(r+6).split(",").map(Number);h.length===4&&h.every(p=>!isNaN(p))&&([s,o,l,d]=h)}else n=e;const u=this.resolveUrl(n.trim(),t);return u?{url:u,x:s,y:o,w:l,h:d}:null}resolveUrl(e,t){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))return e;try{return new URL(e,t).href}catch{return e}}parseTime(e){const t=e.trim().split(":").map(Number);return t.length===3?t[0]*3600+t[1]*60+t[2]:t.length===2?t[0]*60+t[1]:-1}}const He=160,li=90;function Tt({mode:a="vod",chapters:e=[],timelineEvents:t=[],showTimelineMarkers:r=!1,markerSize:n=12,thumbnailsVttUrl:s,seekBarStyle:o}){const l=c.useContext(be),d=c.useRef(null),[u,h]=c.useState(!1),[p,g]=c.useState(null),[m,w]=c.useState(null),[P,S]=c.useState([]),A=c.useRef(null),{currentTime:b,duration:y,isLive:q,isPlaying:z,playbackRate:j}=O(),{seekTo:k,getDVRRange:R,getBufferedRanges:N}=U(),[x,C]=c.useState(b),I=c.useRef(null),$=c.useRef({time:b,ts:performance.now()});c.useEffect(()=>{$.current={time:b,ts:performance.now()},C(b)},[b]);const K=c.useCallback(()=>{if(z){const{time:v,ts:L}=$.current,D=j??1,B=(performance.now()-L)/1e3,X=Math.min(y||1/0,v+B*D);C(X)}I.current=requestAnimationFrame(K)},[z,j,y]);c.useEffect(()=>(I.current=requestAnimationFrame(K),()=>{I.current!==null&&cancelAnimationFrame(I.current)}),[K]),c.useEffect(()=>{if(!s)return;const v=new Ct;return A.current=v,v.load(s),()=>{v.destroy(),A.current=null}},[s]),c.useEffect(()=>{const v=setInterval(()=>{S(N())},500);return()=>clearInterval(v)},[N]);const M=a==="live"||!!q,_=M?R():null,T=_!==null&&_.end-_.start>5,V=T?_.end-_.start:0,Y=T&&V>0?(x-_.start)/V*100:0,G=M?Math.min(100,Math.max(0,Y)):y>0?x/y*100:0,fe=o?.trackColor??"rgba(255, 255, 255, 0.3)",te=o?.progressColor??(M?"#ff2020":"#6366f1"),se=o?.bufferedColor??"rgba(255, 255, 255, 0.25)",W=o?.handleColor??"#ffffff",we=o?.height??4,oe=o?.borderRadius??2,ce=o?.showHandle!==!1,ke=o?.showTooltip!==!1,de=o?.paddingX??20,Se=o?.paddingY??0,Ae=o?.bottom??64,re=v=>{if(!isFinite(v)||isNaN(v))return"0:00";const L=Math.floor(v/3600),D=Math.floor(v%3600/60),B=Math.floor(v%60);return L>0?`${L}:${D.toString().padStart(2,"0")}:${B.toString().padStart(2,"0")}`:`${D}:${B.toString().padStart(2,"0")}`},ue=v=>{if(!d.current)return 0;const L=d.current.getBoundingClientRect(),D=(v.clientX-L.left)/L.width;return Math.max(0,Math.min(1,D))},me=v=>{if(!(M&&!T)){if(M&&T){k(_.start+v*V);return}y!==0&&k(v*y)}},Ce=v=>{if(M&&!T)return;v.preventDefault(),h(!0);const L=ue(v);me(L)},Te=v=>{if(!d.current)return;const L=ue(v);if(g(L),A.current){const D=T?_.start+L*V:L*y;w(A.current.getThumbnailAt(D))}},Me=()=>{g(null),w(null)};return c.useEffect(()=>{if(!u)return;const v=D=>{if(!d.current)return;const B=ue(D);g(B),me(B)},L=()=>{h(!1)};return window.addEventListener("mousemove",v),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",L)}},[u,y]),i.jsxs("div",{style:{position:"absolute",bottom:`${Ae}px`,left:0,right:0,padding:`${Se}px ${de}px`,zIndex:50,opacity:l?1:0,transition:"opacity 0.3s ease",pointerEvents:l?"auto":"none"},children:[M&&!T&&i.jsxs("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",gap:"8px",padding:"6px 18px",background:"rgba(255, 30, 30, 0.95)",borderRadius:"20px",fontSize:"12px",fontWeight:"700",color:"#fff",letterSpacing:"1.5px",zIndex:10,boxShadow:"0 0 20px rgba(255, 30, 30, 0.6), 0 2px 8px rgba(0,0,0,0.4)"},children:[i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#fff",boxShadow:"0 0 6px rgba(255,255,255,0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),i.jsx("span",{children:"LIVE"})]}),M&&T&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexShrink:0},children:[i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#ff2020",boxShadow:"0 0 10px rgba(255, 32, 32, 0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),i.jsx("span",{style:{fontSize:"11px",fontWeight:"700",color:"#fff",letterSpacing:"1px"},children:"LIVE"})]}),i.jsx(At,{}),i.jsx("div",{style:{flex:1}}),i.jsx(St,{})]}),i.jsxs("div",{ref:d,role:M&&!T?void 0:"slider",tabIndex:M&&!T?void 0:0,"aria-label":M?"DVR seek":"Seek","aria-valuemin":M&&!T?void 0:T?Math.floor(_.start):0,"aria-valuemax":M&&!T?void 0:T?Math.floor(_.end):Math.floor(y)||0,"aria-valuenow":M&&!T?void 0:Math.floor(b),"aria-valuetext":M&&!T?"LIVE":T?`${re(b)} (DVR)`:`${re(b)} of ${re(y)}`,"aria-disabled":M&&!T?!0:void 0,onMouseDown:Ce,onMouseMove:Te,onMouseLeave:Me,onKeyDown:v=>{if(M&&!T)return;const L=5,D=30,B=T?_.start:0,X=T?_.end:y;if(X!==0)switch(v.key){case"ArrowLeft":case"ArrowDown":v.preventDefault(),k(Math.max(B,b-L));break;case"ArrowRight":case"ArrowUp":v.preventDefault(),k(Math.min(X,b+L));break;case"PageDown":v.preventDefault(),k(Math.max(B,b-D));break;case"PageUp":v.preventDefault(),k(Math.min(X,b+D));break;case"Home":v.preventDefault(),k(B);break;case"End":v.preventDefault(),k(X);break}},style:{width:"100%",height:"32px",display:"flex",alignItems:"center",cursor:M&&!T?"default":"pointer",position:"relative",outline:"none"},children:[i.jsxs("div",{style:{position:"absolute",left:0,right:0,height:`${we}px`,backgroundColor:fe,borderRadius:`${oe}px`},children:[!M&&P.map((v,L)=>{if(y<=0)return null;const D=v.start/y*100,B=(v.end-v.start)/y*100;return i.jsx("div",{style:{position:"absolute",left:`${D}%`,top:0,height:"100%",width:`${B}%`,backgroundColor:se,borderRadius:`${oe}px`,pointerEvents:"none"}},L)}),i.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${G}%`,backgroundColor:te,borderRadius:`${oe}px`,transition:"none"}}),!M&&e.map(v=>{const L=y>0?v.startTime/y*100:0;return i.jsx("div",{style:{position:"absolute",left:`${L}%`,top:"50%",transform:"translate(-50%, -50%)",width:"3px",height:"12px",backgroundColor:"rgba(255, 255, 255, 0.8)",borderRadius:"1px",pointerEvents:"none"}},v.id)}),r&&!M&&y>0&&t.map((v,L)=>{const D=v.time/y*100;return D<0||D>100?null:i.jsx(ai,{event:v,position:D,size:n,showTooltip:!0,onClick:B=>k(B)},`timeline-${L}-${v.time}`)}),T&&i.jsx("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:"3px",height:"14px",backgroundColor:"#ff2020",boxShadow:"0 0 8px rgba(255,32,32,0.7)",borderRadius:"1px",pointerEvents:"none",zIndex:5},title:"Live edge"}),ce&&(!M||T)&&p!==null&&i.jsx("div",{style:{position:"absolute",left:`${p*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"14px",height:"14px",backgroundColor:W,borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:999}}),ce&&(!M||T)&&i.jsx("div",{style:{position:"absolute",left:`${G}%`,top:"50%",transform:"translate(-50%, -50%)",width:u?"16px":"14px",height:u?"16px":"14px",backgroundColor:W,borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:1e3,opacity:u||p!==null?1:0,transition:u?"none":"all 0.15s ease"}})]}),ke&&(!M||T)&&p!==null&&(()=>{const v=T?_.start+p*V:p*y,L=d.current?.offsetWidth??0,D=p*100,B=p*L,X=He/2;let ae="-50%";return B<X?ae="0%":L-B<X&&(ae="-100%"),m?i.jsxs("div",{style:{position:"absolute",left:`${D}%`,bottom:"24px",transform:`translateX(${ae})`,pointerEvents:"none",zIndex:2e3,display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[i.jsx("div",{style:{width:`${m.w||He}px`,height:`${m.h||li}px`,backgroundImage:`url("${m.url}")`,backgroundPosition:m.w?`-${m.x}px -${m.y}px`:"center center",backgroundRepeat:"no-repeat",backgroundSize:m.w?"auto":"cover",borderRadius:"4px",boxShadow:"0 4px 16px rgba(0,0,0,0.6)",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0}}),i.jsx("div",{style:{padding:"2px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"600",borderRadius:"3px",whiteSpace:"nowrap"},children:re(v)})]}):i.jsx("div",{style:{position:"absolute",left:`${D}%`,bottom:"20px",transform:`translateX(${ae})`,padding:"4px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"500",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:2e3},children:re(v)})})()]}),i.jsx("style",{children:`
171
171
  @keyframes pulse {
172
172
  0%, 100% {
173
173
  opacity: 1;
@@ -176,7 +176,7 @@
176
176
  opacity: 0.5;
177
177
  }
178
178
  }
179
- `})]})}function Mt({seconds:a=15,iconSize:e=24,hoverBackground:t,icon:r}){const{skipBackward:n}=U(),{isLive:s}=O();if(s)return null;const o=typeof t=="string"?t:t===!1?"transparent":void 0;return i.jsx("button",{className:`virtus-btn virtus-skip-backward-button ${ge.controlButton}`,"aria-label":`Skip Backward ${a}s`,onClick:()=>n(a),style:{position:"relative",...o!==void 0?{"--btn-hover-bg":o}:{}},children:r??i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[i.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("path",{d:"M2 12l-2-2m2 2l2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:a})]})})}function Pt({seconds:a=15,iconSize:e=24,hoverBackground:t,icon:r}){const{skipForward:n}=U(),{isLive:s}=O();if(s)return null;const o=typeof t=="string"?t:t===!1?"transparent":void 0;return i.jsx("button",{className:`virtus-btn virtus-skip-forward-button ${ge.controlButton}`,"aria-label":`Skip Forward ${a}s`,onClick:()=>n(a),style:{position:"relative",...o!==void 0?{"--btn-hover-bg":o}:{}},children:r??i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[i.jsx("path",{d:"M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10-10-4.5-10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("path",{d:"M22 12l2-2m-2 2l-2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:a})]})})}function Lt({sliderDirection:a="right",theme:e,iconSize:t=20,hoverBackground:r}){const n={sliderBackground:e?.sliderBackground??"rgba(10, 10, 20, 0.88)",borderColor:e?.borderColor??"rgba(255,255,255,0.1)",buttonBackground:e?.buttonBackground??"rgba(255,255,255,0.1)",buttonHoverBackground:e?.buttonHoverBackground??"rgba(255,255,255,0.2)",iconColor:e?.iconColor??"#fff",trackColor:e?.trackColor??"rgba(255,255,255,0.3)",fillColor:e?.fillColor??"#3b82f6",handleColor:e?.handleColor??"#fff"},{isMuted:s,volume:o}=O(),{toggleMute:l,setVolume:d}=U(),[u,h]=c.useState(!1),[p,g]=c.useState(!1),m=c.useRef(null),w=a==="top"||a==="bottom",j=c.useCallback((x,C)=>{if(!m.current)return;const I=m.current.getBoundingClientRect(),$=w?Math.max(0,Math.min(1,1-(C-I.top)/I.height)):Math.max(0,Math.min(1,(x-I.left)/I.width));d($)},[d,w]),S=c.useCallback(x=>{g(!0),s&&l(),j(x.clientX,x.clientY)},[j,s,l]);c.useEffect(()=>{if(!p)return;const x=I=>j(I.clientX,I.clientY),C=()=>g(!1);return window.addEventListener("mousemove",x),window.addEventListener("mouseup",C),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",C)}},[p,j]);const A=p?o:s?0:o,b=u||p,y={position:"absolute",opacity:b?1:0,transition:"all 0.25s ease",pointerEvents:b?"auto":"none",zIndex:10,background:n.sliderBackground,backdropFilter:"blur(12px)",boxShadow:"4px 0 16px rgba(0,0,0,0.5)",overflow:"hidden"},q=(()=>{const x=`1px solid ${n.borderColor}`;switch(a){case"left":return{...y,right:"40px",top:"0",width:b?"118px":"0px",height:"40px",paddingRight:"8px",borderRadius:"8px 0 0 8px",border:x,borderRight:"none"};case"top":return{...y,bottom:"40px",left:"0",width:"40px",height:b?"118px":"0px",paddingBottom:"8px",borderRadius:"8px 8px 0 0",border:x,borderBottom:"none"};case"bottom":return{...y,top:"40px",left:"0",width:"40px",height:b?"118px":"0px",paddingTop:"8px",borderRadius:"0 0 8px 8px",border:x,borderTop:"none"};default:return{...y,left:"40px",top:"0",width:b?"118px":"0px",height:"40px",paddingLeft:"8px",borderRadius:"0 8px 8px 0",border:x,borderLeft:"none"}}})(),z=w?{width:"40px",height:"110px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative",outline:"none"}:{width:"110px",height:"40px",display:"flex",alignItems:"center",cursor:"pointer",position:"relative",paddingRight:"8px",outline:"none"},L=w?{width:"4px",height:"100%",backgroundColor:n.trackColor,borderRadius:"2px",position:"relative"}:{width:"100%",height:"4px",backgroundColor:n.trackColor,borderRadius:"2px",position:"relative"},k=w?{position:"absolute",bottom:0,left:0,right:0,height:`${A*100}%`,backgroundColor:n.fillColor,borderRadius:"2px",transition:p?"none":"height 0.1s ease"}:{position:"absolute",left:0,top:0,bottom:0,width:`${A*100}%`,backgroundColor:n.fillColor,borderRadius:"2px",transition:p?"none":"width 0.1s ease"},R=p?14:12,N=w?{position:"absolute",bottom:`calc(${A*100}% - ${A*R}px)`,left:"50%",transform:"translateX(-50%)",width:`${R}px`,height:`${R}px`,backgroundColor:n.handleColor,borderRadius:"50%",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",transition:p?"none":"all 0.2s ease"}:{position:"absolute",left:`calc(${A*100}% - ${A*R}px)`,top:"50%",transform:"translateY(-50%)",width:`${R}px`,height:`${R}px`,backgroundColor:n.handleColor,borderRadius:"50%",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",transition:p?"none":"all 0.2s ease"};return i.jsxs("div",{className:"virtus-volume-control",style:{position:"relative",display:"flex",alignItems:"center",height:"40px",width:"40px"},onMouseLeave:()=>{p||h(!1)},children:[i.jsx("button",{className:"virtus-btn virtus-mute-button","aria-label":s?"Unmute":"Mute",onClick:l,style:{background:r===!1?"transparent":n.buttonBackground,border:"none",borderRadius:"8px",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",flexShrink:0,position:"relative",zIndex:1},onMouseEnter:x=>{h(!0),x.currentTarget.style.background=typeof r=="string"?r:r===!1?"transparent":n.buttonHoverBackground,x.currentTarget.style.transform="scale(1.05)"},onMouseLeave:x=>{x.currentTarget.style.background=r===!1?"transparent":n.buttonBackground,x.currentTarget.style.transform="scale(1)"},children:s||o===0?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06ZM17.78 9.22a.75.75 0 1 0-1.06 1.06L18.44 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06l1.72-1.72 1.72 1.72a.75.75 0 1 0 1.06-1.06L20.56 12l1.72-1.72a.75.75 0 1 0-1.06-1.06l-1.72 1.72-1.72-1.72Z"})}):o<.5?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:[i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"}),i.jsx("path",{d:"M18.584 5.106a.75.75 0 0 1 1.06 0 11.5 11.5 0 0 1 0 13.588.75.75 0 0 1-1.06-1.06 10 10 0 0 0 0-11.468.75.75 0 0 1 0-1.06Z"}),i.jsx("path",{d:"M15.932 7.757a.75.75 0 0 1 1.061 0 6.5 6.5 0 0 1 0 8.486.75.75 0 0 1-1.06-1.06 5 5 0 0 0 0-6.366.75.75 0 0 1 0-1.06Z"})]})}),i.jsx("div",{onMouseEnter:()=>h(!0),style:q,children:i.jsx("div",{ref:m,role:"slider",tabIndex:0,"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(A*100),"aria-valuetext":s?"Muted":`${Math.round(A*100)}%`,onMouseDown:S,onKeyDown:x=>{const $=s?0:o;switch(x.key){case"ArrowRight":case"ArrowUp":x.preventDefault(),d(Math.min(1,$+.05));break;case"ArrowLeft":case"ArrowDown":x.preventDefault(),d(Math.max(0,$-.05));break;case"PageUp":x.preventDefault(),d(Math.min(1,$+.2));break;case"PageDown":x.preventDefault(),d(Math.max(0,$-.2));break;case"Home":x.preventDefault(),d(0);break;case"End":x.preventDefault(),d(1);break;case"m":case"M":x.preventDefault(),l();break}},style:z,children:i.jsxs("div",{style:L,children:[i.jsx("div",{style:k}),i.jsx("div",{style:N})]})})})]})}const ci=[.25,.5,.75,1,1.25,1.5,1.75,2];function di(){const{setPlaybackRate:a}=U(),[e,t]=c.useState(1),r=c.useCallback(s=>{a(s),t(s)},[a]),n=e===1?"1×":`${e}×`;return i.jsxs(bt,{children:[i.jsx(Et,{children:i.jsx("button",{className:"virtus-speed-button","aria-label":`Playback speed: ${n}`,"aria-haspopup":"true",style:{background:"transparent",border:"none",color:"white",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",height:"40px",minWidth:"40px",transition:"all 0.2s ease",fontSize:"13px",fontWeight:"600",letterSpacing:"-0.3px",whiteSpace:"nowrap"},onMouseEnter:s=>{s.currentTarget.style.background="rgba(255, 255, 255, 0.15)",s.currentTarget.style.transform="scale(1.05)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.transform="scale(1)"},title:"Playback speed",children:n})}),i.jsx(wt,{placement:"top-right",children:i.jsxs("div",{style:{minWidth:"130px"},children:[i.jsx("div",{style:{padding:"8px 12px",fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.6)",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Speed"}),[...ci].reverse().map(s=>i.jsx(_e,{selected:e===s,onClick:()=>r(s),children:i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:i.jsx("span",{children:s===1?"1× (Normal)":`${s}×`})})},s))]})})]})}const Ve=c.createContext({textColor:"#fff",accentColor:"#6366f1",accentAlpha15:"rgba(99,102,241,0.15)",accentAlpha30:"rgba(99,102,241,0.3)",borderColor:"rgba(255,255,255,0.07)",fontSize:"13.5px"});function ze(a,e){const t=a.replace("#",""),r=t.length===3?t.split("").map(l=>l+l).join(""):t,n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),o=parseInt(r.slice(4,6),16);return isNaN(n)||isNaN(s)||isNaN(o)?`rgba(99,102,241,${e})`:`rgba(${n},${s},${o},${e})`}const ui=60,hi=[.25,.5,.75,1,1.25,1.5,1.75,2],pi={position:"absolute",backdropFilter:"blur(16px)",borderRadius:"14px",overflow:"hidden",zIndex:9999,animation:"settingsFadeIn 0.18s ease-out",fontFamily:"system-ui, -apple-system, sans-serif",transition:"width 0.2s ease"},gi={display:"flex",alignItems:"center",gap:"8px",padding:"11px 14px",fontSize:"13px",fontWeight:600},fi={display:"flex",alignItems:"center",width:"100%",padding:"9px 14px",background:"transparent",border:"none",cursor:"pointer",fontSize:"13.5px",textAlign:"left",gap:"10px",outline:"none",transition:"background 0.12s"};function qe({values:a,color:e,gradId:t}){if(a.length<2)return i.jsx("svg",{width:292,height:52,style:{display:"block"},children:i.jsx("line",{x1:0,y1:52/2,x2:292,y2:52/2,stroke:"rgba(255,255,255,0.08)",strokeWidth:1,strokeDasharray:"4 4"})});const s=Math.max(...a,.001),o=a.map((h,p)=>[p/(ui-1)*292,48-h/s*42]),l=o.map(([h,p],g)=>`${g===0?"M":"L"}${h.toFixed(1)},${p.toFixed(1)}`).join(" "),d=l+` L${292 .toFixed(1)},52 L0,52 Z`,u=o[o.length-1];return i.jsxs("svg",{width:292,height:52,style:{display:"block",overflow:"visible"},children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:t,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:e,stopOpacity:.4}),i.jsx("stop",{offset:"100%",stopColor:e,stopOpacity:.02})]})}),i.jsx("path",{d,fill:`url(#${t})`}),i.jsx("path",{d:l,fill:"none",stroke:e,strokeWidth:1.8,strokeLinejoin:"round",strokeLinecap:"round"}),i.jsx("circle",{cx:u[0],cy:u[1],r:3.5,fill:e}),i.jsx("circle",{cx:u[0],cy:u[1],r:6,fill:e,fillOpacity:.25})]})}function F({label:a,value:e,icon:t,onClick:r,selected:n=!1,isBack:s=!1}){const[o,l]=c.useState(!1),{textColor:d,accentColor:u,accentAlpha15:h,accentAlpha30:p,fontSize:g}=c.useContext(Ve);return i.jsxs("button",{role:"menuitem","aria-checked":n,onClick:r,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{...fi,color:d,fontSize:g,background:o?"rgba(255,255,255,0.07)":n?h:"transparent",fontWeight:n?600:400,justifyContent:"space-between"},children:[i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[s?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"2.5",style:{flexShrink:0},children:i.jsx("polyline",{points:"15 18 9 12 15 6"})}):t?i.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:n?p:"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:n?u:"rgba(255,255,255,0.65)",transition:"background 0.15s, color 0.15s"},children:t}):n?i.jsx("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:u,strokeWidth:"3",style:{flexShrink:0},children:i.jsx("polyline",{points:"20 6 9 17 4 12"})}):i.jsx("span",{style:{display:"inline-block",width:"14px",flexShrink:0}}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),e!==void 0&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[i.jsx("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.45)",maxWidth:"90px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.35)",strokeWidth:"2.5",children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})]})]})}function Ke(){const{borderColor:a}=c.useContext(Ve);return i.jsx("div",{style:{height:"1px",background:a,margin:"2px 0"}})}function jt({theme:a,panelPosition:e,iconSize:t=20,hoverBackground:r,gearIcon:n}={}){const s=a?.accentColor??"#6366f1",o=a?.textColor??"#fff",l=a?.background??"rgba(12, 12, 20, 0.97)",d=a?.borderColor??"rgba(255,255,255,0.1)",u=a?.fontSize??"13.5px",h={textColor:o,accentColor:s,accentAlpha15:s.startsWith("#")?ze(s,.15):"rgba(99,102,241,0.15)",accentAlpha30:s.startsWith("#")?ze(s,.3):"rgba(99,102,241,0.3)",borderColor:d.replace("0.1)","0.07)"),fontSize:u},p={...gi,color:o,fontSize:u,borderBottom:`1px solid ${d.replace("0.1)","0.08)")}`},g=e?.vertical??"top",m=e?.horizontal??"right",{setQuality:w,setAudioTrack:j,setPlaybackRate:S,setSubtitleTrack:A,getPlayerStats:b}=U(),y=pe(),{playbackRate:q=1,isLive:z}=O(),{style:L,setStyle:k}=gt(),[R,N]=c.useState(!1),[x,C]=c.useState("root");c.useEffect(()=>{z&&x==="speed"&&C("root")},[z,x]);const[I,$]=c.useState([]),[K,M]=c.useState(null),[_,T]=c.useState([]),[V,Y]=c.useState(""),[G,fe]=c.useState([]),[te,se]=c.useState(null),[W,we]=c.useState(null),[oe,ce]=c.useState([]);c.useEffect(()=>{const f=()=>{$(y.getAvailableQualities()),M(y.getQuality()),T(y.getAvailableAudioTracks()),Y(y.getAudioTrack()),fe(y.getSubtitleTracks()),se(y.getActiveSubtitleLanguage())};y.events.on("tracksready",f),y.events.on("streamTypeDetected",f),y.events.on("qualitychange",f),y.events.on("loadedmetadata",f),f();const H=setTimeout(f,100);return()=>{y.events.off("tracksready",f),y.events.off("streamTypeDetected",f),y.events.off("qualitychange",f),y.events.off("loadedmetadata",f),clearTimeout(H)}},[y]),c.useEffect(()=>{R&&($(y.getAvailableQualities()),M(y.getQuality()),T(y.getAvailableAudioTracks()),Y(y.getAudioTrack()),fe(y.getSubtitleTracks()),se(y.getActiveSubtitleLanguage()))},[R,y]);const ke=_.length>1;c.useEffect(()=>{if(x!=="statistics")return;const f=()=>{const ye=b();we(ye),ce(Pe=>[...Pe.slice(-59),ye])};f();const H=setInterval(f,1e3);return()=>{clearInterval(H),ce([])}},[x,b]);const de=c.useRef(null);c.useEffect(()=>{if(!R)return;const f=H=>{de.current&&!de.current.contains(H.target)&&(N(!1),C("root"))};return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)},[R]),c.useEffect(()=>{if(!R)return;const f=H=>{H.key==="Escape"&&(N(!1),C("root")),H.key==="Backspace"&&x!=="root"&&C("root")};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[R,x]);const Se=c.useCallback(()=>{N(f=>(f&&C("root"),!f))},[]),Ae=K?K.id==="auto"?"Auto":K.label:"Auto",re=q===1?"1×":`${q}×`,ue=_.find(f=>f.id===V)?.label??"Auto",me=te===null?"Off":G.find(f=>f.language===te)?.label??te,Ce=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("path",{d:"M8 21h8M12 17v4"}),i.jsx("path",{d:"m7 8 2 2 4-4 2 2"})]}),Te=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0"}),i.jsx("path",{d:"M12 2a10 10 0 0 1 7.39 16.74M12 2A10 10 0 0 0 4.61 18.74"}),i.jsx("path",{d:"m16.24 7.76-2.12 2.12"})]}),Me=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),i.jsx("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]}),v=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),i.jsx("line",{x1:"9",y1:"10",x2:"15",y2:"10"}),i.jsx("line",{x1:"9",y1:"14",x2:"12",y2:"14"})]}),P=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"}),i.jsx("polyline",{points:"16 16 12 20 8 16"})]}),D=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),i.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),i.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),B=()=>i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:p,children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]}),i.jsxs("div",{style:{padding:"4px 0"},children:[i.jsx(F,{icon:Ce,label:"Quality",value:Ae,onClick:()=>C("quality")}),!z&&i.jsx(F,{icon:Te,label:"Speed",value:re,onClick:()=>C("speed")}),ke&&i.jsx(F,{icon:Me,label:"Audio Track",value:ue,onClick:()=>C("audio")}),i.jsx(Ke,{}),i.jsx(F,{icon:v,label:"Subtitles",value:me,onClick:()=>C("subtitles")}),i.jsx(F,{icon:P,label:"Subtitle Style",value:`${L.fontSize}px`,onClick:()=>C("subtitleStyle")}),i.jsx(Ke,{}),i.jsx(F,{icon:D,label:"Statistics",onClick:()=>C("statistics")})]})]}),X=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Quality",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"4px 0",maxHeight:"280px",overflowY:"auto"},children:[I.map(f=>i.jsx(F,{label:f.id==="auto"?"Auto":f.label,selected:K?.id===f.id,onClick:()=>{w(f.id),M(f),N(!1),C("root")}},f.id)),I.length===0&&i.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No quality levels available"})]})]}),ae=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Speed",isBack:!0,onClick:()=>C("root")})}),i.jsx("div",{style:{padding:"4px 0"},children:hi.map(f=>i.jsx(F,{label:f===1?"1× (Normal)":`${f}×`,selected:q===f,onClick:()=>{S(f),N(!1),C("root")}},f))})]}),Rt=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Audio Track",isBack:!0,onClick:()=>C("root")})}),i.jsx("div",{style:{padding:"4px 0"},children:_.map(f=>i.jsx(F,{label:f.label||f.language||f.id,selected:V===f.id,onClick:()=>{j(f.id),Y(f.id),N(!1),C("root")}},f.id))})]}),Dt=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Subtitles",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"4px 0"},children:[i.jsx(F,{label:"Off",selected:te===null,onClick:()=>{A(null),se(null),N(!1),C("root")}},"off"),G.map((f,H)=>i.jsx(F,{label:f.label||f.language,selected:te===f.language,onClick:()=>{A(f.language),se(f.language),N(!1),C("root")}},f.url||`${f.language}-${H}`)),G.length===0&&i.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No subtitle tracks available"})]})]}),It=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Subtitle Style",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"8px 14px 12px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Position"}),i.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[L.bottomOffset,"px from bottom"]})]}),i.jsx("input",{type:"range",min:10,max:200,step:5,value:L.bottomOffset,onChange:f=>k({bottomOffset:Number(f.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Font Size"}),i.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[L.fontSize,"px"]})]}),i.jsx("input",{type:"range",min:12,max:40,step:1,value:L.fontSize,onChange:f=>k({fontSize:Number(f.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Background"}),i.jsx("button",{onClick:()=>k({background:L.background?"":"rgba(0,0,0,0.75)"}),style:{padding:"4px 12px",borderRadius:"6px",border:"1px solid rgba(255,255,255,0.2)",background:L.background?"#3b82f6":"transparent",color:"#fff",fontSize:"12px",cursor:"pointer"},children:L.background?"On":"Off"})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Text Color"}),i.jsx("div",{style:{display:"flex",gap:"6px"},children:["#ffffff","#ffff00","#00ff00","#00cfff"].map(f=>i.jsx("button",{onClick:()=>k({color:f}),title:f,style:{width:"22px",height:"22px",borderRadius:"50%",background:f,border:L.color===f?"2px solid #3b82f6":"2px solid transparent",cursor:"pointer",outline:"none",padding:0,flexShrink:0}},f))})]})]})]}),_t=()=>{const f=oe.map(Z=>Z.bandwidth),H=oe.map(Z=>Z.bufferHealth),ye=W?.bandwidth??0,Pe=W?.bufferHealth??0,Bt=Z=>Z>=1e3?`${(Z/1e3).toFixed(2)} Mbps`:`${Z.toFixed(0)} kbps`,ve=(Z,$t)=>i.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",borderRadius:"8px",padding:"7px 10px",flex:"1 1 0",minWidth:0},children:[i.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.4)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:Z}),i.jsx("div",{style:{fontSize:"12px",color:"#fff",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$t})]}),xe=W?.segmentUrl??"",Nt=xe.length>36?"…"+xe.slice(-36):xe||"—";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{...p,justifyContent:"space-between"},children:[i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:i.jsx(F,{label:"Statistics",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",paddingRight:"14px",flexShrink:0},children:[i.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#22c55e",boxShadow:"0 0 6px #22c55e",animation:"statsPulse 1.6s ease-in-out infinite",display:"inline-block"}}),i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.4)"},children:"LIVE"})]})]}),i.jsxs("div",{style:{padding:"0 14px 12px",overflowY:"auto",maxHeight:"420px"},children:[i.jsxs("div",{style:{marginTop:"12px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.45)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Connection Speed"}),i.jsx("span",{style:{fontSize:"16px",fontWeight:600,color:"#4ade80",fontFamily:"monospace"},children:W?Bt(ye):"—"})]}),i.jsx("div",{style:{background:"rgba(0,0,0,0.3)",borderRadius:"8px",padding:"6px 8px"},children:i.jsx(qe,{values:f,color:"#4ade80",gradId:"bw-grad"})})]}),i.jsxs("div",{style:{marginTop:"14px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.45)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Buffer Health"}),i.jsx("span",{style:{fontSize:"16px",fontWeight:600,color:"#60a5fa",fontFamily:"monospace"},children:W?`${Pe.toFixed(1)} s`:"—"})]}),i.jsx("div",{style:{background:"rgba(0,0,0,0.3)",borderRadius:"8px",padding:"6px 8px"},children:i.jsx(qe,{values:H,color:"#60a5fa",gradId:"buf-grad"})})]}),i.jsx("div",{style:{height:"1px",background:"rgba(255,255,255,0.07)",margin:"14px 0 12px"}}),i.jsxs("div",{style:{display:"flex",gap:"6px"},children:[ve("Codec",W?.codec||"—"),ve("Resolution",W?.resolution||"—"),ve("Dropped",W?`${W.droppedFrames}/${W.totalFrames}`:"—")]}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[ve("Stream",W?.streamType||"—"),i.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",borderRadius:"8px",padding:"7px 10px",flex:"2 1 0",minWidth:0},children:[i.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.4)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:"Segment"}),i.jsx("div",{style:{fontSize:"11px",color:"rgba(255,255,255,0.7)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:xe,children:Nt})]})]})]}),i.jsx("style",{children:`
179
+ `})]})}function Mt({seconds:a=15,iconSize:e=24,hoverBackground:t,icon:r}){const{skipBackward:n}=U(),{isLive:s}=O();if(s)return null;const o=typeof t=="string"?t:t===!1?"transparent":void 0;return i.jsx("button",{className:`virtus-btn virtus-skip-backward-button ${ge.controlButton}`,"aria-label":`Skip Backward ${a}s`,onClick:()=>n(a),style:{position:"relative",...o!==void 0?{"--btn-hover-bg":o}:{}},children:r??i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[i.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("path",{d:"M2 12l-2-2m2 2l2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:a})]})})}function Pt({seconds:a=15,iconSize:e=24,hoverBackground:t,icon:r}){const{skipForward:n}=U(),{isLive:s}=O();if(s)return null;const o=typeof t=="string"?t:t===!1?"transparent":void 0;return i.jsx("button",{className:`virtus-btn virtus-skip-forward-button ${ge.controlButton}`,"aria-label":`Skip Forward ${a}s`,onClick:()=>n(a),style:{position:"relative",...o!==void 0?{"--btn-hover-bg":o}:{}},children:r??i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[i.jsx("path",{d:"M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10-10-4.5-10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("path",{d:"M22 12l2-2m-2 2l-2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:a})]})})}function Lt({sliderDirection:a="right",theme:e,iconSize:t=20,hoverBackground:r}){const n={sliderBackground:e?.sliderBackground??"rgba(10, 10, 20, 0.88)",borderColor:e?.borderColor??"rgba(255,255,255,0.1)",buttonBackground:e?.buttonBackground??"rgba(255,255,255,0.1)",buttonHoverBackground:e?.buttonHoverBackground??"rgba(255,255,255,0.2)",iconColor:e?.iconColor??"#fff",trackColor:e?.trackColor??"rgba(255,255,255,0.3)",fillColor:e?.fillColor??"#3b82f6",handleColor:e?.handleColor??"#fff"},{isMuted:s,volume:o}=O(),{toggleMute:l,setVolume:d}=U(),[u,h]=c.useState(!1),[p,g]=c.useState(!1),m=c.useRef(null),w=a==="top"||a==="bottom",P=c.useCallback((x,C)=>{if(!m.current)return;const I=m.current.getBoundingClientRect(),$=w?Math.max(0,Math.min(1,1-(C-I.top)/I.height)):Math.max(0,Math.min(1,(x-I.left)/I.width));d($)},[d,w]),S=c.useCallback(x=>{g(!0),s&&l(),P(x.clientX,x.clientY)},[P,s,l]);c.useEffect(()=>{if(!p)return;const x=I=>P(I.clientX,I.clientY),C=()=>g(!1);return window.addEventListener("mousemove",x),window.addEventListener("mouseup",C),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",C)}},[p,P]);const A=p?o:s?0:o,b=u||p,y={position:"absolute",opacity:b?1:0,transition:"all 0.25s ease",pointerEvents:b?"auto":"none",zIndex:10,background:n.sliderBackground,backdropFilter:"blur(12px)",boxShadow:"4px 0 16px rgba(0,0,0,0.5)",overflow:"hidden"},q=(()=>{const x=`1px solid ${n.borderColor}`;switch(a){case"left":return{...y,right:"40px",top:"0",width:b?"118px":"0px",height:"40px",paddingRight:"8px",borderRadius:"8px 0 0 8px",border:x,borderRight:"none"};case"top":return{...y,bottom:"40px",left:"0",width:"40px",height:b?"118px":"0px",paddingBottom:"8px",borderRadius:"8px 8px 0 0",border:x,borderBottom:"none"};case"bottom":return{...y,top:"40px",left:"0",width:"40px",height:b?"118px":"0px",paddingTop:"8px",borderRadius:"0 0 8px 8px",border:x,borderTop:"none"};default:return{...y,left:"40px",top:"0",width:b?"118px":"0px",height:"40px",paddingLeft:"8px",borderRadius:"0 8px 8px 0",border:x,borderLeft:"none"}}})(),z=w?{width:"40px",height:"110px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative",outline:"none"}:{width:"110px",height:"40px",display:"flex",alignItems:"center",cursor:"pointer",position:"relative",paddingRight:"8px",outline:"none"},j=w?{width:"4px",height:"100%",backgroundColor:n.trackColor,borderRadius:"2px",position:"relative"}:{width:"100%",height:"4px",backgroundColor:n.trackColor,borderRadius:"2px",position:"relative"},k=w?{position:"absolute",bottom:0,left:0,right:0,height:`${A*100}%`,backgroundColor:n.fillColor,borderRadius:"2px",transition:p?"none":"height 0.1s ease"}:{position:"absolute",left:0,top:0,bottom:0,width:`${A*100}%`,backgroundColor:n.fillColor,borderRadius:"2px",transition:p?"none":"width 0.1s ease"},R=p?14:12,N=w?{position:"absolute",bottom:`calc(${A*100}% - ${A*R}px)`,left:"50%",transform:"translateX(-50%)",width:`${R}px`,height:`${R}px`,backgroundColor:n.handleColor,borderRadius:"50%",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",transition:p?"none":"all 0.2s ease"}:{position:"absolute",left:`calc(${A*100}% - ${A*R}px)`,top:"50%",transform:"translateY(-50%)",width:`${R}px`,height:`${R}px`,backgroundColor:n.handleColor,borderRadius:"50%",boxShadow:"0 2px 4px rgba(0,0,0,0.3)",transition:p?"none":"all 0.2s ease"};return i.jsxs("div",{className:"virtus-volume-control",style:{position:"relative",display:"flex",alignItems:"center",height:"40px",width:"40px"},onMouseLeave:()=>{p||h(!1)},children:[i.jsx("button",{className:"virtus-btn virtus-mute-button","aria-label":s?"Unmute":"Mute",onClick:l,style:{background:r===!1?"transparent":n.buttonBackground,border:"none",borderRadius:"8px",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",flexShrink:0,position:"relative",zIndex:1},onMouseEnter:x=>{h(!0),x.currentTarget.style.background=typeof r=="string"?r:r===!1?"transparent":n.buttonHoverBackground,x.currentTarget.style.transform="scale(1.05)"},onMouseLeave:x=>{x.currentTarget.style.background=r===!1?"transparent":n.buttonBackground,x.currentTarget.style.transform="scale(1)"},children:s||o===0?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06ZM17.78 9.22a.75.75 0 1 0-1.06 1.06L18.44 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06l1.72-1.72 1.72 1.72a.75.75 0 1 0 1.06-1.06L20.56 12l1.72-1.72a.75.75 0 1 0-1.06-1.06l-1.72 1.72-1.72-1.72Z"})}):o<.5?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"})}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:n.iconColor,viewBox:"0 0 24 24",children:[i.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"}),i.jsx("path",{d:"M18.584 5.106a.75.75 0 0 1 1.06 0 11.5 11.5 0 0 1 0 13.588.75.75 0 0 1-1.06-1.06 10 10 0 0 0 0-11.468.75.75 0 0 1 0-1.06Z"}),i.jsx("path",{d:"M15.932 7.757a.75.75 0 0 1 1.061 0 6.5 6.5 0 0 1 0 8.486.75.75 0 0 1-1.06-1.06 5 5 0 0 0 0-6.366.75.75 0 0 1 0-1.06Z"})]})}),i.jsx("div",{onMouseEnter:()=>h(!0),style:q,children:i.jsx("div",{ref:m,role:"slider",tabIndex:0,"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(A*100),"aria-valuetext":s?"Muted":`${Math.round(A*100)}%`,onMouseDown:S,onKeyDown:x=>{const $=s?0:o;switch(x.key){case"ArrowRight":case"ArrowUp":x.preventDefault(),d(Math.min(1,$+.05));break;case"ArrowLeft":case"ArrowDown":x.preventDefault(),d(Math.max(0,$-.05));break;case"PageUp":x.preventDefault(),d(Math.min(1,$+.2));break;case"PageDown":x.preventDefault(),d(Math.max(0,$-.2));break;case"Home":x.preventDefault(),d(0);break;case"End":x.preventDefault(),d(1);break;case"m":case"M":x.preventDefault(),l();break}},style:z,children:i.jsxs("div",{style:j,children:[i.jsx("div",{style:k}),i.jsx("div",{style:N})]})})})]})}const ci=[.25,.5,.75,1,1.25,1.5,1.75,2];function di(){const{setPlaybackRate:a}=U(),[e,t]=c.useState(1),r=c.useCallback(s=>{a(s),t(s)},[a]),n=e===1?"1×":`${e}×`;return i.jsxs(bt,{children:[i.jsx(Et,{children:i.jsx("button",{className:"virtus-speed-button","aria-label":`Playback speed: ${n}`,"aria-haspopup":"true",style:{background:"transparent",border:"none",color:"white",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",height:"40px",minWidth:"40px",transition:"all 0.2s ease",fontSize:"13px",fontWeight:"600",letterSpacing:"-0.3px",whiteSpace:"nowrap"},onMouseEnter:s=>{s.currentTarget.style.background="rgba(255, 255, 255, 0.15)",s.currentTarget.style.transform="scale(1.05)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent",s.currentTarget.style.transform="scale(1)"},title:"Playback speed",children:n})}),i.jsx(wt,{placement:"top-right",children:i.jsxs("div",{style:{minWidth:"130px"},children:[i.jsx("div",{style:{padding:"8px 12px",fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.6)",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Speed"}),[...ci].reverse().map(s=>i.jsx(_e,{selected:e===s,onClick:()=>r(s),children:i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:i.jsx("span",{children:s===1?"1× (Normal)":`${s}×`})})},s))]})})]})}const Ve=c.createContext({textColor:"#fff",accentColor:"#6366f1",accentAlpha15:"rgba(99,102,241,0.15)",accentAlpha30:"rgba(99,102,241,0.3)",borderColor:"rgba(255,255,255,0.07)",fontSize:"13.5px"});function ze(a,e){const t=a.replace("#",""),r=t.length===3?t.split("").map(l=>l+l).join(""):t,n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),o=parseInt(r.slice(4,6),16);return isNaN(n)||isNaN(s)||isNaN(o)?`rgba(99,102,241,${e})`:`rgba(${n},${s},${o},${e})`}const ui=60,hi=[.25,.5,.75,1,1.25,1.5,1.75,2],pi={position:"absolute",backdropFilter:"blur(16px)",borderRadius:"14px",overflow:"hidden",zIndex:9999,animation:"settingsFadeIn 0.18s ease-out",fontFamily:"system-ui, -apple-system, sans-serif",transition:"width 0.2s ease"},gi={display:"flex",alignItems:"center",gap:"8px",padding:"11px 14px",fontSize:"13px",fontWeight:600},fi={display:"flex",alignItems:"center",width:"100%",padding:"9px 14px",background:"transparent",border:"none",cursor:"pointer",fontSize:"13.5px",textAlign:"left",gap:"10px",outline:"none",transition:"background 0.12s"};function qe({values:a,color:e,gradId:t}){if(a.length<2)return i.jsx("svg",{width:292,height:52,style:{display:"block"},children:i.jsx("line",{x1:0,y1:52/2,x2:292,y2:52/2,stroke:"rgba(255,255,255,0.08)",strokeWidth:1,strokeDasharray:"4 4"})});const s=Math.max(...a,.001),o=a.map((h,p)=>[p/(ui-1)*292,48-h/s*42]),l=o.map(([h,p],g)=>`${g===0?"M":"L"}${h.toFixed(1)},${p.toFixed(1)}`).join(" "),d=l+` L${292 .toFixed(1)},52 L0,52 Z`,u=o[o.length-1];return i.jsxs("svg",{width:292,height:52,style:{display:"block",overflow:"visible"},children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:t,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:e,stopOpacity:.4}),i.jsx("stop",{offset:"100%",stopColor:e,stopOpacity:.02})]})}),i.jsx("path",{d,fill:`url(#${t})`}),i.jsx("path",{d:l,fill:"none",stroke:e,strokeWidth:1.8,strokeLinejoin:"round",strokeLinecap:"round"}),i.jsx("circle",{cx:u[0],cy:u[1],r:3.5,fill:e}),i.jsx("circle",{cx:u[0],cy:u[1],r:6,fill:e,fillOpacity:.25})]})}function F({label:a,value:e,icon:t,onClick:r,selected:n=!1,isBack:s=!1}){const[o,l]=c.useState(!1),{textColor:d,accentColor:u,accentAlpha15:h,accentAlpha30:p,fontSize:g}=c.useContext(Ve);return i.jsxs("button",{role:"menuitem","aria-checked":n,onClick:r,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{...fi,color:d,fontSize:g,background:o?"rgba(255,255,255,0.07)":n?h:"transparent",fontWeight:n?600:400,justifyContent:"space-between"},children:[i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[s?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"2.5",style:{flexShrink:0},children:i.jsx("polyline",{points:"15 18 9 12 15 6"})}):t?i.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:n?p:"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:n?u:"rgba(255,255,255,0.65)",transition:"background 0.15s, color 0.15s"},children:t}):n?i.jsx("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:u,strokeWidth:"3",style:{flexShrink:0},children:i.jsx("polyline",{points:"20 6 9 17 4 12"})}):i.jsx("span",{style:{display:"inline-block",width:"14px",flexShrink:0}}),i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),e!==void 0&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[i.jsx("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.45)",maxWidth:"90px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.35)",strokeWidth:"2.5",children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})]})]})}function Ke(){const{borderColor:a}=c.useContext(Ve);return i.jsx("div",{style:{height:"1px",background:a,margin:"2px 0"}})}function jt({theme:a,panelPosition:e,iconSize:t=20,hoverBackground:r,gearIcon:n}={}){const s=a?.accentColor??"#6366f1",o=a?.textColor??"#fff",l=a?.background??"rgba(12, 12, 20, 0.97)",d=a?.borderColor??"rgba(255,255,255,0.1)",u=a?.fontSize??"13.5px",h={textColor:o,accentColor:s,accentAlpha15:s.startsWith("#")?ze(s,.15):"rgba(99,102,241,0.15)",accentAlpha30:s.startsWith("#")?ze(s,.3):"rgba(99,102,241,0.3)",borderColor:d.replace("0.1)","0.07)"),fontSize:u},p={...gi,color:o,fontSize:u,borderBottom:`1px solid ${d.replace("0.1)","0.08)")}`},g=e?.vertical??"top",m=e?.horizontal??"right",{setQuality:w,setAudioTrack:P,setPlaybackRate:S,setSubtitleTrack:A,getPlayerStats:b}=U(),y=pe(),{playbackRate:q=1,isLive:z}=O(),{style:j,setStyle:k}=gt(),[R,N]=c.useState(!1),[x,C]=c.useState("root");c.useEffect(()=>{z&&x==="speed"&&C("root")},[z,x]);const[I,$]=c.useState([]),[K,M]=c.useState(null),[_,T]=c.useState([]),[V,Y]=c.useState(""),[G,fe]=c.useState([]),[te,se]=c.useState(null),[W,we]=c.useState(null),[oe,ce]=c.useState([]);c.useEffect(()=>{const f=()=>{$(y.getAvailableQualities()),M(y.getQuality()),T(y.getAvailableAudioTracks()),Y(y.getAudioTrack()),fe(y.getSubtitleTracks()),se(y.getActiveSubtitleLanguage())};y.events.on("tracksready",f),y.events.on("streamTypeDetected",f),y.events.on("qualitychange",f),y.events.on("loadedmetadata",f),f();const H=setTimeout(f,100);return()=>{y.events.off("tracksready",f),y.events.off("streamTypeDetected",f),y.events.off("qualitychange",f),y.events.off("loadedmetadata",f),clearTimeout(H)}},[y]),c.useEffect(()=>{R&&($(y.getAvailableQualities()),M(y.getQuality()),T(y.getAvailableAudioTracks()),Y(y.getAudioTrack()),fe(y.getSubtitleTracks()),se(y.getActiveSubtitleLanguage()))},[R,y]);const ke=_.length>1;c.useEffect(()=>{if(x!=="statistics")return;const f=()=>{const ye=b();we(ye),ce(Pe=>[...Pe.slice(-59),ye])};f();const H=setInterval(f,1e3);return()=>{clearInterval(H),ce([])}},[x,b]);const de=c.useRef(null);c.useEffect(()=>{if(!R)return;const f=H=>{de.current&&!de.current.contains(H.target)&&(N(!1),C("root"))};return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)},[R]),c.useEffect(()=>{if(!R)return;const f=H=>{H.key==="Escape"&&(N(!1),C("root")),H.key==="Backspace"&&x!=="root"&&C("root")};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[R,x]);const Se=c.useCallback(()=>{N(f=>(f&&C("root"),!f))},[]),Ae=K?K.id==="auto"?"Auto":K.label:"Auto",re=q===1?"1×":`${q}×`,ue=_.find(f=>f.id===V)?.label??"Auto",me=te===null?"Off":G.find(f=>f.language===te)?.label??te,Ce=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("path",{d:"M8 21h8M12 17v4"}),i.jsx("path",{d:"m7 8 2 2 4-4 2 2"})]}),Te=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0"}),i.jsx("path",{d:"M12 2a10 10 0 0 1 7.39 16.74M12 2A10 10 0 0 0 4.61 18.74"}),i.jsx("path",{d:"m16.24 7.76-2.12 2.12"})]}),Me=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),i.jsx("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]}),v=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),i.jsx("line",{x1:"9",y1:"10",x2:"15",y2:"10"}),i.jsx("line",{x1:"9",y1:"14",x2:"12",y2:"14"})]}),L=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"}),i.jsx("polyline",{points:"16 16 12 20 8 16"})]}),D=i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),i.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),i.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),B=()=>i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:p,children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]}),i.jsxs("div",{style:{padding:"4px 0"},children:[i.jsx(F,{icon:Ce,label:"Quality",value:Ae,onClick:()=>C("quality")}),!z&&i.jsx(F,{icon:Te,label:"Speed",value:re,onClick:()=>C("speed")}),ke&&i.jsx(F,{icon:Me,label:"Audio Track",value:ue,onClick:()=>C("audio")}),i.jsx(Ke,{}),i.jsx(F,{icon:v,label:"Subtitles",value:me,onClick:()=>C("subtitles")}),i.jsx(F,{icon:L,label:"Subtitle Style",value:`${j.fontSize}px`,onClick:()=>C("subtitleStyle")}),i.jsx(Ke,{}),i.jsx(F,{icon:D,label:"Statistics",onClick:()=>C("statistics")})]})]}),X=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Quality",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"4px 0",maxHeight:"280px",overflowY:"auto"},children:[I.map(f=>i.jsx(F,{label:f.id==="auto"?"Auto":f.label,selected:K?.id===f.id,onClick:()=>{w(f.id),M(f),N(!1),C("root")}},f.id)),I.length===0&&i.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No quality levels available"})]})]}),ae=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Speed",isBack:!0,onClick:()=>C("root")})}),i.jsx("div",{style:{padding:"4px 0"},children:hi.map(f=>i.jsx(F,{label:f===1?"1× (Normal)":`${f}×`,selected:q===f,onClick:()=>{S(f),N(!1),C("root")}},f))})]}),Rt=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Audio Track",isBack:!0,onClick:()=>C("root")})}),i.jsx("div",{style:{padding:"4px 0"},children:_.map(f=>i.jsx(F,{label:f.label||f.language||f.id,selected:V===f.id,onClick:()=>{P(f.id),Y(f.id),N(!1),C("root")}},f.id))})]}),Dt=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Subtitles",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"4px 0"},children:[i.jsx(F,{label:"Off",selected:te===null,onClick:()=>{A(null),se(null),N(!1),C("root")}},"off"),G.map((f,H)=>i.jsx(F,{label:f.label||f.language,selected:te===f.language,onClick:()=>{A(f.language),se(f.language),N(!1),C("root")}},f.url||`${f.language}-${H}`)),G.length===0&&i.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No subtitle tracks available"})]})]}),It=()=>i.jsxs(i.Fragment,{children:[i.jsx("div",{style:p,children:i.jsx(F,{label:"Subtitle Style",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{padding:"8px 14px 12px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Position"}),i.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[j.bottomOffset,"px from bottom"]})]}),i.jsx("input",{type:"range",min:10,max:200,step:5,value:j.bottomOffset,onChange:f=>k({bottomOffset:Number(f.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Font Size"}),i.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[j.fontSize,"px"]})]}),i.jsx("input",{type:"range",min:12,max:40,step:1,value:j.fontSize,onChange:f=>k({fontSize:Number(f.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Background"}),i.jsx("button",{onClick:()=>k({background:j.background?"":"rgba(0,0,0,0.75)"}),style:{padding:"4px 12px",borderRadius:"6px",border:"1px solid rgba(255,255,255,0.2)",background:j.background?"#3b82f6":"transparent",color:"#fff",fontSize:"12px",cursor:"pointer"},children:j.background?"On":"Off"})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Text Color"}),i.jsx("div",{style:{display:"flex",gap:"6px"},children:["#ffffff","#ffff00","#00ff00","#00cfff"].map(f=>i.jsx("button",{onClick:()=>k({color:f}),title:f,style:{width:"22px",height:"22px",borderRadius:"50%",background:f,border:j.color===f?"2px solid #3b82f6":"2px solid transparent",cursor:"pointer",outline:"none",padding:0,flexShrink:0}},f))})]})]})]}),_t=()=>{const f=oe.map(Z=>Z.bandwidth),H=oe.map(Z=>Z.bufferHealth),ye=W?.bandwidth??0,Pe=W?.bufferHealth??0,Bt=Z=>Z>=1e3?`${(Z/1e3).toFixed(2)} Mbps`:`${Z.toFixed(0)} kbps`,ve=(Z,$t)=>i.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",borderRadius:"8px",padding:"7px 10px",flex:"1 1 0",minWidth:0},children:[i.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.4)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:Z}),i.jsx("div",{style:{fontSize:"12px",color:"#fff",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$t})]}),xe=W?.segmentUrl??"",Nt=xe.length>36?"…"+xe.slice(-36):xe||"—";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{...p,justifyContent:"space-between"},children:[i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:i.jsx(F,{label:"Statistics",isBack:!0,onClick:()=>C("root")})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",paddingRight:"14px",flexShrink:0},children:[i.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"#22c55e",boxShadow:"0 0 6px #22c55e",animation:"statsPulse 1.6s ease-in-out infinite",display:"inline-block"}}),i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.4)"},children:"LIVE"})]})]}),i.jsxs("div",{style:{padding:"0 14px 12px",overflowY:"auto",maxHeight:"420px"},children:[i.jsxs("div",{style:{marginTop:"12px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.45)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Connection Speed"}),i.jsx("span",{style:{fontSize:"16px",fontWeight:600,color:"#4ade80",fontFamily:"monospace"},children:W?Bt(ye):"—"})]}),i.jsx("div",{style:{background:"rgba(0,0,0,0.3)",borderRadius:"8px",padding:"6px 8px"},children:i.jsx(qe,{values:f,color:"#4ade80",gradId:"bw-grad"})})]}),i.jsxs("div",{style:{marginTop:"14px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"11px",color:"rgba(255,255,255,0.45)",textTransform:"uppercase",letterSpacing:"0.07em"},children:"Buffer Health"}),i.jsx("span",{style:{fontSize:"16px",fontWeight:600,color:"#60a5fa",fontFamily:"monospace"},children:W?`${Pe.toFixed(1)} s`:"—"})]}),i.jsx("div",{style:{background:"rgba(0,0,0,0.3)",borderRadius:"8px",padding:"6px 8px"},children:i.jsx(qe,{values:H,color:"#60a5fa",gradId:"buf-grad"})})]}),i.jsx("div",{style:{height:"1px",background:"rgba(255,255,255,0.07)",margin:"14px 0 12px"}}),i.jsxs("div",{style:{display:"flex",gap:"6px"},children:[ve("Codec",W?.codec||"—"),ve("Resolution",W?.resolution||"—"),ve("Dropped",W?`${W.droppedFrames}/${W.totalFrames}`:"—")]}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[ve("Stream",W?.streamType||"—"),i.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",borderRadius:"8px",padding:"7px 10px",flex:"2 1 0",minWidth:0},children:[i.jsx("div",{style:{fontSize:"10px",color:"rgba(255,255,255,0.4)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:"Segment"}),i.jsx("div",{style:{fontSize:"11px",color:"rgba(255,255,255,0.7)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:xe,children:Nt})]})]})]}),i.jsx("style",{children:`
180
180
  @keyframes statsPulse {
181
181
  0%, 100% { opacity: 1; }
182
182
  50% { opacity: 0.3; }
@@ -2277,15 +2277,15 @@ const Zt = "_overlay_3mfq6_3", Jt = "_iconContainer_3mfq6_17", er = "_loading_3m
2277
2277
  customIcon: rr
2278
2278
  };
2279
2279
  function ir({ config: a, isAdLoading: e }) {
2280
- const t = Y((D) => D.isPlaying), { togglePlay: r, toggleFullscreen: i, getPlayer: n } = q(), [o, l] = b(!1), [c, d] = b("play"), [h, p] = b(!1), g = O(null);
2280
+ const t = Y((I) => I.isPlaying), { togglePlay: r, toggleFullscreen: i, getPlayer: n } = q(), [o, l] = b(!1), [c, d] = b("play"), [h, p] = b(!1), g = O(null);
2281
2281
  k(() => {
2282
2282
  console.log("[VideoOverlay] isAdLoading changed:", e), e ? (console.log("[VideoOverlay] ✅ Showing ad loading icon"), p(!0), d("loading"), l(!0)) : (console.log("[VideoOverlay] ❌ Hiding ad loading icon"), p(!1), l(!1));
2283
2283
  }, [e]);
2284
- const m = a?.ui?.showOverlayIcons !== !1, A = a?.ui?.showPlayPauseIcons !== !1, I = a?.ui?.overlayIcons?.playIcon, C = a?.ui?.overlayIcons?.pauseIcon, T = a?.ui?.overlayIcons?.iconSize || 40, w = a?.ui?.overlayIcons?.containerSize || 80;
2284
+ const m = a?.ui?.showOverlayIcons !== !1, A = a?.ui?.showPlayPauseIcons !== !1, R = a?.ui?.overlayIcons?.playIcon, C = a?.ui?.overlayIcons?.pauseIcon, T = a?.ui?.overlayIcons?.iconSize || 40, w = a?.ui?.overlayIcons?.containerSize || 80;
2285
2285
  k(() => {
2286
- const D = n();
2287
- if (!D) return;
2288
- const S = D.video || D.videoElement;
2286
+ const I = n();
2287
+ if (!I) return;
2288
+ const S = I.video || I.videoElement;
2289
2289
  if (!S) return;
2290
2290
  const _ = () => {
2291
2291
  p(!0), d("loading"), l(!0), g.current && clearTimeout(g.current);
@@ -2312,23 +2312,23 @@ function ir({ config: a, isAdLoading: e }) {
2312
2312
  }, [n, h]), k(() => {
2313
2313
  if (!h) {
2314
2314
  d(t ? "pause" : "play"), l(!0);
2315
- const D = setTimeout(() => {
2315
+ const I = setTimeout(() => {
2316
2316
  l(!1);
2317
2317
  }, 600);
2318
- return () => clearTimeout(D);
2318
+ return () => clearTimeout(I);
2319
2319
  }
2320
2320
  }, [t, h]);
2321
2321
  const y = $(async () => {
2322
2322
  await r();
2323
2323
  }, [r]), G = $(() => {
2324
2324
  i();
2325
- }, [i]), X = (D) => {
2326
- const S = D === "play" ? I : C;
2325
+ }, [i]), X = (I) => {
2326
+ const S = I === "play" ? R : C;
2327
2327
  return S ? /^https?:\/\//.test(S) || /\.(jpg|jpeg|png|svg|gif|webp)$/i.test(S) ? /* @__PURE__ */ s(
2328
2328
  "img",
2329
2329
  {
2330
2330
  src: S,
2331
- alt: D === "play" ? "Play" : "Pause",
2331
+ alt: I === "play" ? "Play" : "Pause",
2332
2332
  className: ne.customIcon,
2333
2333
  style: { "--icon-size": `${T}px` }
2334
2334
  }
@@ -2339,7 +2339,7 @@ function ir({ config: a, isAdLoading: e }) {
2339
2339
  className: ne.customIcon,
2340
2340
  style: { "--icon-size": `${T}px` }
2341
2341
  }
2342
- ) : D === "play" ? /* @__PURE__ */ s(
2342
+ ) : I === "play" ? /* @__PURE__ */ s(
2343
2343
  "svg",
2344
2344
  {
2345
2345
  xmlns: "http://www.w3.org/2000/svg",
@@ -2538,7 +2538,7 @@ function Sr({ onRetry: a, drmConfig: e }) {
2538
2538
  const m = () => {
2539
2539
  g.currentTime > 0.5 || (l.current = setTimeout(() => {
2540
2540
  if (c.current) return;
2541
- const I = n, C = I ? I.fairplay && !I.widevine && !I.playready ? "drm_fairplay_needed" : !I.widevine && !I.fairplay && !I.playready ? "drm_browser_unsupported" : "drm_generic" : "drm_generic";
2541
+ const R = n, C = R ? R.fairplay && !R.widevine && !R.playready ? "drm_fairplay_needed" : !R.widevine && !R.fairplay && !R.playready ? "drm_browser_unsupported" : "drm_generic" : "drm_generic";
2542
2542
  i({
2543
2543
  type: C,
2544
2544
  code: "DRM_TIMEOUT",
@@ -3271,7 +3271,7 @@ class _r {
3271
3271
  }
3272
3272
  const o = e.getAttribute("id") || `ad-${Date.now()}`, l = n.querySelector("AdTitle")?.textContent?.trim(), c = n.querySelector("Duration")?.textContent?.trim(), d = this.parseDuration(c || "00:00:00"), { mediaFile: h, isVpaid: p, vpaidUrl: g } = this.getMediaFileInfo(n);
3273
3273
  if (!h) throw new Error("VAST MediaFile not found");
3274
- const m = n.querySelector("ClickThrough")?.textContent?.trim(), A = this.parseTrackingEvents(n, t), I = this.getErrorUrls(t), C = this.parseCompanions(n);
3274
+ const m = n.querySelector("ClickThrough")?.textContent?.trim(), A = this.parseTrackingEvents(n, t), R = this.getErrorUrls(t), C = this.parseCompanions(n);
3275
3275
  return {
3276
3276
  id: o,
3277
3277
  title: l,
@@ -3279,7 +3279,7 @@ class _r {
3279
3279
  mediaFile: h,
3280
3280
  clickThrough: m,
3281
3281
  trackingEvents: A,
3282
- errorUrls: I,
3282
+ errorUrls: R,
3283
3283
  companions: C.length > 0 ? C : void 0,
3284
3284
  isVpaid: p,
3285
3285
  vpaidUrl: g,
@@ -3290,7 +3290,7 @@ class _r {
3290
3290
  parseCompanions(e) {
3291
3291
  const t = [];
3292
3292
  return e.querySelectorAll("CompanionAds > Companion").forEach((i) => {
3293
- const n = parseInt(i.getAttribute("width") || "0", 10), o = parseInt(i.getAttribute("height") || "0", 10), l = i.getAttribute("id") ?? void 0, c = i.querySelector("StaticResource"), d = i.querySelector("HTMLResource"), h = i.querySelector("IFrameResource"), p = c?.textContent?.trim() ?? void 0, g = d?.textContent?.trim() ?? void 0, m = h?.textContent?.trim() ?? void 0, A = c?.getAttribute("creativeType") ?? void 0, I = i.querySelector("CompanionClickThrough")?.textContent?.trim() ?? void 0, C = i.querySelector("AltText")?.textContent?.trim() ?? void 0, T = [];
3293
+ const n = parseInt(i.getAttribute("width") || "0", 10), o = parseInt(i.getAttribute("height") || "0", 10), l = i.getAttribute("id") ?? void 0, c = i.querySelector("StaticResource"), d = i.querySelector("HTMLResource"), h = i.querySelector("IFrameResource"), p = c?.textContent?.trim() ?? void 0, g = d?.textContent?.trim() ?? void 0, m = h?.textContent?.trim() ?? void 0, A = c?.getAttribute("creativeType") ?? void 0, R = i.querySelector("CompanionClickThrough")?.textContent?.trim() ?? void 0, C = i.querySelector("AltText")?.textContent?.trim() ?? void 0, T = [];
3294
3294
  i.querySelectorAll('TrackingEvents > Tracking[event="creativeView"]').forEach((w) => {
3295
3295
  const y = w.textContent?.trim();
3296
3296
  y && T.push(y);
@@ -3302,7 +3302,7 @@ class _r {
3302
3302
  htmlResource: g,
3303
3303
  iFrameResource: m,
3304
3304
  type: A,
3305
- clickThrough: I,
3305
+ clickThrough: R,
3306
3306
  altText: C,
3307
3307
  viewTrackingUrls: T.length > 0 ? T : void 0
3308
3308
  });
@@ -4306,7 +4306,7 @@ function wi({
4306
4306
  endCardCountdown: g = 5,
4307
4307
  crossOrigin: m
4308
4308
  }) {
4309
- const A = O(null), I = O(null), [C, T] = b(null), w = O(null), [y, G] = b(!1), [X, D] = b(!1), S = $(() => D(!0), []), _ = $(() => D(!1), []), [W, E] = b(!1), { onTouchStart: M, onTouchMove: N, onTouchEnd: H, gestureHint: Q } = Lr({
4309
+ const A = O(null), R = O(null), [C, T] = b(null), w = O(null), [y, G] = b(!1), [X, I] = b(!1), S = $(() => I(!0), []), _ = $(() => I(!1), []), [W, E] = b(!1), { onTouchStart: M, onTouchMove: N, onTouchEnd: H, gestureHint: Q } = Lr({
4310
4310
  player: C,
4311
4311
  skipSec: 10
4312
4312
  }), { isActive: L } = Dr({
@@ -4335,9 +4335,11 @@ function wi({
4335
4335
  l?.ads?.maxWrapperDepth
4336
4336
  ]);
4337
4337
  k(() => {
4338
- if (!I.current || !A.current) return;
4338
+ R.current && (R.current.muted = r);
4339
+ }, [r]), k(() => {
4340
+ if (!R.current || !A.current) return;
4339
4341
  console.log("[Player] Initializing PlayerCore");
4340
- const F = new fe(I.current);
4342
+ const F = new fe(R.current);
4341
4343
  return fe.preloadEngines(), F.container = A.current, T(F), () => {
4342
4344
  console.log("[Player] Cleanup called - destroying PlayerCore"), w.current && (console.log("[Player] Destroying AdManager"), w.current.destroy(), w.current = null), F.destroy(), T(null);
4343
4345
  };
@@ -4407,7 +4409,7 @@ function wi({
4407
4409
  /* @__PURE__ */ s(
4408
4410
  "video",
4409
4411
  {
4410
- ref: I,
4412
+ ref: R,
4411
4413
  className: `virtus-video-element ${n || ""}`,
4412
4414
  style: {
4413
4415
  width: "100%",
@@ -4427,7 +4429,7 @@ function wi({
4427
4429
  }
4428
4430
  ),
4429
4431
  C ? /* @__PURE__ */ s(Gt, { playerInstance: C, children: /* @__PURE__ */ u(He.Provider, { value: L, children: [
4430
- /* @__PURE__ */ s(Ur, { videoElement: I.current }),
4432
+ /* @__PURE__ */ s(Ur, { videoElement: R.current }),
4431
4433
  /* @__PURE__ */ s(nr, { config: l, isAdLoading: y }),
4432
4434
  /* @__PURE__ */ s(Pr, { type: Q?.type ?? null, value: Q?.value ?? "" }),
4433
4435
  /* @__PURE__ */ s(Sr, { drmConfig: l?.drm }),
@@ -5442,17 +5444,17 @@ function ai({
5442
5444
  thumbnailsVttUrl: n,
5443
5445
  seekBarStyle: o
5444
5446
  }) {
5445
- const l = re(He), c = O(null), [d, h] = b(!1), [p, g] = b(null), [m, A] = b(null), [I, C] = b([]), T = O(null), { currentTime: w, duration: y, isLive: G, isPlaying: X, playbackRate: D } = Y(), { seekTo: S, getDVRRange: _, getBufferedRanges: W } = q(), [E, M] = b(w), N = O(null), H = O({ time: w, ts: performance.now() });
5447
+ const l = re(He), c = O(null), [d, h] = b(!1), [p, g] = b(null), [m, A] = b(null), [R, C] = b([]), T = O(null), { currentTime: w, duration: y, isLive: G, isPlaying: X, playbackRate: I } = Y(), { seekTo: S, getDVRRange: _, getBufferedRanges: W } = q(), [E, M] = b(w), N = O(null), H = O({ time: w, ts: performance.now() });
5446
5448
  k(() => {
5447
5449
  H.current = { time: w, ts: performance.now() }, M(w);
5448
5450
  }, [w]);
5449
5451
  const Q = $(() => {
5450
5452
  if (X) {
5451
- const { time: v, ts: R } = H.current, V = D ?? 1, U = (performance.now() - R) / 1e3, ee = Math.min(y || 1 / 0, v + U * V);
5453
+ const { time: v, ts: D } = H.current, V = I ?? 1, U = (performance.now() - D) / 1e3, ee = Math.min(y || 1 / 0, v + U * V);
5452
5454
  M(ee);
5453
5455
  }
5454
5456
  N.current = requestAnimationFrame(Q);
5455
- }, [X, D, y]);
5457
+ }, [X, I, y]);
5456
5458
  k(() => (N.current = requestAnimationFrame(Q), () => {
5457
5459
  N.current !== null && cancelAnimationFrame(N.current);
5458
5460
  }), [Q]), k(() => {
@@ -5469,11 +5471,11 @@ function ai({
5469
5471
  }, [W]);
5470
5472
  const L = a === "live" || !!G, B = L ? _() : null, P = B !== null && B.end - B.start > 5, F = P ? B.end - B.start : 0, Z = P && F > 0 ? (E - B.start) / F * 100 : 0, J = L ? Math.min(100, Math.max(0, Z)) : y > 0 ? E / y * 100 : 0, Ee = o?.trackColor ?? "rgba(255, 255, 255, 0.3)", ae = o?.progressColor ?? (L ? "#ff2020" : "#6366f1"), de = o?.bufferedColor ?? "rgba(255, 255, 255, 0.25)", j = o?.handleColor ?? "#ffffff", Me = o?.height ?? 4, ue = o?.borderRadius ?? 2, me = o?.showHandle !== !1, Pe = o?.showTooltip !== !1, ye = o?.paddingX ?? 20, Le = o?.paddingY ?? 0, Re = o?.bottom ?? 64, le = (v) => {
5471
5473
  if (!isFinite(v) || isNaN(v)) return "0:00";
5472
- const R = Math.floor(v / 3600), V = Math.floor(v % 3600 / 60), U = Math.floor(v % 60);
5473
- return R > 0 ? `${R}:${V.toString().padStart(2, "0")}:${U.toString().padStart(2, "0")}` : `${V}:${U.toString().padStart(2, "0")}`;
5474
+ const D = Math.floor(v / 3600), V = Math.floor(v % 3600 / 60), U = Math.floor(v % 60);
5475
+ return D > 0 ? `${D}:${V.toString().padStart(2, "0")}:${U.toString().padStart(2, "0")}` : `${V}:${U.toString().padStart(2, "0")}`;
5474
5476
  }, ve = (v) => {
5475
5477
  if (!c.current) return 0;
5476
- const R = c.current.getBoundingClientRect(), V = (v.clientX - R.left) / R.width;
5478
+ const D = c.current.getBoundingClientRect(), V = (v.clientX - D.left) / D.width;
5477
5479
  return Math.max(0, Math.min(1, V));
5478
5480
  }, we = (v) => {
5479
5481
  if (!(L && !P)) {
@@ -5486,13 +5488,13 @@ function ai({
5486
5488
  }, De = (v) => {
5487
5489
  if (L && !P) return;
5488
5490
  v.preventDefault(), h(!0);
5489
- const R = ve(v);
5490
- we(R);
5491
+ const D = ve(v);
5492
+ we(D);
5491
5493
  }, Ie = (v) => {
5492
5494
  if (!c.current) return;
5493
- const R = ve(v);
5494
- if (g(R), T.current) {
5495
- const V = P ? B.start + R * F : R * y;
5495
+ const D = ve(v);
5496
+ if (g(D), T.current) {
5497
+ const V = P ? B.start + D * F : D * y;
5496
5498
  A(T.current.getThumbnailAt(V));
5497
5499
  }
5498
5500
  }, _e = () => {
@@ -5504,11 +5506,11 @@ function ai({
5504
5506
  if (!c.current) return;
5505
5507
  const U = ve(V);
5506
5508
  g(U), we(U);
5507
- }, R = () => {
5509
+ }, D = () => {
5508
5510
  h(!1);
5509
5511
  };
5510
- return window.addEventListener("mousemove", v), window.addEventListener("mouseup", R), () => {
5511
- window.removeEventListener("mousemove", v), window.removeEventListener("mouseup", R);
5512
+ return window.addEventListener("mousemove", v), window.addEventListener("mouseup", D), () => {
5513
+ window.removeEventListener("mousemove", v), window.removeEventListener("mouseup", D);
5512
5514
  };
5513
5515
  }, [d, y]), /* @__PURE__ */ u(
5514
5516
  "div",
@@ -5625,16 +5627,16 @@ function ai({
5625
5627
  onMouseLeave: _e,
5626
5628
  onKeyDown: (v) => {
5627
5629
  if (L && !P) return;
5628
- const R = 5, V = 30, U = P ? B.start : 0, ee = P ? B.end : y;
5630
+ const D = 5, V = 30, U = P ? B.start : 0, ee = P ? B.end : y;
5629
5631
  if (ee !== 0)
5630
5632
  switch (v.key) {
5631
5633
  case "ArrowLeft":
5632
5634
  case "ArrowDown":
5633
- v.preventDefault(), S(Math.max(U, w - R));
5635
+ v.preventDefault(), S(Math.max(U, w - D));
5634
5636
  break;
5635
5637
  case "ArrowRight":
5636
5638
  case "ArrowUp":
5637
- v.preventDefault(), S(Math.min(ee, w + R));
5639
+ v.preventDefault(), S(Math.min(ee, w + D));
5638
5640
  break;
5639
5641
  case "PageDown":
5640
5642
  v.preventDefault(), S(Math.max(U, w - V));
@@ -5672,7 +5674,7 @@ function ai({
5672
5674
  borderRadius: `${ue}px`
5673
5675
  },
5674
5676
  children: [
5675
- !L && I.map((v, R) => {
5677
+ !L && R.map((v, D) => {
5676
5678
  if (y <= 0) return null;
5677
5679
  const V = v.start / y * 100, U = (v.end - v.start) / y * 100;
5678
5680
  return /* @__PURE__ */ s(
@@ -5689,7 +5691,7 @@ function ai({
5689
5691
  pointerEvents: "none"
5690
5692
  }
5691
5693
  },
5692
- R
5694
+ D
5693
5695
  );
5694
5696
  }),
5695
5697
  /* @__PURE__ */ s(
@@ -5708,13 +5710,13 @@ function ai({
5708
5710
  }
5709
5711
  ),
5710
5712
  !L && e.map((v) => {
5711
- const R = y > 0 ? v.startTime / y * 100 : 0;
5713
+ const D = y > 0 ? v.startTime / y * 100 : 0;
5712
5714
  return /* @__PURE__ */ s(
5713
5715
  "div",
5714
5716
  {
5715
5717
  style: {
5716
5718
  position: "absolute",
5717
- left: `${R}%`,
5719
+ left: `${D}%`,
5718
5720
  top: "50%",
5719
5721
  transform: "translate(-50%, -50%)",
5720
5722
  width: "3px",
@@ -5727,7 +5729,7 @@ function ai({
5727
5729
  v.id
5728
5730
  );
5729
5731
  }),
5730
- r && !L && y > 0 && t.map((v, R) => {
5732
+ r && !L && y > 0 && t.map((v, D) => {
5731
5733
  const V = v.time / y * 100;
5732
5734
  return V < 0 || V > 100 ? null : /* @__PURE__ */ s(
5733
5735
  ni,
@@ -5738,7 +5740,7 @@ function ai({
5738
5740
  showTooltip: !0,
5739
5741
  onClick: (U) => S(U)
5740
5742
  },
5741
- `timeline-${R}-${v.time}`
5743
+ `timeline-${D}-${v.time}`
5742
5744
  );
5743
5745
  }),
5744
5746
  P && /* @__PURE__ */ s(
@@ -5802,9 +5804,9 @@ function ai({
5802
5804
  }
5803
5805
  ),
5804
5806
  Pe && (!L || P) && p !== null && (() => {
5805
- const v = P ? B.start + p * F : p * y, R = c.current?.offsetWidth ?? 0, V = p * 100, U = p * R, ee = Ze / 2;
5807
+ const v = P ? B.start + p * F : p * y, D = c.current?.offsetWidth ?? 0, V = p * 100, U = p * D, ee = Ze / 2;
5806
5808
  let he = "-50%";
5807
- return U < ee ? he = "0%" : R - U < ee && (he = "-100%"), m ? (
5809
+ return U < ee ? he = "0%" : D - U < ee && (he = "-100%"), m ? (
5808
5810
  /* Thumbnail card */
5809
5811
  /* @__PURE__ */ u(
5810
5812
  "div",
@@ -6038,20 +6040,20 @@ function di({ sliderDirection: a = "right", theme: e, iconSize: t = 20, hoverBac
6038
6040
  trackColor: e?.trackColor ?? "rgba(255,255,255,0.3)",
6039
6041
  fillColor: e?.fillColor ?? "#3b82f6",
6040
6042
  handleColor: e?.handleColor ?? "#fff"
6041
- }, { isMuted: n, volume: o } = Y(), { toggleMute: l, setVolume: c } = q(), [d, h] = b(!1), [p, g] = b(!1), m = O(null), A = a === "top" || a === "bottom", I = $((E, M) => {
6043
+ }, { isMuted: n, volume: o } = Y(), { toggleMute: l, setVolume: c } = q(), [d, h] = b(!1), [p, g] = b(!1), m = O(null), A = a === "top" || a === "bottom", R = $((E, M) => {
6042
6044
  if (!m.current) return;
6043
6045
  const N = m.current.getBoundingClientRect(), H = A ? Math.max(0, Math.min(1, 1 - (M - N.top) / N.height)) : Math.max(0, Math.min(1, (E - N.left) / N.width));
6044
6046
  c(H);
6045
6047
  }, [c, A]), C = $((E) => {
6046
- g(!0), n && l(), I(E.clientX, E.clientY);
6047
- }, [I, n, l]);
6048
+ g(!0), n && l(), R(E.clientX, E.clientY);
6049
+ }, [R, n, l]);
6048
6050
  k(() => {
6049
6051
  if (!p) return;
6050
- const E = (N) => I(N.clientX, N.clientY), M = () => g(!1);
6052
+ const E = (N) => R(N.clientX, N.clientY), M = () => g(!1);
6051
6053
  return window.addEventListener("mousemove", E), window.addEventListener("mouseup", M), () => {
6052
6054
  window.removeEventListener("mousemove", E), window.removeEventListener("mouseup", M);
6053
6055
  };
6054
- }, [p, I]);
6056
+ }, [p, R]);
6055
6057
  const T = p ? o : n ? 0 : o, w = d || p, y = {
6056
6058
  position: "absolute",
6057
6059
  opacity: w ? 1 : 0,
@@ -6114,7 +6116,7 @@ function di({ sliderDirection: a = "right", theme: e, iconSize: t = 20, hoverBac
6114
6116
  borderLeft: "none"
6115
6117
  };
6116
6118
  }
6117
- })(), X = A ? { width: "40px", height: "110px", display: "flex", justifyContent: "center", alignItems: "center", cursor: "pointer", position: "relative", outline: "none" } : { width: "110px", height: "40px", display: "flex", alignItems: "center", cursor: "pointer", position: "relative", paddingRight: "8px", outline: "none" }, D = A ? { width: "4px", height: "100%", backgroundColor: i.trackColor, borderRadius: "2px", position: "relative" } : { width: "100%", height: "4px", backgroundColor: i.trackColor, borderRadius: "2px", position: "relative" }, S = A ? {
6119
+ })(), X = A ? { width: "40px", height: "110px", display: "flex", justifyContent: "center", alignItems: "center", cursor: "pointer", position: "relative", outline: "none" } : { width: "110px", height: "40px", display: "flex", alignItems: "center", cursor: "pointer", position: "relative", paddingRight: "8px", outline: "none" }, I = A ? { width: "4px", height: "100%", backgroundColor: i.trackColor, borderRadius: "2px", position: "relative" } : { width: "100%", height: "4px", backgroundColor: i.trackColor, borderRadius: "2px", position: "relative" }, S = A ? {
6118
6120
  position: "absolute",
6119
6121
  bottom: 0,
6120
6122
  left: 0,
@@ -6248,7 +6250,7 @@ function di({ sliderDirection: a = "right", theme: e, iconSize: t = 20, hoverBac
6248
6250
  }
6249
6251
  },
6250
6252
  style: X,
6251
- children: /* @__PURE__ */ u("div", { style: D, children: [
6253
+ children: /* @__PURE__ */ u("div", { style: I, children: [
6252
6254
  /* @__PURE__ */ s("div", { style: S }),
6253
6255
  /* @__PURE__ */ s("div", { style: W })
6254
6256
  ] })
@@ -6477,11 +6479,11 @@ function yi({
6477
6479
  borderBottom: `1px solid ${c.replace("0.1)", "0.08)")}`
6478
6480
  }, g = e?.vertical ?? "top", m = e?.horizontal ?? "right", {
6479
6481
  setQuality: A,
6480
- setAudioTrack: I,
6482
+ setAudioTrack: R,
6481
6483
  setPlaybackRate: C,
6482
6484
  setSubtitleTrack: T,
6483
6485
  getPlayerStats: w
6484
- } = q(), y = Ce(), { playbackRate: G = 1, isLive: X } = Y(), { style: D, setStyle: S } = ut(), [_, W] = b(!1), [E, M] = b("root");
6486
+ } = q(), y = Ce(), { playbackRate: G = 1, isLive: X } = Y(), { style: I, setStyle: S } = ut(), [_, W] = b(!1), [E, M] = b("root");
6485
6487
  k(() => {
6486
6488
  X && E === "speed" && M("root");
6487
6489
  }, [X, E]);
@@ -6542,7 +6544,7 @@ function yi({
6542
6544
  /* @__PURE__ */ s("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
6543
6545
  /* @__PURE__ */ s("line", { x1: "9", y1: "10", x2: "15", y2: "10" }),
6544
6546
  /* @__PURE__ */ s("line", { x1: "9", y1: "14", x2: "12", y2: "14" })
6545
- ] }), R = /* @__PURE__ */ u("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
6547
+ ] }), D = /* @__PURE__ */ u("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
6546
6548
  /* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" }),
6547
6549
  /* @__PURE__ */ s("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" }),
6548
6550
  /* @__PURE__ */ s("polyline", { points: "16 16 12 20 8 16" })
@@ -6564,7 +6566,7 @@ function yi({
6564
6566
  Pe && /* @__PURE__ */ s(z, { icon: _e, label: "Audio Track", value: ve, onClick: () => M("audio") }),
6565
6567
  /* @__PURE__ */ s(tt, {}),
6566
6568
  /* @__PURE__ */ s(z, { icon: v, label: "Subtitles", value: we, onClick: () => M("subtitles") }),
6567
- /* @__PURE__ */ s(z, { icon: R, label: "Subtitle Style", value: `${D.fontSize}px`, onClick: () => M("subtitleStyle") }),
6569
+ /* @__PURE__ */ s(z, { icon: D, label: "Subtitle Style", value: `${I.fontSize}px`, onClick: () => M("subtitleStyle") }),
6568
6570
  /* @__PURE__ */ s(tt, {}),
6569
6571
  /* @__PURE__ */ s(z, { icon: V, label: "Statistics", onClick: () => M("statistics") })
6570
6572
  ] })
@@ -6605,7 +6607,7 @@ function yi({
6605
6607
  label: f.label || f.language || f.id,
6606
6608
  selected: F === f.id,
6607
6609
  onClick: () => {
6608
- I(f.id), Z(f.id), W(!1), M("root");
6610
+ R(f.id), Z(f.id), W(!1), M("root");
6609
6611
  }
6610
6612
  },
6611
6613
  f.id
@@ -6644,7 +6646,7 @@ function yi({
6644
6646
  /* @__PURE__ */ u("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "6px" }, children: [
6645
6647
  /* @__PURE__ */ s("span", { style: { fontSize: "13px", color: "rgba(255,255,255,0.8)" }, children: "Position" }),
6646
6648
  /* @__PURE__ */ u("span", { style: { fontSize: "12px", color: "rgba(255,255,255,0.5)" }, children: [
6647
- D.bottomOffset,
6649
+ I.bottomOffset,
6648
6650
  "px from bottom"
6649
6651
  ] })
6650
6652
  ] }),
@@ -6655,7 +6657,7 @@ function yi({
6655
6657
  min: 10,
6656
6658
  max: 200,
6657
6659
  step: 5,
6658
- value: D.bottomOffset,
6660
+ value: I.bottomOffset,
6659
6661
  onChange: (f) => S({ bottomOffset: Number(f.target.value) }),
6660
6662
  style: { width: "100%", accentColor: "#3b82f6", cursor: "pointer" }
6661
6663
  }
@@ -6665,7 +6667,7 @@ function yi({
6665
6667
  /* @__PURE__ */ u("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "6px" }, children: [
6666
6668
  /* @__PURE__ */ s("span", { style: { fontSize: "13px", color: "rgba(255,255,255,0.8)" }, children: "Font Size" }),
6667
6669
  /* @__PURE__ */ u("span", { style: { fontSize: "12px", color: "rgba(255,255,255,0.5)" }, children: [
6668
- D.fontSize,
6670
+ I.fontSize,
6669
6671
  "px"
6670
6672
  ] })
6671
6673
  ] }),
@@ -6676,7 +6678,7 @@ function yi({
6676
6678
  min: 12,
6677
6679
  max: 40,
6678
6680
  step: 1,
6679
- value: D.fontSize,
6681
+ value: I.fontSize,
6680
6682
  onChange: (f) => S({ fontSize: Number(f.target.value) }),
6681
6683
  style: { width: "100%", accentColor: "#3b82f6", cursor: "pointer" }
6682
6684
  }
@@ -6687,17 +6689,17 @@ function yi({
6687
6689
  /* @__PURE__ */ s(
6688
6690
  "button",
6689
6691
  {
6690
- onClick: () => S({ background: D.background ? "" : "rgba(0,0,0,0.75)" }),
6692
+ onClick: () => S({ background: I.background ? "" : "rgba(0,0,0,0.75)" }),
6691
6693
  style: {
6692
6694
  padding: "4px 12px",
6693
6695
  borderRadius: "6px",
6694
6696
  border: "1px solid rgba(255,255,255,0.2)",
6695
- background: D.background ? "#3b82f6" : "transparent",
6697
+ background: I.background ? "#3b82f6" : "transparent",
6696
6698
  color: "#fff",
6697
6699
  fontSize: "12px",
6698
6700
  cursor: "pointer"
6699
6701
  },
6700
- children: D.background ? "On" : "Off"
6702
+ children: I.background ? "On" : "Off"
6701
6703
  }
6702
6704
  )
6703
6705
  ] }),
@@ -6713,7 +6715,7 @@ function yi({
6713
6715
  height: "22px",
6714
6716
  borderRadius: "50%",
6715
6717
  background: f,
6716
- border: D.color === f ? "2px solid #3b82f6" : "2px solid transparent",
6718
+ border: I.color === f ? "2px solid #3b82f6" : "2px solid transparent",
6717
6719
  cursor: "pointer",
6718
6720
  outline: "none",
6719
6721
  padding: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../src/ui/Player.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,UAAU,oBAAqB,SAAQ,WAAW;IAC9C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAGD,eAAO,MAAM,yBAAyB,kCAA+B,CAAC;AAEtE,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,GAA0F,EAC1F,eAAuB,EACvB,QAAgB,EAChB,KAAa,EACb,MAAM,EACN,SAAS,EACT,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAoB,EACpB,WAAW,GACd,EAAE,oBAAoB,2CAiPtB"}
1
+ {"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../src/ui/Player.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,UAAU,oBAAqB,SAAQ,WAAW;IAC9C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAGD,eAAO,MAAM,yBAAyB,kCAA+B,CAAC;AAEtE,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,GAA0F,EAC1F,eAAuB,EACvB,QAAgB,EAChB,KAAa,EACb,MAAM,EACN,SAAS,EACT,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAoB,EACpB,WAAW,GACd,EAAE,oBAAoB,2CAsPtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playron",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Modern OTT video player for React, Next.js, and vanilla JS",
5
5
  "type": "module",
6
6
  "main": "./dist/playron.cjs.js",