@halibegic/react-video-player 0.0.60 → 0.0.61
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.
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`+
|
|
3
|
-
`),J=
|
|
1
|
+
(function(j,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("react"),require("zustand"),require("mitt"),require("hls.js"),require("@radix-ui/react-slider"),require("@radix-ui/react-popover"),require("@radix-ui/react-scroll-area")):typeof define=="function"&&define.amd?define(["exports","react","zustand","mitt","hls.js","@radix-ui/react-slider","@radix-ui/react-popover","@radix-ui/react-scroll-area"],f):(j=typeof globalThis!="undefined"?globalThis:j||self,f(j.ReactVideoPlayer={},j.React,j.zustand,j.Mitt,j.Hls,j.RadixUISlider,j.RadixUIPopover,j.RadixUIScrollArea))})(this,(function(j,f,Z,te,$,yn,gn,wn){"use strict";var So=Object.defineProperty,bo=Object.defineProperties;var Po=Object.getOwnPropertyDescriptors;var Ae=Object.getOwnPropertySymbols;var pn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable;var mn=(j,f,Z)=>f in j?So(j,f,{enumerable:!0,configurable:!0,writable:!0,value:Z}):j[f]=Z,F=(j,f)=>{for(var Z in f||(f={}))pn.call(f,Z)&&mn(j,Z,f[Z]);if(Ae)for(var Z of Ae(f))vn.call(f,Z)&&mn(j,Z,f[Z]);return j},ve=(j,f)=>bo(j,Po(f));var oe=(j,f)=>{var Z={};for(var te in j)pn.call(j,te)&&f.indexOf(te)<0&&(Z[te]=j[te]);if(j!=null&&Ae)for(var te of Ae(j))f.indexOf(te)<0&&vn.call(j,te)&&(Z[te]=j[te]);return Z};function He(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Re=He(yn),ye=He(gn),Se=He(wn);function ot(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function st(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var a=Array.prototype.slice.call(e);if(a.length===0)return n([]);var l=a.length;function u(c,d){if(d&&(typeof d=="object"||typeof d=="function")){var w=d.then;if(typeof w=="function"){w.call(d,function(T){u(c,T)},function(T){a[c]={status:"rejected",reason:T},--l===0&&n(a)});return}}a[c]={status:"fulfilled",value:d},--l===0&&n(a)}for(var s=0;s<a.length;s++)u(s,a[s])})}function it(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}it.prototype=Error.prototype;function at(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError("Promise.any accepts an array"));var a=Array.prototype.slice.call(e);if(a.length===0)return r();for(var l=[],u=0;u<a.length;u++)try{t.resolve(a[u]).then(n).catch(function(s){l.push(s),l.length===a.length&&r(new it(l,"All promises were rejected"))})}catch(s){r(s)}})}var Cn=setTimeout;function ct(e){return!!(e&&typeof e.length!="undefined")}function _n(){}function Tn(e,t){return function(){e.apply(t,arguments)}}function O(e){if(!(this instanceof O))throw new TypeError("Promises must be constructed via new");if(typeof e!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],ut(e,this)}function lt(e,t){for(;e._state===3;)e=e._value;if(e._state===0){e._deferreds.push(t);return}e._handled=!0,O._immediateFn(function(){var n=e._state===1?t.onFulfilled:t.onRejected;if(n===null){(e._state===1?Ue:ge)(t.promise,e._value);return}var r;try{r=n(e._value)}catch(a){ge(t.promise,a);return}Ue(t.promise,r)})}function Ue(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var n=t.then;if(t instanceof O){e._state=3,e._value=t,Be(e);return}else if(typeof n=="function"){ut(Tn(n,t),e);return}}e._state=1,e._value=t,Be(e)}catch(r){ge(e,r)}}function ge(e,t){e._state=2,e._value=t,Be(e)}function Be(e){e._state===2&&e._deferreds.length===0&&O._immediateFn(function(){e._handled||O._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)lt(e,e._deferreds[t]);e._deferreds=null}function xn(e,t,n){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.promise=n}function ut(e,t){var n=!1;try{e(function(r){n||(n=!0,Ue(t,r))},function(r){n||(n=!0,ge(t,r))})}catch(r){if(n)return;n=!0,ge(t,r)}}O.prototype.catch=function(e){return this.then(null,e)},O.prototype.then=function(e,t){var n=new this.constructor(_n);return lt(this,new xn(e,t,n)),n},O.prototype.finally=ot,O.all=function(e){return new O(function(t,n){if(!ct(e))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(e);if(r.length===0)return t([]);var a=r.length;function l(s,c){try{if(c&&(typeof c=="object"||typeof c=="function")){var d=c.then;if(typeof d=="function"){d.call(c,function(w){l(s,w)},n);return}}r[s]=c,--a===0&&t(r)}catch(w){n(w)}}for(var u=0;u<r.length;u++)l(u,r[u])})},O.any=at,O.allSettled=st,O.resolve=function(e){return e&&typeof e=="object"&&e.constructor===O?e:new O(function(t){t(e)})},O.reject=function(e){return new O(function(t,n){n(e)})},O.race=function(e){return new O(function(t,n){if(!ct(e))return n(new TypeError("Promise.race accepts an array"));for(var r=0,a=e.length;r<a;r++)O.resolve(e[r]).then(t,n)})},O._immediateFn=typeof setImmediate=="function"&&function(e){setImmediate(e)}||function(e){Cn(e,0)},O._unhandledRejectionFn=function(t){typeof console!="undefined"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var le=(function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("unable to locate global object")})();typeof le.Promise!="function"?le.Promise=O:(le.Promise.prototype.finally||(le.Promise.prototype.finally=ot),le.Promise.allSettled||(le.Promise.allSettled=st),le.Promise.any||(le.Promise.any=at));var be={exports:{}},we={};var dt;function En(){if(dt)return we;dt=1;var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(s,c,d){var w,T={},g=null,D=null;d!==void 0&&(g=""+d),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(D=c.ref);for(w in c)r.call(c,w)&&!l.hasOwnProperty(w)&&(T[w]=c[w]);if(s&&s.defaultProps)for(w in c=s.defaultProps,c)T[w]===void 0&&(T[w]=c[w]);return{$$typeof:t,type:s,key:g,ref:D,props:T,_owner:a.current}}return we.Fragment=n,we.jsx=u,we.jsxs=u,we}var Ce={};var ft;function Rn(){return ft||(ft=1,process.env.NODE_ENV!=="production"&&(function(){var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),R=Symbol.iterator,_="@@iterator";function H(o){if(o===null||typeof o!="object")return null;var m=R&&o[R]||o[_];return typeof m=="function"?m:null}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function L(o){{for(var m=arguments.length,y=new Array(m>1?m-1:0),x=1;x<m;x++)y[x-1]=arguments[x];b("error",o,y)}}function b(o,m,y){{var x=C.ReactDebugCurrentFrame,I=x.getStackAddendum();I!==""&&(m+="%s",y=y.concat([I]));var M=y.map(function(P){return String(P)});M.unshift("Warning: "+m),Function.prototype.apply.call(console[o],console,M)}}var B=!1,U=!1,p=!1,v=!1,S=!1,k;k=Symbol.for("react.module.reference");function V(o){return!!(typeof o=="string"||typeof o=="function"||o===r||o===l||S||o===a||o===d||o===w||v||o===D||B||U||p||typeof o=="object"&&o!==null&&(o.$$typeof===g||o.$$typeof===T||o.$$typeof===u||o.$$typeof===s||o.$$typeof===c||o.$$typeof===k||o.getModuleId!==void 0))}function N(o,m,y){var x=o.displayName;if(x)return x;var I=m.displayName||m.name||"";return I!==""?y+"("+I+")":y}function Q(o){return o.displayName||"Context"}function K(o){if(o==null)return null;if(typeof o.tag=="number"&&L("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case r:return"Fragment";case n:return"Portal";case l:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case w:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case s:var m=o;return Q(m)+".Consumer";case u:var y=o;return Q(y._context)+".Provider";case c:return N(o,o.render,"ForwardRef");case T:var x=o.displayName||null;return x!==null?x:K(o.type)||"Memo";case g:{var I=o,M=I._payload,P=I._init;try{return K(P(M))}catch(E){return null}}}return null}var G=Object.assign,ae=0,he,re,X,xe,Gt,Xt,Jt;function Qt(){}Qt.__reactDisabledLog=!0;function qr(){{if(ae===0){he=console.log,re=console.info,X=console.warn,xe=console.error,Gt=console.group,Xt=console.groupCollapsed,Jt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Qt,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ae++}}function $r(){{if(ae--,ae===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:G({},o,{value:he}),info:G({},o,{value:re}),warn:G({},o,{value:X}),error:G({},o,{value:xe}),group:G({},o,{value:Gt}),groupCollapsed:G({},o,{value:Xt}),groupEnd:G({},o,{value:Jt})})}ae<0&&L("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Je=C.ReactCurrentDispatcher,Qe;function Me(o,m,y){{if(Qe===void 0)try{throw Error()}catch(I){var x=I.stack.trim().match(/\n( *(at )?)/);Qe=x&&x[1]||""}return`
|
|
2
|
+
`+Qe+o}}var qe=!1,Fe;{var eo=typeof WeakMap=="function"?WeakMap:Map;Fe=new eo}function qt(o,m){if(!o||qe)return"";{var y=Fe.get(o);if(y!==void 0)return y}var x;qe=!0;var I=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var M;M=Je.current,Je.current=null,qr();try{if(m){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(q){x=q}Reflect.construct(o,[],P)}else{try{P.call()}catch(q){x=q}o.call(P.prototype)}}else{try{throw Error()}catch(q){x=q}o()}}catch(q){if(q&&x&&typeof q.stack=="string"){for(var E=q.stack.split(`
|
|
3
|
+
`),J=x.stack.split(`
|
|
4
4
|
`),z=E.length-1,W=J.length-1;z>=1&&W>=0&&E[z]!==J[W];)W--;for(;z>=1&&W>=0;z--,W--)if(E[z]!==J[W]){if(z!==1||W!==1)do if(z--,W--,W<0||E[z]!==J[W]){var ee=`
|
|
5
|
-
`+E[z].replace(" at new "," at ");return o.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",o.displayName)),typeof o=="function"&&
|
|
5
|
+
`+E[z].replace(" at new "," at ");return o.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",o.displayName)),typeof o=="function"&&Fe.set(o,ee),ee}while(z>=1&&W>=0);break}}}finally{qe=!1,Je.current=M,$r(),Error.prepareStackTrace=I}var pe=o?o.displayName||o.name:"",ue=pe?Me(pe):"";return typeof o=="function"&&Fe.set(o,ue),ue}function to(o,m,y){return qt(o,!1)}function no(o){var m=o.prototype;return!!(m&&m.isReactComponent)}function Ve(o,m,y){if(o==null)return"";if(typeof o=="function")return qt(o,no(o));if(typeof o=="string")return Me(o);switch(o){case d:return Me("Suspense");case w:return Me("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case c:return to(o.render);case T:return Ve(o.type,m,y);case g:{var x=o,I=x._payload,M=x._init;try{return Ve(M(I),m,y)}catch(P){}}}return""}var Ee=Object.prototype.hasOwnProperty,$t={},en=C.ReactDebugCurrentFrame;function Oe(o){if(o){var m=o._owner,y=Ve(o.type,o._source,m?m.type:null);en.setExtraStackFrame(y)}else en.setExtraStackFrame(null)}function ro(o,m,y,x,I){{var M=Function.call.bind(Ee);for(var P in o)if(M(o,P)){var E=void 0;try{if(typeof o[P]!="function"){var J=Error((x||"React class")+": "+y+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}E=o[P](m,P,x,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(z){E=z}E&&!(E instanceof Error)&&(Oe(I),L("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",x||"React class",y,P,typeof E),Oe(null)),E instanceof Error&&!(E.message in $t)&&($t[E.message]=!0,Oe(I),L("Failed %s type: %s",y,E.message),Oe(null))}}}var oo=Array.isArray;function $e(o){return oo(o)}function so(o){{var m=typeof Symbol=="function"&&Symbol.toStringTag,y=m&&o[Symbol.toStringTag]||o.constructor.name||"Object";return y}}function io(o){try{return tn(o),!1}catch(m){return!0}}function tn(o){return""+o}function nn(o){if(io(o))return L("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",so(o)),tn(o)}var rn=C.ReactCurrentOwner,ao={key:!0,ref:!0,__self:!0,__source:!0},on,sn;function co(o){if(Ee.call(o,"ref")){var m=Object.getOwnPropertyDescriptor(o,"ref").get;if(m&&m.isReactWarning)return!1}return o.ref!==void 0}function lo(o){if(Ee.call(o,"key")){var m=Object.getOwnPropertyDescriptor(o,"key").get;if(m&&m.isReactWarning)return!1}return o.key!==void 0}function uo(o,m){typeof o.ref=="string"&&rn.current}function fo(o,m){{var y=function(){on||(on=!0,L("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(o,"key",{get:y,configurable:!0})}}function ho(o,m){{var y=function(){sn||(sn=!0,L("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(o,"ref",{get:y,configurable:!0})}}var mo=function(o,m,y,x,I,M,P){var E={$$typeof:t,type:o,key:m,ref:y,props:P,_owner:M};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:I}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function po(o,m,y,x,I){{var M,P={},E=null,J=null;y!==void 0&&(nn(y),E=""+y),lo(m)&&(nn(m.key),E=""+m.key),co(m)&&(J=m.ref,uo(m,I));for(M in m)Ee.call(m,M)&&!ao.hasOwnProperty(M)&&(P[M]=m[M]);if(o&&o.defaultProps){var z=o.defaultProps;for(M in z)P[M]===void 0&&(P[M]=z[M])}if(E||J){var W=typeof o=="function"?o.displayName||o.name||"Unknown":o;E&&fo(P,W),J&&ho(P,W)}return mo(o,E,J,I,x,rn.current,P)}}var et=C.ReactCurrentOwner,an=C.ReactDebugCurrentFrame;function me(o){if(o){var m=o._owner,y=Ve(o.type,o._source,m?m.type:null);an.setExtraStackFrame(y)}else an.setExtraStackFrame(null)}var tt;tt=!1;function nt(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function cn(){{if(et.current){var o=K(et.current.type);if(o)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+o+"`."}return""}}function
|
|
7
|
+
Check the render method of \``+o+"`."}return""}}function vo(o){return""}var ln={};function yo(o){{var m=cn();if(!m){var y=typeof o=="string"?o:o.displayName||o.name;y&&(m=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+y+">.")}return m}}function
|
|
9
|
+
Check the top-level render call using <`+y+">.")}return m}}function un(o,m){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var y=yo(m);if(ln[y])return;ln[y]=!0;var x="";o&&o._owner&&o._owner!==et.current&&(x=" It was passed a child from "+K(o._owner.type)+"."),me(o),L('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,x),me(null)}}function dn(o,m){{if(typeof o!="object")return;if($e(o))for(var y=0;y<o.length;y++){var x=o[y];nt(x)&&un(x,m)}else if(nt(o))o._store&&(o._store.validated=!0);else if(o){var I=H(o);if(typeof I=="function"&&I!==o.entries)for(var M=I.call(o),P;!(P=M.next()).done;)nt(P.value)&&un(P.value,m)}}}function go(o){{var m=o.type;if(m==null||typeof m=="string")return;var y;if(typeof m=="function")y=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===c||m.$$typeof===T))y=m.propTypes;else return;if(y){var x=K(m);ro(y,o.props,"prop",x,o)}else if(m.PropTypes!==void 0&&!tt){tt=!0;var I=K(m);L("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",I||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&L("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wo(o){{for(var m=Object.keys(o.props),y=0;y<m.length;y++){var x=m[y];if(x!=="children"&&x!=="key"){me(o),L("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),me(null);break}}o.ref!==null&&(me(o),L("Invalid attribute `ref` supplied to `React.Fragment`."),me(null))}}var fn={};function hn(o,m,y,x,I,M){{var P=V(o);if(!P){var E="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=vo();J?E+=J:E+=cn();var z;o===null?z="null":$e(o)?z="array":o!==void 0&&o.$$typeof===t?(z="<"+(K(o.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):z=typeof o,L("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,E)}var W=po(o,m,y,I,M);if(W==null)return W;if(P){var ee=m.children;if(ee!==void 0)if(x)if($e(ee)){for(var pe=0;pe<ee.length;pe++)dn(ee[pe],o);Object.freeze&&Object.freeze(ee)}else L("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else dn(ee,o)}if(Ee.call(m,"key")){var ue=K(o),q=Object.keys(m).filter(function(Ro){return Ro!=="key"}),rt=q.length>0?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}";if(!fn[ue+rt]){var Eo=q.length>0?"{"+q.join(": ..., ")+": ...}":"{}";L(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,et,le,_o,le),ln[le+et]=!0}}return o===r?vo(W):po(W),W}}function yo(o,m,y){return un(o,m,y,!0)}function go(o,m,y){return un(o,m,y,!1)}var wo=go,Co=yo;we.Fragment=r,we.jsx=wo,we.jsxs=Co})()),we}var ut;function xn(){return ut||(ut=1,process.env.NODE_ENV==="production"?Se.exports=_n():Se.exports=Tn()),Se.exports}var i=xn();const dt=typeof window!="undefined"?f.useLayoutEffect:f.useEffect;function Ce(e,t){const n=f.useRef(e);dt(()=>{n.current=e},[e]),f.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function En(e,t){var n,r,a,l,u,s;if(typeof Intl!="undefined"&&Intl.DateTimeFormat)try{const d=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),w=parseInt(((n=d.find(S=>S.type==="year"))==null?void 0:n.value)||"0",10),_=parseInt(((r=d.find(S=>S.type==="month"))==null?void 0:r.value)||"0",10)-1,g=parseInt(((a=d.find(S=>S.type==="day"))==null?void 0:a.value)||"0",10),N=parseInt(((l=d.find(S=>S.type==="hour"))==null?void 0:l.value)||"0",10),R=parseInt(((u=d.find(S=>S.type==="minute"))==null?void 0:u.value)||"0",10),x=parseInt(((s=d.find(S=>S.type==="second"))==null?void 0:s.value)||"0",10);return new Date(w,_,g,N,R,x)}catch(c){return console.warn(`Failed to convert date to timezone ${t}, returning original date:`,c),e}return console.warn("Intl.DateTimeFormat not available, timezone conversion may be inaccurate"),e}function Rn(e,t,n){return ft(t.getTime()-e.getTime(),n,"milliseconds")}function Sn(){const e=new Date,t="YYYY-MM-DD HH:mm:ss.SSSSSS",n=(a,l=2)=>String(a).padStart(l,"0"),r={YYYY:String(e.getFullYear()),MM:n(e.getMonth()+1),DD:n(e.getDate()),HH:n(e.getHours()),mm:n(e.getMinutes()),ss:n(e.getSeconds()),SSSSSS:n(e.getMilliseconds(),3)+"000"};return Object.entries(r).reduce((a,[l,u])=>a.replace(l,u),t)}const _e=e=>{if(isNaN(e)||e===1/0)return"0:00";const t=l=>(l<10?"0":"")+l,n=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return n===0?`${r}:${t(a)}`:`${n}:${t(r)}:${t(a)}`};function bn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to get time zone, returning default time zone:",e),"Europe/Sarajevo"}}function Pn(e){return ft(e,"milliseconds","seconds")}function ft(e,t,n){const r={days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};return e*(r[t]/r[n])}function ht(e){var n;const t=typeof window!="undefined"&&((n=window.navigator)==null?void 0:n.userAgent)||"";return e.test(t)}const mt=ht(/iPhone|iPad|iPod/i),Ln=ht(/Tizen/i);function jn(){const e=document;return!!(e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||e.msFullscreenElement)}function kn(e){e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.webkitEnterFullScreen?e.webkitEnterFullScreen():e.mozRequestFullScreen&&e.mozRequestFullScreen()}function In(e){e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen&&e.mozCancelFullScreen()}function Dn(e,t){return e.addEventListener("fullscreenchange",t),e.addEventListener("webkitfullscreenchange",t),e.addEventListener("mozfullscreenchange",t),e.addEventListener("MSFullscreenChange",t),()=>{e.removeEventListener("fullscreenchange",t),e.removeEventListener("webkitfullscreenchange",t),e.removeEventListener("mozfullscreenchange",t),e.removeEventListener("MSFullscreenChange",t)}}const Nn=()=>te(),Mn=(e,t)=>({currentTime:0,duration:0,isEnded:!1,isLoading:!1,isLoop:!1,isMetaLoaded:!1,isPlaying:!1,isReady:!1,isStarted:!1,pauseTime:0,seekTime:-1,startTime:-1,volume:100,destroy:()=>{t().isStarted&&t().eventEmitter.emit("ended")},handleDurationChange:()=>{const n=t().techRef.current;n&&e({duration:n.duration})},handleEnd:()=>{t().techRef.current&&(t().eventEmitter.emit("ended"),e({isEnded:!0,isLoading:!1,isMetaLoaded:!1,isPlaying:!1}))},handleLoadedMetadata:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadedMetadata",{duration:n.duration}),n.loop=t().isLoop,n.volume=n.muted?0:1,t().startTime!==-1&&(n.currentTime=t().startTime),e({currentTime:t().startTime!==-1?t().startTime:n.currentTime,duration:n.duration,startTime:-1,isMetaLoaded:!0,volume:n.muted?0:100}))},handleLoadStart:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadStart"),e({isReady:!0}),!(t().isStarted&&!t().isPlaying)&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})}))},handlePause:()=>{t().techRef.current&&(t().eventEmitter.emit("pause"),e({isPlaying:!1,pauseTime:Date.now()}))},handlePlay:()=>{t().techRef.current&&(t().eventEmitter.emit(t().isStarted&&!t().isEnded?"resume":"play"),e({isPlaying:!0,pauseTime:0}))},handlePlaying:()=>{t().techRef.current&&(t().eventEmitter.emit("playing"),e({isLoading:!1}))},handleSeeked:()=>{t().techRef.current&&(t().eventEmitter.emit("seeked"),e({isLoading:!1}))},handleSeeking:()=>{t().techRef.current&&(t().eventEmitter.emit("seeking"),e({isLoading:!0}))},handleTimeUpdate:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("timeUpdate",{currentTime:n.currentTime,duration:n.duration}),e({currentTime:n.currentTime}))},handleWaiting:()=>{t().techRef.current&&(t().eventEmitter.emit("waiting"),e({isLoading:!0}))},handleVolumeChange:()=>{const n=t().techRef.current;n&&t().eventEmitter.emit("volumeChange",{volume:n.volume})},handleError:n=>{const r=t().techRef.current;if(!r)return;t().eventEmitter.emit("error",n);const a=r.error;if(!a)return;const l=`${a.code}`,u=a.message||"Unknown error occurred";e({error:{message:u,code:l,tech:"native"}})},pause:()=>{const n=t().techRef.current;n&&(n.pause(),e({isEnded:!1,isPlaying:!1,pauseTime:Date.now()}))},getPauseTimeDiff:()=>!t().isStarted||!t().pauseTime?0:parseInt(Pn(Date.now()-t().pauseTime).toFixed(0)),play:()=>{const n=t().techRef.current;n&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})})},restart:()=>{t().eventEmitter.emit("restart")},seek:n=>{const r=t().techRef.current;r&&(r.currentTime=n,e({seekTime:-1,currentTime:n,isStarted:!0,isEnded:!1}))},setIsLoading:n=>e({isLoading:n}),setIsLoop:n=>{const r=t().techRef.current;r&&(r.loop=n,e({isLoop:n}))},setStartTime:n=>e({startTime:n}),setVolume:n=>{const r=t().techRef.current;r&&(r.muted=n===0,r.volume=n/100,e({volume:n}))},stop:()=>{t().techRef.current&&e({isPlaying:!1,isLoading:!1})}}),Fn=(e,t)=>({isIdle:!1,setIsIdle:n=>e({isIdle:n}),resetIdle:()=>t().eventEmitter.emit("resetIdle")}),Vn=e=>({idleLocks:new Set,addIdleLock:t=>e(n=>({idleLocks:new Set(n.idleLocks).add(t)})),removeIdleLock:t=>e(n=>{const r=new Set(n.idleLocks);return r.delete(t),{idleLocks:r}})}),An=(e,t)=>({playbackRate:1,setPlaybackRate:n=>{const r=t().techRef.current;r&&(r.playbackRate=n,e({playbackRate:n}))}}),On=(e,t)=>({level:null,levels:null,setLevels:n=>e({levels:n}),setLevel:n=>e({level:n}),logLevel:n=>{n&&t().eventEmitter.emit("qualityChange",{level:n})}}),Hn=(e,t)=>({isFullscreen:!1,isFullscreenReady:!1,exitFullscreen:()=>{t().eventEmitter.emit("fullscreenChange",{isFullscreen:!1}),In(document),e({isFullscreen:!1})},requestFullscreen:()=>{const n=t().techRef.current,r=t().containerRef.current;if(!n||!r)return;t().eventEmitter.emit("fullscreenChange",{isFullscreen:!0});const a=mt?n:r;a&&kn(a),e({isFullscreen:!0})},setIsFullscreen:n=>e({isFullscreen:n}),setIsFullscreenReady:n=>e({isFullscreenReady:n})}),Un=e=>({error:null,setError:t=>e({error:t})}),Bn=()=>({eventEmitter:Nn()}),zn=e=>()=>V({},e),Wn=(e,t)=>Y.create()((...n)=>V(V(V(V(V(V(V(V(V({},Mn(...n)),Fn(...n)),Vn(...n)),An(...n)),On(...n)),Hn(...n)),Un(...n)),Bn(...n)),zn({techRef:e,containerRef:t})(...n))),pt=f.createContext(null);function Yn({children:e}){const t=f.useRef(null),n=f.useRef(null),r=f.useRef(null);return t.current||(t.current=Wn(n,r)),i.jsx(pt.Provider,{value:t.current,children:e})}const h=e=>{const t=f.useContext(pt);if(!t)throw new Error("usePlayerStore must be used within PlayerStoreProvider");return Y.useStore(t,e)},Ue={version:"0.0.60"},Be=11e3,ze={DEBUG:2,INFO:3,WARNING:4};function vt({title:e,id:t,kind:n,delay:r,url:a}){const l=f.useRef(null),u=f.useRef(!1),[s,c]=f.useState(null),d=h(C=>C.eventEmitter),w=h(C=>C.isPlaying),_=a.includes("staging")?"stg":"prd",g=_==="stg"?"https://collector-staging.spectar.tv/ingest":"https://collector.spectar.tv/ingest",N=_==="stg"?"spectar_fitnessanny_staging":"spectar_fitnessanny_production";u.current=w;const R=f.useCallback(async({type:C,message:j,level:P=ze.INFO,duration:B,valueStr1:U,valueStr2:p})=>{const v={content_kind:n,datetime:{date:Sn(),timezone:bn()},installation:N,level_num:P,log_source:"fitnessanny_player",capp_version:Ue.version,message:j,target_index:C==="client"?"client_log":"watching_activity_log"};e&&(v.title=e),t&&(v.value_int1=t),U&&(v.value_str1=U),p&&(v.value_str2=p),C==="watch"&&(B&&(v.interval_duration=B),r&&(v.catchup_time=r));const b=await fetch(g,{method:"POST",body:JSON.stringify(v)});if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`)},[g,r,t,N,n,e]),x=f.useCallback(C=>{l.current=C!=null?C:new Date},[]),S=f.useCallback(async C=>{!C&&l.current&&(C=Rn(l.current,new Date,"milliseconds")),console.log("[Player][Activity]","Watching",C),await R({type:"watch",message:"WATCHING",duration:C})},[R]);return Ce(()=>{S(s),x()},s),f.useEffect(()=>{const C=()=>{c(Be),R({type:"watch",message:"PLAY"}),x()},j=()=>{c(null),R({type:"watch",message:"PAUSE"}),S(),x()},P=()=>{c(Be),R({type:"watch",message:"RESUME"}),x()},B=()=>{c(null),u.current&&(R({type:"watch",message:"STOP"}),S()),c(Be),R({type:"watch",message:"PLAY"}),x()},U=()=>{c(null),R({type:"watch",message:"STOP"}),u.current&&S(),x()},p=({level:b})=>{b&&R({type:"client",message:"QUALITY_CHANGE",level:ze.DEBUG,valueStr1:b})},v=b=>{let I="UNKNOWN_ERROR",A="Unknown error occurred";b instanceof MediaError&&(b.code&&(I=`${b.code}`),b.message&&(A=`${b.message}`)),R({type:"client",message:"ERROR",level:ze.WARNING,valueStr1:I,valueStr2:A})};return d.on("play",C),d.on("pause",j),d.on("resume",P),d.on("restart",B),d.on("ended",U),d.on("qualityChange",p),d.on("error",v),()=>{d.off("play",C),d.off("pause",j),d.off("resume",P),d.off("restart",B),d.off("ended",U),d.off("qualityChange",p),d.off("error",v)}},[d,R,x,S]),null}const Zn=()=>Y.create(e=>({delay:0,startDate:null,viewerCount:null,setDelay:t=>e({delay:t}),setStartDate:t=>e({startDate:t}),setViewerCount:t=>e({viewerCount:t})})),yt=f.createContext(null),Kn=({children:e})=>{const t=f.useRef(null);return t.current||(t.current=Zn()),i.jsx(yt.Provider,{value:t.current,children:e})},H=e=>{const t=f.useContext(yt);if(!t)throw new Error("useLivePlayerStore must be used within PlayerStoreProvider");return Y.useStore(t,e)};function gt(e){try{const n=new URL(e).searchParams,r={};return n.forEach((a,l)=>{r[l]=a}),r}catch(t){return console.error("Invalid URL:",t),{}}}function Gn({url:e}){const{video_id:t}=gt(e),n=H(a=>a.delay),r=t?Number(t):void 0;return r?i.jsx(vt,{kind:n?"catchup":"live",delay:n,url:e,id:r}):null}const oe={playerNotice:"_playerNotice_x3acc_1",playerNoticeTitle:"_playerNoticeTitle_x3acc_19",playerNoticeText:"_playerNoticeText_x3acc_28",playerNoticeLowZIndex:"_playerNoticeLowZIndex_x3acc_37"};function Xn(e){const[,t]=f.useState(0);Ce(()=>t(n=>n+1),e)}function Jn(e){const t=e.split(`
|
|
15
|
-
`);for(const n of t){const r=n.trim();if(r.startsWith("#EXT-X-PROGRAM-DATE-TIME:")){const a=r.replace("#EXT-X-PROGRAM-DATE-TIME:","").trim(),l=new Date(a);if(!isNaN(l.getTime()))return
|
|
16
|
-
`);let r=!1;for(const a of n){const l=a.trim();if(l.startsWith("#EXT-X-STREAM-INF:")){r=!0;continue}if(r&&!l.startsWith("#")){if(l.startsWith("http"))return l;{const u=new URL(t);return new URL(l,u.origin+u.pathname.substring(0,u.pathname.lastIndexOf("/"))+"/").toString()}}}return null}function qn(e){return e.replace("playlist.m3u8","playlist_fmp4_dvr.m3u8")}async function $n(e){try{const t=qn(e);console.log("Converting to DVR URL:",t);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch master playlist: ${n.status} ${n.statusText}`);const r=await n.text(),a=Qn(r,t);if(!a)throw new Error("No chunklist URL found in master playlist");console.log("Found chunklist URL:",a);const l=await fetch(a);if(!l.ok)throw new Error(`Failed to fetch chunklist: ${l.status} ${l.statusText}`);const u=await l.text(),s=Jn(u);return s?console.log("Successfully detected start time:",s.toISOString()):console.log(" No start time found in chunklist"),s}catch(t){return console.error("Error getting start time from HLS URL:",t),null}}function er(n){var r=n,{url:e}=r,t=re(r,["url"]);const[a,l]=f.useState(!0),u=H(d=>d.startDate),s=H(d=>d.setStartDate),c=f.useCallback(async()=>{const d=await $n(e);d&&s(d)},[e,s]);return f.useEffect(()=>{(async()=>{l(!0),await c(),l(!1)})()},[c]),Ce(c,u?null:5e3),a?null:i.jsx(tr,V({},t))}function tr({children:e,messages:t}){const n=H(u=>u.startDate),r=h(u=>u.isStarted);return Xn(r?null:5e3),n?Date.now()<n.getTime()?i.jsx(nr,{startDate:n,title:t.eventNotStarted,message:t.eventStartingSoon}):i.jsx(i.Fragment,{children:e}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:t.unableToPlay})})}function nr({startDate:e,title:t,message:n}){const r=e.getTime()-Date.now(),a=Math.floor(r/(1e3*60*60)),l=Math.floor(r%(1e3*60*60)/(1e3*60));return a||l?i.jsxs("div",{className:oe.playerNotice,children:[i.jsx("h3",{className:oe.playerNoticeTitle,children:t}),i.jsxs("p",{className:oe.playerNoticeText,children:["(",a>0?`${a}h ${l}m`:`${l}m`,")"]})]}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:n})})}function wt({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=()=>e("play",void 0),r=()=>e("pause",void 0),a=()=>e("resume",void 0),l=()=>e("restart",void 0),u=()=>e("ended",void 0),s=()=>e("seeking",void 0),c=()=>e("seeked",void 0),d=C=>e("volumeChange",C),w=C=>e("fullscreenChange",C),_=C=>e("qualityChange",C),g=C=>e("loadedMetadata",C),N=()=>e("loadStart",void 0),R=()=>e("playing",void 0),x=()=>e("waiting",void 0),S=()=>e("error",void 0);return t.on("play",n),t.on("pause",r),t.on("resume",a),t.on("restart",l),t.on("ended",u),t.on("seeking",s),t.on("seeked",c),t.on("volumeChange",d),t.on("fullscreenChange",w),t.on("qualityChange",_),t.on("loadedMetadata",g),t.on("loadStart",N),t.on("playing",R),t.on("waiting",x),t.on("error",S),()=>{t.off("play",n),t.off("pause",r),t.off("resume",a),t.off("restart",l),t.off("ended",u),t.off("seeking",s),t.off("seeked",c),t.off("volumeChange",d),t.off("fullscreenChange",w),t.off("qualityChange",_),t.off("loadedMetadata",g),t.off("loadStart",N),t.off("playing",R),t.off("waiting",x),t.off("error",S)}},[e,t]),null}const Ct=(e,t=0)=>parseInt(Math.max(0,(Date.now()-(e+t*1e3))/1e3).toFixed(0)),_t=(e,t)=>Math.max(0,(Date.now()-e-t*1e3)/1e3),rr=(e,t)=>Math.max(0,(t-e)/1e3),or=(e,t=0)=>{const r=t<0?0:t,a=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"],l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(r))}${a[l]}`};function sr({isAuto:e,level:t,levels:n}){const r=n.length,a=[];return r>1&&a.push({sid:"quality-level-auto",label:"Auto",value:-1,selected:e||t===-1}),n.sort(function(l,u){const s=l.height||l.bitrate||0,c=u.height||u.bitrate||0;return s===c?0:s>c?1:-1}),n.map(l=>{const{bitrate:u,height:s,index:c}=l;a.push({sid:`quality-level-${c}`,label:s?`${s}p`:or(u),value:c,selected:r===1||!e&&c===t})}),a}function ir({callback:e}){const t=H(l=>l.delay),n=H(l=>l.startDate),r=n?n.getTime():0,a=h(l=>l.eventEmitter);return f.useEffect(()=>{const l=()=>e("timeUpdate",{currentTime:_t(r,t),duration:-1});return a.on("timeUpdate",l),()=>{a.off("timeUpdate",l)}},[e,t,a,r]),i.jsx(wt,{callback:e})}function Tt(){const e=h(s=>s.exitFullscreen),t=h(s=>s.isFullscreen),n=h(s=>s.isFullscreenReady),r=h(s=>s.requestFullscreen),a=h(s=>s.setVolume),l=h(s=>s.volume),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowUp":a(l+10<100?l+10:100),c=!0;break;case"ArrowDown":a(l-10>0?l-10:0),c=!0;break;case"KeyM":a(l===0?100:0),c=!0;break;case"KeyF":n&&(t?e():r(),c=!0);break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),null}function ar(){const e=H(s=>s.delay),t=h(s=>s.isPlaying),n=h(s=>s.pause),r=h(s=>s.getPauseTimeDiff),a=h(s=>s.play),l=H(s=>s.setDelay),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e+10),c=!0;break;case"ArrowRight":l(e-10>0?e-10:0),c=!0;break;case"Space":if(t)n();else{const d=r();d&&l(e+d),a()}c=!0;break}c&&s.preventDefault()}},[e,r,t,n,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Tt,{})}function xt({children:e}){return i.jsx(Yn,{children:e})}function cr({children:e}){return i.jsx(Kn,{children:i.jsx(xt,{children:e})})}function lr({url:e,isLive:t,messages:n}){const r=f.useRef(null),a=h(p=>p.level),l=h(p=>p.levels),u=h(p=>p.setLevel),s=h(p=>p.setLevels),c=h(p=>p.logLevel),d=h(p=>p.techRef),w=h(p=>p.setError),_=f.useRef(0),g=f.useRef(null),N=50,R=1e4,x=f.useCallback(p=>{if(r.current&&(r.current.nextLevel=p,u(null),l)){const v=l.map(b=>pe(V({},b),{selected:b.value===p}));s(v)}},[l,u,s]),S=f.useCallback(()=>{if(!d.current)return;console.log("[Player][HLS] MEDIA_ATTACHING");const p=document.createElement("source");p.src=e,p.type="application/vnd.apple.mpegurl",p.dataset.id="original-stream",d.current.appendChild(p),d.current.disableRemotePlayback=!1},[e,d]),C=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] MANIFEST_LOADED"),w(null),g.current&&(clearTimeout(g.current),g.current=null),_.current=0;const p=r.current.levels,v=r.current.currentLevel,b=r.current.autoLevelEnabled;s(sr({levels:p.map((I,A)=>{const{bitrate:M,height:Q,width:K}=I;return{bitrate:M,height:Q,index:A,width:K}}),level:v,isAuto:b}))},[w,s]),j=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] LEVEL_SWITCHED");const p=r.current.levels,v=r.current.currentLevel;if(p[v]?JSON.stringify(p[v]):null){let I="";p[v].height?I=`${p[v].height}p`:p[v].bitrate&&(I=`${p[v].bitrate}bps`),c(I)}},[c]),P=f.useCallback((p,v)=>{if(r.current&&v.fatal){let b,I="UNKNOWN_ERROR";switch(v.type){case $.ErrorTypes.NETWORK_ERROR:b=n.unableToPlay,console.log("[Player][HLS] NETWORK_ERROR",v),t?(_.current<N&&(g.current&&clearTimeout(g.current),_.current+=1,g.current=setTimeout(()=>{if(r.current)try{console.log("[Player][HLS] Retrying stream..."),r.current.loadSource(e)}catch(A){console.error("[Player][HLS] Retry failed:",A)}},R)),I="LIVE_MANIFEST_LOAD_ERROR"):(r.current.startLoad(),I="NETWORK_ERROR"),w({message:b,code:I,tech:"hls"});break;case $.ErrorTypes.MEDIA_ERROR:r.current.recoverMediaError();break}}},[t,e,w,n]),B=f.useCallback(()=>{if(!d.current)return;const p={startLevel:-1,maxBufferSize:30*1024*1024};Ln?(p.backBufferLength=-1,p.enableWorker=!1):t?p.backBufferLength=10:p.backBufferLength=60;try{console.log("[Player][HLS] URL",e),console.log("[Player][HLS] Config",JSON.stringify(p)),console.log("[Player][HLS] Version",$.version),r.current=new $(p),r.current.on($.Events.MEDIA_ATTACHING,S),r.current.on($.Events.MANIFEST_LOADED,C),r.current.on($.Events.LEVEL_SWITCHED,j),r.current.on($.Events.ERROR,P),r.current.attachMedia(d.current),r.current.loadSource(e)}catch(v){throw new Error(`Error initializing Hls: ${v}`)}},[S,C,j,P,t,d,e]),U=f.useCallback(()=>{if(r.current&&(r.current.off($.Events.MEDIA_ATTACHING,S),r.current.off($.Events.MANIFEST_LOADED,C),r.current.off($.Events.LEVEL_SWITCHED,j),r.current.off($.Events.ERROR,P),r.current.destroy(),r.current=null),d.current){const p=d.current;Array.from(p.children).filter(b=>{var I;return((I=b.dataset)==null?void 0:I.id)==="original-stream"}).forEach(b=>p.removeChild(b))}g.current&&(clearTimeout(g.current),g.current=null),_.current=0},[S,j,C,P,d]);return f.useEffect(()=>{a!==null&&x(a)},[a,x]),f.useEffect(()=>($.isSupported()&&B(),U),[U,B]),null}const ur={playerVideo:"_playerVideo_wc0sm_1"};function Et({url:e,isLive:t,isMuted:n=!1,messages:r}){const a=h(v=>v.destroy),l=h(v=>v.handleDurationChange),u=h(v=>v.handleEnd),s=h(v=>v.handleLoadedMetadata),c=h(v=>v.handleLoadStart),d=h(v=>v.handlePause),w=h(v=>v.handlePlay),_=h(v=>v.handlePlaying),g=h(v=>v.handleSeeked),N=h(v=>v.handleSeeking),R=h(v=>v.handleTimeUpdate),x=h(v=>v.handleWaiting),S=h(v=>v.handleVolumeChange),C=h(v=>v.handleError),j=h(v=>v.techRef),P=f.useRef(null),B=()=>t?{onTimeUpdate:U}:{onDurationChange:l,onSeeked:g,onSeeking:N,onTimeUpdate:U},U=()=>{(!P.current||Date.now()-P.current>=1e3)&&(R(),P.current=Date.now())},p=B();return f.useEffect(()=>()=>{a()},[a]),i.jsxs(i.Fragment,{children:[i.jsx(lr,{isLive:t,url:e,messages:r}),i.jsx("video",V({ref:j,className:ur.playerVideo,playsInline:!0,controls:!1,muted:n,preload:"auto",crossOrigin:"anonymous",onEnded:u,onError:C,onLoadedMetadata:s,onLoadStart:c,onPause:d,onPlay:w,onPlaying:_,onWaiting:x,onVolumeChange:S,tabIndex:-1},p))]})}function dr({url:e,messages:t}){const[n,r]=f.useState(null),a=H(u=>u.delay),l=f.useCallback(async()=>{r(a?e.replace("-live","-catchup").replace("playlist.m3u8",`playlist_fmp4_dvr_timeshift-${a}.m3u8`):e)},[a,e]);return f.useEffect(()=>{const u=requestAnimationFrame(()=>l());return()=>cancelAnimationFrame(u)},[l]),n?i.jsx(Et,{url:n,isLive:!0,messages:t}):null}function fr({url:e}){return h(n=>n.isStarted)?i.jsx(hr,{url:e}):null}function hr({url:e}){const t=H(l=>l.setViewerCount),n=f.useRef(null),r=l=>{try{return new URL(l).pathname.split("/").filter(d=>d.length>0)[0]||null}catch(u){return console.error("Failed to extract URI from player URL:",u),null}},a=f.useCallback(async()=>{var c;const l=r(e);if(!l){console.error("Could not extract URI from URL:",e);return}n.current&&n.current.abort(),n.current=new AbortController;const s=`https://${e.includes("staging")?"stg":"prd"}-fitnessanny.spectar.tv/analytics-api/v1/token-info/uri/${l}`;try{const d=await fetch(s,{signal:n.current.signal});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const _=(c=(await d.json()).count)!=null?c:0;t(_)}catch(d){if(d.name==="AbortError")return;console.error("Failed to fetch viewer count:",d),t(null)}},[t,e]);return f.useEffect(()=>(a(),()=>{n.current&&n.current.abort()}),[a,e]),Ce(a,15e3),null}function mr(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=s=>typeof window=="undefined"?t:window.matchMedia(s).matches,[a,l]=f.useState(()=>n?r(e):t);function u(){l(r(e))}return dt(()=>{if(typeof window=="undefined")return;const s=window.matchMedia(e);return u(),s.addListener?s.addListener(u):s.addEventListener("change",u),()=>{s.removeListener?s.removeListener(u):s.removeEventListener("change",u)}},[e]),a}const ue={playbackButton:"_playbackButton_lgsgw_1",seekIndicator:"_seekIndicator_lgsgw_23",seekIndicatorLeft:"_seekIndicatorLeft_lgsgw_49",seekIndicatorRight:"_seekIndicatorRight_lgsgw_53",seekIndicatorVisible:"_seekIndicatorVisible_lgsgw_57"},pr=10;function Rt(s){var c=s,{className:e,onClick:t,onForwardSeek:n,onBackwardSeek:r,maxForwardTime:a,maxBackwardTime:l}=c,u=re(c,["className","onClick","onForwardSeek","onBackwardSeek","maxForwardTime","maxBackwardTime"]);return mr("(pointer: coarse)")?i.jsx(yr,V({className:e,maxForwardTime:a,maxBackwardTime:l,onForwardSeek:n,onBackwardSeek:r},u)):i.jsx(vr,V({className:e,onClick:t},u))}function vr(r){var a=r,{className:e,onClick:t}=a,n=re(a,["className","onClick"]);const l=f.useRef(null),u=h(x=>x.exitFullscreen),s=h(x=>x.isFullscreen),c=h(x=>x.requestFullscreen),d=h(x=>x.resetIdle),w=x=>{N()?(g(),s?u():c()):_(x)},_=x=>{l.current=window.setTimeout(()=>{t==null||t(x),g()},200)},g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},N=()=>l.current!==null,R=()=>{d()};return f.useEffect(()=>()=>{g()},[]),i.jsx("button",V({onClick:w,onMouseMove:R,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},n))}function yr(u){var s=u,{className:e,maxForwardTime:t,maxBackwardTime:n,onForwardSeek:r,onBackwardSeek:a}=s,l=re(s,["className","maxForwardTime","maxBackwardTime","onForwardSeek","onBackwardSeek"]);const c=f.useRef(null),d=f.useRef({single:null,indicator:null,accumulate:null}),w=f.useRef(null),_=f.useRef(0),g=f.useRef(null),[N,R]=f.useState({visible:!1,direction:null,time:0}),x=h(p=>p.isIdle),S=h(p=>p.setIsIdle),C=h(p=>p.resetIdle),j=(p,v)=>p<v/2?"backward":"forward",P=p=>{if(!w.current)return;const v=p.changedTouches[0];if(!v)return;const b=Date.now(),I=w.current.getBoundingClientRect(),A=v.clientX-I.left,M=v.clientY-I.top;if(A<0||A>I.width||M<0||M>I.height)return;const Q=c.current,K=Q?b-Q.time:1/0,G=j(A,I.width),ie=g.current!==null&&g.current===G&&Q!==null&&K<700&&Math.abs(A-Q.x)<100;if(Q!==null&&g.current===null&&K<300&&Math.abs(A-Q.x)<50||ie){p.preventDefault(),p.stopPropagation(),d.current.single&&(window.clearTimeout(d.current.single),d.current.single=null),C(),(g.current===null||g.current!==G)&&(_.current=0,g.current=G);const ne=G==="backward"?n:t;_.current=Math.min(_.current+pr,ne!=null?ne:1/0),B(G,_.current),d.current.accumulate&&window.clearTimeout(d.current.accumulate),d.current.accumulate=window.setTimeout(()=>{const X=_.current;X>0&&(g.current==="backward"?a==null||a(X):r==null||r(X),C()),_.current=0,g.current=null,c.current=null,U(),d.current.accumulate=null},500),c.current={time:b,x:A}}else{c.current={time:b,x:A},d.current.single&&window.clearTimeout(d.current.single);const ne=g.current!==null?700:350;d.current.single=window.setTimeout(()=>{if(g.current===null){d.current.single=null;const X=x;S(!X),X&&C()}c.current=null},ne)}},B=(p,v)=>{v!==0&&(R({visible:!0,direction:p,time:v}),d.current.indicator&&window.clearTimeout(d.current.indicator),d.current.indicator=window.setTimeout(()=>{U()},700))},U=()=>{R({visible:!1,direction:null,time:0}),d.current.indicator&&(window.clearTimeout(d.current.indicator),d.current.indicator=null)};return f.useEffect(()=>{const p=d.current;return()=>{p!=null&&p.single&&window.clearTimeout(p.single),p!=null&&p.indicator&&window.clearTimeout(p.indicator),p!=null&&p.accumulate&&window.clearTimeout(p.accumulate)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("button",V({ref:w,onTouchEnd:P,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},l)),N.visible&&i.jsxs("div",{className:`${ue.seekIndicator} ${ue.seekIndicatorVisible} ${N.direction==="backward"?ue.seekIndicatorLeft:ue.seekIndicatorRight}`,children:[N.direction==="backward"?"-":"+",_e(N.time)]})]})}function gr(){const e=h(c=>c.isPlaying),t=h(c=>c.pause),n=h(c=>c.getPauseTimeDiff),r=h(c=>c.play),a=H(c=>c.delay),l=H(c=>c.setDelay),u=H(c=>c.startDate),s=u?u.getTime():0;return i.jsx(Rt,{onClick:()=>{if(e)t();else{const c=n();c&&l(a+c),r()}},onBackwardSeek:c=>{const d=a+c;l(d)},onForwardSeek:c=>{const d=Math.max(0,a-c);l(d)},maxBackwardTime:Math.floor(s),maxForwardTime:Math.floor(a)})}const St={playerButton:"_playerButton_izwqq_1",playerButtonCircle:"_playerButtonCircle_izwqq_42"},ae=f.forwardRef((a,r)=>{var l=a,{shape:e="circle",className:t}=l,n=re(l,["shape","className"]);const u=e==="circle"?St.playerButtonCircle:"",s=[St.playerButton,u,t].filter(Boolean).join(" ");return i.jsx("button",V({ref:r,className:s},n))});ae.displayName="PlayerButton";const be={liveIndicator:"_liveIndicator_1jczn_1",liveIndicatorHasDelay:"_liveIndicatorHasDelay_1jczn_9",liveIndicatorNoDelay:"_liveIndicatorNoDelay_1jczn_13"};function wr(n){var r=n,{message:e}=r,t=re(r,["message"]);const a=h(d=>d.restart),l=H(d=>d.delay),u=H(d=>d.setDelay),s=()=>{l&&(a(),u(0))},c=l?`${be.liveIndicator} ${be.liveIndicatorHasDelay}`:`${be.liveIndicator} ${be.liveIndicatorNoDelay}`;return i.jsxs(ae,pe(V({onClick:s,shape:"square"},t),{children:[i.jsx("div",{className:c}),e||"Live"]}))}function bt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6 5H8V19H6V5ZM16 5H18V19H16V5Z"})})}function Pt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M19.376 12.4161L8.77735 19.4818C8.54759 19.635 8.23715 19.5729 8.08397 19.3432C8.02922 19.261 8 19.1645 8 19.0658V4.93433C8 4.65818 8.22386 4.43433 8.5 4.43433C8.59871 4.43433 8.69522 4.46355 8.77735 4.5183L19.376 11.584C19.6057 11.7372 19.6678 12.0477 19.5146 12.2774C19.478 12.3323 19.4309 12.3795 19.376 12.4161Z"})})}function Cr(){const e=h(s=>s.isPlaying),t=h(s=>s.pause),n=h(s=>s.getPauseTimeDiff),r=h(s=>s.play),a=H(s=>s.delay),l=H(s=>s.setDelay),u=()=>{if(e)t();else{const s=n();s&&l(a+s),r()}};return i.jsx(ae,{onClick:u,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const se={progressSlider:"_progressSlider_hwzgf_1",tipContainer:"_tipContainer_hwzgf_7",tipContainerVisible:"_tipContainerVisible_hwzgf_17",tipContainerHidden:"_tipContainerHidden_hwzgf_22",tipContent:"_tipContent_hwzgf_27"},Pe={sliderRoot:"_sliderRoot_aeak6_1",sliderTrack:"_sliderTrack_aeak6_18",sliderRange:"_sliderRange_aeak6_28",sliderThumb:"_sliderThumb_aeak6_37"},Le=f.forwardRef((l,a)=>{var u=l,{max:e=100,min:t=0,className:n}=u,r=re(u,["max","min","className"]);return i.jsxs(Ee.Root,pe(V({ref:a,min:t,max:e,"aria-label":"Player progress",className:[Pe.sliderRoot,n].filter(Boolean).join(" "),onKeyDown:s=>s.preventDefault()},r),{children:[i.jsx(Ee.Track,{className:Pe.sliderTrack,children:i.jsx(Ee.Range,{className:Pe.sliderRange})}),i.jsx(Ee.Thumb,{className:Pe.sliderThumb})]}))});Le.displayName="PlayerSlider";function je(e){const t=e.getBoundingClientRect();return e.offsetWidth/e.offsetHeight>e.clientWidth/e.clientHeight?{left:t.left*100,right:t.right*100,top:t.top*100,bottom:t.bottom*100,width:t.width*100,height:t.height*100}:t}const Lt="vod-player-progress-bar";function _r(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(0),[a,l]=f.useState(0),[u,s]=f.useState(!1),[c,d]=f.useState(-1),[w,_]=f.useState(-1),g=H(M=>M.delay),N=H(M=>M.startDate),R=N?N.getTime():0,x=new Date().getTime(),S=H(M=>M.setDelay),C=h(M=>M.isPlaying),j=h(M=>M.addIdleLock),P=h(M=>M.removeIdleLock),B=f.useCallback(()=>{r(_t(R,g)),l(rr(R,x))},[g,x,R]),U=parseFloat((a?(w!==-1?w:n)/a*100:0).toFixed(1)),p=M=>{_(a*(M[0]/100)),j(Lt)},v=()=>{if(w!==-1){const M=Ct(R,w);S(M),_(-1),P(Lt)}},b=()=>s(!0),I=()=>s(!1),A=f.useCallback(M=>{const Q=e.current,K=t.current;if(Q&&K){const G=je(Q),ie=je(K),fe=(M.pageX||M.clientX)-G.left,ne=fe/G.width;if(ne<0)return;let X=fe-ie.width/2;X<0&&(X=0),X>G.width-ie.width&&(X=-1),K.style.left=X>-1?`${X}px`:"auto",K.style.right=X>-1?"auto":"0px";const Te=a-ne*a;d(Te>0?Te:0)}b()},[a]);return Ce(()=>B(),C?1e3:null),f.useEffect(()=>{const M=requestAnimationFrame(()=>B());return()=>cancelAnimationFrame(M)},[B]),i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[U],onPointerLeave:I,onPointerDown:I,onPointerMove:A,onValueChange:p,onValueCommit:v,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${u?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:`-${_e(c)}`})})]})}function Tr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M22 12C22 17.5228 17.5229 22 12 22C6.4772 22 2 17.5228 2 12C2 6.47715 6.4772 2 12 2V4C7.5817 4 4 7.58172 4 12C4 16.4183 7.5817 20 12 20C16.4183 20 20 16.4183 20 12C20 9.53614 18.8862 7.33243 17.1346 5.86492L15 8V2L21 2L18.5535 4.44656C20.6649 6.28002 22 8.9841 22 12Z"})})}function xr(){const e=H(a=>a.startDate),t=H(a=>a.setDelay),n=e?e.getTime():0,r=()=>t(Ct(n));return i.jsx(ae,{onClick:r,children:i.jsx(Tr,{})})}const ke={viewersContainer:"_viewersContainer_z1ihz_1",viewersIndicator:"_viewersIndicator_z1ihz_16",viewersIcon:"_viewersIcon_z1ihz_24",viewersCount:"_viewersCount_z1ihz_28"};function Er(){const e=H(t=>t.viewerCount);return e?i.jsxs("div",{className:ke.viewersContainer,children:[i.jsx("span",{className:ke.viewersIndicator}),i.jsxs("svg",{className:ke.viewersIcon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M8 7C9.10457 7 10 6.10457 10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5C6 6.10457 6.89543 7 8 7Z",fill:"currentColor"}),i.jsx("path",{d:"M8 8C5.79086 8 4 9.79086 4 12V13H12V12C12 9.79086 10.2091 8 8 8Z",fill:"currentColor"})]}),i.jsx("span",{className:ke.viewersCount,children:e.toLocaleString()})]}):null}function jt(){const e=h(n=>n.error);if(!e)return null;const t=e.code==="LIVE_MANIFEST_LOAD_ERROR";return i.jsx("div",{className:`${oe.playerNotice} ${t?oe.playerNoticeLowZIndex:""}`,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:e.message})})}const Z={playerContainer:"_playerContainer_146tx_1",controlsTop:"_controlsTop_146tx_12",controlsBottom:"_controlsBottom_146tx_29",controlsContainer:"_controlsContainer_146tx_45",controlsRow:"_controlsRow_146tx_61",controlsSection:"_controlsSection_146tx_68",controlsSectionStart:"_controlsSectionStart_146tx_78",controlsSectionEnd:"_controlsSectionEnd_146tx_82"};function Rr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M16 3H22V9H20V5H16V3ZM2 3H8V5H4V9H2V3ZM20 19V15H22V21H16V19H20ZM4 19H8V21H2V15H4V19Z"})})}function Sr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z"})})}function kt(){const e=h(d=>d.containerRef),t=h(d=>d.exitFullscreen),n=h(d=>d.isFullscreen),r=h(d=>d.requestFullscreen),a=h(d=>d.setIsFullscreen),l=h(d=>d.setIsFullscreenReady),u=h(d=>d.techRef),s=f.useCallback(d=>{d.stopPropagation(),a(jn())},[a]),c=()=>{n?t():r()};return f.useEffect(()=>{const d=mt?u.current:e.current;if(d)return Dn(d,s)},[e,s,u]),f.useEffect(()=>{l(!0)},[l]),i.jsx(ae,{onClick:c,children:n?i.jsx(Sr,{}):i.jsx(Rr,{})})}const We={idleCheckContainer:"_idleCheckContainer_crh2s_1",idleCheckContainerIdle:"_idleCheckContainerIdle_crh2s_5",idleCheckContainerActive:"_idleCheckContainerActive_crh2s_11"},br=5*1e3;function It({children:e}){const t=f.useRef(null),n=h(g=>g.isIdle),r=h(g=>g.setIsIdle),a=f.useRef(null),u=h(g=>g.idleLocks).size,s=h(g=>g.eventEmitter),c=f.useCallback(()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},[]),d=f.useCallback(()=>{c(),a.current=window.setTimeout(()=>r(!0),br)},[c,r]);f.useEffect(()=>(r(!1),d(),()=>{c()}),[c,r,d]),f.useEffect(()=>{const g=()=>{r(!1),d()};return s.on("resetIdle",g),()=>{s.off("resetIdle",g)}},[s,r,d]);const w=n&&!u,_=`${We.idleCheckContainer} ${w?We.idleCheckContainerIdle:We.idleCheckContainerActive}`;return i.jsx("div",{ref:t,className:_,children:e})}const Pr={spinner:"_spinner_oo4hi_10"};function Lr(e){return i.jsx("div",V({className:Pr.spinner},e))}function jr(e,t=500){const[n,r]=f.useState(e);return f.useEffect(()=>{const a=window.setTimeout(()=>r(e),t);return()=>{window.clearTimeout(a)}},[e,t]),n}const kr={loadingContainer:"_loadingContainer_v9v7r_1"};function Dt(n){var r=n,{style:e}=r,t=re(r,["style"]);const a=h(u=>u.isLoading);return jr(a,100)?i.jsx("div",pe(V({className:kr.loadingContainer,style:e},t),{children:i.jsx(Lr,{})})):null}function Nt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})})}function Ir(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 5V19H20V5H4ZM3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3ZM7.5 11.25H9.5V9H11V15H9.5V12.75H7.5V15H6V9H7.5V11.25ZM14.5 10.5V13.5H16C16.2761 13.5 16.5 13.2761 16.5 13V11C16.5 10.7239 16.2761 10.5 16 10.5H14.5ZM13 9H16C17.1046 9 18 9.89543 18 11V13C18 14.1046 17.1046 15 16 15H13V9Z"})})}const de={dropdownMenuContent:"_dropdownMenuContent_zi433_1",dropdownMenuItem:"_dropdownMenuItem_zi433_77",scrollAreaRoot:"_scrollAreaRoot_zi433_120",scrollAreaViewport:"_scrollAreaViewport_zi433_127",scrollAreaScrollbar:"_scrollAreaScrollbar_zi433_133",scrollAreaThumb:"_scrollAreaThumb_zi433_160"},Mt=ve.Root,Ft=ve.Trigger,Vt=ve.Portal,Ye=f.forwardRef((l,a)=>{var u=l,{sideOffset:e=4,className:t,children:n}=u,r=re(u,["sideOffset","className","children"]);return i.jsx(ve.Content,pe(V({ref:a,sideOffset:e,className:[de.dropdownMenuContent,t].filter(Boolean).join(" "),onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()}},r),{children:i.jsxs(Re.Root,{className:de.scrollAreaRoot,type:"always",scrollHideDelay:0,children:[i.jsx(Re.Viewport,{className:de.scrollAreaViewport,children:n}),i.jsx(Re.Scrollbar,{className:de.scrollAreaScrollbar,orientation:"vertical",children:i.jsx(Re.Thumb,{className:de.scrollAreaThumb})})]})}))});Ye.displayName="PlayerMenuContent";const Ze=f.forwardRef((a,r)=>{var l=a,{className:e,onClick:t}=l,n=re(l,["className","onClick"]);const u=c=>{t==null||t(c)},s=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t==null||t(c))};return i.jsx(ve.Close,{asChild:!0,children:i.jsx("div",V({ref:r,className:[de.dropdownMenuItem,e].filter(Boolean).join(" "),role:"menuitem",tabIndex:0,onClick:u,onKeyDown:s},n))})});Ze.displayName="PlayerMenuItem";const At="quality";function Ot(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.levels),u=h(c=>c.setLevel),s=f.useCallback(c=>{t(c),c?r(At):a(At)},[r,a]);return!l||l.length===0?null:i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsx(ae,{children:i.jsx(Ir,{})})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ye,{side:"top",align:"end",children:l.map(c=>i.jsxs(Ze,{onClick:()=>u(c.value),children:[c.label,c.selected&&i.jsx(Nt,{})]},c.sid))})})]})}function Dr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6.60282 10.0001L10 7.22056V16.7796L6.60282 14.0001H3V10.0001H6.60282ZM2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"})})}function Nr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M13 7.22056L9.60282 10.0001H6V14.0001H9.60282L13 16.7796V7.22056ZM8.88889 16.0001H5C4.44772 16.0001 4 15.5524 4 15.0001V9.00007C4 8.44778 4.44772 8.00007 5 8.00007H8.88889L14.1834 3.66821C14.3971 3.49335 14.7121 3.52485 14.887 3.73857C14.9601 3.8279 15 3.93977 15 4.05519V19.9449C15 20.2211 14.7761 20.4449 14.5 20.4449C14.3846 20.4449 14.2727 20.405 14.1834 20.3319L8.88889 16.0001ZM18.8631 16.5911L17.4411 15.1691C18.3892 14.4376 19 13.2902 19 12.0001C19 10.5697 18.2493 9.31476 17.1203 8.60766L18.5589 7.16906C20.0396 8.26166 21 10.0187 21 12.0001C21 13.8422 20.1698 15.4905 18.8631 16.5911Z"})})}function Mr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M10 7.22056L6.60282 10.0001H3V14.0001H6.60282L10 16.7796V7.22056ZM5.88889 16.0001H2C1.44772 16.0001 1 15.5524 1 15.0001V9.00007C1 8.44778 1.44772 8.00007 2 8.00007H5.88889L11.1834 3.66821C11.3971 3.49335 11.7121 3.52485 11.887 3.73857C11.9601 3.8279 12 3.93977 12 4.05519V19.9449C12 20.2211 11.7761 20.4449 11.5 20.4449C11.3846 20.4449 11.2727 20.405 11.1834 20.3319L5.88889 16.0001ZM20.4142 12.0001L23.9497 15.5356L22.5355 16.9498L19 13.4143L15.4645 16.9498L14.0503 15.5356L17.5858 12.0001L14.0503 8.46454L15.4645 7.05032L19 10.5859L22.5355 7.05032L23.9497 8.46454L20.4142 12.0001Z"})})}const Ht={volumeContainer:"_volumeContainer_4d6jg_1",volumeSlider:"_volumeSlider_4d6jg_8"},Ut="volume";function Bt(){const e=h(s=>s.setVolume),t=h(s=>s.volume),n=h(s=>s.addIdleLock),r=h(s=>s.removeIdleLock),a=s=>{e(s[0]),n(Ut)},l=()=>{r(Ut)},u=()=>e(t?0:100);return i.jsxs("div",{className:Ht.volumeContainer,children:[i.jsx(ae,{onClick:u,className:"shrink-0",children:t?t>50?i.jsx(Dr,{}):i.jsx(Nr,{}):i.jsx(Mr,{})}),i.jsx("div",{className:Ht.volumeSlider,children:i.jsx(Le,{value:[t],onValueChange:a,onValueCommit:l})})]})}function Fr(e){return i.jsx(cr,{children:i.jsx(Vr,V({},e))})}function Vr({url:e,messages:t={},onEvent:n}){var l,u,s,c;const r=h(d=>d.containerRef),a={eventNotStarted:"Event has not started yet.",eventStartingSoon:"Starting in few seconds...",unableToPlay:"Unable to play the live stream. Please try again later."};return f.useEffect(()=>{console.log(`[Player][Live] Version: ${Ue.version}`)},[]),i.jsxs("div",{ref:r,className:Z.playerContainer,children:[i.jsxs(er,{url:e,messages:{eventNotStarted:(l=t==null?void 0:t.eventNotStarted)!=null?l:a.eventNotStarted,eventStartingSoon:(u=t==null?void 0:t.eventStartingSoon)!=null?u:a.eventStartingSoon,unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:a.unableToPlay},children:[i.jsx(dr,{url:e,messages:{unableToPlay:(c=t==null?void 0:t.unableToPlay)!=null?c:a.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(gr,{}),i.jsxs(It,{children:[i.jsx("div",{className:Z.controlsTop,children:i.jsx("div",{className:Z.controlsContainer,children:i.jsx("div",{className:Z.controlsRow,children:i.jsx(Er,{})})})}),i.jsx("div",{className:Z.controlsBottom,children:i.jsxs("div",{className:Z.controlsContainer,children:[i.jsx(_r,{}),i.jsxs("div",{className:Z.controlsRow,children:[i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionStart}`,children:[i.jsx(Cr,{}),i.jsx(xr,{}),i.jsx(Bt,{})]}),i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionEnd}`,children:[i.jsx(wr,{message:t==null?void 0:t.live}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})]}),i.jsx(Gn,{url:e}),i.jsx(ar,{}),i.jsx(fr,{url:e})]}),n&&i.jsx(ir,{callback:n})]})}const Ar=[.5,.75,1,1.25,1.5,1.75,2],zt="playback-rate";function Or(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.playbackRate),u=h(c=>c.setPlaybackRate),s=f.useCallback(c=>{t(c),c?r(zt):a(zt)},[r,a]);return i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsxs(ae,{children:[l,"x"]})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ye,{side:"top",align:"end",children:Ar.map(c=>i.jsxs(Ze,{onClick:()=>u(c),children:[c,"x",l===c&&i.jsx(Nt,{})]},c))})})]})}function Hr(){const e=h(u=>u.isPlaying),t=h(u=>u.pause),n=h(u=>u.play),r=h(u=>u.currentTime),a=h(u=>u.duration),l=h(u=>u.seek);return i.jsx(Rt,{onClick:()=>{e?t():n()},onBackwardSeek:u=>{const s=Math.max(0,r-u);l(s)},onForwardSeek:u=>{const s=Math.min(r+u,a);l(s)},maxBackwardTime:Math.floor(r),maxForwardTime:Math.floor(a-r)})}function Ur(){const e=h(a=>a.isPlaying),t=h(a=>a.pause),n=h(a=>a.play),r=()=>{e?t():n()};return i.jsx(ae,{onClick:r,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const Wt="vod-player-progress-bar";function Br(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(!1),[a,l]=f.useState(-1),[u,s]=f.useState(-1),c=h(P=>P.currentTime),d=h(P=>P.duration),w=h(P=>P.seek),_=h(P=>P.addIdleLock),g=h(P=>P.removeIdleLock),N=parseFloat((d?(u!==-1?u:c)/d*100:0).toFixed(1)),R=P=>{s(d*(P[0]/100)),_(Wt)},x=()=>{u!==-1&&(w(u),s(-1),g(Wt))},S=()=>r(!0),C=()=>r(!1),j=f.useCallback(P=>{const B=e.current,U=t.current;if(B&&U){const p=je(B),v=je(U),b=(P.pageX||P.clientX)-p.left,I=b/p.width;if(I<0)return;let A=b-v.width/2;A<0&&(A=0),A>p.width-v.width&&(A=-1),U.style.left=A>-1?`${A}px`:"auto",U.style.right=A>-1?"auto":"0px",l(I*d)}S()},[d]);return i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[N],onPointerLeave:C,onPointerDown:C,onPointerMove:j,onValueChange:R,onValueCommit:x,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${n?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:_e(a)})})]})}const Ie={remainingTimeContainer:"_remainingTimeContainer_1yyhb_1",remainingTime:"_remainingTime_1yyhb_1",remainingSeparator:"_remainingSeparator_1yyhb_17"};function zr(){const e=h(n=>n.currentTime),t=h(n=>n.duration);return i.jsxs("div",{className:Ie.remainingTimeContainer,children:[i.jsx("p",{className:Ie.remainingTime,children:_e(e)}),i.jsx("p",{className:Ie.remainingSeparator}),i.jsx("p",{className:Ie.remainingTime,children:_e(t)})]})}function Wr({url:e}){const{video_id:t}=gt(e),n=t?Number(t):void 0;return n?i.jsx(vt,{kind:"vod",url:e,id:n}):null}function Yr({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=r=>e("timeUpdate",r);return t.on("timeUpdate",n),()=>{t.off("timeUpdate",n)}},[e,t]),i.jsx(wt,{callback:e})}function Zr(){const e=h(s=>s.currentTime),t=h(s=>s.duration),n=h(s=>s.isPlaying),r=h(s=>s.pause),a=h(s=>s.play),l=h(s=>s.seek),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e-10>=0?e-10:0),c=!0;break;case"ArrowRight":l(e+10<t?e+10:t),c=!0;break;case"Space":n?r():a(),c=!0;break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Tt,{})}function Kr(e){return i.jsx(xt,{children:i.jsx(Gr,V({},e))})}function Gr({url:e,messages:t,onEvent:n,startTime:r}){var s;const a=h(c=>c.setStartTime),l=h(c=>c.containerRef),u={unableToPlay:"Unable to play the video. Please try again later."};return f.useEffect(()=>{r&&a(r)},[r,a]),f.useEffect(()=>{console.log(`[Player][VOD] Version: ${Ue.version}`)},[]),i.jsxs("div",{ref:l,className:Z.playerContainer,children:[i.jsx(Et,{url:e,isLive:!1,messages:{unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:u.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(Hr,{}),i.jsx(It,{children:i.jsx("div",{className:Z.controlsBottom,children:i.jsxs("div",{className:Z.controlsContainer,children:[i.jsx(Br,{}),i.jsxs("div",{className:Z.controlsRow,children:[i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionStart}`,children:[i.jsx(Ur,{}),i.jsx(Bt,{}),i.jsx(zr,{})]}),i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionEnd}`,children:[i.jsx(Or,{}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})}),i.jsx(Zr,{}),i.jsx(Wr,{url:e}),n&&i.jsx(Yr,{callback:n})]})}k.LivePlayer=Fr,k.VodPlayer=Kr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
14
|
+
<%s key={someKey} {...props} />`,rt,ue,Eo,ue),fn[ue+rt]=!0}}return o===r?wo(W):go(W),W}}function Co(o,m,y){return hn(o,m,y,!0)}function _o(o,m,y){return hn(o,m,y,!1)}var To=_o,xo=Co;Ce.Fragment=r,Ce.jsx=To,Ce.jsxs=xo})()),Ce}var ht;function Sn(){return ht||(ht=1,process.env.NODE_ENV==="production"?be.exports=En():be.exports=Rn()),be.exports}var i=Sn();const mt=typeof window!="undefined"?f.useLayoutEffect:f.useEffect;function _e(e,t){const n=f.useRef(e);mt(()=>{n.current=e},[e]),f.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}const ze="Europe/Sarajevo";function bn(e){var t,n,r,a,l,u;if(typeof Intl!="undefined"&&Intl.DateTimeFormat)try{const c=new Intl.DateTimeFormat("en-US",{timeZone:ze,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),d=parseInt(((t=c.find(_=>_.type==="year"))==null?void 0:t.value)||"0",10),w=parseInt(((n=c.find(_=>_.type==="month"))==null?void 0:n.value)||"0",10)-1,T=parseInt(((r=c.find(_=>_.type==="day"))==null?void 0:r.value)||"0",10),g=parseInt(((a=c.find(_=>_.type==="hour"))==null?void 0:a.value)||"0",10),D=parseInt(((l=c.find(_=>_.type==="minute"))==null?void 0:l.value)||"0",10),R=parseInt(((u=c.find(_=>_.type==="second"))==null?void 0:u.value)||"0",10);return new Date(d,w,T,g,D,R)}catch(s){return console.warn("Failed to convert date to timezone, returning original date:",s),e}return console.warn("Intl.DateTimeFormat not available, timezone conversion may be inaccurate"),e}function Pn(e,t,n){return pt(t.getTime()-e.getTime(),n,"milliseconds")}function Ln(){const e=Pe(),t="YYYY-MM-DD HH:mm:ss.SSSSSS",n=(a,l=2)=>String(a).padStart(l,"0"),r={YYYY:String(e.getFullYear()),MM:n(e.getMonth()+1),DD:n(e.getDate()),HH:n(e.getHours()),mm:n(e.getMinutes()),ss:n(e.getSeconds()),SSSSSS:n(e.getMilliseconds(),3)+"000"};return Object.entries(r).reduce((a,[l,u])=>a.replace(l,u),t)}const Te=e=>{if(isNaN(e)||e===1/0)return"0:00";const t=l=>(l<10?"0":"")+l,n=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return n===0?`${r}:${t(a)}`:`${n}:${t(r)}:${t(a)}`};function jn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to get time zone, returning default time zone:",e),ze}}function kn(e){return pt(e,"milliseconds","seconds")}function pt(e,t,n){const r={days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};return e*(r[t]/r[n])}const Pe=()=>{const e=new Date().toLocaleString("en-US",{timeZone:ze});return new Date(e)},ne=()=>Pe().getTime();function vt(e){var n;const t=typeof window!="undefined"&&((n=window.navigator)==null?void 0:n.userAgent)||"";return e.test(t)}const yt=vt(/iPhone|iPad|iPod/i),In=vt(/Tizen/i);function Dn(){const e=document;return!!(e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||e.msFullscreenElement)}function Nn(e){e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.webkitEnterFullScreen?e.webkitEnterFullScreen():e.mozRequestFullScreen&&e.mozRequestFullScreen()}function Mn(e){e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen&&e.mozCancelFullScreen()}function Fn(e,t){return e.addEventListener("fullscreenchange",t),e.addEventListener("webkitfullscreenchange",t),e.addEventListener("mozfullscreenchange",t),e.addEventListener("MSFullscreenChange",t),()=>{e.removeEventListener("fullscreenchange",t),e.removeEventListener("webkitfullscreenchange",t),e.removeEventListener("mozfullscreenchange",t),e.removeEventListener("MSFullscreenChange",t)}}const Vn=()=>te(),On=(e,t)=>({currentTime:0,duration:0,isEnded:!1,isLoading:!1,isLoop:!1,isMetaLoaded:!1,isPlaying:!1,isReady:!1,isStarted:!1,pauseTime:0,seekTime:-1,startTime:-1,volume:100,destroy:()=>{t().isStarted&&t().eventEmitter.emit("ended")},handleDurationChange:()=>{const n=t().techRef.current;n&&e({duration:n.duration})},handleEnd:()=>{t().techRef.current&&(t().eventEmitter.emit("ended"),e({isEnded:!0,isLoading:!1,isMetaLoaded:!1,isPlaying:!1}))},handleLoadedMetadata:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadedMetadata",{duration:n.duration}),n.loop=t().isLoop,n.volume=n.muted?0:1,t().startTime!==-1&&(n.currentTime=t().startTime),e({currentTime:t().startTime!==-1?t().startTime:n.currentTime,duration:n.duration,startTime:-1,isMetaLoaded:!0,volume:n.muted?0:100}))},handleLoadStart:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadStart"),e({isReady:!0}),!(t().isStarted&&!t().isPlaying)&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})}))},handlePause:()=>{t().techRef.current&&(t().eventEmitter.emit("pause"),e({isPlaying:!1,pauseTime:ne()}))},handlePlay:()=>{t().techRef.current&&(t().eventEmitter.emit(t().isStarted&&!t().isEnded?"resume":"play"),e({isPlaying:!0,pauseTime:0}))},handlePlaying:()=>{t().techRef.current&&(t().eventEmitter.emit("playing"),e({isLoading:!1}))},handleSeeked:()=>{t().techRef.current&&(t().eventEmitter.emit("seeked"),e({isLoading:!1}))},handleSeeking:()=>{t().techRef.current&&(t().eventEmitter.emit("seeking"),e({isLoading:!0}))},handleTimeUpdate:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("timeUpdate",{currentTime:n.currentTime,duration:n.duration}),e({currentTime:n.currentTime}))},handleWaiting:()=>{t().techRef.current&&(t().eventEmitter.emit("waiting"),e({isLoading:!0}))},handleVolumeChange:()=>{const n=t().techRef.current;n&&t().eventEmitter.emit("volumeChange",{volume:n.volume})},handleError:n=>{const r=t().techRef.current;if(!r)return;t().eventEmitter.emit("error",n);const a=r.error;if(!a)return;const l=`${a.code}`,u=a.message||"Unknown error occurred";e({error:{message:u,code:l,tech:"native"}})},pause:()=>{const n=t().techRef.current;n&&(n.pause(),e({isEnded:!1,isPlaying:!1,pauseTime:ne()}))},getPauseTimeDiff:()=>!t().isStarted||!t().pauseTime?0:parseInt(kn(ne()-t().pauseTime).toFixed(0)),play:()=>{const n=t().techRef.current;n&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})})},restart:()=>{t().eventEmitter.emit("restart")},seek:n=>{const r=t().techRef.current;r&&(r.currentTime=n,e({seekTime:-1,currentTime:n,isStarted:!0,isEnded:!1}))},setIsLoading:n=>e({isLoading:n}),setIsLoop:n=>{const r=t().techRef.current;r&&(r.loop=n,e({isLoop:n}))},setStartTime:n=>e({startTime:n}),setVolume:n=>{const r=t().techRef.current;r&&(r.muted=n===0,r.volume=n/100,e({volume:n}))},stop:()=>{t().techRef.current&&e({isPlaying:!1,isLoading:!1})}}),An=(e,t)=>({isIdle:!1,setIsIdle:n=>e({isIdle:n}),resetIdle:()=>t().eventEmitter.emit("resetIdle")}),Hn=e=>({idleLocks:new Set,addIdleLock:t=>e(n=>({idleLocks:new Set(n.idleLocks).add(t)})),removeIdleLock:t=>e(n=>{const r=new Set(n.idleLocks);return r.delete(t),{idleLocks:r}})}),Un=(e,t)=>({playbackRate:1,setPlaybackRate:n=>{const r=t().techRef.current;r&&(r.playbackRate=n,e({playbackRate:n}))}}),Bn=(e,t)=>({level:null,levels:null,setLevels:n=>e({levels:n}),setLevel:n=>e({level:n}),logLevel:n=>{n&&t().eventEmitter.emit("qualityChange",{level:n})}}),zn=(e,t)=>({isFullscreen:!1,isFullscreenReady:!1,exitFullscreen:()=>{t().eventEmitter.emit("fullscreenChange",{isFullscreen:!1}),Mn(document),e({isFullscreen:!1})},requestFullscreen:()=>{const n=t().techRef.current,r=t().containerRef.current;if(!n||!r)return;t().eventEmitter.emit("fullscreenChange",{isFullscreen:!0});const a=yt?n:r;a&&Nn(a),e({isFullscreen:!0})},setIsFullscreen:n=>e({isFullscreen:n}),setIsFullscreenReady:n=>e({isFullscreenReady:n})}),Wn=e=>({error:null,setError:t=>e({error:t})}),Zn=()=>({eventEmitter:Vn()}),Yn=e=>()=>F({},e),Kn=(e,t)=>Z.create()((...n)=>F(F(F(F(F(F(F(F(F({},On(...n)),An(...n)),Hn(...n)),Un(...n)),Bn(...n)),zn(...n)),Wn(...n)),Zn(...n)),Yn({techRef:e,containerRef:t})(...n))),gt=f.createContext(null);function Gn({children:e}){const t=f.useRef(null),n=f.useRef(null),r=f.useRef(null);return t.current||(t.current=Kn(n,r)),i.jsx(gt.Provider,{value:t.current,children:e})}const h=e=>{const t=f.useContext(gt);if(!t)throw new Error("usePlayerStore must be used within PlayerStoreProvider");return Z.useStore(t,e)},We={version:"0.0.61"},Ze=11e3,Ye={DEBUG:2,INFO:3,WARNING:4};function wt({title:e,id:t,kind:n,delay:r,url:a}){const l=f.useRef(null),u=f.useRef(!1),[s,c]=f.useState(null),d=h(C=>C.eventEmitter),w=h(C=>C.isPlaying),T=a.includes("staging")?"stg":"prd",g=T==="stg"?"https://collector-staging.spectar.tv/ingest":"https://collector.spectar.tv/ingest",D=T==="stg"?"spectar_fitnessanny_staging":"spectar_fitnessanny_production";u.current=w;const R=f.useCallback(async({type:C,message:L,level:b=Ye.INFO,duration:B,valueStr1:U,valueStr2:p})=>{const v={content_kind:n,datetime:{date:Ln(),timezone:jn()},installation:D,level_num:b,log_source:"fitnessanny_player",capp_version:We.version,message:L,target_index:C==="client"?"client_log":"watching_activity_log"};e&&(v.title=e),t&&(v.value_int1=t),U&&(v.value_str1=U),p&&(v.value_str2=p),C==="watch"&&(B&&(v.interval_duration=B),r&&(v.catchup_time=r));const S=await fetch(g,{method:"POST",body:JSON.stringify(v)});if(!S.ok)throw new Error(`HTTP error! status: ${S.status}`)},[g,r,t,D,n,e]),_=f.useCallback(C=>{l.current=C!=null?C:Pe()},[]),H=f.useCallback(async C=>{!C&&l.current&&(C=Pn(l.current,Pe(),"milliseconds")),console.log("[Player][Activity]","Watching",C),await R({type:"watch",message:"WATCHING",duration:C})},[R]);return _e(()=>{H(s),_()},s),f.useEffect(()=>{const C=()=>{c(Ze),R({type:"watch",message:"PLAY"}),_()},L=()=>{c(null),R({type:"watch",message:"PAUSE"}),H(),_()},b=()=>{c(Ze),R({type:"watch",message:"RESUME"}),_()},B=()=>{c(null),u.current&&(R({type:"watch",message:"STOP"}),H()),c(Ze),R({type:"watch",message:"PLAY"}),_()},U=()=>{c(null),R({type:"watch",message:"STOP"}),u.current&&H(),_()},p=({level:S})=>{S&&R({type:"client",message:"QUALITY_CHANGE",level:Ye.DEBUG,valueStr1:S})},v=S=>{let k="UNKNOWN_ERROR",V="Unknown error occurred";S instanceof MediaError&&(S.code&&(k=`${S.code}`),S.message&&(V=`${S.message}`)),R({type:"client",message:"ERROR",level:Ye.WARNING,valueStr1:k,valueStr2:V})};return d.on("play",C),d.on("pause",L),d.on("resume",b),d.on("restart",B),d.on("ended",U),d.on("qualityChange",p),d.on("error",v),()=>{d.off("play",C),d.off("pause",L),d.off("resume",b),d.off("restart",B),d.off("ended",U),d.off("qualityChange",p),d.off("error",v)}},[d,R,_,H]),null}const Xn=()=>Z.create(e=>({delay:0,startDate:null,viewerCount:null,setDelay:t=>e({delay:t}),setStartDate:t=>e({startDate:t}),setViewerCount:t=>e({viewerCount:t})})),Ct=f.createContext(null),Jn=({children:e})=>{const t=f.useRef(null);return t.current||(t.current=Xn()),i.jsx(Ct.Provider,{value:t.current,children:e})},A=e=>{const t=f.useContext(Ct);if(!t)throw new Error("useLivePlayerStore must be used within PlayerStoreProvider");return Z.useStore(t,e)};function _t(e){try{const n=new URL(e).searchParams,r={};return n.forEach((a,l)=>{r[l]=a}),r}catch(t){return console.error("Invalid URL:",t),{}}}function Qn({url:e}){const{video_id:t}=_t(e),n=A(a=>a.delay),r=t?Number(t):void 0;return r?i.jsx(wt,{kind:n?"catchup":"live",delay:n,url:e,id:r}):null}const se={playerNotice:"_playerNotice_x3acc_1",playerNoticeTitle:"_playerNoticeTitle_x3acc_19",playerNoticeText:"_playerNoticeText_x3acc_28",playerNoticeLowZIndex:"_playerNoticeLowZIndex_x3acc_37"};function qn(e){const[,t]=f.useState(0);_e(()=>t(n=>n+1),e)}function $n(e){const t=e.split(`
|
|
15
|
+
`);for(const n of t){const r=n.trim();if(r.startsWith("#EXT-X-PROGRAM-DATE-TIME:")){const a=r.replace("#EXT-X-PROGRAM-DATE-TIME:","").trim(),l=new Date(a);if(!isNaN(l.getTime()))return bn(l)}}return null}function er(e,t){const n=e.split(`
|
|
16
|
+
`);let r=!1;for(const a of n){const l=a.trim();if(l.startsWith("#EXT-X-STREAM-INF:")){r=!0;continue}if(r&&!l.startsWith("#")){if(l.startsWith("http"))return l;{const u=new URL(t);return new URL(l,u.origin+u.pathname.substring(0,u.pathname.lastIndexOf("/"))+"/").toString()}}}return null}function tr(e){return e.replace("playlist.m3u8","playlist_fmp4_dvr.m3u8")}async function nr(e){try{const t=tr(e);console.log("Converting to DVR URL:",t);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch master playlist: ${n.status} ${n.statusText}`);const r=await n.text(),a=er(r,t);if(!a)throw new Error("No chunklist URL found in master playlist");console.log("Found chunklist URL:",a);const l=await fetch(a);if(!l.ok)throw new Error(`Failed to fetch chunklist: ${l.status} ${l.statusText}`);const u=await l.text(),s=$n(u);return s?console.log("Successfully detected start time:",s.toISOString()):console.log(" No start time found in chunklist"),s}catch(t){return console.error("Error getting start time from HLS URL:",t),null}}function rr(n){var r=n,{url:e}=r,t=oe(r,["url"]);const[a,l]=f.useState(!0),u=A(d=>d.startDate),s=A(d=>d.setStartDate),c=f.useCallback(async()=>{const d=await nr(e);d&&s(d)},[e,s]);return f.useEffect(()=>{(async()=>{l(!0),await c(),l(!1)})()},[c]),_e(c,u?null:5e3),a?null:i.jsx(or,F({},t))}function or({children:e,messages:t}){const n=A(l=>l.startDate),r=h(l=>l.isStarted);return qn(r?null:5e3),n?ne()<n.getTime()?i.jsx(sr,{startDate:n,title:t.eventNotStarted,message:t.eventStartingSoon}):i.jsx(i.Fragment,{children:e}):i.jsx("div",{className:se.playerNotice,children:i.jsx("h3",{className:se.playerNoticeTitle,children:t.unableToPlay})})}function sr({startDate:e,title:t,message:n}){const r=e.getTime()-ne(),a=Math.floor(r/(1e3*60*60)),l=Math.floor(r%(1e3*60*60)/(1e3*60));return a||l?i.jsxs("div",{className:se.playerNotice,children:[i.jsx("h3",{className:se.playerNoticeTitle,children:t}),i.jsxs("p",{className:se.playerNoticeText,children:["(",a>0?`${a}h ${l}m`:`${l}m`,")"]})]}):i.jsx("div",{className:se.playerNotice,children:i.jsx("h3",{className:se.playerNoticeTitle,children:n})})}function Tt({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=()=>e("play",void 0),r=()=>e("pause",void 0),a=()=>e("resume",void 0),l=()=>e("restart",void 0),u=()=>e("ended",void 0),s=()=>e("seeking",void 0),c=()=>e("seeked",void 0),d=C=>e("volumeChange",C),w=C=>e("fullscreenChange",C),T=C=>e("qualityChange",C),g=C=>e("loadedMetadata",C),D=()=>e("loadStart",void 0),R=()=>e("playing",void 0),_=()=>e("waiting",void 0),H=()=>e("error",void 0);return t.on("play",n),t.on("pause",r),t.on("resume",a),t.on("restart",l),t.on("ended",u),t.on("seeking",s),t.on("seeked",c),t.on("volumeChange",d),t.on("fullscreenChange",w),t.on("qualityChange",T),t.on("loadedMetadata",g),t.on("loadStart",D),t.on("playing",R),t.on("waiting",_),t.on("error",H),()=>{t.off("play",n),t.off("pause",r),t.off("resume",a),t.off("restart",l),t.off("ended",u),t.off("seeking",s),t.off("seeked",c),t.off("volumeChange",d),t.off("fullscreenChange",w),t.off("qualityChange",T),t.off("loadedMetadata",g),t.off("loadStart",D),t.off("playing",R),t.off("waiting",_),t.off("error",H)}},[e,t]),null}const xt=(e,t=0)=>parseInt(Math.max(0,(ne()-(e+t*1e3))/1e3).toFixed(0)),Et=(e,t)=>Math.max(0,(ne()-e-t*1e3)/1e3),ir=(e,t)=>Math.max(0,(t-e)/1e3),ar=(e,t=0)=>{const r=t<0?0:t,a=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"],l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(r))}${a[l]}`};function cr({isAuto:e,level:t,levels:n}){const r=n.length,a=[];return r>1&&a.push({sid:"quality-level-auto",label:"Auto",value:-1,selected:e||t===-1}),n.sort(function(l,u){const s=l.height||l.bitrate||0,c=u.height||u.bitrate||0;return s===c?0:s>c?1:-1}),n.map(l=>{const{bitrate:u,height:s,index:c}=l;a.push({sid:`quality-level-${c}`,label:s?`${s}p`:ar(u),value:c,selected:r===1||!e&&c===t})}),a}function lr({callback:e}){const t=A(l=>l.delay),n=A(l=>l.startDate),r=n?n.getTime():0,a=h(l=>l.eventEmitter);return f.useEffect(()=>{const l=()=>e("timeUpdate",{currentTime:Et(r,t),duration:-1});return a.on("timeUpdate",l),()=>{a.off("timeUpdate",l)}},[e,t,a,r]),i.jsx(Tt,{callback:e})}function Rt(){const e=h(s=>s.exitFullscreen),t=h(s=>s.isFullscreen),n=h(s=>s.isFullscreenReady),r=h(s=>s.requestFullscreen),a=h(s=>s.setVolume),l=h(s=>s.volume),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowUp":a(l+10<100?l+10:100),c=!0;break;case"ArrowDown":a(l-10>0?l-10:0),c=!0;break;case"KeyM":a(l===0?100:0),c=!0;break;case"KeyF":n&&(t?e():r(),c=!0);break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),null}function ur(){const e=A(s=>s.delay),t=h(s=>s.isPlaying),n=h(s=>s.pause),r=h(s=>s.getPauseTimeDiff),a=h(s=>s.play),l=A(s=>s.setDelay),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e+10),c=!0;break;case"ArrowRight":l(e-10>0?e-10:0),c=!0;break;case"Space":if(t)n();else{const d=r();d&&l(e+d),a()}c=!0;break}c&&s.preventDefault()}},[e,r,t,n,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Rt,{})}function St({children:e}){return i.jsx(Gn,{children:e})}function dr({children:e}){return i.jsx(Jn,{children:i.jsx(St,{children:e})})}function fr({url:e,isLive:t,messages:n}){const r=f.useRef(null),a=h(p=>p.level),l=h(p=>p.levels),u=h(p=>p.setLevel),s=h(p=>p.setLevels),c=h(p=>p.logLevel),d=h(p=>p.techRef),w=h(p=>p.setError),T=f.useRef(0),g=f.useRef(null),D=50,R=1e4,_=f.useCallback(p=>{if(r.current&&(r.current.nextLevel=p,u(null),l)){const v=l.map(S=>ve(F({},S),{selected:S.value===p}));s(v)}},[l,u,s]),H=f.useCallback(()=>{if(!d.current)return;console.log("[Player][HLS] MEDIA_ATTACHING");const p=document.createElement("source");p.src=e,p.type="application/vnd.apple.mpegurl",p.dataset.id="original-stream",d.current.appendChild(p),d.current.disableRemotePlayback=!1},[e,d]),C=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] MANIFEST_LOADED"),w(null),g.current&&(clearTimeout(g.current),g.current=null),T.current=0;const p=r.current.levels,v=r.current.currentLevel,S=r.current.autoLevelEnabled;s(cr({levels:p.map((k,V)=>{const{bitrate:N,height:Q,width:K}=k;return{bitrate:N,height:Q,index:V,width:K}}),level:v,isAuto:S}))},[w,s]),L=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] LEVEL_SWITCHED");const p=r.current.levels,v=r.current.currentLevel;if(p[v]?JSON.stringify(p[v]):null){let k="";p[v].height?k=`${p[v].height}p`:p[v].bitrate&&(k=`${p[v].bitrate}bps`),c(k)}},[c]),b=f.useCallback((p,v)=>{if(r.current&&v.fatal){let S,k="UNKNOWN_ERROR";switch(v.type){case $.ErrorTypes.NETWORK_ERROR:S=n.unableToPlay,console.log("[Player][HLS] NETWORK_ERROR",v),t?(T.current<D&&(g.current&&clearTimeout(g.current),T.current+=1,g.current=setTimeout(()=>{if(r.current)try{console.log("[Player][HLS] Retrying stream..."),r.current.loadSource(e)}catch(V){console.error("[Player][HLS] Retry failed:",V)}},R)),k="LIVE_MANIFEST_LOAD_ERROR"):(r.current.startLoad(),k="NETWORK_ERROR"),w({message:S,code:k,tech:"hls"});break;case $.ErrorTypes.MEDIA_ERROR:r.current.recoverMediaError();break}}},[t,e,w,n]),B=f.useCallback(()=>{if(!d.current)return;const p={startLevel:-1,maxBufferSize:30*1024*1024};In?(p.backBufferLength=-1,p.enableWorker=!1):t?p.backBufferLength=10:p.backBufferLength=60;try{console.log("[Player][HLS] URL",e),console.log("[Player][HLS] Config",JSON.stringify(p)),console.log("[Player][HLS] Version",$.version),r.current=new $(p),r.current.on($.Events.MEDIA_ATTACHING,H),r.current.on($.Events.MANIFEST_LOADED,C),r.current.on($.Events.LEVEL_SWITCHED,L),r.current.on($.Events.ERROR,b),r.current.attachMedia(d.current),r.current.loadSource(e)}catch(v){throw new Error(`Error initializing Hls: ${v}`)}},[H,C,L,b,t,d,e]),U=f.useCallback(()=>{if(r.current&&(r.current.off($.Events.MEDIA_ATTACHING,H),r.current.off($.Events.MANIFEST_LOADED,C),r.current.off($.Events.LEVEL_SWITCHED,L),r.current.off($.Events.ERROR,b),r.current.destroy(),r.current=null),d.current){const p=d.current;Array.from(p.children).filter(S=>{var k;return((k=S.dataset)==null?void 0:k.id)==="original-stream"}).forEach(S=>p.removeChild(S))}g.current&&(clearTimeout(g.current),g.current=null),T.current=0},[H,L,C,b,d]);return f.useEffect(()=>{a!==null&&_(a)},[a,_]),f.useEffect(()=>($.isSupported()&&B(),U),[U,B]),null}const hr={playerVideo:"_playerVideo_wc0sm_1"};function bt({url:e,isLive:t,isMuted:n=!1,messages:r}){const a=h(v=>v.destroy),l=h(v=>v.handleDurationChange),u=h(v=>v.handleEnd),s=h(v=>v.handleLoadedMetadata),c=h(v=>v.handleLoadStart),d=h(v=>v.handlePause),w=h(v=>v.handlePlay),T=h(v=>v.handlePlaying),g=h(v=>v.handleSeeked),D=h(v=>v.handleSeeking),R=h(v=>v.handleTimeUpdate),_=h(v=>v.handleWaiting),H=h(v=>v.handleVolumeChange),C=h(v=>v.handleError),L=h(v=>v.techRef),b=f.useRef(null),B=()=>t?{onTimeUpdate:U}:{onDurationChange:l,onSeeked:g,onSeeking:D,onTimeUpdate:U},U=()=>{(!b.current||ne()-b.current>=1e3)&&(R(),b.current=ne())},p=B();return f.useEffect(()=>()=>{a()},[a]),i.jsxs(i.Fragment,{children:[i.jsx(fr,{isLive:t,url:e,messages:r}),i.jsx("video",F({ref:L,className:hr.playerVideo,playsInline:!0,controls:!1,muted:n,preload:"auto",crossOrigin:"anonymous",onEnded:u,onError:C,onLoadedMetadata:s,onLoadStart:c,onPause:d,onPlay:w,onPlaying:T,onWaiting:_,onVolumeChange:H,tabIndex:-1},p))]})}function mr({url:e,messages:t}){const[n,r]=f.useState(null),a=A(u=>u.delay),l=f.useCallback(async()=>{r(a?e.replace("-live","-catchup").replace("playlist.m3u8",`playlist_fmp4_dvr_timeshift-${a}.m3u8`):e)},[a,e]);return f.useEffect(()=>{const u=requestAnimationFrame(()=>l());return()=>cancelAnimationFrame(u)},[l]),n?i.jsx(bt,{url:n,isLive:!0,messages:t}):null}function pr({url:e}){return h(n=>n.isStarted)?i.jsx(vr,{url:e}):null}function vr({url:e}){const t=A(l=>l.setViewerCount),n=f.useRef(null),r=l=>{try{return new URL(l).pathname.split("/").filter(d=>d.length>0)[0]||null}catch(u){return console.error("Failed to extract URI from player URL:",u),null}},a=f.useCallback(async()=>{var c;const l=r(e);if(!l){console.error("Could not extract URI from URL:",e);return}n.current&&n.current.abort(),n.current=new AbortController;const s=`https://${e.includes("staging")?"stg":"prd"}-fitnessanny.spectar.tv/analytics-api/v1/token-info/uri/${l}`;try{const d=await fetch(s,{signal:n.current.signal});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const T=(c=(await d.json()).count)!=null?c:0;t(T)}catch(d){if(d.name==="AbortError")return;console.error("Failed to fetch viewer count:",d),t(null)}},[t,e]);return f.useEffect(()=>(a(),()=>{n.current&&n.current.abort()}),[a,e]),_e(a,15e3),null}function yr(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=s=>typeof window=="undefined"?t:window.matchMedia(s).matches,[a,l]=f.useState(()=>n?r(e):t);function u(){l(r(e))}return mt(()=>{if(typeof window=="undefined")return;const s=window.matchMedia(e);return u(),s.addListener?s.addListener(u):s.addEventListener("change",u),()=>{s.removeListener?s.removeListener(u):s.removeEventListener("change",u)}},[e]),a}const de={playbackButton:"_playbackButton_lgsgw_1",seekIndicator:"_seekIndicator_lgsgw_23",seekIndicatorLeft:"_seekIndicatorLeft_lgsgw_49",seekIndicatorRight:"_seekIndicatorRight_lgsgw_53",seekIndicatorVisible:"_seekIndicatorVisible_lgsgw_57"},gr=10;function Pt(s){var c=s,{className:e,onClick:t,onForwardSeek:n,onBackwardSeek:r,maxForwardTime:a,maxBackwardTime:l}=c,u=oe(c,["className","onClick","onForwardSeek","onBackwardSeek","maxForwardTime","maxBackwardTime"]);return yr("(pointer: coarse)")?i.jsx(Cr,F({className:e,maxForwardTime:a,maxBackwardTime:l,onForwardSeek:n,onBackwardSeek:r},u)):i.jsx(wr,F({className:e,onClick:t},u))}function wr(r){var a=r,{className:e,onClick:t}=a,n=oe(a,["className","onClick"]);const l=f.useRef(null),u=h(_=>_.exitFullscreen),s=h(_=>_.isFullscreen),c=h(_=>_.requestFullscreen),d=h(_=>_.resetIdle),w=_=>{D()?(g(),s?u():c()):T(_)},T=_=>{l.current=window.setTimeout(()=>{t==null||t(_),g()},200)},g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},D=()=>l.current!==null,R=()=>{d()};return f.useEffect(()=>()=>{g()},[]),i.jsx("button",F({onClick:w,onMouseMove:R,className:[de.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},n))}function Cr(u){var s=u,{className:e,maxForwardTime:t,maxBackwardTime:n,onForwardSeek:r,onBackwardSeek:a}=s,l=oe(s,["className","maxForwardTime","maxBackwardTime","onForwardSeek","onBackwardSeek"]);const c=f.useRef(null),d=f.useRef({single:null,indicator:null,accumulate:null}),w=f.useRef(null),T=f.useRef(0),g=f.useRef(null),[D,R]=f.useState({visible:!1,direction:null,time:0}),_=h(p=>p.isIdle),H=h(p=>p.setIsIdle),C=h(p=>p.resetIdle),L=(p,v)=>p<v/2?"backward":"forward",b=p=>{if(!w.current)return;const v=p.changedTouches[0];if(!v)return;const S=ne(),k=w.current.getBoundingClientRect(),V=v.clientX-k.left,N=v.clientY-k.top;if(V<0||V>k.width||N<0||N>k.height)return;const Q=c.current,K=Q?S-Q.time:1/0,G=L(V,k.width),ae=g.current!==null&&g.current===G&&Q!==null&&K<700&&Math.abs(V-Q.x)<100;if(Q!==null&&g.current===null&&K<300&&Math.abs(V-Q.x)<50||ae){p.preventDefault(),p.stopPropagation(),d.current.single&&(window.clearTimeout(d.current.single),d.current.single=null),C(),(g.current===null||g.current!==G)&&(T.current=0,g.current=G);const re=G==="backward"?n:t;T.current=Math.min(T.current+gr,re!=null?re:1/0),B(G,T.current),d.current.accumulate&&window.clearTimeout(d.current.accumulate),d.current.accumulate=window.setTimeout(()=>{const X=T.current;X>0&&(g.current==="backward"?a==null||a(X):r==null||r(X),C()),T.current=0,g.current=null,c.current=null,U(),d.current.accumulate=null},500),c.current={time:S,x:V}}else{c.current={time:S,x:V},d.current.single&&window.clearTimeout(d.current.single);const re=g.current!==null?700:350;d.current.single=window.setTimeout(()=>{if(g.current===null){d.current.single=null;const X=_;H(!X),X&&C()}c.current=null},re)}},B=(p,v)=>{v!==0&&(R({visible:!0,direction:p,time:v}),d.current.indicator&&window.clearTimeout(d.current.indicator),d.current.indicator=window.setTimeout(()=>{U()},700))},U=()=>{R({visible:!1,direction:null,time:0}),d.current.indicator&&(window.clearTimeout(d.current.indicator),d.current.indicator=null)};return f.useEffect(()=>{const p=d.current;return()=>{p!=null&&p.single&&window.clearTimeout(p.single),p!=null&&p.indicator&&window.clearTimeout(p.indicator),p!=null&&p.accumulate&&window.clearTimeout(p.accumulate)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("button",F({ref:w,onTouchEnd:b,className:[de.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},l)),D.visible&&i.jsxs("div",{className:`${de.seekIndicator} ${de.seekIndicatorVisible} ${D.direction==="backward"?de.seekIndicatorLeft:de.seekIndicatorRight}`,children:[D.direction==="backward"?"-":"+",Te(D.time)]})]})}function _r(){const e=h(c=>c.isPlaying),t=h(c=>c.pause),n=h(c=>c.getPauseTimeDiff),r=h(c=>c.play),a=A(c=>c.delay),l=A(c=>c.setDelay),u=A(c=>c.startDate),s=u?u.getTime():0;return i.jsx(Pt,{onClick:()=>{if(e)t();else{const c=n();c&&l(a+c),r()}},onBackwardSeek:c=>{const d=a+c;l(d)},onForwardSeek:c=>{const d=Math.max(0,a-c);l(d)},maxBackwardTime:Math.floor(s),maxForwardTime:Math.floor(a)})}const Lt={playerButton:"_playerButton_izwqq_1",playerButtonCircle:"_playerButtonCircle_izwqq_42"},ce=f.forwardRef((a,r)=>{var l=a,{shape:e="circle",className:t}=l,n=oe(l,["shape","className"]);const u=e==="circle"?Lt.playerButtonCircle:"",s=[Lt.playerButton,u,t].filter(Boolean).join(" ");return i.jsx("button",F({ref:r,className:s},n))});ce.displayName="PlayerButton";const Le={liveIndicator:"_liveIndicator_1jczn_1",liveIndicatorHasDelay:"_liveIndicatorHasDelay_1jczn_9",liveIndicatorNoDelay:"_liveIndicatorNoDelay_1jczn_13"};function Tr(n){var r=n,{message:e}=r,t=oe(r,["message"]);const a=h(d=>d.restart),l=A(d=>d.delay),u=A(d=>d.setDelay),s=()=>{l&&(a(),u(0))},c=l?`${Le.liveIndicator} ${Le.liveIndicatorHasDelay}`:`${Le.liveIndicator} ${Le.liveIndicatorNoDelay}`;return i.jsxs(ce,ve(F({onClick:s,shape:"square"},t),{children:[i.jsx("div",{className:c}),e||"Live"]}))}function jt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6 5H8V19H6V5ZM16 5H18V19H16V5Z"})})}function kt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M19.376 12.4161L8.77735 19.4818C8.54759 19.635 8.23715 19.5729 8.08397 19.3432C8.02922 19.261 8 19.1645 8 19.0658V4.93433C8 4.65818 8.22386 4.43433 8.5 4.43433C8.59871 4.43433 8.69522 4.46355 8.77735 4.5183L19.376 11.584C19.6057 11.7372 19.6678 12.0477 19.5146 12.2774C19.478 12.3323 19.4309 12.3795 19.376 12.4161Z"})})}function xr(){const e=h(s=>s.isPlaying),t=h(s=>s.pause),n=h(s=>s.getPauseTimeDiff),r=h(s=>s.play),a=A(s=>s.delay),l=A(s=>s.setDelay),u=()=>{if(e)t();else{const s=n();s&&l(a+s),r()}};return i.jsx(ce,{onClick:u,children:e?i.jsx(jt,{}):i.jsx(kt,{})})}const ie={progressSlider:"_progressSlider_hwzgf_1",tipContainer:"_tipContainer_hwzgf_7",tipContainerVisible:"_tipContainerVisible_hwzgf_17",tipContainerHidden:"_tipContainerHidden_hwzgf_22",tipContent:"_tipContent_hwzgf_27"},je={sliderRoot:"_sliderRoot_aeak6_1",sliderTrack:"_sliderTrack_aeak6_18",sliderRange:"_sliderRange_aeak6_28",sliderThumb:"_sliderThumb_aeak6_37"},ke=f.forwardRef((l,a)=>{var u=l,{max:e=100,min:t=0,className:n}=u,r=oe(u,["max","min","className"]);return i.jsxs(Re.Root,ve(F({ref:a,min:t,max:e,"aria-label":"Player progress",className:[je.sliderRoot,n].filter(Boolean).join(" "),onKeyDown:s=>s.preventDefault()},r),{children:[i.jsx(Re.Track,{className:je.sliderTrack,children:i.jsx(Re.Range,{className:je.sliderRange})}),i.jsx(Re.Thumb,{className:je.sliderThumb})]}))});ke.displayName="PlayerSlider";function Ie(e){const t=e.getBoundingClientRect();return e.offsetWidth/e.offsetHeight>e.clientWidth/e.clientHeight?{left:t.left*100,right:t.right*100,top:t.top*100,bottom:t.bottom*100,width:t.width*100,height:t.height*100}:t}const It="vod-player-progress-bar";function Er(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(0),[a,l]=f.useState(0),[u,s]=f.useState(!1),[c,d]=f.useState(-1),[w,T]=f.useState(-1),g=A(N=>N.delay),D=A(N=>N.startDate),R=D?D.getTime():0,_=ne(),H=A(N=>N.setDelay),C=h(N=>N.isPlaying),L=h(N=>N.addIdleLock),b=h(N=>N.removeIdleLock),B=f.useCallback(()=>{r(Et(R,g)),l(ir(R,_))},[g,_,R]),U=parseFloat((a?(w!==-1?w:n)/a*100:0).toFixed(1)),p=N=>{T(a*(N[0]/100)),L(It)},v=()=>{if(w!==-1){const N=xt(R,w);H(N),T(-1),b(It)}},S=()=>s(!0),k=()=>s(!1),V=f.useCallback(N=>{const Q=e.current,K=t.current;if(Q&&K){const G=Ie(Q),ae=Ie(K),he=(N.pageX||N.clientX)-G.left,re=he/G.width;if(re<0)return;let X=he-ae.width/2;X<0&&(X=0),X>G.width-ae.width&&(X=-1),K.style.left=X>-1?`${X}px`:"auto",K.style.right=X>-1?"auto":"0px";const xe=a-re*a;d(xe>0?xe:0)}S()},[a]);return _e(()=>B(),C?1e3:null),f.useEffect(()=>{const N=requestAnimationFrame(()=>B());return()=>cancelAnimationFrame(N)},[B]),i.jsxs("div",{className:ie.progressSlider,children:[i.jsx(ke,{ref:e,value:[U],onPointerLeave:k,onPointerDown:k,onPointerMove:V,onValueChange:p,onValueCommit:v,step:.1}),i.jsx("div",{ref:t,className:`${ie.tipContainer} ${u?ie.tipContainerVisible:ie.tipContainerHidden}`,children:i.jsx("p",{className:ie.tipContent,children:`-${Te(c)}`})})]})}function Rr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M22 12C22 17.5228 17.5229 22 12 22C6.4772 22 2 17.5228 2 12C2 6.47715 6.4772 2 12 2V4C7.5817 4 4 7.58172 4 12C4 16.4183 7.5817 20 12 20C16.4183 20 20 16.4183 20 12C20 9.53614 18.8862 7.33243 17.1346 5.86492L15 8V2L21 2L18.5535 4.44656C20.6649 6.28002 22 8.9841 22 12Z"})})}function Sr(){const e=A(a=>a.startDate),t=A(a=>a.setDelay),n=e?e.getTime():0,r=()=>t(xt(n));return i.jsx(ce,{onClick:r,children:i.jsx(Rr,{})})}const De={viewersContainer:"_viewersContainer_z1ihz_1",viewersIndicator:"_viewersIndicator_z1ihz_16",viewersIcon:"_viewersIcon_z1ihz_24",viewersCount:"_viewersCount_z1ihz_28"};function br(){const e=A(t=>t.viewerCount);return e?i.jsxs("div",{className:De.viewersContainer,children:[i.jsx("span",{className:De.viewersIndicator}),i.jsxs("svg",{className:De.viewersIcon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M8 7C9.10457 7 10 6.10457 10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5C6 6.10457 6.89543 7 8 7Z",fill:"currentColor"}),i.jsx("path",{d:"M8 8C5.79086 8 4 9.79086 4 12V13H12V12C12 9.79086 10.2091 8 8 8Z",fill:"currentColor"})]}),i.jsx("span",{className:De.viewersCount,children:e.toLocaleString()})]}):null}function Dt(){const e=h(n=>n.error);if(!e)return null;const t=e.code==="LIVE_MANIFEST_LOAD_ERROR";return i.jsx("div",{className:`${se.playerNotice} ${t?se.playerNoticeLowZIndex:""}`,children:i.jsx("h3",{className:se.playerNoticeTitle,children:e.message})})}const Y={playerContainer:"_playerContainer_146tx_1",controlsTop:"_controlsTop_146tx_12",controlsBottom:"_controlsBottom_146tx_29",controlsContainer:"_controlsContainer_146tx_45",controlsRow:"_controlsRow_146tx_61",controlsSection:"_controlsSection_146tx_68",controlsSectionStart:"_controlsSectionStart_146tx_78",controlsSectionEnd:"_controlsSectionEnd_146tx_82"};function Pr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M16 3H22V9H20V5H16V3ZM2 3H8V5H4V9H2V3ZM20 19V15H22V21H16V19H20ZM4 19H8V21H2V15H4V19Z"})})}function Lr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z"})})}function Nt(){const e=h(d=>d.containerRef),t=h(d=>d.exitFullscreen),n=h(d=>d.isFullscreen),r=h(d=>d.requestFullscreen),a=h(d=>d.setIsFullscreen),l=h(d=>d.setIsFullscreenReady),u=h(d=>d.techRef),s=f.useCallback(d=>{d.stopPropagation(),a(Dn())},[a]),c=()=>{n?t():r()};return f.useEffect(()=>{const d=yt?u.current:e.current;if(d)return Fn(d,s)},[e,s,u]),f.useEffect(()=>{l(!0)},[l]),i.jsx(ce,{onClick:c,children:n?i.jsx(Lr,{}):i.jsx(Pr,{})})}const Ke={idleCheckContainer:"_idleCheckContainer_crh2s_1",idleCheckContainerIdle:"_idleCheckContainerIdle_crh2s_5",idleCheckContainerActive:"_idleCheckContainerActive_crh2s_11"},jr=5*1e3;function Mt({children:e}){const t=f.useRef(null),n=h(g=>g.isIdle),r=h(g=>g.setIsIdle),a=f.useRef(null),u=h(g=>g.idleLocks).size,s=h(g=>g.eventEmitter),c=f.useCallback(()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},[]),d=f.useCallback(()=>{c(),a.current=window.setTimeout(()=>r(!0),jr)},[c,r]);f.useEffect(()=>(r(!1),d(),()=>{c()}),[c,r,d]),f.useEffect(()=>{const g=()=>{r(!1),d()};return s.on("resetIdle",g),()=>{s.off("resetIdle",g)}},[s,r,d]);const w=n&&!u,T=`${Ke.idleCheckContainer} ${w?Ke.idleCheckContainerIdle:Ke.idleCheckContainerActive}`;return i.jsx("div",{ref:t,className:T,children:e})}const kr={spinner:"_spinner_oo4hi_10"};function Ir(e){return i.jsx("div",F({className:kr.spinner},e))}function Dr(e,t=500){const[n,r]=f.useState(e);return f.useEffect(()=>{const a=window.setTimeout(()=>r(e),t);return()=>{window.clearTimeout(a)}},[e,t]),n}const Nr={loadingContainer:"_loadingContainer_v9v7r_1"};function Ft(n){var r=n,{style:e}=r,t=oe(r,["style"]);const a=h(u=>u.isLoading);return Dr(a,100)?i.jsx("div",ve(F({className:Nr.loadingContainer,style:e},t),{children:i.jsx(Ir,{})})):null}function Vt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})})}function Mr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 5V19H20V5H4ZM3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3ZM7.5 11.25H9.5V9H11V15H9.5V12.75H7.5V15H6V9H7.5V11.25ZM14.5 10.5V13.5H16C16.2761 13.5 16.5 13.2761 16.5 13V11C16.5 10.7239 16.2761 10.5 16 10.5H14.5ZM13 9H16C17.1046 9 18 9.89543 18 11V13C18 14.1046 17.1046 15 16 15H13V9Z"})})}const fe={dropdownMenuContent:"_dropdownMenuContent_zi433_1",dropdownMenuItem:"_dropdownMenuItem_zi433_77",scrollAreaRoot:"_scrollAreaRoot_zi433_120",scrollAreaViewport:"_scrollAreaViewport_zi433_127",scrollAreaScrollbar:"_scrollAreaScrollbar_zi433_133",scrollAreaThumb:"_scrollAreaThumb_zi433_160"},Ot=ye.Root,At=ye.Trigger,Ht=ye.Portal,Ge=f.forwardRef((l,a)=>{var u=l,{sideOffset:e=4,className:t,children:n}=u,r=oe(u,["sideOffset","className","children"]);return i.jsx(ye.Content,ve(F({ref:a,sideOffset:e,className:[fe.dropdownMenuContent,t].filter(Boolean).join(" "),onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()}},r),{children:i.jsxs(Se.Root,{className:fe.scrollAreaRoot,type:"always",scrollHideDelay:0,children:[i.jsx(Se.Viewport,{className:fe.scrollAreaViewport,children:n}),i.jsx(Se.Scrollbar,{className:fe.scrollAreaScrollbar,orientation:"vertical",children:i.jsx(Se.Thumb,{className:fe.scrollAreaThumb})})]})}))});Ge.displayName="PlayerMenuContent";const Xe=f.forwardRef((a,r)=>{var l=a,{className:e,onClick:t}=l,n=oe(l,["className","onClick"]);const u=c=>{t==null||t(c)},s=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t==null||t(c))};return i.jsx(ye.Close,{asChild:!0,children:i.jsx("div",F({ref:r,className:[fe.dropdownMenuItem,e].filter(Boolean).join(" "),role:"menuitem",tabIndex:0,onClick:u,onKeyDown:s},n))})});Xe.displayName="PlayerMenuItem";const Ut="quality";function Bt(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.levels),u=h(c=>c.setLevel),s=f.useCallback(c=>{t(c),c?r(Ut):a(Ut)},[r,a]);return!l||l.length===0?null:i.jsxs(Ot,{open:e,onOpenChange:s,children:[i.jsx(At,{asChild:!0,children:i.jsx(ce,{children:i.jsx(Mr,{})})}),i.jsx(Ht,{container:n.current,children:i.jsx(Ge,{side:"top",align:"end",children:l.map(c=>i.jsxs(Xe,{onClick:()=>u(c.value),children:[c.label,c.selected&&i.jsx(Vt,{})]},c.sid))})})]})}function Fr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6.60282 10.0001L10 7.22056V16.7796L6.60282 14.0001H3V10.0001H6.60282ZM2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"})})}function Vr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M13 7.22056L9.60282 10.0001H6V14.0001H9.60282L13 16.7796V7.22056ZM8.88889 16.0001H5C4.44772 16.0001 4 15.5524 4 15.0001V9.00007C4 8.44778 4.44772 8.00007 5 8.00007H8.88889L14.1834 3.66821C14.3971 3.49335 14.7121 3.52485 14.887 3.73857C14.9601 3.8279 15 3.93977 15 4.05519V19.9449C15 20.2211 14.7761 20.4449 14.5 20.4449C14.3846 20.4449 14.2727 20.405 14.1834 20.3319L8.88889 16.0001ZM18.8631 16.5911L17.4411 15.1691C18.3892 14.4376 19 13.2902 19 12.0001C19 10.5697 18.2493 9.31476 17.1203 8.60766L18.5589 7.16906C20.0396 8.26166 21 10.0187 21 12.0001C21 13.8422 20.1698 15.4905 18.8631 16.5911Z"})})}function Or(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M10 7.22056L6.60282 10.0001H3V14.0001H6.60282L10 16.7796V7.22056ZM5.88889 16.0001H2C1.44772 16.0001 1 15.5524 1 15.0001V9.00007C1 8.44778 1.44772 8.00007 2 8.00007H5.88889L11.1834 3.66821C11.3971 3.49335 11.7121 3.52485 11.887 3.73857C11.9601 3.8279 12 3.93977 12 4.05519V19.9449C12 20.2211 11.7761 20.4449 11.5 20.4449C11.3846 20.4449 11.2727 20.405 11.1834 20.3319L5.88889 16.0001ZM20.4142 12.0001L23.9497 15.5356L22.5355 16.9498L19 13.4143L15.4645 16.9498L14.0503 15.5356L17.5858 12.0001L14.0503 8.46454L15.4645 7.05032L19 10.5859L22.5355 7.05032L23.9497 8.46454L20.4142 12.0001Z"})})}const zt={volumeContainer:"_volumeContainer_4d6jg_1",volumeSlider:"_volumeSlider_4d6jg_8"},Wt="volume";function Zt(){const e=h(s=>s.setVolume),t=h(s=>s.volume),n=h(s=>s.addIdleLock),r=h(s=>s.removeIdleLock),a=s=>{e(s[0]),n(Wt)},l=()=>{r(Wt)},u=()=>e(t?0:100);return i.jsxs("div",{className:zt.volumeContainer,children:[i.jsx(ce,{onClick:u,className:"shrink-0",children:t?t>50?i.jsx(Fr,{}):i.jsx(Vr,{}):i.jsx(Or,{})}),i.jsx("div",{className:zt.volumeSlider,children:i.jsx(ke,{value:[t],onValueChange:a,onValueCommit:l})})]})}function Ar(e){return i.jsx(dr,{children:i.jsx(Hr,F({},e))})}function Hr({url:e,messages:t={},onEvent:n}){var l,u,s,c;const r=h(d=>d.containerRef),a={eventNotStarted:"Event has not started yet.",eventStartingSoon:"Starting in few seconds...",unableToPlay:"Unable to play the live stream. Please try again later."};return f.useEffect(()=>{console.log(`[Player][Live] Version: ${We.version}`)},[]),i.jsxs("div",{ref:r,className:Y.playerContainer,children:[i.jsxs(rr,{url:e,messages:{eventNotStarted:(l=t==null?void 0:t.eventNotStarted)!=null?l:a.eventNotStarted,eventStartingSoon:(u=t==null?void 0:t.eventStartingSoon)!=null?u:a.eventStartingSoon,unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:a.unableToPlay},children:[i.jsx(mr,{url:e,messages:{unableToPlay:(c=t==null?void 0:t.unableToPlay)!=null?c:a.unableToPlay}}),i.jsx(Dt,{}),i.jsx(Ft,{}),i.jsx(_r,{}),i.jsxs(Mt,{children:[i.jsx("div",{className:Y.controlsTop,children:i.jsx("div",{className:Y.controlsContainer,children:i.jsx("div",{className:Y.controlsRow,children:i.jsx(br,{})})})}),i.jsx("div",{className:Y.controlsBottom,children:i.jsxs("div",{className:Y.controlsContainer,children:[i.jsx(Er,{}),i.jsxs("div",{className:Y.controlsRow,children:[i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionStart}`,children:[i.jsx(xr,{}),i.jsx(Sr,{}),i.jsx(Zt,{})]}),i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionEnd}`,children:[i.jsx(Tr,{message:t==null?void 0:t.live}),i.jsx(Bt,{}),i.jsx(Nt,{})]})]})]})})]}),i.jsx(Qn,{url:e}),i.jsx(ur,{}),i.jsx(pr,{url:e})]}),n&&i.jsx(lr,{callback:n})]})}const Ur=[.5,.75,1,1.25,1.5,1.75,2],Yt="playback-rate";function Br(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.playbackRate),u=h(c=>c.setPlaybackRate),s=f.useCallback(c=>{t(c),c?r(Yt):a(Yt)},[r,a]);return i.jsxs(Ot,{open:e,onOpenChange:s,children:[i.jsx(At,{asChild:!0,children:i.jsxs(ce,{children:[l,"x"]})}),i.jsx(Ht,{container:n.current,children:i.jsx(Ge,{side:"top",align:"end",children:Ur.map(c=>i.jsxs(Xe,{onClick:()=>u(c),children:[c,"x",l===c&&i.jsx(Vt,{})]},c))})})]})}function zr(){const e=h(u=>u.isPlaying),t=h(u=>u.pause),n=h(u=>u.play),r=h(u=>u.currentTime),a=h(u=>u.duration),l=h(u=>u.seek);return i.jsx(Pt,{onClick:()=>{e?t():n()},onBackwardSeek:u=>{const s=Math.max(0,r-u);l(s)},onForwardSeek:u=>{const s=Math.min(r+u,a);l(s)},maxBackwardTime:Math.floor(r),maxForwardTime:Math.floor(a-r)})}function Wr(){const e=h(a=>a.isPlaying),t=h(a=>a.pause),n=h(a=>a.play),r=()=>{e?t():n()};return i.jsx(ce,{onClick:r,children:e?i.jsx(jt,{}):i.jsx(kt,{})})}const Kt="vod-player-progress-bar";function Zr(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(!1),[a,l]=f.useState(-1),[u,s]=f.useState(-1),c=h(b=>b.currentTime),d=h(b=>b.duration),w=h(b=>b.seek),T=h(b=>b.addIdleLock),g=h(b=>b.removeIdleLock),D=parseFloat((d?(u!==-1?u:c)/d*100:0).toFixed(1)),R=b=>{s(d*(b[0]/100)),T(Kt)},_=()=>{u!==-1&&(w(u),s(-1),g(Kt))},H=()=>r(!0),C=()=>r(!1),L=f.useCallback(b=>{const B=e.current,U=t.current;if(B&&U){const p=Ie(B),v=Ie(U),S=(b.pageX||b.clientX)-p.left,k=S/p.width;if(k<0)return;let V=S-v.width/2;V<0&&(V=0),V>p.width-v.width&&(V=-1),U.style.left=V>-1?`${V}px`:"auto",U.style.right=V>-1?"auto":"0px",l(k*d)}H()},[d]);return i.jsxs("div",{className:ie.progressSlider,children:[i.jsx(ke,{ref:e,value:[D],onPointerLeave:C,onPointerDown:C,onPointerMove:L,onValueChange:R,onValueCommit:_,step:.1}),i.jsx("div",{ref:t,className:`${ie.tipContainer} ${n?ie.tipContainerVisible:ie.tipContainerHidden}`,children:i.jsx("p",{className:ie.tipContent,children:Te(a)})})]})}const Ne={remainingTimeContainer:"_remainingTimeContainer_1yyhb_1",remainingTime:"_remainingTime_1yyhb_1",remainingSeparator:"_remainingSeparator_1yyhb_17"};function Yr(){const e=h(n=>n.currentTime),t=h(n=>n.duration);return i.jsxs("div",{className:Ne.remainingTimeContainer,children:[i.jsx("p",{className:Ne.remainingTime,children:Te(e)}),i.jsx("p",{className:Ne.remainingSeparator}),i.jsx("p",{className:Ne.remainingTime,children:Te(t)})]})}function Kr({url:e}){const{video_id:t}=_t(e),n=t?Number(t):void 0;return n?i.jsx(wt,{kind:"vod",url:e,id:n}):null}function Gr({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=r=>e("timeUpdate",r);return t.on("timeUpdate",n),()=>{t.off("timeUpdate",n)}},[e,t]),i.jsx(Tt,{callback:e})}function Xr(){const e=h(s=>s.currentTime),t=h(s=>s.duration),n=h(s=>s.isPlaying),r=h(s=>s.pause),a=h(s=>s.play),l=h(s=>s.seek),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e-10>=0?e-10:0),c=!0;break;case"ArrowRight":l(e+10<t?e+10:t),c=!0;break;case"Space":n?r():a(),c=!0;break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Rt,{})}function Jr(e){return i.jsx(St,{children:i.jsx(Qr,F({},e))})}function Qr({url:e,messages:t,onEvent:n,startTime:r}){var s;const a=h(c=>c.setStartTime),l=h(c=>c.containerRef),u={unableToPlay:"Unable to play the video. Please try again later."};return f.useEffect(()=>{r&&a(r)},[r,a]),f.useEffect(()=>{console.log(`[Player][VOD] Version: ${We.version}`)},[]),i.jsxs("div",{ref:l,className:Y.playerContainer,children:[i.jsx(bt,{url:e,isLive:!1,messages:{unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:u.unableToPlay}}),i.jsx(Dt,{}),i.jsx(Ft,{}),i.jsx(zr,{}),i.jsx(Mt,{children:i.jsx("div",{className:Y.controlsBottom,children:i.jsxs("div",{className:Y.controlsContainer,children:[i.jsx(Zr,{}),i.jsxs("div",{className:Y.controlsRow,children:[i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionStart}`,children:[i.jsx(Wr,{}),i.jsx(Zt,{}),i.jsx(Yr,{})]}),i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionEnd}`,children:[i.jsx(Br,{}),i.jsx(Bt,{}),i.jsx(Nt,{})]})]})]})})}),i.jsx(Xr,{}),i.jsx(Kr,{url:e}),n&&i.jsx(Gr,{callback:n})]})}j.LivePlayer=Ar,j.VodPlayer=Jr,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
17
17
|
//# sourceMappingURL=react-video-player.umd.js.map
|