@getontime/cli
Version:
Time keeping for live events
3 lines (2 loc) • 2.68 kB
JavaScript
import{h as y,j as S}from"./vendor-q6fv0YT2.js";import{T as u,y as d,h as g}from"./index-B81u4hxi.js";import{b as f,a as v}from"./viewUtils-B8Dr4GHH.js";import{i as x}from"./playbackstate-CPQdnF-k.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e251596-f07c-46e5-91d1-d829893d3245",e._sentryDebugIdIdentifier="sentry-dbid-6e251596-f07c-46e5-91d1-d829893d3245")}catch{}})();const m=(e,t,n)=>{for(;e<t;){const o=Math.floor((e+t)/2);if(o===e)break;n(o)?e=o:t=o}return e};function C({children:e,mode:t="multi",min:n=16,max:o=256,...s}){const i=y.useRef(null),a=y.useCallback(()=>{const r=i.current;return r?r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth:!1},[]),c=y.useCallback(()=>{const r=i.current;if(!r)return;const l=r.style.visibility;r.style.visibility="hidden";const h=m(n,o+1,b=>(r.style.fontSize=`${b}px`,!a()));r.style.fontSize=`${h}px`,r.style.visibility=l},[a,n,o]);return y.useEffect(()=>{const r=i.current;if(!r)return;c();const l=new ResizeObserver(c);return l.observe(r),()=>l.disconnect()},[e,t,c]),S.jsx("div",{ref:i,style:{whiteSpace:t==="single"?"nowrap":"normal"},...s,children:e})}function F(e){return e.text!==""&&e.visible}function z(e){return e===g.Play||e===g.Roll}function E(e,t){return(e??0)+(t??0)}function P(e){return e!==u.None&&e!==u.Clock}function k(e){return e!==u.Clock}const w={4:28,5:28,6:25,8:18,9:18};function I(e,t){const n=e.length;let o=100/(n-1)*1.25;return w[n]&&(o=w[n]),t&&(o*=.6),o}function W(e,t,n,o,s,i){return i?{showEndMessage:!1,showFinished:!1,showWarning:!1,showDanger:!1}:e===u.CountDown||t?{showEndMessage:n===d.Overtime&&o&&s!=="",showFinished:n===d.Overtime,showWarning:n===d.Warning,showDanger:n===d.Danger}:{showEndMessage:!1,showFinished:!1,showWarning:!1,showDanger:!1}}function B(e,t,n,o,s,i){if(!i){if(e.timer.secondarySource==="aux1"||e.timer.secondarySource==="aux2"||e.timer.secondarySource==="aux3")return v(t,u.CountDown,n,{removeSeconds:o,removeLeadingZero:s});if(e.timer.secondarySource==="secondary"&&e.secondary)return e.secondary}}function O(e,t,n,o,s,i){if(s===g.Stop)return{showNow:!1,nowMain:void 0,nowSecondary:void 0,showNext:!1,nextMain:void 0,nextSecondary:void 0};const a=x(s)&&i!==d.Pending,c=a?f(e,n??"title"):void 0,r=a?f(e,o):void 0,l=a?f(t,n??"title"):f(e,n??"title"),h=a?f(t,o):f(e,o);return{showNow:!!c||!!r,nowMain:c,nowSecondary:r,showNext:!!l||!!h,nextMain:l,nextSecondary:h}}export{C as F,W as a,z as b,k as c,P as d,O as e,E as f,F as g,B as h,I as i};
//# sourceMappingURL=timer.utils-rGyI9NYa.js.map