@getontime/cli
Version:
Time keeping for live events
3 lines (2 loc) • 3.37 kB
JavaScript
import{j as n,a7 as E,ax as j}from"./vendor-q6fv0YT2.js";import{b as S}from"./EditorUtils-DuKjlUkF.js";import{c as I,e as c,a as k}from"./index-B81u4hxi.js";import{g as D,a as B,b as F,d as _,f as N,h as R,i as M,F as h}from"./timer.utils-rGyI9NYa.js";import{M as W}from"./MultiPartProgressBar-BXdLxJpy.js";import{g as z,a as A}from"./viewUtils-B8Dr4GHH.js";import{g as L}from"./presentation.utils-Cl-L3pHN.js";import"./playbackstate-CPQdnF-k.js";import"./getProgress-cLuBFPjh.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="79ab97c1-9aea-4a21-a77e-2e1fb079e912",t._sentryDebugIdIdentifier="sentry-dbid-79ab97c1-9aea-4a21-a77e-2e1fb079e912")}catch{}})();function O({viewSettings:t}){const{eventNow:s,message:a,time:e,clock:d,timerTypeNow:i,countToEndNow:o,auxTimer:r}=I(),l=D(a.timer),{showFinished:m,showWarning:y,showDanger:x}=B(i,o,e.phase,!1,"",!1),p=F(e.playback),w=_(i),b=N(e.duration,e.addedTime),T=z(!1,i,d,e,i),f=A(T,i,"min",{removeSeconds:!1,removeLeadingZero:!1}),v=a.timer.secondarySource==="aux1"?r.aux1:a.timer.secondarySource==="aux2"?r.aux2:a.timer.secondarySource==="aux3"?r.aux3:null,u=R(a,v,"min",!1,!0,!1),g=L(t,void 0,y,x),P=M(f,u),C={...g&&{"--timer-colour":g}};return n.jsxs("div",{className:c(["pip-timer",m&&"pip-timer--finished"]),style:C,children:[n.jsx("div",{className:c(["message-overlay",l&&"message-overlay--active"]),children:n.jsx(h,{mode:"multi",min:12,max:256,className:c(["message",a.timer.blink&&"blink"]),children:a.timer.text})}),n.jsxs("div",{className:"timer-container",children:[n.jsx("div",{className:c(["timer",!p&&"timer--paused",m&&"timer--finished"]),style:{fontSize:`${P}vw`},"data-phase":e.phase,children:f}),n.jsx("div",{className:c(["secondary",!u&&"secondary--hidden"]),children:n.jsx(h,{mode:"multi",min:12,max:256,children:u})})]}),w&&n.jsx(W,{className:c(["progress-container",!p&&"progress-container--paused"]),now:e.current,complete:b,normalColor:t.normalColor,warning:s==null?void 0:s.timeWarning,warningColor:t.warningColor,danger:s==null?void 0:s.timeDanger,dangerColor:t.dangerColor,hideOvertime:!m})]})}function Q(){const{data:t,status:s}=k(),a=async()=>{if(window.documentPictureInPicture.window)return;let e;try{e=await window.documentPictureInPicture.requestWindow()}catch(o){console.error("Failed to open Picture-in-Picture:",o);return}[...document.styleSheets].forEach(o=>{try{if(o.href){const r=e.document.createElement("link");r.rel="stylesheet",r.href=o.href,e.document.head.appendChild(r)}else if(o.cssRules){const r=e.document.createElement("style");r.textContent=[...o.cssRules].map(l=>l.cssText).join(""),e.document.head.appendChild(r)}}catch(r){console.warn("Stylesheet copy blocked:",r)}});const d=e.document.createElement("div");d.setAttribute("id","pip-root"),d.style.height="100vh",e.document.body.append(d);const i=E.createRoot(e.document.getElementById("pip-root"),{onCaughtError:(o,r)=>console.error(o),onUncaughtError:(o,r)=>console.error(o),onRecoverableError:(o,r)=>console.error(o)});e.addEventListener("pagehide",()=>{i.unmount()}),i.render(n.jsx(j,{children:n.jsx(O,{viewSettings:t})}))};return n.jsx(S,{onClick:s==="success"?a:void 0})}export{Q as default};
//# sourceMappingURL=PipHost-CvtlZIn7.js.map