UNPKG

@getontime/cli

Version:
2 lines 70.6 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Timer-BbixOGdj.js","./vendor-q6fv0YT2.js","./vendor-4xP-6xVS.css","./timer.utils-rGyI9NYa.js","./viewUtils-B8Dr4GHH.js","./playbackstate-CPQdnF-k.js","./MultiPartProgressBar-BXdLxJpy.js","./getProgress-cLuBFPjh.js","./MultiPartProgressBar-1_EFIx1M.css","./EmptyPage-Bc358YpE.js","./Empty-CJbZxh45.js","./Empty-DvR62o5B.css","./EmptyPage-Cgxd2Z6S.css","./TitleCard-Xdr7xwzU.js","./TitleCard-BlCGzVFy.css","./ViewLogo-G7EosFIr.js","./ViewLogo-Cu9JQggv.css","./ViewParamsEditor-C2-TRP6e.js","./useWindowTitle-Bpmo_HzW.js","./useWindowTitle-DrFGLRMI.css","./Select-BGGVCKqU.js","./Select-Cd08aEcf.css","./SwatchPicker-Cm5Eicvv.js","./SwatchPicker-Cw1aXCwD.css","./ViewParamsEditor-CupOV30k.css","./SuperscriptTime-CA6S2R55.js","./SuperscriptTime-Bk5IU6zG.css","./presentation.utils-Cl-L3pHN.js","./viewLoader.utils-b42scp-I.js","./validateEvent-Do8yE_DJ.js","./useCustomFields-k4piRt9n.js","./useProjectData-DdgKoYzk.js","./Timer-Jjolf5Ra.css","./Countdown-B-MuMf1C.js","./useRundown-Bn6ZPsz0.js","./useFollowComponent-B7vvPzG2.js","./useReport-DSuFnUb9.js","./offset-R98EXhWK.js","./FollowButton-C6Fvaqh0.js","./FollowButton-Dab8w6zT.css","./Countdown-BYXg70ir.css","./Backstage-CDH53Q_N.js","./SuperscriptPeriod-DsPdWN_s.js","./Backstage-BlanRQaw.css","./Studio-BjNZ4l-W.js","./Studio-BbZ7w7aA.css","./TimelinePage-Cgtl1qNp.js","./rundownUtils-CtVGQDQn.js","./TimelinePage-CcFl3uul.css","./ProjectInfo-1tw48NHZ.js","./ProjectInfo-CTQGba6F.css","./ProtectedEditor-D_A75byA.js","./ProtectRoute-BH-QvsU0.js","./ProtectRoute-Bm5sjStK.css","./Modal-BKx0PDGT.js","./Modal-D3tAPV2u.css","./OverviewWrapper-BQb2xl_N.js","./OverviewWrapper-9aebU9w0.css","./editorSettings-D2f7e1a6.js","./editorSettings-BqHbWs9b.css","./EditorUtils-DuKjlUkF.js","./EditorUtils-L4Sg72o_.css","./Tooltip-B5vsLcFu.js","./Tooltip-CKb7gU2M.css","./TimeInput-C8DQoFXv.js","./parseUserTime-YeFR8t3F.js","./TimeInput-Cu-N5DmX.css","./TimeElements-DbclWDbU.js","./TimeElements-c2rTHN98.css","./ProtectedEditor-BtSuTFlT.css","./ProtectedCuesheet-CYBIcg1c.js","./MilestoneEditor-BA0PVIQh.js","./dateConfig-D7xim1t4.js","./MilestoneEditor-BqNKKlvI.css","./DelayIndicator-D--91EO3.js","./DelayIndicator-VuYhhwTj.css","./ProtectedCuesheet-DPO7xYMb.css","./OperatorExport-X7-qi2jv.js","./OperatorExport-CA5WcIt5.css","./EditorFeatureWrapper-DwXUAV4k.js","./EditorFeatureWrapper-MP8HHRxx.css","./RundownExport-EorsanA0.js","./RundownExport-Bgtg_idR.css","./TimerControlExport-Dx3SSGNG.js","./TimerControlExport-cJRa5GUp.css","./MessageControlExport-GmOrvUik.js","./MessageControlExport-D_pNX6Vj.css"])))=>i.map(i=>d[i]); var Zt=Object.defineProperty;var Xt=(e,t,n)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Me=(e,t,n)=>Xt(e,typeof t!="symbol"?t+"":t,n);import{c as Yt,Q as en,a as tn,u as nn,i as on,b as rn,d as sn,e as b,f as _e,R as st,w as an,j as o,g as cn,r as ln,h as c,k as ne,l as un,I as dn,m as mn,n as B,o as at,p as fn,D as it,q as ct,s as lt,t as ut,v as Pe,x as oe,y as dt,z as pn,A as gn,B as hn,C as mt,E as _n,F as be,G as bn,H as yn,J as vn,K as xn,L as wn,M as Sn,N as kn,O as jn,P as de,S as Cn,T as En,U as Nn,V as In,W as Tn,X as Rn,Y as Pn,Z as Dn,_ as $n,$ as E,a0 as y,a1 as An,a2 as On,a3 as Ln,a4 as Un,a5 as Fn,a6 as Mn,a7 as zn}from"./vendor-q6fv0YT2.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]="bc804b7e-d68d-4041-b842-356a36b70bd1",e._sentryDebugIdIdentifier="sentry-dbid-bc804b7e-d68d-4041-b842-356a36b70bd1")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Y=(e=>(e.CountDown="count-down",e.CountUp="count-up",e.Clock="clock",e.None="none",e))(Y||{}),T=(e=>(e.Editor="editor",e.Cuesheet="cuesheet",e.Operator="op",e.Timer="timer",e.Backstage="backstage",e.Timeline="timeline",e.StudioClock="studio",e.Countdown="countdown",e.ProjectInfo="info",e))(T||{}),N=(e=>(e.Ping="ping",e.Pong="pong",e.ClientInit="client-init",e.ClientSet="client-set",e.ClientSetPath="client-set-path",e.ClientRename="client-rename",e.ClientRedirect="client-redirect",e.ClientList="client-list",e.Dialog="dialog",e.Log="log",e.RuntimeData="runtime-data",e.Refetch="refetch",e))(N||{}),R=(e=>(e.All="all",e.CustomFields="custom-fields",e.ProjectData="project-data",e.Report="report",e.Rundown="rundown",e.UrlPresets="url-presets",e.ViewSettings="view-settings",e.Translation="translation",e.Settings="settings",e))(R||{}),ft=(e=>(e.Info="INFO",e.Warn="WARN",e.Error="ERROR",e.Severe="SEVERE",e))(ft||{}),p=(e=>(e.Client="CLIENT",e.Playback="PLAYBACK",e.Rx="RX",e.Server="SERVER",e.Tx="TX",e.User="USER",e))(p||{}),pt=(e=>(e.Roll="roll",e.Play="play",e.Pause="pause",e.Stop="stop",e.Armed="armed",e))(pt||{}),G=(e=>(e.Absolute="absolute",e.Relative="relative",e))(G||{}),W=(e=>(e.Start="start",e.Pause="pause",e.Stop="stop",e))(W||{}),me=(e=>(e.CountUp="count-up",e.CountDown="count-down",e))(me||{}),gt=(e=>(e.None="none",e.Default="default",e.Warning="warning",e.Danger="danger",e.Overtime="overtime",e.Pending="pending",e))(gt||{});const qn={clock:0,timer:{addedTime:0,current:null,duration:null,elapsed:null,expectedFinish:null,phase:gt.None,playback:pt.Stop,secondaryTimer:null,startedAt:null},message:{timer:{text:"",visible:!1,blink:!1,blackout:!1,secondarySource:null},secondary:""},rundown:{selectedEventIndex:null,numEvents:0,plannedStart:0,plannedEnd:0,actualStart:null,actualGroupStart:null,currentDay:null},offset:{absolute:0,relative:0,mode:G.Absolute,expectedFlagStart:null,expectedGroupEnd:null,expectedRundownEnd:null},groupNow:null,eventNow:null,eventNext:null,eventFlag:null,auxtimer1:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},auxtimer2:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},auxtimer3:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},ping:1},ye={"common.expected_finish":"Expected Finish","common.minutes":"min","common.seconds":"sec","common.now":"Now","common.next":"Next","common.scheduled_start":"Scheduled start","common.scheduled_end":"Scheduled end","common.expected_start":"Expected start","common.expected_end":"Expected end","common.stage_timer":"Stage Timer","common.started_at":"Started At","common.time_now":"Time now","common.no_data":"No data","countdown.ended":"Event ended at","countdown.running":"Event running","countdown.loaded":"Event loaded","countdown.select_event":"Select an event to follow","countdown.to_start":"Time to start","countdown.waiting":"Waiting for event start","countdown.overtime":"in overtime","timeline.live":"live","timeline.done":"done","timeline.due":"due","timeline.followedby":"Followed by","project.title":"Title","project.description":"Description","project.info":"Project Info","project.url":"Project URL"},Bn="4.3.0",Pi="https://www.github.com/cpvalente/ontime",Di="https://api.github.com/repos/cpvalente/ontime/releases/latest",$i="https://www.getontime.no",Ai="https://discord.com/invite/eje3CSUEXm",Oi="https://www.reddit.com/r/ontimeapp/",Li="https://docs.getontime.no",Ui="https://docs.getontime.no/features/custom-fields/",Fi="https://github.com/sponsors/cpvalente",Mi="https://buymeacoffee.com/cpvalente",zi=Bn,qi=!1,Wn=!0,ze=window.location.hostname,Kn=ze==="localhost"||ze==="127.0.0.1";var ot;const Vn=(ot=document.querySelector("base"))==null?void 0:ot.hasAttribute("data-is-cloud"),Bi="ontouchstart"in window||navigator.maxTouchPoints>0,Hn=document.fullscreenEnabled,K=Gn(),J=ht("http",""),Qn=ht("ws","ws");function ht(e,t){const n=new URL(window.location.origin);if(e==="ws"){const s=window.location.protocol==="https:";n.protocol=s?"wss":"ws"}n.pathname=K?`${K}/${t}`:t;const r=n.toString();return r.endsWith("/")?r.slice(0,-1):r}function Gn(){var n;const t=((n=document.querySelector("base"))==null?void 0:n.getAttribute("href"))??"";return t.endsWith("/")?t.slice(0,-1):t}const Jn=Zn(),L=()=>new URLSearchParams(window.location.search).get("n")==="1";function Zn(){const e=document.cookie.split("; ").find(t=>t.startsWith("token="));if(e)try{const{scope:t}=JSON.parse(e.split("=")[1]);return t}catch{return"rw"}return"rw"}const Xn=["appinfo"],De=["appSettings"],Wi=["appVersion"],Ki=["automation"],qe=["customFields"],Yn=["project"],Vi=["projectList"],Hi=["projectRundowns"],Be=["rundown"],ee=["urlpresets"],fe=["viewSettings"];const eo=["report"],$e=["translation"],re=`${J}/data`,Ae="user",to="styles/override.css",no="translations/translations.json",oo=`${J}/${Ae}/${to}`,Qi=`${J}/${Ae}/logo`,ro=`${J}/${Ae}/${no}`,te=1e3,V=1e3*60,ge=1e3*60*60,We=864e5;function so(e,t=Y.CountDown){if(e===null)return 0;let n=0;return t===Y.CountDown&&(n=Math.ceil(e/te)),t===Y.CountUp&&(n=Math.floor(e/te)),n===0?0:n}function ao(e){return Math.floor(e/60)}function io(e){return Math.floor(e/3600)}function Gi(e){return e?Math.floor(e%V/te):0}const co=Yt("1234567890abcdef",6),lo=()=>co();function uo(e){return String(e).padStart(2,"0")}function mo(e,t){if(e==null)return(t==null?void 0:t.fallback)??"...";const n=e<0,r=Math.abs(so(e,t==null?void 0:t.direction)),s=r%60,a=ao(r)%60,i=io(r);return`${n?"-":""}${[i,a,s].map(uo).join(":")}`}function Ji(e){return e.startsWith("00:0")?e.slice(4):e.startsWith("00:")?e.slice(3):e.startsWith("-00:0")?`-${e.slice(5)}`:e.startsWith("-00:")?`-${e.slice(4)}`:e}function Zi(e){return e.endsWith(":00")?e.slice(0,-3):e}function Xi(e){return e.slice(0,-3)}function fo(e,t){if(e<0)return;const n=new Date(e),r=n.getUTCHours().toString().padStart(2,"0"),s=n.getUTCHours().toString(),a=n.getUTCMinutes().toString().padStart(2,"0"),i=n.getUTCMinutes().toString(),l=n.getUTCSeconds().toString().padStart(2,"0"),m=n.getUTCSeconds().toString(),_=n.getUTCMilliseconds().toString().padStart(3,"0"),j=(n.getUTCHours()%12||12).toString(),h=j.padStart(2,"0"),C=n.getUTCHours()>=12?"PM":"AM";return po(t,{HH:r,H:s,hh:h,h:j,mm:a,m:i,ss:l,s:m,S:_,a:C})}function po(e,t){return Object.keys(t).reduce((n,r)=>{const s=new RegExp(`\\b${r}\\b`,"g");return n.replace(s,t[r])},e)}const O={isOnlyNumbers:/^\d+$/,isIPAddress:/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/,startsWithHttp:/^https?:\/\//,startsWithSlash:/^\//,isAlphanumeric:/^[a-z0-9]+$/i,isAlphanumericWithSpace:/^[a-z0-9_ ]+$/i,isASCII:/^[ -~]+$/,isASCIIorEmpty:/^$|^[ -~]+$/,isNotEmpty:/\S/},go={isOnlyNumbers:e=>O.isOnlyNumbers.test(e),isIPAddress:e=>O.isIPAddress.test(e),startsWithHttp:e=>O.startsWithHttp.test(e),startsWithSlash:e=>O.startsWithSlash.test(e),isAlphanumeric:e=>O.isAlphanumeric.test(e),isAlphanumericWithSpace:e=>O.isAlphanumericWithSpace.test(e),isASCII:e=>O.isASCII.test(e),isASCIIorEmpty:e=>O.isASCIIorEmpty.test(e),isNotEmpty:e=>O.isNotEmpty.test(e)},ho=e=>{const t=/^#((?:[a-f\d]{1}){3,4})$/i,n=/^#((?:[a-f\d]{2}){3,4})$/i;return t.test(e)||n.test(e)};function Yi(e){return e instanceof Error?e.message:String(e)}function _o(e){const t=e.replace(/[a-zA-Z0-9]/g,n=>/[a-zA-Z]/.test(n)?String.fromCharCode((n<="Z"?90:122)>=(n=n.charCodeAt(0)+13)?n:n-26):String.fromCharCode((n<="4"?57:48)>=(n=n.charCodeAt(0)+5)?n:n-10));return e.startsWith("_")?t.replace("_",""):`_${t}`}function Ke(e){return e.startsWith("_")?_o(e):e}function _t(e,t){const{timeStart:n,dayOffset:r,delay:s}=e,{currentDay:a,totalGap:i,isLinkedToLoaded:l,offset:m,mode:_,actualStart:j,plannedStart:h}=t,C=r-a,w=Math.max(0,n+s)+C*We;let A=0;_===G.Relative&&(A=(j??0)+a*We-(h??0));const u=w+A,se=u+m;return l?se:i>m?u:se-i}function bo(e,t,n=.5){const r=n,s=1-r;return{red:Math.round(e.red*r+t.red*s),green:Math.round(e.green*r+t.green*s),blue:Math.round(e.blue*r+t.blue*s),alpha:1}}function bt(e){const t=Math.round(e.alpha*255).toString(16).padStart(2,"0"),n=e.red.toString(16).padStart(2,"0"),r=e.green.toString(16).padStart(2,"0"),s=e.blue.toString(16).padStart(2,"0");return"#"+n+r+s+t}function yt(e){if(e.startsWith("#"))return Ve(e);const t=e.toLocaleLowerCase();return t in He?Ve(He[t]):null}function Ve(e){if(!ho(e))return null;let t=e.toLocaleLowerCase();t=t.replace(/^#/,"");let n=1;if(t.length===8){const l=t.slice(6,8);n=parseInt(l,16)/255,t=t.slice(0,6)}if(t.length===4){const l=t.slice(3,4).repeat(2);n=parseInt(l,16)/255,t=t.slice(0,3)}t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const r=parseInt(t,16),s=r>>16,a=r>>8&255,i=r&255;return isNaN(s)||isNaN(a)||isNaN(i)||isNaN(n)?null:{red:s,green:a,blue:i,alpha:n}}function yo(e){return(e.red*299+e.green*587+e.blue*114)/1e3>=128}const He={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd3"},v=new en({defaultOptions:{queries:{gcTime:10*V,networkMode:"always",refetchOnWindowFocus:!1,retry:5,retryDelay:e=>e*2500},mutations:{networkMode:Vn?"online":"always"}}}),vo=[{url:"timer",label:"Timer"},{url:"backstage",label:"Backstage"},{url:"timeline",label:"Timeline"},{url:"studio",label:"Studio Clock"},{url:"countdown",label:"Countdown"},{url:"info",label:"Project Info"}],vt="h:mm:ss a",xt="HH:mm:ss",wt=(e,t)=>on(e,t),H=tn(()=>({...qn}),wt),St=e=>nn(H,e,wt);function kt(e,t){const n=H.getState();n[e]=t,H.setState({...n})}function xo(e){const t=H.getState();H.setState({...t,...e})}const f=e=>()=>St(e),jt={setIdentify:e=>d("client",e),setRedirect:e=>{d("client",e)},setClientName:e=>d("client",e)},ec=f(e=>{var t,n;return{playback:e.timer.playback,selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null,nextEventId:((n=e.eventNext)==null?void 0:n.id)??null}}),tc=f(e=>({blackout:e.message.timer.blackout,blink:e.message.timer.blink,secondarySource:e.message.timer.secondarySource})),nc=f(e=>({text:e.message.timer.text,visible:e.message.timer.visible})),oc=f(e=>({text:e.message.secondary,visible:e.message.timer.secondarySource==="secondary"})),rc=f(e=>{var t,n;return{blink:e.message.timer.blink,blackout:e.message.timer.blackout,phase:e.timer.phase,secondarySource:e.message.timer.secondarySource,showTimerMessage:e.message.timer.visible&&!!e.message.timer.text,timerType:((t=e.eventNow)==null?void 0:t.timerType)??null,countToEnd:((n=e.eventNow)==null?void 0:n.countToEnd)??!1}}),sc={timerText:e=>d("message",{timer:{text:e}}),timerVisible:e=>d("message",{timer:{visible:e}}),secondaryMessage:e=>d("message",{secondary:e}),timerBlink:e=>d("message",{timer:{blink:e}}),timerBlackout:e=>d("message",{timer:{blackout:e}}),timerSecondarySource:e=>d("message",{timer:{secondarySource:e}})},ac=f(e=>({playback:e.timer.playback,selectedEventIndex:e.rundown.selectedEventIndex,numEvents:e.rundown.numEvents,timerPhase:e.timer.phase})),ic={start:()=>d("start",void 0),pause:()=>d("pause",void 0),roll:()=>d("roll",void 0),startNext:()=>d("start","next"),previous:()=>{d("load","previous")},next:()=>{d("load","next")},stop:()=>{d("stop",void 0)},reload:()=>{d("reload",void 0)},addTime:e=>{d("addtime",e)}},cc=f(e=>({aux1:e.auxtimer1.current,aux2:e.auxtimer2.current,aux3:e.auxtimer3.current})),lc=e=>f(t=>e===1?t.auxtimer1.current:e===2?t.auxtimer2.current:t.auxtimer3.current)(),uc=e=>f(t=>e===1?{playback:t.auxtimer1.playback,direction:t.auxtimer1.direction}:e===2?{playback:t.auxtimer2.playback,direction:t.auxtimer2.direction}:{playback:t.auxtimer3.playback,direction:t.auxtimer3.direction})(),dc={start:e=>d("auxtimer",{[e]:W.Start}),pause:e=>d("auxtimer",{[e]:W.Pause}),stop:e=>d("auxtimer",{[e]:W.Stop}),setDirection:(e,t)=>d("auxtimer",{[e]:{direction:t}}),setDuration:(e,t)=>d("auxtimer",{[e]:{duration:t}})},mc=f(e=>{var t;return{selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null}}),fc=f(e=>{var t;return{currentGroupId:((t=e.groupNow)==null?void 0:t.id)??null}}),pc={loadEvent:e=>d("load",{id:e}),startEvent:e=>d("start",{id:e}),start:()=>d("start",void 0),pause:()=>d("pause",void 0)},gc=f(e=>({...e.timer})),hc=f(e=>({clock:e.clock})),_c=f(e=>{var t;return{id:((t=e.eventFlag)==null?void 0:t.id)??null,expectedStart:e.offset.expectedFlagStart}}),bc=f(e=>{var t,n;return{current:e.timer.current,duration:e.timer.duration,timeWarning:((t=e.eventNow)==null?void 0:t.timeWarning)??null,timeDanger:((n=e.eventNow)==null?void 0:n.timeDanger)??null}}),wo=f(e=>({offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,mode:e.offset.mode,currentDay:e.rundown.currentDay??0,actualStart:e.rundown.actualStart,plannedStart:e.rundown.plannedStart,clock:e.clock})),So=f(e=>({isOnline:e.ping>0})),yc=f(e=>({offsetMode:e.offset.mode})),vc=e=>d("offsetmode",e),xc=()=>St(t=>({playback:t.timer.playback})),wc=f(e=>({plannedStart:e.rundown.plannedStart,actualStart:e.rundown.actualStart,plannedEnd:e.rundown.plannedEnd})),Sc=f(e=>({expectedEnd:e.offset.expectedRundownEnd})),kc=f(e=>({numEvents:e.rundown.numEvents,selectedEventIndex:e.rundown.selectedEventIndex})),jc=f(e=>({offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,playback:e.timer.playback})),Cc=f(e=>{var t;return{clock:e.clock,mode:e.offset.mode,groupExpectedEnd:e.offset.expectedGroupEnd,actualGroupStart:e.rundown.actualGroupStart??0,currentDay:((t=e.eventNow)==null?void 0:t.dayOffset)??0,playback:e.timer.playback}}),Ec=f(e=>{var t;return{clock:e.clock,mode:e.offset.mode,actualStart:e.rundown.actualStart??0,plannedStart:e.rundown.plannedStart??0,currentDay:((t=e.eventNow)==null?void 0:t.dayOffset)??0,playback:e.timer.playback}}),Nc=f(e=>{var t,n;return{eventNext:e.eventNext,eventNow:e.eventNow,message:e.message,time:e.timer,clock:e.clock,timerTypeNow:((t=e.eventNow)==null?void 0:t.timerType)??Y.CountDown,countToEndNow:((n=e.eventNow)==null?void 0:n.countToEnd)??!1,auxTimer:{aux1:e.auxtimer1.current,aux2:e.auxtimer2.current,aux3:e.auxtimer3.current}}}),Ic=f(e=>({playback:e.timer.playback,current:e.timer.current,clock:e.clock})),Tc=f(e=>{var t;return{eventNext:e.eventNext,eventNow:e.eventNow,rundown:e.rundown,selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null,time:e.timer}}),Rc=f(e=>({clock:e.clock,playback:e.timer.playback})),Pc=f(e=>({eventNext:e.eventNext,eventNow:e.eventNow,message:e.message,time:e.timer,offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,rundown:e.rundown,expectedRundownEnd:e.offset.expectedRundownEnd}));function ko(){const e=new Date;let t=e.getHours()*ge;return t+=e.getMinutes()*V,t+=e.getSeconds()*te,t+=e.getMilliseconds(),t}function jo(){return new URL(document.location.href).searchParams.get("timeformat")}function Co(){const e=v.getQueryData(De);return(e==null?void 0:e.timeFormat)??"24"}function Dc(e,t=vt,n=xt){return e==="12"?t:n}function Eo(e,t){const n=jo();return n||(Co()==="12"?e:t)}const $c=(e,t,n=Eo)=>{if(e===null)return"...";const r=n((t==null?void 0:t.format12)??vt,(t==null?void 0:t.format24)??xt),s=fo(Math.abs(e),r);return`${e<0?"-":""}${s}`};function Ac(e,t=!0){if(e<=0)return"0m";const n=Math.floor(e/ge),r=Math.floor(e%ge/V);let s="";if(n>0&&(s+=`${n}h`),r>0&&(s+=`${r}m`),!t){const i=e%V/te,l=Math.min(59,Math.ceil(i));l>0&&(s+=`${l}s`)}return s}function Oc(e,t){const{offset:n,currentDay:r,mode:s,actualStart:a,plannedStart:i,clock:l}=wo();return e===null?0:_t({...e},{...t,currentDay:r,offset:n,mode:s,actualStart:a,plannedStart:i})-l}function Lc(e,t){if(e===null)return{expectedStart:0,timeToStart:0,expectedEnd:0,plannedEnd:0};const n=_t({timeStart:e.timeStart,delay:e.delay,dayOffset:e.dayOffset},{totalGap:e.totalGap,isLinkedToLoaded:e.isLinkedToLoaded,...t}),r=e.timeStart+e.duration+e.delay;return{expectedStart:n,timeToStart:n-t.clock,expectedEnd:e.countToEnd?Math.max(n+e.duration,r):n+e.duration,plannedEnd:r}}const Oe=rn(()=>({logs:[]})),No=()=>sn(Oe),Ct=e=>Oe.setState(t=>({logs:[e,...t.logs]})),Io=()=>Oe.setState({logs:[]});function To(e){var t,n;if(b.isAxiosError(e)){const r=((t=e.response)==null?void 0:t.statusText)??"";let s=((n=e.response)==null?void 0:n.data)??"";return typeof s=="object"&&("message"in s?s=JSON.stringify(s.message):s=JSON.stringify(s)),`${r}: ${s}`}else return e instanceof Error?e.message:typeof e!="string"?JSON.stringify(e):e}function Uc(e){return e instanceof Error?e.message:typeof e!="string"?JSON.stringify(e):e}function Fc(e,t){const n=`${e}: ${To(t)}`;Ct({id:lo(),origin:"SERVER",time:mo(ko()),level:ft.Error,text:n})}async function Qe(){await v.invalidateQueries()}function Mc(e,t){return new Blob([e],{type:t})}function zc(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),document.body.appendChild(r),r.click(),URL.revokeObjectURL(n)}function Ro(e,t){const n=localStorage.getItem(e);return n?n==="true":(localStorage.setItem(e,String(t)),t)}function Po(e){return K?`${K}-${e}`:e}const Et=Po("client-name");function Do(e){localStorage.setItem(Et,e)}const S=_e(e=>({name:localStorage.getItem(Et)??void 0,setName:t=>e(()=>(Do(t),{name:t})),id:"",setId:t=>e({id:t}),redirect:"",setRedirect:t=>e({redirect:t}),clients:{},setClients:t=>e({clients:t})}));function $o(){return S.getState().name}function Ge(e){S.getState().setName(e)}function Ao(e){S.getState().setId(e)}function Je(){return S.getState().id}function Oo(e){S.getState().setRedirect(e)}function Lo(e){return S.getState().setClients(e)}const Uo=_e(e=>({showDialog:null,clearDialog:()=>e({showDialog:null}),setDialog:t=>e({showDialog:t})}));function Nt(e){Uo.getState().setDialog(e)}let P=null,Ze=null;const Fo=1e3;let It=!1,pe=0;const Tt=()=>{P=new WebSocket(Qn);const e=$o();P.onopen=()=>{clearTimeout(Ze),It=!0,pe=0,d(N.ClientSet,{type:"ontime",origin:window.location.origin,path:window.location.pathname+window.location.search,name:e}),Qe(),Xe(!0)},P.onclose=()=>{console.warn("WebSocket disconnected"),Ze=setTimeout(()=>{pe>2&&Xe(!1),console.warn("WebSocket: attempting reconnect"),P&&P.readyState===WebSocket.CLOSED&&(pe+=1,Tt())},Fo)},P.onerror=t=>{console.error("WebSocket error:",t)},P.onmessage=async t=>{try{const n=JSON.parse(t.data),{tag:r,payload:s}=n;if(!r)return;switch(r){case N.Pong:{const a=(new Date().getTime()-new Date(s).getTime())*.5;kt("ping",a);break}case N.ClientInit:{Ao(s.clientId),e||Ge(s.clientName);break}case N.ClientRename:{const a=Je();s.target===a&&Ge(s.name);break}case N.ClientRedirect:{const a=Je();s.target===a&&Oo(s.path);break}case N.ClientList:{Lo(s);break}case N.Dialog:{s.dialog==="welcome"&&Nt("welcome");break}case N.Log:{Ct(s);break}case N.RuntimeData:{xo(s);break}case N.Refetch:{const{target:a,revision:i}=s;switch(a){case R.All:Qe();break;case R.CustomFields:v.invalidateQueries({queryKey:qe});break;case R.ProjectData:v.invalidateQueries({queryKey:Yn});break;case R.Report:v.invalidateQueries({queryKey:eo});break;case R.Rundown:if(i===v.getQueryData(Be).revision)break;v.invalidateQueries({queryKey:Be}),v.invalidateQueries({queryKey:qe});break;case R.UrlPresets:v.invalidateQueries({queryKey:ee});break;case R.ViewSettings:v.invalidateQueries({queryKey:fe});break;case R.Translation:v.invalidateQueries({queryKey:$e});break;case R.Settings:v.invalidateQueries({queryKey:De});break;default:break}break}default:break}}catch{}}};function d(e,t){P&&P.readyState===WebSocket.OPEN&&P.send(JSON.stringify({tag:e,payload:t}))}function Xe(e){kt("ping",e?1:-1)}const Mo="_errorContainer_35w9k_17",zo="_error_35w9k_17",qo="_report_35w9k_30",ae={errorContainer:Mo,error:zo,report:qo};class Ye extends st.Component{constructor(n){super(n);Me(this,"reportContent","");this.state={error:null,errorInfo:null}}static getDerivedStateFromError(n){return{errorMessage:n.toString()}}componentDidCatch(n,r){this.setState({error:n,errorInfo:r}),this.reportContent=`${n} ${r.componentStack}`;const s=H.getState();s.ping<0||an(a=>{a.setExtras({error:n,store:s,hasSocket:{hasConnected:It,reconnectAttempts:pe}});const i=cn(n);this.setState({eventId:i,info:r})})}render(){return this.state.errorMessage?o.jsx("div",{className:ae.errorContainer,"data-testid":"error-container",children:o.jsxs("div",{children:[o.jsx("p",{className:ae.error,children:": /"}),o.jsx("p",{children:"Something went wrong."}),o.jsx("a",{className:ae.report,href:`mailto:mail@getontime.no?subject=Error%20Report&body=${encodeURIComponent(this.reportContent)}`,children:"Report error"}),o.jsx("div",{role:"button",className:ae.report,onClick:()=>{var n;((n=window==null?void 0:window.process)==null?void 0:n.type)==="renderer"?window.ipcRenderer.send("reload"):window.location.reload()},children:"Reload interface"})]})}):this.props.children}}const Bo="_overlay_9onby_17",Wo="_name_9onby_35",Ko="_message_9onby_43",Se={overlay:Bo,name:Wo,message:Ko};function Vo(){var s;const e=S(a=>a.clients),t=S(a=>a.id);if(!((s=e[t])==null?void 0:s.identify))return null;const r=document.getElementById("identify-portal");return r?ln.createPortal(o.jsx(Ho,{}),r):null}function Ho(){var l;const e=S(m=>m.clients),t=S(m=>m.id),n=S(m=>m.name),r=c.useRef(null),{setIdentify:s}=jt,a=(l=e[t])==null?void 0:l.identify,i=c.useCallback(()=>{r.current&&clearTimeout(r.current),s({target:t,identify:!1})},[t,s]);return c.useEffect(()=>(a&&(r.current=setTimeout(i,V)),()=>{r.current&&clearTimeout(r.current)}),[a,t,s,i]),o.jsxs("div",{className:Se.overlay,"data-testid":"identify-overlay",onClick:i,children:[o.jsx("div",{className:Se.name,children:n}),o.jsx("div",{className:Se.message,children:"Click to close"})]})}const Le=`${re}/settings`;async function Qo(){return(await b.get(Le)).data}async function qc(e){return b.post(Le,e)}async function Bc(e){b.post(`${Le}/welcomedialog`,{show:e})}const Go={version:"4.0.0",serverPort:4001,editorKey:null,operatorKey:null,timeFormat:"24",language:"en"};function Rt(){const{data:e,status:t,isFetching:n,isError:r,refetch:s}=ne({queryKey:De,queryFn:Qo,placeholderData:(a,i)=>a,select:a=>{const i={...a};return a.editorKey&&(i.editorKey=Ke(a.editorKey)),a.operatorKey&&(i.operatorKey=Ke(a.operatorKey)),i}});return{data:e??Go,status:t,isFetching:n,isError:r,refetch:s}}const Jo=c.createContext({editorAuth:!1,operatorAuth:!1,validate:()=>!1}),ie={editor:"ontime-editor-entry",operator:"ontime-operator-entry"},Zo=({children:e})=>{const{status:t,data:n}=Rt(),[r,s]=c.useState(!0),[a,i]=c.useState(!0);c.useEffect(()=>{if(t==="pending")return;const m=sessionStorage.getItem(ie.editor);m&&m===n.editorKey?s(!0):s(n.editorKey==null||n.editorKey==="");const _=sessionStorage.getItem(ie.operator);_&&_===n.operatorKey?i(!0):i(n.operatorKey==null||n.operatorKey==="")},[n,t]);const l=c.useCallback((m,_)=>{function j(h,C){return C==null||C===""||h===C}if(_==="editor"){const h=j(m,n.editorKey);return h&&sessionStorage.setItem(ie.editor,m),s(h),h}else if(_==="operator"){const h=j(m,n.operatorKey);return h&&sessionStorage.setItem(ie.operator,m),i(h),h}return!1},[n]);return o.jsx(Jo.Provider,{value:{editorAuth:r,operatorAuth:a,validate:l},children:e})},Pt=c.createContext(void 0),Dt=typeof window<"u"&&"wakeLock"in navigator;function Xo(){const{keepAwake:e}=$t(),t=c.useRef(null);c.useEffect(()=>{const n=()=>{t.current&&t.current.release().finally(()=>{t.current=null})},r=()=>{const a=t.current;if(!a||a.released){if(t.current=null,!Dt)return;navigator.wakeLock.request("screen").then(i=>{t.current=i}).catch(console.error)}},s=new AbortController;return e?(r(),document.addEventListener("visibilitychange",()=>{t.current!==null&&document.visibilityState==="visible"&&r()},{signal:s.signal})):n(),()=>{s.abort(),n()}},[e])}const he="keep-awake";function Yo(e,t){return(t==null?void 0:t.has(he))||e.has(he)}function $t(){const[e,t]=un(),n=c.use(Pt),r=c.useMemo(()=>{const a=n?new URLSearchParams(n.search):void 0;return Yo(e,a)},[n,e]),s=c.useCallback(()=>{t(a=>(r?a.delete(he):a.set(he,"1"),a))},[r,t]);return{keepAwake:r,toggleKeepAwake:s}}function er(){return Xo(),null}const ve=`${re}/assets`;async function Wc(){return(await b.get(`${ve}/css`)).data}async function Kc(e){await b.post(`${ve}/css`,{css:e})}async function Vc(){return(await b.post(`${ve}/css/restore`)).data}async function tr(){return(await b.get(ro)).data}async function nr(e){await b.post(`${ve}/translations`,{translation:e}),await v.invalidateQueries({queryKey:$e})}const Ue=12e4,Hc={cuesheetMode:"cuesheet-mode",editorMode:"editor-mode"};var or=(e=>(e.Run="run",e.Edit="edit",e))(or||{});function rr(){const{data:e,status:t,refetch:n}=ne({queryKey:$e,queryFn:tr,placeholderData:(r,s)=>r,refetchInterval:Ue});return{data:e??ye,status:t,refetch:n}}const sr={"common.expected_finish":"Erwartetes Ende","common.minutes":"min","common.seconds":"sek","common.now":"Jetzt","common.next":"Nächste","common.scheduled_start":"Geplanter beginn","common.scheduled_end":"Geplantes ende","common.expected_start":"Erwartetes beginn","common.expected_end":"Erwartetes ende","common.stage_timer":"Bühnen-Timer","common.started_at":"Gestartet am","common.time_now":"Aktuelle Zeit","common.no_data":"Keine Daten","countdown.ended":"Veranstaltung endete um","countdown.running":"Veranstaltung läuft","countdown.loaded":"Veranstaltung geladen","countdown.select_event":"Wählen Sie eine Veranstaltung aus, um sie zu verfolgen","countdown.to_start":"Zeit bis zum Start","countdown.waiting":"Warten auf den Veranstaltungsbeginn","countdown.overtime":"überfällig","timeline.live":"live","timeline.done":"Beendet","timeline.due":"fällig","timeline.followedby":"Gefolgt von","project.title":"Titel","project.description":"Beschreibung","project.info":"Projektinfo","project.url":"Projekt-URL"},ar={"common.expected_finish":"Finalización esperada","common.minutes":"min","common.seconds":"sec","common.now":"Ahora","common.next":"Siguiente","common.scheduled_start":"Inicio programado","common.scheduled_end":"Fin programado","common.expected_start":"Inicio previsto","common.expected_end":"Fin previsto","common.stage_timer":"Temporizador de presentador","common.started_at":"Iniciado en","common.time_now":"Ahora","common.no_data":"Sin datos","countdown.ended":"Evento finalizado a las","countdown.running":"Evento en curso","countdown.loaded":"Evento está cargado","countdown.select_event":"Seleccionar un evento para seguir","countdown.to_start":"Tiempo para comenzar","countdown.waiting":"Esperando el inicio del evento","countdown.overtime":"en tiempo extra","timeline.live":"live","timeline.done":"Terminado","timeline.due":"pendiente","timeline.followedby":"Seguido por","project.title":"Título","project.description":"Descripción","project.info":"Información del proyecto","project.url":"URL del proyecto"},ir={"common.expected_finish":"Fin estimée à","common.minutes":"min","common.seconds":"sec","common.now":"Maintenant","common.next":"A suivre","common.scheduled_start":"Début prévu","common.scheduled_end":"Fin prévue","common.expected_start":"Début projeté","common.expected_end":"Fin projetée","common.stage_timer":"Minuteur de scène","common.started_at":"Commencé à","common.time_now":"Heure","common.no_data":"Aucune donnée","countdown.ended":"Évènement terminé à","countdown.running":"Évènement en cours","countdown.loaded":"Évènement chargé","countdown.select_event":"Sélectionnez un évènement à suivre","countdown.to_start":"Évènement commence dans","countdown.waiting":"En attente du début de l’évènement","countdown.overtime":"en dépassement","timeline.live":"live","timeline.done":"Terminé","timeline.due":"dû","timeline.followedby":"Suivi de","project.title":"Titre","project.description":"Description","project.info":"Informations du projet","project.url":"URL du projet"},cr={"common.expected_finish":"Fine Prevista","common.minutes":"min","common.seconds":"sec","common.now":"Adesso","common.next":"Prossimo","common.scheduled_start":"Inizio programmato","common.scheduled_end":"Fine programmata","common.expected_start":"Inizio previsto","common.expected_end":"Fine prevista","common.stage_timer":"Orologio Palco","common.started_at":"Iniziato Alle","common.time_now":"Ora attuale","common.no_data":"Nessun dato disponibile","countdown.ended":"Evento finito alle","countdown.running":"Evento in corso","countdown.loaded":"Evento caricato","countdown.select_event":"Seleziona un evento da seguire","countdown.to_start":"Tempo alla partenza","countdown.waiting":"In attesa dell'inizio dell'evento","countdown.overtime":"in ritardo","timeline.live":"live","timeline.done":"Terminato","timeline.due":"previsto","timeline.followedby":"Seguito da","project.title":"Titolo","project.description":"Descrizione","project.info":"Informazioni sul progetto","project.url":"URL del progetto"},lr={"common.expected_finish":"Término esperado","common.minutes":"min","common.seconds":"sec","common.now":"Agora","common.next":"Próximo","common.scheduled_start":"Início programado","common.scheduled_end":"Fim programado","common.expected_start":"Início previsto","common.expected_end":"Fim previsto","common.stage_timer":"Temporizador do presentador","common.started_at":"Iniciado em","common.time_now":"Hora atual","common.no_data":"Sem dados","countdown.ended":"Evento encerrado às","countdown.running":"Evento em andamento","countdown.loaded":"Evento carregado","countdown.select_event":"Selecione um evento para acompanhar","countdown.to_start":"Tempo para iniciar","countdown.waiting":"Aguardando o início do evento","countdown.overtime":"em tempo extra","timeline.live":"live","timeline.done":"Concluído","timeline.due":"Pendente","timeline.followedby":"Seguido por","project.title":"Título","project.description":"Descrição","project.info":"Informações do projeto","project.url":"URL do projeto"},ke={en:ye,es:ar,fr:ir,it:cr,de:sr,pt:lr},At=c.createContext({userTranslation:ye,getLocalizedString:()=>"",postUserTranslation:async()=>{}}),ur=({children:e})=>{const{data:t}=Rt(),{data:n}=rr(),r=c.useCallback((a,i=(t==null?void 0:t.language)||"en")=>{if(i in ke){if(a in ke[i])return ke[i][a]}else if(i==="custom")return n[a];return ye[a]},[t==null?void 0:t.language,n]),s={userTranslation:n,getLocalizedString:r,postUserTranslation:nr};return o.jsx(At.Provider,{value:s,children:e})},Qc=()=>{const{userTranslation:e,getLocalizedString:t,postUserTranslation:n}=c.useContext(At);return{userTranslation:e,getLocalizedString:t,postUserTranslation:n}},dr=_e(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(t=>({isOpen:!t.isOpen}))}));function mr(e,t){let n;return(...r)=>{n||(n=setTimeout(()=>{n=null,e(...r)},t))}}const fr=3e3,Ot=(e=!1)=>{const[t,n]=c.useState(e);return c.useEffect(()=>{let r=null;const a=mr(()=>{n(!0),r&&clearTimeout(r),r=setTimeout(()=>n(!1),fr)},1e3);return a(),document.addEventListener("mousemove",a),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("keydown",a),r&&clearTimeout(r)}},[]),t},pr={red:26,green:26,blue:26},Gc=e=>{if(!e)return{backgroundColor:"#1a1a1a",color:"#fffffa"};const t=yt(e);if(!t)return{backgroundColor:"#1a1a1a",color:"#fffffa"};const n=bo(pr,t,1-t.alpha),r=yo(n)?"black":"#fffffa";return{backgroundColor:bt(n),color:r}},k=e=>e.filter(Boolean).join(" "),Jc="–",Zc="––:––:––",Xc="––:––";function Yc(e,t){const n=yt(e);return n?(n.alpha=t,bt(n)):e}const gr="_blink_bz8cs_1",hr="_fourtyfive_bz8cs_13",_r="_mirror_bz8cs_17",br="_subtle_bz8cs_21",yr="_primary_bz8cs_51",vr="_destructive_bz8cs_66",xr="_ghosted_bz8cs_92",wr="_baseIconButton_bz8cs_140",Sr="_small_bz8cs_157",kr="_medium_bz8cs_162",jr="_large_bz8cs_167",Cr="_xlarge_bz8cs_172",je={blink:gr,fourtyfive:hr,mirror:_r,subtle:br,"subtle-white":"_subtle-white_bz8cs_35",primary:yr,destructive:vr,"subtle-destructive":"_subtle-destructive_bz8cs_79",ghosted:xr,"ghosted-white":"_ghosted-white_bz8cs_108","ghosted-destructive":"_ghosted-destructive_bz8cs_124",baseIconButton:wr,small:Sr,medium:kr,large:jr,xlarge:Cr},Q=c.forwardRef(({className:e,children:t,variant:n="subtle",size:r="medium",...s},a)=>o.jsx("button",{ref:a,className:k([je.baseIconButton,je[n],je[r],e]),type:"button",...s,children:t}));Q.displayName="IconButton";const Er="_fadeable_1nsno_17",Nr="_hidden_1nsno_22",Ir="_buttonContainer_1nsno_27",Ce={fadeable:Er,hidden:Nr,buttonContainer:Ir};function Tr({toggleMenu:e,toggleSettings:t}){const n=Ot(!0);return o.jsxs("div",{id:"fadeable-navigation",className:k([Ce.fadeable,Ce.buttonContainer,!n&&Ce.hidden]),children:[e&&o.jsx(Q,{variant:"subtle-white",size:"xlarge",onClick:e,"aria-label":"toggle menu","data-testid":"navigation__toggle-menu",children:o.jsx(dn,{})}),t&&o.jsx(Q,{variant:"subtle-white",size:"xlarge",onClick:t,"aria-label":"toggle settings","data-testid":"navigation__toggle-settings",children:o.jsx(mn,{})})]})}const Rr="_fadeable_1y6b8_17",Pr="_hidden_1y6b8_22",Dr="_lockIcon_1y6b8_27",Ee={fadeable:Rr,hidden:Pr,lockIcon:Dr};function $r(){const e=Ot();return o.jsx("div",{className:k([Ee.fadeable,Ee.lockIcon,!e&&Ee.hidden]),children:o.jsx(B,{})})}function Ar(){const{width:e}=at();return c.useMemo(()=>e<1300,[e])}const Or=_e()(e=>({mirror:Ro("view-mirror",!1),toggleMirror:t=>e(n=>{const r=typeof t>"u"?!n.mirror:t;return localStorage.setItem("view-mirror",String(r)),{mirror:r}})})),Lr="_blink_1erat_1",Ur="_fourtyfive_1erat_13",Fr="_mirror_1erat_17",Mr="_subtle_1erat_21",zr="_primary_1erat_51",qr="_destructive_1erat_66",Br="_ghosted_1erat_92",Wr="_baseButton_1erat_140",Kr="_loading_1erat_161",Vr="_content_1erat_164",Hr="_loadingOverlay_1erat_174",Qr="_spinner_1erat_180",Gr="_spin_1erat_180",Jr="_small_1erat_190",Zr="_medium_1erat_195",Xr="_large_1erat_200",Yr="_xlarge_1erat_205",es="_fluid_1erat_210",U={blink:Lr,fourtyfive:Ur,mirror:Fr,subtle:Mr,"subtle-white":"_subtle-white_1erat_35",primary:zr,destructive:qr,"subtle-destructive":"_subtle-destructive_1erat_79",ghosted:Br,"ghosted-white":"_ghosted-white_1erat_108","ghosted-destructive":"_ghosted-destructive_1erat_124",baseButton:Wr,loading:Kr,content:Vr,loadingOverlay:Hr,spinner:Qr,spin:Gr,small:Jr,medium:Zr,large:Xr,xlarge:Yr,fluid:es},I=c.forwardRef(({className:e,children:t,variant:n="subtle",size:r="medium",fluid:s,loading:a,...i},l)=>o.jsxs("button",{ref:l,className:k([U.baseButton,U[n],U[r],s&&U.fluid,a&&U.loading,e]),type:"button",disabled:a||i.disabled,...i,children:[o.jsx("span",{className:U.content,children:t}),a&&o.jsx("div",{className:U.loadingOverlay,children:o.jsx(fn,{className:U.spinner})})]}));I.displayName="Button";const ts="_dialog_qv1xq_17",ns="_backdrop_qv1xq_32",os="_title_qv1xq_42",rs="_body_qv1xq_51",ss="_footer_qv1xq_59",Z={dialog:ts,backdrop:ns,title:os,body:rs,footer:ss};function as({isOpen:e,title:t,showCloseButton:n,showBackdrop:r,bodyElements:s,footerElements:a,onClose:i}){return o.jsx(it,{open:e,onOpenChange:l=>{l||i()},children:o.jsxs(ct,{children:[r&&o.jsx(lt,{className:Z.backdrop}),o.jsxs(ut,{className:Z.dialog,children:[o.jsxs("div",{className:Z.title,children:[t,n&&o.jsx(Q,{variant:"subtle-white",onClick:i,children:o.jsx(Pe,{})})]}),o.jsx("div",{className:Z.body,children:s}),o.jsx("div",{className:Z.footer,children:a})]})]})})}const is="_blink_1r8lg_1",cs="_fourtyfive_1r8lg_13",ls="_input_1r8lg_17",us="_subtle_1r8lg_47",ds="_ghosted_1r8lg_51",ms="_medium_1r8lg_56",fs="_large_1r8lg_60",ps="_fluid_1r8lg_64",ce={blink:is,fourtyfive:cs,input:ls,subtle:us,ghosted:ds,medium:ms,large:fs,fluid:ps},gs=c.forwardRef(function({className:t,variant:n="subtle",height:r="medium",fluid:s,...a},i){return o.jsx("input",{ref:i,type:"text",autoCorrect:"off",autoComplete:"off",spellCheck:"false",className:k([ce.input,ce[n],ce[r],s&&ce.fluid,t]),...a})});function hs({id:e,name:t="",isOpen:n,onClose:r}){const[s,a]=c.useState(t),{setClientName:i}=jt,l=()=>{s!==t&&s!==""&&i({target:e,rename:s}),r()},m=s!==t&&s!=="";return o.jsx(as,{isOpen:n,title:`Rename Client: ${t}`,showCloseButton:!0,onClose:r,bodyElements:o.jsx(gs,{height:"large",placeholder:"New name",value:s,onChange:_=>a(_.target.value)}),footerElements:o.jsxs(o.Fragment,{children:[o.jsx(I,{variant:"subtle",size:"large",onClick:r,children:"Cancel"}),o.jsx(I,{variant:"primary",size:"large",onClick:l,disabled:!m,children:"Submit"})]})})}var rt;const Te=((rt=window.process)==null?void 0:rt.type)==="renderer",q=Te?window.require("electron").ipcRenderer:null;function Lt(){const e=c.useCallback((t,n)=>{Te&&q&&q.send(t,n)},[]);return{isElectron:Te,sendToElectron:e}}function el(){const e=oe(),{isElectron:t}=Lt();c.useEffect(()=>(t&&(q.on("request-editor-location",(n,r)=>{e(r,{relative:"route"})}),q.on("dialog",(n,r)=>{r==="welcome"&&Nt("welcome")})),()=>{q==null||q.removeAllListeners()}),[t,e])}function Ut(e){var t;((t=window.process)==null?void 0:t.type)==="renderer"?window.ipcRenderer.send("send-to-link",e):window.open(e)}function _s(e,t,n=J,r=K){t==null||t.preventDefault();const s=new URL(n);s.pathname=r?`${r}/${e}`:e,Ut(s.toString())}function bs(e,t,n=J,r=K){const s=new URL(n);return s.hostname=e,t&&(s.pathname=r?`${r}/${t}`:t),s.toString()}function ys(e){return e.key==="Enter"}function vs(e){return e.key==="Escape"}function tl(e,t){vs(e)&&(e.preventDefault(),e.stopPropagation(),t==null||t())}const xs="_link_pmy0j_17",ws="_current_pmy0j_41",et={link:xs,current:ws};function $({active:e,className:t,children:n,onClick:r}){return o.jsx("div",{className:k([et.link,e&&et.current,t]),tabIndex:0,role:"button",onClick:r,onKeyDown:s=>{ys(s)&&r()},children:n})}const Ss="_linkIcon_1wpyp_17",ks={linkIcon:Ss};function Ne({current:e,to:t,postAction:n,children:r}){const{isElectron:s}=Lt(),a=oe();return s?o.jsxs($,{active:e,onClick:()=>{_s(t),n==null||n()},children:[r,o.jsx(dt,{className:ks.linkIcon})]}):o.jsx($,{active:e,onClick:()=>{a(`/${t}`),n==null||n()},children:r})}function js(){const{width:e}=at(),t=pn();return c.useMemo(()=>(t==="ios"||t==="android")&&e<1300,[e,t])}function Cs(){const e=oe();return js()?o.jsxs(o.Fragment,{children:[o.jsxs($,{active:location.pathname==="/timercontrol",onClick:()=>e("/timercontrol"),children:[o.jsx(B,{}),"Timer Controls"]}),o.jsxs($,{active:location.pathname==="/messagecontrol",onClick:()=>e("/messagecontrol"),children:[o.jsx(B,{}),"Message Controls"]}),o.jsxs($,{active:location.pathname==="/rundown",onClick:()=>e("/rundown"),children:[o.jsx(B,{}),"Rundown"]})]}):o.jsxs($,{active:location.pathname==="/editor",onClick:()=>e("/editor"),children:[o.jsx(B,{}),"Editor"]})}const Ft=`${re}/session`;async function Es(){return(await b.get(`${Ft}/info`)).data}async function nl(e){return(await b.post(`${Ft}/url`,e)).data.url}const Ns={networkInterfaces:[],version:"4.0.0",serverPort:4001,publicDir:""};function Is(){const{data:e,status:t,isError:n,refetch:r,isFetching:s}=ne({queryKey:Xn,queryFn:Es,placeholderData:(a,i)=>a,retry:5,retryDelay:a=>a*2500,refetchInterval:Ue,networkMode:"always"});return{data:e??Ns,status:t,isError:n,refetch:r,isFetching:s}}async function Mt(e){var t;await((t=navigator.clipboard)==null?void 0:t.writeText(e))}async function ol(e){try{await Mt(e)}catch{}}const Ts="_blink_1pu1m_1",Rs="_fourtyfive_1pu1m_13",Ps="_copytag_1pu1m_17",Ds="_action_1pu1m_22",$s="_label_1pu1m_27",As="_small_1pu1m_38",Os="_medium_1pu1m_43",Ls="_large_1pu1m_48",Us="_copy_1pu1m_17",X={blink:Ts,fourtyfive:Rs,copytag:Ps,action:Ds,label:$s,small:As,medium:Os,large:Ls,copy:Us};function Fs({copyValue:e,disabled:t,size:n="medium",children:r,onClick:s}){const[a,i]=c.useState(!1),l=c.useRef(null),m=async()=>{try{await Mt(e),i(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>i(!1),2e3)}catch{}};return o.jsxs("div",{className:X.copytag,children:[s!==void 0?o.jsx(I,{className:X.action,size:n,onClick:s,disabled:t,children:r}):o.jsx("div",{className:k([X.label,X[n]]),children:r}),o.jsx(Q,{className:X.copy,variant:"primary",size:n,onClick:m,disabled:t,children:a?o.jsx(gn,{}):o.jsx(hn,{})})]})}const Ms="_header_elv9y_17",zs="_interfaces_elv9y_23",qs="_interfaceCopy_elv9y_30",Bs="_goIcon_elv9y_35",le={header:Ms,interfaces:zs,interfaceCopy:qs,goIcon:Bs};function Ws({currentLocation:e}){var n;const{data:t}=Is();return t.networkInterfaces.length<2?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:le.header,children:"Accessible on external networks"}),o.jsx("div",{className:le.interfaces,children:(n=t==null?void 0:t.networkInterfaces)==null?void 0:n.map(r=>{if(r.name==="localhost")return null;const s=bs(r.address,e);return o.jsx(Fs,{copyValue:s,onClick:()=>Ut(s),size:"small",children:o.jsxs("span",{className:le.interfaceCopy,children:[r.address," ",o.jsx(dt,{className:le.goIcon})]})},r.name)})})]})}const Ks="_separator_1f3q6_17",Vs="_backdrop_1f3q6_21",Hs="_drawer_1f3q6_31",Qs="_header_1f3q6_60",Gs="_body_1f3q6_70",Js="_note_1f3q6_75",F={separator:Ks,backdrop:Vs,drawer:Hs,header:Qs,body:Gs,note:Js},Zs=c.memo(Xs);function Xs({isOpen:e,onClose:t}){const n=S(w=>w.id),r=S(w=>w.name),s=Ar(),[a,i]=mt(!1),{fullscreen:l,toggle:m}=_n(),{mirror:_,toggleMirror:j}=Or(),{keepAwake:h,toggleKeepAwake:C}=$t(),x=be();return o.jsx(it,{open:e,onOpenChange:w=>{w||t()},children:o.jsxs(ct,{children:[o.jsx(lt,{className:F.backdrop}),o.jsx(hs,{id:n,name:r,isOpen:a,onClose:i.close}),o.jsxs(ut,{className:F.drawer,children:[o.jsxs("div",{className:F.header,children:[o.jsx(bn,{children:"Ontime"}),o.jsx(Q,{variant:"subtle-white",size:"large",onClick:t,children:o.jsx(Pe,{})})]}),o.jsxs("div",{className:F.body,children:[Hn&&o.jsxs($,{active:l,onClick:m,children:["Toggle Fullscreen",l?o.jsx(yn,{}):o.jsx(vn,{})]}),o.jsxs($,{active:_,onClick:()=>j(),children:["Flip Screen",o.jsx(xn,{}),_&&o.jsx("span",{className:F.note,children:"Active"})]}),Dt&&o.jsxs($,{active:h,onClick:C,children:["Keep Awake",o.jsx(wn,{}),h&&o.jsx("span",{className:F.note,children:"Active"})]}),o.jsx($,{onClick:i.open,children:"Rename Client"}),o.jsx("hr",{className:F.separator}),o.jsx(Cs,{}),o.jsxs(Ne,{to:"cuesheet",current:x.pathname==="/cuesheet",postAction:s?t:void 0,children:[o.jsx(B,{}),"Cuesheet"]}),o.jsxs(Ne,{to:"op",current:x.pathname==="/op",postAction:s?t:void 0,children:[o.jsx(B,{}),"Operator"]}),o.jsx("hr",{className:F.separator}),vo.map(w=>o.jsx(Ne,{to:w.url,current:x.pathname===`/${w.url}`,postAction:s?t:void 0,children:w.label},w.url))]}),Kn&&o.jsx("div",{children:o.jsx(Ws,{currentLocation:x.pathname})})]})]})})}const D=c.memo(Ys);function Ys({isNavigationLocked:e,suppressSettings:t}){const[n,r]=mt(),{open:s}=dr();return Sn([["Space",()=>{e||r.toggle()},{preventDefault:!0}],["mod + ,",()=>{t||s()},{preventDefault:!0}]]),e&&t?o.jsx($r,{}):o.jsxs(o.Fragment,{children:[o.jsx(Tr,{toggleMenu:e?void 0:r.toggle,toggleSettings:t?void 0:s}),!e&&o.jsx(Zs,{isOpen:n,onClose:r.close})]})}const ea=()=>{const e=oe(),{pathname:t,search:n}=be(),{redirect:r,setRedirect:s}=S(kn(i=>({redirect:i.redirect,setRedirect:i.setRedirect}))),a=So();c.useEffect(()=>{a&&d(N.ClientSetPath,t+n)},[t,n,a]),c.useEffect(()=>{r!==""&&(s(""),r!==t+n&&e(r,{replace:!0}))},[e,t,r,n,s])},xe=`${re}/url-presets`;async function ta(){return(await b.get(xe)).data}async function na(e){return(await b.post(xe,e)).data}async function oa(e,t){return(await b.put(`${xe}/${e}`,t)).data}async function ra(e){return(await b.delete(`${xe}/${e}`