@getontime/cli
Version:
Time keeping for live events
2 lines • 1.37 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f14ad0099eab1969fdd065b56af5fdd3cf530de6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`95ee78be-9c6e-4bf0-9cf4-9bd09233236d`,e._sentryDebugIdIdentifier=`sentry-dbid-95ee78be-9c6e-4bf0-9cf4-9bd09233236d`)}catch{}})();import{a as e,n as t}from"./jsx-runtime-BNC90REB.js";import{C as n,Ut as r,_ as i}from"./useSocket-B9-0Z7zf.js";var a=(e,t,n)=>Math.max(Math.min(e,Math.max(t,n)),Math.min(t,n));function o(e,t){return e===null||t===null?0:e<=0?100:e>=t?0:a((t-e)/t*100,0,100)}var s=e(t(),1);function c(e,t,a){let c=n(),l=i(),u=c===r.Play||c===r.Roll,d=(0,s.useRef)({current:e,duration:t,eventId:a,playback:c,at:performance.now()}),[,f]=(0,s.useState)(0),p=performance.now();(d.current.current!==e||d.current.duration!==t||d.current.eventId!==a||d.current.playback!==c)&&(d.current={current:e,duration:t,eventId:a,playback:c,at:p});let m=l&&u&&e!==null&&e>0&&t!==null;(0,s.useEffect)(()=>{if(!m)return;let e=requestAnimationFrame(function t(){f(e=>e+1),e=requestAnimationFrame(t)});return()=>cancelAnimationFrame(e)},[m]);let h=d.current.current;return o(l&&u&&h!==null?h-(p-d.current.at):h,t)}export{o as n,c as t};
//# sourceMappingURL=useAnimatedProgress-DJlteBY2.js.map