@getontime/cli 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/assets/Backstage-WSlbFC9X.js +2 -0
- package/client/assets/Backstage-WSlbFC9X.js.br +0 -0
- package/client/assets/Backstage-WSlbFC9X.js.gz +0 -0
- package/client/assets/{Backstage-DG-hwPI3.js.map → Backstage-WSlbFC9X.js.map} +1 -1
- package/client/assets/{Countdown-C8LGl1pp.js → Countdown-B32qlxYT.js} +2 -2
- package/client/assets/Countdown-B32qlxYT.js.br +0 -0
- package/client/assets/Countdown-B32qlxYT.js.gz +0 -0
- package/client/assets/{Countdown-C8LGl1pp.js.map → Countdown-B32qlxYT.js.map} +1 -1
- package/client/assets/{CustomTranslationModal-CJ9-aDjl.js → CustomTranslationModal-CtBvokyt.js} +2 -2
- package/client/assets/CustomTranslationModal-CtBvokyt.js.br +0 -0
- package/client/assets/CustomTranslationModal-CtBvokyt.js.gz +0 -0
- package/client/assets/{CustomTranslationModal-CJ9-aDjl.js.map → CustomTranslationModal-CtBvokyt.js.map} +1 -1
- package/client/assets/DelayIndicator-BFZFpsY5.js +2 -0
- package/client/assets/DelayIndicator-BFZFpsY5.js.br +0 -0
- package/client/assets/DelayIndicator-BFZFpsY5.js.gz +0 -0
- package/client/assets/{DelayIndicator-F4GdgsGh.js.map → DelayIndicator-BFZFpsY5.js.map} +1 -1
- package/client/assets/EditorFeatureWrapper-DaMxgBMP.js +2 -0
- package/client/assets/EditorFeatureWrapper-DaMxgBMP.js.br +0 -0
- package/client/assets/EditorFeatureWrapper-DaMxgBMP.js.gz +0 -0
- package/client/assets/{EditorFeatureWrapper-eIpSr_UK.js.map → EditorFeatureWrapper-DaMxgBMP.js.map} +1 -1
- package/client/assets/EditorUtils-DoaSwWiz.js +2 -0
- package/client/assets/EditorUtils-DoaSwWiz.js.br +0 -0
- package/client/assets/EditorUtils-DoaSwWiz.js.gz +0 -0
- package/client/assets/{EditorUtils-Bd3J5Dvf.js.map → EditorUtils-DoaSwWiz.js.map} +1 -1
- package/client/assets/Empty-D1UteOYj.js +2 -0
- package/client/assets/Empty-D1UteOYj.js.br +0 -0
- package/client/assets/Empty-D1UteOYj.js.gz +0 -0
- package/client/assets/{Empty-C0IdV_kI.js.map → Empty-D1UteOYj.js.map} +1 -1
- package/client/assets/EmptyPage-DeRjpRKZ.js +2 -0
- package/client/assets/EmptyPage-DeRjpRKZ.js.br +0 -0
- package/client/assets/EmptyPage-DeRjpRKZ.js.gz +0 -0
- package/client/assets/{EmptyPage-Ct3d0DqJ.js.map → EmptyPage-DeRjpRKZ.js.map} +1 -1
- package/client/assets/FollowButton-FodezDem.js +2 -0
- package/client/assets/FollowButton-FodezDem.js.br +0 -0
- package/client/assets/FollowButton-FodezDem.js.gz +0 -0
- package/client/assets/{FollowButton-BG-ycRWu.js.map → FollowButton-FodezDem.js.map} +1 -1
- package/client/assets/{MessageControlExport-X-4dl9QT.js → MessageControlExport-CFGgiwk_.js} +3 -3
- package/client/assets/MessageControlExport-CFGgiwk_.js.br +0 -0
- package/client/assets/MessageControlExport-CFGgiwk_.js.gz +0 -0
- package/client/assets/MessageControlExport-CFGgiwk_.js.map +1 -0
- package/client/assets/{MilestoneEditor-rgBQSXVU.js → MilestoneEditor-B5BdJ5ju.js} +2 -2
- package/client/assets/MilestoneEditor-B5BdJ5ju.js.br +0 -0
- package/client/assets/MilestoneEditor-B5BdJ5ju.js.gz +0 -0
- package/client/assets/{MilestoneEditor-rgBQSXVU.js.map → MilestoneEditor-B5BdJ5ju.js.map} +1 -1
- package/client/assets/Modal-B8ZZbVMg.js +2 -0
- package/client/assets/Modal-B8ZZbVMg.js.br +0 -0
- package/client/assets/Modal-B8ZZbVMg.js.gz +0 -0
- package/client/assets/{Modal-Bn1bZkwb.js.map → Modal-B8ZZbVMg.js.map} +1 -1
- package/client/assets/{MultiPartProgressBar-Cmw-gisu.js → MultiPartProgressBar-BKHk19Hb.js} +2 -2
- package/client/assets/MultiPartProgressBar-BKHk19Hb.js.br +0 -0
- package/client/assets/MultiPartProgressBar-BKHk19Hb.js.gz +0 -0
- package/client/assets/{MultiPartProgressBar-Cmw-gisu.js.map → MultiPartProgressBar-BKHk19Hb.js.map} +1 -1
- package/client/assets/{OperatorExport-CJd8jmY4.js → OperatorExport-DQM14DsN.js} +2 -2
- package/client/assets/OperatorExport-DQM14DsN.js.br +0 -0
- package/client/assets/OperatorExport-DQM14DsN.js.gz +0 -0
- package/client/assets/{OperatorExport-CJd8jmY4.js.map → OperatorExport-DQM14DsN.js.map} +1 -1
- package/client/assets/{OverviewWrapper-1Vj3_ojX.js → OverviewWrapper-D1hUkrRi.js} +2 -2
- package/client/assets/OverviewWrapper-D1hUkrRi.js.br +0 -0
- package/client/assets/OverviewWrapper-D1hUkrRi.js.gz +0 -0
- package/client/assets/{OverviewWrapper-1Vj3_ojX.js.map → OverviewWrapper-D1hUkrRi.js.map} +1 -1
- package/client/assets/PipHost-B9-cZ8Lm.js +2 -0
- package/client/assets/PipHost-B9-cZ8Lm.js.br +0 -0
- package/client/assets/PipHost-B9-cZ8Lm.js.gz +0 -0
- package/client/assets/PipHost-B9-cZ8Lm.js.map +1 -0
- package/client/assets/PipHost-DEhjTbGT.css +1 -0
- package/client/assets/PipHost-DEhjTbGT.css.br +0 -0
- package/client/assets/PipHost-DEhjTbGT.css.gz +0 -0
- package/client/assets/{ProjectInfo-BduQgjcz.js → ProjectInfo-Dp1TZyBd.js} +2 -2
- package/client/assets/ProjectInfo-Dp1TZyBd.js.br +0 -0
- package/client/assets/ProjectInfo-Dp1TZyBd.js.gz +0 -0
- package/client/assets/{ProjectInfo-BduQgjcz.js.map → ProjectInfo-Dp1TZyBd.js.map} +1 -1
- package/client/assets/ProtectRoute-EejQ5o_H.js +2 -0
- package/client/assets/ProtectRoute-EejQ5o_H.js.br +0 -0
- package/client/assets/ProtectRoute-EejQ5o_H.js.gz +0 -0
- package/client/assets/{ProtectRoute-Ci_AIozP.js.map → ProtectRoute-EejQ5o_H.js.map} +1 -1
- package/client/assets/{ProtectedCuesheet-D_zdkwM-.js → ProtectedCuesheet-DvYSgueA.js} +2 -2
- package/client/assets/ProtectedCuesheet-DvYSgueA.js.br +0 -0
- package/client/assets/ProtectedCuesheet-DvYSgueA.js.gz +0 -0
- package/client/assets/{ProtectedCuesheet-D_zdkwM-.js.map → ProtectedCuesheet-DvYSgueA.js.map} +1 -1
- package/client/assets/{ProtectedEditor-CNL2ig79.js → ProtectedEditor-B0l0X3QP.js} +3 -3
- package/client/assets/ProtectedEditor-B0l0X3QP.js.br +0 -0
- package/client/assets/ProtectedEditor-B0l0X3QP.js.gz +0 -0
- package/client/assets/ProtectedEditor-B0l0X3QP.js.map +1 -0
- package/client/assets/RundownEntry-CwiStTnR.js +2 -0
- package/client/assets/RundownEntry-CwiStTnR.js.br +0 -0
- package/client/assets/RundownEntry-CwiStTnR.js.gz +0 -0
- package/client/assets/RundownEntry-CwiStTnR.js.map +1 -0
- package/client/assets/RundownExport-CCaOfHIr.js +3 -0
- package/client/assets/RundownExport-CCaOfHIr.js.br +0 -0
- package/client/assets/RundownExport-CCaOfHIr.js.gz +0 -0
- package/client/assets/RundownExport-CCaOfHIr.js.map +1 -0
- package/client/assets/Select-cHK8JrMG.js +2 -0
- package/client/assets/Select-cHK8JrMG.js.br +0 -0
- package/client/assets/Select-cHK8JrMG.js.gz +0 -0
- package/client/assets/{Select-B5xNi_tM.js.map → Select-cHK8JrMG.js.map} +1 -1
- package/client/assets/{Studio-D4hRKhJ1.js → Studio-BzwFDYzk.js} +2 -2
- package/client/assets/Studio-BzwFDYzk.js.br +0 -0
- package/client/assets/Studio-BzwFDYzk.js.gz +0 -0
- package/client/assets/{Studio-D4hRKhJ1.js.map → Studio-BzwFDYzk.js.map} +1 -1
- package/client/assets/StyleEditor-RZvkKHdf.js +2 -0
- package/client/assets/StyleEditor-RZvkKHdf.js.br +0 -0
- package/client/assets/StyleEditor-RZvkKHdf.js.gz +0 -0
- package/client/assets/{StyleEditor-BvcE8dkA.js.map → StyleEditor-RZvkKHdf.js.map} +1 -1
- package/client/assets/SuperscriptPeriod-DaZq1rr6.js +2 -0
- package/client/assets/SuperscriptPeriod-DaZq1rr6.js.br +0 -0
- package/client/assets/SuperscriptPeriod-DaZq1rr6.js.gz +0 -0
- package/client/assets/{SuperscriptPeriod-BmHAoSBy.js.map → SuperscriptPeriod-DaZq1rr6.js.map} +1 -1
- package/client/assets/SuperscriptTime-Mc0ZGBMo.js +2 -0
- package/client/assets/SuperscriptTime-Mc0ZGBMo.js.br +0 -0
- package/client/assets/SuperscriptTime-Mc0ZGBMo.js.gz +0 -0
- package/client/assets/{SuperscriptTime-Nou92D8X.js.map → SuperscriptTime-Mc0ZGBMo.js.map} +1 -1
- package/client/assets/{TimeElements-XpRwBsaa.js → TimeElements-dIvFHgcd.js} +2 -2
- package/client/assets/TimeElements-dIvFHgcd.js.br +0 -0
- package/client/assets/TimeElements-dIvFHgcd.js.gz +0 -0
- package/client/assets/{TimeElements-XpRwBsaa.js.map → TimeElements-dIvFHgcd.js.map} +1 -1
- package/client/assets/TimeInput-Duzx40TC.js +2 -0
- package/client/assets/TimeInput-Duzx40TC.js.br +0 -0
- package/client/assets/TimeInput-Duzx40TC.js.gz +0 -0
- package/client/assets/{TimeInput-Bu_5GlHP.js.map → TimeInput-Duzx40TC.js.map} +1 -1
- package/client/assets/{TimelinePage-CQqUB1KT.js → TimelinePage-C-OHrCR8.js} +2 -2
- package/client/assets/TimelinePage-C-OHrCR8.js.br +0 -0
- package/client/assets/TimelinePage-C-OHrCR8.js.gz +0 -0
- package/client/assets/{TimelinePage-CQqUB1KT.js.map → TimelinePage-C-OHrCR8.js.map} +1 -1
- package/client/assets/Timer-CGqVtVEC.js +2 -0
- package/client/assets/Timer-CGqVtVEC.js.br +0 -0
- package/client/assets/Timer-CGqVtVEC.js.gz +0 -0
- package/client/assets/{Timer-CIr2L3gJ.js.map → Timer-CGqVtVEC.js.map} +1 -1
- package/client/assets/{Timer-B7nk3TMf.css → Timer-Jjolf5Ra.css} +1 -1
- package/client/assets/Timer-Jjolf5Ra.css.br +0 -0
- package/client/assets/Timer-Jjolf5Ra.css.gz +0 -0
- package/client/assets/{TimerControlExport-4a3Cd9x8.js → TimerControlExport-GJn4WWdH.js} +2 -2
- package/client/assets/TimerControlExport-GJn4WWdH.js.br +0 -0
- package/client/assets/TimerControlExport-GJn4WWdH.js.gz +0 -0
- package/client/assets/{TimerControlExport-4a3Cd9x8.js.map → TimerControlExport-GJn4WWdH.js.map} +1 -1
- package/client/assets/TitleCard-BqbrUnHO.js +2 -0
- package/client/assets/TitleCard-BqbrUnHO.js.br +0 -0
- package/client/assets/TitleCard-BqbrUnHO.js.gz +0 -0
- package/client/assets/{TitleCard-1U35ek0D.js.map → TitleCard-BqbrUnHO.js.map} +1 -1
- package/client/assets/Tooltip-BQBvaIZx.js +2 -0
- package/client/assets/Tooltip-BQBvaIZx.js.br +0 -0
- package/client/assets/Tooltip-BQBvaIZx.js.gz +0 -0
- package/client/assets/{Tooltip-B8y25e3n.js.map → Tooltip-BQBvaIZx.js.map} +1 -1
- package/client/assets/ViewLogo-BdL1hUV1.js +2 -0
- package/client/assets/ViewLogo-BdL1hUV1.js.br +0 -0
- package/client/assets/ViewLogo-BdL1hUV1.js.gz +0 -0
- package/client/assets/{ViewLogo-BHsV7Faa.js.map → ViewLogo-BdL1hUV1.js.map} +1 -1
- package/client/assets/{ViewParamsEditor-BMHXOv-K.js → ViewParamsEditor-CFedpp6w.js} +2 -2
- package/client/assets/ViewParamsEditor-CFedpp6w.js.br +0 -0
- package/client/assets/ViewParamsEditor-CFedpp6w.js.gz +0 -0
- package/client/assets/{ViewParamsEditor-BMHXOv-K.js.map → ViewParamsEditor-CFedpp6w.js.map} +1 -1
- package/client/assets/dateConfig-BU1RZfIK.js +2 -0
- package/client/assets/dateConfig-BU1RZfIK.js.br +0 -0
- package/client/assets/dateConfig-BU1RZfIK.js.gz +0 -0
- package/client/assets/dateConfig-BU1RZfIK.js.map +1 -0
- package/client/assets/editorSettings-BMt-7s8I.js +2 -0
- package/client/assets/editorSettings-BMt-7s8I.js.br +0 -0
- package/client/assets/editorSettings-BMt-7s8I.js.gz +0 -0
- package/client/assets/{editorSettings-DH9ca-nB.js.map → editorSettings-BMt-7s8I.js.map} +1 -1
- package/client/assets/{getProgress-DlrSzpnf.js → getProgress-sdxPEEPi.js} +2 -2
- package/client/assets/getProgress-sdxPEEPi.js.br +0 -0
- package/client/assets/getProgress-sdxPEEPi.js.gz +0 -0
- package/client/assets/{getProgress-DlrSzpnf.js.map → getProgress-sdxPEEPi.js.map} +1 -1
- package/client/assets/index-CoGiopcb.js +3 -0
- package/client/assets/index-CoGiopcb.js.br +0 -0
- package/client/assets/index-CoGiopcb.js.gz +0 -0
- package/client/assets/index-CoGiopcb.js.map +1 -0
- package/client/assets/{offset-CLG4o744.js → offset-BS90Rks2.js} +2 -2
- package/client/assets/offset-BS90Rks2.js.br +0 -0
- package/client/assets/offset-BS90Rks2.js.gz +0 -0
- package/client/assets/{offset-CLG4o744.js.map → offset-BS90Rks2.js.map} +1 -1
- package/client/assets/parseUserTime-DZJMcfuJ.js +2 -0
- package/client/assets/parseUserTime-DZJMcfuJ.js.br +0 -0
- package/client/assets/parseUserTime-DZJMcfuJ.js.gz +0 -0
- package/client/assets/{parseUserTime-Cp5iWS7y.js.map → parseUserTime-DZJMcfuJ.js.map} +1 -1
- package/client/assets/{playbackstate-B3BKJ8cT.js → playbackstate-CWexoP3a.js} +2 -2
- package/client/assets/playbackstate-CWexoP3a.js.br +0 -0
- package/client/assets/playbackstate-CWexoP3a.js.gz +0 -0
- package/client/assets/{playbackstate-B3BKJ8cT.js.map → playbackstate-CWexoP3a.js.map} +1 -1
- package/client/assets/{presentation.utils-B-wIv_a5.js → presentation.utils-Zo5hNQje.js} +2 -2
- package/client/assets/presentation.utils-Zo5hNQje.js.br +0 -0
- package/client/assets/presentation.utils-Zo5hNQje.js.gz +0 -0
- package/client/assets/{presentation.utils-B-wIv_a5.js.map → presentation.utils-Zo5hNQje.js.map} +1 -1
- package/client/assets/rundownUtils-Dl1x6NDv.js +2 -0
- package/client/assets/rundownUtils-Dl1x6NDv.js.br +0 -0
- package/client/assets/rundownUtils-Dl1x6NDv.js.gz +0 -0
- package/client/assets/{rundownUtils-DJKMt8Ih.js.map → rundownUtils-Dl1x6NDv.js.map} +1 -1
- package/client/assets/timer.utils-BnMyVO6Z.js +2 -0
- package/client/assets/timer.utils-BnMyVO6Z.js.br +0 -0
- package/client/assets/timer.utils-BnMyVO6Z.js.gz +0 -0
- package/client/assets/timer.utils-BnMyVO6Z.js.map +1 -0
- package/client/assets/useCustomFields-CcTb-GQM.js +2 -0
- package/client/assets/useCustomFields-CcTb-GQM.js.br +0 -0
- package/client/assets/useCustomFields-CcTb-GQM.js.gz +0 -0
- package/client/assets/{useCustomFields-BUJkzZvM.js.map → useCustomFields-CcTb-GQM.js.map} +1 -1
- package/client/assets/useFollowComponent-BjhV6Uv8.js +2 -0
- package/client/assets/useFollowComponent-BjhV6Uv8.js.br +0 -0
- package/client/assets/useFollowComponent-BjhV6Uv8.js.gz +0 -0
- package/client/assets/{useFollowComponent-Eyo4hWVG.js.map → useFollowComponent-BjhV6Uv8.js.map} +1 -1
- package/client/assets/{useProjectData-DGA6K2Zs.js → useProjectData-B5mjXsMj.js} +2 -2
- package/client/assets/useProjectData-B5mjXsMj.js.br +0 -0
- package/client/assets/useProjectData-B5mjXsMj.js.gz +0 -0
- package/client/assets/{useProjectData-DGA6K2Zs.js.map → useProjectData-B5mjXsMj.js.map} +1 -1
- package/client/assets/useReport-zMbyWwpn.js +2 -0
- package/client/assets/useReport-zMbyWwpn.js.br +0 -0
- package/client/assets/useReport-zMbyWwpn.js.gz +0 -0
- package/client/assets/{useReport-BUCsRa2T.js.map → useReport-zMbyWwpn.js.map} +1 -1
- package/client/assets/useRundown-CHsh5rnl.js +2 -0
- package/client/assets/useRundown-CHsh5rnl.js.br +0 -0
- package/client/assets/useRundown-CHsh5rnl.js.gz +0 -0
- package/client/assets/useRundown-CHsh5rnl.js.map +1 -0
- package/client/assets/useWindowTitle-mLKt65i7.js +2 -0
- package/client/assets/useWindowTitle-mLKt65i7.js.br +0 -0
- package/client/assets/useWindowTitle-mLKt65i7.js.gz +0 -0
- package/client/assets/{useWindowTitle-DU8NlxIu.js.map → useWindowTitle-mLKt65i7.js.map} +1 -1
- package/client/assets/{validateEvent-3adKsP1N.js → validateEvent-CUmvjN95.js} +2 -2
- package/client/assets/validateEvent-CUmvjN95.js.br +0 -0
- package/client/assets/validateEvent-CUmvjN95.js.gz +0 -0
- package/client/assets/{validateEvent-3adKsP1N.js.map → validateEvent-CUmvjN95.js.map} +1 -1
- package/client/assets/{vendor-BoH5HFNN.js → vendor-Cdwxo8bP.js} +21 -21
- package/client/assets/vendor-Cdwxo8bP.js.br +0 -0
- package/client/assets/vendor-Cdwxo8bP.js.gz +0 -0
- package/client/assets/{vendor-BoH5HFNN.js.map → vendor-Cdwxo8bP.js.map} +1 -1
- package/client/assets/{viewLoader.utils-BPOG1xso.js → viewLoader.utils-DuXjY5zb.js} +2 -2
- package/client/assets/viewLoader.utils-DuXjY5zb.js.br +0 -0
- package/client/assets/viewLoader.utils-DuXjY5zb.js.gz +0 -0
- package/client/assets/{viewLoader.utils-BPOG1xso.js.map → viewLoader.utils-DuXjY5zb.js.map} +1 -1
- package/client/assets/viewUtils-dKRKkb_F.js +2 -0
- package/client/assets/viewUtils-dKRKkb_F.js.br +0 -0
- package/client/assets/viewUtils-dKRKkb_F.js.gz +0 -0
- package/client/assets/viewUtils-dKRKkb_F.js.map +1 -0
- package/client/index.html +2 -2
- package/package.json +1 -1
- package/server/index.cjs +89 -89
- package/client/assets/Backstage-DG-hwPI3.js +0 -2
- package/client/assets/Backstage-DG-hwPI3.js.br +0 -0
- package/client/assets/Backstage-DG-hwPI3.js.gz +0 -0
- package/client/assets/Countdown-C8LGl1pp.js.br +0 -0
- package/client/assets/Countdown-C8LGl1pp.js.gz +0 -0
- package/client/assets/CustomTranslationModal-CJ9-aDjl.js.br +0 -0
- package/client/assets/CustomTranslationModal-CJ9-aDjl.js.gz +0 -0
- package/client/assets/DelayIndicator-F4GdgsGh.js +0 -2
- package/client/assets/DelayIndicator-F4GdgsGh.js.br +0 -0
- package/client/assets/DelayIndicator-F4GdgsGh.js.gz +0 -0
- package/client/assets/EditorFeatureWrapper-eIpSr_UK.js +0 -2
- package/client/assets/EditorFeatureWrapper-eIpSr_UK.js.br +0 -0
- package/client/assets/EditorFeatureWrapper-eIpSr_UK.js.gz +0 -0
- package/client/assets/EditorUtils-Bd3J5Dvf.js +0 -2
- package/client/assets/EditorUtils-Bd3J5Dvf.js.br +0 -0
- package/client/assets/EditorUtils-Bd3J5Dvf.js.gz +0 -0
- package/client/assets/Empty-C0IdV_kI.js +0 -2
- package/client/assets/Empty-C0IdV_kI.js.br +0 -0
- package/client/assets/Empty-C0IdV_kI.js.gz +0 -0
- package/client/assets/EmptyPage-Ct3d0DqJ.js +0 -2
- package/client/assets/EmptyPage-Ct3d0DqJ.js.br +0 -0
- package/client/assets/EmptyPage-Ct3d0DqJ.js.gz +0 -0
- package/client/assets/FollowButton-BG-ycRWu.js +0 -2
- package/client/assets/FollowButton-BG-ycRWu.js.br +0 -0
- package/client/assets/FollowButton-BG-ycRWu.js.gz +0 -0
- package/client/assets/MessageControlExport-X-4dl9QT.js.br +0 -0
- package/client/assets/MessageControlExport-X-4dl9QT.js.gz +0 -0
- package/client/assets/MessageControlExport-X-4dl9QT.js.map +0 -1
- package/client/assets/MilestoneEditor-rgBQSXVU.js.br +0 -0
- package/client/assets/MilestoneEditor-rgBQSXVU.js.gz +0 -0
- package/client/assets/Modal-Bn1bZkwb.js +0 -2
- package/client/assets/Modal-Bn1bZkwb.js.br +0 -0
- package/client/assets/Modal-Bn1bZkwb.js.gz +0 -0
- package/client/assets/MultiPartProgressBar-Cmw-gisu.js.br +0 -0
- package/client/assets/MultiPartProgressBar-Cmw-gisu.js.gz +0 -0
- package/client/assets/OperatorExport-CJd8jmY4.js.br +0 -0
- package/client/assets/OperatorExport-CJd8jmY4.js.gz +0 -0
- package/client/assets/OverviewWrapper-1Vj3_ojX.js.br +0 -0
- package/client/assets/OverviewWrapper-1Vj3_ojX.js.gz +0 -0
- package/client/assets/PipHost-BUF7n-lT.css +0 -1
- package/client/assets/PipHost-BUF7n-lT.css.br +0 -0
- package/client/assets/PipHost-BUF7n-lT.css.gz +0 -0
- package/client/assets/PipHost-D7liNR4M.js +0 -2
- package/client/assets/PipHost-D7liNR4M.js.br +0 -0
- package/client/assets/PipHost-D7liNR4M.js.gz +0 -0
- package/client/assets/PipHost-D7liNR4M.js.map +0 -1
- package/client/assets/ProjectInfo-BduQgjcz.js.br +0 -0
- package/client/assets/ProjectInfo-BduQgjcz.js.gz +0 -0
- package/client/assets/ProtectRoute-Ci_AIozP.js +0 -2
- package/client/assets/ProtectRoute-Ci_AIozP.js.br +0 -0
- package/client/assets/ProtectRoute-Ci_AIozP.js.gz +0 -0
- package/client/assets/ProtectedCuesheet-D_zdkwM-.js.br +0 -0
- package/client/assets/ProtectedCuesheet-D_zdkwM-.js.gz +0 -0
- package/client/assets/ProtectedEditor-CNL2ig79.js.br +0 -0
- package/client/assets/ProtectedEditor-CNL2ig79.js.gz +0 -0
- package/client/assets/ProtectedEditor-CNL2ig79.js.map +0 -1
- package/client/assets/RundownEntry-Bs1ombtH.js +0 -2
- package/client/assets/RundownEntry-Bs1ombtH.js.br +0 -0
- package/client/assets/RundownEntry-Bs1ombtH.js.gz +0 -0
- package/client/assets/RundownEntry-Bs1ombtH.js.map +0 -1
- package/client/assets/RundownExport-BCT0ybxy.js +0 -3
- package/client/assets/RundownExport-BCT0ybxy.js.br +0 -0
- package/client/assets/RundownExport-BCT0ybxy.js.gz +0 -0
- package/client/assets/RundownExport-BCT0ybxy.js.map +0 -1
- package/client/assets/Select-B5xNi_tM.js +0 -2
- package/client/assets/Select-B5xNi_tM.js.br +0 -0
- package/client/assets/Select-B5xNi_tM.js.gz +0 -0
- package/client/assets/Studio-D4hRKhJ1.js.br +0 -0
- package/client/assets/Studio-D4hRKhJ1.js.gz +0 -0
- package/client/assets/StyleEditor-BvcE8dkA.js +0 -2
- package/client/assets/StyleEditor-BvcE8dkA.js.br +0 -3
- package/client/assets/StyleEditor-BvcE8dkA.js.gz +0 -0
- package/client/assets/SuperscriptPeriod-BmHAoSBy.js +0 -2
- package/client/assets/SuperscriptPeriod-BmHAoSBy.js.br +0 -0
- package/client/assets/SuperscriptPeriod-BmHAoSBy.js.gz +0 -0
- package/client/assets/SuperscriptTime-Nou92D8X.js +0 -2
- package/client/assets/SuperscriptTime-Nou92D8X.js.br +0 -0
- package/client/assets/SuperscriptTime-Nou92D8X.js.gz +0 -0
- package/client/assets/TimeElements-XpRwBsaa.js.br +0 -0
- package/client/assets/TimeElements-XpRwBsaa.js.gz +0 -0
- package/client/assets/TimeInput-Bu_5GlHP.js +0 -2
- package/client/assets/TimeInput-Bu_5GlHP.js.br +0 -0
- package/client/assets/TimeInput-Bu_5GlHP.js.gz +0 -0
- package/client/assets/TimelinePage-CQqUB1KT.js.br +0 -0
- package/client/assets/TimelinePage-CQqUB1KT.js.gz +0 -0
- package/client/assets/Timer-B7nk3TMf.css.br +0 -0
- package/client/assets/Timer-B7nk3TMf.css.gz +0 -0
- package/client/assets/Timer-CIr2L3gJ.js +0 -2
- package/client/assets/Timer-CIr2L3gJ.js.br +0 -0
- package/client/assets/Timer-CIr2L3gJ.js.gz +0 -0
- package/client/assets/TimerControlExport-4a3Cd9x8.js.br +0 -0
- package/client/assets/TimerControlExport-4a3Cd9x8.js.gz +0 -0
- package/client/assets/TitleCard-1U35ek0D.js +0 -2
- package/client/assets/TitleCard-1U35ek0D.js.br +0 -0
- package/client/assets/TitleCard-1U35ek0D.js.gz +0 -0
- package/client/assets/Tooltip-B8y25e3n.js +0 -2
- package/client/assets/Tooltip-B8y25e3n.js.br +0 -0
- package/client/assets/Tooltip-B8y25e3n.js.gz +0 -0
- package/client/assets/ViewLogo-BHsV7Faa.js +0 -2
- package/client/assets/ViewLogo-BHsV7Faa.js.br +0 -0
- package/client/assets/ViewLogo-BHsV7Faa.js.gz +0 -0
- package/client/assets/ViewParamsEditor-BMHXOv-K.js.br +0 -0
- package/client/assets/ViewParamsEditor-BMHXOv-K.js.gz +0 -0
- package/client/assets/dateConfig-_BhycZza.js +0 -2
- package/client/assets/dateConfig-_BhycZza.js.br +0 -0
- package/client/assets/dateConfig-_BhycZza.js.gz +0 -0
- package/client/assets/dateConfig-_BhycZza.js.map +0 -1
- package/client/assets/editorSettings-DH9ca-nB.js +0 -2
- package/client/assets/editorSettings-DH9ca-nB.js.br +0 -0
- package/client/assets/editorSettings-DH9ca-nB.js.gz +0 -0
- package/client/assets/getProgress-DlrSzpnf.js.br +0 -0
- package/client/assets/getProgress-DlrSzpnf.js.gz +0 -0
- package/client/assets/index-CDBQg2fh.js +0 -3
- package/client/assets/index-CDBQg2fh.js.br +0 -0
- package/client/assets/index-CDBQg2fh.js.gz +0 -0
- package/client/assets/index-CDBQg2fh.js.map +0 -1
- package/client/assets/offset-CLG4o744.js.br +0 -0
- package/client/assets/offset-CLG4o744.js.gz +0 -0
- package/client/assets/parseUserTime-Cp5iWS7y.js +0 -2
- package/client/assets/parseUserTime-Cp5iWS7y.js.br +0 -0
- package/client/assets/parseUserTime-Cp5iWS7y.js.gz +0 -0
- package/client/assets/playbackstate-B3BKJ8cT.js.br +0 -0
- package/client/assets/playbackstate-B3BKJ8cT.js.gz +0 -0
- package/client/assets/presentation.utils-B-wIv_a5.js.br +0 -0
- package/client/assets/presentation.utils-B-wIv_a5.js.gz +0 -0
- package/client/assets/rundownUtils-DJKMt8Ih.js +0 -2
- package/client/assets/rundownUtils-DJKMt8Ih.js.br +0 -0
- package/client/assets/rundownUtils-DJKMt8Ih.js.gz +0 -0
- package/client/assets/timer.utils-ByC_bcT9.js +0 -2
- package/client/assets/timer.utils-ByC_bcT9.js.br +0 -0
- package/client/assets/timer.utils-ByC_bcT9.js.gz +0 -0
- package/client/assets/timer.utils-ByC_bcT9.js.map +0 -1
- package/client/assets/useCustomFields-BUJkzZvM.js +0 -2
- package/client/assets/useCustomFields-BUJkzZvM.js.br +0 -2
- package/client/assets/useCustomFields-BUJkzZvM.js.gz +0 -0
- package/client/assets/useFollowComponent-Eyo4hWVG.js +0 -2
- package/client/assets/useFollowComponent-Eyo4hWVG.js.br +0 -0
- package/client/assets/useFollowComponent-Eyo4hWVG.js.gz +0 -0
- package/client/assets/useProjectData-DGA6K2Zs.js.br +0 -0
- package/client/assets/useProjectData-DGA6K2Zs.js.gz +0 -0
- package/client/assets/useReport-BUCsRa2T.js +0 -2
- package/client/assets/useReport-BUCsRa2T.js.br +0 -0
- package/client/assets/useReport-BUCsRa2T.js.gz +0 -0
- package/client/assets/useRundown-BFae0_bU.js +0 -2
- package/client/assets/useRundown-BFae0_bU.js.br +0 -0
- package/client/assets/useRundown-BFae0_bU.js.gz +0 -0
- package/client/assets/useRundown-BFae0_bU.js.map +0 -1
- package/client/assets/useWindowTitle-DU8NlxIu.js +0 -2
- package/client/assets/useWindowTitle-DU8NlxIu.js.br +0 -0
- package/client/assets/useWindowTitle-DU8NlxIu.js.gz +0 -0
- package/client/assets/validateEvent-3adKsP1N.js.br +0 -0
- package/client/assets/validateEvent-3adKsP1N.js.gz +0 -0
- package/client/assets/vendor-BoH5HFNN.js.br +0 -0
- package/client/assets/vendor-BoH5HFNN.js.gz +0 -0
- package/client/assets/viewLoader.utils-BPOG1xso.js.br +0 -0
- package/client/assets/viewLoader.utils-BPOG1xso.js.gz +0 -0
- package/client/assets/viewUtils-DI8_kmUZ.js +0 -2
- package/client/assets/viewUtils-DI8_kmUZ.js.br +0 -0
- package/client/assets/viewUtils-DI8_kmUZ.js.gz +0 -0
- package/client/assets/viewUtils-DI8_kmUZ.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-
|
|
2
|
-
import{h as g,j as e,ac as ss,e as Y,k as St,ad as ce,ae as Ts,af as As,ag as et,ah as xe,T as je,aa as nt,ai as Fs,y as Ct,aj as Is,ak as It,f as Ls,O as _t,A as $s,al as Vs,am as Ms,an as Ge,ao as Ws,P as qe,C as Ee,ap as ns,aq as as,ar as Us,as as rs,at as Lt,au as qs,av as zs,l as is,aw as Bs,$ as Qe,v as kt,ax as Ks,x as Hs,M as Gs,I as Qs,m as Ys}from"./vendor-BoH5HFNN.js";import{P as Js}from"./ProtectRoute-Ci_AIozP.js";import{e as be,Q as Dt,R as Xs,S as Zs,U as tt,s as en,V as tn,W as Ne,X as Ze,Y as E,Z as Me,_ as Ae,$ as P,a0 as se,a1 as Q,a2 as gt,a3 as sn,a4 as nn,a5 as Rt,a6 as an,a7 as ls,a8 as rn,a9 as A,B as f,aa as ie,ab as we,ac as Le,ad as ye,ae as oe,af as W,ag as B,ah as M,ai as V,aj as $e,ak as X,al as ve,am as at,an as ln,ao as on,ap as Et,f as Oe,aq as os,ar as Nt,as as cs,at as ne,x as $t,O as Re,au as cn,av as Vt,aw as ds,ax as us,ay as Pt,az as dn,aA as un,aB as Ot,aC as ct,m as Ie,k as hn,aD as mn,aE as xn,aF as ge,aG as hs,aH as ft,T as Ye,aI as jn,aJ as ms,aK as Mt,aL as pn,aM as gn,aN as fn,aO as We,aP as bn,aQ as yn,b as vn,aR as wn,N as Sn,aS as Cn,aT as _n,aU as kn,a as Dn,aV as Rn,aW as En,aX as Wt,aY as Nn,aZ as Ut,a_ as Pn,a$ as On}from"./index-CDBQg2fh.js";import{I as me,C as Tn,u as An}from"./useWindowTitle-DU8NlxIu.js";import{e as Fn,u as rt,T as H,t as dt,a as In,b as Ln,d as $n,c as Vn,f as Mn,g as Wn,S as Un,h as qn,D as xs,M as it}from"./Modal-Bn1bZkwb.js";import{S as ke,u as zn,a as Bn,b as Kn,c as ut}from"./useProjectData-DGA6K2Zs.js";import{i as js,R as ps,s as Hn,a as Gn,G as Qn,b as Yn,O as Jn,T as Xn}from"./OverviewWrapper-1Vj3_ojX.js";import{e as Zn,f as ea,g as ta,i as gs,h as fs,j as sa,k as na,l as aa,m as ra,r as ia,n as la,o as oa,p as ca,q as da}from"./useRundown-BFae0_bU.js";import{S as ae}from"./Select-B5xNi_tM.js";import{u as lt,p as ua,e as ha,d as ma}from"./useCustomFields-BUJkzZvM.js";import{u as xa,d as ja}from"./useReport-BUCsRa2T.js";import{T as bt,u as bs,e as Be}from"./editorSettings-DH9ca-nB.js";import{S as pa,L as ga,T as fa}from"./EditorUtils-Bd3J5Dvf.js";import{T as ys}from"./Tooltip-B8y25e3n.js";import{A as vs,T as Ke}from"./TimeInput-Bu_5GlHP.js";import{T as qt,E as ht}from"./validateEvent-3adKsP1N.js";import{p as He}from"./parseUserTime-Cp5iWS7y.js";import{S as ba,P as ya,O as va,M as wa,C as Sa}from"./TimeElements-XpRwBsaa.js";import{s as mt}from"./Editor.module-DvV2efYs.js";import"./offset-CLG4o744.js";import"./SuperscriptPeriod-BmHAoSBy.js";/* empty css */import"./playbackstate-B3BKJ8cT.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof wt<"u"?wt:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="b0d1583b-a72d-4969-bb26-20290f147110",t._sentryDebugIdIdentifier="sentry-dbid-b0d1583b-a72d-4969-bb26-20290f147110")}catch{}})();function Ca(t){return t.trim().replaceAll(" ","_")}const _a={worksheet:"event schedule",flag:"flag",timeStart:"time start",linkStart:"link start",timeEnd:"time end",duration:"duration",cue:"cue",title:"title",countToEnd:"count to end",skip:"skip",note:"note",colour:"colour",endAction:"end action",timerType:"timer type",timeWarning:"warning time",timeDanger:"danger time",custom:{},id:"id"},ka=(t,s,n={})=>{const{isDisabled:a=!1}=n,i=g.useCallback(l=>{l.key===s&&!l.repeat&&!a&&(l.preventDefault(),t())},[t,a,s]);g.useEffect(()=>(document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}),[i])},Da="_link_70oau_17",Ra="_inline_70oau_27",zt={link:Da,inline:Ra};function te({href:t,inline:s,children:n}){const a=i=>{i.preventDefault(),Dt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:be([zt.link,s&&zt.inline]),onClick:a,children:[n," ",e.jsx(ss,{style:{fontSize:"1em"}})]})}async function Ea(){const t=await Y.get(Xs);return{url:t.data.html_url,version:t.data.tag_name}}const Bt={url:"",version:"",hasUpdates:!1};function ws(){const{data:t,status:s,isFetching:n,isError:a,refetch:i}=St({queryKey:tn,queryFn:Ea,placeholderData:(c,m)=>c,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:en,enabled:tt}),l=(t==null?void 0:t.version)&&!t.version.includes(Zs);return{data:t?{...t,hasUpdates:l}:Bt,placeholder:Bt,status:s,isFetching:n,isError:a,refetch:i}}function Na(){const{data:t,isError:s}=ws();return s?e.jsxs(Ne,{children:[`You are currently using Ontime version ${Ze}`,e.jsx(E,{children:"Could not fetch version information"})]}):t.hasUpdates?e.jsxs(Ne,{children:[`You are currently using Ontime version ${Ze}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Me?"You can restart your stage to get the latest available version.":e.jsx(te,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(Ne,{children:`You are currently using the latest version of Ontime: ${Ze}`})}function Pa(){return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"About Ontime"}),e.jsxs(P,{children:[e.jsxs(se,{children:[e.jsx(Q,{children:"Ontime"}),e.jsxs(Ne,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(te,{href:gt,children:"www.getontime.no"})]}),e.jsxs(Ne,{children:["Considering sponsoring our work",e.jsx(te,{href:sn,children:"GitHub Sponsors"}),e.jsx(te,{href:nn,children:"Buy Me a Coffee"})]}),e.jsxs(Ne,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(te,{href:gt,children:"www.getontime.no"})]})]}),e.jsx(Q,{children:"Current version"}),e.jsx(Na,{}),e.jsx(Q,{children:"Links"}),e.jsx(te,{href:Rt,children:"Read the docs"}),e.jsx(te,{href:an,children:"Follow the project on GitHub"}),e.jsx(te,{href:ls,children:"Discord server"}),e.jsx(te,{href:rn,children:"Subreddit"})]})]})}function re(t,s){const n=g.useRef(null);return g.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const Oa="https://docs.getontime.no/api/protocols/osc/";function Ta({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var b,v,y;const{handleSubmit:a,reset:i,register:l,setError:r,watch:c,setValue:m,formState:{errors:o,isSubmitting:u,isDirty:h,isValid:d}}=ce({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),x=async S=>{try{await Fn(S),i(S)}catch(L){const R=V(L);r("root",{message:R})}},j=()=>{i({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},p=!u&&h&&d;return e.jsxs(se,{children:[e.jsxs(Q,{children:["Automation settings",e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",onClick:j,disabled:!p,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!p,loading:u,children:"Save"})]})]}),(o==null?void 0:o.root)&&e.jsx(E,{children:o.root.message}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:[e.jsx("p",{children:"Control Ontime and share its data with external systems in your workflow."}),e.jsx("p",{children:"- Automations allow Ontime to send its data on lifecycle triggers."}),e.jsx("p",{children:"- OSC Input tells Ontime to listen to messages on the specific port."}),e.jsx("br",{}),e.jsx(te,{href:Oa,children:"See the docs"})]})}),e.jsxs(P,{as:"form",id:"automation-settings-form",onSubmit:a(x),onKeyDown:S=>we(S,j),children:[e.jsx(Le,{isLoading:!1}),e.jsx(ye,{children:"Automation"}),e.jsx(oe,{children:e.jsxs(W,{children:[e.jsx(B,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(b=o.enabledAutomations)==null?void 0:b.message}),e.jsx(ke,{size:"large",checked:c("enabledAutomations"),onCheckedChange:S=>m("enabledAutomations",S,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(ye,{children:"OSC Input"}),e.jsxs(oe,{children:[Me&&e.jsx(me,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(W,{children:[e.jsx(B,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(v=o.enabledOscIn)==null?void 0:v.message}),e.jsx(ke,{size:"large",checked:c("enabledOscIn"),onCheckedChange:S=>m("enabledOscIn",S,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(y=o.oscPortIn)==null?void 0:y.message}),e.jsx(M,{id:"oscPortIn",placeholder:"8888",maxLength:5,style:{textAlign:"right",width:"5rem"},type:"number",fluid:!0,...l("oscPortIn",{required:{value:!0,message:"Required field"},max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"},pattern:{value:js,message:"Value should be numeric"}})})]})]})]})]})}const Aa=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],Fa=["{{clock}}","{{timer.addedTime}}","{{timer.current}}","{{timer.duration}}","{{timer.elapsed}}","{{timer.expectedFinish}}","{{timer.secondaryTimer}}","{{timer.startedAt}}","{{rundown.selectedEventIndex}}","{{rundown.numEvents}}","{{rundown.plannedStart}}","{{rundown.plannedEnd}}","{{rundown.actualStart}}","{{offset.absolute}}","{{offset.relative}}","{{offset.expectedRundownEnd}}","{{offset.expectedGroupEnd}}","{{offset.expectedFlagStart}}"],Ia=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],La=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function $a(t){return[...Aa,...Fa,...Ia,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...La,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Va(t,s){if(t===s)return"";if(t.endsWith("{{")&&s.startsWith("{{"))return s.substring(2);if(t.endsWith("{")&&s.startsWith("{{"))return s.substring(1);for(let n=0;n<s.length;n++){const a=s.substring(0,n+1);if(t.endsWith(a))return s.substring(n+1)}return""}function Ma(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Wa="_wrapper_1dmtf_17",Ua="_suggestions_1dmtf_21",Kt={wrapper:Wa,suggestions:Ua},qa=g.forwardRef(function(s,n){const{value:a,onChange:i,...l}=s,{data:r}=lt(),c=Ts(()=>j(!1)),m=g.useMemo(()=>$a(r),[r]),[o,u]=g.useState(a||""),[h,d]=g.useState([]),[x,j]=g.useState(!1),p=y=>{const S=Ma(y);return m.filter(L=>L.startsWith(S))},b=y=>{u(y.target.value),y.target.value.endsWith("{")?(j(!0),d(p(y.target.value))):y.target.value===""||y.target.value.endsWith("}}")?j(!1):x&&d(p(y.target.value)),i==null||i(y)},v=y=>{u(S=>{const L=Va(S,y);return S+L}),j(!1)};return e.jsxs("div",{className:Kt.wrapper,ref:As(c,n),children:[e.jsx(M,{value:o,...l,onChange:b,fluid:!0}),x&&h.length>0&&e.jsx("ul",{className:Kt.suggestions,children:h.map(y=>e.jsx("li",{onClick:()=>v(y),children:y},y))})]})}),yt=[{id:1,label:"On Load",value:"onLoad"},{id:2,label:"On Start",value:"onStart"},{id:3,label:"On Pause",value:"onPause"},{id:4,label:"On Stop",value:"onStop"},{id:5,label:"Every second",value:"onClock"},{id:6,label:"On Timer Update",value:"onUpdate"},{id:7,label:"On Finish",value:"onFinish"},{id:8,label:"On Warning",value:"onWarning"},{id:9,label:"On Danger",value:"onDanger"}];function Ht(t){return Object.hasOwn(t,"id")}const za=[{value:"eventNow.id",label:"ID"},{value:"eventNow.title",label:"Title"},{value:"eventNow.cue",label:"Cue"},{value:"eventNow.countToEnd",label:"Count to end"},{value:"eventNow.note",label:"Note"},{value:"eventNow.colour",label:"Colour"}],Ba=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Ka(t){return[...za,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Ba,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function Ha(t){const s={},n=[];for(let a=0;a<t.length;a++){const i=t[a];Object.hasOwn(s,i.trigger)||(s[i.trigger]=[]),s[i.trigger].includes(i.automationId)?n.push(a):s[i.trigger].push(i.automationId)}return n.length>0?n:void 0}const Ga="_outerColumn_1klj0_17",Qa="_innerColumn_1klj0_25",Ya="_ruleSection_1klj0_31",Ja="_titleSection_1klj0_37",Xa="_filterSection_1klj0_38",Za="_oscSection_1klj0_39",er="_httpSection_1klj0_40",tr="_actionSection_1klj0_41",sr="_test_1klj0_95",nr="_outputCard_1klj0_99",ue={outerColumn:Ga,innerColumn:Qa,ruleSection:Ya,titleSection:Ja,filterSection:Xa,oscSection:Za,httpSection:er,actionSection:tr,test:sr,outputCard:nr};function ar({index:t,register:s,setValue:n,rowErrors:a,value:i,children:l,watch:r}){var u,h,d,x,j;const[c,m]=g.useState(i),o=p=>{n(`outputs.${t}.action`,p,{shouldDirty:!0}),m(p)};return e.jsxs("div",{className:ue.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ae,{onValueChange:p=>{o(p)},value:r(`outputs.${t}.action`),options:[{value:"aux1-pause",label:"Aux 1: pause"},{value:"aux2-pause",label:"Aux 2: pause"},{value:"aux3-pause",label:"Aux 3: pause"},{value:"aux1-start",label:"Aux 1: start"},{value:"aux2-start",label:"Aux 2: start"},{value:"aux3-start",label:"Aux 3: start"},{value:"aux1-stop",label:"Aux 1: stop"},{value:"aux2-stop",label:"Aux 2: stop"},{value:"aux3-stop",label:"Aux 3: stop"},{value:"aux1-set",label:"Aux 1: set"},{value:"aux2-set",label:"Aux 2: set"},{value:"aux3-set",label:"Aux 3: set"},{value:"message-set",label:"Primary Message: set"},{value:"message-secondary",label:"Secondary Message: source"}]}),e.jsx(E,{children:(u=a==null?void 0:a.action)==null?void 0:u.message})]}),c.startsWith("aux")&&c.endsWith("set")&&e.jsxs("label",{children:["New time",e.jsx(M,{...s(`outputs.${t}.time`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"eg: 10m5s"}),e.jsx(E,{children:(h=a==null?void 0:a.time)==null?void 0:h.message})]}),c==="message-set"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Text (leave empty for no change)",e.jsx(M,{...s(`outputs.${t}.text`),fluid:!0,placeholder:"eg: Timer is finished"}),e.jsx(E,{children:(d=a==null?void 0:a.text)==null?void 0:d.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ae,{onValueChange:p=>{const b=p==="untouched"?void 0:p;n(`outputs.${t}.visible`,b,{shouldDirty:!0})},value:r(`outputs.${t}.visible`)===void 0?"untouched":r(`outputs.${t}.visible`),options:[{value:"untouched",label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(E,{children:(x=a==null?void 0:a.visible)==null?void 0:x.message})]})]}),c==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ae,{onValueChange:p=>{n(`outputs.${t}.secondarySource`,p,{shouldDirty:!0})},value:r(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source",disabled:!0},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"external",label:"External"},{value:"null",label:"None"}]}),e.jsx(E,{children:(j=a==null?void 0:a.secondarySource)==null?void 0:j.message})]}),e.jsx("div",{className:ue.test,children:l})]})}const rr="https://docs.getontime.no/api/automation/#using-variables-in-automation";function ir({automation:t,onClose:s}){var K;const n=Ht(t),{data:a}=lt(),{refetch:i}=rt(),l=g.useMemo(()=>Ka(a),[a]),{control:r,handleSubmit:c,getValues:m,register:o,setError:u,setFocus:h,setValue:d,watch:x,formState:{errors:j,isSubmitting:p,isDirty:b,isValid:v}}=ce({mode:"onChange",defaultValues:{title:(t==null?void 0:t.title)??"",filterRule:(t==null?void 0:t.filterRule)??"all",filters:(t==null?void 0:t.filters)??[],outputs:(t==null?void 0:t.outputs)??[]},resetOptions:{keepDirtyValues:!0}}),{fields:y,append:S,remove:L}=et({name:"filters",control:r}),{fields:R,append:O,remove:U}=et({name:"outputs",control:r});g.useEffect(()=>{h("title")},[h]);const w=()=>{S({field:"",operator:"equals",value:""})},$=()=>{O({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},_=()=>{O({type:"http",url:""})},G=()=>{O({type:"ontime",action:"aux1-start"})},q=async I=>{try{const k=m(`outputs.${I}`);if(!k.targetIP||!k.targetPort||!k.address)return;await dt({type:"osc",targetIP:k.targetIP,targetPort:k.targetPort,address:k.address,args:k.args})}catch{}},F=async I=>{try{const k=m(`outputs.${I}`);if(!k.url)return;await dt({type:"http",url:k.url})}catch{}},N=async I=>{try{const k=m(`outputs.${I}`);await dt({...k,type:"ontime"})}catch{}},T=async I=>{Ht(t)?await k(t.id,{id:t.id,...I}):await pe(I),i();async function k(de,le){try{await In(de,le),s()}catch(C){u("root",{message:V(C)})}}async function pe(de){try{await Ln(de),s()}catch(le){u("root",{message:V(le)})}}},D=!p&&b&&v;return e.jsxs($e,{as:"form",name:"automation-form",onSubmit:c(T),className:ue.outerColumn,onKeyDown:I=>we(I,s),children:[e.jsx(Q,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:ue.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:ue.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx(M,{...o("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(E,{children:(K=j.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:ue.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:ue.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(ps,{orientation:"horizontal",value:x("filterRule"),onValueChange:I=>d("filterRule",I,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),y.map((I,k)=>{var de,le,C,Z,Ce,De;const pe=`filters.${k}.field.${I.id}`;return e.jsxs("div",{className:ue.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ae,{value:x(`filters.${k}.field`),onValueChange:_e=>d(`filters.${k}.field`,_e,{shouldDirty:!0}),options:l.map(({value:_e,label:J})=>({value:_e,label:J})),"aria-label":"Event field"}),e.jsx(E,{children:(C=(le=(de=j.filters)==null?void 0:de[k])==null?void 0:le.field)==null?void 0:C.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ae,{value:x(`filters.${k}.operator`),onValueChange:_e=>d(`filters.${k}.operator`,_e,{shouldDirty:!0}),options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(E,{children:(De=(Ce=(Z=j.filters)==null?void 0:Z[k])==null?void 0:Ce.operator)==null?void 0:De.message})]}),e.jsxs("label",{children:["Value to match",e.jsx(M,{...o(`filters.${k}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>L(k),children:e.jsx(xe,{})})})]})]},pe)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:w,children:["Add filter ",e.jsx(je,{})]})})]})]}),e.jsxs("div",{className:ue.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(me,{children:["Automation outputs can be used to send data from Ontime to external software.",e.jsx(te,{href:rr,children:"See the documentation for templates"})]}),R.map((I,k)=>{var pe,de,le,C,Z,Ce,De,_e;if(Zn(I)){const J=(pe=j.outputs)==null?void 0:pe[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"OSC"}),e.jsxs("div",{className:ue.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx(M,{...o(`outputs.${k}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(E,{children:(de=J==null?void 0:J.targetIP)==null?void 0:de.message})]}),e.jsxs("label",{children:["Target Port",e.jsx(M,{...o(`outputs.${k}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:Ft=>Ft===""?0:Number(Ft),max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"}}),fluid:!0,type:"number",maxLength:5,placeholder:"8000"}),e.jsx(E,{children:(le=J==null?void 0:J.targetPort)==null?void 0:le.message})]}),e.jsxs("label",{children:["Address",e.jsx(M,{...o(`outputs.${k}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(E,{children:(C=J==null?void 0:J.address)==null?void 0:C.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(qa,{...o(`outputs.${k}.args`),value:I.args,placeholder:"1"}),e.jsx(E,{children:(Z=J==null?void 0:J.args)==null?void 0:Z.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>q(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]})]},I.id)}if(ea(I)){const J=(Ce=j.outputs)==null?void 0:Ce[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"HTTP"}),e.jsxs("div",{className:ue.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx(M,{...o(`outputs.${k}.url`,{required:{value:!0,message:"Required field"},pattern:{value:Hn,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(E,{children:(De=J==null?void 0:J.url)==null?void 0:De.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>F(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]})]},I.id)}if(ta(I)){const J=(_e=j.outputs)==null?void 0:_e[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"Ontime action"}),e.jsxs(ar,{value:I.action,index:k,register:o,rowErrors:J,setValue:d,watch:x,children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>N(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]},I.id)}return null}),e.jsxs(A,{relation:"inner",children:[e.jsxs(f,{onClick:$,children:["OSC ",e.jsx(je,{})]}),e.jsxs(f,{onClick:_,children:["HTTP ",e.jsx(je,{})]}),e.jsxs(f,{onClick:G,children:["Ontime action ",e.jsx(je,{})]})]})]}),e.jsxs(A,{align:"end",children:[(j==null?void 0:j.root)&&e.jsx(E,{children:j.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!D,loading:p,children:"Save"})]})]})}const Gt={title:"",filterRule:"all",filters:[],outputs:[]};function lr(t){const{automations:s}=t,{refetch:n}=rt(),[a,i]=g.useState(null),[l,r]=g.useState(null),c=async o=>{try{r(null),await $n(o)}catch(u){r(V(u))}finally{n()}},m=Object.keys(s);return e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!a,onClick:()=>i(Gt),children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),a!==null&&e.jsx(ir,{automation:a,onClose:()=>i(null)}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"45%"},children:"Title"}),e.jsx("th",{style:{width:"15%"},children:"Trigger rule"}),e.jsx("th",{style:{width:"15%"},children:"Filters"}),e.jsx("th",{style:{width:"15%"},children:"Outputs"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[m.length===0&&e.jsx(at,{handleClick:a?void 0:()=>i(Gt)}),m.map(o=>Object.hasOwn(s,o)?e.jsx(g.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[o].title}),e.jsx("td",{children:e.jsx(H,{children:s[o].filterRule})}),e.jsx("td",{children:s[o].filters.length}),e.jsx("td",{children:s[o].outputs.length}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>i(s[o]),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>c(o),children:e.jsx(xe,{})})]})]})},o):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(E,{children:l})})})]})]})]})}function Ss({automations:t,initialId:s,initialTitle:n,initialAutomationId:a,initialTrigger:i,onCancel:l,postSubmit:r}){var L,R,O,U;const{handleSubmit:c,register:m,setFocus:o,setError:u,watch:h,setValue:d,formState:{errors:x,isSubmitting:j,isValid:p,isDirty:b}}=ce({defaultValues:{title:n,trigger:i??yt[0].value,automationId:a??((L=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:L.id)},resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{o("title")},[o]);const v=async w=>{if(s){try{await Vn(s,{id:s,...w}),r()}catch($){u("root",{message:`Failed to save changes to trigger ${V($)}`})}return}try{await Mn(w),r()}catch($){u("root",{message:`Failed to save trigger ${V($)}`})}},y=Object.keys(t).map(w=>({value:w,label:t[w].title})),S=b&&p;return e.jsxs($e,{as:"form",name:"trigger-form",onSubmit:c(v),onKeyDown:w=>we(w,l),children:[e.jsx(Q,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx(M,{...m("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(E,{children:(R=x.title)==null?void 0:R.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ae,{value:h("trigger"),onValueChange:w=>d("trigger",w,{shouldDirty:!0}),options:yt.map(w=>({value:w.value,label:w.label})),"aria-label":"Lifecycle trigger"}),e.jsx(E,{children:(O=x.trigger)==null?void 0:O.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ae,{value:h("automationId"),onValueChange:w=>d("automationId",w,{shouldDirty:!0}),options:y,"aria-label":"Automation title"}),e.jsx(E,{children:(U=x.automationId)==null?void 0:U.message})]}),e.jsxs(A,{align:"end",children:[e.jsx(f,{disabled:j,onClick:l,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!S,loading:j,children:"Save"})]})]})}function or(t){var h,d;const{automations:s,id:n,title:a,trigger:i,automationId:l,duplicate:r,handleDelete:c,postSubmit:m}=t,[o,u]=g.useState(!1);return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ss,{automations:s,initialId:n,initialTitle:a,initialTrigger:i,initialAutomationId:l,onCancel:()=>u(!1),postSubmit:()=>{u(!1),m()}})})}):e.jsxs("tr",{"data-warn":r,children:[e.jsxs(A,{as:"td",relation:"inner",children:[r&&e.jsx(Fs,{color:"#FFBC56"}),a]}),e.jsx("td",{children:e.jsx(H,{children:(h=yt.find(x=>x.value===i))==null?void 0:h.label})}),e.jsx("td",{children:e.jsx(H,{children:(d=s==null?void 0:s[l])==null?void 0:d.title})}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>u(!0),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:c,children:e.jsx(xe,{})})]})]})}function cr(t){const{triggers:s,automations:n}=t,[a,i]=g.useState(!1),{refetch:l}=rt(),[r,c]=g.useState(null),m=async d=>{try{await Wn(d)}catch(x){c(V(x))}finally{l()}},o=()=>{i(!1),l()},u=g.useMemo(()=>Ha(s),[s]),h=Object.keys(n).length>0;return e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!h,loading:!1,onClick:()=>i(!0),children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[u&&e.jsx(E,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),a&&e.jsx(Ss,{automations:n,onCancel:()=>i(!1),postSubmit:o}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"35%"},children:"Title"}),e.jsx("th",{style:{width:"25%"},children:"Lifecycle trigger"}),e.jsx("th",{style:{width:"25%"},children:"Automation"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[!a&&s.length===0&&e.jsx(at,{label:"Create an automation to attach triggers to",handleClick:h?()=>i(!0):void 0}),s.map((d,x)=>e.jsxs(g.Fragment,{children:[e.jsx(or,{automations:n,id:d.id,title:d.title,trigger:d.trigger,automationId:d.automationId,duplicate:u==null?void 0:u.includes(x),handleDelete:()=>m(d.id),postSubmit:o}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(E,{children:r})})})]},d.id))]})]})]})]})}function dr({location:t}){const{data:s,status:n}=rt(),a=re("settings",t),i=re("triggers",t),l=re("automations",t),r=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Automation"}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:r}),e.jsx("div",{ref:a,children:e.jsx(Ta,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(lr,{automations:s.automations})}),e.jsx("div",{ref:i,children:e.jsx(cr,{triggers:s.triggers,automations:s.automations})})]})]})}const ur="_goIcon_1fzu7_17",hr={goIcon:ur};function mr(){const{data:t}=ln(),s=n=>Dt(n);return e.jsx(A,{children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!tt)return null;const a=on(n.address);return e.jsxs(Et,{copyValue:a,onClick:()=>s(a),children:[`${n.name} - ${n.address}`," ",e.jsx(Ct,{className:hr.goIcon})]},n.name)})})}function xr(t){return Is(t)}function jr(t,s,n){if(Object.keys(t).length===0)return[];if(n.length===0)return[];const a=[];let i=1;for(let l=0;l<n.length;l++){const r=n[l],c=s[r];!c||!gs(c)||(r in t||a.push({id:r,index:i,title:c.title,cue:c.cue,scheduledStart:c.timeStart,actualEnd:null,scheduledEnd:c.timeEnd,actualStart:null}),r in t&&a.push({id:r,index:i,title:c.title,cue:c.cue,scheduledStart:c.timeStart,actualEnd:t[r].endedAt,scheduledEnd:c.timeEnd,actualStart:t[r].startedAt}),i++)}return a}const pr=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function gr(t){const s=[];s.push(pr);for(const n of t)s.push([String(n.index),n.title,n.cue,Oe(n.scheduledStart),Oe(n.actualStart),Oe(n.scheduledEnd),Oe(n.actualEnd)]);return xr(s)}const fr="_blink_15peo_1",br="_fourtyfive_15peo_13",yr="_over_15peo_17",vr="_under_15peo_21",Je={blink:fr,fourtyfive:br,over:yr,under:vr};function wr(){const{data:t}=xa(),{data:s}=fs(),n=async()=>await ja(),a=l=>{if(!l)return;const r=gr(l),c=os(r,"text/csv;charset=utf-8;");Nt(c,"ontime-report.csv")},i=g.useMemo(()=>jr(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Report"}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(ye,{children:["Manage report",e.jsxs(A,{children:[e.jsxs(f,{onClick:()=>a(i),disabled:i.length===0,children:[e.jsx(It,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:i.length===0,children:[e.jsx(It,{}),"Clear All"]})]})]})}),e.jsx(P,{children:e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Scheduled Start"}),e.jsx("th",{children:"Actual Start"}),e.jsx("th",{children:"Scheduled End"}),e.jsx("th",{children:"Actual End"})]})}),e.jsxs("tbody",{children:[i.length===0&&e.jsx(at,{label:"Reports are generated when running through the show."}),i.map(l=>{const r=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",c=l.actualEnd===null?null:l.actualEnd<=l.scheduledEnd?"under":"over";return e.jsxs("tr",{children:[e.jsx("th",{children:l.index}),e.jsx("th",{children:l.cue}),e.jsx("th",{children:l.title}),e.jsx("th",{className:be([r&&Je[r]]),children:Oe(l.scheduledStart)}),e.jsx("th",{className:be([r&&Je[r]]),children:Oe(l.actualStart)}),e.jsx("th",{className:be([c&&Je[c]]),children:Oe(l.scheduledEnd)}),e.jsx("th",{className:be([c&&Je[c]]),children:Oe(l.actualEnd)})]},l.id)})]})]})})]})})}const Sr="_expand_1sy0c_17",Cr="_column_1sy0c_21",Qt={expand:Sr,column:Cr},_r=[{value:Re.Cuesheet,label:"Cuesheet"},{value:Re.Operator,label:"Operator"},{value:Re.Timer,label:"Timer"},{value:Re.Backstage,label:"Backstage"},{value:Re.Timeline,label:"Timeline"},{value:Re.StudioClock,label:"Studio Clock"},{value:Re.Countdown,label:"Countdown"},{value:Re.ProjectInfo,label:"Project Info"}],kr={alias:"",target:Re.Timer,search:"",enabled:!0};function Dr({urlPreset:t,onClose:s}){var R,O,U;const{addPreset:n,updatePreset:a,isMutating:i}=cs(),{handleSubmit:l,register:r,setFocus:c,setError:m,clearErrors:o,setValue:u,getValues:h,watch:d,formState:{errors:x,isSubmitting:j,isValid:p,isDirty:b}}=ce({defaultValues:t??kr,mode:"onChange",resetOptions:{keepDirtyValues:!0}}),v=g.useRef(null),y=async w=>{try{t?await a(t.alias,w):await n(w),s()}catch($){m("root",{message:V($)})}};g.useEffect(()=>{c("alias")},[c]);const S=()=>{var w;o();try{const $=cn(h("alias"),((w=v.current)==null?void 0:w.value.trim())??"");u("target",$.target,{shouldDirty:!0,shouldValidate:!0}),u("search",$.search,{shouldDirty:!0,shouldValidate:!0})}catch($){m("root",{message:Vt($)});return}},L=w=>{try{return new URLSearchParams(w),!0}catch($){return Vt($)||"Invalid URL parameters"}};return e.jsxs($e,{as:"form",onSubmit:l(y),onKeyDown:w=>we(w,s),className:Qt.column,children:[e.jsx("input",{hidden:!0,name:"enabled",value:"true"}),e.jsx("div",{children:"1. Enter URL and let Ontime generate the preset options"}),e.jsxs(A,{children:[e.jsxs("div",{children:[e.jsx(ne,{children:"Alias"}),e.jsx(M,{...r("alias",{required:"Alias is required",pattern:{value:Gn,message:"Field can only contain URL safe characters (a-z, 0-9, _ and -)"}})})]}),e.jsxs("div",{className:Qt.expand,children:[e.jsx(ne,{children:"Generate options (paste URL to generate options)"}),e.jsxs(A,{children:[e.jsx(M,{placeholder:"Paste URL",fluid:!0,ref:v}),e.jsx(f,{onClick:S,children:"Generate"})]})]})]}),((R=x.alias)==null?void 0:R.message)&&e.jsx(E,{children:x.alias.message}),e.jsxs("div",{children:[$t," or ",$t]}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(ne,{children:"Target"}),e.jsx(ae,{options:_r,...r("target",{required:"Target is required"}),value:d("target"),onValueChange:w=>u("target",w,{shouldDirty:!0})})]}),e.jsxs("div",{children:[e.jsx(ne,{children:"Parameters"}),e.jsx(bt,{fluid:!0,rows:3,...r("search",{validate:L})}),e.jsx(E,{children:(O=x.search)==null?void 0:O.message})]}),e.jsxs("div",{children:[e.jsx(E,{children:(U=x.root)==null?void 0:U.message}),e.jsxs(A,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!p||!b,loading:j||i,children:"Save"})]})]})]})}const Rr="https://docs.getontime.no/features/url-presets/";function Er(){const[t,s]=g.useState({isOpen:!1,preset:void 0}),{data:n,status:a}=ds(),{deletePreset:i,isMutating:l}=cs(),r=()=>s({isOpen:!0}),c=o=>s({isOpen:!0,preset:o}),m=()=>s({isOpen:!1,preset:void 0});return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["URL presets",e.jsxs(f,{onClick:r,children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:["URL presets are user pre-defined aliases to Ontime URLs.",e.jsx("br",{}),"This URL can contain full configuration including parameters, or simply route to a specific view.",e.jsx("br",{}),e.jsx("br",{}),"The easiest way to get started is to copy an URL from your browser and paste it into the form.",e.jsx(te,{href:Rr,children:"See the docs"})]})}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:a==="pending"}),t.isOpen&&e.jsx(Dr,{urlPreset:t.preset,onClose:m}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Enabled"}),e.jsx("th",{children:"Target view"}),e.jsx("th",{children:"Alias"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[n.length===0&&e.jsx(at,{handleClick:r}),n.map((o,u)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(ke,{defaultChecked:o.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(H,{children:o.target})}),e.jsx("td",{style:{width:"100%"},children:o.alias}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white",onClick:h=>us(o.alias,h),disabled:l,children:e.jsx(ss,{})}),e.jsx(X,{onClick:()=>c(o),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${u}`,disabled:l,children:e.jsx(nt,{})}),e.jsx(X,{onClick:()=>i(o.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${u}`,disabled:l,children:e.jsx(xe,{})})]})]},o.alias))]})]})]})]})})}function Nr({location:t}){const s=re("presets",t),n=re("link",t),a=re("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(Er,{})}),e.jsx("div",{ref:n,children:e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Share Ontime Link"}),!Me&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(mr,{})]}),e.jsx(ie,{}),e.jsx(Qn,{})]})})}),e.jsx("div",{ref:a,children:e.jsx(wr,{})})]})}const Tt=`${Pt}/excel`;async function Pr(t){const s=new FormData;return s.append("excel",t),(await Y.post(`${Tt}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Or(t){return(await Y.post(`${Tt}/preview`,{options:t})).data}async function Tr(t,s){try{const n=await Y.get(`${Tt}/${t}/export`,{responseType:"blob"});Nt(n.data,`${s??"Ontime_rundown"}.xlsx`)}catch(n){console.error("Error downloading file:",n)}}const Ue=`${Pt}/sheets`,Ar=async()=>(await Y.get(`${Ue}/connect`)).data,Fr=async(t,s)=>{const n=new FormData;return n.append("client_secret",t),(await Y.post(`${Ue}/${s}/connect`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},Ir=async()=>(await Y.post(`${Ue}/revoke`)).data,Lr=async(t,s)=>(await Y.post(`${Ue}/${t}/read`,{options:s})).data,Cs=async t=>(await Y.post(`${Ue}/${t}/worksheets`)).data,$r=async(t,s)=>(await Y.post(`${Ue}/${t}/write`,{options:s})).data;function Vr(t){if(!Mr(t))throw new Error("Unknown file type");if(t.size===0)throw new Error("File is empty");if(t.size>1e7)throw new Error("File size limit (10MB) exceeded")}function _s(t){if(!Wr(t))throw new Error("Unknown file type");if(t.size===0)throw new Error("File is empty");if(t.size>2e6)throw new Error("File size limit (2MB) exceeded")}function Mr(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Wr(t){return t==null?void 0:t.name.endsWith(".json")}function Ur(t){if(t.size===0)throw new Error("File is empty");if(t.size>15e5)throw new Error("File size limit (1.5MB) exceeded")}const Se=`${Pt}/db`;function ks(t){return Y.post(`${Se}/download`,{filename:t})}async function qr(t){try{const{data:s,name:n}=await Jr(t),a=JSON.stringify(s,null,2),i=os(a,"application/json;charset=utf-8;");Nt(i,`${n}.json`)}catch(s){console.error(s)}}async function Ds(t){const s=new FormData;return s.append("project",t),(await Y.post(`${Se}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Rs(t){return await Y.patch(Se,t)}async function zr(t){return(await Y.post(`${Se}/new`,t)).data}async function Br(t){return(await Y.post(`${Se}/quick`,t)).data}async function Kr(){return(await Y.get(`${Se}/all`)).data}async function Es(t){return(await Y.post(`${Se}/load`,{filename:t})).data}async function Hr(){return(await Y.post(`${Se}/demo`)).data}async function Gr(t,s){const n=`${Se}/${t}/duplicate`,a=decodeURIComponent(n);return(await Y.post(a,{newFilename:s})).data}async function Qr(t,s){const n=`${Se}/${t}/rename`,a=decodeURIComponent(n);return(await Y.put(a,{newFilename:s})).data}async function Yr(t){const s=`${Se}/${t}`,n=decodeURIComponent(s);return(await Y.delete(n)).data}async function Jr(t){const s=await ks(t),n=s.headers["Content-Disposition"];let a=t;if(n!=null){const i=n.indexOf('"')+1,l=n.lastIndexOf('"');a=n.substring(i,l)}return{data:s.data,name:a}}const Xr={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},Yt={stepData:Xr,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,summary:null,spreadsheetImportMap:_a},z=Ls((t,s)=>({...Yt,patchStepData:n=>{const a=s().stepData;t({stepData:{...a,...n}})},setWorksheets:n=>t({worksheetNames:n}),setSheetId:n=>t({sheetId:n}),setAuthenticationStatus:n=>t({authenticationStatus:n}),setRundown:n=>t({rundown:n}),setCustomFields:n=>t({customFields:n}),setSummary:n=>t({summary:n}),patchSpreadsheetImportMap:(n,a)=>{const i=s().spreadsheetImportMap;i[n]!==a&&(i[n]=a)},reset:()=>t(Yt),resetPreview:()=>t({rundown:null,customFields:null,summary:null})}));function ot(){const t=_t(),s=z(h=>h.patchStepData),n=z(h=>h.setRundown),a=z(h=>h.setCustomFields),i=z(h=>h.setSummary);return{connect:async(h,d)=>{try{return await Fr(h,d)}catch(x){s({authenticate:{available:!1,error:V(x)}})}},revoke:async()=>{try{return await Ir()}catch(h){s({authenticate:{available:!1,error:V(h)}})}},verifyAuth:async()=>{try{return await Ar()}catch(h){s({authenticate:{available:!1,error:V(h)}})}},importRundownPreview:async(h,d)=>{try{const x=await Lr(h,d);n(x.rundown),a(x.customFields),i(x.summary)}catch(x){s({pullPush:{available:!0,error:V(x)}})}},importRundown:async(h,d)=>{try{await Rs({rundowns:h,customFields:d}),await t.invalidateQueries({queryKey:[dn,un]})}catch(x){s({pullPush:{available:!0,error:V(x)}})}},exportRundown:async(h,d)=>{try{await $r(h,d),s({pullPush:{available:!1,error:""}})}catch(x){s({pullPush:{available:!0,error:V(x)}})}}}}const vt={Worksheet:"event schedule",Flag:"flag",Start:"time start","Link start":"link start",End:"time end",Duration:"duration",Cue:"cue",Title:"title","Count to end":"count to end",Skip:"skip",Note:"notes",Colour:"colour","End action":"end action","Timer type":"timer type","Time warning":"warning time","Time danger":"danger time",ID:"id",custom:[]};function Zr(t){return typeof t!="object"||t===null?!1:Object.keys(vt).every(n=>Object.hasOwn(t,n))}function Jt(t){const s=t.custom.reduce((n,{ontimeName:a,importName:i})=>(a&&i&&(n[a.trim()]=i.trim()),n),{});return{worksheet:t.Worksheet,flag:t.Flag,timeStart:t.Start,linkStart:t["Link start"],timeEnd:t.End,duration:t.Duration,cue:t.Cue,title:t.Title,countToEnd:t["Count to end"],skip:t.Skip,note:t.Note,colour:t.Colour,endAction:t["End action"],timerType:t["Timer type"],timeWarning:t["Time warning"],timeDanger:t["Time danger"],custom:s,id:t.ID}}function ei(t){localStorage.setItem("import-options",JSON.stringify(t))}function ti(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function si(){try{const t=ti();return Zr(t)?t:vt}catch{return vt}}const ni="_uploadSection_10owf_17",ai="_finishSection_10owf_18",ri="_error_10owf_40",ii="_success_10owf_43",li="_singleActionCell_10owf_47",Te={uploadSection:ni,finishSection:ai,error:ri,success:ii,singleActionCell:li};function oi({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:a,onSubmitImport:i}){const l=si(),{revoke:r}=ot(),{control:c,handleSubmit:m,register:o,setValue:u,watch:h,formState:{errors:d,isValid:x}}=ce({mode:"onChange",defaultValues:l,values:l}),{fields:j,append:p,remove:b}=et({control:c,name:"custom"}),v=z(N=>N.stepData),y=z(N=>N.worksheetNames),[S,L]=g.useState("");g.useEffect(()=>{!y||y.length===0||y.includes(l.Worksheet)||u("Worksheet",y[0],{shouldValidate:!0,shouldDirty:!0})},[y,u,l.Worksheet]);const R=async N=>{L("export");const T=Jt(N);await a(T),L("")},O=async()=>{await r(),n()},U=async N=>{L("import");const T=Jt(N);ei(N),await i(T),L("")},w=N=>{b(N)},$=()=>{p({})},_=!!S,G=s&&!_,q=!_&&!v.worksheet.error,F=!t&&x&&(G||q);return e.jsxs(P,{as:"form",id:"import-map",children:[e.jsxs(ye,{children:["Import options",e.jsxs(A,{children:[!s&&e.jsx(ys,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:O,disabled:_,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:_,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:m(R),disabled:!q,loading:S==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:m(U),disabled:!F,loading:S==="import",children:"Import preview"})]})]}),e.jsxs(me,{children:["Match your spreadsheet columns to Ontime fields. ",e.jsx("br",{}),"You can also add Custom Fields by providing a name for Ontime and the spreadsheet column name."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Ontime field"}),e.jsx("th",{children:"Column name in spreadsheet"}),e.jsx("th",{className:Te.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([N,T])=>N==="custom"?null:N==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:N}),e.jsx("td",{children:e.jsx(ae,{id:T,value:h(N),onValueChange:D=>u(N,D,{shouldDirty:!0}),options:(y==null?void 0:y.map(D=>({value:D,label:D})))||[]})}),e.jsx("td",{className:Te.singleActionCell})]},T):e.jsxs("tr",{children:[e.jsx("td",{children:N}),e.jsx("td",{children:e.jsx(M,{id:T,fluid:!0,maxLength:25,defaultValue:T,placeholder:"Use default column name",...o(N)})}),e.jsx("td",{className:Te.singleActionCell})]},T)),j.map((N,T)=>{var pe,de,le;const D=N.ontimeName,K=N.importName,I=(le=(de=(pe=d.custom)==null?void 0:pe[T])==null?void 0:de.ontimeName)==null?void 0:le.message,k=`custom.${T}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx(M,{maxLength:25,fluid:!0,defaultValue:D,placeholder:"Name of the field as shown in Ontime",...o(`custom.${T}.ontimeName`,{validate:C=>Ot.isAlphanumericWithSpace(C)?!0:"Only alphanumeric characters and space are allowed"})}),I&&e.jsx(E,{children:I})]}),e.jsx("td",{children:e.jsx(M,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...o(`custom.${T}.importName`)})}),e.jsx("td",{className:Te.singleActionCell,children:e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>w(T),children:e.jsx(xe,{})})})]},k)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(A,{as:"td",align:"end",children:e.jsxs(f,{onClick:$,children:["Add custom field ",e.jsx(je,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(E,{children:v.worksheet.error})]})}const ci="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function di(){return e.jsxs(me,{children:["Ontime can import data from spreadsheets by: ",e.jsx("br",{}),"- importing the spreadsheet file in Ontime ",e.jsx("br",{}),"- synchronising your project with a Google Sheet",e.jsx("br",{}),e.jsx("br",{}),"To synchronise with a Google Sheet, you will need to allow Ontime to authenticate with your Google account.",e.jsx(te,{href:ci,children:"See the docs"})]})}function ui(t){const{onCancel:s}=t,{revoke:n,connect:a,verifyAuth:i}=ot(),[l,r]=g.useState(null),[c,m]=g.useState(null),[o,u]=g.useState(""),[h,d]=g.useState(""),x=z(D=>D.sheetId),j=z(D=>D.setSheetId),p=z(D=>D.setWorksheets),b=z(D=>D.patchStepData),v=z(D=>D.authenticationStatus),y=z(D=>D.setAuthenticationStatus),S=z(D=>D.stepData.authenticate.error),L=async()=>{const D=await i();D&&y(D.authenticated)};g.useEffect(()=>{b({authenticate:{available:!1,error:""}}),$()},[]);const R=async()=>{u("cancel"),await n(),await L(),u("")},O=()=>{s()},U=D=>{var K;(K=D.target.files)!=null&&K.length&&r(D.target.files[0])},w=async()=>{if(!l||!x)return;b({worksheet:{available:!1,error:""}}),u("connect");const D=await a(l,x);D&&(d(D.verification_url),m(D.user_code)),u("")},$=async(D=0)=>{const K=await i();if(K!=null&&K.authenticated&&(y(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const I=await Cs(K.sheetId);p(I)}catch(I){const k=V(I);b({worksheet:{available:!1,error:k}})}u("");return}if(D<=10){setTimeout(()=>$(D+1),2e3);return}u("")},_=async()=>{u("authenticate"),Dt(h),window.addEventListener("focus",async()=>{$()},{once:!0})},G=l&&x,q=!!c&&!!h,F=!!o,N=v==="authenticated",T=v==="pending";return e.jsxs(P,{children:[e.jsxs(ye,{children:["Sync with Google Sheet (experimental)",N?e.jsx(f,{onClick:R,loading:o==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:O,children:"Go Back"})]}),e.jsxs(oe,{children:[e.jsx(ne,{children:"Upload Client Secret provided by Google"}),e.jsx(E,{children:S}),e.jsx(M,{fluid:!0,type:"file",onChange:U,accept:".json",disabled:F||q})]}),e.jsxs(oe,{children:[e.jsx(ne,{children:"Enter ID of sheet to synchronise"}),e.jsx(E,{children:void 0}),e.jsx(M,{fluid:!0,placeholder:"Sheet ID",onChange:D=>j(D.target.value),disabled:F||q})]}),q?e.jsx(oe,{children:e.jsxs(A,{children:[T&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Et,{copyValue:c??"",disabled:!q,children:c||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:_,disabled:!q,children:[e.jsx(Vs,{}),"Authenticate"]})]})}):e.jsx(oe,{children:e.jsx(A,{children:e.jsxs(f,{onClick:w,disabled:!G||F,loading:o==="connect",children:[e.jsx($s,{}),"Connect"]})})})]})}const hi="_center_l8uww_17",mi="_nowrap_l8uww_21",xi="_secondaryRow_l8uww_25",ji="_linkStartActive_l8uww_30",pi="_flex_l8uww_36",gi="_subdued_l8uww_42",ee={center:hi,nowrap:mi,secondaryRow:xi,linkStartActive:ji,flex:pi,subdued:gi};function xt(t){return t?"Yes":void 0}function fi({rundown:t,customFields:s}){let n=0;const a=Object.keys(s),i=a.map(l=>s[l].label);return e.jsxs(ve,{className:ee.nowrap,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Flag"}),e.jsx("th",{children:"Time Start"}),e.jsx("th",{children:"Time End"}),e.jsx("th",{children:"Duration"}),e.jsx("th",{children:"Warning Time"}),e.jsx("th",{children:"Danger Time"}),e.jsx("th",{children:"Count to end"}),e.jsx("th",{children:"Skip"}),e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Timer Type"}),e.jsx("th",{children:"End Action"}),i.map(l=>e.jsx("th",{children:l},l)),e.jsx("th",{children:"ID"})]})}),e.jsx("tbody",{children:t.flatOrder.map(l=>{const r=t.entries[l];if(sa(r)){const h=r.colour?ct(r.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{})," ",e.jsx("td",{children:r.title}),e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{style:{...h},children:r.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(d=>{let x="";return d in r.custom&&(x=r.custom[d]),e.jsx("td",{children:x},d)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]},r.id)}if(na(r)){const h=r.colour?ct(r.colour):{};return e.jsxs(g.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:ee.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{style:{...h},children:r.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(d=>{let x="";return d in r.custom&&(x=r.custom[d]),e.jsx("td",{children:x},d)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:ee.secondaryRow,children:["Note: ",r.note]})})]},r.id)}if(!gs(r))return null;n+=1;const c=r.colour?ct(r.colour):{},m=xt(r.countToEnd),o=xt(r.skip),u=xt(r.flag);return e.jsxs(g.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:ee.center,children:e.jsx(H,{children:n})}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:ee.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{className:ee.center,children:u&&e.jsx(H,{children:u})}),e.jsxs("td",{className:ee.flex,children:[e.jsx("span",{className:r.linkStart?ee.subdued:void 0,children:Ie(r.timeStart)}),r.linkStart&&e.jsx(Ms,{className:ee.linkStartActive})]}),e.jsx("td",{children:Ie(r.timeEnd)}),e.jsx("td",{children:Ie(r.duration)}),e.jsx("td",{children:Ie(r.timeWarning)}),e.jsx("td",{children:Ie(r.timeDanger)}),e.jsx("td",{className:ee.center,children:m&&e.jsx(H,{children:m})}),e.jsx("td",{children:o&&e.jsx(H,{children:o})}),e.jsx("td",{style:{...c},children:r.colour}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.timerType})}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.endAction})}),a.map(h=>{let d="";return h in r.custom&&(d=r.custom[h]),e.jsx("td",{children:d},h)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:ee.secondaryRow,children:["Note: ",r.note]})})]},r.id)})})]})}function bi({rundown:t,customFields:s,summary:n,onFinished:a,onCancel:i,onBack:l}){const{data:r}=fs(),[c,m]=g.useState(!1),{importRundown:o}=ot(),u=z(x=>x.resetPreview),h=()=>{u(),i()},d=async()=>{m(!0),await o({[r.id]:{...t,id:r.id,title:r.title}},s),m(!1),a()};return e.jsxs(P,{children:[e.jsxs(ye,{children:["Review Rundown",e.jsxs(A,{children:[e.jsx(f,{onClick:h,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{onClick:l,variant:"subtle",disabled:c,children:"Back"}),e.jsx(f,{onClick:d,variant:"primary",loading:c,children:"Apply"})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx("b",{children:"Title"})," ",t.title]}),e.jsxs(W,{children:[e.jsx("b",{children:"Number of entries"})," ",t.flatOrder.length]}),e.jsxs(W,{children:[e.jsx("b",{children:"Start time"})," ",Ie(n.start)]}),e.jsxs(W,{children:[e.jsx("b",{children:"End time"})," ",Ie(n.end)]}),e.jsxs(W,{children:[e.jsx("b",{children:"Total duration"})," ",hn(n.duration)]})]}),e.jsx(fi,{rundown:t,customFields:s})]})}function yi(){const[t,s]=g.useState("none"),[n,a]=g.useState(""),[i,l]=g.useState("none"),{exportRundown:r,importRundownPreview:c,verifyAuth:m}=ot(),o=z(C=>C.setWorksheets),u=z(C=>C.authenticationStatus),h=z(C=>C.setAuthenticationStatus),d=z(C=>C.rundown),x=z(C=>C.setRundown),j=z(C=>C.customFields),p=z(C=>C.setCustomFields),b=z(C=>C.summary),v=z(C=>C.setSummary),y=z(C=>C.setSheetId),S=z(C=>C.sheetId),L=z(C=>C.resetPreview),R=g.useRef(null),O=async C=>{var Ce;const Z=(Ce=C.target.files)==null?void 0:Ce[0];if(!Z){o(null),l("none");return}try{l("loading"),Vr(Z);const De=await Pr(Z);o(De),s("excel"),l("done")}catch(De){const _e=mn(De);a(`Error uploading file: ${_e}`),o(null),l("none")}},U=()=>{var C;(C=R.current)==null||C.click()},w=()=>{s("none"),x(null),l("none"),o(null),p(null),v(null),a(""),y(null)},$=async()=>{const C=await m();if(C&&(h(C.authenticated),y(C.sheetId),C.authenticated==="authenticated"&&C.sheetId))try{const Z=await Cs(C.sheetId);o(Z)}catch(Z){const Ce=V(Z);a(`Error getting worksheets: ${Ce}`)}s("gsheet")},_=()=>{w()},G=async C=>{if(a(""),t==="excel")try{const Z=await Or(C);x(Z.rundown),p(Z.customFields),v(Z.summary)}catch(Z){a(V(Z))}if(t==="gsheet"){if(!S)return;await c(S,C)}},q=async()=>{if(w(),u==="authenticated"){const C=await m();C&&h(C.authenticated)}},F=()=>{s("finished"),x(null),l("none"),o(null),p(null),a("")},N=async C=>{S&&await r(S,C)},T=t==="excel",D=t==="gsheet",K=u==="authenticated",I=t==="none",k=t==="finished",pe=D&&!K,de=D&&K||T&&i==="done",le=d!==null&&j!==null&&b!==null;return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(E,{children:n}),I&&e.jsxs(e.Fragment,{children:[e.jsx(di,{}),e.jsx("input",{ref:R,style:{display:"none"},type:"file",onChange:O,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Te.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:U,loading:i==="loading",children:[e.jsx(Ge,{}),"Import from spreadsheet"]}),e.jsx(ne,{children:"Accepts .xlsx files"})]}),e.jsx(pa,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:$,disabled:i!=="none",children:[e.jsx(Ws,{}),"Synchronise with Google"]}),e.jsx(ne,{children:"Start authentication process"})]})]})]}),k&&e.jsxs("div",{className:Te.finishSection,children:[n?e.jsx("span",{className:Te.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Te.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:w,children:"Return"})]}),pe&&e.jsx(ui,{onCancel:_}),de&&!le&&e.jsx(oi,{hasErrors:!!n,isSpreadsheet:T,onCancel:q,onSubmitExport:N,onSubmitImport:G}),le&&e.jsx(bi,{rundown:d,customFields:j,summary:b,onFinished:F,onCancel:q,onBack:L})]})})}const vi="_halfWidth_6p65m_17",wi="_fullWidth_6p65m_21",Si="_twoCols_6p65m_25",Ci="_current_6p65m_31",st={halfWidth:vi,fullWidth:wi,twoCols:Si,current:Ci};function Ns({onSubmit:t,onCancel:s,initialColour:n,initialLabel:a,initialKey:i}){const{data:l}=lt(),[r,c]=g.useState(n||""),{handleSubmit:m,register:o,setFocus:u,setError:h,setValue:d,getValues:x,watch:j,formState:{errors:p,isSubmitting:b,isValid:v,isDirty:y}}=ce({defaultValues:{type:"text",label:a||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),S=async w=>{const{type:$,label:_,colour:G}=w,q={type:$,colour:G,label:_};try{await t(q)}catch(F){h("root",{type:"custom",message:V(F)})}};g.useEffect(()=>{u("label")},[u]);const L=w=>{c(w),d("colour",w,{shouldDirty:!0})},R=x("colour"),O=y&&v,U=i!==void 0;return e.jsxs($e,{as:"form",onSubmit:m(S),onKeyDown:w=>we(w,s),children:[e.jsxs(me,{children:["Please note that images can quickly deteriorate your app's performance.",e.jsx("br",{}),"Prefer using small, and compressed images."]}),e.jsxs("div",{children:[e.jsx(ne,{children:"Type"}),e.jsx(ps,{orientation:"horizontal",disabled:U,onValueChange:w=>d("type",w,{shouldDirty:!0}),value:j("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:st.twoCols,children:[e.jsxs("label",{children:[e.jsx(ne,{children:"Label (only alphanumeric characters are allowed)"}),p.label&&e.jsx(E,{children:p.label.message}),e.jsx(M,{...o("label",{required:{value:!0,message:"Required field"},onChange:()=>d("key",Ca(x("label"))??"N/A"),validate:w=>w.trim().length===0?"Required field":Ot.isAlphanumericWithSpace(w)?!U&&U&&Object.keys(l).includes(w)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(ne,{children:"Key (use in Integrations and API)"}),e.jsx(M,{...o("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(ne,{children:"Colour"}),e.jsx(Un,{name:"colour",value:R,handleChange:(w,$)=>L($)})]}),p.root&&e.jsx(E,{children:p.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!O,loading:b,children:"Save"})]})]})}function _i(t){const{colour:s,label:n,fieldKey:a,type:i,onEdit:l,onDelete:r}=t,[c,m]=g.useState(!1),o=async u=>{await l(a,u),m(!1)};return c?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ns,{onCancel:()=>m(!1),onSubmit:o,initialColour:s,initialLabel:n,initialKey:a})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(qn,{color:s})}),e.jsx("td",{children:e.jsx(H,{children:i})}),e.jsx("td",{className:st.halfWidth,children:n}),e.jsx("td",{className:st.fullWidth,children:e.jsx(Et,{size:"small",copyValue:a,children:a})}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>m(!0),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>r(a),children:e.jsx(xe,{})})]})]})}function ki(){const{data:t,refetch:s}=lt(),[n,a]=g.useState(!1),i=()=>{a(!0)},l=()=>{a(!1)},r=async o=>{await ua(o),s(),a(!1)},c=async(o,u)=>{await ha(o,u),s()},m=async o=>{try{await ma(o),s()}catch{}};return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Custom fields",e.jsxs(f,{onClick:i,children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:["Custom fields allow for additional information to be added to an event.",e.jsx("br",{}),e.jsx("br",{}),"To use custom fields as a data source in an"," ",e.jsx(vs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(te,{href:xn,children:"See the docs"})]})}),e.jsxs(P,{children:[n&&e.jsx(Ns,{onSubmit:r,onCancel:l}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Key (used in Automations)"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:Object.entries(t).map(([o,{colour:u,label:h,type:d}])=>e.jsx(_i,{fieldKey:o,colour:u,label:h,type:d,onEdit:c,onDelete:m},o))})]})]})]})})}function Di(){const{data:t,status:s,isError:n,refetch:a,isFetching:i}=St({queryKey:ge,queryFn:ca,placeholderData:(l,r)=>l,refetchInterval:hs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:a,isFetching:i}}function Ps(){const t=_t(),{mutateAsync:s}=qe({mutationFn:aa,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:n}=qe({mutationFn:ra,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:a}=qe({mutationFn:([r,c])=>ia(r,c),onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:i}=qe({mutationFn:la,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:l}=qe({mutationFn:oa,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}});return{create:s,duplicate:n,remove:i,load:l,rename:a}}function Ri({onSubmit:t,onCancel:s,initialTitle:n}){const{handleSubmit:a,register:i,setFocus:l,setError:r,formState:{errors:c,isSubmitting:m,isValid:o,isDirty:u}}=ce({defaultValues:{title:n},mode:"onChange"}),h=async x=>{try{await t(x.title)}catch(j){r("root",{type:"custom",message:V(j)})}};g.useEffect(()=>{l("title")},[l]);const d=u&&o;return e.jsxs($e,{as:"form",onSubmit:a(h),onKeyDown:x=>we(x,s),children:[e.jsxs("label",{children:[e.jsx(ne,{children:"Rundown title"}),e.jsx(M,{...i("title",{required:{value:!0,message:"Title is required"},validate:x=>x.trim().length===0?"Title cannot be empty":Ot.isAlphanumericWithSpace(x)===!1?"Title can only contain alphanumeric characters, spaces and underscores":!0}),fluid:!0}),c.title&&e.jsx(E,{children:c.title.message})]}),c.root&&e.jsx(E,{children:c.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!d,loading:m,children:"Save"})]})]})}function Ei({onClose:t}){const{create:s}=Ps(),{handleSubmit:n,register:a,setFocus:i,setError:l,formState:{errors:r,isSubmitting:c}}=ce({defaultValues:{title:""}}),m=async o=>{try{await s(o.title||"untitled"),t()}catch(u){l("root",{message:`Failed to create rundown. ${u}`})}};return g.useEffect(()=>{i("title")},[i]),e.jsxs($e,{as:"form",onSubmit:n(m),children:[e.jsx(P,{children:e.jsxs("label",{children:[e.jsx(ne,{children:"Rundown title"}),e.jsx(M,{...a("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:c,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:c,children:"Create rundown"})]}),r.root&&e.jsx(E,{children:r.root.message})]})}function Ni(){var $;const{data:t}=Di(),{duplicate:s,remove:n,load:a,rename:i}=Ps(),[l,r]=Ee(),[c,m]=Ee(),[o,u]=Ee(),[h,d]=g.useState(""),[x,j]=g.useState(null),[p,b]=g.useState(null),v=_=>{b(null),d(_),m.open()},y=_=>{b(null),d(_),r.open()},S=_=>{b(null),j(_)},L=async()=>{try{await a(h)}catch(_){b(`Failed to load rundown. ${V(_)}`)}finally{m.close()}},R=async _=>{b(null),j(null),d("");try{await s(_)}catch(G){b(`Failed to duplicate rundown. ${V(G)}`)}},O=async(_,G)=>{try{await i([_,G]),j(null)}catch(q){b(`Failed to rename rundown. ${V(q)}`)}},U=async()=>{try{await n(h)}catch(_){b(`Failed to delete rundown. ${V(_)}`)}finally{r.close()}},w=async(_,G)=>{await Tr(_,G)};return e.jsxs(e.Fragment,{children:[e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage project rundowns",e.jsx(A,{children:e.jsxs(f,{onClick:()=>{b(null),u.open()},children:["New ",e.jsx(je,{})]})})]}),e.jsx(ie,{}),e.jsxs(P,{children:[o&&e.jsx(Ei,{onClose:u.close}),p&&e.jsx(E,{children:p}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"# Entries"}),e.jsx("th",{style:{width:"100%"},children:"Title"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:($=t==null?void 0:t.rundowns)==null?void 0:$.map(({id:_,numEntries:G,title:q})=>{const F=t.loaded===_;return x===_?e.jsx("tr",{children:e.jsx("td",{colSpan:3,children:e.jsx(Ri,{onCancel:()=>j(null),onSubmit:T=>O(_,T),initialTitle:q})})},_):e.jsxs("tr",{className:be([F&&st.current]),children:[e.jsx("td",{children:G}),e.jsxs("td",{children:[q," ",F&&e.jsx(H,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(xs,{render:e.jsx(X,{variant:"ghosted-white"}),items:[{type:"item",icon:ns,label:"Rename",onClick:()=>S(_)},{type:"item",icon:Ge,label:"Load",onClick:()=>v(_),disabled:F},{type:"item",icon:as,label:"Download .xlsx",onClick:()=>w(_,q)},{type:"item",icon:Us,label:"Duplicate",onClick:()=>R(_)},{type:"divider"},{type:"destructive",icon:xe,label:"Delete",onClick:()=>y(_),disabled:F}],children:e.jsx(rs,{})})})]},_)})})]})]})]})}),e.jsx(ft,{isOpen:l,onClose:r.close,title:"Delete 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(f,{size:"large",onClick:r.close,children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"large",onClick:U,children:"Delete rundown"})]})}),e.jsx(ft,{isOpen:c,onClose:m.close,title:"Load rundown",showBackdrop:!0,showCloseButton:!0,bodyElements:e.jsxs(e.Fragment,{children:["The current playback will be stopped. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{size:"large",onClick:m.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:L,children:"Load rundown"})]})})]})}function Pi(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:a,defaultDangerTime:i,defaultTimerType:l,defaultEndAction:r,setDefaultDuration:c,setLinkPrevious:m,setTimeStrategy:o,setWarnTime:u,setDangerTime:h,setDefaultTimerType:d,setDefaultEndAction:x}=bs(v=>v),j=He(t),p=He(a),b=He(i);return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Rundown defaults"}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(ye,{children:"Default settings for new events"}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(ke,{size:"large",checked:s,onCheckedChange:m})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ae,{value:n,onValueChange:v=>o(v),options:[{value:qt.LockDuration,label:"Duration"},{value:qt.LockEnd,label:"End Time"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Default duration",description:"Default duration for new events"}),e.jsx(Ke,{name:"defaultDuration",submitHandler:(v,y)=>c(y),time:j,placeholder:Be.duration})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ae,{value:l,onValueChange:v=>d(v),options:[{value:Ye.CountDown,label:"Count down"},{value:Ye.CountUp,label:"Count up"},{value:Ye.Clock,label:"Clock"},{value:Ye.None,label:"None"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"End Action",description:"Default end action for new events"}),e.jsx(ae,{value:r,onValueChange:v=>x(v),options:[{value:ht.None,label:"None"},{value:ht.LoadNext,label:"Load next"},{value:ht.PlayNext,label:"Play next"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Ke,{name:"warnTime",submitHandler:(v,y)=>u(y),time:p,placeholder:Be.warnTime})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Ke,{name:"dangerTime",submitHandler:(v,y)=>h(y),time:b,placeholder:Be.dangerTime})]})]})]})]})})}function Oi({location:t}){const s=re("defaults",t),n=re("custom",t),a=re("rundowns",t),i=re("sheets",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(Pi,{})}),e.jsx("div",{ref:n,children:e.jsx(ki,{})}),e.jsx("div",{ref:a,children:e.jsx(Ni,{})}),e.jsx("div",{ref:i,children:e.jsx(yi,{})})]})}const Ti="_textEntry_1xa10_17",Ai="_inlineEntry_1xa10_25",Fi="_redirect_1xa10_32",Ii="_label_1xa10_36",Pe={textEntry:Ti,inlineEntry:Ai,redirect:Fi,label:Ii};function Li({id:t,isOpen:s,name:n,currentPath:a,origin:i,onClose:l}){const{data:r}=ds(),[c,m]=g.useState(a),[o,u]=g.useState("/"),{setRedirect:h}=ms,d=p=>{p==="/"||p===a||(p.startsWith("preset-")?h({target:t,redirect:p.slice(7)}):h({target:t,redirect:p}),l())},x=r.filter(p=>p.enabled),j=[...jn.map(p=>({value:`/${p.url}`,label:p.label})),...x.map(p=>({value:`preset-${p.alias}`,label:`URL Preset: ${p.alias}`}))];return e.jsx(it,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(me,{children:["Remotely redirect the client to a different URL. ",e.jsx("br",{}),"Either by entering a custom path or selecting a URL Preset.",e.jsx("br",{}),e.jsx("br",{}),e.jsx(vs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:Pe.inlineEntry,children:[e.jsx("span",{className:Pe.label,children:"Enter custom path"}),e.jsxs("label",{className:Pe.textEntry,children:[i,e.jsx(M,{placeholder:"eg. /timer",fluid:!0,value:c,onChange:p=>m(p.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:c===a||c==="",className:Pe.redirect,onClick:()=>d(c),children:["Redirect",e.jsx(Lt,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:Pe.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:Pe.inlineEntry,children:[e.jsxs("label",{className:Pe.textEntry,children:[i,e.jsx(ae,{fluid:!0,options:j,defaultValue:j[0].value,onValueChange:p=>u(p),disabled:x.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:Pe.redirect,disabled:x.length===0||o==="/",onClick:()=>d(o),children:["Redirect ",e.jsx(Lt,{})]})]})]})]})})}const $i="_blink_vtewd_1",Vi="_halfWidthNoWrap_vtewd_25",Mi="_copiable_vtewd_30",wt="_self_vtewd_35",ze={blink:$i,halfWidthNoWrap:Vi,copiable:Mi,self:wt};function Wi(){const t=Mt(j=>j.id),s=Mt(j=>j.clients),[n,a]=Ee(),[i,l]=Ee(),{setIdentify:r}=ms,[c,m]=g.useState(""),o=j=>{m(j),l.open()},u=j=>{m(j),a.open()},h=Object.entries(s).filter(([j,{type:p}])=>p==="ontime"),d=Object.entries(s).filter(([j,{type:p}])=>p!=="ontime"),x=s[c];return e.jsxs(e.Fragment,{children:[n&&x!==void 0&&e.jsx(Li,{id:c,name:x.name,origin:x.origin,currentPath:x.path,isOpen:n,onClose:a.close}),i&&e.jsx(pn,{id:c,name:x==null?void 0:x.name,isOpen:i,onClose:l.close}),e.jsxs(P,{children:[e.jsxs(ye,{children:["Ontime Clients (",h.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:{width:"20%"},children:"Client Name"}),e.jsx("td",{children:"Path"}),e.jsx("td",{})]})}),e.jsx("tbody",{children:h.map(([j,p])=>{const{identify:b,name:v,path:y}=p,S=t===j;return e.jsxs("tr",{className:be([S&&ze.self]),children:[e.jsxs(A,{relation:"inner",as:"td",children:[S&&e.jsx(H,{children:"SELF"}),v]}),e.jsx("td",{className:ze.copiable,children:y}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${b?ze.blink:""}`,disabled:S,variant:b?"primary":"subtle","data-testid":S?"":"not-self-identify",onClick:()=>{r({target:j,identify:!b})},children:"Identify"}),e.jsx(f,{size:"small","data-testid":S?"":"not-self-rename",onClick:()=>o(j),children:"Rename"}),e.jsx(f,{size:"small",disabled:S,"data-testid":S?"":"not-self-redirect",onClick:()=>u(j),children:"Redirect"})]})]},j)})})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsxs(ye,{children:["Other Clients (",d.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:ze.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:ze.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:d.map(([j,p])=>{const{name:b,type:v}=p;return e.jsxs("tr",{children:[e.jsx("td",{children:b}),e.jsx("td",{children:v})]},j)})})]})]})]})}function Ui(){return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Manage clients"}),e.jsx(ie,{}),e.jsx(Wi,{})]})})}const qi="_iconRotate_l21m9_17",zi={iconRotate:qi};function Bi(){const t=s=>{us("log",s)};return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(Ct,{className:zi.iconRotate})]})]}),e.jsx(ie,{}),e.jsx(gn,{})]})})}function Ki({location:t}){const s=re("clients",t),n=re("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Network"}),fn,e.jsx("div",{ref:n,children:e.jsx(Bi,{})}),e.jsx("div",{ref:s,children:e.jsx(Ui,{})})]})}const Xt={project:{title:""},settings:{timeFormat:"24",language:"en"}};function Hi({isOpen:t,onClose:s}){var v,y,S,L;const{defaultWarnTime:n,defaultDangerTime:a,setDangerTime:i,setWarnTime:l}=bs(),{handleSubmit:r,register:c,formState:{errors:m,isSubmitting:o,isValid:u},watch:h,setError:d,setValue:x}=ce({defaultValues:Xt,values:Xt,resetOptions:{keepDirtyValues:!0}}),j=async R=>{try{R.project.title===""&&(R.project.title="untitled"),await Br(R),await We(),s()}catch(O){d("root",{message:V(O)})}},p=He(n),b=He(a);return e.jsx(it,{isOpen:t,onClose:s,showBackdrop:!0,showCloseButton:!0,title:"Create new project...",bodyElements:e.jsxs("form",{onSubmit:r(j),id:"quick-start",children:[e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Project title",description:"Shown as the title in some views"}),e.jsx(M,{maxLength:150,placeholder:"Project title",fluid:!0,...c("project.title")})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Time format",description:"Default time format to show in views 12 / 24 hours (does not affect editor)",error:(y=(v=m.settings)==null?void 0:v.timeFormat)==null?void 0:y.message}),e.jsx(ae,{value:h("settings.timeFormat"),onValueChange:R=>x("settings.timeFormat",R,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Views language",description:"Language to be displayed in views",error:(L=(S=m.settings)==null?void 0:S.language)==null?void 0:L.message}),e.jsx(ae,{value:h("settings.language"),onValueChange:R=>x("settings.language",R,{shouldDirty:!0}),defaultValue:"en",options:[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Ke,{name:"warnTime",submitHandler:(R,O)=>l(O),time:p,placeholder:Be.warnTime})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Ke,{name:"dangerTime",submitHandler:(R,O)=>i(O),time:b,placeholder:Be.dangerTime})]})]})]}),footerElements:e.jsxs(e.Fragment,{children:[(m==null?void 0:m.root)&&e.jsx(E,{children:m.root.message}),e.jsx(f,{variant:"ghosted",onClick:s,disabled:!1,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",form:"quick-start",disabled:!u,loading:o,children:"Create project"})]})})}const Gi="_current_13n43_17",Qi="_isEditing_13n43_21",Yi="_form_13n43_25",Ji="_formInput_13n43_33",Xi="_saveButton_13n43_37",Zi="_containCell_13n43_41",el="_sortableHeader_13n43_45",tl="_innerColumn_13n43_55",sl="_inlineLabels_13n43_63",nl="_warningInfo_13n43_68",al="_empty_13n43_72",he={current:Gi,isEditing:Qi,form:Yi,formInput:Ji,saveButton:Xi,containCell:Zi,sortableHeader:el,innerColumn:tl,inlineLabels:sl,warningInfo:nl,empty:al};function rl({onClose:t}){const[s,n]=g.useState(null),{handleSubmit:a,register:i,formState:{isSubmitting:l,isValid:r},setFocus:c}=ce({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{c("title")},[c]);const m=async o=>{try{n(null);const u=o.title??"untitled";await zr({filename:u}),t()}catch(u){n(V(u))}};return e.jsxs($e,{as:"form",onSubmit:a(m),onKeyDown:o=>we(o,t),children:[e.jsxs(ye,{children:["Create new project",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:l,children:"Cancel"}),e.jsx(f,{disabled:!r,type:"submit",loading:l,variant:"primary",children:"Create project"})]})]}),s&&e.jsx(E,{children:s}),e.jsxs(P,{className:he.innerColumn,children:[e.jsx(ne,{children:"Project title"}),e.jsx(M,{fluid:!0,placeholder:"Your project name",...i("title")})]})]})}const il={files:[],lastLoadedProject:""};function ll(){const{data:t,status:s,refetch:n}=St({queryKey:bn,queryFn:Kr,placeholderData:(a,i)=>a,retry:5,retryDelay:a=>a*2500,refetchInterval:hs,networkMode:"always"});return{data:t??il,status:s,refetch:n}}const ol={"alphabetical-asc":(t,s)=>t.filename.localeCompare(s.filename),"alphabetical-desc":(t,s)=>s.filename.localeCompare(t.filename),"modified-asc":(t,s)=>new Date(t.updatedAt).getTime()-new Date(s.updatedAt).getTime(),"modified-desc":(t,s)=>new Date(s.updatedAt).getTime()-new Date(t.updatedAt).getTime()};function Os(t="modified-desc"){const s=ll(),{files:n,lastLoadedProject:a}=s.data,i=g.useMemo(()=>{if(!n.length)return[];const l=[...n].sort(ol[t]),r=l.findIndex(c=>c.filename===a);if(r>0){const[c]=l.splice(r,1);l.unshift(c)}return l},[n,a,t]);return{...s,data:{reorderedProjectFiles:i,lastLoadedProject:s.data.lastLoadedProject}}}function cl({action:t,filename:s,onSubmit:n,onCancel:a}){const{handleSubmit:i,register:l,formState:{isSubmitting:r,isDirty:c,isValid:m},setFocus:o}=ce({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return g.useEffect(()=>{o("filename")},[o]),e.jsxs("form",{onSubmit:i(n),onKeyDown:u=>we(u,a),className:he.form,children:[e.jsx(M,{className:he.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{onClick:a,variant:"ghosted",disabled:r,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!c||!m||r,type:"submit",className:he.saveButton,children:t})]})]})}async function dl(t,s){const n={};for(const a in s)da(a,t)&&s[a]&&(a==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[a]:t[a]}));return n}function ul({onClose:t,fileName:s}){const[n,a]=g.useState(null),i=_t(),{handleSubmit:l,watch:r,setValue:c,formState:{isSubmitting:m,isValid:o,isDirty:u}}=ce({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),h=async d=>{if(Object.values(d).every(j=>!j)){a("At least one option must be selected");return}try{a(null);const{data:j}=await ks(s);if(!j.settings.version.startsWith("4.")){a("The project you are attempting to merge is from an older version and it need to be migrated first");return}const p=await dl(j,d);await Rs(p),await i.invalidateQueries({queryKey:yn}),t()}catch(j){a(V(j))}};return e.jsxs(P,{as:"form",onSubmit:l(h),children:[e.jsxs(ye,{children:["Partial project merge",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:m,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:!o||!u,loading:m,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(E,{children:n}),e.jsxs(P,{className:be([he.innerColumn,he.inlineLabels]),children:[e.jsxs(ne,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(me,{type:"warning",children:["This process is irreversible and can result in data loss. ",e.jsx("br",{}),"You may want to create a duplicate backup beforehand."]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("project"),onCheckedChange:d=>c("project",d,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("rundowns"),onCheckedChange:d=>c("rundowns",d,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("viewSettings"),onCheckedChange:d=>c("viewSettings",d,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("urlPresets"),onCheckedChange:d=>c("urlPresets",d,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("automation"),onCheckedChange:d=>c("automation",d,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function hl({current:t,updatedAt:s,editingFilename:n,editingMode:a,filename:i,onRefetch:l,onSubmit:r,onToggleEditMode:c}){const[m,o]=g.useState(null),[u,h]=g.useState(!1),d=R=>async O=>{h(!0),o(null);try{if(!O.filename){o("Filename cannot be blank");return}await(R==="rename"?Qr:Gr)(i,O.filename),await l(),r()}catch(U){o(V(U))}finally{h(!1)}},x=async R=>{h(!0),o(null);try{await Es(R),await l(),await We()}catch(O){o(V(O))}finally{h(!1)}},j=async R=>{h(!0),o(null);try{await Yr(R),await l()}catch(O){o(V(O))}finally{h(!1)}},p=(R,O)=>{o(null),c(R,O)},b=()=>{p(null,null)},v=i===n,y=(a==="rename"||a==="duplicate")&&i===n,S=a==="merge"&&v,L=be([t&&!v&&he.current,v&&he.isEditing]);return e.jsxs(e.Fragment,{children:[m&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(E,{children:m})})},"filename-error"),e.jsx("tr",{className:L,children:y?e.jsx("td",{colSpan:99,children:e.jsx(cl,{action:a,filename:i,onSubmit:d(a==="duplicate"?"duplicate":"rename"),onCancel:b})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:he.containCell,children:i}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(ml,{current:t,filename:i,onChangeEditMode:p,onDelete:j,onLoad:x,isDisabled:u||S,onMerge:R=>p("merge",R)})})]})},i),S&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(ul,{onClose:b,fileName:i})})})]})}function ml(t){const{current:s,filename:n,isDisabled:a,onChangeEditMode:i,onDelete:l,onLoad:r,onMerge:c}=t,m=()=>{i("rename",n)},o=()=>{i("duplicate",n)},u=async()=>{await qr(n)};return e.jsx(xs,{render:e.jsx(X,{variant:"ghosted-white"}),disabled:a,items:[{type:"item",icon:Ge,label:"Load",onClick:()=>r(n),disabled:s},{type:"item",icon:Ge,label:"Partial Load",onClick:()=>c(n),disabled:s},{type:"item",icon:ns,label:"Rename",onClick:m},{type:"item",icon:qs,label:"Duplicate",onClick:o},{type:"item",icon:as,label:"Download",onClick:u},{type:"divider"},{type:"item",icon:xe,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(rs,{})})}function xl(){const[t,s]=g.useState(null),[n,a]=g.useState(null),[i,l]=g.useState("modified-desc"),{data:r,refetch:c,status:m}=Os(i),o=(j,p)=>{s(b=>b===j&&p===n?null:j),a(p)},u=()=>{s(null),a(null)},h=async()=>{await c()},d=j=>{l(p=>{const b=p===`${j}-asc`;return`${j}-${b?"desc":"asc"}`})};if(m==="pending")return e.jsx("div",{className:he.empty,children:e.jsx(Le,{isLoading:!0})});const x=r.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[x>20&&e.jsxs(me,{className:he.warningInfo,type:"warning",children:["You have ",x," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:he.containCell,onClick:()=>d("alphabetical"),children:e.jsxs("span",{className:he.sortableHeader,children:["File Name",e.jsx(Zt,{sortMode:i,type:"alphabetical"})]})}),e.jsx("th",{onClick:()=>d("modified"),children:e.jsxs("span",{className:he.sortableHeader,children:["Last Used",e.jsx(Zt,{sortMode:i,type:"modified"})]})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.reorderedProjectFiles.map(j=>e.jsx(hl,{filename:j.filename,updatedAt:j.updatedAt,onToggleEditMode:o,onSubmit:u,onRefetch:h,editingFilename:n,editingMode:t,current:j.filename===r.lastLoadedProject},j.filename))})]})]})}function Zt({sortMode:t,type:s}){const n=`${s}-`;return t===`${n}asc`?e.jsx(zs,{}):t===`${n}desc`?e.jsx(Ct,{}):null}function jl(){const[t,s]=is(),[n,a]=g.useState(""),[i,l]=g.useState(null),r=g.useRef(null),c=t.get("new")==="true",m=()=>{t.set("new",c?"false":"true"),s(t)},o=()=>{var d;(d=r.current)==null||d.click()},u=async d=>{var j,p;const x=(p=(j=d.target)==null?void 0:j.files)==null?void 0:p[0];if(x){l("import");try{_s(x),await Ds(x)}catch(b){const v=V(b);a(`Error uploading file: ${v}`)}finally{await We()}l(null)}},h=()=>{t.delete("new"),s(t)};return e.jsxs(P,{children:[e.jsx("input",{ref:r,style:{display:"none"},type:"file",onChange:u,accept:".json","data-testid":"file-input"}),e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage projects",e.jsxs(A,{children:[e.jsx(f,{onClick:o,disabled:!!i||c,loading:i==="import",children:"Import"}),e.jsxs(f,{onClick:m,disabled:!!i||c,children:["New ",e.jsx(je,{})]})]})]}),n&&e.jsx(E,{children:n}),e.jsx(ie,{}),c&&e.jsx(rl,{onClose:h}),e.jsx(xl,{})]})]})}function pl({location:t,setLocation:s}){const n=re("list",t),a=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Project"}),e.jsx(Hi,{isOpen:t==="create",onClose:a}),e.jsx("div",{ref:n,children:e.jsx(jl,{})})]})}const gl="_container_cq029_17",fl={container:gl};function es({register:t,formName:s,disabled:n}){const[a,i]=g.useState(!1);return e.jsxs("div",{className:fl.container,children:[e.jsx(M,{type:a?"text":"password",maxLength:4,...t(s,{pattern:{value:Yn,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(X,{onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(Bs,{})})]})}const bl=g.lazy(()=>Qe(()=>import("./CustomTranslationModal-CJ9-aDjl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url));function yl(){var R,O,U,w,$;const{data:t,status:s,refetch:n}=vn(),{handleSubmit:a,register:i,reset:l,setError:r,watch:c,setValue:m,formState:{isSubmitting:o,isDirty:u,isValid:h,errors:d}}=ce({mode:"onChange",defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}}),[x,j]=Ee();g.useEffect(()=>{t&&l(t)},[t,l]);const p=async _=>{try{await wn(_)}catch(G){const q=V(G);r("root",{message:q})}finally{await n()}},b=s==="pending",v=o||!u||!h,y="",S=()=>{l(t)},L=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(bl,{isOpen:x,onClose:j.close}),e.jsx(P,{as:"form",onSubmit:a(p),onKeyDown:_=>we(_,S),id:"app-settings",children:e.jsxs(se,{children:[e.jsxs(Q,{children:["General settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!u||o,variant:"ghosted",onClick:S,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:o,disabled:v,variant:"primary",children:"Save"})]})]}),y,e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(me,{children:"Changes to the time format and views language do not affect the editor view"}),e.jsx(Le,{isLoading:L}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Ontime server port",description:Me?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(R=d.serverPort)==null?void 0:R.message}),e.jsx(M,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Me,...i("serverPort",{required:{value:!0,message:"Required field"},max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"},pattern:{value:js,message:"Value should be numeric"}})})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(O=d.editorKey)==null?void 0:O.message}),e.jsx(es,{register:i,formName:"editorKey",disabled:b})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(U=d.operatorKey)==null?void 0:U.message}),e.jsx(es,{register:i,formName:"operatorKey",disabled:b})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Time format",description:"Default time format to show in views 12 / 24 hours",error:(w=d.timeFormat)==null?void 0:w.message}),e.jsx(ae,{value:c("timeFormat"),onValueChange:_=>m("timeFormat",_,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Views language",description:"Language to be displayed in views",error:($=d.language)==null?void 0:$.message}),e.jsx(ae,{value:c("language"),onValueChange:_=>m("language",_,{shouldDirty:!0}),disabled:b,defaultValue:"en",options:[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"},{value:"custom",label:"Custom"}]}),e.jsx(f,{onClick:j.open,children:"Edit custom translation"})]})]})]})]})})]})}const vl="_uploadLogoCard_m5263_17",wl="_customDataItem_m5263_32",Sl="_titleRow_m5263_39",Cl="_customImage_m5263_48",_l="_imageContainer_m5263_54",Ve={uploadLogoCard:vl,customDataItem:wl,titleRow:Sl,customImage:Cl,imageContainer:_l};function kl(){var q;const{data:t,status:s}=zn(),{updateProjectData:n}=Bn(),{handleSubmit:a,register:i,reset:l,formState:{isSubmitting:r,isValid:c,isDirty:m,errors:o},setError:u,clearErrors:h,watch:d,control:x,setValue:j}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:p,append:b,remove:v}=et({control:x,name:"custom"});g.useEffect(()=>{t&&l(t)},[t,l]);const y=async F=>{var T;const N=(T=F.target.files)==null?void 0:T[0];if(h("logo"),!!N)try{Ur(N);const D=await Kn(N);j("logo",D.data.logoFilename,{shouldDirty:!0})}catch(D){const K=V(D);u("logo",{message:K})}},{ref:S,...L}=i("logo"),R=g.useRef(null),O=()=>{var F;(F=R.current)==null||F.click()},U=F=>{F.preventDefault(),F.stopPropagation(),j("logo",null,{shouldDirty:!0})},w=()=>{b({title:"",value:"",url:""})},$=async F=>{try{h(),await n(F)}catch(N){const T=V(N);u("root",{message:T})}},_=()=>{l(t)},G=s==="pending";return e.jsx(P,{as:"form",onSubmit:a($),onKeyDown:F=>we(F,_),children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Project data",e.jsxs(A,{children:[e.jsx(f,{onClick:_,disabled:r||!m,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!m||!c,loading:r,children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:G}),e.jsxs("label",{children:["Project title",e.jsx(M,{fluid:!0,maxLength:50,placeholder:"Project title is shown in production views",...i("title")})]}),e.jsx(P,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...L,ref:F=>{S(F),R.current=F},onChange:y}),e.jsxs(se,{className:Ve.uploadLogoCard,children:[d("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${Sn}/${d("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:r||!d("logo"),onClick:U,children:[e.jsx(xe,{}),"Delete"]})]}):e.jsxs(f,{disabled:r,onClick:O,type:"button",children:[e.jsx(Ge,{}),"Upload logo"]}),((q=o==null?void 0:o.logo)==null?void 0:q.message)&&e.jsx(E,{children:o.logo.message})]})]})}),e.jsxs("label",{children:["Project description",e.jsx(M,{fluid:!0,maxLength:100,placeholder:"Euro Love, Malmö 2024",...i("description")})]}),e.jsxs("label",{children:["Project info",e.jsx(bt,{fluid:!0,maxLength:150,placeholder:"Wi-Fi password: 1234",resize:"vertical",...i("info")})]}),e.jsxs("label",{children:["Project QR code URL",e.jsx(M,{fluid:!0,placeholder:Rt,...i("url")})]}),e.jsxs(P,{style:{marginTop:0},children:[e.jsxs(W,{children:[e.jsx(B,{title:"Custom data",description:""}),e.jsxs(f,{onClick:w,children:["Add ",e.jsx(je,{})]})]}),p.length>0&&p.map((F,N)=>{var D,K,I;const T=(D=o.custom)==null?void 0:D[N];return e.jsxs("div",{className:Ve.customDataItem,children:[e.jsxs("div",{className:Ve.titleRow,children:[e.jsxs("label",{className:Ve.title,children:["Title",e.jsx(M,{fluid:!0,defaultValue:F.title,placeholder:"Title of your custom data",...i(`custom.${N}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>v(N),children:[e.jsx(xe,{}),"Delete"]})]}),((K=T==null?void 0:T.title)==null?void 0:K.message)&&e.jsx(E,{children:T.title.message}),e.jsxs("label",{children:["Text",e.jsx(bt,{fluid:!0,rows:3,resize:"vertical",defaultValue:F.value,placeholder:"Text of your custom data",...i(`custom.${N}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),((I=T==null?void 0:T.value)==null?void 0:I.message)&&e.jsx(E,{children:T.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Ve.customImage,children:[e.jsx(M,{fluid:!0,defaultValue:F.url,placeholder:"Paste image URL (optional)",...i(`custom.${N}.url`)}),e.jsx("div",{className:Ve.imageContainer,children:d(`custom.${N}.url`)&&e.jsx("img",{src:d(`custom.${N}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},F.id)})]})]})]})})}const Dl="_editorActions_18rtd_17",Rl="_right_18rtd_21",El="_column_18rtd_26",jt={editorActions:Dl,right:Rl,column:El},Nl=g.lazy(()=>Qe(()=>import("./StyleEditor-BvcE8dkA.js"),__vite__mapDeps([11,1,2,12]),import.meta.url));function Pl({isOpen:t,onClose:s}){const[n,a]=g.useState(""),[i,l]=g.useState(!1),[r,c]=g.useState(!1),[m,o]=g.useState(!1),[u,h]=g.useState(null),d=g.useRef(null),x=async()=>{try{o(!0);const b=await Cn();a(b)}catch{}finally{o(!1)}},j=async()=>{try{c(!0),d.current&&(await _n(d.current.getCss()),a(d.current.getCss()),l(!1))}catch{}finally{c(!1)}},p=()=>a("");return g.useEffect(()=>{async function b(){if(t)try{const v=await kn();a(v)}catch{h("Failed to load CSS from server")}}b()},[t]),e.jsx(it,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(Nl,{ref:d,initialValue:n,language:"css",isDirty:i,setIsDirty:l}),footerElements:e.jsxs("div",{className:jt.column,children:[e.jsx(me,{children:"Invalid CSS will be refused by the browser"}),u&&e.jsx(E,{className:jt.right,children:`Error: ${u}`}),e.jsxs(A,{align:"apart",className:jt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:x,disabled:r||m,children:"Reset to example"}),e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:p,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:j,disabled:r||m||!i,loading:r,children:"Save changes"})]})]})]})})}const Ol="https://docs.getontime.no/features/custom-styling/";function Tl(){var b;const{data:t,status:s,mutateAsync:n}=Dn(),[a,i]=Ee(),{control:l,handleSubmit:r,setError:c,reset:m,setValue:o,watch:u,formState:{isSubmitting:h,isDirty:d,errors:x}}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{t&&m(t)},[t,m]);const j=async v=>{try{n(v)}catch(y){const S=V(y);c("root",{message:S})}},p=()=>{m(t)};return l?e.jsx(P,{as:"form",onSubmit:r(j),onKeyDown:v=>we(v,p),id:"view-settings",children:e.jsxs(se,{children:[e.jsxs(Q,{children:["View settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!d,variant:"ghosted",onClick:p,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:h,disabled:!d,variant:"primary",children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(me,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(te,{href:Ol,children:"See the docs"})]}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:s==="pending"}),e.jsx(E,{children:(b=x.root)==null?void 0:b.message}),e.jsxs(oe,{children:[e.jsx(Pl,{isOpen:a,onClose:i.close}),e.jsxs(W,{children:[e.jsx(B,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(ke,{size:"large",checked:u("overrideStyles"),onCheckedChange:v=>o("overrideStyles",v,{shouldDirty:!0})}),e.jsx(f,{onClick:i.open,disabled:h,children:"Edit CSS override"})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(ut,{name:"normalColor",control:l})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(ut,{name:"warningColor",control:l})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(ut,{name:"dangerColor",control:l})]})]})]})]})}):null}function Al({location:t}){const s=re("data",t),n=re("general",t),a=re("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(kl,{})}),e.jsx("div",{ref:n,children:e.jsx(yl,{})}),e.jsx("div",{ref:a,children:e.jsx(Tl,{})})]})}function Fl(){const{isElectron:t,sendToElectron:s}=Rn(),[n,a]=Ee(),i=g.useRef(null),l=()=>{s("shutdown","now"),a.close()},r=t||tt;return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Shutdown Ontime"}),e.jsxs(P,{children:[Me?e.jsx(En,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(Ne,{children:["This will shutdown the Ontime server. ",e.jsx("br",{}),"The runtime state will be lost, but your project is kept for next time."]}),e.jsx(f,{variant:"destructive",onClick:a.open,disabled:!(t||tt),children:"Shutdown ontime"}),!r&&e.jsx(ne,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(ft,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:a.close,bodyElements:e.jsxs(Ne,{children:["This will shutdown the Ontime server. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{ref:i,onClick:a.close,variant:"ghosted-white",children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:l,disabled:!r,children:"Shutdown"})]})})]})]})}const Il="_corner_1dxip_17",Ll="_contentWrapper_1dxip_24",$l="_content_1dxip_24",pt={corner:Il,contentWrapper:Ll,content:$l};function Vl({onClose:t,children:s}){return e.jsxs("div",{className:pt.contentWrapper,children:[e.jsx("div",{className:pt.content,children:s}),e.jsx("div",{className:pt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(kt,{})]})})]})}const Ml=[{id:"settings",label:"Settings",secondary:[{id:"settings__data",label:"Project data"},{id:"settings__general",label:"General settings"},{id:"settings__view",label:"View settings"}]},{id:"project",label:"Project",split:!0,secondary:[{id:"project__create",label:"Create..."},{id:"project__list",label:"Manage projects"}]},{id:"manage",label:"Project settings",secondary:[{id:"manage__defaults",label:"Rundown defaults"},{id:"manage__custom",label:"Custom fields"},{id:"manage__rundowns",label:"Manage rundowns"},{id:"manage__sheets",label:"Import spreadsheet"},{id:"manage__sheets",label:"Sync with Google Sheet"}]},{id:"automation",label:"Automation",split:!0,secondary:[{id:"automation__settings",label:"Automation settings"},{id:"automation__automations",label:"Manage automations"},{id:"automation__triggers",label:"Manage triggers"}]},{id:"sharing",label:"Sharing and reporting",split:!0,secondary:[{id:"sharing__presets",label:"URL Presets"},{id:"sharing__link",label:"Share link"},{id:"sharing__report",label:"Runtime report"}]},{id:"network",label:"Network",split:!0,secondary:[{id:"network__log",label:"Event log"},{id:"network__clients",label:"Manage clients"}]},{id:"about",label:"About",split:!0},{id:"shutdown",label:"Shutdown",split:!0}];function Wl(){const{data:t}=ws();return{options:g.useMemo(()=>Ml.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Xe="settings";function At(){const[t,s]=is(),n=g.useMemo(()=>t.get(Xe)??"project",[t]),a=g.useMemo(()=>!!t.get(Xe),[t]),[i,l]=n.split("__"),r=g.useCallback(()=>{t.delete(Xe),s(t)},[t,s]),c=g.useCallback(m=>{t.set(Xe,m),s(t)},[t,s]);return{isOpen:a,panel:i,location:l,setLocation:c,close:r}}const Ul="_tabs_86c70_17",ql="_primary_86c70_31",zl="_secondary_86c70_32",Bl="_active_86c70_54",Kl="_highlight_86c70_58",Hl="_split_86c70_68",Fe={tabs:Ul,primary:ql,secondary:zl,active:Bl,highlight:Kl,split:Hl};function Gl({selectedPanel:t,location:s}){const{options:n}=Wl();return e.jsx("ul",{className:Fe.tabs,children:n.map(a=>{const i=t===a.id;return a.highlight?e.jsx(ys,{text:a.highlight,render:e.jsx("span",{}),children:e.jsx(ts,{panel:a,location:s,isSelected:i})},a.id):e.jsx(ts,{panel:a,location:s,isSelected:i},a.id)})})}function ts(t){var r;const{panel:s,isSelected:n,location:a}=t,{setLocation:i}=At(),l=be([Fe.primary,n&&Fe.active,s.split&&Fe.split,s.highlight&&Fe.highlight]);return e.jsxs(g.Fragment,{children:[e.jsx("li",{onClick:()=>i(s.id),onKeyDown:c=>{Wt(c)&&i(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(r=s.secondary)==null?void 0:r.map((c,m)=>{const o=c.id.split("__")[1],u=be([Fe.secondary,n&&a===o?Fe.active:null]);return e.jsx("li",{onClick:()=>i(c.id),onKeyDown:h=>{Wt(h)&&i(c.id)},className:u,role:"button",children:c.label},c.id+m)})]},s.id)}const Ql="_container_1fy3l_17",Yl={container:Ql};function Jl(){const{close:t,panel:s,location:n,setLocation:a}=At();return ka(t,"Escape"),e.jsx("div",{className:Yl.container,children:e.jsxs(Ks,{children:[e.jsx(Gl,{selectedPanel:s,location:n}),e.jsxs(Vl,{onClose:t,children:[s==="settings"&&e.jsx(Al,{location:n}),s==="project"&&e.jsx(pl,{location:n,setLocation:a}),s==="manage"&&e.jsx(Oi,{location:n}),s==="automation"&&e.jsx(dr,{location:n}),s==="sharing"&&e.jsx(Nr,{location:n}),s==="network"&&e.jsx(Ki,{location:n}),s==="about"&&e.jsx(Pa,{}),s==="shutdown"&&e.jsx(Fl,{})]})]})})}const Xl=g.memo(Zl);function Zl({children:t}){return e.jsxs(Jn,{navElements:t,children:[e.jsx(Xn,{}),e.jsx(ba,{}),e.jsx(ya,{}),e.jsx(va,{}),e.jsx(wa,{}),e.jsx(Sa,{})]})}function eo({onFinish:t}){const s=g.useRef(null),n=()=>{var i;(i=s.current)==null||i.click()},a=async i=>{var r,c;const l=(c=(r=i.target)==null?void 0:r.files)==null?void 0:c[0];if(l)try{_s(l),await Ds(l)}catch{}finally{await We(),t()}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:s,style:{display:"none"},type:"file",onChange:a,accept:".json","data-testid":"file-input"}),e.jsx(f,{onClick:n,children:"Import project"})]})}const to="_sections_ar7bf_17",so="_column_ar7bf_23",no="_about_ar7bf_23",ao="_inline_ar7bf_35",ro="_header_ar7bf_41",io="_logo_ar7bf_48",lo="_buttonRow_ar7bf_53",oo="_tableContainer_ar7bf_62",co="_table_ar7bf_62",uo="_current_ar7bf_75",fe={sections:to,column:so,about:no,inline:ao,header:ro,logo:io,buttonRow:lo,tableContainer:oo,table:co,current:uo};function ho(t){const{loadProject:s,onClose:n}=t,{data:a}=Os();return e.jsx("tbody",{children:a.reorderedProjectFiles.map(i=>i.filename===a.lastLoadedProject?e.jsxs("tr",{className:fe.current,onClick:n,children:[e.jsx("td",{children:i.filename}),e.jsx("td",{children:"Loaded from last session"})]},i.filename):e.jsxs("tr",{onClick:()=>s(i.filename),children:[e.jsx("td",{children:i.filename}),e.jsx("td",{children:new Date(i.updatedAt).toLocaleString()})]},i.filename))})}function mo({onClose:t}){const s=Hs(),n=async l=>{try{await Es(l),await We(),t()}catch{}},a=async()=>{try{await Hr(),await We(),t()}catch{}},i=()=>{s("/editor?settings=project__create"),t()};return e.jsx(it,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:fe.sections,children:[e.jsxs("div",{className:fe.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:fe.logo}),e.jsxs("div",{children:["Ontime v",Ze]}),e.jsx(te,{href:gt,children:"Website"}),e.jsx(te,{href:Rt,children:"Read the docs"}),e.jsx(te,{href:ls,children:"Discord server"})]}),e.jsxs("div",{className:fe.column,children:[e.jsxs("div",{className:fe.header,children:["Welcome to Ontime",e.jsx(X,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(kt,{})})]}),e.jsx(fa,{children:"Select project"}),e.jsx("div",{className:fe.tableContainer,children:e.jsxs("table",{className:fe.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(ho,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:fe.column,children:[e.jsxs("div",{className:fe.buttonRow,children:[e.jsx(f,{onClick:a,children:"Load demo project"}),e.jsx(eo,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:i,children:"Create new..."})]}),e.jsxs(ga,{className:fe.inline,children:[e.jsx(Tn,{defaultChecked:!0,onCheckedChange:l=>Nn(l)}),"Show this modal on next startup"]})]})})}function xo(){const t=Ut(n=>n.showDialog),s=Ut(n=>n.clearDialog);return t?e.jsx(mo,{onClose:s}):null}const jo=g.lazy(()=>Qe(()=>import("./RundownExport-BCT0ybxy.js").then(t=>t.R),__vite__mapDeps([13,1,2,14,3,4,15,16,17,18,8,9,19,20,21,22,23,24,25,26,27,28,29,30,31,32,7,10,33,34,35,36,37,38]),import.meta.url)),po=g.lazy(()=>Qe(()=>import("./TimerControlExport-4a3Cd9x8.js"),__vite__mapDeps([39,1,2,14,3,4,15,16,17,20,21,22,31,32,40,41,42,43]),import.meta.url)),go=g.lazy(()=>Qe(()=>import("./MessageControlExport-X-4dl9QT.js"),__vite__mapDeps([44,1,2,14,3,4,15,16,17,29,30,31,32,41,42,45]),import.meta.url));function fo(){const{isOpen:t,setLocation:s,close:n}=At(),[a,i]=Ee();An("Editor"),Pn(),g.useEffect(()=>{var r;((r=window.process)==null?void 0:r.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=g.useCallback(()=>{t?n():s("settings")},[n,t,s]);return Gs([["mod + ,",l]]),e.jsxs("div",{className:mt.mainContainer,"data-testid":"event-editor",children:[e.jsx(xo,{}),e.jsx(On,{isOpen:a,onClose:i.close}),e.jsxs(Xl,{children:[e.jsx(X,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:i.open,children:e.jsx(Qs,{})}),e.jsx(X,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(kt,{}):e.jsx(Ys,{})})]}),t?e.jsx(Jl,{}):e.jsxs("div",{id:"panels",className:mt.panelContainer,children:[e.jsxs("div",{className:mt.left,children:[e.jsx(po,{}),e.jsx(go,{})]}),e.jsx(jo,{})]})]})}function Uo(){return e.jsx(Js,{permission:"editor",children:e.jsx(fo,{})})}export{Uo as default};
|
|
3
|
-
//# sourceMappingURL=ProtectedEditor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-CtBvokyt.js","./vendor-Cdwxo8bP.js","./vendor-4xP-6xVS.css","./index-CoGiopcb.js","./index-BuJoGGff.css","./useWindowTitle-mLKt65i7.js","./useWindowTitle-DrFGLRMI.css","./Modal-B8ZZbVMg.js","./useProjectData-B5mjXsMj.js","./useProjectData-Cw1aXCwD.css","./Modal-D3tAPV2u.css","./StyleEditor-RZvkKHdf.js","./StyleEditor-Bie84LSc.css","./RundownExport-CCaOfHIr.js","./EditorUtils-DoaSwWiz.js","./EditorUtils-CgF7UfHP.css","./ProtectRoute-EejQ5o_H.js","./ProtectRoute-Bm5sjStK.css","./useRundown-CHsh5rnl.js","./MilestoneEditor-B5BdJ5ju.js","./TimeInput-Duzx40TC.js","./parseUserTime-DZJMcfuJ.js","./TimeInput-Cu-N5DmX.css","./dateConfig-BU1RZfIK.js","./validateEvent-CUmvjN95.js","./editorSettings-BMt-7s8I.js","./editorSettings-BqHbWs9b.css","./rundownUtils-Dl1x6NDv.js","./useCustomFields-CcTb-GQM.js","./Select-cHK8JrMG.js","./Select-Cd08aEcf.css","./Tooltip-BQBvaIZx.js","./Tooltip-CKb7gU2M.css","./offset-BS90Rks2.js","./MilestoneEditor-BqNKKlvI.css","./Empty-D1UteOYj.js","./Empty-DvR62o5B.css","./useFollowComponent-BjhV6Uv8.js","./RundownExport-DtSvAfBG.css","./TimerControlExport-GJn4WWdH.js","./useReport-zMbyWwpn.js","./Editor.module-DvV2efYs.js","./Editor-B_NlyOLw.css","./TimerControlExport-DavNxY9p.css","./MessageControlExport-CFGgiwk_.js","./MessageControlExport-DjoUioWA.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as g,j as e,ac as ss,e as Y,k as St,ad as ce,ae as Ts,af as As,ag as et,ah as xe,T as je,aa as nt,ai as Fs,y as Ct,aj as Is,ak as It,f as Ls,O as _t,A as $s,al as Vs,am as Ms,an as Ge,ao as Ws,P as qe,C as Ee,ap as ns,aq as as,ar as Us,as as rs,at as Lt,au as qs,av as zs,l as is,aw as Bs,$ as Qe,v as kt,ax as Ks,x as Hs,M as Gs,I as Qs,m as Ys}from"./vendor-Cdwxo8bP.js";import{P as Js}from"./ProtectRoute-EejQ5o_H.js";import{e as ye,Q as Dt,R as Xs,S as Zs,U as tt,s as en,V as tn,W as Ne,X as Ze,Y as E,Z as Me,_ as Ae,$ as P,a0 as se,a1 as Q,a2 as gt,a3 as sn,a4 as nn,a5 as Rt,a6 as an,a7 as ls,a8 as rn,a9 as A,B as f,aa as ie,ab as we,ac as Le,ad as be,ae as oe,af as W,ag as B,ah as M,ai as V,aj as $e,ak as X,al as ve,am as at,an as ln,ao as on,ap as Et,f as Oe,aq as os,ar as Nt,as as cs,at as ne,x as $t,O as Re,au as cn,av as Vt,aw as ds,ax as us,ay as Pt,az as dn,aA as un,aB as Ot,aC as ct,m as Ie,k as hn,aD as mn,aE as xn,aF as ge,aG as hs,aH as ft,T as Ye,aI as jn,aJ as ms,aK as Mt,aL as pn,aM as gn,aN as fn,aO as We,aP as yn,aQ as bn,b as vn,aR as wn,N as Sn,aS as Cn,aT as _n,aU as kn,a as Dn,aV as Rn,aW as En,aX as Wt,aY as Nn,aZ as Ut,a_ as Pn,a$ as On}from"./index-CoGiopcb.js";import{I as me,C as Tn,u as An}from"./useWindowTitle-mLKt65i7.js";import{e as Fn,u as rt,T as H,t as dt,a as In,b as Ln,d as $n,c as Vn,f as Mn,g as Wn,S as Un,h as qn,D as xs,M as it}from"./Modal-B8ZZbVMg.js";import{S as ke,u as zn,a as Bn,b as Kn,c as ut}from"./useProjectData-B5mjXsMj.js";import{i as js,R as ps,s as Hn,a as Gn,G as Qn,b as Yn,O as Jn,T as Xn}from"./OverviewWrapper-D1hUkrRi.js";import{e as Zn,f as ea,g as ta,i as gs,h as fs,j as sa,k as na,l as aa,m as ra,r as ia,n as la,o as oa,p as ca,q as da}from"./useRundown-CHsh5rnl.js";import{S as ae}from"./Select-cHK8JrMG.js";import{u as lt,p as ua,e as ha,d as ma}from"./useCustomFields-CcTb-GQM.js";import{u as xa,d as ja}from"./useReport-zMbyWwpn.js";import{T as yt,u as ys,e as Be}from"./editorSettings-BMt-7s8I.js";import{S as pa,L as ga,T as fa}from"./EditorUtils-DoaSwWiz.js";import{T as bs}from"./Tooltip-BQBvaIZx.js";import{A as vs,T as Ke}from"./TimeInput-Duzx40TC.js";import{T as qt,E as ht}from"./validateEvent-CUmvjN95.js";import{p as He}from"./parseUserTime-DZJMcfuJ.js";import{S as ya,P as ba,O as va,M as wa,C as Sa}from"./TimeElements-dIvFHgcd.js";import{s as mt}from"./Editor.module-DvV2efYs.js";import"./offset-BS90Rks2.js";import"./SuperscriptPeriod-DaZq1rr6.js";/* empty css */import"./playbackstate-CWexoP3a.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof wt<"u"?wt:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="5923f120-e288-46c4-bcc9-525405268607",t._sentryDebugIdIdentifier="sentry-dbid-5923f120-e288-46c4-bcc9-525405268607")}catch{}})();function Ca(t){return t.trim().replaceAll(" ","_")}const _a={worksheet:"event schedule",flag:"flag",timeStart:"time start",linkStart:"link start",timeEnd:"time end",duration:"duration",cue:"cue",title:"title",countToEnd:"count to end",skip:"skip",note:"note",colour:"colour",endAction:"end action",timerType:"timer type",timeWarning:"warning time",timeDanger:"danger time",custom:{},id:"id"},ka=(t,s,n={})=>{const{isDisabled:a=!1}=n,i=g.useCallback(l=>{l.key===s&&!l.repeat&&!a&&(l.preventDefault(),t())},[t,a,s]);g.useEffect(()=>(document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}),[i])},Da="_link_70oau_17",Ra="_inline_70oau_27",zt={link:Da,inline:Ra};function te({href:t,inline:s,children:n}){const a=i=>{i.preventDefault(),Dt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:ye([zt.link,s&&zt.inline]),onClick:a,children:[n," ",e.jsx(ss,{style:{fontSize:"1em"}})]})}async function Ea(){const t=await Y.get(Xs);return{url:t.data.html_url,version:t.data.tag_name}}const Bt={url:"",version:"",hasUpdates:!1};function ws(){const{data:t,status:s,isFetching:n,isError:a,refetch:i}=St({queryKey:tn,queryFn:Ea,placeholderData:(c,m)=>c,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:en,enabled:tt}),l=(t==null?void 0:t.version)&&!t.version.includes(Zs);return{data:t?{...t,hasUpdates:l}:Bt,placeholder:Bt,status:s,isFetching:n,isError:a,refetch:i}}function Na(){const{data:t,isError:s}=ws();return s?e.jsxs(Ne,{children:[`You are currently using Ontime version ${Ze}`,e.jsx(E,{children:"Could not fetch version information"})]}):t.hasUpdates?e.jsxs(Ne,{children:[`You are currently using Ontime version ${Ze}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Me?"You can restart your stage to get the latest available version.":e.jsx(te,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(Ne,{children:`You are currently using the latest version of Ontime: ${Ze}`})}function Pa(){return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"About Ontime"}),e.jsxs(P,{children:[e.jsxs(se,{children:[e.jsx(Q,{children:"Ontime"}),e.jsxs(Ne,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(te,{href:gt,children:"www.getontime.no"})]}),e.jsxs(Ne,{children:["Considering sponsoring our work",e.jsx(te,{href:sn,children:"GitHub Sponsors"}),e.jsx(te,{href:nn,children:"Buy Me a Coffee"})]}),e.jsxs(Ne,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(te,{href:gt,children:"www.getontime.no"})]})]}),e.jsx(Q,{children:"Current version"}),e.jsx(Na,{}),e.jsx(Q,{children:"Links"}),e.jsx(te,{href:Rt,children:"Read the docs"}),e.jsx(te,{href:an,children:"Follow the project on GitHub"}),e.jsx(te,{href:ls,children:"Discord server"}),e.jsx(te,{href:rn,children:"Subreddit"})]})]})}function re(t,s){const n=g.useRef(null);return g.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const Oa="https://docs.getontime.no/api/protocols/osc/";function Ta({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var y,v,b;const{handleSubmit:a,reset:i,register:l,setError:r,watch:c,setValue:m,formState:{errors:o,isSubmitting:u,isDirty:h,isValid:d}}=ce({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),x=async S=>{try{await Fn(S),i(S)}catch(L){const R=V(L);r("root",{message:R})}},j=()=>{i({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},p=!u&&h&&d;return e.jsxs(se,{children:[e.jsxs(Q,{children:["Automation settings",e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",onClick:j,disabled:!p,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!p,loading:u,children:"Save"})]})]}),(o==null?void 0:o.root)&&e.jsx(E,{children:o.root.message}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:[e.jsx("p",{children:"Control Ontime and share its data with external systems in your workflow."}),e.jsx("p",{children:"- Automations allow Ontime to send its data on lifecycle triggers."}),e.jsx("p",{children:"- OSC Input tells Ontime to listen to messages on the specific port."}),e.jsx("br",{}),e.jsx(te,{href:Oa,children:"See the docs"})]})}),e.jsxs(P,{as:"form",id:"automation-settings-form",onSubmit:a(x),onKeyDown:S=>we(S,j),children:[e.jsx(Le,{isLoading:!1}),e.jsx(be,{children:"Automation"}),e.jsx(oe,{children:e.jsxs(W,{children:[e.jsx(B,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(y=o.enabledAutomations)==null?void 0:y.message}),e.jsx(ke,{size:"large",checked:c("enabledAutomations"),onCheckedChange:S=>m("enabledAutomations",S,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(be,{children:"OSC Input"}),e.jsxs(oe,{children:[Me&&e.jsx(me,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(W,{children:[e.jsx(B,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(v=o.enabledOscIn)==null?void 0:v.message}),e.jsx(ke,{size:"large",checked:c("enabledOscIn"),onCheckedChange:S=>m("enabledOscIn",S,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(b=o.oscPortIn)==null?void 0:b.message}),e.jsx(M,{id:"oscPortIn",placeholder:"8888",maxLength:5,style:{textAlign:"right",width:"5rem"},type:"number",fluid:!0,...l("oscPortIn",{required:{value:!0,message:"Required field"},max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"},pattern:{value:js,message:"Value should be numeric"}})})]})]})]})]})}const Aa=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],Fa=["{{clock}}","{{timer.addedTime}}","{{timer.current}}","{{timer.duration}}","{{timer.elapsed}}","{{timer.expectedFinish}}","{{timer.secondaryTimer}}","{{timer.startedAt}}","{{rundown.selectedEventIndex}}","{{rundown.numEvents}}","{{rundown.plannedStart}}","{{rundown.plannedEnd}}","{{rundown.actualStart}}","{{offset.absolute}}","{{offset.relative}}","{{offset.expectedRundownEnd}}","{{offset.expectedGroupEnd}}","{{offset.expectedFlagStart}}"],Ia=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],La=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function $a(t){return[...Aa,...Fa,...Ia,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...La,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Va(t,s){if(t===s)return"";if(t.endsWith("{{")&&s.startsWith("{{"))return s.substring(2);if(t.endsWith("{")&&s.startsWith("{{"))return s.substring(1);for(let n=0;n<s.length;n++){const a=s.substring(0,n+1);if(t.endsWith(a))return s.substring(n+1)}return""}function Ma(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Wa="_wrapper_1dmtf_17",Ua="_suggestions_1dmtf_21",Kt={wrapper:Wa,suggestions:Ua},qa=g.forwardRef(function(s,n){const{value:a,onChange:i,...l}=s,{data:r}=lt(),c=Ts(()=>j(!1)),m=g.useMemo(()=>$a(r),[r]),[o,u]=g.useState(a||""),[h,d]=g.useState([]),[x,j]=g.useState(!1),p=b=>{const S=Ma(b);return m.filter(L=>L.startsWith(S))},y=b=>{u(b.target.value),b.target.value.endsWith("{")?(j(!0),d(p(b.target.value))):b.target.value===""||b.target.value.endsWith("}}")?j(!1):x&&d(p(b.target.value)),i==null||i(b)},v=b=>{u(S=>{const L=Va(S,b);return S+L}),j(!1)};return e.jsxs("div",{className:Kt.wrapper,ref:As(c,n),children:[e.jsx(M,{value:o,...l,onChange:y,fluid:!0}),x&&h.length>0&&e.jsx("ul",{className:Kt.suggestions,children:h.map(b=>e.jsx("li",{onClick:()=>v(b),children:b},b))})]})}),bt=[{id:1,label:"On Load",value:"onLoad"},{id:2,label:"On Start",value:"onStart"},{id:3,label:"On Pause",value:"onPause"},{id:4,label:"On Stop",value:"onStop"},{id:5,label:"Every second",value:"onClock"},{id:6,label:"On Timer Update",value:"onUpdate"},{id:7,label:"On Finish",value:"onFinish"},{id:8,label:"On Warning",value:"onWarning"},{id:9,label:"On Danger",value:"onDanger"}];function Ht(t){return Object.hasOwn(t,"id")}const za=[{value:"eventNow.id",label:"ID"},{value:"eventNow.title",label:"Title"},{value:"eventNow.cue",label:"Cue"},{value:"eventNow.countToEnd",label:"Count to end"},{value:"eventNow.note",label:"Note"},{value:"eventNow.colour",label:"Colour"}],Ba=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Ka(t){return[...za,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Ba,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function Ha(t){const s={},n=[];for(let a=0;a<t.length;a++){const i=t[a];Object.hasOwn(s,i.trigger)||(s[i.trigger]=[]),s[i.trigger].includes(i.automationId)?n.push(a):s[i.trigger].push(i.automationId)}return n.length>0?n:void 0}const Ga="_outerColumn_1klj0_17",Qa="_innerColumn_1klj0_25",Ya="_ruleSection_1klj0_31",Ja="_titleSection_1klj0_37",Xa="_filterSection_1klj0_38",Za="_oscSection_1klj0_39",er="_httpSection_1klj0_40",tr="_actionSection_1klj0_41",sr="_test_1klj0_95",nr="_outputCard_1klj0_99",ue={outerColumn:Ga,innerColumn:Qa,ruleSection:Ya,titleSection:Ja,filterSection:Xa,oscSection:Za,httpSection:er,actionSection:tr,test:sr,outputCard:nr};function ar({index:t,register:s,setValue:n,rowErrors:a,value:i,children:l,watch:r}){var u,h,d,x,j;const[c,m]=g.useState(i),o=p=>{n(`outputs.${t}.action`,p,{shouldDirty:!0}),m(p)};return e.jsxs("div",{className:ue.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ae,{onValueChange:p=>{o(p)},value:r(`outputs.${t}.action`),options:[{value:"aux1-pause",label:"Aux 1: pause"},{value:"aux2-pause",label:"Aux 2: pause"},{value:"aux3-pause",label:"Aux 3: pause"},{value:"aux1-start",label:"Aux 1: start"},{value:"aux2-start",label:"Aux 2: start"},{value:"aux3-start",label:"Aux 3: start"},{value:"aux1-stop",label:"Aux 1: stop"},{value:"aux2-stop",label:"Aux 2: stop"},{value:"aux3-stop",label:"Aux 3: stop"},{value:"aux1-set",label:"Aux 1: set"},{value:"aux2-set",label:"Aux 2: set"},{value:"aux3-set",label:"Aux 3: set"},{value:"message-set",label:"Primary Message: set"},{value:"message-secondary",label:"Secondary Message: source"}]}),e.jsx(E,{children:(u=a==null?void 0:a.action)==null?void 0:u.message})]}),c.startsWith("aux")&&c.endsWith("set")&&e.jsxs("label",{children:["New time",e.jsx(M,{...s(`outputs.${t}.time`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"eg: 10m5s"}),e.jsx(E,{children:(h=a==null?void 0:a.time)==null?void 0:h.message})]}),c==="message-set"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Text (leave empty for no change)",e.jsx(M,{...s(`outputs.${t}.text`),fluid:!0,placeholder:"eg: Timer is finished"}),e.jsx(E,{children:(d=a==null?void 0:a.text)==null?void 0:d.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ae,{onValueChange:p=>{const y=p==="untouched"?void 0:p;n(`outputs.${t}.visible`,y,{shouldDirty:!0})},value:r(`outputs.${t}.visible`)===void 0?"untouched":r(`outputs.${t}.visible`),options:[{value:"untouched",label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(E,{children:(x=a==null?void 0:a.visible)==null?void 0:x.message})]})]}),c==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ae,{onValueChange:p=>{n(`outputs.${t}.secondarySource`,p,{shouldDirty:!0})},value:r(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source",disabled:!0},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"external",label:"External"},{value:"null",label:"None"}]}),e.jsx(E,{children:(j=a==null?void 0:a.secondarySource)==null?void 0:j.message})]}),e.jsx("div",{className:ue.test,children:l})]})}const rr="https://docs.getontime.no/api/automation/#using-variables-in-automation";function ir({automation:t,onClose:s}){var K;const n=Ht(t),{data:a}=lt(),{refetch:i}=rt(),l=g.useMemo(()=>Ka(a),[a]),{control:r,handleSubmit:c,getValues:m,register:o,setError:u,setFocus:h,setValue:d,watch:x,formState:{errors:j,isSubmitting:p,isDirty:y,isValid:v}}=ce({mode:"onChange",defaultValues:{title:(t==null?void 0:t.title)??"",filterRule:(t==null?void 0:t.filterRule)??"all",filters:(t==null?void 0:t.filters)??[],outputs:(t==null?void 0:t.outputs)??[]},resetOptions:{keepDirtyValues:!0}}),{fields:b,append:S,remove:L}=et({name:"filters",control:r}),{fields:R,append:O,remove:U}=et({name:"outputs",control:r});g.useEffect(()=>{h("title")},[h]);const w=()=>{S({field:"",operator:"equals",value:""})},$=()=>{O({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},_=()=>{O({type:"http",url:""})},G=()=>{O({type:"ontime",action:"aux1-start"})},q=async I=>{try{const k=m(`outputs.${I}`);if(!k.targetIP||!k.targetPort||!k.address)return;await dt({type:"osc",targetIP:k.targetIP,targetPort:k.targetPort,address:k.address,args:k.args})}catch{}},F=async I=>{try{const k=m(`outputs.${I}`);if(!k.url)return;await dt({type:"http",url:k.url})}catch{}},N=async I=>{try{const k=m(`outputs.${I}`);await dt({...k,type:"ontime"})}catch{}},T=async I=>{Ht(t)?await k(t.id,{id:t.id,...I}):await pe(I),i();async function k(de,le){try{await In(de,le),s()}catch(C){u("root",{message:V(C)})}}async function pe(de){try{await Ln(de),s()}catch(le){u("root",{message:V(le)})}}},D=!p&&y&&v;return e.jsxs($e,{as:"form",name:"automation-form",onSubmit:c(T),className:ue.outerColumn,onKeyDown:I=>we(I,s),children:[e.jsx(Q,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:ue.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:ue.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx(M,{...o("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(E,{children:(K=j.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:ue.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:ue.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(ps,{orientation:"horizontal",value:x("filterRule"),onValueChange:I=>d("filterRule",I,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),b.map((I,k)=>{var de,le,C,Z,Ce,De;const pe=`filters.${k}.field.${I.id}`;return e.jsxs("div",{className:ue.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ae,{value:x(`filters.${k}.field`),onValueChange:_e=>d(`filters.${k}.field`,_e,{shouldDirty:!0}),options:l.map(({value:_e,label:J})=>({value:_e,label:J})),"aria-label":"Event field"}),e.jsx(E,{children:(C=(le=(de=j.filters)==null?void 0:de[k])==null?void 0:le.field)==null?void 0:C.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ae,{value:x(`filters.${k}.operator`),onValueChange:_e=>d(`filters.${k}.operator`,_e,{shouldDirty:!0}),options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(E,{children:(De=(Ce=(Z=j.filters)==null?void 0:Z[k])==null?void 0:Ce.operator)==null?void 0:De.message})]}),e.jsxs("label",{children:["Value to match",e.jsx(M,{...o(`filters.${k}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>L(k),children:e.jsx(xe,{})})})]})]},pe)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:w,children:["Add filter ",e.jsx(je,{})]})})]})]}),e.jsxs("div",{className:ue.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(me,{children:["Automation outputs can be used to send data from Ontime to external software.",e.jsx(te,{href:rr,children:"See the documentation for templates"})]}),R.map((I,k)=>{var pe,de,le,C,Z,Ce,De,_e;if(Zn(I)){const J=(pe=j.outputs)==null?void 0:pe[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"OSC"}),e.jsxs("div",{className:ue.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx(M,{...o(`outputs.${k}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(E,{children:(de=J==null?void 0:J.targetIP)==null?void 0:de.message})]}),e.jsxs("label",{children:["Target Port",e.jsx(M,{...o(`outputs.${k}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:Ft=>Ft===""?0:Number(Ft),max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"}}),fluid:!0,type:"number",maxLength:5,placeholder:"8000"}),e.jsx(E,{children:(le=J==null?void 0:J.targetPort)==null?void 0:le.message})]}),e.jsxs("label",{children:["Address",e.jsx(M,{...o(`outputs.${k}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(E,{children:(C=J==null?void 0:J.address)==null?void 0:C.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(qa,{...o(`outputs.${k}.args`),value:I.args,placeholder:"1"}),e.jsx(E,{children:(Z=J==null?void 0:J.args)==null?void 0:Z.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>q(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]})]},I.id)}if(ea(I)){const J=(Ce=j.outputs)==null?void 0:Ce[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"HTTP"}),e.jsxs("div",{className:ue.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx(M,{...o(`outputs.${k}.url`,{required:{value:!0,message:"Required field"},pattern:{value:Hn,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(E,{children:(De=J==null?void 0:J.url)==null?void 0:De.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>F(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]})]},I.id)}if(ta(I)){const J=(_e=j.outputs)==null?void 0:_e[k];return e.jsxs("div",{className:ue.outputCard,children:[e.jsx(H,{children:"Ontime action"}),e.jsxs(ar,{value:I.action,index:k,register:o,rowErrors:J,setValue:d,watch:x,children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>N(k),children:"Test"}),e.jsx(X,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>U(k),children:e.jsx(xe,{})})]})]})]},I.id)}return null}),e.jsxs(A,{relation:"inner",children:[e.jsxs(f,{onClick:$,children:["OSC ",e.jsx(je,{})]}),e.jsxs(f,{onClick:_,children:["HTTP ",e.jsx(je,{})]}),e.jsxs(f,{onClick:G,children:["Ontime action ",e.jsx(je,{})]})]})]}),e.jsxs(A,{align:"end",children:[(j==null?void 0:j.root)&&e.jsx(E,{children:j.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!D,loading:p,children:"Save"})]})]})}const Gt={title:"",filterRule:"all",filters:[],outputs:[]};function lr(t){const{automations:s}=t,{refetch:n}=rt(),[a,i]=g.useState(null),[l,r]=g.useState(null),c=async o=>{try{r(null),await $n(o)}catch(u){r(V(u))}finally{n()}},m=Object.keys(s);return e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!a,onClick:()=>i(Gt),children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),a!==null&&e.jsx(ir,{automation:a,onClose:()=>i(null)}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"45%"},children:"Title"}),e.jsx("th",{style:{width:"15%"},children:"Trigger rule"}),e.jsx("th",{style:{width:"15%"},children:"Filters"}),e.jsx("th",{style:{width:"15%"},children:"Outputs"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[m.length===0&&e.jsx(at,{handleClick:a?void 0:()=>i(Gt)}),m.map(o=>Object.hasOwn(s,o)?e.jsx(g.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[o].title}),e.jsx("td",{children:e.jsx(H,{children:s[o].filterRule})}),e.jsx("td",{children:s[o].filters.length}),e.jsx("td",{children:s[o].outputs.length}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>i(s[o]),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>c(o),children:e.jsx(xe,{})})]})]})},o):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(E,{children:l})})})]})]})]})}function Ss({automations:t,initialId:s,initialTitle:n,initialAutomationId:a,initialTrigger:i,onCancel:l,postSubmit:r}){var L,R,O,U;const{handleSubmit:c,register:m,setFocus:o,setError:u,watch:h,setValue:d,formState:{errors:x,isSubmitting:j,isValid:p,isDirty:y}}=ce({defaultValues:{title:n,trigger:i??bt[0].value,automationId:a??((L=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:L.id)},resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{o("title")},[o]);const v=async w=>{if(s){try{await Vn(s,{id:s,...w}),r()}catch($){u("root",{message:`Failed to save changes to trigger ${V($)}`})}return}try{await Mn(w),r()}catch($){u("root",{message:`Failed to save trigger ${V($)}`})}},b=Object.keys(t).map(w=>({value:w,label:t[w].title})),S=y&&p;return e.jsxs($e,{as:"form",name:"trigger-form",onSubmit:c(v),onKeyDown:w=>we(w,l),children:[e.jsx(Q,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx(M,{...m("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(E,{children:(R=x.title)==null?void 0:R.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ae,{value:h("trigger"),onValueChange:w=>d("trigger",w,{shouldDirty:!0}),options:bt.map(w=>({value:w.value,label:w.label})),"aria-label":"Lifecycle trigger"}),e.jsx(E,{children:(O=x.trigger)==null?void 0:O.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ae,{value:h("automationId"),onValueChange:w=>d("automationId",w,{shouldDirty:!0}),options:b,"aria-label":"Automation title"}),e.jsx(E,{children:(U=x.automationId)==null?void 0:U.message})]}),e.jsxs(A,{align:"end",children:[e.jsx(f,{disabled:j,onClick:l,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!S,loading:j,children:"Save"})]})]})}function or(t){var h,d;const{automations:s,id:n,title:a,trigger:i,automationId:l,duplicate:r,handleDelete:c,postSubmit:m}=t,[o,u]=g.useState(!1);return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ss,{automations:s,initialId:n,initialTitle:a,initialTrigger:i,initialAutomationId:l,onCancel:()=>u(!1),postSubmit:()=>{u(!1),m()}})})}):e.jsxs("tr",{"data-warn":r,children:[e.jsxs(A,{as:"td",relation:"inner",children:[r&&e.jsx(Fs,{color:"#FFBC56"}),a]}),e.jsx("td",{children:e.jsx(H,{children:(h=bt.find(x=>x.value===i))==null?void 0:h.label})}),e.jsx("td",{children:e.jsx(H,{children:(d=s==null?void 0:s[l])==null?void 0:d.title})}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>u(!0),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:c,children:e.jsx(xe,{})})]})]})}function cr(t){const{triggers:s,automations:n}=t,[a,i]=g.useState(!1),{refetch:l}=rt(),[r,c]=g.useState(null),m=async d=>{try{await Wn(d)}catch(x){c(V(x))}finally{l()}},o=()=>{i(!1),l()},u=g.useMemo(()=>Ha(s),[s]),h=Object.keys(n).length>0;return e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!h,loading:!1,onClick:()=>i(!0),children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[u&&e.jsx(E,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),a&&e.jsx(Ss,{automations:n,onCancel:()=>i(!1),postSubmit:o}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"35%"},children:"Title"}),e.jsx("th",{style:{width:"25%"},children:"Lifecycle trigger"}),e.jsx("th",{style:{width:"25%"},children:"Automation"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[!a&&s.length===0&&e.jsx(at,{label:"Create an automation to attach triggers to",handleClick:h?()=>i(!0):void 0}),s.map((d,x)=>e.jsxs(g.Fragment,{children:[e.jsx(or,{automations:n,id:d.id,title:d.title,trigger:d.trigger,automationId:d.automationId,duplicate:u==null?void 0:u.includes(x),handleDelete:()=>m(d.id),postSubmit:o}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(E,{children:r})})})]},d.id))]})]})]})]})}function dr({location:t}){const{data:s,status:n}=rt(),a=re("settings",t),i=re("triggers",t),l=re("automations",t),r=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Automation"}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:r}),e.jsx("div",{ref:a,children:e.jsx(Ta,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(lr,{automations:s.automations})}),e.jsx("div",{ref:i,children:e.jsx(cr,{triggers:s.triggers,automations:s.automations})})]})]})}const ur="_goIcon_1fzu7_17",hr={goIcon:ur};function mr(){const{data:t}=ln(),s=n=>Dt(n);return e.jsx(A,{children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!tt)return null;const a=on(n.address);return e.jsxs(Et,{copyValue:a,onClick:()=>s(a),children:[`${n.name} - ${n.address}`," ",e.jsx(Ct,{className:hr.goIcon})]},n.name)})})}function xr(t){return Is(t)}function jr(t,s,n){if(Object.keys(t).length===0)return[];if(n.length===0)return[];const a=[];let i=1;for(let l=0;l<n.length;l++){const r=n[l],c=s[r];!c||!gs(c)||(r in t||a.push({id:r,index:i,title:c.title,cue:c.cue,scheduledStart:c.timeStart,actualEnd:null,scheduledEnd:c.timeEnd,actualStart:null}),r in t&&a.push({id:r,index:i,title:c.title,cue:c.cue,scheduledStart:c.timeStart,actualEnd:t[r].endedAt,scheduledEnd:c.timeEnd,actualStart:t[r].startedAt}),i++)}return a}const pr=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function gr(t){const s=[];s.push(pr);for(const n of t)s.push([String(n.index),n.title,n.cue,Oe(n.scheduledStart),Oe(n.actualStart),Oe(n.scheduledEnd),Oe(n.actualEnd)]);return xr(s)}const fr="_blink_15peo_1",yr="_fourtyfive_15peo_13",br="_over_15peo_17",vr="_under_15peo_21",Je={blink:fr,fourtyfive:yr,over:br,under:vr};function wr(){const{data:t}=xa(),{data:s}=fs(),n=async()=>await ja(),a=l=>{if(!l)return;const r=gr(l),c=os(r,"text/csv;charset=utf-8;");Nt(c,"ontime-report.csv")},i=g.useMemo(()=>jr(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Report"}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(be,{children:["Manage report",e.jsxs(A,{children:[e.jsxs(f,{onClick:()=>a(i),disabled:i.length===0,children:[e.jsx(It,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:i.length===0,children:[e.jsx(It,{}),"Clear All"]})]})]})}),e.jsx(P,{children:e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Scheduled Start"}),e.jsx("th",{children:"Actual Start"}),e.jsx("th",{children:"Scheduled End"}),e.jsx("th",{children:"Actual End"})]})}),e.jsxs("tbody",{children:[i.length===0&&e.jsx(at,{label:"Reports are generated when running through the show."}),i.map(l=>{const r=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",c=l.actualEnd===null?null:l.actualEnd<=l.scheduledEnd?"under":"over";return e.jsxs("tr",{children:[e.jsx("th",{children:l.index}),e.jsx("th",{children:l.cue}),e.jsx("th",{children:l.title}),e.jsx("th",{className:ye([r&&Je[r]]),children:Oe(l.scheduledStart)}),e.jsx("th",{className:ye([r&&Je[r]]),children:Oe(l.actualStart)}),e.jsx("th",{className:ye([c&&Je[c]]),children:Oe(l.scheduledEnd)}),e.jsx("th",{className:ye([c&&Je[c]]),children:Oe(l.actualEnd)})]},l.id)})]})]})})]})})}const Sr="_expand_1sy0c_17",Cr="_column_1sy0c_21",Qt={expand:Sr,column:Cr},_r=[{value:Re.Cuesheet,label:"Cuesheet"},{value:Re.Operator,label:"Operator"},{value:Re.Timer,label:"Timer"},{value:Re.Backstage,label:"Backstage"},{value:Re.Timeline,label:"Timeline"},{value:Re.StudioClock,label:"Studio Clock"},{value:Re.Countdown,label:"Countdown"},{value:Re.ProjectInfo,label:"Project Info"}],kr={alias:"",target:Re.Timer,search:"",enabled:!0};function Dr({urlPreset:t,onClose:s}){var R,O,U;const{addPreset:n,updatePreset:a,isMutating:i}=cs(),{handleSubmit:l,register:r,setFocus:c,setError:m,clearErrors:o,setValue:u,getValues:h,watch:d,formState:{errors:x,isSubmitting:j,isValid:p,isDirty:y}}=ce({defaultValues:t??kr,mode:"onChange",resetOptions:{keepDirtyValues:!0}}),v=g.useRef(null),b=async w=>{try{t?await a(t.alias,w):await n(w),s()}catch($){m("root",{message:V($)})}};g.useEffect(()=>{c("alias")},[c]);const S=()=>{var w;o();try{const $=cn(h("alias"),((w=v.current)==null?void 0:w.value.trim())??"");u("target",$.target,{shouldDirty:!0,shouldValidate:!0}),u("search",$.search,{shouldDirty:!0,shouldValidate:!0})}catch($){m("root",{message:Vt($)});return}},L=w=>{try{return new URLSearchParams(w),!0}catch($){return Vt($)||"Invalid URL parameters"}};return e.jsxs($e,{as:"form",onSubmit:l(b),onKeyDown:w=>we(w,s),className:Qt.column,children:[e.jsx("input",{hidden:!0,name:"enabled",value:"true"}),e.jsx("div",{children:"1. Enter URL and let Ontime generate the preset options"}),e.jsxs(A,{children:[e.jsxs("div",{children:[e.jsx(ne,{children:"Alias"}),e.jsx(M,{...r("alias",{required:"Alias is required",pattern:{value:Gn,message:"Field can only contain URL safe characters (a-z, 0-9, _ and -)"}})})]}),e.jsxs("div",{className:Qt.expand,children:[e.jsx(ne,{children:"Generate options (paste URL to generate options)"}),e.jsxs(A,{children:[e.jsx(M,{placeholder:"Paste URL",fluid:!0,ref:v}),e.jsx(f,{onClick:S,children:"Generate"})]})]})]}),((R=x.alias)==null?void 0:R.message)&&e.jsx(E,{children:x.alias.message}),e.jsxs("div",{children:[$t," or ",$t]}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(ne,{children:"Target"}),e.jsx(ae,{options:_r,...r("target",{required:"Target is required"}),value:d("target"),onValueChange:w=>u("target",w,{shouldDirty:!0})})]}),e.jsxs("div",{children:[e.jsx(ne,{children:"Parameters"}),e.jsx(yt,{fluid:!0,rows:3,...r("search",{validate:L})}),e.jsx(E,{children:(O=x.search)==null?void 0:O.message})]}),e.jsxs("div",{children:[e.jsx(E,{children:(U=x.root)==null?void 0:U.message}),e.jsxs(A,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!p||!y,loading:j||i,children:"Save"})]})]})]})}const Rr="https://docs.getontime.no/features/url-presets/";function Er(){const[t,s]=g.useState({isOpen:!1,preset:void 0}),{data:n,status:a}=ds(),{deletePreset:i,isMutating:l}=cs(),r=()=>s({isOpen:!0}),c=o=>s({isOpen:!0,preset:o}),m=()=>s({isOpen:!1,preset:void 0});return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["URL presets",e.jsxs(f,{onClick:r,children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:["URL presets are user pre-defined aliases to Ontime URLs.",e.jsx("br",{}),"This URL can contain full configuration including parameters, or simply route to a specific view.",e.jsx("br",{}),e.jsx("br",{}),"The easiest way to get started is to copy an URL from your browser and paste it into the form.",e.jsx(te,{href:Rr,children:"See the docs"})]})}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:a==="pending"}),t.isOpen&&e.jsx(Dr,{urlPreset:t.preset,onClose:m}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Enabled"}),e.jsx("th",{children:"Target view"}),e.jsx("th",{children:"Alias"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[n.length===0&&e.jsx(at,{handleClick:r}),n.map((o,u)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(ke,{defaultChecked:o.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(H,{children:o.target})}),e.jsx("td",{style:{width:"100%"},children:o.alias}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white",onClick:h=>us(o.alias,h),disabled:l,children:e.jsx(ss,{})}),e.jsx(X,{onClick:()=>c(o),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${u}`,disabled:l,children:e.jsx(nt,{})}),e.jsx(X,{onClick:()=>i(o.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${u}`,disabled:l,children:e.jsx(xe,{})})]})]},o.alias))]})]})]})]})})}function Nr({location:t}){const s=re("presets",t),n=re("link",t),a=re("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(Er,{})}),e.jsx("div",{ref:n,children:e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Share Ontime Link"}),!Me&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(mr,{})]}),e.jsx(ie,{}),e.jsx(Qn,{})]})})}),e.jsx("div",{ref:a,children:e.jsx(wr,{})})]})}const Tt=`${Pt}/excel`;async function Pr(t){const s=new FormData;return s.append("excel",t),(await Y.post(`${Tt}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Or(t){return(await Y.post(`${Tt}/preview`,{options:t})).data}async function Tr(t,s){try{const n=await Y.get(`${Tt}/${t}/export`,{responseType:"blob"});Nt(n.data,`${s??"Ontime_rundown"}.xlsx`)}catch(n){console.error("Error downloading file:",n)}}const Ue=`${Pt}/sheets`,Ar=async()=>(await Y.get(`${Ue}/connect`)).data,Fr=async(t,s)=>{const n=new FormData;return n.append("client_secret",t),(await Y.post(`${Ue}/${s}/connect`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},Ir=async()=>(await Y.post(`${Ue}/revoke`)).data,Lr=async(t,s)=>(await Y.post(`${Ue}/${t}/read`,{options:s})).data,Cs=async t=>(await Y.post(`${Ue}/${t}/worksheets`)).data,$r=async(t,s)=>(await Y.post(`${Ue}/${t}/write`,{options:s})).data;function Vr(t){if(!Mr(t))throw new Error("Unknown file type");if(t.size===0)throw new Error("File is empty");if(t.size>1e7)throw new Error("File size limit (10MB) exceeded")}function _s(t){if(!Wr(t))throw new Error("Unknown file type");if(t.size===0)throw new Error("File is empty");if(t.size>2e6)throw new Error("File size limit (2MB) exceeded")}function Mr(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Wr(t){return t==null?void 0:t.name.endsWith(".json")}function Ur(t){if(t.size===0)throw new Error("File is empty");if(t.size>15e5)throw new Error("File size limit (1.5MB) exceeded")}const Se=`${Pt}/db`;function ks(t){return Y.post(`${Se}/download`,{filename:t})}async function qr(t){try{const{data:s,name:n}=await Jr(t),a=JSON.stringify(s,null,2),i=os(a,"application/json;charset=utf-8;");Nt(i,`${n}.json`)}catch(s){console.error(s)}}async function Ds(t){const s=new FormData;return s.append("project",t),(await Y.post(`${Se}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function Rs(t){return await Y.patch(Se,t)}async function zr(t){return(await Y.post(`${Se}/new`,t)).data}async function Br(t){return(await Y.post(`${Se}/quick`,t)).data}async function Kr(){return(await Y.get(`${Se}/all`)).data}async function Es(t){return(await Y.post(`${Se}/load`,{filename:t})).data}async function Hr(){return(await Y.post(`${Se}/demo`)).data}async function Gr(t,s){const n=`${Se}/${t}/duplicate`,a=decodeURIComponent(n);return(await Y.post(a,{newFilename:s})).data}async function Qr(t,s){const n=`${Se}/${t}/rename`,a=decodeURIComponent(n);return(await Y.put(a,{newFilename:s})).data}async function Yr(t){const s=`${Se}/${t}`,n=decodeURIComponent(s);return(await Y.delete(n)).data}async function Jr(t){const s=await ks(t),n=s.headers["Content-Disposition"];let a=t;if(n!=null){const i=n.indexOf('"')+1,l=n.lastIndexOf('"');a=n.substring(i,l)}return{data:s.data,name:a}}const Xr={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},Yt={stepData:Xr,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,summary:null,spreadsheetImportMap:_a},z=Ls((t,s)=>({...Yt,patchStepData:n=>{const a=s().stepData;t({stepData:{...a,...n}})},setWorksheets:n=>t({worksheetNames:n}),setSheetId:n=>t({sheetId:n}),setAuthenticationStatus:n=>t({authenticationStatus:n}),setRundown:n=>t({rundown:n}),setCustomFields:n=>t({customFields:n}),setSummary:n=>t({summary:n}),patchSpreadsheetImportMap:(n,a)=>{const i=s().spreadsheetImportMap;i[n]!==a&&(i[n]=a)},reset:()=>t(Yt),resetPreview:()=>t({rundown:null,customFields:null,summary:null})}));function ot(){const t=_t(),s=z(h=>h.patchStepData),n=z(h=>h.setRundown),a=z(h=>h.setCustomFields),i=z(h=>h.setSummary);return{connect:async(h,d)=>{try{return await Fr(h,d)}catch(x){s({authenticate:{available:!1,error:V(x)}})}},revoke:async()=>{try{return await Ir()}catch(h){s({authenticate:{available:!1,error:V(h)}})}},verifyAuth:async()=>{try{return await Ar()}catch(h){s({authenticate:{available:!1,error:V(h)}})}},importRundownPreview:async(h,d)=>{try{const x=await Lr(h,d);n(x.rundown),a(x.customFields),i(x.summary)}catch(x){s({pullPush:{available:!0,error:V(x)}})}},importRundown:async(h,d)=>{try{await Rs({rundowns:h,customFields:d}),await t.invalidateQueries({queryKey:[dn,un]})}catch(x){s({pullPush:{available:!0,error:V(x)}})}},exportRundown:async(h,d)=>{try{await $r(h,d),s({pullPush:{available:!1,error:""}})}catch(x){s({pullPush:{available:!0,error:V(x)}})}}}}const vt={Worksheet:"event schedule",Flag:"flag",Start:"time start","Link start":"link start",End:"time end",Duration:"duration",Cue:"cue",Title:"title","Count to end":"count to end",Skip:"skip",Note:"notes",Colour:"colour","End action":"end action","Timer type":"timer type","Time warning":"warning time","Time danger":"danger time",ID:"id",custom:[]};function Zr(t){return typeof t!="object"||t===null?!1:Object.keys(vt).every(n=>Object.hasOwn(t,n))}function Jt(t){const s=t.custom.reduce((n,{ontimeName:a,importName:i})=>(a&&i&&(n[a.trim()]=i.trim()),n),{});return{worksheet:t.Worksheet,flag:t.Flag,timeStart:t.Start,linkStart:t["Link start"],timeEnd:t.End,duration:t.Duration,cue:t.Cue,title:t.Title,countToEnd:t["Count to end"],skip:t.Skip,note:t.Note,colour:t.Colour,endAction:t["End action"],timerType:t["Timer type"],timeWarning:t["Time warning"],timeDanger:t["Time danger"],custom:s,id:t.ID}}function ei(t){localStorage.setItem("import-options",JSON.stringify(t))}function ti(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function si(){try{const t=ti();return Zr(t)?t:vt}catch{return vt}}const ni="_uploadSection_10owf_17",ai="_finishSection_10owf_18",ri="_error_10owf_40",ii="_success_10owf_43",li="_singleActionCell_10owf_47",Te={uploadSection:ni,finishSection:ai,error:ri,success:ii,singleActionCell:li};function oi({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:a,onSubmitImport:i}){const l=si(),{revoke:r}=ot(),{control:c,handleSubmit:m,register:o,setValue:u,watch:h,formState:{errors:d,isValid:x}}=ce({mode:"onChange",defaultValues:l,values:l}),{fields:j,append:p,remove:y}=et({control:c,name:"custom"}),v=z(N=>N.stepData),b=z(N=>N.worksheetNames),[S,L]=g.useState("");g.useEffect(()=>{!b||b.length===0||b.includes(l.Worksheet)||u("Worksheet",b[0],{shouldValidate:!0,shouldDirty:!0})},[b,u,l.Worksheet]);const R=async N=>{L("export");const T=Jt(N);await a(T),L("")},O=async()=>{await r(),n()},U=async N=>{L("import");const T=Jt(N);ei(N),await i(T),L("")},w=N=>{y(N)},$=()=>{p({})},_=!!S,G=s&&!_,q=!_&&!v.worksheet.error,F=!t&&x&&(G||q);return e.jsxs(P,{as:"form",id:"import-map",children:[e.jsxs(be,{children:["Import options",e.jsxs(A,{children:[!s&&e.jsx(bs,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:O,disabled:_,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:_,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:m(R),disabled:!q,loading:S==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:m(U),disabled:!F,loading:S==="import",children:"Import preview"})]})]}),e.jsxs(me,{children:["Match your spreadsheet columns to Ontime fields. ",e.jsx("br",{}),"You can also add Custom Fields by providing a name for Ontime and the spreadsheet column name."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Ontime field"}),e.jsx("th",{children:"Column name in spreadsheet"}),e.jsx("th",{className:Te.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([N,T])=>N==="custom"?null:N==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:N}),e.jsx("td",{children:e.jsx(ae,{id:T,value:h(N),onValueChange:D=>u(N,D,{shouldDirty:!0}),options:(b==null?void 0:b.map(D=>({value:D,label:D})))||[]})}),e.jsx("td",{className:Te.singleActionCell})]},T):e.jsxs("tr",{children:[e.jsx("td",{children:N}),e.jsx("td",{children:e.jsx(M,{id:T,fluid:!0,maxLength:25,defaultValue:T,placeholder:"Use default column name",...o(N)})}),e.jsx("td",{className:Te.singleActionCell})]},T)),j.map((N,T)=>{var pe,de,le;const D=N.ontimeName,K=N.importName,I=(le=(de=(pe=d.custom)==null?void 0:pe[T])==null?void 0:de.ontimeName)==null?void 0:le.message,k=`custom.${T}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx(M,{maxLength:25,fluid:!0,defaultValue:D,placeholder:"Name of the field as shown in Ontime",...o(`custom.${T}.ontimeName`,{validate:C=>Ot.isAlphanumericWithSpace(C)?!0:"Only alphanumeric characters and space are allowed"})}),I&&e.jsx(E,{children:I})]}),e.jsx("td",{children:e.jsx(M,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...o(`custom.${T}.importName`)})}),e.jsx("td",{className:Te.singleActionCell,children:e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>w(T),children:e.jsx(xe,{})})})]},k)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(A,{as:"td",align:"end",children:e.jsxs(f,{onClick:$,children:["Add custom field ",e.jsx(je,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(E,{children:v.worksheet.error})]})}const ci="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function di(){return e.jsxs(me,{children:["Ontime can import data from spreadsheets by: ",e.jsx("br",{}),"- importing the spreadsheet file in Ontime ",e.jsx("br",{}),"- synchronising your project with a Google Sheet",e.jsx("br",{}),e.jsx("br",{}),"To synchronise with a Google Sheet, you will need to allow Ontime to authenticate with your Google account.",e.jsx(te,{href:ci,children:"See the docs"})]})}function ui(t){const{onCancel:s}=t,{revoke:n,connect:a,verifyAuth:i}=ot(),[l,r]=g.useState(null),[c,m]=g.useState(null),[o,u]=g.useState(""),[h,d]=g.useState(""),x=z(D=>D.sheetId),j=z(D=>D.setSheetId),p=z(D=>D.setWorksheets),y=z(D=>D.patchStepData),v=z(D=>D.authenticationStatus),b=z(D=>D.setAuthenticationStatus),S=z(D=>D.stepData.authenticate.error),L=async()=>{const D=await i();D&&b(D.authenticated)};g.useEffect(()=>{y({authenticate:{available:!1,error:""}}),$()},[]);const R=async()=>{u("cancel"),await n(),await L(),u("")},O=()=>{s()},U=D=>{var K;(K=D.target.files)!=null&&K.length&&r(D.target.files[0])},w=async()=>{if(!l||!x)return;y({worksheet:{available:!1,error:""}}),u("connect");const D=await a(l,x);D&&(d(D.verification_url),m(D.user_code)),u("")},$=async(D=0)=>{const K=await i();if(K!=null&&K.authenticated&&(b(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const I=await Cs(K.sheetId);p(I)}catch(I){const k=V(I);y({worksheet:{available:!1,error:k}})}u("");return}if(D<=10){setTimeout(()=>$(D+1),2e3);return}u("")},_=async()=>{u("authenticate"),Dt(h),window.addEventListener("focus",async()=>{$()},{once:!0})},G=l&&x,q=!!c&&!!h,F=!!o,N=v==="authenticated",T=v==="pending";return e.jsxs(P,{children:[e.jsxs(be,{children:["Sync with Google Sheet (experimental)",N?e.jsx(f,{onClick:R,loading:o==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:O,children:"Go Back"})]}),e.jsxs(oe,{children:[e.jsx(ne,{children:"Upload Client Secret provided by Google"}),e.jsx(E,{children:S}),e.jsx(M,{fluid:!0,type:"file",onChange:U,accept:".json",disabled:F||q})]}),e.jsxs(oe,{children:[e.jsx(ne,{children:"Enter ID of sheet to synchronise"}),e.jsx(E,{children:void 0}),e.jsx(M,{fluid:!0,placeholder:"Sheet ID",onChange:D=>j(D.target.value),disabled:F||q})]}),q?e.jsx(oe,{children:e.jsxs(A,{children:[T&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Et,{copyValue:c??"",disabled:!q,children:c||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:_,disabled:!q,children:[e.jsx(Vs,{}),"Authenticate"]})]})}):e.jsx(oe,{children:e.jsx(A,{children:e.jsxs(f,{onClick:w,disabled:!G||F,loading:o==="connect",children:[e.jsx($s,{}),"Connect"]})})})]})}const hi="_center_l8uww_17",mi="_nowrap_l8uww_21",xi="_secondaryRow_l8uww_25",ji="_linkStartActive_l8uww_30",pi="_flex_l8uww_36",gi="_subdued_l8uww_42",ee={center:hi,nowrap:mi,secondaryRow:xi,linkStartActive:ji,flex:pi,subdued:gi};function xt(t){return t?"Yes":void 0}function fi({rundown:t,customFields:s}){let n=0;const a=Object.keys(s),i=a.map(l=>s[l].label);return e.jsxs(ve,{className:ee.nowrap,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Flag"}),e.jsx("th",{children:"Time Start"}),e.jsx("th",{children:"Time End"}),e.jsx("th",{children:"Duration"}),e.jsx("th",{children:"Warning Time"}),e.jsx("th",{children:"Danger Time"}),e.jsx("th",{children:"Count to end"}),e.jsx("th",{children:"Skip"}),e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Timer Type"}),e.jsx("th",{children:"End Action"}),i.map(l=>e.jsx("th",{children:l},l)),e.jsx("th",{children:"ID"})]})}),e.jsx("tbody",{children:t.flatOrder.map(l=>{const r=t.entries[l];if(sa(r)){const h=r.colour?ct(r.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{})," ",e.jsx("td",{children:r.title}),e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{style:{...h},children:r.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(d=>{let x="";return d in r.custom&&(x=r.custom[d]),e.jsx("td",{children:x},d)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]},r.id)}if(na(r)){const h=r.colour?ct(r.colour):{};return e.jsxs(g.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:ee.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{})," ",e.jsx("td",{style:{...h},children:r.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(d=>{let x="";return d in r.custom&&(x=r.custom[d]),e.jsx("td",{children:x},d)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:ee.secondaryRow,children:["Note: ",r.note]})})]},r.id)}if(!gs(r))return null;n+=1;const c=r.colour?ct(r.colour):{},m=xt(r.countToEnd),o=xt(r.skip),u=xt(r.flag);return e.jsxs(g.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:ee.center,children:e.jsx(H,{children:n})}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:ee.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{className:ee.center,children:u&&e.jsx(H,{children:u})}),e.jsxs("td",{className:ee.flex,children:[e.jsx("span",{className:r.linkStart?ee.subdued:void 0,children:Ie(r.timeStart)}),r.linkStart&&e.jsx(Ms,{className:ee.linkStartActive})]}),e.jsx("td",{children:Ie(r.timeEnd)}),e.jsx("td",{children:Ie(r.duration)}),e.jsx("td",{children:Ie(r.timeWarning)}),e.jsx("td",{children:Ie(r.timeDanger)}),e.jsx("td",{className:ee.center,children:m&&e.jsx(H,{children:m})}),e.jsx("td",{children:o&&e.jsx(H,{children:o})}),e.jsx("td",{style:{...c},children:r.colour}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.timerType})}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.endAction})}),a.map(h=>{let d="";return h in r.custom&&(d=r.custom[h]),e.jsx("td",{children:d},h)}),e.jsx("td",{className:ee.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:ee.secondaryRow,children:["Note: ",r.note]})})]},r.id)})})]})}function yi({rundown:t,customFields:s,summary:n,onFinished:a,onCancel:i,onBack:l}){const{data:r}=fs(),[c,m]=g.useState(!1),{importRundown:o}=ot(),u=z(x=>x.resetPreview),h=()=>{u(),i()},d=async()=>{m(!0),await o({[r.id]:{...t,id:r.id,title:r.title}},s),m(!1),a()};return e.jsxs(P,{children:[e.jsxs(be,{children:["Review Rundown",e.jsxs(A,{children:[e.jsx(f,{onClick:h,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{onClick:l,variant:"subtle",disabled:c,children:"Back"}),e.jsx(f,{onClick:d,variant:"primary",loading:c,children:"Apply"})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx("b",{children:"Title"})," ",t.title]}),e.jsxs(W,{children:[e.jsx("b",{children:"Number of entries"})," ",t.flatOrder.length]}),e.jsxs(W,{children:[e.jsx("b",{children:"Start time"})," ",Ie(n.start)]}),e.jsxs(W,{children:[e.jsx("b",{children:"End time"})," ",Ie(n.end)]}),e.jsxs(W,{children:[e.jsx("b",{children:"Total duration"})," ",hn(n.duration)]})]}),e.jsx(fi,{rundown:t,customFields:s})]})}function bi(){const[t,s]=g.useState("none"),[n,a]=g.useState(""),[i,l]=g.useState("none"),{exportRundown:r,importRundownPreview:c,verifyAuth:m}=ot(),o=z(C=>C.setWorksheets),u=z(C=>C.authenticationStatus),h=z(C=>C.setAuthenticationStatus),d=z(C=>C.rundown),x=z(C=>C.setRundown),j=z(C=>C.customFields),p=z(C=>C.setCustomFields),y=z(C=>C.summary),v=z(C=>C.setSummary),b=z(C=>C.setSheetId),S=z(C=>C.sheetId),L=z(C=>C.resetPreview),R=g.useRef(null),O=async C=>{var Ce;const Z=(Ce=C.target.files)==null?void 0:Ce[0];if(!Z){o(null),l("none");return}try{l("loading"),Vr(Z);const De=await Pr(Z);o(De),s("excel"),l("done")}catch(De){const _e=mn(De);a(`Error uploading file: ${_e}`),o(null),l("none")}},U=()=>{var C;(C=R.current)==null||C.click()},w=()=>{s("none"),x(null),l("none"),o(null),p(null),v(null),a(""),b(null)},$=async()=>{const C=await m();if(C&&(h(C.authenticated),b(C.sheetId),C.authenticated==="authenticated"&&C.sheetId))try{const Z=await Cs(C.sheetId);o(Z)}catch(Z){const Ce=V(Z);a(`Error getting worksheets: ${Ce}`)}s("gsheet")},_=()=>{w()},G=async C=>{if(a(""),t==="excel")try{const Z=await Or(C);x(Z.rundown),p(Z.customFields),v(Z.summary)}catch(Z){a(V(Z))}if(t==="gsheet"){if(!S)return;await c(S,C)}},q=async()=>{if(w(),u==="authenticated"){const C=await m();C&&h(C.authenticated)}},F=()=>{s("finished"),x(null),l("none"),o(null),p(null),a("")},N=async C=>{S&&await r(S,C)},T=t==="excel",D=t==="gsheet",K=u==="authenticated",I=t==="none",k=t==="finished",pe=D&&!K,de=D&&K||T&&i==="done",le=d!==null&&j!==null&&y!==null;return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(E,{children:n}),I&&e.jsxs(e.Fragment,{children:[e.jsx(di,{}),e.jsx("input",{ref:R,style:{display:"none"},type:"file",onChange:O,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Te.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:U,loading:i==="loading",children:[e.jsx(Ge,{}),"Import from spreadsheet"]}),e.jsx(ne,{children:"Accepts .xlsx files"})]}),e.jsx(pa,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:$,disabled:i!=="none",children:[e.jsx(Ws,{}),"Synchronise with Google"]}),e.jsx(ne,{children:"Start authentication process"})]})]})]}),k&&e.jsxs("div",{className:Te.finishSection,children:[n?e.jsx("span",{className:Te.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Te.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:w,children:"Return"})]}),pe&&e.jsx(ui,{onCancel:_}),de&&!le&&e.jsx(oi,{hasErrors:!!n,isSpreadsheet:T,onCancel:q,onSubmitExport:N,onSubmitImport:G}),le&&e.jsx(yi,{rundown:d,customFields:j,summary:y,onFinished:F,onCancel:q,onBack:L})]})})}const vi="_halfWidth_6p65m_17",wi="_fullWidth_6p65m_21",Si="_twoCols_6p65m_25",Ci="_current_6p65m_31",st={halfWidth:vi,fullWidth:wi,twoCols:Si,current:Ci};function Ns({onSubmit:t,onCancel:s,initialColour:n,initialLabel:a,initialKey:i}){const{data:l}=lt(),[r,c]=g.useState(n||""),{handleSubmit:m,register:o,setFocus:u,setError:h,setValue:d,getValues:x,watch:j,formState:{errors:p,isSubmitting:y,isValid:v,isDirty:b}}=ce({defaultValues:{type:"text",label:a||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),S=async w=>{const{type:$,label:_,colour:G}=w,q={type:$,colour:G,label:_};try{await t(q)}catch(F){h("root",{type:"custom",message:V(F)})}};g.useEffect(()=>{u("label")},[u]);const L=w=>{c(w),d("colour",w,{shouldDirty:!0})},R=x("colour"),O=b&&v,U=i!==void 0;return e.jsxs($e,{as:"form",onSubmit:m(S),onKeyDown:w=>we(w,s),children:[e.jsxs(me,{children:["Please note that images can quickly deteriorate your app's performance.",e.jsx("br",{}),"Prefer using small, and compressed images."]}),e.jsxs("div",{children:[e.jsx(ne,{children:"Type"}),e.jsx(ps,{orientation:"horizontal",disabled:U,onValueChange:w=>d("type",w,{shouldDirty:!0}),value:j("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:st.twoCols,children:[e.jsxs("label",{children:[e.jsx(ne,{children:"Label (only alphanumeric characters are allowed)"}),p.label&&e.jsx(E,{children:p.label.message}),e.jsx(M,{...o("label",{required:{value:!0,message:"Required field"},onChange:()=>d("key",Ca(x("label"))??"N/A"),validate:w=>w.trim().length===0?"Required field":Ot.isAlphanumericWithSpace(w)?!U&&U&&Object.keys(l).includes(w)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(ne,{children:"Key (use in Integrations and API)"}),e.jsx(M,{...o("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(ne,{children:"Colour"}),e.jsx(Un,{name:"colour",value:R,handleChange:(w,$)=>L($)})]}),p.root&&e.jsx(E,{children:p.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!O,loading:y,children:"Save"})]})]})}function _i(t){const{colour:s,label:n,fieldKey:a,type:i,onEdit:l,onDelete:r}=t,[c,m]=g.useState(!1),o=async u=>{await l(a,u),m(!1)};return c?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ns,{onCancel:()=>m(!1),onSubmit:o,initialColour:s,initialLabel:n,initialKey:a})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(qn,{color:s})}),e.jsx("td",{children:e.jsx(H,{children:i})}),e.jsx("td",{className:st.halfWidth,children:n}),e.jsx("td",{className:st.fullWidth,children:e.jsx(Et,{size:"small",copyValue:a,children:a})}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(X,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>m(!0),children:e.jsx(nt,{})}),e.jsx(X,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>r(a),children:e.jsx(xe,{})})]})]})}function ki(){const{data:t,refetch:s}=lt(),[n,a]=g.useState(!1),i=()=>{a(!0)},l=()=>{a(!1)},r=async o=>{await ua(o),s(),a(!1)},c=async(o,u)=>{await ha(o,u),s()},m=async o=>{try{await ma(o),s()}catch{}};return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Custom fields",e.jsxs(f,{onClick:i,children:["New ",e.jsx(je,{})]})]}),e.jsx(ie,{}),e.jsx(P,{children:e.jsxs(me,{children:["Custom fields allow for additional information to be added to an event.",e.jsx("br",{}),e.jsx("br",{}),"To use custom fields as a data source in an"," ",e.jsx(vs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(te,{href:xn,children:"See the docs"})]})}),e.jsxs(P,{children:[n&&e.jsx(Ns,{onSubmit:r,onCancel:l}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Key (used in Automations)"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:Object.entries(t).map(([o,{colour:u,label:h,type:d}])=>e.jsx(_i,{fieldKey:o,colour:u,label:h,type:d,onEdit:c,onDelete:m},o))})]})]})]})})}function Di(){const{data:t,status:s,isError:n,refetch:a,isFetching:i}=St({queryKey:ge,queryFn:ca,placeholderData:(l,r)=>l,refetchInterval:hs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:a,isFetching:i}}function Ps(){const t=_t(),{mutateAsync:s}=qe({mutationFn:aa,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:n}=qe({mutationFn:ra,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:a}=qe({mutationFn:([r,c])=>ia(r,c),onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:i}=qe({mutationFn:la,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}}),{mutateAsync:l}=qe({mutationFn:oa,onMutate:()=>{t.cancelQueries({queryKey:ge})},onSuccess:r=>{t.setQueryData(ge,r.data)}});return{create:s,duplicate:n,remove:i,load:l,rename:a}}function Ri({onSubmit:t,onCancel:s,initialTitle:n}){const{handleSubmit:a,register:i,setFocus:l,setError:r,formState:{errors:c,isSubmitting:m,isValid:o,isDirty:u}}=ce({defaultValues:{title:n},mode:"onChange"}),h=async x=>{try{await t(x.title)}catch(j){r("root",{type:"custom",message:V(j)})}};g.useEffect(()=>{l("title")},[l]);const d=u&&o;return e.jsxs($e,{as:"form",onSubmit:a(h),onKeyDown:x=>we(x,s),children:[e.jsxs("label",{children:[e.jsx(ne,{children:"Rundown title"}),e.jsx(M,{...i("title",{required:{value:!0,message:"Title is required"},validate:x=>x.trim().length===0?"Title cannot be empty":Ot.isAlphanumericWithSpace(x)===!1?"Title can only contain alphanumeric characters, spaces and underscores":!0}),fluid:!0}),c.title&&e.jsx(E,{children:c.title.message})]}),c.root&&e.jsx(E,{children:c.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!d,loading:m,children:"Save"})]})]})}function Ei({onClose:t}){const{create:s}=Ps(),{handleSubmit:n,register:a,setFocus:i,setError:l,formState:{errors:r,isSubmitting:c}}=ce({defaultValues:{title:""}}),m=async o=>{try{await s(o.title||"untitled"),t()}catch(u){l("root",{message:`Failed to create rundown. ${u}`})}};return g.useEffect(()=>{i("title")},[i]),e.jsxs($e,{as:"form",onSubmit:n(m),children:[e.jsx(P,{children:e.jsxs("label",{children:[e.jsx(ne,{children:"Rundown title"}),e.jsx(M,{...a("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:c,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:c,children:"Create rundown"})]}),r.root&&e.jsx(E,{children:r.root.message})]})}function Ni(){var $;const{data:t}=Di(),{duplicate:s,remove:n,load:a,rename:i}=Ps(),[l,r]=Ee(),[c,m]=Ee(),[o,u]=Ee(),[h,d]=g.useState(""),[x,j]=g.useState(null),[p,y]=g.useState(null),v=_=>{y(null),d(_),m.open()},b=_=>{y(null),d(_),r.open()},S=_=>{y(null),j(_)},L=async()=>{try{await a(h)}catch(_){y(`Failed to load rundown. ${V(_)}`)}finally{m.close()}},R=async _=>{y(null),j(null),d("");try{await s(_)}catch(G){y(`Failed to duplicate rundown. ${V(G)}`)}},O=async(_,G)=>{try{await i([_,G]),j(null)}catch(q){y(`Failed to rename rundown. ${V(q)}`)}},U=async()=>{try{await n(h)}catch(_){y(`Failed to delete rundown. ${V(_)}`)}finally{r.close()}},w=async(_,G)=>{await Tr(_,G)};return e.jsxs(e.Fragment,{children:[e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage project rundowns",e.jsx(A,{children:e.jsxs(f,{onClick:()=>{y(null),u.open()},children:["New ",e.jsx(je,{})]})})]}),e.jsx(ie,{}),e.jsxs(P,{children:[o&&e.jsx(Ei,{onClose:u.close}),p&&e.jsx(E,{children:p}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"# Entries"}),e.jsx("th",{style:{width:"100%"},children:"Title"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:($=t==null?void 0:t.rundowns)==null?void 0:$.map(({id:_,numEntries:G,title:q})=>{const F=t.loaded===_;return x===_?e.jsx("tr",{children:e.jsx("td",{colSpan:3,children:e.jsx(Ri,{onCancel:()=>j(null),onSubmit:T=>O(_,T),initialTitle:q})})},_):e.jsxs("tr",{className:ye([F&&st.current]),children:[e.jsx("td",{children:G}),e.jsxs("td",{children:[q," ",F&&e.jsx(H,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(xs,{render:e.jsx(X,{variant:"ghosted-white"}),items:[{type:"item",icon:ns,label:"Rename",onClick:()=>S(_)},{type:"item",icon:Ge,label:"Load",onClick:()=>v(_),disabled:F},{type:"item",icon:as,label:"Download .xlsx",onClick:()=>w(_,q)},{type:"item",icon:Us,label:"Duplicate",onClick:()=>R(_)},{type:"divider"},{type:"destructive",icon:xe,label:"Delete",onClick:()=>b(_),disabled:F}],children:e.jsx(rs,{})})})]},_)})})]})]})]})}),e.jsx(ft,{isOpen:l,onClose:r.close,title:"Delete 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(f,{size:"large",onClick:r.close,children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"large",onClick:U,children:"Delete rundown"})]})}),e.jsx(ft,{isOpen:c,onClose:m.close,title:"Load rundown",showBackdrop:!0,showCloseButton:!0,bodyElements:e.jsxs(e.Fragment,{children:["The current playback will be stopped. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{size:"large",onClick:m.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:L,children:"Load rundown"})]})})]})}function Pi(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:a,defaultDangerTime:i,defaultTimerType:l,defaultEndAction:r,setDefaultDuration:c,setLinkPrevious:m,setTimeStrategy:o,setWarnTime:u,setDangerTime:h,setDefaultTimerType:d,setDefaultEndAction:x}=ys(v=>v),j=He(t),p=He(a),y=He(i);return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Rundown defaults"}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(be,{children:"Default settings for new events"}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(ke,{size:"large",checked:s,onCheckedChange:m})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ae,{value:n,onValueChange:v=>o(v),options:[{value:qt.LockDuration,label:"Duration"},{value:qt.LockEnd,label:"End Time"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Default duration",description:"Default duration for new events"}),e.jsx(Ke,{name:"defaultDuration",submitHandler:(v,b)=>c(b),time:j,placeholder:Be.duration})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ae,{value:l,onValueChange:v=>d(v),options:[{value:Ye.CountDown,label:"Count down"},{value:Ye.CountUp,label:"Count up"},{value:Ye.Clock,label:"Clock"},{value:Ye.None,label:"None"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"End Action",description:"Default end action for new events"}),e.jsx(ae,{value:r,onValueChange:v=>x(v),options:[{value:ht.None,label:"None"},{value:ht.LoadNext,label:"Load next"},{value:ht.PlayNext,label:"Play next"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Ke,{name:"warnTime",submitHandler:(v,b)=>u(b),time:p,placeholder:Be.warnTime})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Ke,{name:"dangerTime",submitHandler:(v,b)=>h(b),time:y,placeholder:Be.dangerTime})]})]})]})]})})}function Oi({location:t}){const s=re("defaults",t),n=re("custom",t),a=re("rundowns",t),i=re("sheets",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(Pi,{})}),e.jsx("div",{ref:n,children:e.jsx(ki,{})}),e.jsx("div",{ref:a,children:e.jsx(Ni,{})}),e.jsx("div",{ref:i,children:e.jsx(bi,{})})]})}const Ti="_textEntry_1xa10_17",Ai="_inlineEntry_1xa10_25",Fi="_redirect_1xa10_32",Ii="_label_1xa10_36",Pe={textEntry:Ti,inlineEntry:Ai,redirect:Fi,label:Ii};function Li({id:t,isOpen:s,name:n,currentPath:a,origin:i,onClose:l}){const{data:r}=ds(),[c,m]=g.useState(a),[o,u]=g.useState("/"),{setRedirect:h}=ms,d=p=>{p==="/"||p===a||(p.startsWith("preset-")?h({target:t,redirect:p.slice(7)}):h({target:t,redirect:p}),l())},x=r.filter(p=>p.enabled),j=[...jn.map(p=>({value:`/${p.url}`,label:p.label})),...x.map(p=>({value:`preset-${p.alias}`,label:`URL Preset: ${p.alias}`}))];return e.jsx(it,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(me,{children:["Remotely redirect the client to a different URL. ",e.jsx("br",{}),"Either by entering a custom path or selecting a URL Preset.",e.jsx("br",{}),e.jsx("br",{}),e.jsx(vs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:Pe.inlineEntry,children:[e.jsx("span",{className:Pe.label,children:"Enter custom path"}),e.jsxs("label",{className:Pe.textEntry,children:[i,e.jsx(M,{placeholder:"eg. /timer",fluid:!0,value:c,onChange:p=>m(p.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:c===a||c==="",className:Pe.redirect,onClick:()=>d(c),children:["Redirect",e.jsx(Lt,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:Pe.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:Pe.inlineEntry,children:[e.jsxs("label",{className:Pe.textEntry,children:[i,e.jsx(ae,{fluid:!0,options:j,defaultValue:j[0].value,onValueChange:p=>u(p),disabled:x.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:Pe.redirect,disabled:x.length===0||o==="/",onClick:()=>d(o),children:["Redirect ",e.jsx(Lt,{})]})]})]})]})})}const $i="_blink_vtewd_1",Vi="_halfWidthNoWrap_vtewd_25",Mi="_copiable_vtewd_30",wt="_self_vtewd_35",ze={blink:$i,halfWidthNoWrap:Vi,copiable:Mi,self:wt};function Wi(){const t=Mt(j=>j.id),s=Mt(j=>j.clients),[n,a]=Ee(),[i,l]=Ee(),{setIdentify:r}=ms,[c,m]=g.useState(""),o=j=>{m(j),l.open()},u=j=>{m(j),a.open()},h=Object.entries(s).filter(([j,{type:p}])=>p==="ontime"),d=Object.entries(s).filter(([j,{type:p}])=>p!=="ontime"),x=s[c];return e.jsxs(e.Fragment,{children:[n&&x!==void 0&&e.jsx(Li,{id:c,name:x.name,origin:x.origin,currentPath:x.path,isOpen:n,onClose:a.close}),i&&e.jsx(pn,{id:c,name:x==null?void 0:x.name,isOpen:i,onClose:l.close}),e.jsxs(P,{children:[e.jsxs(be,{children:["Ontime Clients (",h.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:{width:"20%"},children:"Client Name"}),e.jsx("td",{children:"Path"}),e.jsx("td",{})]})}),e.jsx("tbody",{children:h.map(([j,p])=>{const{identify:y,name:v,path:b}=p,S=t===j;return e.jsxs("tr",{className:ye([S&&ze.self]),children:[e.jsxs(A,{relation:"inner",as:"td",children:[S&&e.jsx(H,{children:"SELF"}),v]}),e.jsx("td",{className:ze.copiable,children:b}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${y?ze.blink:""}`,disabled:S,variant:y?"primary":"subtle","data-testid":S?"":"not-self-identify",onClick:()=>{r({target:j,identify:!y})},children:"Identify"}),e.jsx(f,{size:"small","data-testid":S?"":"not-self-rename",onClick:()=>o(j),children:"Rename"}),e.jsx(f,{size:"small",disabled:S,"data-testid":S?"":"not-self-redirect",onClick:()=>u(j),children:"Redirect"})]})]},j)})})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsxs(be,{children:["Other Clients (",d.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:ze.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:ze.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:d.map(([j,p])=>{const{name:y,type:v}=p;return e.jsxs("tr",{children:[e.jsx("td",{children:y}),e.jsx("td",{children:v})]},j)})})]})]})]})}function Ui(){return e.jsx(P,{children:e.jsxs(se,{children:[e.jsx(Q,{children:"Manage clients"}),e.jsx(ie,{}),e.jsx(Wi,{})]})})}const qi="_iconRotate_l21m9_17",zi={iconRotate:qi};function Bi(){const t=s=>{us("log",s)};return e.jsx(P,{children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(Ct,{className:zi.iconRotate})]})]}),e.jsx(ie,{}),e.jsx(gn,{})]})})}function Ki({location:t}){const s=re("clients",t),n=re("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Network"}),fn,e.jsx("div",{ref:n,children:e.jsx(Bi,{})}),e.jsx("div",{ref:s,children:e.jsx(Ui,{})})]})}const Xt={project:{title:""},settings:{timeFormat:"24",language:"en"}};function Hi({isOpen:t,onClose:s}){var v,b,S,L;const{defaultWarnTime:n,defaultDangerTime:a,setDangerTime:i,setWarnTime:l}=ys(),{handleSubmit:r,register:c,formState:{errors:m,isSubmitting:o,isValid:u},watch:h,setError:d,setValue:x}=ce({defaultValues:Xt,values:Xt,resetOptions:{keepDirtyValues:!0}}),j=async R=>{try{R.project.title===""&&(R.project.title="untitled"),await Br(R),await We(),s()}catch(O){d("root",{message:V(O)})}},p=He(n),y=He(a);return e.jsx(it,{isOpen:t,onClose:s,showBackdrop:!0,showCloseButton:!0,title:"Create new project...",bodyElements:e.jsxs("form",{onSubmit:r(j),id:"quick-start",children:[e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Project title",description:"Shown as the title in some views"}),e.jsx(M,{maxLength:150,placeholder:"Project title",fluid:!0,...c("project.title")})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Time format",description:"Default time format to show in views 12 / 24 hours (does not affect editor)",error:(b=(v=m.settings)==null?void 0:v.timeFormat)==null?void 0:b.message}),e.jsx(ae,{value:h("settings.timeFormat"),onValueChange:R=>x("settings.timeFormat",R,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Views language",description:"Language to be displayed in views",error:(L=(S=m.settings)==null?void 0:S.language)==null?void 0:L.message}),e.jsx(ae,{value:h("settings.language"),onValueChange:R=>x("settings.language",R,{shouldDirty:!0}),defaultValue:"en",options:[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Ke,{name:"warnTime",submitHandler:(R,O)=>l(O),time:p,placeholder:Be.warnTime})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Ke,{name:"dangerTime",submitHandler:(R,O)=>i(O),time:y,placeholder:Be.dangerTime})]})]})]}),footerElements:e.jsxs(e.Fragment,{children:[(m==null?void 0:m.root)&&e.jsx(E,{children:m.root.message}),e.jsx(f,{variant:"ghosted",onClick:s,disabled:!1,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",form:"quick-start",disabled:!u,loading:o,children:"Create project"})]})})}const Gi="_current_13n43_17",Qi="_isEditing_13n43_21",Yi="_form_13n43_25",Ji="_formInput_13n43_33",Xi="_saveButton_13n43_37",Zi="_containCell_13n43_41",el="_sortableHeader_13n43_45",tl="_innerColumn_13n43_55",sl="_inlineLabels_13n43_63",nl="_warningInfo_13n43_68",al="_empty_13n43_72",he={current:Gi,isEditing:Qi,form:Yi,formInput:Ji,saveButton:Xi,containCell:Zi,sortableHeader:el,innerColumn:tl,inlineLabels:sl,warningInfo:nl,empty:al};function rl({onClose:t}){const[s,n]=g.useState(null),{handleSubmit:a,register:i,formState:{isSubmitting:l,isValid:r},setFocus:c}=ce({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{c("title")},[c]);const m=async o=>{try{n(null);const u=o.title??"untitled";await zr({filename:u}),t()}catch(u){n(V(u))}};return e.jsxs($e,{as:"form",onSubmit:a(m),onKeyDown:o=>we(o,t),children:[e.jsxs(be,{children:["Create new project",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:l,children:"Cancel"}),e.jsx(f,{disabled:!r,type:"submit",loading:l,variant:"primary",children:"Create project"})]})]}),s&&e.jsx(E,{children:s}),e.jsxs(P,{className:he.innerColumn,children:[e.jsx(ne,{children:"Project title"}),e.jsx(M,{fluid:!0,placeholder:"Your project name",...i("title")})]})]})}const il={files:[],lastLoadedProject:""};function ll(){const{data:t,status:s,refetch:n}=St({queryKey:yn,queryFn:Kr,placeholderData:(a,i)=>a,retry:5,retryDelay:a=>a*2500,refetchInterval:hs,networkMode:"always"});return{data:t??il,status:s,refetch:n}}const ol={"alphabetical-asc":(t,s)=>t.filename.localeCompare(s.filename),"alphabetical-desc":(t,s)=>s.filename.localeCompare(t.filename),"modified-asc":(t,s)=>new Date(t.updatedAt).getTime()-new Date(s.updatedAt).getTime(),"modified-desc":(t,s)=>new Date(s.updatedAt).getTime()-new Date(t.updatedAt).getTime()};function Os(t="modified-desc"){const s=ll(),{files:n,lastLoadedProject:a}=s.data,i=g.useMemo(()=>{if(!n.length)return[];const l=[...n].sort(ol[t]),r=l.findIndex(c=>c.filename===a);if(r>0){const[c]=l.splice(r,1);l.unshift(c)}return l},[n,a,t]);return{...s,data:{reorderedProjectFiles:i,lastLoadedProject:s.data.lastLoadedProject}}}function cl({action:t,filename:s,onSubmit:n,onCancel:a}){const{handleSubmit:i,register:l,formState:{isSubmitting:r,isDirty:c,isValid:m},setFocus:o}=ce({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return g.useEffect(()=>{o("filename")},[o]),e.jsxs("form",{onSubmit:i(n),onKeyDown:u=>we(u,a),className:he.form,children:[e.jsx(M,{className:he.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{onClick:a,variant:"ghosted",disabled:r,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!c||!m||r,type:"submit",className:he.saveButton,children:t})]})]})}async function dl(t,s){const n={};for(const a in s)da(a,t)&&s[a]&&(a==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[a]:t[a]}));return n}function ul({onClose:t,fileName:s}){const[n,a]=g.useState(null),i=_t(),{handleSubmit:l,watch:r,setValue:c,formState:{isSubmitting:m,isValid:o,isDirty:u}}=ce({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),h=async d=>{if(Object.values(d).every(j=>!j)){a("At least one option must be selected");return}try{a(null);const{data:j}=await ks(s);if(!j.settings.version.startsWith("4.")){a("The project you are attempting to merge is from an older version and it need to be migrated first");return}const p=await dl(j,d);await Rs(p),await i.invalidateQueries({queryKey:bn}),t()}catch(j){a(V(j))}};return e.jsxs(P,{as:"form",onSubmit:l(h),children:[e.jsxs(be,{children:["Partial project merge",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:m,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:!o||!u,loading:m,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(E,{children:n}),e.jsxs(P,{className:ye([he.innerColumn,he.inlineLabels]),children:[e.jsxs(ne,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(me,{type:"warning",children:["This process is irreversible and can result in data loss. ",e.jsx("br",{}),"You may want to create a duplicate backup beforehand."]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("project"),onCheckedChange:d=>c("project",d,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("rundowns"),onCheckedChange:d=>c("rundowns",d,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("viewSettings"),onCheckedChange:d=>c("viewSettings",d,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("urlPresets"),onCheckedChange:d=>c("urlPresets",d,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(ke,{size:"large",checked:r("automation"),onCheckedChange:d=>c("automation",d,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function hl({current:t,updatedAt:s,editingFilename:n,editingMode:a,filename:i,onRefetch:l,onSubmit:r,onToggleEditMode:c}){const[m,o]=g.useState(null),[u,h]=g.useState(!1),d=R=>async O=>{h(!0),o(null);try{if(!O.filename){o("Filename cannot be blank");return}await(R==="rename"?Qr:Gr)(i,O.filename),await l(),r()}catch(U){o(V(U))}finally{h(!1)}},x=async R=>{h(!0),o(null);try{await Es(R),await l(),await We()}catch(O){o(V(O))}finally{h(!1)}},j=async R=>{h(!0),o(null);try{await Yr(R),await l()}catch(O){o(V(O))}finally{h(!1)}},p=(R,O)=>{o(null),c(R,O)},y=()=>{p(null,null)},v=i===n,b=(a==="rename"||a==="duplicate")&&i===n,S=a==="merge"&&v,L=ye([t&&!v&&he.current,v&&he.isEditing]);return e.jsxs(e.Fragment,{children:[m&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(E,{children:m})})},"filename-error"),e.jsx("tr",{className:L,children:b?e.jsx("td",{colSpan:99,children:e.jsx(cl,{action:a,filename:i,onSubmit:d(a==="duplicate"?"duplicate":"rename"),onCancel:y})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:he.containCell,children:i}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(ml,{current:t,filename:i,onChangeEditMode:p,onDelete:j,onLoad:x,isDisabled:u||S,onMerge:R=>p("merge",R)})})]})},i),S&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(ul,{onClose:y,fileName:i})})})]})}function ml(t){const{current:s,filename:n,isDisabled:a,onChangeEditMode:i,onDelete:l,onLoad:r,onMerge:c}=t,m=()=>{i("rename",n)},o=()=>{i("duplicate",n)},u=async()=>{await qr(n)};return e.jsx(xs,{render:e.jsx(X,{variant:"ghosted-white"}),disabled:a,items:[{type:"item",icon:Ge,label:"Load",onClick:()=>r(n),disabled:s},{type:"item",icon:Ge,label:"Partial Load",onClick:()=>c(n),disabled:s},{type:"item",icon:ns,label:"Rename",onClick:m},{type:"item",icon:qs,label:"Duplicate",onClick:o},{type:"item",icon:as,label:"Download",onClick:u},{type:"divider"},{type:"item",icon:xe,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(rs,{})})}function xl(){const[t,s]=g.useState(null),[n,a]=g.useState(null),[i,l]=g.useState("modified-desc"),{data:r,refetch:c,status:m}=Os(i),o=(j,p)=>{s(y=>y===j&&p===n?null:j),a(p)},u=()=>{s(null),a(null)},h=async()=>{await c()},d=j=>{l(p=>{const y=p===`${j}-asc`;return`${j}-${y?"desc":"asc"}`})};if(m==="pending")return e.jsx("div",{className:he.empty,children:e.jsx(Le,{isLoading:!0})});const x=r.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[x>20&&e.jsxs(me,{className:he.warningInfo,type:"warning",children:["You have ",x," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:he.containCell,onClick:()=>d("alphabetical"),children:e.jsxs("span",{className:he.sortableHeader,children:["File Name",e.jsx(Zt,{sortMode:i,type:"alphabetical"})]})}),e.jsx("th",{onClick:()=>d("modified"),children:e.jsxs("span",{className:he.sortableHeader,children:["Last Used",e.jsx(Zt,{sortMode:i,type:"modified"})]})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.reorderedProjectFiles.map(j=>e.jsx(hl,{filename:j.filename,updatedAt:j.updatedAt,onToggleEditMode:o,onSubmit:u,onRefetch:h,editingFilename:n,editingMode:t,current:j.filename===r.lastLoadedProject},j.filename))})]})]})}function Zt({sortMode:t,type:s}){const n=`${s}-`;return t===`${n}asc`?e.jsx(zs,{}):t===`${n}desc`?e.jsx(Ct,{}):null}function jl(){const[t,s]=is(),[n,a]=g.useState(""),[i,l]=g.useState(null),r=g.useRef(null),c=t.get("new")==="true",m=()=>{t.set("new",c?"false":"true"),s(t)},o=()=>{var d;(d=r.current)==null||d.click()},u=async d=>{var j,p;const x=(p=(j=d.target)==null?void 0:j.files)==null?void 0:p[0];if(x){l("import");try{_s(x),await Ds(x)}catch(y){const v=V(y);a(`Error uploading file: ${v}`)}finally{await We()}l(null)}},h=()=>{t.delete("new"),s(t)};return e.jsxs(P,{children:[e.jsx("input",{ref:r,style:{display:"none"},type:"file",onChange:u,accept:".json","data-testid":"file-input"}),e.jsxs(se,{children:[e.jsxs(Q,{children:["Manage projects",e.jsxs(A,{children:[e.jsx(f,{onClick:o,disabled:!!i||c,loading:i==="import",children:"Import"}),e.jsxs(f,{onClick:m,disabled:!!i||c,children:["New ",e.jsx(je,{})]})]})]}),n&&e.jsx(E,{children:n}),e.jsx(ie,{}),c&&e.jsx(rl,{onClose:h}),e.jsx(xl,{})]})]})}function pl({location:t,setLocation:s}){const n=re("list",t),a=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Project"}),e.jsx(Hi,{isOpen:t==="create",onClose:a}),e.jsx("div",{ref:n,children:e.jsx(jl,{})})]})}const gl="_container_cq029_17",fl={container:gl};function es({register:t,formName:s,disabled:n}){const[a,i]=g.useState(!1);return e.jsxs("div",{className:fl.container,children:[e.jsx(M,{type:a?"text":"password",maxLength:4,...t(s,{pattern:{value:Yn,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(X,{onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(Bs,{})})]})}const yl=g.lazy(()=>Qe(()=>import("./CustomTranslationModal-CtBvokyt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url));function bl(){var R,O,U,w,$;const{data:t,status:s,refetch:n}=vn(),{handleSubmit:a,register:i,reset:l,setError:r,watch:c,setValue:m,formState:{isSubmitting:o,isDirty:u,isValid:h,errors:d}}=ce({mode:"onChange",defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}}),[x,j]=Ee();g.useEffect(()=>{t&&l(t)},[t,l]);const p=async _=>{try{await wn(_)}catch(G){const q=V(G);r("root",{message:q})}finally{await n()}},y=s==="pending",v=o||!u||!h,b="",S=()=>{l(t)},L=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(yl,{isOpen:x,onClose:j.close}),e.jsx(P,{as:"form",onSubmit:a(p),onKeyDown:_=>we(_,S),id:"app-settings",children:e.jsxs(se,{children:[e.jsxs(Q,{children:["General settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!u||o,variant:"ghosted",onClick:S,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:o,disabled:v,variant:"primary",children:"Save"})]})]}),b,e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(me,{children:"Changes to the time format and views language do not affect the editor view"}),e.jsx(Le,{isLoading:L}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Ontime server port",description:Me?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(R=d.serverPort)==null?void 0:R.message}),e.jsx(M,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Me,...i("serverPort",{required:{value:!0,message:"Required field"},max:{value:65535,message:"Port must be within range 1024 - 65535"},min:{value:1024,message:"Port must be within range 1024 - 65535"},pattern:{value:js,message:"Value should be numeric"}})})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(O=d.editorKey)==null?void 0:O.message}),e.jsx(es,{register:i,formName:"editorKey",disabled:y})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(U=d.operatorKey)==null?void 0:U.message}),e.jsx(es,{register:i,formName:"operatorKey",disabled:y})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Time format",description:"Default time format to show in views 12 / 24 hours",error:(w=d.timeFormat)==null?void 0:w.message}),e.jsx(ae,{value:c("timeFormat"),onValueChange:_=>m("timeFormat",_,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Views language",description:"Language to be displayed in views",error:($=d.language)==null?void 0:$.message}),e.jsx(ae,{value:c("language"),onValueChange:_=>m("language",_,{shouldDirty:!0}),disabled:y,defaultValue:"en",options:[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"},{value:"custom",label:"Custom"}]}),e.jsx(f,{onClick:j.open,children:"Edit custom translation"})]})]})]})]})})]})}const vl="_uploadLogoCard_m5263_17",wl="_customDataItem_m5263_32",Sl="_titleRow_m5263_39",Cl="_customImage_m5263_48",_l="_imageContainer_m5263_54",Ve={uploadLogoCard:vl,customDataItem:wl,titleRow:Sl,customImage:Cl,imageContainer:_l};function kl(){var q;const{data:t,status:s}=zn(),{updateProjectData:n}=Bn(),{handleSubmit:a,register:i,reset:l,formState:{isSubmitting:r,isValid:c,isDirty:m,errors:o},setError:u,clearErrors:h,watch:d,control:x,setValue:j}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:p,append:y,remove:v}=et({control:x,name:"custom"});g.useEffect(()=>{t&&l(t)},[t,l]);const b=async F=>{var T;const N=(T=F.target.files)==null?void 0:T[0];if(h("logo"),!!N)try{Ur(N);const D=await Kn(N);j("logo",D.data.logoFilename,{shouldDirty:!0})}catch(D){const K=V(D);u("logo",{message:K})}},{ref:S,...L}=i("logo"),R=g.useRef(null),O=()=>{var F;(F=R.current)==null||F.click()},U=F=>{F.preventDefault(),F.stopPropagation(),j("logo",null,{shouldDirty:!0})},w=()=>{y({title:"",value:"",url:""})},$=async F=>{try{h(),await n(F)}catch(N){const T=V(N);u("root",{message:T})}},_=()=>{l(t)},G=s==="pending";return e.jsx(P,{as:"form",onSubmit:a($),onKeyDown:F=>we(F,_),children:e.jsxs(se,{children:[e.jsxs(Q,{children:["Project data",e.jsxs(A,{children:[e.jsx(f,{onClick:_,disabled:r||!m,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!m||!c,loading:r,children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:G}),e.jsxs("label",{children:["Project title",e.jsx(M,{fluid:!0,maxLength:50,placeholder:"Project title is shown in production views",...i("title")})]}),e.jsx(P,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...L,ref:F=>{S(F),R.current=F},onChange:b}),e.jsxs(se,{className:Ve.uploadLogoCard,children:[d("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${Sn}/${d("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:r||!d("logo"),onClick:U,children:[e.jsx(xe,{}),"Delete"]})]}):e.jsxs(f,{disabled:r,onClick:O,type:"button",children:[e.jsx(Ge,{}),"Upload logo"]}),((q=o==null?void 0:o.logo)==null?void 0:q.message)&&e.jsx(E,{children:o.logo.message})]})]})}),e.jsxs("label",{children:["Project description",e.jsx(M,{fluid:!0,maxLength:100,placeholder:"Euro Love, Malmö 2024",...i("description")})]}),e.jsxs("label",{children:["Project info",e.jsx(yt,{fluid:!0,maxLength:150,placeholder:"Wi-Fi password: 1234",resize:"vertical",...i("info")})]}),e.jsxs("label",{children:["Project QR code URL",e.jsx(M,{fluid:!0,placeholder:Rt,...i("url")})]}),e.jsxs(P,{style:{marginTop:0},children:[e.jsxs(W,{children:[e.jsx(B,{title:"Custom data",description:""}),e.jsxs(f,{onClick:w,children:["Add ",e.jsx(je,{})]})]}),p.length>0&&p.map((F,N)=>{var D,K,I;const T=(D=o.custom)==null?void 0:D[N];return e.jsxs("div",{className:Ve.customDataItem,children:[e.jsxs("div",{className:Ve.titleRow,children:[e.jsxs("label",{className:Ve.title,children:["Title",e.jsx(M,{fluid:!0,defaultValue:F.title,placeholder:"Title of your custom data",...i(`custom.${N}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>v(N),children:[e.jsx(xe,{}),"Delete"]})]}),((K=T==null?void 0:T.title)==null?void 0:K.message)&&e.jsx(E,{children:T.title.message}),e.jsxs("label",{children:["Text",e.jsx(yt,{fluid:!0,rows:3,resize:"vertical",defaultValue:F.value,placeholder:"Text of your custom data",...i(`custom.${N}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),((I=T==null?void 0:T.value)==null?void 0:I.message)&&e.jsx(E,{children:T.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Ve.customImage,children:[e.jsx(M,{fluid:!0,defaultValue:F.url,placeholder:"Paste image URL (optional)",...i(`custom.${N}.url`)}),e.jsx("div",{className:Ve.imageContainer,children:d(`custom.${N}.url`)&&e.jsx("img",{src:d(`custom.${N}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},F.id)})]})]})]})})}const Dl="_editorActions_18rtd_17",Rl="_right_18rtd_21",El="_column_18rtd_26",jt={editorActions:Dl,right:Rl,column:El},Nl=g.lazy(()=>Qe(()=>import("./StyleEditor-RZvkKHdf.js"),__vite__mapDeps([11,1,2,12]),import.meta.url));function Pl({isOpen:t,onClose:s}){const[n,a]=g.useState(""),[i,l]=g.useState(!1),[r,c]=g.useState(!1),[m,o]=g.useState(!1),[u,h]=g.useState(null),d=g.useRef(null),x=async()=>{try{o(!0);const y=await Cn();a(y)}catch{}finally{o(!1)}},j=async()=>{try{c(!0),d.current&&(await _n(d.current.getCss()),a(d.current.getCss()),l(!1))}catch{}finally{c(!1)}},p=()=>a("");return g.useEffect(()=>{async function y(){if(t)try{const v=await kn();a(v)}catch{h("Failed to load CSS from server")}}y()},[t]),e.jsx(it,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(Nl,{ref:d,initialValue:n,language:"css",isDirty:i,setIsDirty:l}),footerElements:e.jsxs("div",{className:jt.column,children:[e.jsx(me,{children:"Invalid CSS will be refused by the browser"}),u&&e.jsx(E,{className:jt.right,children:`Error: ${u}`}),e.jsxs(A,{align:"apart",className:jt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:x,disabled:r||m,children:"Reset to example"}),e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:p,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:j,disabled:r||m||!i,loading:r,children:"Save changes"})]})]})]})})}const Ol="https://docs.getontime.no/features/custom-styling/";function Tl(){var y;const{data:t,status:s,mutateAsync:n}=Dn(),[a,i]=Ee(),{control:l,handleSubmit:r,setError:c,reset:m,setValue:o,watch:u,formState:{isSubmitting:h,isDirty:d,errors:x}}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}});g.useEffect(()=>{t&&m(t)},[t,m]);const j=async v=>{try{n(v)}catch(b){const S=V(b);c("root",{message:S})}},p=()=>{m(t)};return l?e.jsx(P,{as:"form",onSubmit:r(j),onKeyDown:v=>we(v,p),id:"view-settings",children:e.jsxs(se,{children:[e.jsxs(Q,{children:["View settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!d,variant:"ghosted",onClick:p,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:h,disabled:!d,variant:"primary",children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(me,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(te,{href:Ol,children:"See the docs"})]}),e.jsxs(P,{children:[e.jsx(Le,{isLoading:s==="pending"}),e.jsx(E,{children:(y=x.root)==null?void 0:y.message}),e.jsxs(oe,{children:[e.jsx(Pl,{isOpen:a,onClose:i.close}),e.jsxs(W,{children:[e.jsx(B,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(ke,{size:"large",checked:u("overrideStyles"),onCheckedChange:v=>o("overrideStyles",v,{shouldDirty:!0})}),e.jsx(f,{onClick:i.open,disabled:h,children:"Edit CSS override"})]})]}),e.jsxs(oe,{children:[e.jsxs(W,{children:[e.jsx(B,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(ut,{name:"normalColor",control:l})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(ut,{name:"warningColor",control:l})]}),e.jsxs(W,{children:[e.jsx(B,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(ut,{name:"dangerColor",control:l})]})]})]})]})}):null}function Al({location:t}){const s=re("data",t),n=re("general",t),a=re("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(kl,{})}),e.jsx("div",{ref:n,children:e.jsx(bl,{})}),e.jsx("div",{ref:a,children:e.jsx(Tl,{})})]})}function Fl(){const{isElectron:t,sendToElectron:s}=Rn(),[n,a]=Ee(),i=g.useRef(null),l=()=>{s("shutdown","now"),a.close()},r=t||tt;return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{children:"Shutdown Ontime"}),e.jsxs(P,{children:[Me?e.jsx(En,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(Ne,{children:["This will shutdown the Ontime server. ",e.jsx("br",{}),"The runtime state will be lost, but your project is kept for next time."]}),e.jsx(f,{variant:"destructive",onClick:a.open,disabled:!(t||tt),children:"Shutdown ontime"}),!r&&e.jsx(ne,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(ft,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:a.close,bodyElements:e.jsxs(Ne,{children:["This will shutdown the Ontime server. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{ref:i,onClick:a.close,variant:"ghosted-white",children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:l,disabled:!r,children:"Shutdown"})]})})]})]})}const Il="_corner_1dxip_17",Ll="_contentWrapper_1dxip_24",$l="_content_1dxip_24",pt={corner:Il,contentWrapper:Ll,content:$l};function Vl({onClose:t,children:s}){return e.jsxs("div",{className:pt.contentWrapper,children:[e.jsx("div",{className:pt.content,children:s}),e.jsx("div",{className:pt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(kt,{})]})})]})}const Ml=[{id:"settings",label:"Settings",secondary:[{id:"settings__data",label:"Project data"},{id:"settings__general",label:"General settings"},{id:"settings__view",label:"View settings"}]},{id:"project",label:"Project",split:!0,secondary:[{id:"project__create",label:"Create..."},{id:"project__list",label:"Manage projects"}]},{id:"manage",label:"Project settings",secondary:[{id:"manage__defaults",label:"Rundown defaults"},{id:"manage__custom",label:"Custom fields"},{id:"manage__rundowns",label:"Manage rundowns"},{id:"manage__sheets",label:"Import spreadsheet"},{id:"manage__sheets",label:"Sync with Google Sheet"}]},{id:"automation",label:"Automation",split:!0,secondary:[{id:"automation__settings",label:"Automation settings"},{id:"automation__automations",label:"Manage automations"},{id:"automation__triggers",label:"Manage triggers"}]},{id:"sharing",label:"Sharing and reporting",split:!0,secondary:[{id:"sharing__presets",label:"URL Presets"},{id:"sharing__link",label:"Share link"},{id:"sharing__report",label:"Runtime report"}]},{id:"network",label:"Network",split:!0,secondary:[{id:"network__log",label:"Event log"},{id:"network__clients",label:"Manage clients"}]},{id:"about",label:"About",split:!0},{id:"shutdown",label:"Shutdown",split:!0}];function Wl(){const{data:t}=ws();return{options:g.useMemo(()=>Ml.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Xe="settings";function At(){const[t,s]=is(),n=g.useMemo(()=>t.get(Xe)??"project",[t]),a=g.useMemo(()=>!!t.get(Xe),[t]),[i,l]=n.split("__"),r=g.useCallback(()=>{t.delete(Xe),s(t)},[t,s]),c=g.useCallback(m=>{t.set(Xe,m),s(t)},[t,s]);return{isOpen:a,panel:i,location:l,setLocation:c,close:r}}const Ul="_tabs_86c70_17",ql="_primary_86c70_31",zl="_secondary_86c70_32",Bl="_active_86c70_54",Kl="_highlight_86c70_58",Hl="_split_86c70_68",Fe={tabs:Ul,primary:ql,secondary:zl,active:Bl,highlight:Kl,split:Hl};function Gl({selectedPanel:t,location:s}){const{options:n}=Wl();return e.jsx("ul",{className:Fe.tabs,children:n.map(a=>{const i=t===a.id;return a.highlight?e.jsx(bs,{text:a.highlight,render:e.jsx("span",{}),children:e.jsx(ts,{panel:a,location:s,isSelected:i})},a.id):e.jsx(ts,{panel:a,location:s,isSelected:i},a.id)})})}function ts(t){var r;const{panel:s,isSelected:n,location:a}=t,{setLocation:i}=At(),l=ye([Fe.primary,n&&Fe.active,s.split&&Fe.split,s.highlight&&Fe.highlight]);return e.jsxs(g.Fragment,{children:[e.jsx("li",{onClick:()=>i(s.id),onKeyDown:c=>{Wt(c)&&i(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(r=s.secondary)==null?void 0:r.map((c,m)=>{const o=c.id.split("__")[1],u=ye([Fe.secondary,n&&a===o?Fe.active:null]);return e.jsx("li",{onClick:()=>i(c.id),onKeyDown:h=>{Wt(h)&&i(c.id)},className:u,role:"button",children:c.label},c.id+m)})]},s.id)}const Ql="_container_1fy3l_17",Yl={container:Ql};function Jl(){const{close:t,panel:s,location:n,setLocation:a}=At();return ka(t,"Escape"),e.jsx("div",{className:Yl.container,children:e.jsxs(Ks,{children:[e.jsx(Gl,{selectedPanel:s,location:n}),e.jsxs(Vl,{onClose:t,children:[s==="settings"&&e.jsx(Al,{location:n}),s==="project"&&e.jsx(pl,{location:n,setLocation:a}),s==="manage"&&e.jsx(Oi,{location:n}),s==="automation"&&e.jsx(dr,{location:n}),s==="sharing"&&e.jsx(Nr,{location:n}),s==="network"&&e.jsx(Ki,{location:n}),s==="about"&&e.jsx(Pa,{}),s==="shutdown"&&e.jsx(Fl,{})]})]})})}const Xl=g.memo(Zl);function Zl({children:t}){return e.jsxs(Jn,{navElements:t,children:[e.jsx(Xn,{}),e.jsx(ya,{}),e.jsx(ba,{}),e.jsx(va,{}),e.jsx(wa,{}),e.jsx(Sa,{})]})}function eo({onFinish:t}){const s=g.useRef(null),n=()=>{var i;(i=s.current)==null||i.click()},a=async i=>{var r,c;const l=(c=(r=i.target)==null?void 0:r.files)==null?void 0:c[0];if(l)try{_s(l),await Ds(l)}catch{}finally{await We(),t()}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:s,style:{display:"none"},type:"file",onChange:a,accept:".json","data-testid":"file-input"}),e.jsx(f,{onClick:n,children:"Import project"})]})}const to="_sections_ar7bf_17",so="_column_ar7bf_23",no="_about_ar7bf_23",ao="_inline_ar7bf_35",ro="_header_ar7bf_41",io="_logo_ar7bf_48",lo="_buttonRow_ar7bf_53",oo="_tableContainer_ar7bf_62",co="_table_ar7bf_62",uo="_current_ar7bf_75",fe={sections:to,column:so,about:no,inline:ao,header:ro,logo:io,buttonRow:lo,tableContainer:oo,table:co,current:uo};function ho(t){const{loadProject:s,onClose:n}=t,{data:a}=Os();return e.jsx("tbody",{children:a.reorderedProjectFiles.map(i=>i.filename===a.lastLoadedProject?e.jsxs("tr",{className:fe.current,onClick:n,children:[e.jsx("td",{children:i.filename}),e.jsx("td",{children:"Loaded from last session"})]},i.filename):e.jsxs("tr",{onClick:()=>s(i.filename),children:[e.jsx("td",{children:i.filename}),e.jsx("td",{children:new Date(i.updatedAt).toLocaleString()})]},i.filename))})}function mo({onClose:t}){const s=Hs(),n=async l=>{try{await Es(l),await We(),t()}catch{}},a=async()=>{try{await Hr(),await We(),t()}catch{}},i=()=>{s("/editor?settings=project__create"),t()};return e.jsx(it,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:fe.sections,children:[e.jsxs("div",{className:fe.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:fe.logo}),e.jsxs("div",{children:["Ontime v",Ze]}),e.jsx(te,{href:gt,children:"Website"}),e.jsx(te,{href:Rt,children:"Read the docs"}),e.jsx(te,{href:ls,children:"Discord server"})]}),e.jsxs("div",{className:fe.column,children:[e.jsxs("div",{className:fe.header,children:["Welcome to Ontime",e.jsx(X,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(kt,{})})]}),e.jsx(fa,{children:"Select project"}),e.jsx("div",{className:fe.tableContainer,children:e.jsxs("table",{className:fe.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(ho,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:fe.column,children:[e.jsxs("div",{className:fe.buttonRow,children:[e.jsx(f,{onClick:a,children:"Load demo project"}),e.jsx(eo,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:i,children:"Create new..."})]}),e.jsxs(ga,{className:fe.inline,children:[e.jsx(Tn,{defaultChecked:!0,onCheckedChange:l=>Nn(l)}),"Show this modal on next startup"]})]})})}function xo(){const t=Ut(n=>n.showDialog),s=Ut(n=>n.clearDialog);return t?e.jsx(mo,{onClose:s}):null}const jo=g.lazy(()=>Qe(()=>import("./RundownExport-CCaOfHIr.js").then(t=>t.R),__vite__mapDeps([13,1,2,14,3,4,15,16,17,18,8,9,19,20,21,22,23,24,25,26,27,28,29,30,31,32,7,10,33,34,35,36,37,38]),import.meta.url)),po=g.lazy(()=>Qe(()=>import("./TimerControlExport-GJn4WWdH.js"),__vite__mapDeps([39,1,2,14,3,4,15,16,17,20,21,22,31,32,40,41,42,43]),import.meta.url)),go=g.lazy(()=>Qe(()=>import("./MessageControlExport-CFGgiwk_.js"),__vite__mapDeps([44,1,2,14,3,4,15,16,17,29,30,31,32,41,42,45]),import.meta.url));function fo(){const{isOpen:t,setLocation:s,close:n}=At(),[a,i]=Ee();An("Editor"),Pn(),g.useEffect(()=>{var r;((r=window.process)==null?void 0:r.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=g.useCallback(()=>{t?n():s("settings")},[n,t,s]);return Gs([["mod + ,",l]]),e.jsxs("div",{className:mt.mainContainer,"data-testid":"event-editor",children:[e.jsx(xo,{}),e.jsx(On,{isOpen:a,onClose:i.close}),e.jsxs(Xl,{children:[e.jsx(X,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:i.open,children:e.jsx(Qs,{})}),e.jsx(X,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(kt,{}):e.jsx(Ys,{})})]}),t?e.jsx(Jl,{}):e.jsxs("div",{id:"panels",className:mt.panelContainer,children:[e.jsxs("div",{className:mt.left,children:[e.jsx(po,{}),e.jsx(go,{})]}),e.jsx(jo,{})]})]})}function Uo(){return e.jsx(Js,{permission:"editor",children:e.jsx(fo,{})})}export{Uo as default};
|
|
3
|
+
//# sourceMappingURL=ProtectedEditor-B0l0X3QP.js.map
|