@getontime/cli
Version:
Time keeping for live events
3 lines (2 loc) • 16.2 kB
JavaScript
import{j as e,aY as ze,aZ as Ge,a_ as qe,h as _,aG as Q,aH as X,bf as Y,ch as He,v as Ke,f as Ve,bq as We,ci as Ze,cj as Qe,bQ as Xe,bM as le,bN as Ye,aN as Je,bS as et,ck as tt,y as st,bR as nt,br as ot,av as rt,bP as it,cl as at,am as lt,bl as ct,cm as ut,ah as Z,aF as dt,T as pt,K as mt,ar as ft}from"./vendor-q6fv0YT2.js";import{m as A,ah as ce,e as N,B as ne,n as _t,bg as ue,k as J,M as de,bf as bt,ak as q,bT as M,K as ht,b2 as oe,b6 as yt,h as re,T as H,bU as vt,aC as pe}from"./index-B81u4hxi.js";import{i as gt,s as xt,k as jt}from"./useRundown-Bn6ZPsz0.js";import{u as D}from"./dateConfig-D7xim1t4.js";import{p as Et}from"./parseUserTime-YeFR8t3F.js";import{T as kt,u as me,a as fe,g as St}from"./RundownExport-EorsanA0.js";import{E as K}from"./validateEvent-Do8yE_DJ.js";import{T as E}from"./Tooltip-B5vsLcFu.js";import{a as It,u as Ct}from"./MilestoneEditor-BA0PVIQh.js";import{u as Nt}from"./useReport-DSuFnUb9.js";import{i as _e}from"./playbackstate-CPQdnF-k.js";import{g as wt}from"./getProgress-cLuBFPjh.js";import"./editorSettings-D2f7e1a6.js";import"./rundownUtils-CtVGQDQn.js";import"./EditorUtils-DuKjlUkF.js";import"./ProtectRoute-BH-QvsU0.js";import"./Modal-BKx0PDGT.js";import"./SwatchPicker-Cm5Eicvv.js";import"./Empty-CJbZxh45.js";import"./useFollowComponent-B7vvPzG2.js";import"./offset-R98EXhWK.js";import"./TimeInput-C8DQoFXv.js";import"./useCustomFields-k4piRt9n.js";import"./Select-BGGVCKqU.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="28290648-811f-44d4-bd37-80b15f8e88a4",s._sentryDebugIdIdentifier="sentry-dbid-28290648-811f-44d4-bd37-80b15f8e88a4")}catch{}})();const Tt="_radioGroup_sxz6b_17",Rt="_item_sxz6b_23",$t="_radio_sxz6b_17",At="_indicator_sxz6b_55",P={radioGroup:Tt,item:Rt,radio:$t,indicator:At};function Dt({items:s,onValueChange:t,...n}){return e.jsx(ze,{onValueChange:o=>t==null?void 0:t(o),className:P.radioGroup,...n,children:s.map(o=>e.jsxs("label",{className:P.item,children:[e.jsx(Ge,{value:o.value.toString(),className:P.radio,children:e.jsx(qe,{className:P.indicator})}),o.label]},o.value.toString()))})}const Mt="_delayInput_ksn92_17",Pt="_inputField_ksn92_23",ie={delayInput:Mt,inputField:Pt};function Lt(s){const{eventId:t,duration:n}=s,{updateEntry:o}=D(),[l,i]=_.useState(""),c=_.useRef(null),u=_.useRef(!1);_.useEffect(()=>{typeof n>"u"||i(A(n))},[n]);const d=r=>{if(u.current){u.current=!1;return}const y=r.startsWith("-");let b=Et(r);y&&(b=b*-1),b!==n&&(p(b),i(A(b)))},p=r=>{o({id:t,duration:r})},m=()=>{var r;return(r=c.current)==null?void 0:r.select()},f=r=>{var y,b;r.key==="Enter"?((y=c.current)==null||y.blur(),d(r.target.value)):r.key==="Tab"?d(r.target.value):r.key==="Escape"&&(u.current=!0,i(A(n)),(b=c.current)==null||b.blur())},v=r=>{r==="add"?n<0&&p(n*-1):r==="subtract"&&n>0&&p(n*-1)},h=l.startsWith("-")?"subtract":"add";return e.jsxs("div",{className:ie.delayInput,children:[e.jsx(ce,{ref:c,"data-testid":"delay-input",className:ie.inputField,placeholder:"-",onFocus:m,onChange:r=>i(r.target.value),onBlur:r=>d(r.target.value),onKeyDown:f,value:l,maxLength:9}),e.jsx(Dt,{onValueChange:v,value:h,items:[{value:"add",label:"Add time"},{value:"subtract",label:"Subtract time"}]})]})}const Bt="_delay_tel5v_17",Ft="_hasCursor_tel5v_34",Ut="_drag_tel5v_38",V={delay:Bt,hasCursor:Ft,drag:Ut};function Ot({data:s,hasCursor:t}){const{applyDelay:n,deleteEntry:o}=D(),l=_.useRef(null),{attributes:i,listeners:c,setNodeRef:u,isDragging:d,transform:p,transition:m}=Q({id:s.id,data:{type:"delay"},animateLayoutChanges:()=>!1}),f={zIndex:d?2:"inherit",transform:X.Translate.toString(p),transition:m};_.useEffect(()=>{var r;t&&((r=l==null?void 0:l.current)==null||r.focus())},[t]);const v=()=>{n(s.id)},h=()=>{o([s.id])};return e.jsxs("div",{className:N([V.delay,t?V.hasCursor:null]),ref:u,style:f,"data-testid":"rundown-delay",children:[e.jsx("span",{className:V.drag,ref:l,...i,...c,children:e.jsx(Y,{})}),e.jsx(Lt,{eventId:s.id,duration:s.duration}),e.jsxs(ne,{onClick:v,variant:"ghosted-white",children:[e.jsx(He,{})," Make permanent"]}),e.jsxs(ne,{onClick:h,variant:"ghosted-white",children:[e.jsx(Ke,{}),"Cancel"]})]})}const zt=Ve(s=>({selectedEventId:null,setSelectedEventId:t=>s(()=>({selectedEventId:t})),clearSelectedEventId:()=>s(()=>({selectedEventId:null}))})),Gt="_blink_1uqu6_1",qt="_fourtyfive_1uqu6_13",Ht="_chip_1uqu6_17",Kt="_over_1uqu6_23",Vt="_under_1uqu6_26",Wt="_due_1uqu6_29",B={blink:Gt,fourtyfive:qt,chip:Ht,over:Kt,under:Vt,due:Wt};function Zt({timeStart:s,delay:t,dayOffset:n,isPast:o,isLoaded:l,className:i,totalGap:c,id:u,duration:d,isLinkedToLoaded:p}){const{playback:m}=_t();if(l)return null;const f=_e(m);return!f||o?e.jsx(Xt,{className:i,id:u,duration:d}):f?e.jsx(E,{text:"Expected time until start",render:e.jsx("span",{}),className:i,children:e.jsx(Qt,{timeStart:s,delay:t,dayOffset:n,totalGap:c,isLinkedToLoaded:p})}):null}function Qt({timeStart:s,delay:t,dayOffset:n,totalGap:o,isLinkedToLoaded:l}){const i=bt({timeStart:s,delay:t,dayOffset:n},{totalGap:o,isLinkedToLoaded:l}),c=i<ue,u=c?"DUE":`${J(Math.abs(i),i>2*de)}`;return e.jsx("div",{className:N([B.chip,c&&B.due]),children:u})}function Xt(s){const{className:t,id:n,duration:o}=s,{data:l}=Nt(),i=l[n],[c,u,d]=_.useMemo(()=>{if(!i)return[null,"none",""];const{startedAt:p,endedAt:m}=i;if(!p||!m)return[null,"none",""];const v=m-p-o,h=Math.abs(v);if(h<ue)return["ontime","under","Event finished on time"];const r=v>0,y=A(h),b=`Event ran ${r?"over":"under"} time by ${y}`;return[`${r?"+":"-"}${J(h,h>2*de)}`,r?"over":"under",b]},[i,o]);return c?e.jsx(E,{text:d,render:e.jsx("span",{}),className:N([B.chip,B[u],t]),children:c==="ontime"?e.jsx(We,{size:"1.1rem"}):c}):null}const Yt="_blink_bc2h9_1",Jt="_fourtyfive_bc2h9_13",es="_rundownEvent_bc2h9_17",ts="_loaded_bc2h9_39",ss="_play_bc2h9_42",ns="_roll_bc2h9_47",os="_pause_bc2h9_52",rs="_selected_bc2h9_57",is="_hasCursor_bc2h9_60",as="_past_bc2h9_63",ls="_skip_bc2h9_63",cs="_timerNote_bc2h9_63",us="_statusElements_bc2h9_64",ds="_eventTitle_bc2h9_65",ps="_eventNote_bc2h9_66",ms="_eventTimers_bc2h9_67",fs="_eventStatus_bc2h9_68",_s="_playbackActions_bc2h9_69",bs="_binder_bc2h9_70",hs="_drag_bc2h9_97",ys="_cue_bc2h9_115",vs="_editMode_bc2h9_143",gs="_chipSection_bc2h9_148",xs="_titleSection_bc2h9_152",js="_nextTag_bc2h9_158",Es="_progressBg_bc2h9_171",ks="_hidden_bc2h9_180",Ss="_flip_bc2h9_184",Is="_statusIcon_bc2h9_218",Cs="_active_bc2h9_222",Ns="_disabled_bc2h9_225",a={blink:Yt,fourtyfive:Jt,rundownEvent:es,loaded:ts,play:ss,roll:ns,pause:os,selected:rs,hasCursor:is,past:as,skip:ls,timerNote:cs,statusElements:us,eventTitle:ds,eventNote:ps,eventTimers:ms,eventStatus:fs,playbackActions:_s,binder:bs,drag:hs,cue:ys,editMode:vs,chipSection:gs,titleSection:xs,nextTag:js,progressBg:Es,hidden:ks,flip:Ss,statusIcon:Is,active:Cs,disabled:Ns},ws=_.memo(Ts);function Ts({eventId:s,skip:t,isPlaying:n,isPaused:o,loaded:l,disablePlayback:i}){const{updateEntry:c}=D(),u=f=>{f.stopPropagation(),c({id:s,skip:!t})},d=f=>{f.stopPropagation(),n?M.pause():o?M.start():M.startEvent(s)},p=f=>{f.stopPropagation(),M.loadEvent(s)},m=o?{tooltip:"Continue event",backgroundColor:"#339E4E"}:n?{tooltip:"Pause event",backgroundColor:"#c05621"}:{tooltip:"Start event",backgroundColor:void 0};return e.jsxs("div",{className:a.playbackActions,children:[e.jsx(E,{text:"Skip event",render:e.jsx(q,{variant:"subtle-white"}),onClick:u,tabIndex:-1,disabled:l,style:{background:t?"#9A0000":void 0},"aria-label":"Skip event",children:t?e.jsx(Ze,{}):e.jsx(Qe,{})}),e.jsx(E,{text:"Load event",render:e.jsx(q,{variant:"subtle-white"}),onClick:p,tabIndex:-1,disabled:i,"aria-label":"Load event",children:e.jsx(Xe,{className:a.flip})}),e.jsx(E,{text:m.tooltip,render:e.jsx(q,{variant:"subtle-white"}),onClick:d,tabIndex:-1,disabled:i,style:{backgroundColor:m.backgroundColor},"aria-label":n?"Pause event":"Start event",children:n?e.jsx(Ye,{}):e.jsx(le,{})})]})}const Rs="_progressBar_1glmb_17",$s={progressBar:Rs};function As(){const s=ht(),t=wt(s.current,s.duration);return e.jsx("div",{className:$s.progressBar,style:{width:`${t}%`}})}const Ds=_.memo(Ms);function Ms({eventId:s,timeStart:t,timeEnd:n,duration:o,timeStrategy:l,linkStart:i,countToEnd:c,endAction:u,timerType:d,title:p,note:m,delay:f,isNext:v,skip:h=!1,loaded:r,playback:y,isRolling:b,dayOffset:w,isPast:I,totalGap:T,isLinkedToLoaded:R,hasTriggers:g}){const[x,F]=_.useState(!1),[U]=Je({key:yt.editorMode,defaultValue:oe.Edit});_.useEffect(()=>{F(!0)},[]);const O=y===re.Play,z=y===re.Pause;return x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:N([a.eventTimers,U===oe.Edit&&a.editMode]),children:e.jsx(It,{eventId:s,timeStart:t,timeEnd:n,duration:o,delay:f,timeStrategy:l,linkStart:i,countToEnd:c})}),e.jsxs("div",{className:a.titleSection,children:[e.jsx(kt,{title:p,entryId:s,placeholder:"Event title",className:a.eventTitle}),v&&e.jsx("span",{className:a.nextTag,children:"UP NEXT"})]}),e.jsx(ws,{eventId:s,skip:h,isPlaying:O,isPaused:z,loaded:r,disablePlayback:h||b}),!h&&e.jsx(Zt,{className:a.chipSection,id:s,timeStart:t,delay:f,dayOffset:w,isLinkedToLoaded:R,isPast:I,isLoaded:r,totalGap:T,duration:o}),e.jsxs("div",{className:a.statusElements,id:"entry-status","data-timertype":d,children:[e.jsx("span",{className:a.eventNote,children:m}),e.jsx("div",{className:r?a.progressBg:`${a.progressBg} ${a.hidden}`,children:r&&e.jsx(As,{})}),e.jsxs("div",{className:a.eventStatus,tabIndex:-1,children:[e.jsx(E,{text:`Time type: ${d}`,render:e.jsx("span",{}),children:e.jsx(Ls,{type:d,className:a.statusIcon})}),e.jsx(E,{text:`End action: ${u}`,render:e.jsx("span",{}),children:e.jsx(Ps,{action:u,className:a.statusIcon})}),e.jsx(E,{text:`${c?"Count to End":"Count duration"}`,render:e.jsx("span",{}),children:e.jsx(et,{className:`${a.statusIcon} ${c?a.active:a.disabled}`})}),e.jsx(E,{text:"Event has Triggers",render:e.jsx("span",{}),children:e.jsx(tt,{className:`${a.statusIcon} ${g?a.active:a.disabled}`})})]})]})]}):null}function Ps(s){const{action:t,className:n}=s,o=N([t!==K.None&&a.active,n]);return t===K.LoadNext?e.jsx(it,{className:o}):t===K.PlayNext?e.jsx(at,{className:o}):e.jsx(le,{className:n})}function Ls(s){const{type:t,className:n}=s;return t===H.CountUp?e.jsx(st,{className:n}):t===H.Clock?e.jsx(nt,{className:n}):t===H.None?e.jsx(ot,{className:n}):e.jsx(rt,{className:n})}function Bs(s,t){if(!t)return;const n=Math.max(0,s+t);return`New start ${vt(A(n))}`}function Fs(s,t){if(s===0)return t?"(next day)":void 0;const n=J(Math.abs(s),!1);return`${s<0?"Overlap":"Gap"} ${n}${t?" (next day)":""}`}const Us="_indicators_duajo_18",Os="_delay_duajo_29",zs="_gap_duajo_36",W={indicators:Us,delay:Os,gap:zs};function Gs({timeStart:s,delay:t,gap:n,isNextDay:o}){const l=Fs(n,o),i=Bs(s,t);return e.jsxs("div",{className:W.indicators,children:[i&&e.jsx("div",{className:W.delay,children:i}),l&&e.jsx("div",{className:W.gap,children:l})]})}function qs({eventId:s,cue:t,timeStart:n,timeEnd:o,duration:l,timeStrategy:i,linkStart:c,flag:u,countToEnd:d,eventIndex:p,endAction:m,timerType:f,title:v,note:h,delay:r,colour:y,isPast:b,isNext:w,skip:I=!1,parent:T,loaded:R,hasCursor:g,playback:x,isRolling:F,gap:U,isNextDay:O,dayOffset:z,totalGap:be,isLinkedToLoaded:he,hasTriggers:ye}){const{selectedEventId:$,setSelectedEventId:ve,clearSelectedEventId:ge}=zt(),{updateEntry:xe,batchUpdateEvents:ee,clone:je,deleteEntry:te,groupEntries:Ee,swapEvents:ke}=D(),{selectedEvents:C,unselect:Se,setSelectedEvents:Ie,clearSelectedEvents:se}=me(),k=_.useRef(null),[Ce,Ne]=_.useState(!1),[we]=fe(C.size>1?[{type:"item",label:"Link to previous",icon:lt,onClick:()=>{ee({linkStart:!0},Array.from(C))}},{type:"item",label:"Unlink from previous",icon:ct,onClick:()=>{ee({linkStart:!1},Array.from(C))}},{type:"divider"},{type:"item",label:"Group",icon:ut,onClick:()=>{Ee(Array.from(C)),se()},disabled:T!==null},{type:"divider"},{type:"item",label:"Delete",icon:Z,onClick:()=>{se(),te(Array.from(C))}}]:[{type:"item",label:u?"Remove flag":"Add flag",icon:dt,onClick:()=>{xe({id:s,flag:!u})}},{type:"divider"},{type:"item",label:"Add to swap",icon:pt,onClick:()=>ve(s)},{type:"item",label:`Swap this event with ${$??""}`,icon:mt,onClick:()=>{$&&(ke($,s),ge())},disabled:$==null||$===s},{type:"item",label:"Clone",icon:ft,onClick:()=>je(s,{after:s})},{type:"divider"},{type:"item",label:"Delete",icon:Z,onClick:()=>{te([s]),Se(s)}}]),{isDragging:Te,attributes:Re,listeners:$e,setNodeRef:Ae,transform:De,transition:Me}=Q({id:s,data:{type:"event",parent:T},animateLayoutChanges:()=>!1}),Pe={zIndex:Te?2:"inherit",transform:X.Translate.toString(De),transition:Me},Le=y&&pe(y);_.useEffect(()=>{if(!g||(k==null?void 0:k.current)==null)return;const S=document.activeElement,j=k.current.closest("#event-group");j&&!j.contains(S)&&k.current.focus()},[g]),_.useLayoutEffect(()=>{const S=new IntersectionObserver(([G])=>{G.isIntersecting&&Ne(!0)},{root:null,threshold:1}),j=k.current;return j&&S.observe(j),()=>{j&&S.unobserve(j)}},[k]);const Be=C.has(s),Fe=N([a.rundownEvent,I?a.skip:null,b?a.past:null,R?a.loaded:null,x?a[x]:null,Be?a.selected:null,g?a.hasCursor:null]),Ue=S=>{if(S.stopPropagation(),C.size>1&&S.button===2)return;const j=p-1,G=St(S);Ie({id:s,index:j,selectMode:G})},Oe=x?_e(x):!1;return e.jsxs("div",{className:Fe,ref:Ae,style:Pe,onClick:Ue,onContextMenu:we,"data-testid":"rundown-event",...Oe?{"data-running":!0}:{},children:[e.jsx(Gs,{timeStart:n,delay:r,gap:U,isNextDay:O}),e.jsxs("div",{className:a.binder,style:{...Le},tabIndex:-1,children:[e.jsx("span",{className:a.drag,ref:k,...Re,...$e,children:e.jsx(Y,{})}),e.jsx("span",{className:a.cue,children:t})]}),Ce&&e.jsx(Ds,{timeStart:n,timeEnd:o,duration:l,linkStart:c,countToEnd:d,timeStrategy:i,eventId:s,eventIndex:p,endAction:m,timerType:f,title:v,note:h,delay:r,isNext:w,skip:I,loaded:R,playback:x,isRolling:F,dayOffset:z,isPast:b,totalGap:be,isLinkedToLoaded:he,hasTriggers:ye})]})}const Hs="_milestone_102sw_17",Ks="_hasCursor_102sw_35",Vs="_binder_102sw_39",Ws="_drag_102sw_47",L={milestone:Hs,hasCursor:Ks,binder:Vs,drag:Ws};function Zs({colour:s,cue:t,entryId:n,hasCursor:o,title:l}){const i=_.useRef(null),{updateEntry:c,deleteEntry:u}=D(),{selectedEvents:d,setSingleEntrySelection:p}=me(),[m]=fe([{type:"item",label:"Delete",icon:Z,onClick:()=>u([n])}]),{attributes:f,listeners:v,setNodeRef:h,isDragging:r,transform:y,transition:b}=Q({id:n,data:{type:"milestone"},animateLayoutChanges:()=>!1}),w=g=>{g.stopPropagation(),!(d.size>1&&g.button===2)&&p({id:n})},I=(g,x)=>{c({id:n,[g]:x})},T={zIndex:r?2:"inherit",transform:X.Translate.toString(y),transition:b},R=s&&pe(s);return e.jsxs("div",{className:N([L.milestone,o?L.hasCursor:null]),ref:h,onClick:w,onContextMenu:m,style:T,"data-testid":"rundown-milestone",children:[e.jsx("div",{className:L.binder,style:{...R},children:e.jsx("span",{className:L.drag,ref:i,...f,...v,children:e.jsx(Y,{})})}),e.jsx(ae,{field:"cue",initialValue:t,placeholder:"Cue",submitHandler:I}),e.jsx(ae,{field:"title",initialValue:l,placeholder:"Title",submitHandler:I})]})}function ae({field:s,initialValue:t,placeholder:n,submitHandler:o}){const l=_.useRef(null),i=_.useCallback(m=>o(s,m),[s,o]),{value:c,onChange:u,onBlur:d,onKeyDown:p}=Ct(t,i,l,{submitOnEnter:!0});return e.jsx(ce,{id:s,ref:l,fluid:!0,value:c,placeholder:n,onChange:u,onBlur:d,onKeyDown:p})}function xn({isPast:s,data:t,loaded:n,hasCursor:o,isNext:l,playback:i,isRolling:c,eventIndex:u,isNextDay:d,totalGap:p,isLinkedToLoaded:m}){return gt(t)?e.jsx(qs,{eventId:t.id,eventIndex:u,cue:t.cue,timeStart:t.timeStart,timeEnd:t.timeEnd,duration:t.duration,timeStrategy:t.timeStrategy,linkStart:t.linkStart,flag:t.flag,countToEnd:t.countToEnd,endAction:t.endAction,timerType:t.timerType,title:t.title,note:t.note,delay:t.delay,colour:t.colour,isPast:s,isNext:l,skip:t.skip,parent:t.parent,loaded:n,hasCursor:o,playback:i,isRolling:c,gap:t.gap,isNextDay:d,dayOffset:t.dayOffset,totalGap:p,isLinkedToLoaded:m,hasTriggers:t.triggers.length>0}):xt(t)?e.jsx(Ot,{data:t,hasCursor:o}):jt(t)?e.jsx(Zs,{colour:t.colour,cue:t.cue,entryId:t.id,hasCursor:o,title:t.title}):null}export{xn as default};
//# sourceMappingURL=RundownEntry-bkqwx57t.js.map