@getontime/cli
Version:
Time keeping for live events
4 lines (3 loc) • 33.2 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RundownEntry-C6xlMhcp.js","./vendor-DFNUfA2K.js","./vendor-4xP-6xVS.css","./useRundown-DgZv-crd.js","./index-BNit4nUw.js","./index-tI0w5dSe.css","./useProjectData-BfKJevmX.js","./useProjectData-Cw1aXCwD.css","./dateConfig-B62K3AL_.js","./validateEvent-d8SZfbc8.js","./isNewLatest-Bui5Tm3U.js","./editorSettings-CK-Psf7E.js","./editorSettings-BqHbWs9b.css","./parseUserTime-COEUAmmZ.js","./Tooltip-CMnbeNS3.js","./Tooltip-CKb7gU2M.css","./GroupEditor-Fr9zvH2i.js","./EditorUtils-QotOv0b5.js","./EditorUtils-BXko-IuN.css","./TimeInput-BWc6ixac.js","./TimeInput-BrVdiuOQ.css","./useCustomFields-C60U2vqf.js","./Select-Bp_h4xvR.js","./Select-DdMiS_36.css","./DropdownMenu-BV41kjSA.js","./DropdownMenu-ByBDeesm.css","./offset-DC4blUxG.js","./GroupEditor-CBhgzn1f.css","./useReport-C6WYCwpP.js","./playbackstate-DRK4geZP.js","./getProgress-Dgt_8BYF.js","./ProtectRoute-CmcGN6gV.js","./ProtectRoute-GSFobmAo.css","./Empty-BLJKwoJq.js","./Empty-DvR62o5B.css","./useFollowComponent-2C-gde3X.js","./RundownEntry-kIRtkSkD.css"])))=>i.map(i=>d[i]);
import{f as be,r as x,j as e,aN as se,bd as pt,C as Ye,L as Xe,aM as F,ah as Je,aO as Ce,aP as je,aQ as X,S as K,aK as ht,be as jt,aF as Ze,aG as et,bf as ft,b1 as mt,aT as yt,ax as gt,ay as vt,az as _t,bg as Et,aH as wt,bh as bt,aD as Ct,aC as kt,_ as Nt}from"./vendor-DFNUfA2K.js";import{T as we,L as Ie,S as ke,C as St}from"./EditorUtils-QotOv0b5.js";import{bo as De,ax as Ae,an as Re,af as Ne,b0 as q,b5 as ue,B as U,aF as Mt,bp as tt,bq as fe,br as st,i as J,ai as nt,aA as It,E as ge,g as Ge,bf as Dt,bs as At,b as Rt,bt as Gt,bh as Oe,bu as ve,av as Ot}from"./index-BNit4nUw.js";import{P as Pe}from"./ProtectRoute-CmcGN6gV.js";import{i as te,f as rt,g as Pt,l as Tt,h as ce,u as Bt,S as j}from"./useRundown-DgZv-crd.js";import{s as ee,a as Te,b as $t,c as Ft,E as qt,G as Lt,u as Vt}from"./GroupEditor-Fr9zvH2i.js";import{S as Kt,M as Wt,P as zt,D as Ht}from"./DropdownMenu-BV41kjSA.js";import{A as Ut}from"./TimeInput-BWc6ixac.js";import{u as ne,c as lt,a as Be,b as Qt}from"./dateConfig-B62K3AL_.js";import{u as Yt}from"./useCustomFields-C60U2vqf.js";import{E as ot}from"./Empty-BLJKwoJq.js";import{u as Xt}from"./useFollowComponent-2C-gde3X.js";import{g as Jt}from"./offset-DC4blUxG.js";import{d as _e,e as $e,f as Fe,h as Zt,j as es,k as ts}from"./isNewLatest-Bui5Tm3U.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]="eb8f4033-a90e-4e5c-94d8-98f1f3aeff7d",t._sentryDebugIdIdentifier="sentry-dbid-eb8f4033-a90e-4e5c-94d8-98f1f3aeff7d")}catch{}})();function ss(t,s,n){if(s===n)return t;const r=[...t],[l]=r.splice(s,1);return r.splice(n,0,l),r}function Se(){const t=navigator.userAgent.toLowerCase();return t.includes("macintosh")||t.includes("mac os")}const V=Se()?"Option":"Alt",Z=Se()?"Cmd":"Ctrl",xe=be()((t,s)=>({selectedEvents:new Set,anchoredIndex:null,cursor:null,entryMode:null,setSingleEntrySelection:({id:n})=>{t({selectedEvents:new Set([n]),anchoredIndex:null,cursor:n,entryMode:"single"})},setSelectedEvents:({id:n,index:r,selectMode:l})=>{const{selectedEvents:i,anchoredIndex:c,entryMode:b}=s();if(b==="single")return t({selectedEvents:new Set([n]),anchoredIndex:r,cursor:n,entryMode:"event"});if(l==="click")return t({selectedEvents:new Set([n]),anchoredIndex:r,cursor:n,entryMode:"event"});if(l==="ctrl"){const _=De.getQueryData(Ae);if(!_)return;if(!i.has(n))return t({selectedEvents:i.add(n),anchoredIndex:r,cursor:n,entryMode:"event"});i.delete(n);const C=_.order.findIndex((S,T)=>T>r&&te(_.entries[S])&&i.has(S));return t({selectedEvents:i,anchoredIndex:C<0?_.order.length-1:C,entryMode:"event"})}if(l==="shift"){const _=De.getQueryData(Ae);if(!_)return;const C=[];_.flatOrder.forEach(E=>{const A=_.entries[E];te(A)&&C.push(A.id)});const S=c===null?0:Math.min(c,r),T=c===null?r:Math.max(c,r+1),p=C.slice(S,T);return t({selectedEvents:new Set([...i,...p]),anchoredIndex:r,entryMode:"event"})}},clearSelectedEvents:()=>t({selectedEvents:new Set,anchoredIndex:null,cursor:null,entryMode:null}),clearMultiSelect:()=>{const{selectedEvents:n}=s(),[r]=n;t({selectedEvents:new Set(r?[r]:[]),anchoredIndex:null,entryMode:null})},unselect:n=>{const{entryMode:r,selectedEvents:l}=s();l.delete(n),t({selectedEvents:l,entryMode:l.size===0?null:r})}}));function tr(t){return Se()&&t.metaKey||t.ctrlKey?"ctrl":t.shiftKey?"shift":"click"}const ns="_footer_44w0f_17",rs={footer:ns},ls=x.memo(os);function os({id:t,cue:s}){const n=`/ontime/load/id "${t}"`,r=`/ontime/load/cue "${s}"`;return e.jsxs("div",{className:rs.footer,children:[e.jsx(Re,{copyValue:n,children:n}),e.jsx(Re,{copyValue:r,children:r})]})}const is="_entryEditor_103di_17",ds="_shortcutSection_103di_28",as="_shortcuts_103di_35",cs="_spacer_103di_48",us="_prompt_103di_52",xs="_divider_103di_56",ps="_kbd_103di_62",H={entryEditor:is,shortcutSection:ds,shortcuts:as,spacer:cs,prompt:us,divider:xs,kbd:ps},hs=x.memo(js);function js(){return e.jsx("div",{className:H.entryEditor,"data-testid":"editor-container",children:e.jsxs("div",{className:H.shortcutSection,children:[e.jsx(we,{className:H.prompt,children:"Rundown shortcuts"}),e.jsx("table",{className:H.shortcuts,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:"Find in rundown"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"F"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Open Settings"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:","})]})]}),e.jsx("tr",{className:H.spacer}),e.jsxs("tr",{children:[e.jsx("td",{children:"Select entry"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"↑"}),e.jsx(y,{children:"/"}),e.jsx(d,{children:"↓"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Select group"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"↑"}),e.jsx(y,{children:"/"}),e.jsx(d,{children:"↓"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Deselect entry"}),e.jsx("td",{children:e.jsx(d,{children:"Esc"})})]}),e.jsx("tr",{className:H.spacer}),e.jsxs("tr",{children:[e.jsx("td",{children:"Reorder selected entry"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"↑"}),e.jsx(y,{children:"/"}),e.jsx(d,{children:"↓"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Copy selected entry"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"C"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Paste above"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"V"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Paste below"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"V"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Delete selected entry"}),e.jsxs("td",{children:[e.jsx(d,{children:Z}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Backspace"})]})]}),e.jsx("tr",{className:H.spacer}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add event below"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"E"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add event above"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"E"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add group below"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"G"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add group above"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"M"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add milestone below"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"G"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add milestone above"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"M"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add delay below"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"D"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Add delay above"}),e.jsxs("td",{children:[e.jsx(d,{children:V}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"Shift"}),e.jsx(y,{children:"+"}),e.jsx(d,{children:"D"})]})]})]})})]})})}function y({children:t}){return e.jsx("span",{className:H.divider,children:t})}function d({children:t}){return e.jsx("span",{className:H.kbd,children:t})}function fs({milestone:t}){const{data:s}=Yt(),{updateEntry:n}=ne(),r=x.useCallback((i,c)=>{if(typeof i=="string"&&i.startsWith("custom-")){const b=i.split("custom-")[1];n({id:t.id,custom:{[b]:c}});return}return n({id:t.id,[i]:c})},[t.id,n]),l=window.location.pathname.includes("editor");return e.jsxs("div",{className:ee.content,children:[e.jsxs("div",{className:ee.column,children:[e.jsx(we,{children:"Milestone data"}),e.jsxs("div",{className:ee.splitTwo,children:[e.jsxs("div",{children:[e.jsx(Ie,{htmlFor:"entryId",children:"Milestone ID (read only)"}),e.jsx(Ne,{id:"entryId","data-testid":"input-textfield",value:t.id,readOnly:!0,fluid:!0})]}),e.jsx(Te,{field:"cue",label:"Cue",initialValue:t.cue,submitHandler:r,maxLength:10})]}),e.jsxs("div",{children:[e.jsx(Ie,{children:"Colour"}),e.jsx(Kt,{name:"colour",value:t.colour,handleChange:r})]}),e.jsx(Te,{field:"title",label:"Title",initialValue:t.title,submitHandler:r}),e.jsx($t,{field:"note",label:"Note",initialValue:t.note,submitHandler:r})]}),e.jsxs("div",{className:ee.column,children:[e.jsxs(we,{children:["Custom Fields",l&&e.jsx(Ut,{search:"settings=manage__custom",children:"Manage Custom Fields"})]}),e.jsx(Ft,{fields:s,handleSubmit:r,entry:t})]})]})}function ms(){const t=xe(l=>l.selectedEvents),{data:s}=rt(),[n,r]=x.useState(null);return x.useEffect(()=>{if(s.order.length===0){r(null);return}const l=Array.from(t).at(0);if(!l){r(null);return}const i=s.entries[l];i&&!Pt(i)?r(i):r(null)},[s.order,s.entries,t]),n?te(n)?e.jsxs("div",{className:ee.entryEditor,"data-testid":"editor-container",children:[e.jsx(qt,{event:n}),e.jsx(ls,{id:n.id,cue:n.cue})]}):Tt(n)?e.jsx("div",{className:ee.entryEditor,"data-testid":"editor-container",children:e.jsx(fs,{milestone:n})}):ce(n)?e.jsx("div",{className:ee.entryEditor,"data-testid":"editor-container",children:e.jsx(Lt,{group:n})}):null:e.jsx(hs,{})}const qe=12;function ys(){const{data:t,rundownId:s}=Bt(),[n,r]=x.useState([]),[l,i]=x.useState(null),c=x.useRef(""),b=xe(p=>p.setSelectedEvents),[_,C]=se({key:`rundown.${s}-editor-collapsed-groups`,defaultValue:[]}),S=x.useCallback(p=>{if(!t||t.length===0){i("No data");return}if(i(null),p.target.value===""){r([]);return}const E=p.target.value.toLowerCase();if(c.current=E,E.startsWith("index ")){const O=E.replace("index ","").trim(),{results:N,error:k}=R(O);r(N),i(k);return}if(E.startsWith("cue ")){const O=E.replace("cue ","").trim(),{results:N,error:k}=f(O);r(N),i(k);return}const A=E.replace("title ","").trim(),{results:G,error:W}=re(A);r(G),i(W);function R(O){const N=Number(O);if(isNaN(N)||N<1)return{results:[],error:"Invalid index"};if(N>t.length)return{results:[],error:null};let k=1;const M=[];for(let g=0;g<t.length;g++){const h=t[g];if(te(h)){if(k===N){M.push({type:j.Event,id:h.id,index:g,eventIndex:k,title:h.title,cue:h.cue,colour:h.colour,parent:h.parent});break}k++}}return{results:M,error:null}}function f(O){let N=1,k=qe;const M=[];for(let g=0;g<t.length&&!(k<=0);g++){const h=t[g];te(h)&&(h.cue.toLowerCase().includes(O)&&(k--,M.push({type:j.Event,id:h.id,index:g,eventIndex:N,title:h.title,cue:h.cue,colour:h.colour,parent:h.parent})),N++)}return{results:M,error:null}}function re(O){let N=1,k=qe;const M=[];for(let g=0;g<t.length&&!(k<=0);g++){const h=t[g];te(h)&&(h.title.toLowerCase().includes(O)&&(k--,M.push({type:j.Event,id:h.id,index:g,eventIndex:N,title:h.title,cue:h.cue,colour:h.colour,parent:h.parent})),N++),ce(h)&&h.title.toLowerCase().includes(O)&&(k--,M.push({type:j.Group,id:h.id,index:g,title:h.title}))}return{results:M,error:null}}},[t]),T=x.useCallback(p=>{if(p.type===j.Event&&p.parent!==null){const A=[...new Set(_)].filter(G=>G!==p.parent);C(A)}b({id:p.id,index:p.index,selectMode:"click"})},[_,C,b]);return x.useEffect(()=>{r([]),i(null),c.current&&S({target:{value:c.current}})},[t,S]),{find:S,select:T,results:n,error:l}}const gs="_entry_1dyqa_17",vs="_empty_1dyqa_18",_s="_error_1dyqa_19",Es="_data_1dyqa_40",ws="_index_1dyqa_46",bs="_title_1dyqa_55",Cs="_cue_1dyqa_58",ks="_footer_1dyqa_66",Ns="_em_1dyqa_18",Ss="_scrollContainer_1dyqa_76",L={entry:gs,empty:vs,error:_s,data:Es,index:ws,title:bs,cue:Cs,footer:ks,em:Ns,scrollContainer:Ss};function Ms({isOpen:t,onClose:s}){const{find:n,select:r,results:l,error:i}=ys(),[c,b]=x.useState(0),_=pt(n,100),C=p=>{l.length!==0&&(p.key==="ArrowDown"&&b(E=>(E+1)%l.length),p.key==="ArrowUp"&&b(E=>(E-1+l.length)%l.length),p.key==="Enter"&&(p.preventDefault(),p.stopPropagation(),S()))},S=()=>{const p=l[c];r(p),s()},T=p=>{const A=p.target.closest("li");if(A){const G=Number(A.dataset.index);isNaN(G)||b(G)}};return e.jsx(Wt,{title:"",isOpen:t,onClose:s,showBackdrop:!0,bodyElements:e.jsxs("div",{onKeyDown:C,children:[e.jsx(Ne,{height:"large",fluid:!0,onChange:_,placeholder:"Search..."}),e.jsxs("ul",{className:L.scrollContainer,onMouseMove:T,children:[i&&e.jsx("li",{className:L.error,children:i}),l.length===0&&e.jsx("li",{className:L.empty,children:"No results"}),l.length>0&&l.map((p,E)=>{const A=c===E,G=p.type===j.Event?p.eventIndex:"-",W=p.type===j.Event?p.cue:"",R=p.type===j.Event?p.colour:"";return e.jsxs("li",{className:L.entry,"data-selected":A,"data-index":E,onClick:S,children:[e.jsxs("div",{className:L.data,children:[e.jsx("div",{className:L.index,style:{"--color":R},children:G}),e.jsx("div",{className:L.cue,children:W}),e.jsx("div",{className:L.title,children:p.title})]}),A&&e.jsx("span",{children:"Go ⏎"})]},p.id)})]})]}),footerElements:e.jsxs("div",{className:L.footer,children:["Use the keywords ",e.jsx("span",{className:L.em,children:"cue"}),", ",e.jsx("span",{className:L.em,children:"index"})," or",e.jsx("span",{className:L.em,children:"title"})," to filter search"]})})}const Le=x.memo(Is);function Is(){const[t,s]=Ye();return Xe([["mod + f",s.toggle],["Escape",s.close]]),t?e.jsx(Ms,{isOpen:t,onClose:s.close}):null}const it=be(t=>({position:{x:0,y:0},options:[],isOpen:!1,setContextMenu:(s,n)=>t(()=>({position:s,options:n,isOpen:!0})),setIsOpen:s=>t(()=>({isOpen:s}))}));function Ve({children:t}){const{position:s,options:n,isOpen:r,setIsOpen:l}=it(),i=()=>l(!1);return r?e.jsxs(e.Fragment,{children:[t,e.jsx(zt,{isOpen:!0,position:s,onClose:i,items:n})]}):t}const Ds="_header_156wk_17",As="_group_156wk_28",Rs="_radioButton_156wk_39",Gs="_apart_156wk_70",Os="_separator_156wk_74",D={header:Ds,group:As,radioButton:Rs,apart:Gs,separator:Os},Ps=x.memo(Ts);function Ts(){const[t,s]=Ye(),n=xe(c=>c.clearSelectedEvents),[r]=se({key:ue.editorMode,defaultValue:q.Edit}),{deleteAllEntries:l}=ne(),i=x.useCallback(()=>{l(),n(),s.close()},[n,l,s]);return e.jsxs(e.Fragment,{children:[e.jsxs(F,{render:e.jsx(U,{variant:"subtle-destructive"}),onClick:s.open,disabled:r===q.Run,className:D.apart,children:[e.jsx(Je,{}),"Clear all"]}),e.jsx(Mt,{isOpen:t,onClose:s.close,title:"Clear rundown",showBackdrop:!0,showCloseButton:!0,bodyElements:e.jsxs(e.Fragment,{children:["You will lose all data in your rundown. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(U,{variant:"ghosted-white",size:"large",onClick:s.close,children:"Cancel"}),e.jsx(U,{variant:"destructive",size:"large",onClick:i,children:"Delete all"})]})})]})}const Bs=x.memo($s);function $s(){const[t,s]=se({key:ue.editorMode,defaultValue:q.Edit}),{offsetMode:n}=tt(),r=i=>{const c=i.at(0);c&&s(c)},l=i=>{const c=i.at(0);c&&st(c)};return e.jsxs(Ce,{className:D.header,children:[e.jsxs(je,{value:[t],onValueChange:r,className:D.group,children:[e.jsx(F,{render:e.jsx(X,{}),value:q.Run,className:D.radioButton,children:"Run"}),e.jsx(F,{render:e.jsx(X,{}),value:q.Edit,className:D.radioButton,children:"Edit"})]}),e.jsx(ke,{className:D.separator}),e.jsxs(je,{value:[n],onValueChange:l,className:D.group,children:[e.jsx(F,{render:e.jsx(X,{}),value:fe.Absolute,className:D.radioButton,children:"Absolute"}),e.jsx(F,{render:e.jsx(X,{}),value:fe.Relative,className:D.radioButton,children:"Relative"})]}),e.jsx(Ps,{})]})}const Fs=x.memo(qs);function qs(){const[t,s]=se({key:ue.editorMode,defaultValue:q.Edit}),{offsetMode:n}=tt(),r=i=>{const c=i.at(0);c&&s(c)},l=i=>{const c=i.at(0);c&&st(c)};return e.jsxs(Ce,{className:D.header,children:[e.jsxs(je,{value:[t],onValueChange:r,className:D.group,children:[e.jsx(F,{render:e.jsx(X,{}),value:q.Run,className:D.radioButton,children:"Run"}),e.jsx(F,{render:e.jsx(X,{}),value:q.Edit,className:D.radioButton,children:"Edit"})]}),e.jsx(ke,{className:D.separator}),e.jsxs(je,{value:[n],onValueChange:l,className:D.group,children:[e.jsx(F,{render:e.jsx(X,{}),value:fe.Absolute,className:D.radioButton,children:"Absolute"}),e.jsx(F,{render:e.jsx(X,{}),value:fe.Relative,className:D.radioButton,children:"Relative"})]})]})}const Ls=be()(t=>({entryCopyId:null,setEntryCopyId:s=>t({entryCopyId:s})})),Vs=t=>({type:j.Event,flag:t.flag,title:t.title,note:t.note,timeStart:t.timeStart,duration:t.duration,timeEnd:t.timeEnd,timerType:t.timerType,timeStrategy:t.timeStrategy,countToEnd:t.countToEnd,linkStart:t.linkStart,endAction:t.endAction,skip:t.skip,colour:t.colour,parent:t.parent,revision:0,delay:t.delay,dayOffset:t.dayOffset,gap:0,timeWarning:t.timeWarning,timeDanger:t.timeDanger,triggers:structuredClone(t.triggers),custom:structuredClone(t.custom)}),Ks="_quickAdd_96pwt_17",Ws="_indent_96pwt_24",Ke={quickAdd:Ks,indent:Ws},Ee=x.memo(zs);function zs({previousEventId:t,parentGroup:s,backgroundColor:n}){const{addEntry:r}=ne(),l=()=>{r({type:j.Event,parent:s},{after:t,lastEventId:t})},i=()=>{r({type:j.Delay,parent:s},{lastEventId:t,after:t})},c=()=>{r({type:j.Milestone,parent:s},{lastEventId:t,after:t})},b=()=>{s===null&&r({type:j.Group},{lastEventId:t,after:t})},_=n===""?"#9d9d9d":n;return e.jsxs(Ce,{className:J([Ke.quickAdd,!!s&&Ke.indent]),style:_?{"--user-bg":_}:{},"data-testid":"quick-add-buttons",children:[e.jsxs(F,{render:e.jsx(U,{size:"small"}),onClick:l,children:[e.jsx(K,{}),"Event"]}),e.jsxs(F,{render:e.jsx(U,{size:"small"}),onClick:i,children:[e.jsx(K,{}),"Delay"]}),e.jsxs(F,{render:e.jsx(U,{size:"small"}),onClick:c,children:[e.jsx(K,{}),"Milestone"]}),s===null&&e.jsxs(F,{render:e.jsx(U,{size:"small"}),onClick:b,children:[e.jsx(K,{}),"Group"]})]})}const Hs="_quickAdd_uk1y1_17",Us="_addButton_uk1y1_26",We={quickAdd:Hs,addButton:Us},ze=x.memo(Qs);function Qs({previousEventId:t,parentGroup:s}){const{addEntry:n}=ne(),r=()=>{n({type:j.Event,parent:s},{after:t,lastEventId:t})},l=()=>{n({type:j.Delay,parent:s},{lastEventId:t,after:t})},i=()=>{n({type:j.Milestone,parent:s},{lastEventId:t,after:t})},c=()=>{s===null&&n({type:j.Group},{lastEventId:t,after:t})};return e.jsx("div",{className:We.quickAdd,"data-testid":"quick-add-inline",children:e.jsx(Ht,{items:[{type:"item",icon:K,label:"Add Event",onClick:r},{type:"item",icon:K,label:"Add Delay",onClick:l},{type:"item",icon:K,label:"Add Milestone",onClick:i},{type:"item",icon:K,label:"Add Group",onClick:c,disabled:s!==null}],render:e.jsx(nt,{size:"small",variant:"primary",className:We.addButton}),children:e.jsx(K,{})})})}const Ys=t=>{const s=it(r=>r.setContextMenu);return[r=>{r.preventDefault();const{pageX:l,pageY:i}=r;return s({x:l,y:i},t)}]},Xs="_noTitle_zrdm3_26",He={noTitle:Xs};function Js({title:t,entryId:s,placeholder:n,className:r}){const{updateEntry:l}=ne(),i=x.useRef(null),c=x.useCallback(p=>{if(p===t)return;const E=p.trim();l({id:s,title:E})},[t,l,s]),{value:b,onChange:_,onBlur:C,onKeyDown:S}=Vt(t,c,i,{submitOnEnter:!0}),T=J([r,He.eventTitle,b?null:He.noTitle]);return e.jsx(Ne,{"data-testid":"entry__title",variant:"ghosted",fluid:!0,ref:i,value:b,className:T,placeholder:n,onChange:_,onBlur:C,onKeyDown:S})}const Zs="_blink_igjkt_1",en="_fourtyfive_igjkt_13",tn="_group_igjkt_17",sn="_hasCursor_igjkt_31",nn="_expanded_igjkt_34",rn="_binder_igjkt_39",ln="_header_igjkt_54",on="_titleRow_igjkt_62",dn="_metaRow_igjkt_67",an="_metaEntry_igjkt_73",cn="_strike_igjkt_81",un="_over_igjkt_85",xn="_under_igjkt_89",pn="_drag_igjkt_93",hn="_isDragging_igjkt_109",jn="_notAllowed_igjkt_112",I={blink:Zs,fourtyfive:en,group:tn,hasCursor:sn,expanded:nn,binder:rn,header:ln,titleRow:on,metaRow:dn,metaEntry:an,strike:cn,over:un,under:xn,drag:pn,isDragging:hn,notAllowed:jn};function fn({data:t,hasCursor:s,collapsed:n,onCollapse:r}){var h,oe;const l=x.useRef(null),{clone:i,ungroup:c,deleteEntry:b}=ne(),{selectedEvents:_,setSingleEntrySelection:C}=xe(),[S]=Ys([{type:"item",label:"Clone Group",icon:ht,onClick:()=>i(t.id)},{type:"item",label:"Ungroup",icon:jt,onClick:()=>c(t.id),disabled:t.entries.length===0},{type:"divider"},{type:"item",label:"Delete Group",icon:Je,onClick:()=>b([t.id])}]),{attributes:T,listeners:p,setNodeRef:E,transform:A,transition:G,isDragging:W,isOver:R,over:f}=Ze({id:t.id,data:{type:"group"},animateLayoutChanges:()=>!1}),re=B=>{B.stopPropagation(),!(_.size>1&&B.button===2)&&C({id:t.id})},O=t.colour&&It(t.colour),N=(f==null?void 0:f.id)&<((h=f.data.current)==null?void 0:h.type,(oe=f.data.current)==null?void 0:oe.parent),[k,M]=(()=>{if(t.targetDuration===null)return[null,null];const B=t.duration-t.targetDuration;if(B===0)return[null,"under"];const Q=Math.abs(B);return[`${B<0?"-":"+"}${ge(Q,Q>2*Dt)}`,Jt(B)]})(),g={zIndex:W?2:"inherit",transform:et.Translate.toString(A),transition:G,cursor:R?N?"grabbing":"no-drop":"grab"};return e.jsxs("div",{className:J([I.group,s&&I.hasCursor,!n&&I.expanded]),ref:E,onClick:re,onContextMenu:S,style:{...g,"--user-bg":t.colour||"#929292"},"data-testid":"rundown-group",children:[e.jsx("div",{className:I.binder,style:{...O},tabIndex:-1,children:e.jsx("span",{className:J([I.drag,W&&I.isDragging,W&&!N&&I.notAllowed]),ref:l,...T,...p,children:e.jsx(ft,{})})}),e.jsxs("div",{className:I.header,children:[e.jsxs("div",{className:I.titleRow,children:[e.jsx(Js,{title:t.title,entryId:t.id,placeholder:"Group title"}),e.jsx(nt,{"aria-label":"Collapse",variant:"subtle-white",onClick:()=>r(!n,t.id),children:n?e.jsx(mt,{}):e.jsx(yt,{})})]}),e.jsxs("div",{className:I.metaRow,children:[e.jsxs("div",{className:I.metaEntry,children:[e.jsx("div",{children:"Start"}),e.jsx("div",{children:Ge(t.timeStart)})]}),e.jsxs("div",{className:I.metaEntry,children:[e.jsx("div",{children:"End"}),e.jsx("div",{children:Ge(t.timeEnd)})]}),e.jsxs("div",{className:I.metaEntry,children:[e.jsx("div",{children:"Duration"}),k===null?e.jsx("div",{className:J([M!==null&&I[M]]),children:ge(t.duration)}):e.jsxs("div",{children:[e.jsx("span",{className:I.strike,children:ge(t.duration)}),e.jsx("span",{className:J([M!==null&&I[M]]),children:k})]})]}),e.jsxs("div",{className:I.metaEntry,children:[e.jsx("div",{children:"Entries"}),e.jsx("div",{children:t.entries.length})]})]})]})]})}const mn="_groupEnd_1mlc9_17",yn={groupEnd:mn};function gn({id:t,colour:s}){const{attributes:n,listeners:r,setNodeRef:l,transform:i,transition:c}=Ze({id:t,data:{type:"end-group"},animateLayoutChanges:()=>!1,disabled:!0}),b={transform:et.Transform.toString(i),transition:c};return e.jsx("div",{className:yn.groupEnd,ref:l,...n,...r,style:{...b,...s?{"--user-bg":s}:{}},tabIndex:-1})}const vn="_empty_pqnxu_17",_n="_inline_pqnxu_22",Ue={empty:vn,inline:_n};function En(t){const{handleAddNew:s}=t;return e.jsxs("div",{className:Ue.empty,children:[e.jsx(ot,{injectedStyles:{marginTop:"5vh",marginBottom:"3rem"}}),e.jsxs("div",{className:Ue.inline,children:[e.jsxs(U,{onClick:()=>s(j.Event),variant:"primary",size:"large",children:[e.jsx(K,{}),"Create Event"]}),e.jsx(ke,{}),e.jsxs(U,{onClick:()=>s(j.Group),variant:"primary",size:"large",children:[e.jsx(K,{})," Create Group"]})]})]})}const wn="_rundownWrapper_qmpnm_17",bn="_rundownContainer_qmpnm_22",Cn="_list_qmpnm_28",kn="_spacer_qmpnm_44",Nn="_entryWrapper_qmpnm_48",Sn="_entryIndex_qmpnm_55",Mn="_flag_qmpnm_66",In="_index_qmpnm_72",Dn="_entry_qmpnm_48",z={rundownWrapper:wn,rundownContainer:bn,list:Cn,spacer:kn,entryWrapper:Nn,entryIndex:Sn,flag:Mn,index:In,entry:Dn},An=x.lazy(()=>Nt(()=>import("./RundownEntry-C6xlMhcp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url));function Rn({data:t}){const{order:s,entries:n,id:r}=t,l=At(),[i,c]=x.useState(()=>Be(s,n)),[b,_]=se({key:`rundown.${r}-editor-collapsed-groups`,defaultValue:[]}),{addEntry:C,deleteEntry:S,move:T,reorderEntry:p}=ne(),{entryCopyId:E,setEntryCopyId:A}=Ls(),[G]=se({key:ue.editorMode,defaultValue:q.Edit}),{clearSelectedEvents:W,setSelectedEvents:R,cursor:f}=xe(),re=x.useRef(null),O=x.useRef(null);Xt({followRef:re,scrollRef:O,doFollow:G===q.Run});const N=gt(vt(kt,{activationConstraint:{distance:10}})),k=x.useCallback(a=>{if(!a)return;const{entry:u,index:o}=_e(n,s,a);S([a]),u&&o!==null&&R({id:u.id,selectMode:"click",index:o})},[n,s,S,R]),M=x.useCallback((a,u,o=!1)=>{var P;const w=o?((P=_e(n,s,a??"").entry)==null?void 0:P.id)??null:a;if(u===null)return;const m=n[u];if((m==null?void 0:m.type)===j.Event){const $=Vs(m);C($,{after:w??void 0})}},[C,s,n]),g=x.useCallback((a,u,o=!1)=>{C(a,{after:u&&!o?u:void 0,before:u&&o?u:void 0,lastEventId:!o&&u?u:void 0})},[C]),h=x.useCallback((a,u)=>{if(s.length<1)return;let o=a;if(a===null){const m=u==="up"?$e(n,s):Fe(n,s);if(ce(m)){R({id:m.id,selectMode:"click",index:u==="up"?s.length:0});return}o=(m==null?void 0:m.id)??null}if(o===null)return;const w=u==="up"?Zt(n,s,o):es(n,s,o);w.entry!==null&&w.index!==null&&R({id:w.entry.id,selectMode:"click",index:w.index})},[s,n,R]),oe=x.useCallback((a,u)=>{if(s.length<1)return;if(a===null){const w=u==="up"?$e(n,s):Fe(n,s);w!==null&&R({id:w.id,selectMode:"click",index:u==="up"?s.length:0});return}const o=u==="up"?_e(n,s,a):ts(n,s,a);o.entry!==null&&o.index!==null&&R({id:o.entry.id,selectMode:"click",index:o.index})},[s,n,R]),B=x.useCallback(a=>!!b.find(u=>u===a),[b]),Q=x.useCallback((a,u)=>{_(o=>{const w=B(u);return a&&!w?[...new Set(o).add(u)]:!a&&w?[...o].filter(m=>m!==u):o})},[B,_]),Me=x.useCallback(async(a,u)=>{if(a==null)return;const o=await T(a,u);o&&Q(!1,o)},[Q,T]);Xe([["alt + ArrowDown",()=>oe(f,"down"),{preventDefault:!0,usePhysicalKeys:!0}],["alt + ArrowUp",()=>oe(f,"up"),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + ArrowDown",()=>h(f,"down"),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + ArrowUp",()=>h(f,"up"),{preventDefault:!0,usePhysicalKeys:!0}],["alt + mod + ArrowDown",()=>Me(f,"down"),{preventDefault:!0,usePhysicalKeys:!0}],["alt + mod + ArrowUp",()=>Me(f,"up"),{preventDefault:!0,usePhysicalKeys:!0}],["Escape",()=>W(),{preventDefault:!0,usePhysicalKeys:!0}],["mod + Backspace",()=>k(f),{preventDefault:!0,usePhysicalKeys:!0}],["alt + E",()=>g({type:j.Event},f),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + E",()=>g({type:j.Event},f,!0),{preventDefault:!0,usePhysicalKeys:!0}],["alt + G",()=>g({type:j.Group},f),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + G",()=>g({type:j.Group},f,!0),{preventDefault:!0,usePhysicalKeys:!0}],["alt + D",()=>g({type:j.Delay},f),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + D",()=>g({type:j.Delay},f,!0),{preventDefault:!0,usePhysicalKeys:!0}],["alt + M",()=>g({type:j.Milestone},f),{preventDefault:!0,usePhysicalKeys:!0}],["alt + shift + M",()=>g({type:j.Milestone},f,!0),{preventDefault:!0,usePhysicalKeys:!0}],["mod + C",()=>A(f)],["mod + V",()=>M(f,E)],["mod + shift + V",()=>M(f,E,!0),{preventDefault:!0,usePhysicalKeys:!0}],["alt + backspace",()=>k(f),{preventDefault:!0,usePhysicalKeys:!0}]]),x.useEffect(()=>{c(Be(s,n))},[s,n]),x.useEffect(()=>{var o;if(G!==q.Run||!(l!=null&&l.selectedEventId))return;const a=s.findIndex(w=>w===l.selectedEventId),u=(o=n[l.selectedEventId])==null?void 0:o.parent;u&&_(w=>[...w].filter(m=>m!==u)),R({id:l.selectedEventId,selectMode:"click",index:a})},[G,n,l.selectedEventId,s,_,R]);const dt=a=>{var pe,he,de,ae,ye;const{active:u,over:o}=a;if(!(o!=null&&o.id)||u.id===o.id||((pe=u.data.current)==null?void 0:pe.type)===j.Group&&!lt((he=o.data.current)==null?void 0:he.type,(de=o.data.current)==null?void 0:de.parent))return;const w=(ae=u.data.current)==null?void 0:ae.sortable.index,m=(ye=o.data.current)==null?void 0:ye.sortable.index;let P=o.id,$=w<m?"after":"before";if(P.startsWith("end-"))P=P.replace("end-",""),$==="before"&&($="insert");else{const le=t.entries[P];ce(le)&&$==="after"&&(le.entries.length===0?$="insert":(P=le.entries[0],$="before"))}const me=structuredClone(i);c(le=>ss(le,w,m)),p(u.id,P,$).catch(le=>{c(me)})},at=a=>{var o;((o=a.active.data.current)==null?void 0:o.type)===j.Group&&Q(!0,a.active.id)},ct=a=>{var w,m,P,$;if(((w=a.active.data.current)==null?void 0:w.type)==="group"||((P=(m=a.over)==null?void 0:m.data.current)==null?void 0:P.type)!=="group")return;const u=($=a.over)==null?void 0:$.id;B(u)&&Q(!1,u)};if(i.length<1)return e.jsx(En,{handleAddNew:a=>C({type:a})});const ie=G===q.Edit,{metadata:ut,process:xt}=Qt(l==null?void 0:l.selectedEventId);let v=ut;return e.jsx("div",{className:z.rundownContainer,ref:O,"data-testid":"rundown",children:e.jsx(_t,{onDragEnd:dt,onDragStart:at,onDragOver:ct,sensors:N,collisionDetection:Et,children:e.jsx(wt,{items:i,strategy:bt,children:e.jsxs("div",{className:z.list,children:[ie&&e.jsx(Ee,{previousEventId:null,parentGroup:null}),i.map((a,u)=>{var de;if(a.startsWith("end-")){const ae=a.split("end-")[1];return B(ae)?null:e.jsxs(x.Fragment,{children:[ie&&v.groupEntries===0&&e.jsx(Ee,{previousEventId:null,parentGroup:ae,backgroundColor:v.groupColour}),e.jsx(gn,{id:a,colour:v.groupColour},a)]},a)}const o=n[a];if(!o||(v=xt(o),o.type!==j.Group&&v.groupId!==null&&B(v.groupId)))return null;const w=(l==null?void 0:l.nextEventId)===o.id,m=o.id===f,P=v.groupColour===""?"#9d9d9d":v.groupColour,$=u===0,me=a===s.at(-1),pe=v.thisId!==v.groupId?v.groupId:null,he=v.groupId;return e.jsxs(x.Fragment,{children:[ie&&m&&!$&&e.jsx(ze,{previousEventId:v.previousEntryId,parentGroup:pe}),ce(o)?e.jsx(fn,{data:o,hasCursor:m,collapsed:B(o.id),onCollapse:Q}):e.jsxs("div",{className:z.entryWrapper,"data-testid":`entry-${v.eventIndex}`,style:P?{"--user-bg":P}:{},children:[te(o)&&e.jsxs("div",{className:z.entryIndex,children:[o.flag&&e.jsx(Ct,{className:z.flag}),e.jsx("div",{className:z.index,children:v.eventIndex})]}),e.jsx("div",{className:z.entry,ref:m?re:void 0,children:e.jsx(An,{type:o.type,isPast:v.isPast,eventIndex:v.eventIndex,data:o,loaded:v.isLoaded,hasCursor:m,isNext:w,previousEntryId:v.previousEntryId,previousEventId:(de=v.previousEvent)==null?void 0:de.id,playback:v.isLoaded?l.playback:void 0,isRolling:l.playback===Rt.Roll,isNextDay:v.isNextDay,totalGap:v.totalGap,isLinkedToLoaded:v.isLinkedToLoaded})},o.id)]}),ie&&m&&!me&&e.jsx(ze,{previousEventId:o.id,parentGroup:he})]},o.id)}),ie&&e.jsx(Ee,{previousEventId:v.groupId??v.thisId,parentGroup:null}),e.jsx("div",{className:z.spacer})]})})})})}function Qe({isSmallDevice:t}){const{data:s,status:n}=rt();return e.jsxs("div",{className:z.rundownWrapper,children:[t?e.jsx(Fs,{}):e.jsx(Bs,{}),n==="success"&&s?e.jsx(Rn,{data:s}):e.jsx(ot,{text:"Connecting to server"})]})}const Gn="_rundownExport_wxni5_21",On="_extracted_wxni5_25",Pn="_list_wxni5_25",Tn="_side_wxni5_29",Bn="_rundown_wxni5_21",Y={rundownExport:Gn,extracted:On,list:Pn,side:Tn,rundown:Bn},$n=x.memo(Fn);function Fn(){const t=window.location.pathname.includes("/rundown"),[s]=se({key:ue.editorMode,defaultValue:q.Edit});if(Gt()&&t)return e.jsx(Pe,{permission:"editor",children:e.jsxs("div",{className:J([Y.rundownExport,Y.extracted]),"data-target":"small-device","data-testid":"panel-rundown",children:[e.jsx(Le,{}),e.jsx(Oe,{suppressSettings:!0}),e.jsx("div",{className:Y.rundown,children:e.jsx(ve,{children:e.jsx(Ve,{children:e.jsx(Qe,{isSmallDevice:!0})})})})]})});const r=t&&s==="run";return e.jsx(Pe,{permission:"editor",children:e.jsxs("div",{className:J([Y.rundownExport,t&&Y.extracted]),"data-testid":"panel-rundown",children:[e.jsx(Le,{}),t&&e.jsx(Oe,{suppressSettings:!0}),e.jsxs("div",{className:Y.rundown,children:[e.jsx("div",{className:Y.list,children:e.jsxs(ve,{children:[!t&&e.jsx(St,{onClick:l=>Ot("rundown",l)}),e.jsx(Ve,{children:e.jsx(Qe,{})})]})}),!r&&e.jsx("div",{className:Y.side,children:e.jsx(ve,{children:e.jsx(ms,{})})})]})]})})}const sr=Object.freeze(Object.defineProperty({__proto__:null,default:$n},Symbol.toStringTag,{value:"Module"}));export{sr as R,Js as T,Ys as a,Vs as c,tr as g,xe as u};
//# sourceMappingURL=RundownExport-Dz40gwc-.js.map