@getontime/cli 4.4.1 → 4.4.2

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.
Files changed (333) hide show
  1. package/client/assets/{Backstage-BY9GL_rk.js → Backstage-BdrcXNr9.js} +2 -2
  2. package/client/assets/Backstage-BdrcXNr9.js.br +0 -0
  3. package/client/assets/Backstage-BdrcXNr9.js.gz +0 -0
  4. package/client/assets/{Backstage-BY9GL_rk.js.map → Backstage-BdrcXNr9.js.map} +1 -1
  5. package/client/assets/{Countdown-CXFgDHND.js → Countdown-DQM2ppPg.js} +2 -2
  6. package/client/assets/Countdown-DQM2ppPg.js.br +0 -0
  7. package/client/assets/Countdown-DQM2ppPg.js.gz +0 -0
  8. package/client/assets/{Countdown-CXFgDHND.js.map → Countdown-DQM2ppPg.js.map} +1 -1
  9. package/client/assets/{CuesheetTable-BLICUNky.js → CuesheetTable-B5LQVh5m.js} +2 -2
  10. package/client/assets/CuesheetTable-B5LQVh5m.js.br +0 -0
  11. package/client/assets/CuesheetTable-B5LQVh5m.js.gz +0 -0
  12. package/client/assets/{CuesheetTable-BLICUNky.js.map → CuesheetTable-B5LQVh5m.js.map} +1 -1
  13. package/client/assets/{CustomTranslationModal-4PVZBtkC.js → CustomTranslationModal-CML7Vsot.js} +2 -2
  14. package/client/assets/CustomTranslationModal-CML7Vsot.js.br +0 -0
  15. package/client/assets/CustomTranslationModal-CML7Vsot.js.gz +0 -0
  16. package/client/assets/{CustomTranslationModal-4PVZBtkC.js.map → CustomTranslationModal-CML7Vsot.js.map} +1 -1
  17. package/client/assets/{DelayIndicator-DUbpd6DG.js → DelayIndicator-DKS6mZdB.js} +2 -2
  18. package/client/assets/DelayIndicator-DKS6mZdB.js.br +0 -0
  19. package/client/assets/DelayIndicator-DKS6mZdB.js.gz +0 -0
  20. package/client/assets/{DelayIndicator-DUbpd6DG.js.map → DelayIndicator-DKS6mZdB.js.map} +1 -1
  21. package/client/assets/{EditorFeatureWrapper-CV_zaDoG.js → EditorFeatureWrapper-C1vLQxiy.js} +2 -2
  22. package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.br +0 -0
  23. package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.gz +0 -0
  24. package/client/assets/{EditorFeatureWrapper-CV_zaDoG.js.map → EditorFeatureWrapper-C1vLQxiy.js.map} +1 -1
  25. package/client/assets/{EditorUtils-CLBWDP4k.js → EditorUtils-BLcTuWz1.js} +2 -2
  26. package/client/assets/EditorUtils-BLcTuWz1.js.br +0 -0
  27. package/client/assets/EditorUtils-BLcTuWz1.js.gz +0 -0
  28. package/client/assets/{EditorUtils-CLBWDP4k.js.map → EditorUtils-BLcTuWz1.js.map} +1 -1
  29. package/client/assets/{EmptyPage-DmpOAg7R.js → EmptyPage-CYVrjOvI.js} +2 -2
  30. package/client/assets/EmptyPage-CYVrjOvI.js.br +0 -0
  31. package/client/assets/EmptyPage-CYVrjOvI.js.gz +0 -0
  32. package/client/assets/{EmptyPage-DmpOAg7R.js.map → EmptyPage-CYVrjOvI.js.map} +1 -1
  33. package/client/assets/{FollowButton-CAUWz5Ma.js → FollowButton-DcSbb4R_.js} +2 -2
  34. package/client/assets/FollowButton-DcSbb4R_.js.br +0 -0
  35. package/client/assets/FollowButton-DcSbb4R_.js.gz +0 -0
  36. package/client/assets/{FollowButton-CAUWz5Ma.js.map → FollowButton-DcSbb4R_.js.map} +1 -1
  37. package/client/assets/{MessageControlExport-Dm8IjSr4.js → MessageControlExport-BgT9JaXk.js} +3 -3
  38. package/client/assets/MessageControlExport-BgT9JaXk.js.br +0 -0
  39. package/client/assets/MessageControlExport-BgT9JaXk.js.gz +0 -0
  40. package/client/assets/{MessageControlExport-Dm8IjSr4.js.map → MessageControlExport-BgT9JaXk.js.map} +1 -1
  41. package/client/assets/{MultiPartProgressBar-Fp-sTN2u.js → MultiPartProgressBar-W2a-JWPY.js} +2 -2
  42. package/client/assets/MultiPartProgressBar-W2a-JWPY.js.br +0 -0
  43. package/client/assets/MultiPartProgressBar-W2a-JWPY.js.gz +0 -0
  44. package/client/assets/{MultiPartProgressBar-Fp-sTN2u.js.map → MultiPartProgressBar-W2a-JWPY.js.map} +1 -1
  45. package/client/assets/{OperatorExport-CE4ajLPS.js → OperatorExport-CbWojpp6.js} +2 -2
  46. package/client/assets/OperatorExport-CbWojpp6.js.br +0 -0
  47. package/client/assets/OperatorExport-CbWojpp6.js.gz +0 -0
  48. package/client/assets/{OperatorExport-CE4ajLPS.js.map → OperatorExport-CbWojpp6.js.map} +1 -1
  49. package/client/assets/{OverviewWrapper-BNnAIUP1.js → OverviewWrapper-B2i8d3rt.js} +2 -2
  50. package/client/assets/OverviewWrapper-B2i8d3rt.js.br +0 -0
  51. package/client/assets/OverviewWrapper-B2i8d3rt.js.gz +0 -0
  52. package/client/assets/{OverviewWrapper-BNnAIUP1.js.map → OverviewWrapper-B2i8d3rt.js.map} +1 -1
  53. package/client/assets/{PipHost-CbNFsfqp.js → PipHost-Dz2oy7XG.js} +2 -2
  54. package/client/assets/PipHost-Dz2oy7XG.js.br +0 -0
  55. package/client/assets/PipHost-Dz2oy7XG.js.gz +0 -0
  56. package/client/assets/{PipHost-CbNFsfqp.js.map → PipHost-Dz2oy7XG.js.map} +1 -1
  57. package/client/assets/{ProjectInfo-Bf5z4Xsv.js → ProjectInfo-BR_7Hp5u.js} +2 -2
  58. package/client/assets/ProjectInfo-BR_7Hp5u.js.br +0 -0
  59. package/client/assets/ProjectInfo-BR_7Hp5u.js.gz +0 -0
  60. package/client/assets/{ProjectInfo-Bf5z4Xsv.js.map → ProjectInfo-BR_7Hp5u.js.map} +1 -1
  61. package/client/assets/{ProtectRoute-CCHzyy0I.js → ProtectRoute-Bxq6q7ba.js} +2 -2
  62. package/client/assets/ProtectRoute-Bxq6q7ba.js.br +0 -0
  63. package/client/assets/ProtectRoute-Bxq6q7ba.js.gz +0 -0
  64. package/client/assets/{ProtectRoute-CCHzyy0I.js.map → ProtectRoute-Bxq6q7ba.js.map} +1 -1
  65. package/client/assets/{ProtectedCuesheet-COI1W_V3.js → ProtectedCuesheet-C7AqD2dy.js} +2 -2
  66. package/client/assets/ProtectedCuesheet-C7AqD2dy.js.br +0 -0
  67. package/client/assets/ProtectedCuesheet-C7AqD2dy.js.gz +0 -0
  68. package/client/assets/{ProtectedCuesheet-COI1W_V3.js.map → ProtectedCuesheet-C7AqD2dy.js.map} +1 -1
  69. package/client/assets/{ProtectedEditor-BvTFmv-F.js → ProtectedEditor-CsfvVyOU.js} +3 -3
  70. package/client/assets/ProtectedEditor-CsfvVyOU.js.br +0 -0
  71. package/client/assets/ProtectedEditor-CsfvVyOU.js.gz +0 -0
  72. package/client/assets/{ProtectedEditor-BvTFmv-F.js.map → ProtectedEditor-CsfvVyOU.js.map} +1 -1
  73. package/client/assets/{RundownExport-C_q3KYN_.js → RundownExport-25orDQIW.js} +2 -2
  74. package/client/assets/RundownExport-25orDQIW.js.br +0 -0
  75. package/client/assets/RundownExport-25orDQIW.js.gz +0 -0
  76. package/client/assets/{RundownExport-C_q3KYN_.js.map → RundownExport-25orDQIW.js.map} +1 -1
  77. package/client/assets/{Select-DQwYPDyI.js → Select-BnGTAeXJ.js} +2 -2
  78. package/client/assets/Select-BnGTAeXJ.js.br +0 -0
  79. package/client/assets/Select-BnGTAeXJ.js.gz +0 -0
  80. package/client/assets/{Select-DQwYPDyI.js.map → Select-BnGTAeXJ.js.map} +1 -1
  81. package/client/assets/{Studio-DzXTmBx4.js → Studio-BK2Klo_K.js} +2 -2
  82. package/client/assets/Studio-BK2Klo_K.js.br +0 -0
  83. package/client/assets/Studio-BK2Klo_K.js.gz +0 -0
  84. package/client/assets/{Studio-DzXTmBx4.js.map → Studio-BK2Klo_K.js.map} +1 -1
  85. package/client/assets/{StyleEditor-ClMEMaWh.js → StyleEditor-DIHQ1PUV.js} +2 -2
  86. package/client/assets/StyleEditor-DIHQ1PUV.js.br +0 -0
  87. package/client/assets/StyleEditor-DIHQ1PUV.js.gz +0 -0
  88. package/client/assets/{StyleEditor-ClMEMaWh.js.map → StyleEditor-DIHQ1PUV.js.map} +1 -1
  89. package/client/assets/{SuperscriptPeriod-CBiZU34J.js → SuperscriptPeriod-EEedc9rG.js} +2 -2
  90. package/client/assets/SuperscriptPeriod-EEedc9rG.js.br +0 -0
  91. package/client/assets/SuperscriptPeriod-EEedc9rG.js.gz +0 -0
  92. package/client/assets/{SuperscriptPeriod-CBiZU34J.js.map → SuperscriptPeriod-EEedc9rG.js.map} +1 -1
  93. package/client/assets/{SuperscriptTime-DP1CDlOX.js → SuperscriptTime-BVanhNvd.js} +2 -2
  94. package/client/assets/SuperscriptTime-BVanhNvd.js.br +0 -0
  95. package/client/assets/SuperscriptTime-BVanhNvd.js.gz +0 -0
  96. package/client/assets/{SuperscriptTime-DP1CDlOX.js.map → SuperscriptTime-BVanhNvd.js.map} +1 -1
  97. package/client/assets/{SwatchPicker-Dyxkxf3_.js → SwatchPicker-Ckpchvjo.js} +2 -2
  98. package/client/assets/SwatchPicker-Ckpchvjo.js.br +0 -0
  99. package/client/assets/SwatchPicker-Ckpchvjo.js.gz +0 -0
  100. package/client/assets/{SwatchPicker-Dyxkxf3_.js.map → SwatchPicker-Ckpchvjo.js.map} +1 -1
  101. package/client/assets/{TimeElements-pDYJeFbV.js → TimeElements-CYIgGk0T.js} +2 -2
  102. package/client/assets/TimeElements-CYIgGk0T.js.br +0 -0
  103. package/client/assets/TimeElements-CYIgGk0T.js.gz +0 -0
  104. package/client/assets/{TimeElements-pDYJeFbV.js.map → TimeElements-CYIgGk0T.js.map} +1 -1
  105. package/client/assets/{TimeInput-DTWDnaum.js → TimeInput-Cwl9vLWA.js} +2 -2
  106. package/client/assets/TimeInput-Cwl9vLWA.js.br +0 -0
  107. package/client/assets/TimeInput-Cwl9vLWA.js.gz +0 -0
  108. package/client/assets/{TimeInput-DTWDnaum.js.map → TimeInput-Cwl9vLWA.js.map} +1 -1
  109. package/client/assets/{TimelinePage-DbLt9rQi.js → TimelinePage-D4QNdk-Z.js} +2 -2
  110. package/client/assets/TimelinePage-D4QNdk-Z.js.br +0 -0
  111. package/client/assets/TimelinePage-D4QNdk-Z.js.gz +0 -0
  112. package/client/assets/{TimelinePage-DbLt9rQi.js.map → TimelinePage-D4QNdk-Z.js.map} +1 -1
  113. package/client/assets/{Timer-BfyVKQ8U.js → Timer-BJQKNHfo.js} +2 -2
  114. package/client/assets/Timer-BJQKNHfo.js.br +0 -0
  115. package/client/assets/Timer-BJQKNHfo.js.gz +0 -0
  116. package/client/assets/{Timer-BfyVKQ8U.js.map → Timer-BJQKNHfo.js.map} +1 -1
  117. package/client/assets/{TimerControlExport-BJfhJc07.js → TimerControlExport-Ba1vifNg.js} +2 -2
  118. package/client/assets/TimerControlExport-Ba1vifNg.js.br +0 -0
  119. package/client/assets/TimerControlExport-Ba1vifNg.js.gz +0 -0
  120. package/client/assets/{TimerControlExport-BJfhJc07.js.map → TimerControlExport-Ba1vifNg.js.map} +1 -1
  121. package/client/assets/{TimerDisplay-Dgmbqf65.js → TimerDisplay-tVcUk9j3.js} +2 -2
  122. package/client/assets/TimerDisplay-tVcUk9j3.js.br +0 -0
  123. package/client/assets/TimerDisplay-tVcUk9j3.js.gz +0 -0
  124. package/client/assets/{TimerDisplay-Dgmbqf65.js.map → TimerDisplay-tVcUk9j3.js.map} +1 -1
  125. package/client/assets/{TitleCard-MUurHeZ7.js → TitleCard-BNjv58eq.js} +2 -2
  126. package/client/assets/TitleCard-BNjv58eq.js.br +0 -0
  127. package/client/assets/TitleCard-BNjv58eq.js.gz +0 -0
  128. package/client/assets/{TitleCard-MUurHeZ7.js.map → TitleCard-BNjv58eq.js.map} +1 -1
  129. package/client/assets/{Tooltip-DXph8P8p.js → Tooltip-DZJ7u9gm.js} +2 -2
  130. package/client/assets/Tooltip-DZJ7u9gm.js.br +4 -0
  131. package/client/assets/Tooltip-DZJ7u9gm.js.gz +0 -0
  132. package/client/assets/{Tooltip-DXph8P8p.js.map → Tooltip-DZJ7u9gm.js.map} +1 -1
  133. package/client/assets/{ViewLogo-Ckp7i75x.js → ViewLogo-2I7w5Yms.js} +2 -2
  134. package/client/assets/ViewLogo-2I7w5Yms.js.br +0 -0
  135. package/client/assets/ViewLogo-2I7w5Yms.js.gz +0 -0
  136. package/client/assets/{ViewLogo-Ckp7i75x.js.map → ViewLogo-2I7w5Yms.js.map} +1 -1
  137. package/client/assets/{ViewParamsEditor-Cxngd15h.js → ViewParamsEditor-BX2RM8sx.js} +2 -2
  138. package/client/assets/ViewParamsEditor-BX2RM8sx.js.br +0 -0
  139. package/client/assets/ViewParamsEditor-BX2RM8sx.js.gz +0 -0
  140. package/client/assets/{ViewParamsEditor-Cxngd15h.js.map → ViewParamsEditor-BX2RM8sx.js.map} +1 -1
  141. package/client/assets/{editorSettings-D4jfu68W.js → editorSettings-_x6YKRfR.js} +2 -2
  142. package/client/assets/editorSettings-_x6YKRfR.js.br +6 -0
  143. package/client/assets/editorSettings-_x6YKRfR.js.gz +0 -0
  144. package/client/assets/{editorSettings-D4jfu68W.js.map → editorSettings-_x6YKRfR.js.map} +1 -1
  145. package/client/assets/{getProgress-B9UANc25.js → getProgress-ZUTmCn_v.js} +2 -2
  146. package/client/assets/getProgress-ZUTmCn_v.js.br +0 -0
  147. package/client/assets/getProgress-ZUTmCn_v.js.gz +0 -0
  148. package/client/assets/{getProgress-B9UANc25.js.map → getProgress-ZUTmCn_v.js.map} +1 -1
  149. package/client/assets/{index-2lQ-45a9.js → index-Dm-4OTmY.js} +3 -3
  150. package/client/assets/index-Dm-4OTmY.js.br +0 -0
  151. package/client/assets/index-Dm-4OTmY.js.gz +0 -0
  152. package/client/assets/{index-2lQ-45a9.js.map → index-Dm-4OTmY.js.map} +1 -1
  153. package/client/assets/{offset-DAyBfv5b.js → offset-VthsmtrO.js} +2 -2
  154. package/client/assets/offset-VthsmtrO.js.br +0 -0
  155. package/client/assets/offset-VthsmtrO.js.gz +0 -0
  156. package/client/assets/{offset-DAyBfv5b.js.map → offset-VthsmtrO.js.map} +1 -1
  157. package/client/assets/{parseUserTime-WkVNjkkE.js → parseUserTime-sZbEBi61.js} +2 -2
  158. package/client/assets/parseUserTime-sZbEBi61.js.br +0 -0
  159. package/client/assets/parseUserTime-sZbEBi61.js.gz +0 -0
  160. package/client/assets/{parseUserTime-WkVNjkkE.js.map → parseUserTime-sZbEBi61.js.map} +1 -1
  161. package/client/assets/{playbackstate-znZk3SSJ.js → playbackstate-Dl_ZJABT.js} +2 -2
  162. package/client/assets/playbackstate-Dl_ZJABT.js.br +0 -0
  163. package/client/assets/playbackstate-Dl_ZJABT.js.gz +0 -0
  164. package/client/assets/{playbackstate-znZk3SSJ.js.map → playbackstate-Dl_ZJABT.js.map} +1 -1
  165. package/client/assets/{presentation.utils-CjjYs5II.js → presentation.utils-Z61KykAH.js} +2 -2
  166. package/client/assets/presentation.utils-Z61KykAH.js.br +0 -0
  167. package/client/assets/presentation.utils-Z61KykAH.js.gz +0 -0
  168. package/client/assets/{presentation.utils-CjjYs5II.js.map → presentation.utils-Z61KykAH.js.map} +1 -1
  169. package/client/assets/{rundownUtils-BTQ3EeqN.js → rundownUtils-CXZRD6yP.js} +2 -2
  170. package/client/assets/rundownUtils-CXZRD6yP.js.br +0 -0
  171. package/client/assets/rundownUtils-CXZRD6yP.js.gz +0 -0
  172. package/client/assets/{rundownUtils-BTQ3EeqN.js.map → rundownUtils-CXZRD6yP.js.map} +1 -1
  173. package/client/assets/timer.utils-B4bvsns3.js +2 -0
  174. package/client/assets/timer.utils-B4bvsns3.js.br +0 -0
  175. package/client/assets/timer.utils-B4bvsns3.js.gz +0 -0
  176. package/client/assets/{timer.utils-B-Ui91P7.js.map → timer.utils-B4bvsns3.js.map} +1 -1
  177. package/client/assets/{useCustomFields-zr9SUl5o.js → useCustomFields-BBE4LBBr.js} +2 -2
  178. package/client/assets/useCustomFields-BBE4LBBr.js.br +0 -0
  179. package/client/assets/useCustomFields-BBE4LBBr.js.gz +0 -0
  180. package/client/assets/{useCustomFields-zr9SUl5o.js.map → useCustomFields-BBE4LBBr.js.map} +1 -1
  181. package/client/assets/{useEventSelection-B9mbj1cM.js → useEventSelection-Bpbu89c7.js} +2 -2
  182. package/client/assets/useEventSelection-Bpbu89c7.js.br +0 -0
  183. package/client/assets/useEventSelection-Bpbu89c7.js.gz +0 -0
  184. package/client/assets/{useEventSelection-B9mbj1cM.js.map → useEventSelection-Bpbu89c7.js.map} +1 -1
  185. package/client/assets/{useProjectData-DD_BQ9eJ.js → useProjectData-C110zIXC.js} +2 -2
  186. package/client/assets/useProjectData-C110zIXC.js.br +0 -0
  187. package/client/assets/useProjectData-C110zIXC.js.gz +0 -0
  188. package/client/assets/{useProjectData-DD_BQ9eJ.js.map → useProjectData-C110zIXC.js.map} +1 -1
  189. package/client/assets/{useReport-DozG5uz5.js → useReport-DqSBq4MG.js} +2 -2
  190. package/client/assets/useReport-DqSBq4MG.js.br +0 -0
  191. package/client/assets/useReport-DqSBq4MG.js.gz +0 -0
  192. package/client/assets/{useReport-DozG5uz5.js.map → useReport-DqSBq4MG.js.map} +1 -1
  193. package/client/assets/{useRundown-D6vokFHi.js → useRundown-DAo6huE4.js} +2 -2
  194. package/client/assets/useRundown-DAo6huE4.js.br +0 -0
  195. package/client/assets/useRundown-DAo6huE4.js.gz +0 -0
  196. package/client/assets/{useRundown-D6vokFHi.js.map → useRundown-DAo6huE4.js.map} +1 -1
  197. package/client/assets/{useSelectAndRevealEntry-Dd6MpVHe.js → useSelectAndRevealEntry-DTg0hmxA.js} +2 -2
  198. package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.br +0 -0
  199. package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.gz +0 -0
  200. package/client/assets/{useSelectAndRevealEntry-Dd6MpVHe.js.map → useSelectAndRevealEntry-DTg0hmxA.js.map} +1 -1
  201. package/client/assets/{useWindowTitle-bg-fLPOk.js → useWindowTitle-DM8dIp8L.js} +2 -2
  202. package/client/assets/useWindowTitle-DM8dIp8L.js.br +0 -0
  203. package/client/assets/useWindowTitle-DM8dIp8L.js.gz +0 -0
  204. package/client/assets/{useWindowTitle-bg-fLPOk.js.map → useWindowTitle-DM8dIp8L.js.map} +1 -1
  205. package/client/assets/{validateEvent-BUgLWn7x.js → validateEvent-GnPt-e9-.js} +2 -2
  206. package/client/assets/validateEvent-GnPt-e9-.js.br +0 -0
  207. package/client/assets/validateEvent-GnPt-e9-.js.gz +0 -0
  208. package/client/assets/{validateEvent-BUgLWn7x.js.map → validateEvent-GnPt-e9-.js.map} +1 -1
  209. package/client/assets/{vendor-CKDP5hij.js → vendor-BKUJ0_Du.js} +2 -2
  210. package/client/assets/vendor-BKUJ0_Du.js.br +0 -0
  211. package/client/assets/{vendor-CKDP5hij.js.gz → vendor-BKUJ0_Du.js.gz} +0 -0
  212. package/client/assets/{vendor-CKDP5hij.js.map → vendor-BKUJ0_Du.js.map} +1 -1
  213. package/client/assets/{viewLoader.utils-Bn5zu5sz.js → viewLoader.utils-4lL4PiNI.js} +2 -2
  214. package/client/assets/viewLoader.utils-4lL4PiNI.js.br +0 -0
  215. package/client/assets/viewLoader.utils-4lL4PiNI.js.gz +0 -0
  216. package/client/assets/{viewLoader.utils-Bn5zu5sz.js.map → viewLoader.utils-4lL4PiNI.js.map} +1 -1
  217. package/client/assets/{viewUtils-DQFwr7hm.js → viewUtils-29a3Mmiu.js} +2 -2
  218. package/client/assets/viewUtils-29a3Mmiu.js.br +0 -0
  219. package/client/assets/viewUtils-29a3Mmiu.js.gz +0 -0
  220. package/client/assets/{viewUtils-DQFwr7hm.js.map → viewUtils-29a3Mmiu.js.map} +1 -1
  221. package/client/index.html +2 -2
  222. package/package.json +1 -1
  223. package/server/index.cjs +1 -1
  224. package/client/assets/Backstage-BY9GL_rk.js.br +0 -0
  225. package/client/assets/Backstage-BY9GL_rk.js.gz +0 -0
  226. package/client/assets/Countdown-CXFgDHND.js.br +0 -0
  227. package/client/assets/Countdown-CXFgDHND.js.gz +0 -0
  228. package/client/assets/CuesheetTable-BLICUNky.js.br +0 -0
  229. package/client/assets/CuesheetTable-BLICUNky.js.gz +0 -0
  230. package/client/assets/CustomTranslationModal-4PVZBtkC.js.br +0 -0
  231. package/client/assets/CustomTranslationModal-4PVZBtkC.js.gz +0 -0
  232. package/client/assets/DelayIndicator-DUbpd6DG.js.br +0 -0
  233. package/client/assets/DelayIndicator-DUbpd6DG.js.gz +0 -0
  234. package/client/assets/EditorFeatureWrapper-CV_zaDoG.js.br +0 -0
  235. package/client/assets/EditorFeatureWrapper-CV_zaDoG.js.gz +0 -0
  236. package/client/assets/EditorUtils-CLBWDP4k.js.br +0 -0
  237. package/client/assets/EditorUtils-CLBWDP4k.js.gz +0 -0
  238. package/client/assets/EmptyPage-DmpOAg7R.js.br +0 -2
  239. package/client/assets/EmptyPage-DmpOAg7R.js.gz +0 -0
  240. package/client/assets/FollowButton-CAUWz5Ma.js.br +0 -0
  241. package/client/assets/FollowButton-CAUWz5Ma.js.gz +0 -0
  242. package/client/assets/MessageControlExport-Dm8IjSr4.js.br +0 -0
  243. package/client/assets/MessageControlExport-Dm8IjSr4.js.gz +0 -0
  244. package/client/assets/MultiPartProgressBar-Fp-sTN2u.js.br +0 -0
  245. package/client/assets/MultiPartProgressBar-Fp-sTN2u.js.gz +0 -0
  246. package/client/assets/OperatorExport-CE4ajLPS.js.br +0 -0
  247. package/client/assets/OperatorExport-CE4ajLPS.js.gz +0 -0
  248. package/client/assets/OverviewWrapper-BNnAIUP1.js.br +0 -0
  249. package/client/assets/OverviewWrapper-BNnAIUP1.js.gz +0 -0
  250. package/client/assets/PipHost-CbNFsfqp.js.br +0 -0
  251. package/client/assets/PipHost-CbNFsfqp.js.gz +0 -0
  252. package/client/assets/ProjectInfo-Bf5z4Xsv.js.br +0 -0
  253. package/client/assets/ProjectInfo-Bf5z4Xsv.js.gz +0 -0
  254. package/client/assets/ProtectRoute-CCHzyy0I.js.br +0 -0
  255. package/client/assets/ProtectRoute-CCHzyy0I.js.gz +0 -0
  256. package/client/assets/ProtectedCuesheet-COI1W_V3.js.br +0 -0
  257. package/client/assets/ProtectedCuesheet-COI1W_V3.js.gz +0 -0
  258. package/client/assets/ProtectedEditor-BvTFmv-F.js.br +0 -0
  259. package/client/assets/ProtectedEditor-BvTFmv-F.js.gz +0 -0
  260. package/client/assets/RundownExport-C_q3KYN_.js.br +0 -0
  261. package/client/assets/RundownExport-C_q3KYN_.js.gz +0 -0
  262. package/client/assets/Select-DQwYPDyI.js.br +0 -0
  263. package/client/assets/Select-DQwYPDyI.js.gz +0 -0
  264. package/client/assets/Studio-DzXTmBx4.js.br +0 -0
  265. package/client/assets/Studio-DzXTmBx4.js.gz +0 -0
  266. package/client/assets/StyleEditor-ClMEMaWh.js.br +0 -0
  267. package/client/assets/StyleEditor-ClMEMaWh.js.gz +0 -0
  268. package/client/assets/SuperscriptPeriod-CBiZU34J.js.br +0 -0
  269. package/client/assets/SuperscriptPeriod-CBiZU34J.js.gz +0 -0
  270. package/client/assets/SuperscriptTime-DP1CDlOX.js.br +0 -0
  271. package/client/assets/SuperscriptTime-DP1CDlOX.js.gz +0 -0
  272. package/client/assets/SwatchPicker-Dyxkxf3_.js.br +0 -0
  273. package/client/assets/SwatchPicker-Dyxkxf3_.js.gz +0 -0
  274. package/client/assets/TimeElements-pDYJeFbV.js.br +0 -0
  275. package/client/assets/TimeElements-pDYJeFbV.js.gz +0 -0
  276. package/client/assets/TimeInput-DTWDnaum.js.br +0 -0
  277. package/client/assets/TimeInput-DTWDnaum.js.gz +0 -0
  278. package/client/assets/TimelinePage-DbLt9rQi.js.br +0 -0
  279. package/client/assets/TimelinePage-DbLt9rQi.js.gz +0 -0
  280. package/client/assets/Timer-BfyVKQ8U.js.br +0 -0
  281. package/client/assets/Timer-BfyVKQ8U.js.gz +0 -0
  282. package/client/assets/TimerControlExport-BJfhJc07.js.br +0 -0
  283. package/client/assets/TimerControlExport-BJfhJc07.js.gz +0 -0
  284. package/client/assets/TimerDisplay-Dgmbqf65.js.br +0 -0
  285. package/client/assets/TimerDisplay-Dgmbqf65.js.gz +0 -0
  286. package/client/assets/TitleCard-MUurHeZ7.js.br +0 -0
  287. package/client/assets/TitleCard-MUurHeZ7.js.gz +0 -0
  288. package/client/assets/Tooltip-DXph8P8p.js.br +0 -0
  289. package/client/assets/Tooltip-DXph8P8p.js.gz +0 -0
  290. package/client/assets/ViewLogo-Ckp7i75x.js.br +0 -0
  291. package/client/assets/ViewLogo-Ckp7i75x.js.gz +0 -0
  292. package/client/assets/ViewParamsEditor-Cxngd15h.js.br +0 -0
  293. package/client/assets/ViewParamsEditor-Cxngd15h.js.gz +0 -0
  294. package/client/assets/editorSettings-D4jfu68W.js.br +0 -0
  295. package/client/assets/editorSettings-D4jfu68W.js.gz +0 -0
  296. package/client/assets/getProgress-B9UANc25.js.br +0 -0
  297. package/client/assets/getProgress-B9UANc25.js.gz +0 -0
  298. package/client/assets/index-2lQ-45a9.js.br +0 -0
  299. package/client/assets/index-2lQ-45a9.js.gz +0 -0
  300. package/client/assets/offset-DAyBfv5b.js.br +0 -4
  301. package/client/assets/offset-DAyBfv5b.js.gz +0 -0
  302. package/client/assets/parseUserTime-WkVNjkkE.js.br +0 -0
  303. package/client/assets/parseUserTime-WkVNjkkE.js.gz +0 -0
  304. package/client/assets/playbackstate-znZk3SSJ.js.br +0 -0
  305. package/client/assets/playbackstate-znZk3SSJ.js.gz +0 -0
  306. package/client/assets/presentation.utils-CjjYs5II.js.br +0 -0
  307. package/client/assets/presentation.utils-CjjYs5II.js.gz +0 -0
  308. package/client/assets/rundownUtils-BTQ3EeqN.js.br +0 -0
  309. package/client/assets/rundownUtils-BTQ3EeqN.js.gz +0 -0
  310. package/client/assets/timer.utils-B-Ui91P7.js +0 -2
  311. package/client/assets/timer.utils-B-Ui91P7.js.br +0 -0
  312. package/client/assets/timer.utils-B-Ui91P7.js.gz +0 -0
  313. package/client/assets/useCustomFields-zr9SUl5o.js.br +0 -0
  314. package/client/assets/useCustomFields-zr9SUl5o.js.gz +0 -0
  315. package/client/assets/useEventSelection-B9mbj1cM.js.br +0 -0
  316. package/client/assets/useEventSelection-B9mbj1cM.js.gz +0 -0
  317. package/client/assets/useProjectData-DD_BQ9eJ.js.br +0 -0
  318. package/client/assets/useProjectData-DD_BQ9eJ.js.gz +0 -0
  319. package/client/assets/useReport-DozG5uz5.js.br +0 -0
  320. package/client/assets/useReport-DozG5uz5.js.gz +0 -0
  321. package/client/assets/useRundown-D6vokFHi.js.br +0 -0
  322. package/client/assets/useRundown-D6vokFHi.js.gz +0 -0
  323. package/client/assets/useSelectAndRevealEntry-Dd6MpVHe.js.br +0 -0
  324. package/client/assets/useSelectAndRevealEntry-Dd6MpVHe.js.gz +0 -0
  325. package/client/assets/useWindowTitle-bg-fLPOk.js.br +0 -0
  326. package/client/assets/useWindowTitle-bg-fLPOk.js.gz +0 -0
  327. package/client/assets/validateEvent-BUgLWn7x.js.br +0 -0
  328. package/client/assets/validateEvent-BUgLWn7x.js.gz +0 -0
  329. package/client/assets/vendor-CKDP5hij.js.br +0 -0
  330. package/client/assets/viewLoader.utils-Bn5zu5sz.js.br +0 -0
  331. package/client/assets/viewLoader.utils-Bn5zu5sz.js.gz +0 -0
  332. package/client/assets/viewUtils-DQFwr7hm.js.br +0 -0
  333. package/client/assets/viewUtils-DQFwr7hm.js.gz +0 -0
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-4PVZBtkC.js","./vendor-CKDP5hij.js","./vendor-4xP-6xVS.css","./index-2lQ-45a9.js","./index-Cm69j2Ld.css","./SwatchPicker-Dyxkxf3_.js","./SwatchPicker-DxatRu17.css","./useEventSelection-B9mbj1cM.js","./Select-DQwYPDyI.js","./Select-Cd08aEcf.css","./useCustomFields-zr9SUl5o.js","./useRundown-D6vokFHi.js","./useEventSelection-D_Et8xSN.css","./StyleEditor-ClMEMaWh.js","./StyleEditor-Bie84LSc.css","./RundownExport-C_q3KYN_.js","./EditorUtils-CLBWDP4k.js","./EditorUtils-L4Sg72o_.css","./ProtectRoute-CCHzyy0I.js","./ProtectRoute-Bm5sjStK.css","./CuesheetTable-BLICUNky.js","./TimeInput-DTWDnaum.js","./parseUserTime-WkVNjkkE.js","./TimeInput-Cu-N5DmX.css","./validateEvent-BUgLWn7x.js","./Tooltip-DXph8P8p.js","./Tooltip-CKb7gU2M.css","./DelayIndicator-DUbpd6DG.js","./editorSettings-D4jfu68W.js","./editorSettings-BqHbWs9b.css","./rundownUtils-BTQ3EeqN.js","./DelayIndicator-VuYhhwTj.css","./offset-DAyBfv5b.js","./EmptyPage-DmpOAg7R.js","./EmptyPage-Ci10HwDK.css","./CuesheetTable-BJ30G538.css","./useSelectAndRevealEntry-Dd6MpVHe.js","./useReport-DozG5uz5.js","./playbackstate-znZk3SSJ.js","./getProgress-B9UANc25.js","./RundownExport-CzaSrbaj.css","./TimerControlExport-BJfhJc07.js","./TimerDisplay-Dgmbqf65.js","./TimerDisplay-B-FvT2T-.css","./TimerControlExport-X_cQKSFg.css","./MessageControlExport-Dm8IjSr4.js","./MessageControlExport-D_pNX6Vj.css"])))=>i.map(i=>d[i]);
2
- import{h as p,j as e,ac as Ns,a as X,k as Ft,ad as de,ae as cn,af as dn,ag as mt,ah as pe,T as ge,aa as gt,ai as un,y as ft,aj as hn,ak as is,f as mn,O as $t,A as ut,al as xn,am as jn,an as rt,ao as pn,P as Xe,C as Ee,ap as Ds,aq as Ps,ar as gn,as as Rs,at as rs,au as fn,av as Es,l as bn,aw as yn,$ as lt,v as Vt,ax as vn,x as wn,ay as Sn,M as Is,az as Cn,aA as ls,aB as _n,aC as kn,aD as Tn,aE as Nn,aF as Dn,I as Pn,m as Rn}from"./vendor-CKDP5hij.js";import{e as Se,Q as Mt,R as En,S as In,U as xt,s as Ln,V as An,W as Ie,X as ht,Y as D,Z as Qe,_ as Me,$ as E,a0 as ne,a1 as J,a2 as Rt,a3 as On,a4 as Fn,a5 as Wt,a6 as $n,a7 as Ls,a8 as Vn,a9 as L,B as f,aa as le,ab as ke,ac as Be,ad as Ce,ae as ce,af as U,ag as G,ah as M,ai as V,aj as ze,ak as Y,al as _e,am as bt,an as Mn,ao as Wn,ap as Ut,f as $e,aq as As,ar as Bt,as as Os,at as ae,x as Et,O as Re,au as Un,av as os,aw as Fs,ax as $s,ay as zt,az as Le,aA as Bn,aB as zn,aC as Gt,aD as St,m as Fe,k as Kt,aE as Gn,aF as Kn,aG as ye,aH as Vs,aI as jt,T as ot,aJ as Hn,aK as Ms,aL as cs,aM as qn,aN as Qn,aO as Yn,aP as Ye,aQ as Jn,aR as Xn,b as Zn,aS as ea,N as ta,aT as sa,aU as na,aV as aa,a as ia,aW as ra,aX as la,aY as ds,aZ as oa,a_ as us,K as ca,a$ as da,b0 as ua,b1 as ha,b2 as Ge,h as Ze,y as hs,b3 as et,b4 as ct,b5 as tt,b6 as Ue,b7 as ma,M as xa,b8 as ja,o as pa,b9 as ga,ba as fa}from"./index-2lQ-45a9.js";import{P as ba}from"./ProtectRoute-CCHzyy0I.js";import{u as ya}from"./useWindowTitle-bg-fLPOk.js";import{i as Ws,e as va,u as yt,R as Us,T as H,s as wa,t as Ct,a as Sa,b as Ca,d as _a,c as ka,f as Ta,g as Na,h as Da,G as Pa,S as Ra,j as Ea,D as Ht,M as qt,k as Ia,l as La}from"./useEventSelection-B9mbj1cM.js";import{I as xe,S as De,a as _t,C as Aa}from"./SwatchPicker-Dyxkxf3_.js";import{f as Oa,g as Fa,h as $a,i as Qt,u as Yt,j as Va,k as Ma,l as Wa,m as Ua,r as Ba,n as za,o as Ga,p as Ka,q as Ha,s as qa}from"./useRundown-D6vokFHi.js";import{S as ie}from"./Select-DQwYPDyI.js";import{u as vt,p as Qa,e as Ya,d as Ja}from"./useCustomFields-zr9SUl5o.js";import{u as Xa,d as Za}from"./useReport-DozG5uz5.js";import{T as It,u as Bs,e as at}from"./editorSettings-D4jfu68W.js";import{S as ei,L as ti,T as si}from"./EditorUtils-CLBWDP4k.js";import{T as Jt}from"./Tooltip-DXph8P8p.js";import{A as zs,T as He}from"./TimeInput-DTWDnaum.js";import{T as ms,E as kt}from"./validateEvent-BUgLWn7x.js";import{p as qe}from"./parseUserTime-WkVNjkkE.js";import{u as ni,a as ai,b as ii}from"./useProjectData-DD_BQ9eJ.js";import{u as Xt,a as Zt,E as we,b as ri}from"./useSelectAndRevealEntry-Dd6MpVHe.js";import{S as li,P as oi,C as es,a as Gs,b as Ks,O as Hs,M as qs}from"./TimeElements-pDYJeFbV.js";import{O as ci,s as ts,T as Qs,S as di}from"./OverviewWrapper-BNnAIUP1.js";import{g as ui,T as Ae,a as hi}from"./TimerDisplay-Dgmbqf65.js";import"./offset-DAyBfv5b.js";import"./SuperscriptPeriod-CBiZU34J.js";/* empty css */import"./playbackstate-znZk3SSJ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof Ot<"u"?Ot:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="a110e26f-5bdd-4a61-8a6f-4b9b4b913f70",t._sentryDebugIdIdentifier="sentry-dbid-a110e26f-5bdd-4a61-8a6f-4b9b4b913f70")}catch{}})();function mi(t){return t.trim().replaceAll(" ","_")}const xi={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"},ji=(t,s,n={})=>{const{isDisabled:a=!1}=n,i=p.useCallback(l=>{l.key===s&&!l.repeat&&!a&&(l.preventDefault(),t())},[t,a,s]);p.useEffect(()=>(document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}),[i])},pi="_link_70oau_17",gi="_inline_70oau_27",xs={link:pi,inline:gi};function se({href:t,inline:s,children:n}){const a=i=>{i.preventDefault(),Mt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:Se([xs.link,s&&xs.inline]),onClick:a,children:[n," ",e.jsx(Ns,{style:{fontSize:"1em"}})]})}async function fi(t){const s=await X.get(En,{signal:t==null?void 0:t.signal});return{url:s.data.html_url,version:s.data.tag_name}}const js={url:"",version:"",hasUpdates:!1};function Ys(){const{data:t,status:s,isFetching:n,isError:a,refetch:i}=Ft({queryKey:An,queryFn:({signal:o})=>fi({signal:o}),placeholderData:(o,u)=>o,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:Ln,enabled:xt}),l=(t==null?void 0:t.version)&&!t.version.includes(In);return{data:t?{...t,hasUpdates:l}:js,placeholder:js,status:s,isFetching:n,isError:a,refetch:i}}function bi(){const{data:t,isError:s}=Ys();return s?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ht}`,e.jsx(D,{children:"Could not fetch version information"})]}):t.hasUpdates?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ht}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Qe?"You can restart your stage to get the latest available version.":e.jsx(se,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(Ie,{children:`You are currently using the latest version of Ontime: ${ht}`})}function yi(){return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"About Ontime"}),e.jsxs(E,{children:[e.jsxs(ne,{children:[e.jsx(J,{children:"Ontime"}),e.jsxs(Ie,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(se,{href:Rt,children:"www.getontime.no"})]}),e.jsxs(Ie,{children:["Considering sponsoring our work",e.jsx(se,{href:On,children:"GitHub Sponsors"}),e.jsx(se,{href:Fn,children:"Buy Me a Coffee"})]}),e.jsxs(Ie,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(se,{href:Rt,children:"www.getontime.no"})]})]}),e.jsx(J,{children:"Current version"}),e.jsx(bi,{}),e.jsx(J,{children:"Links"}),e.jsx(se,{href:Wt,children:"Read the docs"}),e.jsx(se,{href:$n,children:"Follow the project on GitHub"}),e.jsx(se,{href:Ls,children:"Discord server"}),e.jsx(se,{href:Vn,children:"Subreddit"})]})]})}function re(t,s){const n=p.useRef(null);return p.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const vi="https://docs.getontime.no/api/protocols/osc/";function wi({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var b,y,w;const{handleSubmit:a,reset:i,register:l,setError:r,watch:o,setValue:u,formState:{errors:c,isSubmitting:h,isDirty:m,isValid:d}}=de({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),x=async S=>{try{await va(S),i(S)}catch(A){const k=V(A);r("root",{message:k})}},j=()=>{i({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},g=!h&&m&&d;return e.jsxs(ne,{children:[e.jsxs(J,{children:["Automation settings",e.jsxs(L,{children:[e.jsx(f,{variant:"ghosted",onClick:j,disabled:!g,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!g,loading:h,children:"Save"})]})]}),(c==null?void 0:c.root)&&e.jsx(D,{children:c.root.message}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(se,{href:vi,children:"See the docs"})]})}),e.jsxs(E,{as:"form",id:"automation-settings-form",onSubmit:a(x),onKeyDown:S=>ke(S,j),children:[e.jsx(Be,{isLoading:!1}),e.jsx(Ce,{children:"Automation"}),e.jsx(ce,{children:e.jsxs(U,{children:[e.jsx(G,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(b=c.enabledAutomations)==null?void 0:b.message}),e.jsx(De,{size:"large",checked:o("enabledAutomations"),onCheckedChange:S=>u("enabledAutomations",S,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(Ce,{children:"OSC Input"}),e.jsxs(ce,{children:[Qe&&e.jsx(xe,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(U,{children:[e.jsx(G,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(y=c.enabledOscIn)==null?void 0:y.message}),e.jsx(De,{size:"large",checked:o("enabledOscIn"),onCheckedChange:S=>u("enabledOscIn",S,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(w=c.oscPortIn)==null?void 0:w.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:Ws,message:"Value should be numeric"}})})]})]})]})]})}const Si=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],Ci=["{{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}}"],_i=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],ki=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function Ti(t){return[...Si,...Ci,..._i,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...ki,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Ni(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 Di(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Pi="_wrapper_1dmtf_17",Ri="_suggestions_1dmtf_21",ps={wrapper:Pi,suggestions:Ri},Ei=p.forwardRef(function(s,n){const{value:a,onChange:i,...l}=s,{data:r}=vt(),o=cn(()=>j(!1)),u=p.useMemo(()=>Ti(r),[r]),[c,h]=p.useState(a||""),[m,d]=p.useState([]),[x,j]=p.useState(!1),g=w=>{const S=Di(w);return u.filter(A=>A.startsWith(S))},b=w=>{h(w.target.value),w.target.value.endsWith("{")?(j(!0),d(g(w.target.value))):w.target.value===""||w.target.value.endsWith("}}")?j(!1):x&&d(g(w.target.value)),i==null||i(w)},y=w=>{h(S=>{const A=Ni(S,w);return S+A}),j(!1)};return e.jsxs("div",{className:ps.wrapper,ref:dn(o,n),children:[e.jsx(M,{value:c,...l,onChange:b,fluid:!0}),x&&m.length>0&&e.jsx("ul",{className:ps.suggestions,children:m.map(w=>e.jsx("li",{onClick:()=>y(w),children:w},w))})]})}),Lt=[{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 gs(t){return Object.hasOwn(t,"id")}const Ii=[{value:null,label:"Select field"},{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"}],Li=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Ai(t){return[...Ii,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Li,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function Oi(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 Fi="_outerColumn_1klj0_17",$i="_innerColumn_1klj0_25",Vi="_ruleSection_1klj0_31",Mi="_titleSection_1klj0_37",Wi="_filterSection_1klj0_38",Ui="_oscSection_1klj0_39",Bi="_httpSection_1klj0_40",zi="_actionSection_1klj0_41",Gi="_test_1klj0_95",Ki="_outputCard_1klj0_99",he={outerColumn:Fi,innerColumn:$i,ruleSection:Vi,titleSection:Mi,filterSection:Wi,oscSection:Ui,httpSection:Bi,actionSection:zi,test:Gi,outputCard:Ki};function Hi({index:t,register:s,setValue:n,rowErrors:a,value:i,children:l,watch:r}){var h,m,d,x,j;const[o,u]=p.useState(i),c=g=>{n(`outputs.${t}.action`,g,{shouldDirty:!0}),u(g)};return e.jsxs("div",{className:he.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ie,{onValueChange:g=>{g!==null&&c(g)},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(D,{children:(h=a==null?void 0:a.action)==null?void 0:h.message})]}),o.startsWith("aux")&&o.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(D,{children:(m=a==null?void 0:a.time)==null?void 0:m.message})]}),o==="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(D,{children:(d=a==null?void 0:a.text)==null?void 0:d.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ie,{onValueChange:g=>{const b=g===null?void 0:g;n(`outputs.${t}.visible`,b,{shouldDirty:!0})},value:r(`outputs.${t}.visible`),options:[{value:null,label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(D,{children:(x=a==null?void 0:a.visible)==null?void 0:x.message})]})]}),o==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ie,{onValueChange:g=>{if(g!==null){if(g==="null"){n(`outputs.${t}.secondarySource`,null,{shouldDirty:!0});return}n(`outputs.${t}.secondarySource`,g,{shouldDirty:!0})}},value:r(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source"},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"secondary",label:"Secondary"},{value:"null",label:"None"}]}),e.jsx(D,{children:(j=a==null?void 0:a.secondarySource)==null?void 0:j.message})]}),e.jsx("div",{className:he.test,children:l})]})}const qi="https://docs.getontime.no/api/automation/#using-variables-in-automation";function Qi({automation:t,onClose:s}){var K;const n=gs(t),{data:a}=vt(),{refetch:i}=yt(),l=p.useMemo(()=>Ai(a),[a]),{control:r,handleSubmit:o,getValues:u,register:c,setError:h,setFocus:m,setValue:d,watch:x,formState:{errors:j,isSubmitting:g,isDirty:b,isValid:y}}=de({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:w,append:S,remove:A}=mt({name:"filters",control:r}),{fields:k,append:R,remove:W}=mt({name:"outputs",control:r});p.useEffect(()=>{m("title")},[m]);const v=()=>{S({field:"",operator:"equals",value:""})},O=()=>{R({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},C=()=>{R({type:"http",url:""})},q=()=>{R({type:"ontime",action:"aux1-start"})},B=async $=>{try{const T=u(`outputs.${$}`);if(!T.targetIP||!T.targetPort||!T.address)return;await Ct({type:"osc",targetIP:T.targetIP,targetPort:T.targetPort,address:T.address,args:T.args})}catch{}},F=async $=>{try{const T=u(`outputs.${$}`);if(!T.url)return;await Ct({type:"http",url:T.url})}catch{}},P=async $=>{try{const T=u(`outputs.${$}`);await Ct({...T,type:"ontime"})}catch{}},I=async $=>{gs(t)?await T(t.id,{id:t.id,...$}):await fe($),i();async function T(ue,oe){try{await Sa(ue,oe),s()}catch(_){h("root",{message:V(_)})}}async function fe(ue){try{await Ca(ue),s()}catch(oe){h("root",{message:V(oe)})}}},N=!g&&b&&y;return e.jsxs(ze,{as:"form",name:"automation-form",onSubmit:o(I),className:he.outerColumn,onKeyDown:$=>ke($,s),children:[e.jsx(J,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:he.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:he.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx(M,{...c("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(D,{children:(K=j.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:he.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:he.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(Us,{orientation:"horizontal",value:x("filterRule"),onValueChange:$=>d("filterRule",$,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),w.map(($,T)=>{var ue,oe,_,ee,Ne,Pe;const fe=`filters.${T}.field.${$.id}`;return e.jsxs("div",{className:he.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ie,{value:x(`filters.${T}.field`)||null,onValueChange:je=>{je!==null&&d(`filters.${T}.field`,je,{shouldDirty:!0})},options:l.map(({value:je,label:Z})=>({value:je,label:Z,disabled:je===null})),"aria-label":"Event field"}),e.jsx(D,{children:(_=(oe=(ue=j.filters)==null?void 0:ue[T])==null?void 0:oe.field)==null?void 0:_.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ie,{value:x(`filters.${T}.operator`),onValueChange:je=>{je!==null&&d(`filters.${T}.operator`,je,{shouldDirty:!0})},options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(D,{children:(Pe=(Ne=(ee=j.filters)==null?void 0:ee[T])==null?void 0:Ne.operator)==null?void 0:Pe.message})]}),e.jsxs("label",{children:["Value to match",e.jsx(M,{...c(`filters.${T}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>A(T),children:e.jsx(pe,{})})})]})]},fe)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:v,children:["Add filter ",e.jsx(ge,{})]})})]})]}),e.jsxs("div",{className:he.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(xe,{children:["Automation outputs can be used to send data from Ontime to external software ",e.jsx("br",{}),"or to change properties of Ontime itself.",e.jsx(se,{href:qi,children:"See the documentation for templates"})]}),k.map(($,T)=>{var fe,ue,oe,_,ee,Ne,Pe,je;if(Oa($)){const Z=(fe=j.outputs)==null?void 0:fe[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"OSC"}),e.jsxs("div",{className:he.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx(M,{...c(`outputs.${T}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(D,{children:(ue=Z==null?void 0:Z.targetIP)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Target Port",e.jsx(M,{...c(`outputs.${T}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:as=>as===""?0:Number(as),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(D,{children:(oe=Z==null?void 0:Z.targetPort)==null?void 0:oe.message})]}),e.jsxs("label",{children:["Address",e.jsx(M,{...c(`outputs.${T}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(D,{children:(_=Z==null?void 0:Z.address)==null?void 0:_.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(Ei,{...c(`outputs.${T}.args`),value:$.args,placeholder:"1"}),e.jsx(D,{children:(ee=Z==null?void 0:Z.args)==null?void 0:ee.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>B(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]})]},$.id)}if(Fa($)){const Z=(Ne=j.outputs)==null?void 0:Ne[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"HTTP"}),e.jsxs("div",{className:he.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx(M,{...c(`outputs.${T}.url`,{required:{value:!0,message:"Required field"},pattern:{value:wa,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(D,{children:(Pe=Z==null?void 0:Z.url)==null?void 0:Pe.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>F(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]})]},$.id)}if($a($)){const Z=(je=j.outputs)==null?void 0:je[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"Ontime action"}),e.jsxs(Hi,{value:$.action,index:T,register:c,rowErrors:Z,setValue:d,watch:x,children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>P(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]},$.id)}return null}),e.jsxs(L,{relation:"inner",children:[e.jsxs(f,{onClick:O,children:["OSC ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:C,children:["HTTP ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:q,children:["Ontime action ",e.jsx(ge,{})]})]})]}),e.jsxs(L,{align:"end",children:[(j==null?void 0:j.root)&&e.jsx(D,{children:j.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!N,loading:g,children:"Save"})]})]})}const fs={title:"",filterRule:"all",filters:[],outputs:[]};function Yi(t){const{automations:s}=t,{refetch:n}=yt(),[a,i]=p.useState(null),[l,r]=p.useState(null),o=async c=>{try{r(null),await _a(c)}catch(h){r(V(h))}finally{n()}},u=Object.keys(s);return e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!a,onClick:()=>i(fs),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),a!==null&&e.jsx(Qi,{automation:a,onClose:()=>i(null)}),e.jsxs(_e,{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:[u.length===0&&e.jsx(bt,{handleClick:a?void 0:()=>i(fs)}),u.map(c=>Object.hasOwn(s,c)?e.jsx(p.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[c].title}),e.jsx("td",{children:e.jsx(H,{children:s[c].filterRule})}),e.jsx("td",{children:s[c].filters.length}),e.jsx("td",{children:s[c].outputs.length}),e.jsxs(L,{align:"end",relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>i(s[c]),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>o(c),children:e.jsx(pe,{})})]})]})},c):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(D,{children:l})})})]})]})]})}function Js({automations:t,initialId:s,initialTitle:n,initialAutomationId:a,initialTrigger:i,onCancel:l,postSubmit:r}){var A,k,R,W;const{handleSubmit:o,register:u,setFocus:c,setError:h,watch:m,setValue:d,formState:{errors:x,isSubmitting:j,isValid:g,isDirty:b}}=de({defaultValues:{title:n,trigger:i??Lt[0].value,automationId:a??((A=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:A.id)},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{c("title")},[c]);const y=async v=>{if(s){try{await ka(s,{id:s,...v}),r()}catch(O){h("root",{message:`Failed to save changes to trigger ${V(O)}`})}return}try{await Ta(v),r()}catch(O){h("root",{message:`Failed to save trigger ${V(O)}`})}},w=Object.keys(t).map(v=>({value:v,label:t[v].title})),S=b&&g;return e.jsxs(ze,{as:"form",name:"trigger-form",onSubmit:o(y),onKeyDown:v=>ke(v,l),children:[e.jsx(J,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx(M,{...u("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(D,{children:(k=x.title)==null?void 0:k.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ie,{value:m("trigger"),onValueChange:v=>{v!==null&&d("trigger",v,{shouldDirty:!0})},options:Lt.map(v=>({value:v.value,label:v.label})),"aria-label":"Lifecycle trigger"}),e.jsx(D,{children:(R=x.trigger)==null?void 0:R.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ie,{value:m("automationId"),onValueChange:v=>{v!==null&&d("automationId",v,{shouldDirty:!0})},options:w,"aria-label":"Automation title"}),e.jsx(D,{children:(W=x.automationId)==null?void 0:W.message})]}),e.jsxs(L,{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 Ji(t){var m,d;const{automations:s,id:n,title:a,trigger:i,automationId:l,duplicate:r,handleDelete:o,postSubmit:u}=t,[c,h]=p.useState(!1);return c?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Js,{automations:s,initialId:n,initialTitle:a,initialTrigger:i,initialAutomationId:l,onCancel:()=>h(!1),postSubmit:()=>{h(!1),u()}})})}):e.jsxs("tr",{"data-warn":r,children:[e.jsxs(L,{as:"td",relation:"inner",children:[r&&e.jsx(un,{color:"#FFBC56"}),a]}),e.jsx("td",{children:e.jsx(H,{children:(m=Lt.find(x=>x.value===i))==null?void 0:m.label})}),e.jsx("td",{children:e.jsx(H,{children:(d=s==null?void 0:s[l])==null?void 0:d.title})}),e.jsxs(L,{align:"end",relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>h(!0),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:o,children:e.jsx(pe,{})})]})]})}function Xi(t){const{triggers:s,automations:n}=t,[a,i]=p.useState(!1),{refetch:l}=yt(),[r,o]=p.useState(null),u=async d=>{try{await Na(d)}catch(x){o(V(x))}finally{l()}},c=()=>{i(!1),l()},h=p.useMemo(()=>Oi(s),[s]),m=Object.keys(n).length>0;return e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!m,loading:!1,onClick:()=>i(!0),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[h&&e.jsx(D,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),a&&e.jsx(Js,{automations:n,onCancel:()=>i(!1),postSubmit:c}),e.jsxs(_e,{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(bt,{label:"Create an automation to attach triggers to",handleClick:m?()=>i(!0):void 0}),s.map((d,x)=>e.jsxs(p.Fragment,{children:[e.jsx(Ji,{automations:n,id:d.id,title:d.title,trigger:d.trigger,automationId:d.automationId,duplicate:h==null?void 0:h.includes(x),handleDelete:()=>u(d.id),postSubmit:c}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(D,{children:r})})})]},d.id))]})]})]})]})}function Zi({location:t}){const{data:s,status:n}=yt(),a=re("settings",t),i=re("triggers",t),l=re("automations",t),r=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Automation"}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:r}),e.jsx("div",{ref:a,children:e.jsx(wi,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(Yi,{automations:s.automations})}),e.jsx("div",{ref:i,children:e.jsx(Xi,{triggers:s.triggers,automations:s.automations})})]})]})}const er="_goIcon_1fzu7_17",tr={goIcon:er};function sr(){const{data:t}=Mn(),s=n=>Mt(n);return e.jsx(L,{wrap:"wrap",children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!xt)return null;const a=Wn(n.address);return e.jsxs(Ut,{copyValue:a,onClick:()=>s(a),children:[`${n.name} - ${n.address}`," ",e.jsx(ft,{className:tr.goIcon})]},n.name)})})}function nr(t){return hn(t)}function ar(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],o=s[r];!o||!Qt(o)||(r in t||a.push({id:r,index:i,title:o.title,cue:o.cue,scheduledStart:o.timeStart,actualEnd:null,scheduledEnd:o.timeEnd,actualStart:null}),r in t&&a.push({id:r,index:i,title:o.title,cue:o.cue,scheduledStart:o.timeStart,actualEnd:t[r].endedAt,scheduledEnd:o.timeEnd,actualStart:t[r].startedAt}),i++)}return a}const ir=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function rr(t){const s=[];s.push(ir);for(const n of t)s.push([String(n.index),n.title,n.cue,$e(n.scheduledStart),$e(n.actualStart),$e(n.scheduledEnd),$e(n.actualEnd)]);return nr(s)}const lr="_blink_15peo_1",or="_fourtyfive_15peo_13",cr="_over_15peo_17",dr="_under_15peo_21",dt={blink:lr,fourtyfive:or,over:cr,under:dr};function ur(){const{data:t}=Xa(),{data:s}=Yt(),n=async()=>await Za(),a=l=>{if(!l)return;const r=rr(l),o=As(r,"text/csv;charset=utf-8;");Bt(o,"ontime-report.csv")},i=p.useMemo(()=>ar(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Report"}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(Ce,{children:["Manage report",e.jsxs(L,{children:[e.jsxs(f,{onClick:()=>a(i),disabled:i.length===0,children:[e.jsx(is,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:i.length===0,children:[e.jsx(is,{}),"Clear All"]})]})]})}),e.jsx(E,{children:e.jsxs(_e,{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(bt,{label:"Reports are generated when running through the show."}),i.map(l=>{const r=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",o=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:Se([r&&dt[r]]),children:$e(l.scheduledStart)}),e.jsx("th",{className:Se([r&&dt[r]]),children:$e(l.actualStart)}),e.jsx("th",{className:Se([o&&dt[o]]),children:$e(l.scheduledEnd)}),e.jsx("th",{className:Se([o&&dt[o]]),children:$e(l.actualEnd)})]},l.id)})]})]})})]})})}const hr="_expand_1sy0c_17",mr="_column_1sy0c_21",bs={expand:hr,column:mr},xr=[{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"}],jr={alias:"",target:Re.Timer,search:"",enabled:!0};function pr({urlPreset:t,onClose:s}){var k,R,W;const{addPreset:n,updatePreset:a,isMutating:i}=Os(),{handleSubmit:l,register:r,setFocus:o,setError:u,clearErrors:c,setValue:h,getValues:m,watch:d,formState:{errors:x,isSubmitting:j,isValid:g,isDirty:b}}=de({defaultValues:t??jr,mode:"onChange",resetOptions:{keepDirtyValues:!0}}),y=p.useRef(null),w=async v=>{try{t?await a(t.alias,v):await n(v),s()}catch(O){u("root",{message:V(O)})}};p.useEffect(()=>{o("alias")},[o]);const S=()=>{var v;c();try{const O=Un(m("alias"),((v=y.current)==null?void 0:v.value.trim())??"");h("target",O.target,{shouldDirty:!0,shouldValidate:!0}),h("search",O.search,{shouldDirty:!0,shouldValidate:!0})}catch(O){u("root",{message:os(O)});return}},A=v=>{try{return new URLSearchParams(v),!0}catch(O){return os(O)||"Invalid URL parameters"}};return e.jsxs(ze,{as:"form",onSubmit:l(w),onKeyDown:v=>ke(v,s),className:bs.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(L,{children:[e.jsxs("div",{children:[e.jsx(ae,{children:"Alias"}),e.jsx(M,{...r("alias",{required:"Alias is required",pattern:{value:Da,message:"Field can only contain URL safe characters (a-z, 0-9, _ and -)"}})})]}),e.jsxs("div",{className:bs.expand,children:[e.jsx(ae,{children:"Generate options (paste URL to generate options)"}),e.jsxs(L,{children:[e.jsx(M,{placeholder:"Paste URL",fluid:!0,ref:y}),e.jsx(f,{onClick:S,children:"Generate"})]})]})]}),((k=x.alias)==null?void 0:k.message)&&e.jsx(D,{children:x.alias.message}),e.jsxs("div",{children:[Et," or ",Et]}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(ae,{children:"Target"}),e.jsx(ie,{options:xr,...r("target",{required:"Target is required"}),value:d("target"),onValueChange:v=>{v!==null&&h("target",v,{shouldDirty:!0})}})]}),e.jsxs("div",{children:[e.jsx(ae,{children:"Parameters"}),e.jsx(It,{fluid:!0,rows:3,...r("search",{validate:A})}),e.jsx(D,{children:(R=x.search)==null?void 0:R.message})]}),e.jsxs("div",{children:[e.jsx(D,{children:(W=x.root)==null?void 0:W.message}),e.jsxs(L,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!g||!b,loading:j||i,children:"Save"})]})]})]})}const gr="https://docs.getontime.no/features/url-presets/";function fr(){const[t,s]=p.useState({isOpen:!1,preset:void 0}),{data:n,status:a}=Fs(),{deletePreset:i,isMutating:l}=Os(),r=()=>s({isOpen:!0}),o=c=>s({isOpen:!0,preset:c}),u=()=>s({isOpen:!1,preset:void 0});return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["URL presets",e.jsxs(f,{onClick:r,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(se,{href:gr,children:"See the docs"})]})}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:a==="pending"}),t.isOpen&&e.jsx(pr,{urlPreset:t.preset,onClose:u}),e.jsxs(_e,{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(bt,{handleClick:r}),n.map((c,h)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(De,{defaultChecked:c.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(H,{children:c.target})}),e.jsx("td",{style:{width:"100%"},children:c.alias}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white",onClick:m=>$s(c.alias,m),disabled:l,children:e.jsx(Ns,{})}),e.jsx(Y,{onClick:()=>o(c),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${h}`,disabled:l,children:e.jsx(gt,{})}),e.jsx(Y,{onClick:()=>i(c.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${h}`,disabled:l,children:e.jsx(pe,{})})]})]},c.alias))]})]})]})]})})}function br({location:t}){const s=re("presets",t),n=re("link",t),a=re("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(fr,{})}),e.jsx("div",{ref:n,children:e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Share Ontime Link"}),!Qe&&e.jsxs(e.Fragment,{children:[e.jsx(Ie,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(sr,{})]}),e.jsx(le,{}),e.jsx(Pa,{})]})})}),e.jsx("div",{ref:a,children:e.jsx(ur,{})})]})}const ss=`${zt}/excel`;async function yr(t,s){const n=new FormData;return n.append("excel",t),(await X.post(`${ss}/upload`,n,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data}async function vr(t,s){return(await X.post(`${ss}/preview`,{options:t},{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data}async function wr(t,s,n){try{const a=await X.get(`${ss}/${t}/export`,{signal:n==null?void 0:n.signal,timeout:(n==null?void 0:n.timeout)??Le.longTimeout,responseType:"blob"});Bt(a.data,`${s??"Ontime_rundown"}.xlsx`)}catch(a){console.error("Error downloading file:",a)}}const Je=`${zt}/sheets`,Sr=async()=>(await X.get(`${Je}/connect`)).data,Cr=async(t,s,n)=>{const a=new FormData;return a.append("client_secret",t),(await X.post(`${Je}/${s}/connect`,a,{signal:n==null?void 0:n.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data},_r=async()=>(await X.post(`${Je}/revoke`)).data,kr=async(t,s,n)=>(await X.post(`${Je}/${t}/read`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data,Xs=async(t,s)=>(await X.post(`${Je}/${t}/worksheets`,void 0,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data,Tr=async(t,s,n)=>(await X.post(`${Je}/${t}/write`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data;function Nr(t){if(!Dr(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 Zs(t){if(!Pr(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 Dr(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Pr(t){return t==null?void 0:t.name.endsWith(".json")}function Rr(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 Te=`${zt}/db`;function en(t){return X.post(`${Te}/download`,{filename:t},{timeout:Le.longTimeout})}async function Er(t){try{const{data:s,name:n}=await Mr(t),a=JSON.stringify(s,null,2),i=As(a,"application/json;charset=utf-8;");Bt(i,`${n}.json`)}catch(s){console.error(s)}}async function tn(t){const s=new FormData;return s.append("project",t),(await X.post(`${Te}/upload`,s,{timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data}async function sn(t){return await X.patch(Te,t)}async function Ir(t){return(await X.post(`${Te}/new`,t)).data}async function Lr(t){return(await X.post(`${Te}/quick`,t)).data}async function Ar(t){return(await X.get(`${Te}/all`,{signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})).data}async function nn(t){return(await X.post(`${Te}/load`,{filename:t})).data}async function Or(){return(await X.post(`${Te}/demo`)).data}async function Fr(t,s){const n=`${Te}/${t}/duplicate`,a=decodeURIComponent(n);return(await X.post(a,{newFilename:s})).data}async function $r(t,s){const n=`${Te}/${t}/rename`,a=decodeURIComponent(n);return(await X.put(a,{newFilename:s})).data}async function Vr(t){const s=`${Te}/${t}`,n=decodeURIComponent(s);return(await X.delete(n)).data}async function Mr(t){const s=await en(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 Wr={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},ys={stepData:Wr,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,summary:null,spreadsheetImportMap:xi},z=mn((t,s)=>({...ys,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(ys),resetPreview:()=>t({rundown:null,customFields:null,summary:null})}));function wt(){const t=$t(),s=z(m=>m.patchStepData),n=z(m=>m.setRundown),a=z(m=>m.setCustomFields),i=z(m=>m.setSummary);return{connect:async(m,d)=>{try{return await Cr(m,d)}catch(x){s({authenticate:{available:!1,error:V(x)}})}},revoke:async()=>{try{return await _r()}catch(m){s({authenticate:{available:!1,error:V(m)}})}},verifyAuth:async()=>{try{return await Sr()}catch(m){s({authenticate:{available:!1,error:V(m)}})}},importRundownPreview:async(m,d)=>{try{const x=await kr(m,d);n(x.rundown),a(x.customFields),i(x.summary)}catch(x){s({pullPush:{available:!0,error:V(x)}})}},importRundown:async(m,d)=>{try{await sn({rundowns:m,customFields:d}),await t.invalidateQueries({queryKey:[Bn,zn]})}catch(x){s({pullPush:{available:!0,error:V(x)}})}},exportRundown:async(m,d)=>{try{await Tr(m,d),s({pullPush:{available:!1,error:""}})}catch(x){s({pullPush:{available:!0,error:V(x)}})}}}}const At={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 Ur(t){return typeof t!="object"||t===null?!1:Object.keys(At).every(n=>Object.hasOwn(t,n))}function vs(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 Br(t){localStorage.setItem("import-options",JSON.stringify(t))}function zr(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function Gr(){try{const t=zr();return Ur(t)?t:At}catch{return At}}const Kr="_uploadSection_10owf_17",Hr="_finishSection_10owf_18",qr="_error_10owf_40",Qr="_success_10owf_43",Yr="_singleActionCell_10owf_47",Ve={uploadSection:Kr,finishSection:Hr,error:qr,success:Qr,singleActionCell:Yr};function Jr({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:a,onSubmitImport:i}){const l=Gr(),{revoke:r}=wt(),{control:o,handleSubmit:u,register:c,setValue:h,watch:m,formState:{errors:d,isValid:x}}=de({mode:"onChange",defaultValues:l,values:l}),{fields:j,append:g,remove:b}=mt({control:o,name:"custom"}),y=z(P=>P.stepData),w=z(P=>P.worksheetNames),[S,A]=p.useState("");p.useEffect(()=>{!w||w.length===0||w.includes(l.Worksheet)||h("Worksheet",w[0],{shouldValidate:!0,shouldDirty:!0})},[w,h,l.Worksheet]);const k=async P=>{A("export");const I=vs(P);await a(I),A("")},R=async()=>{await r(),n()},W=async P=>{A("import");const I=vs(P);Br(P),await i(I),A("")},v=P=>{b(P)},O=()=>{g({})},C=!!S,q=s&&!C,B=!C&&!y.worksheet.error,F=!t&&x&&(q||B);return e.jsxs(E,{as:"form",id:"import-map",children:[e.jsxs(Ce,{children:["Import options",e.jsxs(L,{children:[!s&&e.jsx(Jt,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:R,disabled:C,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:C,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:u(k),disabled:!B,loading:S==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:u(W),disabled:!F,loading:S==="import",children:"Import preview"})]})]}),e.jsxs(xe,{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(_e,{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:Ve.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([P,I])=>P==="custom"?null:P==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:P}),e.jsx("td",{children:e.jsx(ie,{id:I,value:m(P),onValueChange:N=>{N!==null&&h(P,N,{shouldDirty:!0})},options:(w==null?void 0:w.map(N=>({value:N,label:N})))||[]})}),e.jsx("td",{className:Ve.singleActionCell})]},I):e.jsxs("tr",{children:[e.jsx("td",{children:P}),e.jsx("td",{children:e.jsx(M,{id:I,fluid:!0,maxLength:25,defaultValue:I,placeholder:"Use default column name",...c(P)})}),e.jsx("td",{className:Ve.singleActionCell})]},I)),j.map((P,I)=>{var fe,ue,oe;const N=P.ontimeName,K=P.importName,$=(oe=(ue=(fe=d.custom)==null?void 0:fe[I])==null?void 0:ue.ontimeName)==null?void 0:oe.message,T=`custom.${I}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx(M,{maxLength:25,fluid:!0,defaultValue:N,placeholder:"Name of the field as shown in Ontime",...c(`custom.${I}.ontimeName`,{validate:_=>Gt.isAlphanumericWithSpace(_)?!0:"Only alphanumeric characters and space are allowed"})}),$&&e.jsx(D,{children:$})]}),e.jsx("td",{children:e.jsx(M,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...c(`custom.${I}.importName`)})}),e.jsx("td",{className:Ve.singleActionCell,children:e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>v(I),children:e.jsx(pe,{})})})]},T)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(L,{as:"td",align:"end",children:e.jsxs(f,{onClick:O,children:["Add custom field ",e.jsx(ge,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(D,{children:y.worksheet.error})]})}const Xr="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function Zr(){return e.jsxs(xe,{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(se,{href:Xr,children:"See the docs"})]})}function el(t){const{onCancel:s}=t,{revoke:n,connect:a,verifyAuth:i}=wt(),[l,r]=p.useState(null),[o,u]=p.useState(null),[c,h]=p.useState(""),[m,d]=p.useState(""),x=z(N=>N.sheetId),j=z(N=>N.setSheetId),g=z(N=>N.setWorksheets),b=z(N=>N.patchStepData),y=z(N=>N.authenticationStatus),w=z(N=>N.setAuthenticationStatus),S=z(N=>N.stepData.authenticate.error),A=async()=>{const N=await i();N&&w(N.authenticated)};p.useEffect(()=>{b({authenticate:{available:!1,error:""}}),O()},[]);const k=async()=>{h("cancel"),await n(),await A(),h("")},R=()=>{s()},W=N=>{var K;(K=N.target.files)!=null&&K.length&&r(N.target.files[0])},v=async()=>{if(!l||!x)return;b({worksheet:{available:!1,error:""}}),h("connect");const N=await a(l,x);N&&(d(N.verification_url),u(N.user_code)),h("")},O=async(N=0)=>{const K=await i();if(K!=null&&K.authenticated&&(w(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const $=await Xs(K.sheetId);g($)}catch($){const T=V($);b({worksheet:{available:!1,error:T}})}h("");return}if(N<=10){setTimeout(()=>O(N+1),2e3);return}h("")},C=async()=>{h("authenticate"),Mt(m),window.addEventListener("focus",async()=>{O()},{once:!0})},q=l&&x,B=!!o&&!!m,F=!!c,P=y==="authenticated",I=y==="pending";return e.jsxs(E,{children:[e.jsxs(Ce,{children:["Sync with Google Sheet (experimental)",P?e.jsx(f,{onClick:k,loading:c==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:R,children:"Go Back"})]}),e.jsxs(ce,{children:[e.jsx(ae,{children:"Upload Client Secret provided by Google"}),e.jsx(D,{children:S}),e.jsx(M,{fluid:!0,type:"file",onChange:W,accept:".json",disabled:F||B})]}),e.jsxs(ce,{children:[e.jsx(ae,{children:"Enter ID of sheet to synchronise"}),e.jsx(D,{children:void 0}),e.jsx(M,{fluid:!0,placeholder:"Sheet ID",onChange:N=>j(N.target.value),disabled:F||B})]}),B?e.jsx(ce,{children:e.jsxs(L,{children:[I&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Ut,{copyValue:o??"",disabled:!B,children:o||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:C,disabled:!B,children:[e.jsx(xn,{}),"Authenticate"]})]})}):e.jsx(ce,{children:e.jsx(L,{children:e.jsxs(f,{onClick:v,disabled:!q||F,loading:c==="connect",children:[e.jsx(ut,{}),"Connect"]})})})]})}const tl="_center_l8uww_17",sl="_nowrap_l8uww_21",nl="_secondaryRow_l8uww_25",al="_linkStartActive_l8uww_30",il="_flex_l8uww_36",rl="_subdued_l8uww_42",te={center:tl,nowrap:sl,secondaryRow:nl,linkStartActive:al,flex:il,subdued:rl};function Tt(t){return t?"Yes":void 0}function ll({rundown:t,customFields:s}){let n=0;const a=Object.keys(s),i=a.map(l=>s[l].label);return e.jsxs(_e,{className:te.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(Va(r)){const m=r.colour?St(r.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:te.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:{...m},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:te.center,children:e.jsx(H,{children:r.id})})]},r.id)}if(Ma(r)){const m=r.colour?St(r.colour):{};return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:te.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:{...m},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:te.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:te.secondaryRow,children:["Note: ",r.note]})})]},r.id)}if(!Qt(r))return null;n+=1;const o=r.colour?St(r.colour):{},u=Tt(r.countToEnd),c=Tt(r.skip),h=Tt(r.flag);return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:te.center,children:e.jsx(H,{children:n})}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:te.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{className:te.center,children:h&&e.jsx(H,{children:h})}),e.jsxs("td",{className:te.flex,children:[e.jsx("span",{className:r.linkStart?te.subdued:void 0,children:Fe(r.timeStart)}),r.linkStart&&e.jsx(jn,{className:te.linkStartActive})]}),e.jsx("td",{children:Fe(r.timeEnd)}),e.jsx("td",{children:Fe(r.duration)}),e.jsx("td",{children:Fe(r.timeWarning)}),e.jsx("td",{children:Fe(r.timeDanger)}),e.jsx("td",{className:te.center,children:u&&e.jsx(H,{children:u})}),e.jsx("td",{children:c&&e.jsx(H,{children:c})}),e.jsx("td",{style:{...o},children:r.colour}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.timerType})}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.endAction})}),a.map(m=>{let d="";return m in r.custom&&(d=r.custom[m]),e.jsx("td",{children:d},m)}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:te.secondaryRow,children:["Note: ",r.note]})})]},r.id)})})]})}function ol({rundown:t,customFields:s,summary:n,onFinished:a,onCancel:i,onBack:l}){const{data:r}=Yt(),[o,u]=p.useState(!1),{importRundown:c}=wt(),h=z(x=>x.resetPreview),m=()=>{h(),i()},d=async()=>{u(!0),await c({[r.id]:{...t,id:r.id,title:r.title}},s),u(!1),a()};return e.jsxs(E,{children:[e.jsxs(Ce,{children:["Review Rundown",e.jsxs(L,{children:[e.jsx(f,{onClick:m,variant:"ghosted",disabled:o,children:"Cancel"}),e.jsx(f,{onClick:l,variant:"subtle",disabled:o,children:"Back"}),e.jsx(f,{onClick:d,variant:"primary",loading:o,children:"Apply"})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx("b",{children:"Title"})," ",t.title]}),e.jsxs(U,{children:[e.jsx("b",{children:"Number of entries"})," ",t.flatOrder.length]}),e.jsxs(U,{children:[e.jsx("b",{children:"Start time"})," ",Fe(n.start)]}),e.jsxs(U,{children:[e.jsx("b",{children:"End time"})," ",Fe(n.end)]}),e.jsxs(U,{children:[e.jsx("b",{children:"Total duration"})," ",Kt(n.duration)]})]}),e.jsx(ll,{rundown:t,customFields:s})]})}function cl(){const[t,s]=p.useState("none"),[n,a]=p.useState(""),[i,l]=p.useState("none"),{exportRundown:r,importRundownPreview:o,verifyAuth:u}=wt(),c=z(_=>_.setWorksheets),h=z(_=>_.authenticationStatus),m=z(_=>_.setAuthenticationStatus),d=z(_=>_.rundown),x=z(_=>_.setRundown),j=z(_=>_.customFields),g=z(_=>_.setCustomFields),b=z(_=>_.summary),y=z(_=>_.setSummary),w=z(_=>_.setSheetId),S=z(_=>_.sheetId),A=z(_=>_.resetPreview),k=p.useRef(null),R=async _=>{var Ne;const ee=(Ne=_.target.files)==null?void 0:Ne[0];if(!ee){c(null),l("none");return}try{l("loading"),Nr(ee);const Pe=await yr(ee);c(Pe),s("excel"),l("done")}catch(Pe){const je=Gn(Pe);a(`Error uploading file: ${je}`),c(null),l("none")}},W=()=>{var _;(_=k.current)==null||_.click()},v=()=>{s("none"),x(null),l("none"),c(null),g(null),y(null),a(""),w(null)},O=async()=>{const _=await u();if(_&&(m(_.authenticated),w(_.sheetId),_.authenticated==="authenticated"&&_.sheetId))try{const ee=await Xs(_.sheetId);c(ee)}catch(ee){const Ne=V(ee);a(`Error getting worksheets: ${Ne}`)}s("gsheet")},C=()=>{v()},q=async _=>{if(a(""),t==="excel")try{const ee=await vr(_);x(ee.rundown),g(ee.customFields),y(ee.summary)}catch(ee){a(V(ee))}if(t==="gsheet"){if(!S)return;await o(S,_)}},B=async()=>{if(v(),h==="authenticated"){const _=await u();_&&m(_.authenticated)}},F=()=>{s("finished"),x(null),l("none"),c(null),g(null),a("")},P=async _=>{S&&await r(S,_)},I=t==="excel",N=t==="gsheet",K=h==="authenticated",$=t==="none",T=t==="finished",fe=N&&!K,ue=N&&K||I&&i==="done",oe=d!==null&&j!==null&&b!==null;return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(D,{children:n}),$&&e.jsxs(e.Fragment,{children:[e.jsx(Zr,{}),e.jsx("input",{ref:k,style:{display:"none"},type:"file",onChange:R,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Ve.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:W,loading:i==="loading",children:[e.jsx(rt,{}),"Import from spreadsheet"]}),e.jsx(ae,{children:"Accepts .xlsx files"})]}),e.jsx(ei,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:O,disabled:i!=="none",children:[e.jsx(pn,{}),"Synchronise with Google"]}),e.jsx(ae,{children:"Start authentication process"})]})]})]}),T&&e.jsxs("div",{className:Ve.finishSection,children:[n?e.jsx("span",{className:Ve.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Ve.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:v,children:"Return"})]}),fe&&e.jsx(el,{onCancel:C}),ue&&!oe&&e.jsx(Jr,{hasErrors:!!n,isSpreadsheet:I,onCancel:B,onSubmitExport:P,onSubmitImport:q}),oe&&e.jsx(ol,{rundown:d,customFields:j,summary:b,onFinished:F,onCancel:B,onBack:A})]})})}const dl="_halfWidth_6p65m_17",ul="_fullWidth_6p65m_21",hl="_twoCols_6p65m_25",ml="_current_6p65m_31",pt={halfWidth:dl,fullWidth:ul,twoCols:hl,current:ml};function an({onSubmit:t,onCancel:s,initialColour:n,initialLabel:a,initialKey:i}){const{data:l}=vt(),[r,o]=p.useState(n||""),{handleSubmit:u,register:c,setFocus:h,setError:m,setValue:d,getValues:x,watch:j,formState:{errors:g,isSubmitting:b,isValid:y,isDirty:w}}=de({defaultValues:{type:"text",label:a||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),S=async v=>{const{type:O,label:C,colour:q}=v,B={type:O,colour:q,label:C};try{await t(B)}catch(F){m("root",{type:"custom",message:V(F)})}};p.useEffect(()=>{h("label")},[h]);const A=v=>{o(v),d("colour",v,{shouldDirty:!0})},k=x("colour"),R=w&&y,W=i!==void 0;return e.jsxs(ze,{as:"form",onSubmit:u(S),onKeyDown:v=>ke(v,s),children:[e.jsxs(xe,{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(ae,{children:"Type"}),e.jsx(Us,{orientation:"horizontal",disabled:W,onValueChange:v=>d("type",v,{shouldDirty:!0}),value:j("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:pt.twoCols,children:[e.jsxs("label",{children:[e.jsx(ae,{children:"Label (only alphanumeric characters are allowed)"}),g.label&&e.jsx(D,{children:g.label.message}),e.jsx(M,{...c("label",{required:{value:!0,message:"Required field"},onChange:()=>d("key",mi(x("label"))??"N/A"),validate:v=>v.trim().length===0?"Required field":Gt.isAlphanumericWithSpace(v)?!W&&W&&Object.keys(l).includes(v)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(ae,{children:"Key (use in Integrations and API)"}),e.jsx(M,{...c("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(ae,{children:"Colour"}),e.jsx(Ra,{name:"colour",value:k,handleChange:(v,O)=>A(O)})]}),g.root&&e.jsx(D,{children:g.root.message}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!R,loading:b,children:"Save"})]})]})}function xl(t){const{colour:s,label:n,fieldKey:a,type:i,onEdit:l,onDelete:r}=t,[o,u]=p.useState(!1),c=async h=>{await l(a,h),u(!1)};return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(an,{onCancel:()=>u(!1),onSubmit:c,initialColour:s,initialLabel:n,initialKey:a})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Ea,{color:s})}),e.jsx("td",{children:e.jsx(H,{children:i})}),e.jsx("td",{className:pt.halfWidth,children:n}),e.jsx("td",{className:pt.fullWidth,children:e.jsx(Ut,{size:"small",copyValue:a,children:a})}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>u(!0),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>r(a),children:e.jsx(pe,{})})]})]})}function jl(){const{data:t,refetch:s}=vt(),[n,a]=p.useState(!1),i=()=>{a(!0)},l=()=>{a(!1)},r=async c=>{await Qa(c),s(),a(!1)},o=async(c,h)=>{await Ya(c,h),s()},u=async c=>{try{await Ja(c),s()}catch{}};return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Custom fields",e.jsxs(f,{onClick:i,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(zs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(se,{href:Kn,children:"See the docs"})]})}),e.jsxs(E,{children:[n&&e.jsx(an,{onSubmit:r,onCancel:l}),e.jsxs(_e,{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(([c,{colour:h,label:m,type:d}])=>e.jsx(xl,{fieldKey:c,colour:h,label:m,type:d,onEdit:o,onDelete:u},c))})]})]})]})})}function pl(){const{data:t,status:s,isError:n,refetch:a,isFetching:i}=Ft({queryKey:ye,queryFn:({signal:l})=>Ka({signal:l}),placeholderData:(l,r)=>l,refetchInterval:Vs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:a,isFetching:i}}function rn(){const t=$t(),{mutateAsync:s}=Xe({mutationFn:Wa,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:n}=Xe({mutationFn:Ua,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:a}=Xe({mutationFn:([r,o])=>Ba(r,o),onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:i}=Xe({mutationFn:za,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:l}=Xe({mutationFn:Ga,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}});return{create:s,duplicate:n,remove:i,load:l,rename:a}}function gl({onSubmit:t,onCancel:s,initialTitle:n}){const{handleSubmit:a,register:i,setFocus:l,setError:r,formState:{errors:o,isSubmitting:u,isValid:c,isDirty:h}}=de({defaultValues:{title:n},mode:"onChange"}),m=async x=>{try{await t(x.title)}catch(j){r("root",{type:"custom",message:V(j)})}};p.useEffect(()=>{l("title")},[l]);const d=h&&c;return e.jsxs(ze,{as:"form",onSubmit:a(m),onKeyDown:x=>ke(x,s),children:[e.jsxs("label",{children:[e.jsx(ae,{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":Gt.isAlphanumericWithSpace(x)===!1?"Title can only contain alphanumeric characters, spaces and underscores":!0}),fluid:!0}),o.title&&e.jsx(D,{children:o.title.message})]}),o.root&&e.jsx(D,{children:o.root.message}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!d,loading:u,children:"Save"})]})]})}function fl({onClose:t}){const{create:s}=rn(),{handleSubmit:n,register:a,setFocus:i,setError:l,formState:{errors:r,isSubmitting:o}}=de({defaultValues:{title:""}}),u=async c=>{try{await s(c.title||"untitled"),t()}catch(h){l("root",{message:`Failed to create rundown. ${h}`})}};return p.useEffect(()=>{i("title")},[i]),e.jsxs(ze,{as:"form",onSubmit:n(u),children:[e.jsx(E,{children:e.jsxs("label",{children:[e.jsx(ae,{children:"Rundown title"}),e.jsx(M,{...a("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:o,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:o,children:"Create rundown"})]}),r.root&&e.jsx(D,{children:r.root.message})]})}function bl(){var O;const{data:t}=pl(),{duplicate:s,remove:n,load:a,rename:i}=rn(),[l,r]=Ee(),[o,u]=Ee(),[c,h]=Ee(),[m,d]=p.useState(""),[x,j]=p.useState(null),[g,b]=p.useState(null),y=C=>{b(null),d(C),u.open()},w=C=>{b(null),d(C),r.open()},S=C=>{b(null),j(C)},A=async()=>{try{await a(m)}catch(C){b(`Failed to load rundown. ${V(C)}`)}finally{u.close()}},k=async C=>{b(null),j(null),d("");try{await s(C)}catch(q){b(`Failed to duplicate rundown. ${V(q)}`)}},R=async(C,q)=>{try{await i([C,q]),j(null)}catch(B){b(`Failed to rename rundown. ${V(B)}`)}},W=async()=>{try{await n(m)}catch(C){b(`Failed to delete rundown. ${V(C)}`)}finally{r.close()}},v=async(C,q)=>{await wr(C,q)};return e.jsxs(e.Fragment,{children:[e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage project rundowns",e.jsx(L,{children:e.jsxs(f,{onClick:()=>{b(null),h.open()},children:["New ",e.jsx(ge,{})]})})]}),e.jsx(le,{}),e.jsxs(E,{children:[c&&e.jsx(fl,{onClose:h.close}),g&&e.jsx(D,{children:g}),e.jsxs(_e,{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:(O=t==null?void 0:t.rundowns)==null?void 0:O.map(({id:C,numEntries:q,title:B})=>{const F=t.loaded===C;return x===C?e.jsx("tr",{children:e.jsx("td",{colSpan:3,children:e.jsx(gl,{onCancel:()=>j(null),onSubmit:I=>R(C,I),initialTitle:B})})},C):e.jsxs("tr",{className:Se([F&&pt.current]),children:[e.jsx("td",{children:q}),e.jsxs("td",{children:[B," ",F&&e.jsx(H,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(Ht,{render:e.jsx(Y,{variant:"ghosted-white"}),items:[{type:"item",icon:Ds,label:"Rename",onClick:()=>S(C)},{type:"item",icon:rt,label:"Load",onClick:()=>y(C),disabled:F},{type:"item",icon:Ps,label:"Download .xlsx",onClick:()=>v(C,B)},{type:"item",icon:gn,label:"Duplicate",onClick:()=>k(C)},{type:"divider"},{type:"destructive",icon:pe,label:"Delete",onClick:()=>w(C),disabled:F}],children:e.jsx(Rs,{})})})]},C)})})]})]})]})}),e.jsx(jt,{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:W,children:"Delete rundown"})]})}),e.jsx(jt,{isOpen:o,onClose:u.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:u.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:A,children:"Load rundown"})]})})]})}function yl(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:a,defaultDangerTime:i,defaultTimerType:l,defaultEndAction:r,setDefaultDuration:o,setLinkPrevious:u,setTimeStrategy:c,setWarnTime:h,setDangerTime:m,setDefaultTimerType:d,setDefaultEndAction:x}=Bs(y=>y),j=qe(t),g=qe(a),b=qe(i);return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Rundown defaults"}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(Ce,{children:"Default settings for new events"}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(De,{size:"large",checked:s,onCheckedChange:u})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ie,{value:n,onValueChange:y=>{y!==null&&c(y)},options:[{value:ms.LockDuration,label:"Duration"},{value:ms.LockEnd,label:"End Time"}]})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Default duration",description:"Default duration for new events"}),e.jsx(He,{name:"defaultDuration",submitHandler:(y,w)=>o(w),time:j,placeholder:at.duration})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ie,{value:l,onValueChange:y=>{y!==null&&d(y)},options:[{value:ot.CountDown,label:"Count down"},{value:ot.CountUp,label:"Count up"},{value:ot.Clock,label:"Clock"},{value:ot.None,label:"None"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"End Action",description:"Default end action for new events"}),e.jsx(ie,{value:r,onValueChange:y=>{y!==null&&x(y)},options:[{value:kt.None,label:"None"},{value:kt.LoadNext,label:"Load next"},{value:kt.PlayNext,label:"Play next"}]})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(y,w)=>h(w),time:g,placeholder:at.warnTime})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(y,w)=>m(w),time:b,placeholder:at.dangerTime})]})]})]})]})})}function vl({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(Me,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(yl,{})}),e.jsx("div",{ref:n,children:e.jsx(jl,{})}),e.jsx("div",{ref:a,children:e.jsx(bl,{})}),e.jsx("div",{ref:i,children:e.jsx(cl,{})})]})}const wl="_textEntry_1xa10_17",Sl="_inlineEntry_1xa10_25",Cl="_redirect_1xa10_32",_l="_label_1xa10_36",Oe={textEntry:wl,inlineEntry:Sl,redirect:Cl,label:_l};function kl({id:t,isOpen:s,name:n,currentPath:a,origin:i,onClose:l}){const{data:r}=Fs(),[o,u]=p.useState(a),[c,h]=p.useState("/"),{setRedirect:m}=Ms,d=g=>{g==="/"||g===a||(g.startsWith("preset-")?m({target:t,redirect:g.slice(7)}):m({target:t,redirect:g}),l())},x=r.filter(g=>g.enabled),j=[...Hn.map(g=>({value:`/${g.url}`,label:g.label})),...x.map(g=>({value:`preset-${g.alias}`,label:`URL Preset: ${g.alias}`}))];return e.jsx(jt,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(xe,{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(zs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:Oe.inlineEntry,children:[e.jsx("span",{className:Oe.label,children:"Enter custom path"}),e.jsxs("label",{className:Oe.textEntry,children:[i,e.jsx(M,{placeholder:"eg. /timer",fluid:!0,value:o,onChange:g=>u(g.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:o===a||o==="",className:Oe.redirect,onClick:()=>d(o),children:["Redirect",e.jsx(rs,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:Oe.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:Oe.inlineEntry,children:[e.jsxs("label",{className:Oe.textEntry,children:[i,e.jsx(ie,{fluid:!0,options:j,defaultValue:j[0].value,onValueChange:g=>{g!==null&&h(g)},disabled:x.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:Oe.redirect,disabled:x.length===0||c==="/",onClick:()=>d(c),children:["Redirect ",e.jsx(rs,{})]})]})]})]})})}const Tl="_blink_vtewd_1",Nl="_halfWidthNoWrap_vtewd_25",Dl="_copiable_vtewd_30",Ot="_self_vtewd_35",st={blink:Tl,halfWidthNoWrap:Nl,copiable:Dl,self:Ot};function Pl(){const t=cs(j=>j.id),s=cs(j=>j.clients),[n,a]=Ee(),[i,l]=Ee(),{setIdentify:r}=Ms,[o,u]=p.useState(""),c=j=>{u(j),l.open()},h=j=>{u(j),a.open()},m=Object.entries(s).filter(([j,{type:g}])=>g==="ontime"),d=Object.entries(s).filter(([j,{type:g}])=>g!=="ontime"),x=s[o];return e.jsxs(e.Fragment,{children:[n&&x!==void 0&&e.jsx(kl,{id:o,name:x.name,origin:x.origin,currentPath:x.path,isOpen:n,onClose:a.close}),i&&e.jsx(qn,{id:o,name:x==null?void 0:x.name,isOpen:i,onClose:l.close}),e.jsxs(E,{children:[e.jsxs(Ce,{children:["Ontime Clients (",m.length,")"]}),e.jsxs(_e,{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:m.map(([j,g])=>{const{identify:b,name:y,path:w}=g,S=t===j;return e.jsxs("tr",{className:Se([S&&st.self]),children:[e.jsxs(L,{relation:"inner",as:"td",children:[S&&e.jsx(H,{children:"SELF"}),y]}),e.jsx("td",{className:st.copiable,children:w}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${b?st.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:()=>c(j),children:"Rename"}),e.jsx(f,{size:"small",disabled:S,"data-testid":S?"":"not-self-redirect",onClick:()=>h(j),children:"Redirect"})]})]},j)})})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsxs(Ce,{children:["Other Clients (",d.length,")"]}),e.jsxs(_e,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:st.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:st.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:d.map(([j,g])=>{const{name:b,type:y}=g;return e.jsxs("tr",{children:[e.jsx("td",{children:b}),e.jsx("td",{children:y})]},j)})})]})]})]})}function Rl(){return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Manage clients"}),e.jsx(le,{}),e.jsx(Pl,{})]})})}const El="_iconRotate_l21m9_17",Il={iconRotate:El};function Ll(){const t=s=>{$s("log",s)};return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(ft,{className:Il.iconRotate})]})]}),e.jsx(le,{}),e.jsx(Qn,{})]})})}function Al({location:t}){const s=re("clients",t),n=re("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Network"}),Yn,e.jsx("div",{ref:n,children:e.jsx(Ll,{})}),e.jsx("div",{ref:s,children:e.jsx(Rl,{})})]})}const ws={project:{title:""},settings:{timeFormat:"24",language:"en"}};function Ol({isOpen:t,onClose:s}){var y,w,S,A;const{defaultWarnTime:n,defaultDangerTime:a,setDangerTime:i,setWarnTime:l}=Bs(),{handleSubmit:r,register:o,formState:{errors:u,isSubmitting:c,isValid:h},watch:m,setError:d,setValue:x}=de({defaultValues:ws,values:ws,resetOptions:{keepDirtyValues:!0}}),j=async k=>{try{k.project.title===""&&(k.project.title="untitled"),await Lr(k),await Ye(),s()}catch(R){d("root",{message:V(R)})}},g=qe(n),b=qe(a);return e.jsx(qt,{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(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Project title",description:"Shown as the title in some views"}),e.jsx(M,{maxLength:150,placeholder:"Project title",fluid:!0,...o("project.title")})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Time format",description:"Default time format to show in views 12 / 24 hours (does not affect editor)",error:(w=(y=u.settings)==null?void 0:y.timeFormat)==null?void 0:w.message}),e.jsx(ie,{value:m("settings.timeFormat"),onValueChange:k=>{k!==null&&x("settings.timeFormat",k,{shouldDirty:!0})},defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Views language",description:"Language to be displayed in views",error:(A=(S=u.settings)==null?void 0:S.language)==null?void 0:A.message}),e.jsx(ie,{value:m("settings.language"),onValueChange:k=>{k!==null&&x("settings.language",k,{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(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(k,R)=>l(R),time:g,placeholder:at.warnTime})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(k,R)=>i(R),time:b,placeholder:at.dangerTime})]})]})]}),footerElements:e.jsxs(e.Fragment,{children:[(u==null?void 0:u.root)&&e.jsx(D,{children:u.root.message}),e.jsx(f,{variant:"ghosted",onClick:s,disabled:!1,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",form:"quick-start",disabled:!h,loading:c,children:"Create project"})]})})}const Fl="_current_13n43_17",$l="_isEditing_13n43_21",Vl="_form_13n43_25",Ml="_formInput_13n43_33",Wl="_saveButton_13n43_37",Ul="_containCell_13n43_41",Bl="_sortableHeader_13n43_45",zl="_innerColumn_13n43_55",Gl="_inlineLabels_13n43_63",Kl="_warningInfo_13n43_68",Hl="_empty_13n43_72",me={current:Fl,isEditing:$l,form:Vl,formInput:Ml,saveButton:Wl,containCell:Ul,sortableHeader:Bl,innerColumn:zl,inlineLabels:Gl,warningInfo:Kl,empty:Hl};function ql({onClose:t}){const[s,n]=p.useState(null),{handleSubmit:a,register:i,formState:{isSubmitting:l,isValid:r},setFocus:o}=de({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{o("title")},[o]);const u=async c=>{try{n(null);const h=c.title??"untitled";await Ir({filename:h}),t()}catch(h){n(V(h))}};return e.jsxs(ze,{as:"form",onSubmit:a(u),onKeyDown:c=>ke(c,t),children:[e.jsxs(Ce,{children:["Create new project",e.jsxs(L,{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(D,{children:s}),e.jsxs(E,{className:me.innerColumn,children:[e.jsx(ae,{children:"Project title"}),e.jsx(M,{fluid:!0,placeholder:"Your project name",...i("title")})]})]})}const Ql={files:[],lastLoadedProject:""};function Yl(){const{data:t,status:s,refetch:n}=Ft({queryKey:Jn,queryFn:({signal:a})=>Ar({signal:a}),placeholderData:(a,i)=>a,refetchInterval:Vs});return{data:t??Ql,status:s,refetch:n}}const Jl={"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 ln(t="modified-desc"){const s=Yl(),{files:n,lastLoadedProject:a}=s.data,i=p.useMemo(()=>{if(!n.length)return[];const l=[...n].sort(Jl[t]),r=l.findIndex(o=>o.filename===a);if(r>0){const[o]=l.splice(r,1);l.unshift(o)}return l},[n,a,t]);return{...s,data:{reorderedProjectFiles:i,lastLoadedProject:s.data.lastLoadedProject}}}function Xl({action:t,filename:s,onSubmit:n,onCancel:a}){const{handleSubmit:i,register:l,formState:{isSubmitting:r,isDirty:o,isValid:u},setFocus:c}=de({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return p.useEffect(()=>{c("filename")},[c]),e.jsxs("form",{onSubmit:i(n),onKeyDown:h=>ke(h,a),className:me.form,children:[e.jsx(M,{className:me.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{onClick:a,variant:"ghosted",disabled:r,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!o||!u||r,type:"submit",className:me.saveButton,children:t})]})]})}async function Zl(t,s){const n={};for(const a in s)Ha(a,t)&&s[a]&&(a==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[a]:t[a]}));return n}function eo({onClose:t,fileName:s}){const[n,a]=p.useState(null),i=$t(),{handleSubmit:l,watch:r,setValue:o,formState:{isSubmitting:u,isValid:c,isDirty:h}}=de({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),m=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 en(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 g=await Zl(j,d);await sn(g),await i.invalidateQueries({queryKey:Xn}),t()}catch(j){a(V(j))}};return e.jsxs(E,{as:"form",onSubmit:l(m),children:[e.jsxs(Ce,{children:["Partial project merge",e.jsxs(L,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:u,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:!c||!h,loading:u,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(D,{children:n}),e.jsxs(E,{className:Se([me.innerColumn,me.inlineLabels]),children:[e.jsxs(ae,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(xe,{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(De,{size:"large",checked:r("project"),onCheckedChange:d=>o("project",d,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("rundowns"),onCheckedChange:d=>o("rundowns",d,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("viewSettings"),onCheckedChange:d=>o("viewSettings",d,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("urlPresets"),onCheckedChange:d=>o("urlPresets",d,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("automation"),onCheckedChange:d=>o("automation",d,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function to({current:t,updatedAt:s,editingFilename:n,editingMode:a,filename:i,onRefetch:l,onSubmit:r,onToggleEditMode:o}){const[u,c]=p.useState(null),[h,m]=p.useState(!1),d=k=>async R=>{m(!0),c(null);try{if(!R.filename){c("Filename cannot be blank");return}await(k==="rename"?$r:Fr)(i,R.filename),await l(),r()}catch(W){c(V(W))}finally{m(!1)}},x=async k=>{m(!0),c(null);try{await nn(k),await l(),await Ye()}catch(R){c(V(R))}finally{m(!1)}},j=async k=>{m(!0),c(null);try{await Vr(k),await l()}catch(R){c(V(R))}finally{m(!1)}},g=(k,R)=>{c(null),o(k,R)},b=()=>{g(null,null)},y=i===n,w=(a==="rename"||a==="duplicate")&&i===n,S=a==="merge"&&y,A=Se([t&&!y&&me.current,y&&me.isEditing]);return e.jsxs(e.Fragment,{children:[u&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(D,{children:u})})},"filename-error"),e.jsx("tr",{className:A,children:w?e.jsx("td",{colSpan:99,children:e.jsx(Xl,{action:a,filename:i,onSubmit:d(a==="duplicate"?"duplicate":"rename"),onCancel:b})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:me.containCell,children:i}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(so,{current:t,filename:i,onChangeEditMode:g,onDelete:j,onLoad:x,isDisabled:h||S,onMerge:k=>g("merge",k)})})]})},i),S&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(eo,{onClose:b,fileName:i})})})]})}function so(t){const{current:s,filename:n,isDisabled:a,onChangeEditMode:i,onDelete:l,onLoad:r,onMerge:o}=t,u=()=>{i("rename",n)},c=()=>{i("duplicate",n)},h=async()=>{await Er(n)};return e.jsx(Ht,{render:e.jsx(Y,{variant:"ghosted-white"}),disabled:a,items:[{type:"item",icon:rt,label:"Load",onClick:()=>r(n),disabled:s},{type:"item",icon:rt,label:"Partial Load",onClick:()=>o(n),disabled:s},{type:"item",icon:Ds,label:"Rename",onClick:u},{type:"item",icon:fn,label:"Duplicate",onClick:c},{type:"item",icon:Ps,label:"Download",onClick:h},{type:"divider"},{type:"item",icon:pe,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(Rs,{})})}function no(){const[t,s]=p.useState(null),[n,a]=p.useState(null),[i,l]=p.useState("modified-desc"),{data:r,refetch:o,status:u}=ln(i),c=(j,g)=>{s(b=>b===j&&g===n?null:j),a(g)},h=()=>{s(null),a(null)},m=async()=>{await o()},d=j=>{l(g=>{const b=g===`${j}-asc`;return`${j}-${b?"desc":"asc"}`})};if(u==="pending")return e.jsx("div",{className:me.empty,children:e.jsx(Be,{isLoading:!0})});const x=r.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[x>20&&e.jsxs(xe,{className:me.warningInfo,type:"warning",children:["You have ",x," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(_e,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:me.containCell,onClick:()=>d("alphabetical"),children:e.jsxs("span",{className:me.sortableHeader,children:["File Name",e.jsx(Ss,{sortMode:i,type:"alphabetical"})]})}),e.jsx("th",{onClick:()=>d("modified"),children:e.jsxs("span",{className:me.sortableHeader,children:["Last Used",e.jsx(Ss,{sortMode:i,type:"modified"})]})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.reorderedProjectFiles.map(j=>e.jsx(to,{filename:j.filename,updatedAt:j.updatedAt,onToggleEditMode:c,onSubmit:h,onRefetch:m,editingFilename:n,editingMode:t,current:j.filename===r.lastLoadedProject},j.filename))})]})]})}function Ss({sortMode:t,type:s}){const n=`${s}-`;return t===`${n}asc`?e.jsx(Es,{}):t===`${n}desc`?e.jsx(ft,{}):null}function ao(){const[t,s]=bn(),[n,a]=p.useState(""),[i,l]=p.useState(null),r=p.useRef(null),o=t.get("new")==="true",u=()=>{t.set("new",o?"false":"true"),s(t)},c=()=>{var d;(d=r.current)==null||d.click()},h=async d=>{var j,g;const x=(g=(j=d.target)==null?void 0:j.files)==null?void 0:g[0];if(x){l("import");try{Zs(x),await tn(x)}catch(b){const y=V(b);a(`Error uploading file: ${y}`)}finally{await Ye()}l(null)}},m=()=>{t.delete("new"),s(t)};return e.jsxs(E,{children:[e.jsx("input",{ref:r,style:{display:"none"},type:"file",onChange:h,accept:".json","data-testid":"file-input"}),e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage projects",e.jsxs(L,{children:[e.jsx(f,{onClick:c,disabled:!!i||o,loading:i==="import",children:"Import"}),e.jsxs(f,{onClick:u,disabled:!!i||o,children:["New ",e.jsx(ge,{})]})]})]}),n&&e.jsx(D,{children:n}),e.jsx(le,{}),o&&e.jsx(ql,{onClose:m}),e.jsx(no,{})]})]})}function io({location:t,setLocation:s}){const n=re("list",t),a=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Project"}),e.jsx(Ol,{isOpen:t==="create",onClose:a}),e.jsx("div",{ref:n,children:e.jsx(ao,{})})]})}const ro="_container_cq029_17",lo={container:ro};function Cs({register:t,formName:s,disabled:n}){const[a,i]=p.useState(!1);return e.jsxs("div",{className:lo.container,children:[e.jsx(M,{type:a?"text":"password",maxLength:4,...t(s,{pattern:{value:Ia,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(Y,{onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(yn,{})})]})}const oo=p.lazy(()=>lt(()=>import("./CustomTranslationModal-4PVZBtkC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url));function co(){var k,R,W,v,O;const{data:t,status:s,refetch:n}=Zn(),{handleSubmit:a,register:i,reset:l,setError:r,watch:o,setValue:u,formState:{isSubmitting:c,isDirty:h,isValid:m,errors:d}}=de({mode:"onChange",defaultValues:t,resetOptions:{keepDirtyValues:!0}}),[x,j]=Ee();p.useEffect(()=>{t&&l(t)},[t,l]);const g=async C=>{try{await ea(C)}catch(q){const B=V(q);r("root",{message:B})}finally{await n()}},b=s==="pending",y=c||!h||!m,w="",S=()=>{l(t)},A=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(oo,{isOpen:x,onClose:j.close}),e.jsx(E,{as:"form",onSubmit:a(g),onKeyDown:C=>ke(C,S),id:"app-settings",children:e.jsxs(ne,{children:[e.jsxs(J,{children:["General settings",e.jsxs(L,{children:[e.jsx(f,{disabled:!h||c,variant:"ghosted",onClick:S,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:c,disabled:y,variant:"primary",children:"Save"})]})]}),w,e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(xe,{children:"Changes to the time format and views language do not affect the editor view"}),e.jsx(Be,{isLoading:A}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Ontime server port",description:Qe?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(k=d.serverPort)==null?void 0:k.message}),e.jsx(M,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Qe,...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:Ws,message:"Value should be numeric"}})})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(R=d.editorKey)==null?void 0:R.message}),e.jsx(Cs,{register:i,formName:"editorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(W=d.operatorKey)==null?void 0:W.message}),e.jsx(Cs,{register:i,formName:"operatorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Time format",description:"Default time format to show in views 12 / 24 hours",error:(v=d.timeFormat)==null?void 0:v.message}),e.jsx(ie,{value:o("timeFormat"),onValueChange:C=>{C!==null&&u("timeFormat",C,{shouldDirty:!0})},defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Views language",description:"Language to be displayed in views",error:(O=d.language)==null?void 0:O.message}),e.jsx(ie,{value:o("language"),onValueChange:C=>{C!==null&&u("language",C,{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 uo="_uploadLogoCard_m5263_17",ho="_customDataItem_m5263_32",mo="_titleRow_m5263_39",xo="_customImage_m5263_48",jo="_imageContainer_m5263_54",Ke={uploadLogoCard:uo,customDataItem:ho,titleRow:mo,customImage:xo,imageContainer:jo};function po(){var B;const{data:t,status:s}=ni(),{updateProjectData:n}=ai(),{handleSubmit:a,register:i,reset:l,formState:{isSubmitting:r,isValid:o,isDirty:u,errors:c},setError:h,clearErrors:m,watch:d,control:x,setValue:j}=de({defaultValues:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:g,append:b,remove:y}=mt({control:x,name:"custom"});p.useEffect(()=>{t&&l(t)},[t,l]);const w=async F=>{var I;const P=(I=F.target.files)==null?void 0:I[0];if(m("logo"),!!P)try{Rr(P);const N=await ii(P);j("logo",N.data.logoFilename,{shouldDirty:!0})}catch(N){const K=V(N);h("logo",{message:K})}},{ref:S,...A}=i("logo"),k=p.useRef(null),R=()=>{var F;(F=k.current)==null||F.click()},W=F=>{F.preventDefault(),F.stopPropagation(),j("logo",null,{shouldDirty:!0})},v=()=>{b({title:"",value:"",url:""})},O=async F=>{try{m(),await n(F)}catch(P){const I=V(P);h("root",{message:I})}},C=()=>{l(t)},q=s==="pending";return e.jsx(E,{as:"form",onSubmit:a(O),onKeyDown:F=>ke(F,C),children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Project data",e.jsxs(L,{children:[e.jsx(f,{onClick:C,disabled:r||!u,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!u||!o,loading:r,children:"Save"})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:q}),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(E,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...A,ref:F=>{S(F),k.current=F},onChange:w}),e.jsxs(ne,{className:Ke.uploadLogoCard,children:[d("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${ta}/${d("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:r||!d("logo"),onClick:W,children:[e.jsx(pe,{}),"Delete"]})]}):e.jsxs(f,{disabled:r,onClick:R,type:"button",children:[e.jsx(rt,{}),"Upload logo"]}),((B=c==null?void 0:c.logo)==null?void 0:B.message)&&e.jsx(D,{children:c.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(It,{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:Wt,...i("url")})]}),e.jsxs(E,{style:{marginTop:0},children:[e.jsxs(U,{children:[e.jsx(G,{title:"Custom data",description:""}),e.jsxs(f,{onClick:v,children:["Add ",e.jsx(ge,{})]})]}),g.length>0&&g.map((F,P)=>{var N,K,$;const I=(N=c.custom)==null?void 0:N[P];return e.jsxs("div",{className:Ke.customDataItem,children:[e.jsxs("div",{className:Ke.titleRow,children:[e.jsxs("label",{className:Ke.title,children:["Title",e.jsx(M,{fluid:!0,defaultValue:F.title,placeholder:"Title of your custom data",...i(`custom.${P}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>y(P),children:[e.jsx(pe,{}),"Delete"]})]}),((K=I==null?void 0:I.title)==null?void 0:K.message)&&e.jsx(D,{children:I.title.message}),e.jsxs("label",{children:["Text",e.jsx(It,{fluid:!0,rows:3,resize:"vertical",defaultValue:F.value,placeholder:"Text of your custom data",...i(`custom.${P}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),(($=I==null?void 0:I.value)==null?void 0:$.message)&&e.jsx(D,{children:I.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Ke.customImage,children:[e.jsx(M,{fluid:!0,defaultValue:F.url,placeholder:"Paste image URL (optional)",...i(`custom.${P}.url`)}),e.jsx("div",{className:Ke.imageContainer,children:d(`custom.${P}.url`)&&e.jsx("img",{src:d(`custom.${P}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},F.id)})]})]})]})})}const go="_editorActions_18rtd_17",fo="_right_18rtd_21",bo="_column_18rtd_26",Nt={editorActions:go,right:fo,column:bo},yo=p.lazy(()=>lt(()=>import("./StyleEditor-ClMEMaWh.js"),__vite__mapDeps([13,1,2,14]),import.meta.url));function vo({isOpen:t,onClose:s}){const[n,a]=p.useState(""),[i,l]=p.useState(!1),[r,o]=p.useState(!1),[u,c]=p.useState(!1),[h,m]=p.useState(null),d=p.useRef(null),x=async()=>{try{c(!0);const b=await sa();a(b)}catch{}finally{c(!1)}},j=async()=>{try{o(!0),d.current&&(await na(d.current.getCss()),a(d.current.getCss()),l(!1))}catch{}finally{o(!1)}},g=()=>a("");return p.useEffect(()=>{async function b(){if(t)try{const y=await aa();a(y)}catch{m("Failed to load CSS from server")}}b()},[t]),e.jsx(qt,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(p.Suspense,{fallback:null,children:e.jsx(yo,{ref:d,initialValue:n,language:"css",isDirty:i,setIsDirty:l})}),footerElements:e.jsxs("div",{className:Nt.column,children:[e.jsx(xe,{children:"Invalid CSS will be refused by the browser"}),h&&e.jsx(D,{className:Nt.right,children:`Error: ${h}`}),e.jsxs(L,{align:"apart",className:Nt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:x,disabled:r||u,children:"Reset to example"}),e.jsxs(L,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:g,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:j,disabled:r||u||!i,loading:r,children:"Save changes"})]})]})]})})}const wo="https://docs.getontime.no/features/custom-styling/";function So(){var b;const{data:t,status:s,mutateAsync:n}=ia(),[a,i]=Ee(),{control:l,handleSubmit:r,setError:o,reset:u,setValue:c,watch:h,formState:{isSubmitting:m,isDirty:d,errors:x}}=de({defaultValues:t,resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{t&&u(t)},[t,u]);const j=async y=>{try{n(y)}catch(w){const S=V(w);o("root",{message:S})}},g=()=>{u(t)};return l?e.jsx(E,{as:"form",onSubmit:r(j),onKeyDown:y=>ke(y,g),id:"view-settings",children:e.jsxs(ne,{children:[e.jsxs(J,{children:["View settings",e.jsxs(L,{children:[e.jsx(f,{disabled:!d,variant:"ghosted",onClick:g,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:m,disabled:!d,variant:"primary",children:"Save"})]})]}),e.jsx(le,{}),e.jsxs(xe,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(se,{href:wo,children:"See the docs"})]}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:s==="pending"}),e.jsx(D,{children:(b=x.root)==null?void 0:b.message}),e.jsxs(ce,{children:[e.jsx(vo,{isOpen:a,onClose:i.close}),e.jsxs(U,{children:[e.jsx(G,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(De,{size:"large",checked:h("overrideStyles"),onCheckedChange:y=>c("overrideStyles",y,{shouldDirty:!0})}),e.jsx(f,{onClick:i.open,disabled:m,children:"Edit CSS override"})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(_t,{name:"normalColor",control:l})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(_t,{name:"warningColor",control:l})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(_t,{name:"dangerColor",control:l})]})]})]})]})}):null}function Co({location:t}){const s=re("data",t),n=re("general",t),a=re("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(po,{})}),e.jsx("div",{ref:n,children:e.jsx(co,{})}),e.jsx("div",{ref:a,children:e.jsx(So,{})})]})}function _o(){const{isElectron:t,sendToElectron:s}=ra(),[n,a]=Ee(),i=p.useRef(null),l=()=>{s("shutdown","now"),a.close()},r=t||xt;return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Shutdown Ontime"}),e.jsxs(E,{children:[Qe?e.jsx(la,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(Ie,{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||xt),children:"Shutdown ontime"}),!r&&e.jsx(ae,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(jt,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:a.close,bodyElements:e.jsxs(Ie,{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 ko="_corner_1dxip_17",To="_contentWrapper_1dxip_24",No="_content_1dxip_24",Dt={corner:ko,contentWrapper:To,content:No};function Do({onClose:t,children:s}){return e.jsxs("div",{className:Dt.contentWrapper,children:[e.jsx("div",{className:Dt.content,children:s}),e.jsx("div",{className:Dt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(Vt,{})]})})]})}const Po=[{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 Ro(){const{data:t}=Ys();return{options:p.useMemo(()=>Po.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Eo="_tabs_86c70_17",Io="_primary_86c70_31",Lo="_secondary_86c70_32",Ao="_active_86c70_54",Oo="_highlight_86c70_58",Fo="_split_86c70_68",We={tabs:Eo,primary:Io,secondary:Lo,active:Ao,highlight:Oo,split:Fo};function $o({selectedPanel:t,location:s}){const{options:n}=Ro();return e.jsx("ul",{className:We.tabs,children:n.map(a=>{const i=t===a.id;return a.highlight?e.jsx(Jt,{text:a.highlight,render:e.jsx("span",{}),children:e.jsx(_s,{panel:a,location:s,isSelected:i})},a.id):e.jsx(_s,{panel:a,location:s,isSelected:i},a.id)})})}function _s(t){var r;const{panel:s,isSelected:n,location:a}=t,{setLocation:i}=Xt(),l=Se([We.primary,n&&We.active,s.split&&We.split,s.highlight&&We.highlight]);return e.jsxs(p.Fragment,{children:[e.jsx("li",{onClick:()=>i(s.id),onKeyDown:o=>{ds(o)&&i(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(r=s.secondary)==null?void 0:r.map((o,u)=>{const c=o.id.split("__")[1],h=Se([We.secondary,n&&a===c?We.active:null]);return e.jsx("li",{onClick:()=>i(o.id),onKeyDown:m=>{ds(m)&&i(o.id)},className:h,role:"button",children:o.label},o.id+u)})]},s.id)}const Vo="_container_1fy3l_17",Mo={container:Vo};function Wo(){const{close:t,panel:s,location:n,setLocation:a}=Xt();return ji(t,"Escape"),e.jsx("div",{className:Mo.container,children:e.jsxs(vn,{children:[e.jsx($o,{selectedPanel:s,location:n}),e.jsxs(Do,{onClose:t,children:[s==="settings"&&e.jsx(Co,{location:n}),s==="project"&&e.jsx(io,{location:n,setLocation:a}),s==="manage"&&e.jsx(vl,{location:n}),s==="automation"&&e.jsx(Zi,{location:n}),s==="sharing"&&e.jsx(br,{location:n}),s==="network"&&e.jsx(Al,{location:n}),s==="about"&&e.jsx(yi,{}),s==="shutdown"&&e.jsx(_o,{})]})]})})}const Uo=p.memo(Bo);function Bo({children:t}){const{layoutMode:s}=Zt();return e.jsxs(ci,{navElements:t,children:[s===we.PLANNING&&e.jsx(zo,{}),s===we.TRACKING&&e.jsx(Go,{}),s===we.CONTROL&&e.jsx(Ko,{})]})}function zo(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ts.inline,children:[e.jsx(Qs,{}),e.jsx(li,{}),e.jsx(oi,{})]}),e.jsx(es,{})]})}function Go(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ts.inline,children:[e.jsx(Gs,{}),e.jsx(Ks,{}),e.jsx(Hs,{})]}),e.jsx(qs,{}),e.jsx(es,{})]})}function Ko(){return e.jsxs(e.Fragment,{children:[e.jsx(Qs,{}),e.jsxs("div",{className:ts.inline,children:[e.jsx(Gs,{}),e.jsx(Ks,{}),e.jsx(Hs,{})]}),e.jsx(qs,{}),e.jsx(es,{})]})}function Ho({onFinish:t}){const s=p.useRef(null),n=()=>{var i;(i=s.current)==null||i.click()},a=async i=>{var r,o;const l=(o=(r=i.target)==null?void 0:r.files)==null?void 0:o[0];if(l)try{Zs(l),await tn(l)}catch{}finally{await Ye(),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 qo="_sections_ar7bf_17",Qo="_column_ar7bf_23",Yo="_about_ar7bf_23",Jo="_inline_ar7bf_35",Xo="_header_ar7bf_41",Zo="_logo_ar7bf_48",ec="_buttonRow_ar7bf_53",tc="_tableContainer_ar7bf_62",sc="_table_ar7bf_62",nc="_current_ar7bf_75",ve={sections:qo,column:Qo,about:Yo,inline:Jo,header:Xo,logo:Zo,buttonRow:ec,tableContainer:tc,table:sc,current:nc};function ac(t){const{loadProject:s,onClose:n}=t,{data:a}=ln();return e.jsx("tbody",{children:a.reorderedProjectFiles.map(i=>i.filename===a.lastLoadedProject?e.jsxs("tr",{className:ve.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 ic({onClose:t}){const s=wn(),n=async l=>{try{await nn(l),await Ye(),t()}catch{}},a=async()=>{try{await Or(),await Ye(),t()}catch{}},i=()=>{s("/editor?settings=project__create"),t()};return e.jsx(qt,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:ve.sections,children:[e.jsxs("div",{className:ve.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:ve.logo}),e.jsxs("div",{children:["Ontime v",ht]}),e.jsx(se,{href:Rt,children:"Website"}),e.jsx(se,{href:Wt,children:"Read the docs"}),e.jsx(se,{href:Ls,children:"Discord server"})]}),e.jsxs("div",{className:ve.column,children:[e.jsxs("div",{className:ve.header,children:["Welcome to Ontime",e.jsx(Y,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(Vt,{})})]}),e.jsx(si,{children:"Select project"}),e.jsx("div",{className:ve.tableContainer,children:e.jsxs("table",{className:ve.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(ac,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:ve.column,children:[e.jsxs("div",{className:ve.buttonRow,children:[e.jsx(f,{onClick:a,children:"Load demo project"}),e.jsx(Ho,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:i,children:"Create new..."})]}),e.jsxs(ti,{className:ve.inline,children:[e.jsx(Aa,{defaultChecked:!0,onCheckedChange:l=>oa(l)}),"Show this modal on next startup"]})]})})}function rc(){const t=us(n=>n.showDialog),s=us(n=>n.clearDialog);return t?e.jsx(ic,{onClose:s}):null}const lc="_container_12ac0_17",oc="_itemGroup_12ac0_27",cc="_goButton_12ac0_34",dc="_iconButtonWithLabel_12ac0_35",uc="_iconButton_12ac0_35",hc="_goLabel_12ac0_55",mc="_shortcutHint_12ac0_61",xc="_addSection_12ac0_66",jc="_separator_12ac0_70",pc="_timerSection_12ac0_77",gc="_negativeIndicator_12ac0_84",fc="_auxSection_12ac0_95",bc="_auxTimeInput_12ac0_108",yc="_auxTimeDisplay_12ac0_109",Q={container:lc,itemGroup:oc,goButton:cc,iconButtonWithLabel:dc,iconButton:uc,goLabel:hc,shortcutHint:mc,addSection:xc,separator:jc,timerSection:pc,negativeIndicator:gc,auxSection:fc,auxTimeInput:bc,auxTimeDisplay:yc};function vc(){const t=ca(),{playback:s,numEvents:n,selectedEventIndex:a}=da(),{playback:i,direction:l}=ua(1),r=ha(1),[o]=Sn({key:"add-time",defaultValue:3e5}),{disableGo:u,disableNext:c,disableAddTime:h,isPlaying:m,goAction:d,goLabel:x}=ui({playback:s,numEvents:n,selectedEventIndex:a,timerPhase:t.phase}),j=h||o===0,g=v=>{j||(v==="add"?Ge.addTime(o):Ge.addTime(-1*o))},b=()=>{i===et.Start?tt.pause(1):tt.start(1)},y=()=>{tt.stop(1)},w=()=>{const v=l===ct.CountDown?ct.CountUp:ct.CountDown;tt.setDirection(1,v)},S=(v,O)=>{const C=qe(O);tt.setDuration(1,C)};Is([["Space",()=>!u&&d(),{preventDefault:!0}],["N",()=>!c&&Ge.next(),{preventDefault:!0}],["Escape",()=>s!==Ze.Stop&&Ge.stop(),{preventDefault:!0}]]);const A=t.phase===hs.Pending,k=t.phase===hs.Overtime,R=A?t.secondaryTimer:t.current,W=Kt(o);return e.jsxs("div",{className:Q.container,children:[e.jsxs("div",{className:Q.itemGroup,children:[e.jsxs(Ae,{onClick:d,disabled:u,theme:Ze.Play,active:m,className:Q.goButton,children:[e.jsx("span",{className:Q.goLabel,children:x}),e.jsx("span",{className:Q.shortcutHint,children:"[space]"})]}),e.jsxs(Ae,{onClick:Ge.next,disabled:c,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(Cn,{}),e.jsx("span",{className:Q.shortcutHint,children:"[n]"})]}),e.jsxs(Ae,{onClick:Ge.stop,disabled:s===Ze.Stop,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(ls,{}),e.jsx("span",{className:Q.shortcutHint,children:"[esc]"})]}),e.jsxs("div",{className:Q.addSection,children:[e.jsx("div",{className:Q.separator}),e.jsxs(Ae,{onClick:()=>g("remove"),disabled:j,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(_n,{}),W]}),e.jsxs(Ae,{onClick:()=>g("add"),disabled:j,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(ge,{}),W]})]})]}),e.jsxs("div",{className:Q.timerSection,children:[e.jsx("span",{className:Q.negativeIndicator,"data-active":k,children:Et}),e.jsx(hi,{time:R,phase:t.phase})]}),e.jsxs("div",{className:Q.auxSection,children:[e.jsx(Ae,{onClick:b,className:Q.iconButton,theme:Ze.Play,aspect:"square",children:i===et.Start?e.jsx(kn,{}):e.jsx(Tn,{})}),e.jsx(Ae,{onClick:y,disabled:i===et.Stop,className:Q.iconButton,theme:Ze.Stop,aspect:"square",children:e.jsx(ls,{})}),i!==et.Stop?e.jsx("div",{className:Q.auxTimeDisplay,children:Fe(r)}):e.jsx(He,{name:"aux1-tracking",submitHandler:S,time:r,className:Q.auxTimeInput}),e.jsx(Ae,{onClick:w,disabled:i!==et.Stop,className:Q.iconButton,aspect:"square",children:l===ct.CountDown?e.jsx(Es,{}):e.jsx(ft,{})})]})]})}const ks=5;function wc(t){const s=t.findIndex(i=>i.isLoaded),n=s!==-1?t[s]:null,a=(n==null?void 0:n.eventIndex)??0;return{index:s,id:(n==null?void 0:n.id)??null,eventIndex:a,upcomingChipLimit:a>0?a+ks:ks}}const Sc="_container_qfgjn_17",Cc="_emptyState_qfgjn_22",_c="_emptyMessage_qfgjn_30",kc="_emptyTitle_qfgjn_36",Tc="_emptyBody_qfgjn_43",nt={container:Sc,emptyState:Cc,emptyMessage:_c,emptyTitle:kc,emptyBody:Tc};function Nc(){return e.jsx("div",{className:nt.container,children:e.jsx("div",{className:nt.emptyState,children:e.jsxs("div",{className:nt.emptyMessage,children:[e.jsx("h3",{className:nt.emptyTitle,children:"No events yet"}),e.jsx("p",{className:nt.emptyBody,children:"Add events in the rundown to populate this list."})]})})})}const Dc="_item_1nasm_17",Pc="_title_1nasm_36",Rc="_colourBar_1nasm_76",Ec="_chipSlot_1nasm_100",Ic="_chipText_1nasm_121",it={item:Dc,title:Pc,colourBar:Rc,chipSlot:Ec,chipText:Ic},Lc=p.memo(Ac);function Ac({entry:t,currentEventIndex:s,upcomingChipLimit:n,isRunning:a,mode:i,isGroupEnd:l,onSelect:r}){const o=p.useCallback(()=>{r({id:t.id,index:t.eventIndex-1,parent:t.parent??void 0})},[r,t.id,t.eventIndex,t.parent]),u=s>0&&t.eventIndex>s&&t.eventIndex<=s+2,c=i===Ue.Run&&t.isPast,h=t.isLoaded?i===Ue.Run?"running":"selected":c?"past":u?"next":"default",m=a&&!t.isLoaded&&!t.isPast&&!t.skip,d=m&&t.eventIndex<=n;return e.jsxs("li",{"data-state":h,"data-skipped":t.skip||void 0,"data-group-end":l||void 0,className:it.item,onClick:o,children:[e.jsx("div",{className:it.colourBar,style:{backgroundColor:t.groupColour||"transparent"}}),e.jsx("span",{className:it.title,children:t.title||"Untitled"}),m&&e.jsx(Oc,{timeStart:t.timeStart,delay:t.delay,dayOffset:t.dayOffset,totalGap:t.totalGap,isLinkedToLoaded:t.isLinkedToLoaded,isLoaded:t.isLoaded,showOnHover:!d})]})}const Oc=p.memo(Fc);function Fc({timeStart:t,delay:s,dayOffset:n,totalGap:a,isLinkedToLoaded:i,isLoaded:l,showOnHover:r}){const o=ma({timeStart:t,delay:s,dayOffset:n},{totalGap:a,isLinkedToLoaded:i}),u=!l&&o<ja;let c="LIVE";l||(c=u?"DUE":Kt(Math.abs(o),o>2*xa));const h=l?"live":u?"due":"pending";return e.jsx(Jt,{text:"Expected time until start",className:it.chipSlot,"data-hover-only":r||void 0,children:e.jsx("span",{"data-chip-status":h,className:it.chipText,children:c})})}const $c="_container_kcrvg_17",Vc="_list_kcrvg_24",Mc="_bottomSpacer_kcrvg_30",ns={container:$c,list:Vc,bottomSpacer:Mc};function Ts({mode:t}){const{data:s}=Yt(),n=pa(),a=La(r=>r.cursor),i=p.useMemo(()=>t===Ue.Run?n:a,[t,n,a]),l=p.useMemo(()=>qa(s,i).filter(Qt),[s,i]);return l.length===0?e.jsx(Nc,{}):e.jsx(Wc,{mode:t,eventData:l,selectedEventId:n,resolvedFollowEventId:i,rundownId:s.id})}function Wc({mode:t,eventData:s,selectedEventId:n,resolvedFollowEventId:a,rundownId:i}){"use memo";const l=p.useRef(null),r=p.useRef(null),o=ri(i),u=p.useMemo(()=>wc(s),[s]),c=p.useMemo(()=>a?s.findIndex(d=>d.id===a):-1,[s,a]),h=p.useCallback(d=>{o(d)},[o]);p.useEffect(()=>{if(!l.current)return;const d=c!==-1?c:u.index;d!==-1&&(t===Ue.Edit&&d<=3||l.current.scrollToIndex({index:d,align:"start",behavior:"smooth",offset:-50}))},[u.index,c,t]);const m=p.useCallback((d,x)=>{const j=s[d+1],g=!!x.parent&&x.parent!==((j==null?void 0:j.parent)??null);return e.jsx(Lc,{entry:x,currentEventIndex:u.eventIndex,upcomingChipLimit:u.upcomingChipLimit,isRunning:t===Ue.Run&&n!==null,mode:t,onSelect:h,isGroupEnd:g},x.id)},[s,u.eventIndex,u.upcomingChipLimit,t,n,h]);return e.jsx(di,{className:ns.container,ref:r,children:e.jsx(Nn,{ref:l,data:s,computeItemKey:(d,x)=>x.id,itemContent:m,increaseViewportBy:{top:200,bottom:200},customScrollParent:r.current??void 0,components:{List:on,Footer:Uc}})})}function on({children:t,...s}){return e.jsx("ul",{...s,className:ns.list,children:t})}on.displayName="VirtuosoListComponent";function Uc(){return e.jsx("div",{className:ns.bottomSpacer})}const Bc="_panelContainer_1exbp_17",zc="_panelContainerTracking_1exbp_26",Gc="_left_1exbp_31",Kc="_rundownLayout_1exbp_40",Hc="_rundownPanel_1exbp_48",qc="_titlesPanel_1exbp_55",be={panelContainer:Bc,panelContainerTracking:zc,left:Gc,rundownLayout:Kc,rundownPanel:Hc,titlesPanel:qc},Pt=p.lazy(()=>lt(()=>import("./RundownExport-C_q3KYN_.js"),__vite__mapDeps([15,1,2,16,3,4,17,18,19,20,7,5,6,8,9,10,11,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url)),Qc=p.lazy(()=>lt(()=>import("./TimerControlExport-BJfhJc07.js"),__vite__mapDeps([41,1,2,16,3,4,17,18,19,21,22,23,42,43,25,26,37,44]),import.meta.url)),Yc=p.lazy(()=>lt(()=>import("./MessageControlExport-Dm8IjSr4.js"),__vite__mapDeps([45,1,2,16,3,4,17,18,19,8,9,25,26,46]),import.meta.url));function Jc(){const{layoutMode:t}=Zt();return t===we.CONTROL?e.jsxs("div",{id:"panels",className:be.panelContainer,children:[e.jsxs("div",{className:be.left,children:[e.jsx(Qc,{}),e.jsx(Yc,{})]}),e.jsx(Pt,{})]}):t===we.TRACKING?e.jsxs("div",{id:"panels",className:`${be.panelContainer} ${be.panelContainerTracking}`,children:[e.jsxs("div",{className:be.rundownLayout,children:[e.jsx("div",{className:be.titlesPanel,children:e.jsx(Ts,{mode:Ue.Run})}),e.jsx("div",{className:be.rundownPanel,children:e.jsx(Pt,{})})]}),e.jsx(vc,{})]}):e.jsx("div",{id:"panels",className:be.panelContainer,children:e.jsxs("div",{className:be.rundownLayout,children:[e.jsx("div",{className:be.titlesPanel,children:e.jsx(Ts,{mode:Ue.Edit})}),e.jsx("div",{className:be.rundownPanel,children:e.jsx(Pt,{})})]})})}const Xc=p.memo(Zc);function Zc(){const{layoutMode:t,setLayoutMode:s}=Zt(),n=p.useMemo(()=>[{type:"item",label:"Planning",description:"Edit-focused list with planning stats",icon:t===we.PLANNING?ut:void 0,onClick:()=>s(we.PLANNING)},{type:"item",label:"Tracking",description:"Live timing view with progress and offsets",icon:t===we.TRACKING?ut:void 0,onClick:()=>s(we.TRACKING)},{type:"item",label:"Control",description:"All controls and rundown together",icon:t===we.CONTROL?ut:void 0,onClick:()=>s(we.CONTROL)}],[t,s]);return e.jsx(Ht,{render:e.jsx(Y,{"aria-label":"Layout mode",variant:"subtle-white",size:"xlarge"}),items:n,children:e.jsx(Dn,{})})}const ed="_mainContainer_1m0yz_17",td={mainContainer:ed};function Td(){const{isOpen:t,setLocation:s,close:n}=Xt(),[a,i]=Ee();ya("Editor"),ga(),p.useEffect(()=>{var r;((r=window.process)==null?void 0:r.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=p.useCallback(()=>{t?n():s("settings")},[n,t,s]);return Is([["mod + ,",l]]),e.jsx(ba,{permission:"editor",children:e.jsxs("div",{className:td.mainContainer,"data-testid":"event-editor",children:[e.jsx(rc,{}),e.jsx(fa,{isOpen:a,onClose:i.close}),t?e.jsx(Wo,{}):e.jsx(Jc,{}),e.jsxs(Uo,{children:[e.jsx(Y,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:i.open,children:e.jsx(Pn,{})}),e.jsx(Y,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(Vt,{}):e.jsx(Rn,{})}),e.jsx(Xc,{})]})]})})}export{Td as default};
3
- //# sourceMappingURL=ProtectedEditor-BvTFmv-F.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-CML7Vsot.js","./vendor-BKUJ0_Du.js","./vendor-4xP-6xVS.css","./index-Dm-4OTmY.js","./index-Cm69j2Ld.css","./SwatchPicker-Ckpchvjo.js","./SwatchPicker-DxatRu17.css","./useEventSelection-Bpbu89c7.js","./Select-BnGTAeXJ.js","./Select-Cd08aEcf.css","./useCustomFields-BBE4LBBr.js","./useRundown-DAo6huE4.js","./useEventSelection-D_Et8xSN.css","./StyleEditor-DIHQ1PUV.js","./StyleEditor-Bie84LSc.css","./RundownExport-25orDQIW.js","./EditorUtils-BLcTuWz1.js","./EditorUtils-L4Sg72o_.css","./ProtectRoute-Bxq6q7ba.js","./ProtectRoute-Bm5sjStK.css","./CuesheetTable-B5LQVh5m.js","./TimeInput-Cwl9vLWA.js","./parseUserTime-sZbEBi61.js","./TimeInput-Cu-N5DmX.css","./validateEvent-GnPt-e9-.js","./Tooltip-DZJ7u9gm.js","./Tooltip-CKb7gU2M.css","./DelayIndicator-DKS6mZdB.js","./editorSettings-_x6YKRfR.js","./editorSettings-BqHbWs9b.css","./rundownUtils-CXZRD6yP.js","./DelayIndicator-VuYhhwTj.css","./offset-VthsmtrO.js","./EmptyPage-CYVrjOvI.js","./EmptyPage-Ci10HwDK.css","./CuesheetTable-BJ30G538.css","./useSelectAndRevealEntry-DTg0hmxA.js","./useReport-DqSBq4MG.js","./playbackstate-Dl_ZJABT.js","./getProgress-ZUTmCn_v.js","./RundownExport-CzaSrbaj.css","./TimerControlExport-Ba1vifNg.js","./TimerDisplay-tVcUk9j3.js","./TimerDisplay-B-FvT2T-.css","./TimerControlExport-X_cQKSFg.css","./MessageControlExport-BgT9JaXk.js","./MessageControlExport-D_pNX6Vj.css"])))=>i.map(i=>d[i]);
2
+ import{h as p,j as e,ac as Ns,a as X,k as Ft,ad as de,ae as cn,af as dn,ag as mt,ah as pe,T as ge,aa as gt,ai as un,y as ft,aj as hn,ak as is,f as mn,O as $t,A as ut,al as xn,am as jn,an as rt,ao as pn,P as Xe,C as Ee,ap as Ds,aq as Ps,ar as gn,as as Rs,at as rs,au as fn,av as Es,l as bn,aw as yn,$ as lt,v as Vt,ax as vn,x as wn,ay as Sn,M as Is,az as Cn,aA as ls,aB as _n,aC as kn,aD as Tn,aE as Nn,aF as Dn,I as Pn,m as Rn}from"./vendor-BKUJ0_Du.js";import{e as Se,Q as Mt,R as En,S as In,U as xt,s as Ln,V as An,W as Ie,X as ht,Y as D,Z as Qe,_ as Me,$ as E,a0 as ne,a1 as J,a2 as Rt,a3 as On,a4 as Fn,a5 as Wt,a6 as $n,a7 as Ls,a8 as Vn,a9 as L,B as f,aa as le,ab as ke,ac as Be,ad as Ce,ae as ce,af as U,ag as G,ah as M,ai as V,aj as ze,ak as Y,al as _e,am as bt,an as Mn,ao as Wn,ap as Ut,f as $e,aq as As,ar as Bt,as as Os,at as ae,x as Et,O as Re,au as Un,av as os,aw as Fs,ax as $s,ay as zt,az as Le,aA as Bn,aB as zn,aC as Gt,aD as St,m as Fe,k as Kt,aE as Gn,aF as Kn,aG as ye,aH as Vs,aI as jt,T as ot,aJ as Hn,aK as Ms,aL as cs,aM as qn,aN as Qn,aO as Yn,aP as Ye,aQ as Jn,aR as Xn,b as Zn,aS as ea,N as ta,aT as sa,aU as na,aV as aa,a as ia,aW as ra,aX as la,aY as ds,aZ as oa,a_ as us,K as ca,a$ as da,b0 as ua,b1 as ha,b2 as Ge,h as Ze,y as hs,b3 as et,b4 as ct,b5 as tt,b6 as Ue,b7 as ma,M as xa,b8 as ja,o as pa,b9 as ga,ba as fa}from"./index-Dm-4OTmY.js";import{P as ba}from"./ProtectRoute-Bxq6q7ba.js";import{u as ya}from"./useWindowTitle-DM8dIp8L.js";import{i as Ws,e as va,u as yt,R as Us,T as H,s as wa,t as Ct,a as Sa,b as Ca,d as _a,c as ka,f as Ta,g as Na,h as Da,G as Pa,S as Ra,j as Ea,D as Ht,M as qt,k as Ia,l as La}from"./useEventSelection-Bpbu89c7.js";import{I as xe,S as De,a as _t,C as Aa}from"./SwatchPicker-Ckpchvjo.js";import{f as Oa,g as Fa,h as $a,i as Qt,u as Yt,j as Va,k as Ma,l as Wa,m as Ua,r as Ba,n as za,o as Ga,p as Ka,q as Ha,s as qa}from"./useRundown-DAo6huE4.js";import{S as ie}from"./Select-BnGTAeXJ.js";import{u as vt,p as Qa,e as Ya,d as Ja}from"./useCustomFields-BBE4LBBr.js";import{u as Xa,d as Za}from"./useReport-DqSBq4MG.js";import{T as It,u as Bs,e as at}from"./editorSettings-_x6YKRfR.js";import{S as ei,L as ti,T as si}from"./EditorUtils-BLcTuWz1.js";import{T as Jt}from"./Tooltip-DZJ7u9gm.js";import{A as zs,T as He}from"./TimeInput-Cwl9vLWA.js";import{T as ms,E as kt}from"./validateEvent-GnPt-e9-.js";import{p as qe}from"./parseUserTime-sZbEBi61.js";import{u as ni,a as ai,b as ii}from"./useProjectData-C110zIXC.js";import{u as Xt,a as Zt,E as we,b as ri}from"./useSelectAndRevealEntry-DTg0hmxA.js";import{S as li,P as oi,C as es,a as Gs,b as Ks,O as Hs,M as qs}from"./TimeElements-CYIgGk0T.js";import{O as ci,s as ts,T as Qs,S as di}from"./OverviewWrapper-B2i8d3rt.js";import{g as ui,T as Ae,a as hi}from"./TimerDisplay-tVcUk9j3.js";import"./offset-VthsmtrO.js";import"./SuperscriptPeriod-EEedc9rG.js";/* empty css */import"./playbackstate-Dl_ZJABT.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof Ot<"u"?Ot:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="a110e26f-5bdd-4a61-8a6f-4b9b4b913f70",t._sentryDebugIdIdentifier="sentry-dbid-a110e26f-5bdd-4a61-8a6f-4b9b4b913f70")}catch{}})();function mi(t){return t.trim().replaceAll(" ","_")}const xi={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"},ji=(t,s,n={})=>{const{isDisabled:a=!1}=n,i=p.useCallback(l=>{l.key===s&&!l.repeat&&!a&&(l.preventDefault(),t())},[t,a,s]);p.useEffect(()=>(document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}),[i])},pi="_link_70oau_17",gi="_inline_70oau_27",xs={link:pi,inline:gi};function se({href:t,inline:s,children:n}){const a=i=>{i.preventDefault(),Mt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:Se([xs.link,s&&xs.inline]),onClick:a,children:[n," ",e.jsx(Ns,{style:{fontSize:"1em"}})]})}async function fi(t){const s=await X.get(En,{signal:t==null?void 0:t.signal});return{url:s.data.html_url,version:s.data.tag_name}}const js={url:"",version:"",hasUpdates:!1};function Ys(){const{data:t,status:s,isFetching:n,isError:a,refetch:i}=Ft({queryKey:An,queryFn:({signal:o})=>fi({signal:o}),placeholderData:(o,u)=>o,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:Ln,enabled:xt}),l=(t==null?void 0:t.version)&&!t.version.includes(In);return{data:t?{...t,hasUpdates:l}:js,placeholder:js,status:s,isFetching:n,isError:a,refetch:i}}function bi(){const{data:t,isError:s}=Ys();return s?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ht}`,e.jsx(D,{children:"Could not fetch version information"})]}):t.hasUpdates?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ht}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Qe?"You can restart your stage to get the latest available version.":e.jsx(se,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(Ie,{children:`You are currently using the latest version of Ontime: ${ht}`})}function yi(){return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"About Ontime"}),e.jsxs(E,{children:[e.jsxs(ne,{children:[e.jsx(J,{children:"Ontime"}),e.jsxs(Ie,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(se,{href:Rt,children:"www.getontime.no"})]}),e.jsxs(Ie,{children:["Considering sponsoring our work",e.jsx(se,{href:On,children:"GitHub Sponsors"}),e.jsx(se,{href:Fn,children:"Buy Me a Coffee"})]}),e.jsxs(Ie,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(se,{href:Rt,children:"www.getontime.no"})]})]}),e.jsx(J,{children:"Current version"}),e.jsx(bi,{}),e.jsx(J,{children:"Links"}),e.jsx(se,{href:Wt,children:"Read the docs"}),e.jsx(se,{href:$n,children:"Follow the project on GitHub"}),e.jsx(se,{href:Ls,children:"Discord server"}),e.jsx(se,{href:Vn,children:"Subreddit"})]})]})}function re(t,s){const n=p.useRef(null);return p.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const vi="https://docs.getontime.no/api/protocols/osc/";function wi({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var b,y,w;const{handleSubmit:a,reset:i,register:l,setError:r,watch:o,setValue:u,formState:{errors:c,isSubmitting:h,isDirty:m,isValid:d}}=de({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),x=async S=>{try{await va(S),i(S)}catch(A){const k=V(A);r("root",{message:k})}},j=()=>{i({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},g=!h&&m&&d;return e.jsxs(ne,{children:[e.jsxs(J,{children:["Automation settings",e.jsxs(L,{children:[e.jsx(f,{variant:"ghosted",onClick:j,disabled:!g,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!g,loading:h,children:"Save"})]})]}),(c==null?void 0:c.root)&&e.jsx(D,{children:c.root.message}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(se,{href:vi,children:"See the docs"})]})}),e.jsxs(E,{as:"form",id:"automation-settings-form",onSubmit:a(x),onKeyDown:S=>ke(S,j),children:[e.jsx(Be,{isLoading:!1}),e.jsx(Ce,{children:"Automation"}),e.jsx(ce,{children:e.jsxs(U,{children:[e.jsx(G,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(b=c.enabledAutomations)==null?void 0:b.message}),e.jsx(De,{size:"large",checked:o("enabledAutomations"),onCheckedChange:S=>u("enabledAutomations",S,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(Ce,{children:"OSC Input"}),e.jsxs(ce,{children:[Qe&&e.jsx(xe,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(U,{children:[e.jsx(G,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(y=c.enabledOscIn)==null?void 0:y.message}),e.jsx(De,{size:"large",checked:o("enabledOscIn"),onCheckedChange:S=>u("enabledOscIn",S,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(w=c.oscPortIn)==null?void 0:w.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:Ws,message:"Value should be numeric"}})})]})]})]})]})}const Si=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],Ci=["{{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}}"],_i=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],ki=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function Ti(t){return[...Si,...Ci,..._i,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...ki,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Ni(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 Di(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Pi="_wrapper_1dmtf_17",Ri="_suggestions_1dmtf_21",ps={wrapper:Pi,suggestions:Ri},Ei=p.forwardRef(function(s,n){const{value:a,onChange:i,...l}=s,{data:r}=vt(),o=cn(()=>j(!1)),u=p.useMemo(()=>Ti(r),[r]),[c,h]=p.useState(a||""),[m,d]=p.useState([]),[x,j]=p.useState(!1),g=w=>{const S=Di(w);return u.filter(A=>A.startsWith(S))},b=w=>{h(w.target.value),w.target.value.endsWith("{")?(j(!0),d(g(w.target.value))):w.target.value===""||w.target.value.endsWith("}}")?j(!1):x&&d(g(w.target.value)),i==null||i(w)},y=w=>{h(S=>{const A=Ni(S,w);return S+A}),j(!1)};return e.jsxs("div",{className:ps.wrapper,ref:dn(o,n),children:[e.jsx(M,{value:c,...l,onChange:b,fluid:!0}),x&&m.length>0&&e.jsx("ul",{className:ps.suggestions,children:m.map(w=>e.jsx("li",{onClick:()=>y(w),children:w},w))})]})}),Lt=[{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 gs(t){return Object.hasOwn(t,"id")}const Ii=[{value:null,label:"Select field"},{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"}],Li=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Ai(t){return[...Ii,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Li,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function Oi(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 Fi="_outerColumn_1klj0_17",$i="_innerColumn_1klj0_25",Vi="_ruleSection_1klj0_31",Mi="_titleSection_1klj0_37",Wi="_filterSection_1klj0_38",Ui="_oscSection_1klj0_39",Bi="_httpSection_1klj0_40",zi="_actionSection_1klj0_41",Gi="_test_1klj0_95",Ki="_outputCard_1klj0_99",he={outerColumn:Fi,innerColumn:$i,ruleSection:Vi,titleSection:Mi,filterSection:Wi,oscSection:Ui,httpSection:Bi,actionSection:zi,test:Gi,outputCard:Ki};function Hi({index:t,register:s,setValue:n,rowErrors:a,value:i,children:l,watch:r}){var h,m,d,x,j;const[o,u]=p.useState(i),c=g=>{n(`outputs.${t}.action`,g,{shouldDirty:!0}),u(g)};return e.jsxs("div",{className:he.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ie,{onValueChange:g=>{g!==null&&c(g)},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(D,{children:(h=a==null?void 0:a.action)==null?void 0:h.message})]}),o.startsWith("aux")&&o.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(D,{children:(m=a==null?void 0:a.time)==null?void 0:m.message})]}),o==="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(D,{children:(d=a==null?void 0:a.text)==null?void 0:d.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ie,{onValueChange:g=>{const b=g===null?void 0:g;n(`outputs.${t}.visible`,b,{shouldDirty:!0})},value:r(`outputs.${t}.visible`),options:[{value:null,label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(D,{children:(x=a==null?void 0:a.visible)==null?void 0:x.message})]})]}),o==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ie,{onValueChange:g=>{if(g!==null){if(g==="null"){n(`outputs.${t}.secondarySource`,null,{shouldDirty:!0});return}n(`outputs.${t}.secondarySource`,g,{shouldDirty:!0})}},value:r(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source"},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"secondary",label:"Secondary"},{value:"null",label:"None"}]}),e.jsx(D,{children:(j=a==null?void 0:a.secondarySource)==null?void 0:j.message})]}),e.jsx("div",{className:he.test,children:l})]})}const qi="https://docs.getontime.no/api/automation/#using-variables-in-automation";function Qi({automation:t,onClose:s}){var K;const n=gs(t),{data:a}=vt(),{refetch:i}=yt(),l=p.useMemo(()=>Ai(a),[a]),{control:r,handleSubmit:o,getValues:u,register:c,setError:h,setFocus:m,setValue:d,watch:x,formState:{errors:j,isSubmitting:g,isDirty:b,isValid:y}}=de({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:w,append:S,remove:A}=mt({name:"filters",control:r}),{fields:k,append:R,remove:W}=mt({name:"outputs",control:r});p.useEffect(()=>{m("title")},[m]);const v=()=>{S({field:"",operator:"equals",value:""})},O=()=>{R({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},C=()=>{R({type:"http",url:""})},q=()=>{R({type:"ontime",action:"aux1-start"})},B=async $=>{try{const T=u(`outputs.${$}`);if(!T.targetIP||!T.targetPort||!T.address)return;await Ct({type:"osc",targetIP:T.targetIP,targetPort:T.targetPort,address:T.address,args:T.args})}catch{}},F=async $=>{try{const T=u(`outputs.${$}`);if(!T.url)return;await Ct({type:"http",url:T.url})}catch{}},P=async $=>{try{const T=u(`outputs.${$}`);await Ct({...T,type:"ontime"})}catch{}},I=async $=>{gs(t)?await T(t.id,{id:t.id,...$}):await fe($),i();async function T(ue,oe){try{await Sa(ue,oe),s()}catch(_){h("root",{message:V(_)})}}async function fe(ue){try{await Ca(ue),s()}catch(oe){h("root",{message:V(oe)})}}},N=!g&&b&&y;return e.jsxs(ze,{as:"form",name:"automation-form",onSubmit:o(I),className:he.outerColumn,onKeyDown:$=>ke($,s),children:[e.jsx(J,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:he.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:he.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx(M,{...c("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(D,{children:(K=j.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:he.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:he.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(Us,{orientation:"horizontal",value:x("filterRule"),onValueChange:$=>d("filterRule",$,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),w.map(($,T)=>{var ue,oe,_,ee,Ne,Pe;const fe=`filters.${T}.field.${$.id}`;return e.jsxs("div",{className:he.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ie,{value:x(`filters.${T}.field`)||null,onValueChange:je=>{je!==null&&d(`filters.${T}.field`,je,{shouldDirty:!0})},options:l.map(({value:je,label:Z})=>({value:je,label:Z,disabled:je===null})),"aria-label":"Event field"}),e.jsx(D,{children:(_=(oe=(ue=j.filters)==null?void 0:ue[T])==null?void 0:oe.field)==null?void 0:_.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ie,{value:x(`filters.${T}.operator`),onValueChange:je=>{je!==null&&d(`filters.${T}.operator`,je,{shouldDirty:!0})},options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(D,{children:(Pe=(Ne=(ee=j.filters)==null?void 0:ee[T])==null?void 0:Ne.operator)==null?void 0:Pe.message})]}),e.jsxs("label",{children:["Value to match",e.jsx(M,{...c(`filters.${T}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>A(T),children:e.jsx(pe,{})})})]})]},fe)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:v,children:["Add filter ",e.jsx(ge,{})]})})]})]}),e.jsxs("div",{className:he.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(xe,{children:["Automation outputs can be used to send data from Ontime to external software ",e.jsx("br",{}),"or to change properties of Ontime itself.",e.jsx(se,{href:qi,children:"See the documentation for templates"})]}),k.map(($,T)=>{var fe,ue,oe,_,ee,Ne,Pe,je;if(Oa($)){const Z=(fe=j.outputs)==null?void 0:fe[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"OSC"}),e.jsxs("div",{className:he.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx(M,{...c(`outputs.${T}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(D,{children:(ue=Z==null?void 0:Z.targetIP)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Target Port",e.jsx(M,{...c(`outputs.${T}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:as=>as===""?0:Number(as),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(D,{children:(oe=Z==null?void 0:Z.targetPort)==null?void 0:oe.message})]}),e.jsxs("label",{children:["Address",e.jsx(M,{...c(`outputs.${T}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(D,{children:(_=Z==null?void 0:Z.address)==null?void 0:_.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(Ei,{...c(`outputs.${T}.args`),value:$.args,placeholder:"1"}),e.jsx(D,{children:(ee=Z==null?void 0:Z.args)==null?void 0:ee.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>B(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]})]},$.id)}if(Fa($)){const Z=(Ne=j.outputs)==null?void 0:Ne[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"HTTP"}),e.jsxs("div",{className:he.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx(M,{...c(`outputs.${T}.url`,{required:{value:!0,message:"Required field"},pattern:{value:wa,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(D,{children:(Pe=Z==null?void 0:Z.url)==null?void 0:Pe.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>F(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]})]},$.id)}if($a($)){const Z=(je=j.outputs)==null?void 0:je[T];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"Ontime action"}),e.jsxs(Hi,{value:$.action,index:T,register:c,rowErrors:Z,setValue:d,watch:x,children:[e.jsx("span",{children:" "}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>P(T),children:"Test"}),e.jsx(Y,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(T),children:e.jsx(pe,{})})]})]})]},$.id)}return null}),e.jsxs(L,{relation:"inner",children:[e.jsxs(f,{onClick:O,children:["OSC ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:C,children:["HTTP ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:q,children:["Ontime action ",e.jsx(ge,{})]})]})]}),e.jsxs(L,{align:"end",children:[(j==null?void 0:j.root)&&e.jsx(D,{children:j.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!N,loading:g,children:"Save"})]})]})}const fs={title:"",filterRule:"all",filters:[],outputs:[]};function Yi(t){const{automations:s}=t,{refetch:n}=yt(),[a,i]=p.useState(null),[l,r]=p.useState(null),o=async c=>{try{r(null),await _a(c)}catch(h){r(V(h))}finally{n()}},u=Object.keys(s);return e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!a,onClick:()=>i(fs),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),a!==null&&e.jsx(Qi,{automation:a,onClose:()=>i(null)}),e.jsxs(_e,{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:[u.length===0&&e.jsx(bt,{handleClick:a?void 0:()=>i(fs)}),u.map(c=>Object.hasOwn(s,c)?e.jsx(p.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[c].title}),e.jsx("td",{children:e.jsx(H,{children:s[c].filterRule})}),e.jsx("td",{children:s[c].filters.length}),e.jsx("td",{children:s[c].outputs.length}),e.jsxs(L,{align:"end",relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>i(s[c]),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>o(c),children:e.jsx(pe,{})})]})]})},c):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(D,{children:l})})})]})]})]})}function Js({automations:t,initialId:s,initialTitle:n,initialAutomationId:a,initialTrigger:i,onCancel:l,postSubmit:r}){var A,k,R,W;const{handleSubmit:o,register:u,setFocus:c,setError:h,watch:m,setValue:d,formState:{errors:x,isSubmitting:j,isValid:g,isDirty:b}}=de({defaultValues:{title:n,trigger:i??Lt[0].value,automationId:a??((A=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:A.id)},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{c("title")},[c]);const y=async v=>{if(s){try{await ka(s,{id:s,...v}),r()}catch(O){h("root",{message:`Failed to save changes to trigger ${V(O)}`})}return}try{await Ta(v),r()}catch(O){h("root",{message:`Failed to save trigger ${V(O)}`})}},w=Object.keys(t).map(v=>({value:v,label:t[v].title})),S=b&&g;return e.jsxs(ze,{as:"form",name:"trigger-form",onSubmit:o(y),onKeyDown:v=>ke(v,l),children:[e.jsx(J,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx(M,{...u("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(D,{children:(k=x.title)==null?void 0:k.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ie,{value:m("trigger"),onValueChange:v=>{v!==null&&d("trigger",v,{shouldDirty:!0})},options:Lt.map(v=>({value:v.value,label:v.label})),"aria-label":"Lifecycle trigger"}),e.jsx(D,{children:(R=x.trigger)==null?void 0:R.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ie,{value:m("automationId"),onValueChange:v=>{v!==null&&d("automationId",v,{shouldDirty:!0})},options:w,"aria-label":"Automation title"}),e.jsx(D,{children:(W=x.automationId)==null?void 0:W.message})]}),e.jsxs(L,{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 Ji(t){var m,d;const{automations:s,id:n,title:a,trigger:i,automationId:l,duplicate:r,handleDelete:o,postSubmit:u}=t,[c,h]=p.useState(!1);return c?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Js,{automations:s,initialId:n,initialTitle:a,initialTrigger:i,initialAutomationId:l,onCancel:()=>h(!1),postSubmit:()=>{h(!1),u()}})})}):e.jsxs("tr",{"data-warn":r,children:[e.jsxs(L,{as:"td",relation:"inner",children:[r&&e.jsx(un,{color:"#FFBC56"}),a]}),e.jsx("td",{children:e.jsx(H,{children:(m=Lt.find(x=>x.value===i))==null?void 0:m.label})}),e.jsx("td",{children:e.jsx(H,{children:(d=s==null?void 0:s[l])==null?void 0:d.title})}),e.jsxs(L,{align:"end",relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>h(!0),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:o,children:e.jsx(pe,{})})]})]})}function Xi(t){const{triggers:s,automations:n}=t,[a,i]=p.useState(!1),{refetch:l}=yt(),[r,o]=p.useState(null),u=async d=>{try{await Na(d)}catch(x){o(V(x))}finally{l()}},c=()=>{i(!1),l()},h=p.useMemo(()=>Oi(s),[s]),m=Object.keys(n).length>0;return e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!m,loading:!1,onClick:()=>i(!0),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[h&&e.jsx(D,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),a&&e.jsx(Js,{automations:n,onCancel:()=>i(!1),postSubmit:c}),e.jsxs(_e,{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(bt,{label:"Create an automation to attach triggers to",handleClick:m?()=>i(!0):void 0}),s.map((d,x)=>e.jsxs(p.Fragment,{children:[e.jsx(Ji,{automations:n,id:d.id,title:d.title,trigger:d.trigger,automationId:d.automationId,duplicate:h==null?void 0:h.includes(x),handleDelete:()=>u(d.id),postSubmit:c}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(D,{children:r})})})]},d.id))]})]})]})]})}function Zi({location:t}){const{data:s,status:n}=yt(),a=re("settings",t),i=re("triggers",t),l=re("automations",t),r=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Automation"}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:r}),e.jsx("div",{ref:a,children:e.jsx(wi,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(Yi,{automations:s.automations})}),e.jsx("div",{ref:i,children:e.jsx(Xi,{triggers:s.triggers,automations:s.automations})})]})]})}const er="_goIcon_1fzu7_17",tr={goIcon:er};function sr(){const{data:t}=Mn(),s=n=>Mt(n);return e.jsx(L,{wrap:"wrap",children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!xt)return null;const a=Wn(n.address);return e.jsxs(Ut,{copyValue:a,onClick:()=>s(a),children:[`${n.name} - ${n.address}`," ",e.jsx(ft,{className:tr.goIcon})]},n.name)})})}function nr(t){return hn(t)}function ar(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],o=s[r];!o||!Qt(o)||(r in t||a.push({id:r,index:i,title:o.title,cue:o.cue,scheduledStart:o.timeStart,actualEnd:null,scheduledEnd:o.timeEnd,actualStart:null}),r in t&&a.push({id:r,index:i,title:o.title,cue:o.cue,scheduledStart:o.timeStart,actualEnd:t[r].endedAt,scheduledEnd:o.timeEnd,actualStart:t[r].startedAt}),i++)}return a}const ir=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function rr(t){const s=[];s.push(ir);for(const n of t)s.push([String(n.index),n.title,n.cue,$e(n.scheduledStart),$e(n.actualStart),$e(n.scheduledEnd),$e(n.actualEnd)]);return nr(s)}const lr="_blink_15peo_1",or="_fourtyfive_15peo_13",cr="_over_15peo_17",dr="_under_15peo_21",dt={blink:lr,fourtyfive:or,over:cr,under:dr};function ur(){const{data:t}=Xa(),{data:s}=Yt(),n=async()=>await Za(),a=l=>{if(!l)return;const r=rr(l),o=As(r,"text/csv;charset=utf-8;");Bt(o,"ontime-report.csv")},i=p.useMemo(()=>ar(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Report"}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(Ce,{children:["Manage report",e.jsxs(L,{children:[e.jsxs(f,{onClick:()=>a(i),disabled:i.length===0,children:[e.jsx(is,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:i.length===0,children:[e.jsx(is,{}),"Clear All"]})]})]})}),e.jsx(E,{children:e.jsxs(_e,{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(bt,{label:"Reports are generated when running through the show."}),i.map(l=>{const r=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",o=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:Se([r&&dt[r]]),children:$e(l.scheduledStart)}),e.jsx("th",{className:Se([r&&dt[r]]),children:$e(l.actualStart)}),e.jsx("th",{className:Se([o&&dt[o]]),children:$e(l.scheduledEnd)}),e.jsx("th",{className:Se([o&&dt[o]]),children:$e(l.actualEnd)})]},l.id)})]})]})})]})})}const hr="_expand_1sy0c_17",mr="_column_1sy0c_21",bs={expand:hr,column:mr},xr=[{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"}],jr={alias:"",target:Re.Timer,search:"",enabled:!0};function pr({urlPreset:t,onClose:s}){var k,R,W;const{addPreset:n,updatePreset:a,isMutating:i}=Os(),{handleSubmit:l,register:r,setFocus:o,setError:u,clearErrors:c,setValue:h,getValues:m,watch:d,formState:{errors:x,isSubmitting:j,isValid:g,isDirty:b}}=de({defaultValues:t??jr,mode:"onChange",resetOptions:{keepDirtyValues:!0}}),y=p.useRef(null),w=async v=>{try{t?await a(t.alias,v):await n(v),s()}catch(O){u("root",{message:V(O)})}};p.useEffect(()=>{o("alias")},[o]);const S=()=>{var v;c();try{const O=Un(m("alias"),((v=y.current)==null?void 0:v.value.trim())??"");h("target",O.target,{shouldDirty:!0,shouldValidate:!0}),h("search",O.search,{shouldDirty:!0,shouldValidate:!0})}catch(O){u("root",{message:os(O)});return}},A=v=>{try{return new URLSearchParams(v),!0}catch(O){return os(O)||"Invalid URL parameters"}};return e.jsxs(ze,{as:"form",onSubmit:l(w),onKeyDown:v=>ke(v,s),className:bs.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(L,{children:[e.jsxs("div",{children:[e.jsx(ae,{children:"Alias"}),e.jsx(M,{...r("alias",{required:"Alias is required",pattern:{value:Da,message:"Field can only contain URL safe characters (a-z, 0-9, _ and -)"}})})]}),e.jsxs("div",{className:bs.expand,children:[e.jsx(ae,{children:"Generate options (paste URL to generate options)"}),e.jsxs(L,{children:[e.jsx(M,{placeholder:"Paste URL",fluid:!0,ref:y}),e.jsx(f,{onClick:S,children:"Generate"})]})]})]}),((k=x.alias)==null?void 0:k.message)&&e.jsx(D,{children:x.alias.message}),e.jsxs("div",{children:[Et," or ",Et]}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(ae,{children:"Target"}),e.jsx(ie,{options:xr,...r("target",{required:"Target is required"}),value:d("target"),onValueChange:v=>{v!==null&&h("target",v,{shouldDirty:!0})}})]}),e.jsxs("div",{children:[e.jsx(ae,{children:"Parameters"}),e.jsx(It,{fluid:!0,rows:3,...r("search",{validate:A})}),e.jsx(D,{children:(R=x.search)==null?void 0:R.message})]}),e.jsxs("div",{children:[e.jsx(D,{children:(W=x.root)==null?void 0:W.message}),e.jsxs(L,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!g||!b,loading:j||i,children:"Save"})]})]})]})}const gr="https://docs.getontime.no/features/url-presets/";function fr(){const[t,s]=p.useState({isOpen:!1,preset:void 0}),{data:n,status:a}=Fs(),{deletePreset:i,isMutating:l}=Os(),r=()=>s({isOpen:!0}),o=c=>s({isOpen:!0,preset:c}),u=()=>s({isOpen:!1,preset:void 0});return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["URL presets",e.jsxs(f,{onClick:r,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(se,{href:gr,children:"See the docs"})]})}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:a==="pending"}),t.isOpen&&e.jsx(pr,{urlPreset:t.preset,onClose:u}),e.jsxs(_e,{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(bt,{handleClick:r}),n.map((c,h)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(De,{defaultChecked:c.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(H,{children:c.target})}),e.jsx("td",{style:{width:"100%"},children:c.alias}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white",onClick:m=>$s(c.alias,m),disabled:l,children:e.jsx(Ns,{})}),e.jsx(Y,{onClick:()=>o(c),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${h}`,disabled:l,children:e.jsx(gt,{})}),e.jsx(Y,{onClick:()=>i(c.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${h}`,disabled:l,children:e.jsx(pe,{})})]})]},c.alias))]})]})]})]})})}function br({location:t}){const s=re("presets",t),n=re("link",t),a=re("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(fr,{})}),e.jsx("div",{ref:n,children:e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Share Ontime Link"}),!Qe&&e.jsxs(e.Fragment,{children:[e.jsx(Ie,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(sr,{})]}),e.jsx(le,{}),e.jsx(Pa,{})]})})}),e.jsx("div",{ref:a,children:e.jsx(ur,{})})]})}const ss=`${zt}/excel`;async function yr(t,s){const n=new FormData;return n.append("excel",t),(await X.post(`${ss}/upload`,n,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data}async function vr(t,s){return(await X.post(`${ss}/preview`,{options:t},{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data}async function wr(t,s,n){try{const a=await X.get(`${ss}/${t}/export`,{signal:n==null?void 0:n.signal,timeout:(n==null?void 0:n.timeout)??Le.longTimeout,responseType:"blob"});Bt(a.data,`${s??"Ontime_rundown"}.xlsx`)}catch(a){console.error("Error downloading file:",a)}}const Je=`${zt}/sheets`,Sr=async()=>(await X.get(`${Je}/connect`)).data,Cr=async(t,s,n)=>{const a=new FormData;return a.append("client_secret",t),(await X.post(`${Je}/${s}/connect`,a,{signal:n==null?void 0:n.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data},_r=async()=>(await X.post(`${Je}/revoke`)).data,kr=async(t,s,n)=>(await X.post(`${Je}/${t}/read`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data,Xs=async(t,s)=>(await X.post(`${Je}/${t}/worksheets`,void 0,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data,Tr=async(t,s,n)=>(await X.post(`${Je}/${t}/write`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data;function Nr(t){if(!Dr(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 Zs(t){if(!Pr(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 Dr(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Pr(t){return t==null?void 0:t.name.endsWith(".json")}function Rr(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 Te=`${zt}/db`;function en(t){return X.post(`${Te}/download`,{filename:t},{timeout:Le.longTimeout})}async function Er(t){try{const{data:s,name:n}=await Mr(t),a=JSON.stringify(s,null,2),i=As(a,"application/json;charset=utf-8;");Bt(i,`${n}.json`)}catch(s){console.error(s)}}async function tn(t){const s=new FormData;return s.append("project",t),(await X.post(`${Te}/upload`,s,{timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data}async function sn(t){return await X.patch(Te,t)}async function Ir(t){return(await X.post(`${Te}/new`,t)).data}async function Lr(t){return(await X.post(`${Te}/quick`,t)).data}async function Ar(t){return(await X.get(`${Te}/all`,{signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})).data}async function nn(t){return(await X.post(`${Te}/load`,{filename:t})).data}async function Or(){return(await X.post(`${Te}/demo`)).data}async function Fr(t,s){const n=`${Te}/${t}/duplicate`,a=decodeURIComponent(n);return(await X.post(a,{newFilename:s})).data}async function $r(t,s){const n=`${Te}/${t}/rename`,a=decodeURIComponent(n);return(await X.put(a,{newFilename:s})).data}async function Vr(t){const s=`${Te}/${t}`,n=decodeURIComponent(s);return(await X.delete(n)).data}async function Mr(t){const s=await en(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 Wr={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},ys={stepData:Wr,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,summary:null,spreadsheetImportMap:xi},z=mn((t,s)=>({...ys,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(ys),resetPreview:()=>t({rundown:null,customFields:null,summary:null})}));function wt(){const t=$t(),s=z(m=>m.patchStepData),n=z(m=>m.setRundown),a=z(m=>m.setCustomFields),i=z(m=>m.setSummary);return{connect:async(m,d)=>{try{return await Cr(m,d)}catch(x){s({authenticate:{available:!1,error:V(x)}})}},revoke:async()=>{try{return await _r()}catch(m){s({authenticate:{available:!1,error:V(m)}})}},verifyAuth:async()=>{try{return await Sr()}catch(m){s({authenticate:{available:!1,error:V(m)}})}},importRundownPreview:async(m,d)=>{try{const x=await kr(m,d);n(x.rundown),a(x.customFields),i(x.summary)}catch(x){s({pullPush:{available:!0,error:V(x)}})}},importRundown:async(m,d)=>{try{await sn({rundowns:m,customFields:d}),await t.invalidateQueries({queryKey:[Bn,zn]})}catch(x){s({pullPush:{available:!0,error:V(x)}})}},exportRundown:async(m,d)=>{try{await Tr(m,d),s({pullPush:{available:!1,error:""}})}catch(x){s({pullPush:{available:!0,error:V(x)}})}}}}const At={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 Ur(t){return typeof t!="object"||t===null?!1:Object.keys(At).every(n=>Object.hasOwn(t,n))}function vs(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 Br(t){localStorage.setItem("import-options",JSON.stringify(t))}function zr(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function Gr(){try{const t=zr();return Ur(t)?t:At}catch{return At}}const Kr="_uploadSection_10owf_17",Hr="_finishSection_10owf_18",qr="_error_10owf_40",Qr="_success_10owf_43",Yr="_singleActionCell_10owf_47",Ve={uploadSection:Kr,finishSection:Hr,error:qr,success:Qr,singleActionCell:Yr};function Jr({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:a,onSubmitImport:i}){const l=Gr(),{revoke:r}=wt(),{control:o,handleSubmit:u,register:c,setValue:h,watch:m,formState:{errors:d,isValid:x}}=de({mode:"onChange",defaultValues:l,values:l}),{fields:j,append:g,remove:b}=mt({control:o,name:"custom"}),y=z(P=>P.stepData),w=z(P=>P.worksheetNames),[S,A]=p.useState("");p.useEffect(()=>{!w||w.length===0||w.includes(l.Worksheet)||h("Worksheet",w[0],{shouldValidate:!0,shouldDirty:!0})},[w,h,l.Worksheet]);const k=async P=>{A("export");const I=vs(P);await a(I),A("")},R=async()=>{await r(),n()},W=async P=>{A("import");const I=vs(P);Br(P),await i(I),A("")},v=P=>{b(P)},O=()=>{g({})},C=!!S,q=s&&!C,B=!C&&!y.worksheet.error,F=!t&&x&&(q||B);return e.jsxs(E,{as:"form",id:"import-map",children:[e.jsxs(Ce,{children:["Import options",e.jsxs(L,{children:[!s&&e.jsx(Jt,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:R,disabled:C,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:C,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:u(k),disabled:!B,loading:S==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:u(W),disabled:!F,loading:S==="import",children:"Import preview"})]})]}),e.jsxs(xe,{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(_e,{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:Ve.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([P,I])=>P==="custom"?null:P==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:P}),e.jsx("td",{children:e.jsx(ie,{id:I,value:m(P),onValueChange:N=>{N!==null&&h(P,N,{shouldDirty:!0})},options:(w==null?void 0:w.map(N=>({value:N,label:N})))||[]})}),e.jsx("td",{className:Ve.singleActionCell})]},I):e.jsxs("tr",{children:[e.jsx("td",{children:P}),e.jsx("td",{children:e.jsx(M,{id:I,fluid:!0,maxLength:25,defaultValue:I,placeholder:"Use default column name",...c(P)})}),e.jsx("td",{className:Ve.singleActionCell})]},I)),j.map((P,I)=>{var fe,ue,oe;const N=P.ontimeName,K=P.importName,$=(oe=(ue=(fe=d.custom)==null?void 0:fe[I])==null?void 0:ue.ontimeName)==null?void 0:oe.message,T=`custom.${I}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx(M,{maxLength:25,fluid:!0,defaultValue:N,placeholder:"Name of the field as shown in Ontime",...c(`custom.${I}.ontimeName`,{validate:_=>Gt.isAlphanumericWithSpace(_)?!0:"Only alphanumeric characters and space are allowed"})}),$&&e.jsx(D,{children:$})]}),e.jsx("td",{children:e.jsx(M,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...c(`custom.${I}.importName`)})}),e.jsx("td",{className:Ve.singleActionCell,children:e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>v(I),children:e.jsx(pe,{})})})]},T)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(L,{as:"td",align:"end",children:e.jsxs(f,{onClick:O,children:["Add custom field ",e.jsx(ge,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(D,{children:y.worksheet.error})]})}const Xr="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function Zr(){return e.jsxs(xe,{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(se,{href:Xr,children:"See the docs"})]})}function el(t){const{onCancel:s}=t,{revoke:n,connect:a,verifyAuth:i}=wt(),[l,r]=p.useState(null),[o,u]=p.useState(null),[c,h]=p.useState(""),[m,d]=p.useState(""),x=z(N=>N.sheetId),j=z(N=>N.setSheetId),g=z(N=>N.setWorksheets),b=z(N=>N.patchStepData),y=z(N=>N.authenticationStatus),w=z(N=>N.setAuthenticationStatus),S=z(N=>N.stepData.authenticate.error),A=async()=>{const N=await i();N&&w(N.authenticated)};p.useEffect(()=>{b({authenticate:{available:!1,error:""}}),O()},[]);const k=async()=>{h("cancel"),await n(),await A(),h("")},R=()=>{s()},W=N=>{var K;(K=N.target.files)!=null&&K.length&&r(N.target.files[0])},v=async()=>{if(!l||!x)return;b({worksheet:{available:!1,error:""}}),h("connect");const N=await a(l,x);N&&(d(N.verification_url),u(N.user_code)),h("")},O=async(N=0)=>{const K=await i();if(K!=null&&K.authenticated&&(w(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const $=await Xs(K.sheetId);g($)}catch($){const T=V($);b({worksheet:{available:!1,error:T}})}h("");return}if(N<=10){setTimeout(()=>O(N+1),2e3);return}h("")},C=async()=>{h("authenticate"),Mt(m),window.addEventListener("focus",async()=>{O()},{once:!0})},q=l&&x,B=!!o&&!!m,F=!!c,P=y==="authenticated",I=y==="pending";return e.jsxs(E,{children:[e.jsxs(Ce,{children:["Sync with Google Sheet (experimental)",P?e.jsx(f,{onClick:k,loading:c==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:R,children:"Go Back"})]}),e.jsxs(ce,{children:[e.jsx(ae,{children:"Upload Client Secret provided by Google"}),e.jsx(D,{children:S}),e.jsx(M,{fluid:!0,type:"file",onChange:W,accept:".json",disabled:F||B})]}),e.jsxs(ce,{children:[e.jsx(ae,{children:"Enter ID of sheet to synchronise"}),e.jsx(D,{children:void 0}),e.jsx(M,{fluid:!0,placeholder:"Sheet ID",onChange:N=>j(N.target.value),disabled:F||B})]}),B?e.jsx(ce,{children:e.jsxs(L,{children:[I&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Ut,{copyValue:o??"",disabled:!B,children:o||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:C,disabled:!B,children:[e.jsx(xn,{}),"Authenticate"]})]})}):e.jsx(ce,{children:e.jsx(L,{children:e.jsxs(f,{onClick:v,disabled:!q||F,loading:c==="connect",children:[e.jsx(ut,{}),"Connect"]})})})]})}const tl="_center_l8uww_17",sl="_nowrap_l8uww_21",nl="_secondaryRow_l8uww_25",al="_linkStartActive_l8uww_30",il="_flex_l8uww_36",rl="_subdued_l8uww_42",te={center:tl,nowrap:sl,secondaryRow:nl,linkStartActive:al,flex:il,subdued:rl};function Tt(t){return t?"Yes":void 0}function ll({rundown:t,customFields:s}){let n=0;const a=Object.keys(s),i=a.map(l=>s[l].label);return e.jsxs(_e,{className:te.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(Va(r)){const m=r.colour?St(r.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:te.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:{...m},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:te.center,children:e.jsx(H,{children:r.id})})]},r.id)}if(Ma(r)){const m=r.colour?St(r.colour):{};return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:te.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:{...m},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:te.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:te.secondaryRow,children:["Note: ",r.note]})})]},r.id)}if(!Qt(r))return null;n+=1;const o=r.colour?St(r.colour):{},u=Tt(r.countToEnd),c=Tt(r.skip),h=Tt(r.flag);return e.jsxs(p.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:te.center,children:e.jsx(H,{children:n})}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.type})}),e.jsx("td",{className:te.nowrap,children:r.cue}),e.jsx("td",{children:r.title}),e.jsx("td",{className:te.center,children:h&&e.jsx(H,{children:h})}),e.jsxs("td",{className:te.flex,children:[e.jsx("span",{className:r.linkStart?te.subdued:void 0,children:Fe(r.timeStart)}),r.linkStart&&e.jsx(jn,{className:te.linkStartActive})]}),e.jsx("td",{children:Fe(r.timeEnd)}),e.jsx("td",{children:Fe(r.duration)}),e.jsx("td",{children:Fe(r.timeWarning)}),e.jsx("td",{children:Fe(r.timeDanger)}),e.jsx("td",{className:te.center,children:u&&e.jsx(H,{children:u})}),e.jsx("td",{children:c&&e.jsx(H,{children:c})}),e.jsx("td",{style:{...o},children:r.colour}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.timerType})}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.endAction})}),a.map(m=>{let d="";return m in r.custom&&(d=r.custom[m]),e.jsx("td",{children:d},m)}),e.jsx("td",{className:te.center,children:e.jsx(H,{children:r.id})})]}),r.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:te.secondaryRow,children:["Note: ",r.note]})})]},r.id)})})]})}function ol({rundown:t,customFields:s,summary:n,onFinished:a,onCancel:i,onBack:l}){const{data:r}=Yt(),[o,u]=p.useState(!1),{importRundown:c}=wt(),h=z(x=>x.resetPreview),m=()=>{h(),i()},d=async()=>{u(!0),await c({[r.id]:{...t,id:r.id,title:r.title}},s),u(!1),a()};return e.jsxs(E,{children:[e.jsxs(Ce,{children:["Review Rundown",e.jsxs(L,{children:[e.jsx(f,{onClick:m,variant:"ghosted",disabled:o,children:"Cancel"}),e.jsx(f,{onClick:l,variant:"subtle",disabled:o,children:"Back"}),e.jsx(f,{onClick:d,variant:"primary",loading:o,children:"Apply"})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx("b",{children:"Title"})," ",t.title]}),e.jsxs(U,{children:[e.jsx("b",{children:"Number of entries"})," ",t.flatOrder.length]}),e.jsxs(U,{children:[e.jsx("b",{children:"Start time"})," ",Fe(n.start)]}),e.jsxs(U,{children:[e.jsx("b",{children:"End time"})," ",Fe(n.end)]}),e.jsxs(U,{children:[e.jsx("b",{children:"Total duration"})," ",Kt(n.duration)]})]}),e.jsx(ll,{rundown:t,customFields:s})]})}function cl(){const[t,s]=p.useState("none"),[n,a]=p.useState(""),[i,l]=p.useState("none"),{exportRundown:r,importRundownPreview:o,verifyAuth:u}=wt(),c=z(_=>_.setWorksheets),h=z(_=>_.authenticationStatus),m=z(_=>_.setAuthenticationStatus),d=z(_=>_.rundown),x=z(_=>_.setRundown),j=z(_=>_.customFields),g=z(_=>_.setCustomFields),b=z(_=>_.summary),y=z(_=>_.setSummary),w=z(_=>_.setSheetId),S=z(_=>_.sheetId),A=z(_=>_.resetPreview),k=p.useRef(null),R=async _=>{var Ne;const ee=(Ne=_.target.files)==null?void 0:Ne[0];if(!ee){c(null),l("none");return}try{l("loading"),Nr(ee);const Pe=await yr(ee);c(Pe),s("excel"),l("done")}catch(Pe){const je=Gn(Pe);a(`Error uploading file: ${je}`),c(null),l("none")}},W=()=>{var _;(_=k.current)==null||_.click()},v=()=>{s("none"),x(null),l("none"),c(null),g(null),y(null),a(""),w(null)},O=async()=>{const _=await u();if(_&&(m(_.authenticated),w(_.sheetId),_.authenticated==="authenticated"&&_.sheetId))try{const ee=await Xs(_.sheetId);c(ee)}catch(ee){const Ne=V(ee);a(`Error getting worksheets: ${Ne}`)}s("gsheet")},C=()=>{v()},q=async _=>{if(a(""),t==="excel")try{const ee=await vr(_);x(ee.rundown),g(ee.customFields),y(ee.summary)}catch(ee){a(V(ee))}if(t==="gsheet"){if(!S)return;await o(S,_)}},B=async()=>{if(v(),h==="authenticated"){const _=await u();_&&m(_.authenticated)}},F=()=>{s("finished"),x(null),l("none"),c(null),g(null),a("")},P=async _=>{S&&await r(S,_)},I=t==="excel",N=t==="gsheet",K=h==="authenticated",$=t==="none",T=t==="finished",fe=N&&!K,ue=N&&K||I&&i==="done",oe=d!==null&&j!==null&&b!==null;return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(D,{children:n}),$&&e.jsxs(e.Fragment,{children:[e.jsx(Zr,{}),e.jsx("input",{ref:k,style:{display:"none"},type:"file",onChange:R,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Ve.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:W,loading:i==="loading",children:[e.jsx(rt,{}),"Import from spreadsheet"]}),e.jsx(ae,{children:"Accepts .xlsx files"})]}),e.jsx(ei,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:O,disabled:i!=="none",children:[e.jsx(pn,{}),"Synchronise with Google"]}),e.jsx(ae,{children:"Start authentication process"})]})]})]}),T&&e.jsxs("div",{className:Ve.finishSection,children:[n?e.jsx("span",{className:Ve.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Ve.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:v,children:"Return"})]}),fe&&e.jsx(el,{onCancel:C}),ue&&!oe&&e.jsx(Jr,{hasErrors:!!n,isSpreadsheet:I,onCancel:B,onSubmitExport:P,onSubmitImport:q}),oe&&e.jsx(ol,{rundown:d,customFields:j,summary:b,onFinished:F,onCancel:B,onBack:A})]})})}const dl="_halfWidth_6p65m_17",ul="_fullWidth_6p65m_21",hl="_twoCols_6p65m_25",ml="_current_6p65m_31",pt={halfWidth:dl,fullWidth:ul,twoCols:hl,current:ml};function an({onSubmit:t,onCancel:s,initialColour:n,initialLabel:a,initialKey:i}){const{data:l}=vt(),[r,o]=p.useState(n||""),{handleSubmit:u,register:c,setFocus:h,setError:m,setValue:d,getValues:x,watch:j,formState:{errors:g,isSubmitting:b,isValid:y,isDirty:w}}=de({defaultValues:{type:"text",label:a||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),S=async v=>{const{type:O,label:C,colour:q}=v,B={type:O,colour:q,label:C};try{await t(B)}catch(F){m("root",{type:"custom",message:V(F)})}};p.useEffect(()=>{h("label")},[h]);const A=v=>{o(v),d("colour",v,{shouldDirty:!0})},k=x("colour"),R=w&&y,W=i!==void 0;return e.jsxs(ze,{as:"form",onSubmit:u(S),onKeyDown:v=>ke(v,s),children:[e.jsxs(xe,{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(ae,{children:"Type"}),e.jsx(Us,{orientation:"horizontal",disabled:W,onValueChange:v=>d("type",v,{shouldDirty:!0}),value:j("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:pt.twoCols,children:[e.jsxs("label",{children:[e.jsx(ae,{children:"Label (only alphanumeric characters are allowed)"}),g.label&&e.jsx(D,{children:g.label.message}),e.jsx(M,{...c("label",{required:{value:!0,message:"Required field"},onChange:()=>d("key",mi(x("label"))??"N/A"),validate:v=>v.trim().length===0?"Required field":Gt.isAlphanumericWithSpace(v)?!W&&W&&Object.keys(l).includes(v)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(ae,{children:"Key (use in Integrations and API)"}),e.jsx(M,{...c("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(ae,{children:"Colour"}),e.jsx(Ra,{name:"colour",value:k,handleChange:(v,O)=>A(O)})]}),g.root&&e.jsx(D,{children:g.root.message}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!R,loading:b,children:"Save"})]})]})}function xl(t){const{colour:s,label:n,fieldKey:a,type:i,onEdit:l,onDelete:r}=t,[o,u]=p.useState(!1),c=async h=>{await l(a,h),u(!1)};return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(an,{onCancel:()=>u(!1),onSubmit:c,initialColour:s,initialLabel:n,initialKey:a})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Ea,{color:s})}),e.jsx("td",{children:e.jsx(H,{children:i})}),e.jsx("td",{className:pt.halfWidth,children:n}),e.jsx("td",{className:pt.fullWidth,children:e.jsx(Ut,{size:"small",copyValue:a,children:a})}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(Y,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>u(!0),children:e.jsx(gt,{})}),e.jsx(Y,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>r(a),children:e.jsx(pe,{})})]})]})}function jl(){const{data:t,refetch:s}=vt(),[n,a]=p.useState(!1),i=()=>{a(!0)},l=()=>{a(!1)},r=async c=>{await Qa(c),s(),a(!1)},o=async(c,h)=>{await Ya(c,h),s()},u=async c=>{try{await Ja(c),s()}catch{}};return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Custom fields",e.jsxs(f,{onClick:i,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(E,{children:e.jsxs(xe,{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(zs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(se,{href:Kn,children:"See the docs"})]})}),e.jsxs(E,{children:[n&&e.jsx(an,{onSubmit:r,onCancel:l}),e.jsxs(_e,{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(([c,{colour:h,label:m,type:d}])=>e.jsx(xl,{fieldKey:c,colour:h,label:m,type:d,onEdit:o,onDelete:u},c))})]})]})]})})}function pl(){const{data:t,status:s,isError:n,refetch:a,isFetching:i}=Ft({queryKey:ye,queryFn:({signal:l})=>Ka({signal:l}),placeholderData:(l,r)=>l,refetchInterval:Vs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:a,isFetching:i}}function rn(){const t=$t(),{mutateAsync:s}=Xe({mutationFn:Wa,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:n}=Xe({mutationFn:Ua,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:a}=Xe({mutationFn:([r,o])=>Ba(r,o),onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:i}=Xe({mutationFn:za,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}}),{mutateAsync:l}=Xe({mutationFn:Ga,onMutate:()=>{t.cancelQueries({queryKey:ye})},onSuccess:r=>{t.setQueryData(ye,r.data)}});return{create:s,duplicate:n,remove:i,load:l,rename:a}}function gl({onSubmit:t,onCancel:s,initialTitle:n}){const{handleSubmit:a,register:i,setFocus:l,setError:r,formState:{errors:o,isSubmitting:u,isValid:c,isDirty:h}}=de({defaultValues:{title:n},mode:"onChange"}),m=async x=>{try{await t(x.title)}catch(j){r("root",{type:"custom",message:V(j)})}};p.useEffect(()=>{l("title")},[l]);const d=h&&c;return e.jsxs(ze,{as:"form",onSubmit:a(m),onKeyDown:x=>ke(x,s),children:[e.jsxs("label",{children:[e.jsx(ae,{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":Gt.isAlphanumericWithSpace(x)===!1?"Title can only contain alphanumeric characters, spaces and underscores":!0}),fluid:!0}),o.title&&e.jsx(D,{children:o.title.message})]}),o.root&&e.jsx(D,{children:o.root.message}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!d,loading:u,children:"Save"})]})]})}function fl({onClose:t}){const{create:s}=rn(),{handleSubmit:n,register:a,setFocus:i,setError:l,formState:{errors:r,isSubmitting:o}}=de({defaultValues:{title:""}}),u=async c=>{try{await s(c.title||"untitled"),t()}catch(h){l("root",{message:`Failed to create rundown. ${h}`})}};return p.useEffect(()=>{i("title")},[i]),e.jsxs(ze,{as:"form",onSubmit:n(u),children:[e.jsx(E,{children:e.jsxs("label",{children:[e.jsx(ae,{children:"Rundown title"}),e.jsx(M,{...a("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(L,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:o,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:o,children:"Create rundown"})]}),r.root&&e.jsx(D,{children:r.root.message})]})}function bl(){var O;const{data:t}=pl(),{duplicate:s,remove:n,load:a,rename:i}=rn(),[l,r]=Ee(),[o,u]=Ee(),[c,h]=Ee(),[m,d]=p.useState(""),[x,j]=p.useState(null),[g,b]=p.useState(null),y=C=>{b(null),d(C),u.open()},w=C=>{b(null),d(C),r.open()},S=C=>{b(null),j(C)},A=async()=>{try{await a(m)}catch(C){b(`Failed to load rundown. ${V(C)}`)}finally{u.close()}},k=async C=>{b(null),j(null),d("");try{await s(C)}catch(q){b(`Failed to duplicate rundown. ${V(q)}`)}},R=async(C,q)=>{try{await i([C,q]),j(null)}catch(B){b(`Failed to rename rundown. ${V(B)}`)}},W=async()=>{try{await n(m)}catch(C){b(`Failed to delete rundown. ${V(C)}`)}finally{r.close()}},v=async(C,q)=>{await wr(C,q)};return e.jsxs(e.Fragment,{children:[e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage project rundowns",e.jsx(L,{children:e.jsxs(f,{onClick:()=>{b(null),h.open()},children:["New ",e.jsx(ge,{})]})})]}),e.jsx(le,{}),e.jsxs(E,{children:[c&&e.jsx(fl,{onClose:h.close}),g&&e.jsx(D,{children:g}),e.jsxs(_e,{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:(O=t==null?void 0:t.rundowns)==null?void 0:O.map(({id:C,numEntries:q,title:B})=>{const F=t.loaded===C;return x===C?e.jsx("tr",{children:e.jsx("td",{colSpan:3,children:e.jsx(gl,{onCancel:()=>j(null),onSubmit:I=>R(C,I),initialTitle:B})})},C):e.jsxs("tr",{className:Se([F&&pt.current]),children:[e.jsx("td",{children:q}),e.jsxs("td",{children:[B," ",F&&e.jsx(H,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(Ht,{render:e.jsx(Y,{variant:"ghosted-white"}),items:[{type:"item",icon:Ds,label:"Rename",onClick:()=>S(C)},{type:"item",icon:rt,label:"Load",onClick:()=>y(C),disabled:F},{type:"item",icon:Ps,label:"Download .xlsx",onClick:()=>v(C,B)},{type:"item",icon:gn,label:"Duplicate",onClick:()=>k(C)},{type:"divider"},{type:"destructive",icon:pe,label:"Delete",onClick:()=>w(C),disabled:F}],children:e.jsx(Rs,{})})})]},C)})})]})]})]})}),e.jsx(jt,{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:W,children:"Delete rundown"})]})}),e.jsx(jt,{isOpen:o,onClose:u.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:u.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:A,children:"Load rundown"})]})})]})}function yl(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:a,defaultDangerTime:i,defaultTimerType:l,defaultEndAction:r,setDefaultDuration:o,setLinkPrevious:u,setTimeStrategy:c,setWarnTime:h,setDangerTime:m,setDefaultTimerType:d,setDefaultEndAction:x}=Bs(y=>y),j=qe(t),g=qe(a),b=qe(i);return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Rundown defaults"}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(Ce,{children:"Default settings for new events"}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(De,{size:"large",checked:s,onCheckedChange:u})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ie,{value:n,onValueChange:y=>{y!==null&&c(y)},options:[{value:ms.LockDuration,label:"Duration"},{value:ms.LockEnd,label:"End Time"}]})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Default duration",description:"Default duration for new events"}),e.jsx(He,{name:"defaultDuration",submitHandler:(y,w)=>o(w),time:j,placeholder:at.duration})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ie,{value:l,onValueChange:y=>{y!==null&&d(y)},options:[{value:ot.CountDown,label:"Count down"},{value:ot.CountUp,label:"Count up"},{value:ot.Clock,label:"Clock"},{value:ot.None,label:"None"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"End Action",description:"Default end action for new events"}),e.jsx(ie,{value:r,onValueChange:y=>{y!==null&&x(y)},options:[{value:kt.None,label:"None"},{value:kt.LoadNext,label:"Load next"},{value:kt.PlayNext,label:"Play next"}]})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(y,w)=>h(w),time:g,placeholder:at.warnTime})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(y,w)=>m(w),time:b,placeholder:at.dangerTime})]})]})]})]})})}function vl({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(Me,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(yl,{})}),e.jsx("div",{ref:n,children:e.jsx(jl,{})}),e.jsx("div",{ref:a,children:e.jsx(bl,{})}),e.jsx("div",{ref:i,children:e.jsx(cl,{})})]})}const wl="_textEntry_1xa10_17",Sl="_inlineEntry_1xa10_25",Cl="_redirect_1xa10_32",_l="_label_1xa10_36",Oe={textEntry:wl,inlineEntry:Sl,redirect:Cl,label:_l};function kl({id:t,isOpen:s,name:n,currentPath:a,origin:i,onClose:l}){const{data:r}=Fs(),[o,u]=p.useState(a),[c,h]=p.useState("/"),{setRedirect:m}=Ms,d=g=>{g==="/"||g===a||(g.startsWith("preset-")?m({target:t,redirect:g.slice(7)}):m({target:t,redirect:g}),l())},x=r.filter(g=>g.enabled),j=[...Hn.map(g=>({value:`/${g.url}`,label:g.label})),...x.map(g=>({value:`preset-${g.alias}`,label:`URL Preset: ${g.alias}`}))];return e.jsx(jt,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(xe,{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(zs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:Oe.inlineEntry,children:[e.jsx("span",{className:Oe.label,children:"Enter custom path"}),e.jsxs("label",{className:Oe.textEntry,children:[i,e.jsx(M,{placeholder:"eg. /timer",fluid:!0,value:o,onChange:g=>u(g.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:o===a||o==="",className:Oe.redirect,onClick:()=>d(o),children:["Redirect",e.jsx(rs,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:Oe.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:Oe.inlineEntry,children:[e.jsxs("label",{className:Oe.textEntry,children:[i,e.jsx(ie,{fluid:!0,options:j,defaultValue:j[0].value,onValueChange:g=>{g!==null&&h(g)},disabled:x.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:Oe.redirect,disabled:x.length===0||c==="/",onClick:()=>d(c),children:["Redirect ",e.jsx(rs,{})]})]})]})]})})}const Tl="_blink_vtewd_1",Nl="_halfWidthNoWrap_vtewd_25",Dl="_copiable_vtewd_30",Ot="_self_vtewd_35",st={blink:Tl,halfWidthNoWrap:Nl,copiable:Dl,self:Ot};function Pl(){const t=cs(j=>j.id),s=cs(j=>j.clients),[n,a]=Ee(),[i,l]=Ee(),{setIdentify:r}=Ms,[o,u]=p.useState(""),c=j=>{u(j),l.open()},h=j=>{u(j),a.open()},m=Object.entries(s).filter(([j,{type:g}])=>g==="ontime"),d=Object.entries(s).filter(([j,{type:g}])=>g!=="ontime"),x=s[o];return e.jsxs(e.Fragment,{children:[n&&x!==void 0&&e.jsx(kl,{id:o,name:x.name,origin:x.origin,currentPath:x.path,isOpen:n,onClose:a.close}),i&&e.jsx(qn,{id:o,name:x==null?void 0:x.name,isOpen:i,onClose:l.close}),e.jsxs(E,{children:[e.jsxs(Ce,{children:["Ontime Clients (",m.length,")"]}),e.jsxs(_e,{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:m.map(([j,g])=>{const{identify:b,name:y,path:w}=g,S=t===j;return e.jsxs("tr",{className:Se([S&&st.self]),children:[e.jsxs(L,{relation:"inner",as:"td",children:[S&&e.jsx(H,{children:"SELF"}),y]}),e.jsx("td",{className:st.copiable,children:w}),e.jsxs(L,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${b?st.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:()=>c(j),children:"Rename"}),e.jsx(f,{size:"small",disabled:S,"data-testid":S?"":"not-self-redirect",onClick:()=>h(j),children:"Redirect"})]})]},j)})})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsxs(Ce,{children:["Other Clients (",d.length,")"]}),e.jsxs(_e,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:st.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:st.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:d.map(([j,g])=>{const{name:b,type:y}=g;return e.jsxs("tr",{children:[e.jsx("td",{children:b}),e.jsx("td",{children:y})]},j)})})]})]})]})}function Rl(){return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsx(J,{children:"Manage clients"}),e.jsx(le,{}),e.jsx(Pl,{})]})})}const El="_iconRotate_l21m9_17",Il={iconRotate:El};function Ll(){const t=s=>{$s("log",s)};return e.jsx(E,{children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(ft,{className:Il.iconRotate})]})]}),e.jsx(le,{}),e.jsx(Qn,{})]})})}function Al({location:t}){const s=re("clients",t),n=re("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Network"}),Yn,e.jsx("div",{ref:n,children:e.jsx(Ll,{})}),e.jsx("div",{ref:s,children:e.jsx(Rl,{})})]})}const ws={project:{title:""},settings:{timeFormat:"24",language:"en"}};function Ol({isOpen:t,onClose:s}){var y,w,S,A;const{defaultWarnTime:n,defaultDangerTime:a,setDangerTime:i,setWarnTime:l}=Bs(),{handleSubmit:r,register:o,formState:{errors:u,isSubmitting:c,isValid:h},watch:m,setError:d,setValue:x}=de({defaultValues:ws,values:ws,resetOptions:{keepDirtyValues:!0}}),j=async k=>{try{k.project.title===""&&(k.project.title="untitled"),await Lr(k),await Ye(),s()}catch(R){d("root",{message:V(R)})}},g=qe(n),b=qe(a);return e.jsx(qt,{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(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Project title",description:"Shown as the title in some views"}),e.jsx(M,{maxLength:150,placeholder:"Project title",fluid:!0,...o("project.title")})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Time format",description:"Default time format to show in views 12 / 24 hours (does not affect editor)",error:(w=(y=u.settings)==null?void 0:y.timeFormat)==null?void 0:w.message}),e.jsx(ie,{value:m("settings.timeFormat"),onValueChange:k=>{k!==null&&x("settings.timeFormat",k,{shouldDirty:!0})},defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Views language",description:"Language to be displayed in views",error:(A=(S=u.settings)==null?void 0:S.language)==null?void 0:A.message}),e.jsx(ie,{value:m("settings.language"),onValueChange:k=>{k!==null&&x("settings.language",k,{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(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(k,R)=>l(R),time:g,placeholder:at.warnTime})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(k,R)=>i(R),time:b,placeholder:at.dangerTime})]})]})]}),footerElements:e.jsxs(e.Fragment,{children:[(u==null?void 0:u.root)&&e.jsx(D,{children:u.root.message}),e.jsx(f,{variant:"ghosted",onClick:s,disabled:!1,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",form:"quick-start",disabled:!h,loading:c,children:"Create project"})]})})}const Fl="_current_13n43_17",$l="_isEditing_13n43_21",Vl="_form_13n43_25",Ml="_formInput_13n43_33",Wl="_saveButton_13n43_37",Ul="_containCell_13n43_41",Bl="_sortableHeader_13n43_45",zl="_innerColumn_13n43_55",Gl="_inlineLabels_13n43_63",Kl="_warningInfo_13n43_68",Hl="_empty_13n43_72",me={current:Fl,isEditing:$l,form:Vl,formInput:Ml,saveButton:Wl,containCell:Ul,sortableHeader:Bl,innerColumn:zl,inlineLabels:Gl,warningInfo:Kl,empty:Hl};function ql({onClose:t}){const[s,n]=p.useState(null),{handleSubmit:a,register:i,formState:{isSubmitting:l,isValid:r},setFocus:o}=de({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{o("title")},[o]);const u=async c=>{try{n(null);const h=c.title??"untitled";await Ir({filename:h}),t()}catch(h){n(V(h))}};return e.jsxs(ze,{as:"form",onSubmit:a(u),onKeyDown:c=>ke(c,t),children:[e.jsxs(Ce,{children:["Create new project",e.jsxs(L,{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(D,{children:s}),e.jsxs(E,{className:me.innerColumn,children:[e.jsx(ae,{children:"Project title"}),e.jsx(M,{fluid:!0,placeholder:"Your project name",...i("title")})]})]})}const Ql={files:[],lastLoadedProject:""};function Yl(){const{data:t,status:s,refetch:n}=Ft({queryKey:Jn,queryFn:({signal:a})=>Ar({signal:a}),placeholderData:(a,i)=>a,refetchInterval:Vs});return{data:t??Ql,status:s,refetch:n}}const Jl={"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 ln(t="modified-desc"){const s=Yl(),{files:n,lastLoadedProject:a}=s.data,i=p.useMemo(()=>{if(!n.length)return[];const l=[...n].sort(Jl[t]),r=l.findIndex(o=>o.filename===a);if(r>0){const[o]=l.splice(r,1);l.unshift(o)}return l},[n,a,t]);return{...s,data:{reorderedProjectFiles:i,lastLoadedProject:s.data.lastLoadedProject}}}function Xl({action:t,filename:s,onSubmit:n,onCancel:a}){const{handleSubmit:i,register:l,formState:{isSubmitting:r,isDirty:o,isValid:u},setFocus:c}=de({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return p.useEffect(()=>{c("filename")},[c]),e.jsxs("form",{onSubmit:i(n),onKeyDown:h=>ke(h,a),className:me.form,children:[e.jsx(M,{className:me.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(L,{relation:"inner",children:[e.jsx(f,{onClick:a,variant:"ghosted",disabled:r,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!o||!u||r,type:"submit",className:me.saveButton,children:t})]})]})}async function Zl(t,s){const n={};for(const a in s)Ha(a,t)&&s[a]&&(a==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[a]:t[a]}));return n}function eo({onClose:t,fileName:s}){const[n,a]=p.useState(null),i=$t(),{handleSubmit:l,watch:r,setValue:o,formState:{isSubmitting:u,isValid:c,isDirty:h}}=de({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),m=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 en(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 g=await Zl(j,d);await sn(g),await i.invalidateQueries({queryKey:Xn}),t()}catch(j){a(V(j))}};return e.jsxs(E,{as:"form",onSubmit:l(m),children:[e.jsxs(Ce,{children:["Partial project merge",e.jsxs(L,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:u,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:!c||!h,loading:u,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(D,{children:n}),e.jsxs(E,{className:Se([me.innerColumn,me.inlineLabels]),children:[e.jsxs(ae,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(xe,{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(De,{size:"large",checked:r("project"),onCheckedChange:d=>o("project",d,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("rundowns"),onCheckedChange:d=>o("rundowns",d,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("viewSettings"),onCheckedChange:d=>o("viewSettings",d,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("urlPresets"),onCheckedChange:d=>o("urlPresets",d,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(De,{size:"large",checked:r("automation"),onCheckedChange:d=>o("automation",d,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function to({current:t,updatedAt:s,editingFilename:n,editingMode:a,filename:i,onRefetch:l,onSubmit:r,onToggleEditMode:o}){const[u,c]=p.useState(null),[h,m]=p.useState(!1),d=k=>async R=>{m(!0),c(null);try{if(!R.filename){c("Filename cannot be blank");return}await(k==="rename"?$r:Fr)(i,R.filename),await l(),r()}catch(W){c(V(W))}finally{m(!1)}},x=async k=>{m(!0),c(null);try{await nn(k),await l(),await Ye()}catch(R){c(V(R))}finally{m(!1)}},j=async k=>{m(!0),c(null);try{await Vr(k),await l()}catch(R){c(V(R))}finally{m(!1)}},g=(k,R)=>{c(null),o(k,R)},b=()=>{g(null,null)},y=i===n,w=(a==="rename"||a==="duplicate")&&i===n,S=a==="merge"&&y,A=Se([t&&!y&&me.current,y&&me.isEditing]);return e.jsxs(e.Fragment,{children:[u&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(D,{children:u})})},"filename-error"),e.jsx("tr",{className:A,children:w?e.jsx("td",{colSpan:99,children:e.jsx(Xl,{action:a,filename:i,onSubmit:d(a==="duplicate"?"duplicate":"rename"),onCancel:b})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:me.containCell,children:i}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(so,{current:t,filename:i,onChangeEditMode:g,onDelete:j,onLoad:x,isDisabled:h||S,onMerge:k=>g("merge",k)})})]})},i),S&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(eo,{onClose:b,fileName:i})})})]})}function so(t){const{current:s,filename:n,isDisabled:a,onChangeEditMode:i,onDelete:l,onLoad:r,onMerge:o}=t,u=()=>{i("rename",n)},c=()=>{i("duplicate",n)},h=async()=>{await Er(n)};return e.jsx(Ht,{render:e.jsx(Y,{variant:"ghosted-white"}),disabled:a,items:[{type:"item",icon:rt,label:"Load",onClick:()=>r(n),disabled:s},{type:"item",icon:rt,label:"Partial Load",onClick:()=>o(n),disabled:s},{type:"item",icon:Ds,label:"Rename",onClick:u},{type:"item",icon:fn,label:"Duplicate",onClick:c},{type:"item",icon:Ps,label:"Download",onClick:h},{type:"divider"},{type:"item",icon:pe,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(Rs,{})})}function no(){const[t,s]=p.useState(null),[n,a]=p.useState(null),[i,l]=p.useState("modified-desc"),{data:r,refetch:o,status:u}=ln(i),c=(j,g)=>{s(b=>b===j&&g===n?null:j),a(g)},h=()=>{s(null),a(null)},m=async()=>{await o()},d=j=>{l(g=>{const b=g===`${j}-asc`;return`${j}-${b?"desc":"asc"}`})};if(u==="pending")return e.jsx("div",{className:me.empty,children:e.jsx(Be,{isLoading:!0})});const x=r.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[x>20&&e.jsxs(xe,{className:me.warningInfo,type:"warning",children:["You have ",x," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(_e,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:me.containCell,onClick:()=>d("alphabetical"),children:e.jsxs("span",{className:me.sortableHeader,children:["File Name",e.jsx(Ss,{sortMode:i,type:"alphabetical"})]})}),e.jsx("th",{onClick:()=>d("modified"),children:e.jsxs("span",{className:me.sortableHeader,children:["Last Used",e.jsx(Ss,{sortMode:i,type:"modified"})]})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.reorderedProjectFiles.map(j=>e.jsx(to,{filename:j.filename,updatedAt:j.updatedAt,onToggleEditMode:c,onSubmit:h,onRefetch:m,editingFilename:n,editingMode:t,current:j.filename===r.lastLoadedProject},j.filename))})]})]})}function Ss({sortMode:t,type:s}){const n=`${s}-`;return t===`${n}asc`?e.jsx(Es,{}):t===`${n}desc`?e.jsx(ft,{}):null}function ao(){const[t,s]=bn(),[n,a]=p.useState(""),[i,l]=p.useState(null),r=p.useRef(null),o=t.get("new")==="true",u=()=>{t.set("new",o?"false":"true"),s(t)},c=()=>{var d;(d=r.current)==null||d.click()},h=async d=>{var j,g;const x=(g=(j=d.target)==null?void 0:j.files)==null?void 0:g[0];if(x){l("import");try{Zs(x),await tn(x)}catch(b){const y=V(b);a(`Error uploading file: ${y}`)}finally{await Ye()}l(null)}},m=()=>{t.delete("new"),s(t)};return e.jsxs(E,{children:[e.jsx("input",{ref:r,style:{display:"none"},type:"file",onChange:h,accept:".json","data-testid":"file-input"}),e.jsxs(ne,{children:[e.jsxs(J,{children:["Manage projects",e.jsxs(L,{children:[e.jsx(f,{onClick:c,disabled:!!i||o,loading:i==="import",children:"Import"}),e.jsxs(f,{onClick:u,disabled:!!i||o,children:["New ",e.jsx(ge,{})]})]})]}),n&&e.jsx(D,{children:n}),e.jsx(le,{}),o&&e.jsx(ql,{onClose:m}),e.jsx(no,{})]})]})}function io({location:t,setLocation:s}){const n=re("list",t),a=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Project"}),e.jsx(Ol,{isOpen:t==="create",onClose:a}),e.jsx("div",{ref:n,children:e.jsx(ao,{})})]})}const ro="_container_cq029_17",lo={container:ro};function Cs({register:t,formName:s,disabled:n}){const[a,i]=p.useState(!1);return e.jsxs("div",{className:lo.container,children:[e.jsx(M,{type:a?"text":"password",maxLength:4,...t(s,{pattern:{value:Ia,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(Y,{onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(yn,{})})]})}const oo=p.lazy(()=>lt(()=>import("./CustomTranslationModal-CML7Vsot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url));function co(){var k,R,W,v,O;const{data:t,status:s,refetch:n}=Zn(),{handleSubmit:a,register:i,reset:l,setError:r,watch:o,setValue:u,formState:{isSubmitting:c,isDirty:h,isValid:m,errors:d}}=de({mode:"onChange",defaultValues:t,resetOptions:{keepDirtyValues:!0}}),[x,j]=Ee();p.useEffect(()=>{t&&l(t)},[t,l]);const g=async C=>{try{await ea(C)}catch(q){const B=V(q);r("root",{message:B})}finally{await n()}},b=s==="pending",y=c||!h||!m,w="",S=()=>{l(t)},A=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(oo,{isOpen:x,onClose:j.close}),e.jsx(E,{as:"form",onSubmit:a(g),onKeyDown:C=>ke(C,S),id:"app-settings",children:e.jsxs(ne,{children:[e.jsxs(J,{children:["General settings",e.jsxs(L,{children:[e.jsx(f,{disabled:!h||c,variant:"ghosted",onClick:S,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:c,disabled:y,variant:"primary",children:"Save"})]})]}),w,e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(xe,{children:"Changes to the time format and views language do not affect the editor view"}),e.jsx(Be,{isLoading:A}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Ontime server port",description:Qe?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(k=d.serverPort)==null?void 0:k.message}),e.jsx(M,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Qe,...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:Ws,message:"Value should be numeric"}})})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(R=d.editorKey)==null?void 0:R.message}),e.jsx(Cs,{register:i,formName:"editorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(W=d.operatorKey)==null?void 0:W.message}),e.jsx(Cs,{register:i,formName:"operatorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Time format",description:"Default time format to show in views 12 / 24 hours",error:(v=d.timeFormat)==null?void 0:v.message}),e.jsx(ie,{value:o("timeFormat"),onValueChange:C=>{C!==null&&u("timeFormat",C,{shouldDirty:!0})},defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Views language",description:"Language to be displayed in views",error:(O=d.language)==null?void 0:O.message}),e.jsx(ie,{value:o("language"),onValueChange:C=>{C!==null&&u("language",C,{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 uo="_uploadLogoCard_m5263_17",ho="_customDataItem_m5263_32",mo="_titleRow_m5263_39",xo="_customImage_m5263_48",jo="_imageContainer_m5263_54",Ke={uploadLogoCard:uo,customDataItem:ho,titleRow:mo,customImage:xo,imageContainer:jo};function po(){var B;const{data:t,status:s}=ni(),{updateProjectData:n}=ai(),{handleSubmit:a,register:i,reset:l,formState:{isSubmitting:r,isValid:o,isDirty:u,errors:c},setError:h,clearErrors:m,watch:d,control:x,setValue:j}=de({defaultValues:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:g,append:b,remove:y}=mt({control:x,name:"custom"});p.useEffect(()=>{t&&l(t)},[t,l]);const w=async F=>{var I;const P=(I=F.target.files)==null?void 0:I[0];if(m("logo"),!!P)try{Rr(P);const N=await ii(P);j("logo",N.data.logoFilename,{shouldDirty:!0})}catch(N){const K=V(N);h("logo",{message:K})}},{ref:S,...A}=i("logo"),k=p.useRef(null),R=()=>{var F;(F=k.current)==null||F.click()},W=F=>{F.preventDefault(),F.stopPropagation(),j("logo",null,{shouldDirty:!0})},v=()=>{b({title:"",value:"",url:""})},O=async F=>{try{m(),await n(F)}catch(P){const I=V(P);h("root",{message:I})}},C=()=>{l(t)},q=s==="pending";return e.jsx(E,{as:"form",onSubmit:a(O),onKeyDown:F=>ke(F,C),children:e.jsxs(ne,{children:[e.jsxs(J,{children:["Project data",e.jsxs(L,{children:[e.jsx(f,{onClick:C,disabled:r||!u,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!u||!o,loading:r,children:"Save"})]})]}),e.jsx(le,{}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:q}),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(E,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...A,ref:F=>{S(F),k.current=F},onChange:w}),e.jsxs(ne,{className:Ke.uploadLogoCard,children:[d("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${ta}/${d("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:r||!d("logo"),onClick:W,children:[e.jsx(pe,{}),"Delete"]})]}):e.jsxs(f,{disabled:r,onClick:R,type:"button",children:[e.jsx(rt,{}),"Upload logo"]}),((B=c==null?void 0:c.logo)==null?void 0:B.message)&&e.jsx(D,{children:c.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(It,{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:Wt,...i("url")})]}),e.jsxs(E,{style:{marginTop:0},children:[e.jsxs(U,{children:[e.jsx(G,{title:"Custom data",description:""}),e.jsxs(f,{onClick:v,children:["Add ",e.jsx(ge,{})]})]}),g.length>0&&g.map((F,P)=>{var N,K,$;const I=(N=c.custom)==null?void 0:N[P];return e.jsxs("div",{className:Ke.customDataItem,children:[e.jsxs("div",{className:Ke.titleRow,children:[e.jsxs("label",{className:Ke.title,children:["Title",e.jsx(M,{fluid:!0,defaultValue:F.title,placeholder:"Title of your custom data",...i(`custom.${P}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>y(P),children:[e.jsx(pe,{}),"Delete"]})]}),((K=I==null?void 0:I.title)==null?void 0:K.message)&&e.jsx(D,{children:I.title.message}),e.jsxs("label",{children:["Text",e.jsx(It,{fluid:!0,rows:3,resize:"vertical",defaultValue:F.value,placeholder:"Text of your custom data",...i(`custom.${P}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),(($=I==null?void 0:I.value)==null?void 0:$.message)&&e.jsx(D,{children:I.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Ke.customImage,children:[e.jsx(M,{fluid:!0,defaultValue:F.url,placeholder:"Paste image URL (optional)",...i(`custom.${P}.url`)}),e.jsx("div",{className:Ke.imageContainer,children:d(`custom.${P}.url`)&&e.jsx("img",{src:d(`custom.${P}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},F.id)})]})]})]})})}const go="_editorActions_18rtd_17",fo="_right_18rtd_21",bo="_column_18rtd_26",Nt={editorActions:go,right:fo,column:bo},yo=p.lazy(()=>lt(()=>import("./StyleEditor-DIHQ1PUV.js"),__vite__mapDeps([13,1,2,14]),import.meta.url));function vo({isOpen:t,onClose:s}){const[n,a]=p.useState(""),[i,l]=p.useState(!1),[r,o]=p.useState(!1),[u,c]=p.useState(!1),[h,m]=p.useState(null),d=p.useRef(null),x=async()=>{try{c(!0);const b=await sa();a(b)}catch{}finally{c(!1)}},j=async()=>{try{o(!0),d.current&&(await na(d.current.getCss()),a(d.current.getCss()),l(!1))}catch{}finally{o(!1)}},g=()=>a("");return p.useEffect(()=>{async function b(){if(t)try{const y=await aa();a(y)}catch{m("Failed to load CSS from server")}}b()},[t]),e.jsx(qt,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(p.Suspense,{fallback:null,children:e.jsx(yo,{ref:d,initialValue:n,language:"css",isDirty:i,setIsDirty:l})}),footerElements:e.jsxs("div",{className:Nt.column,children:[e.jsx(xe,{children:"Invalid CSS will be refused by the browser"}),h&&e.jsx(D,{className:Nt.right,children:`Error: ${h}`}),e.jsxs(L,{align:"apart",className:Nt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:x,disabled:r||u,children:"Reset to example"}),e.jsxs(L,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:g,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:j,disabled:r||u||!i,loading:r,children:"Save changes"})]})]})]})})}const wo="https://docs.getontime.no/features/custom-styling/";function So(){var b;const{data:t,status:s,mutateAsync:n}=ia(),[a,i]=Ee(),{control:l,handleSubmit:r,setError:o,reset:u,setValue:c,watch:h,formState:{isSubmitting:m,isDirty:d,errors:x}}=de({defaultValues:t,resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{t&&u(t)},[t,u]);const j=async y=>{try{n(y)}catch(w){const S=V(w);o("root",{message:S})}},g=()=>{u(t)};return l?e.jsx(E,{as:"form",onSubmit:r(j),onKeyDown:y=>ke(y,g),id:"view-settings",children:e.jsxs(ne,{children:[e.jsxs(J,{children:["View settings",e.jsxs(L,{children:[e.jsx(f,{disabled:!d,variant:"ghosted",onClick:g,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:m,disabled:!d,variant:"primary",children:"Save"})]})]}),e.jsx(le,{}),e.jsxs(xe,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(se,{href:wo,children:"See the docs"})]}),e.jsxs(E,{children:[e.jsx(Be,{isLoading:s==="pending"}),e.jsx(D,{children:(b=x.root)==null?void 0:b.message}),e.jsxs(ce,{children:[e.jsx(vo,{isOpen:a,onClose:i.close}),e.jsxs(U,{children:[e.jsx(G,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(De,{size:"large",checked:h("overrideStyles"),onCheckedChange:y=>c("overrideStyles",y,{shouldDirty:!0})}),e.jsx(f,{onClick:i.open,disabled:m,children:"Edit CSS override"})]})]}),e.jsxs(ce,{children:[e.jsxs(U,{children:[e.jsx(G,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(_t,{name:"normalColor",control:l})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(_t,{name:"warningColor",control:l})]}),e.jsxs(U,{children:[e.jsx(G,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(_t,{name:"dangerColor",control:l})]})]})]})]})}):null}function Co({location:t}){const s=re("data",t),n=re("general",t),a=re("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(po,{})}),e.jsx("div",{ref:n,children:e.jsx(co,{})}),e.jsx("div",{ref:a,children:e.jsx(So,{})})]})}function _o(){const{isElectron:t,sendToElectron:s}=ra(),[n,a]=Ee(),i=p.useRef(null),l=()=>{s("shutdown","now"),a.close()},r=t||xt;return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Shutdown Ontime"}),e.jsxs(E,{children:[Qe?e.jsx(la,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(Ie,{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||xt),children:"Shutdown ontime"}),!r&&e.jsx(ae,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(jt,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:a.close,bodyElements:e.jsxs(Ie,{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 ko="_corner_1dxip_17",To="_contentWrapper_1dxip_24",No="_content_1dxip_24",Dt={corner:ko,contentWrapper:To,content:No};function Do({onClose:t,children:s}){return e.jsxs("div",{className:Dt.contentWrapper,children:[e.jsx("div",{className:Dt.content,children:s}),e.jsx("div",{className:Dt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(Vt,{})]})})]})}const Po=[{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 Ro(){const{data:t}=Ys();return{options:p.useMemo(()=>Po.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Eo="_tabs_86c70_17",Io="_primary_86c70_31",Lo="_secondary_86c70_32",Ao="_active_86c70_54",Oo="_highlight_86c70_58",Fo="_split_86c70_68",We={tabs:Eo,primary:Io,secondary:Lo,active:Ao,highlight:Oo,split:Fo};function $o({selectedPanel:t,location:s}){const{options:n}=Ro();return e.jsx("ul",{className:We.tabs,children:n.map(a=>{const i=t===a.id;return a.highlight?e.jsx(Jt,{text:a.highlight,render:e.jsx("span",{}),children:e.jsx(_s,{panel:a,location:s,isSelected:i})},a.id):e.jsx(_s,{panel:a,location:s,isSelected:i},a.id)})})}function _s(t){var r;const{panel:s,isSelected:n,location:a}=t,{setLocation:i}=Xt(),l=Se([We.primary,n&&We.active,s.split&&We.split,s.highlight&&We.highlight]);return e.jsxs(p.Fragment,{children:[e.jsx("li",{onClick:()=>i(s.id),onKeyDown:o=>{ds(o)&&i(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(r=s.secondary)==null?void 0:r.map((o,u)=>{const c=o.id.split("__")[1],h=Se([We.secondary,n&&a===c?We.active:null]);return e.jsx("li",{onClick:()=>i(o.id),onKeyDown:m=>{ds(m)&&i(o.id)},className:h,role:"button",children:o.label},o.id+u)})]},s.id)}const Vo="_container_1fy3l_17",Mo={container:Vo};function Wo(){const{close:t,panel:s,location:n,setLocation:a}=Xt();return ji(t,"Escape"),e.jsx("div",{className:Mo.container,children:e.jsxs(vn,{children:[e.jsx($o,{selectedPanel:s,location:n}),e.jsxs(Do,{onClose:t,children:[s==="settings"&&e.jsx(Co,{location:n}),s==="project"&&e.jsx(io,{location:n,setLocation:a}),s==="manage"&&e.jsx(vl,{location:n}),s==="automation"&&e.jsx(Zi,{location:n}),s==="sharing"&&e.jsx(br,{location:n}),s==="network"&&e.jsx(Al,{location:n}),s==="about"&&e.jsx(yi,{}),s==="shutdown"&&e.jsx(_o,{})]})]})})}const Uo=p.memo(Bo);function Bo({children:t}){const{layoutMode:s}=Zt();return e.jsxs(ci,{navElements:t,children:[s===we.PLANNING&&e.jsx(zo,{}),s===we.TRACKING&&e.jsx(Go,{}),s===we.CONTROL&&e.jsx(Ko,{})]})}function zo(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ts.inline,children:[e.jsx(Qs,{}),e.jsx(li,{}),e.jsx(oi,{})]}),e.jsx(es,{})]})}function Go(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ts.inline,children:[e.jsx(Gs,{}),e.jsx(Ks,{}),e.jsx(Hs,{})]}),e.jsx(qs,{}),e.jsx(es,{})]})}function Ko(){return e.jsxs(e.Fragment,{children:[e.jsx(Qs,{}),e.jsxs("div",{className:ts.inline,children:[e.jsx(Gs,{}),e.jsx(Ks,{}),e.jsx(Hs,{})]}),e.jsx(qs,{}),e.jsx(es,{})]})}function Ho({onFinish:t}){const s=p.useRef(null),n=()=>{var i;(i=s.current)==null||i.click()},a=async i=>{var r,o;const l=(o=(r=i.target)==null?void 0:r.files)==null?void 0:o[0];if(l)try{Zs(l),await tn(l)}catch{}finally{await Ye(),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 qo="_sections_ar7bf_17",Qo="_column_ar7bf_23",Yo="_about_ar7bf_23",Jo="_inline_ar7bf_35",Xo="_header_ar7bf_41",Zo="_logo_ar7bf_48",ec="_buttonRow_ar7bf_53",tc="_tableContainer_ar7bf_62",sc="_table_ar7bf_62",nc="_current_ar7bf_75",ve={sections:qo,column:Qo,about:Yo,inline:Jo,header:Xo,logo:Zo,buttonRow:ec,tableContainer:tc,table:sc,current:nc};function ac(t){const{loadProject:s,onClose:n}=t,{data:a}=ln();return e.jsx("tbody",{children:a.reorderedProjectFiles.map(i=>i.filename===a.lastLoadedProject?e.jsxs("tr",{className:ve.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 ic({onClose:t}){const s=wn(),n=async l=>{try{await nn(l),await Ye(),t()}catch{}},a=async()=>{try{await Or(),await Ye(),t()}catch{}},i=()=>{s("/editor?settings=project__create"),t()};return e.jsx(qt,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:ve.sections,children:[e.jsxs("div",{className:ve.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:ve.logo}),e.jsxs("div",{children:["Ontime v",ht]}),e.jsx(se,{href:Rt,children:"Website"}),e.jsx(se,{href:Wt,children:"Read the docs"}),e.jsx(se,{href:Ls,children:"Discord server"})]}),e.jsxs("div",{className:ve.column,children:[e.jsxs("div",{className:ve.header,children:["Welcome to Ontime",e.jsx(Y,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(Vt,{})})]}),e.jsx(si,{children:"Select project"}),e.jsx("div",{className:ve.tableContainer,children:e.jsxs("table",{className:ve.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(ac,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:ve.column,children:[e.jsxs("div",{className:ve.buttonRow,children:[e.jsx(f,{onClick:a,children:"Load demo project"}),e.jsx(Ho,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:i,children:"Create new..."})]}),e.jsxs(ti,{className:ve.inline,children:[e.jsx(Aa,{defaultChecked:!0,onCheckedChange:l=>oa(l)}),"Show this modal on next startup"]})]})})}function rc(){const t=us(n=>n.showDialog),s=us(n=>n.clearDialog);return t?e.jsx(ic,{onClose:s}):null}const lc="_container_12ac0_17",oc="_itemGroup_12ac0_27",cc="_goButton_12ac0_34",dc="_iconButtonWithLabel_12ac0_35",uc="_iconButton_12ac0_35",hc="_goLabel_12ac0_55",mc="_shortcutHint_12ac0_61",xc="_addSection_12ac0_66",jc="_separator_12ac0_70",pc="_timerSection_12ac0_77",gc="_negativeIndicator_12ac0_84",fc="_auxSection_12ac0_95",bc="_auxTimeInput_12ac0_108",yc="_auxTimeDisplay_12ac0_109",Q={container:lc,itemGroup:oc,goButton:cc,iconButtonWithLabel:dc,iconButton:uc,goLabel:hc,shortcutHint:mc,addSection:xc,separator:jc,timerSection:pc,negativeIndicator:gc,auxSection:fc,auxTimeInput:bc,auxTimeDisplay:yc};function vc(){const t=ca(),{playback:s,numEvents:n,selectedEventIndex:a}=da(),{playback:i,direction:l}=ua(1),r=ha(1),[o]=Sn({key:"add-time",defaultValue:3e5}),{disableGo:u,disableNext:c,disableAddTime:h,isPlaying:m,goAction:d,goLabel:x}=ui({playback:s,numEvents:n,selectedEventIndex:a,timerPhase:t.phase}),j=h||o===0,g=v=>{j||(v==="add"?Ge.addTime(o):Ge.addTime(-1*o))},b=()=>{i===et.Start?tt.pause(1):tt.start(1)},y=()=>{tt.stop(1)},w=()=>{const v=l===ct.CountDown?ct.CountUp:ct.CountDown;tt.setDirection(1,v)},S=(v,O)=>{const C=qe(O);tt.setDuration(1,C)};Is([["Space",()=>!u&&d(),{preventDefault:!0}],["N",()=>!c&&Ge.next(),{preventDefault:!0}],["Escape",()=>s!==Ze.Stop&&Ge.stop(),{preventDefault:!0}]]);const A=t.phase===hs.Pending,k=t.phase===hs.Overtime,R=A?t.secondaryTimer:t.current,W=Kt(o);return e.jsxs("div",{className:Q.container,children:[e.jsxs("div",{className:Q.itemGroup,children:[e.jsxs(Ae,{onClick:d,disabled:u,theme:Ze.Play,active:m,className:Q.goButton,children:[e.jsx("span",{className:Q.goLabel,children:x}),e.jsx("span",{className:Q.shortcutHint,children:"[space]"})]}),e.jsxs(Ae,{onClick:Ge.next,disabled:c,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(Cn,{}),e.jsx("span",{className:Q.shortcutHint,children:"[n]"})]}),e.jsxs(Ae,{onClick:Ge.stop,disabled:s===Ze.Stop,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(ls,{}),e.jsx("span",{className:Q.shortcutHint,children:"[esc]"})]}),e.jsxs("div",{className:Q.addSection,children:[e.jsx("div",{className:Q.separator}),e.jsxs(Ae,{onClick:()=>g("remove"),disabled:j,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(_n,{}),W]}),e.jsxs(Ae,{onClick:()=>g("add"),disabled:j,className:Q.iconButtonWithLabel,aspect:"square",children:[e.jsx(ge,{}),W]})]})]}),e.jsxs("div",{className:Q.timerSection,children:[e.jsx("span",{className:Q.negativeIndicator,"data-active":k,children:Et}),e.jsx(hi,{time:R,phase:t.phase})]}),e.jsxs("div",{className:Q.auxSection,children:[e.jsx(Ae,{onClick:b,className:Q.iconButton,theme:Ze.Play,aspect:"square",children:i===et.Start?e.jsx(kn,{}):e.jsx(Tn,{})}),e.jsx(Ae,{onClick:y,disabled:i===et.Stop,className:Q.iconButton,theme:Ze.Stop,aspect:"square",children:e.jsx(ls,{})}),i!==et.Stop?e.jsx("div",{className:Q.auxTimeDisplay,children:Fe(r)}):e.jsx(He,{name:"aux1-tracking",submitHandler:S,time:r,className:Q.auxTimeInput}),e.jsx(Ae,{onClick:w,disabled:i!==et.Stop,className:Q.iconButton,aspect:"square",children:l===ct.CountDown?e.jsx(Es,{}):e.jsx(ft,{})})]})]})}const ks=5;function wc(t){const s=t.findIndex(i=>i.isLoaded),n=s!==-1?t[s]:null,a=(n==null?void 0:n.eventIndex)??0;return{index:s,id:(n==null?void 0:n.id)??null,eventIndex:a,upcomingChipLimit:a>0?a+ks:ks}}const Sc="_container_qfgjn_17",Cc="_emptyState_qfgjn_22",_c="_emptyMessage_qfgjn_30",kc="_emptyTitle_qfgjn_36",Tc="_emptyBody_qfgjn_43",nt={container:Sc,emptyState:Cc,emptyMessage:_c,emptyTitle:kc,emptyBody:Tc};function Nc(){return e.jsx("div",{className:nt.container,children:e.jsx("div",{className:nt.emptyState,children:e.jsxs("div",{className:nt.emptyMessage,children:[e.jsx("h3",{className:nt.emptyTitle,children:"No events yet"}),e.jsx("p",{className:nt.emptyBody,children:"Add events in the rundown to populate this list."})]})})})}const Dc="_item_1nasm_17",Pc="_title_1nasm_36",Rc="_colourBar_1nasm_76",Ec="_chipSlot_1nasm_100",Ic="_chipText_1nasm_121",it={item:Dc,title:Pc,colourBar:Rc,chipSlot:Ec,chipText:Ic},Lc=p.memo(Ac);function Ac({entry:t,currentEventIndex:s,upcomingChipLimit:n,isRunning:a,mode:i,isGroupEnd:l,onSelect:r}){const o=p.useCallback(()=>{r({id:t.id,index:t.eventIndex-1,parent:t.parent??void 0})},[r,t.id,t.eventIndex,t.parent]),u=s>0&&t.eventIndex>s&&t.eventIndex<=s+2,c=i===Ue.Run&&t.isPast,h=t.isLoaded?i===Ue.Run?"running":"selected":c?"past":u?"next":"default",m=a&&!t.isLoaded&&!t.isPast&&!t.skip,d=m&&t.eventIndex<=n;return e.jsxs("li",{"data-state":h,"data-skipped":t.skip||void 0,"data-group-end":l||void 0,className:it.item,onClick:o,children:[e.jsx("div",{className:it.colourBar,style:{backgroundColor:t.groupColour||"transparent"}}),e.jsx("span",{className:it.title,children:t.title||"Untitled"}),m&&e.jsx(Oc,{timeStart:t.timeStart,delay:t.delay,dayOffset:t.dayOffset,totalGap:t.totalGap,isLinkedToLoaded:t.isLinkedToLoaded,isLoaded:t.isLoaded,showOnHover:!d})]})}const Oc=p.memo(Fc);function Fc({timeStart:t,delay:s,dayOffset:n,totalGap:a,isLinkedToLoaded:i,isLoaded:l,showOnHover:r}){const o=ma({timeStart:t,delay:s,dayOffset:n},{totalGap:a,isLinkedToLoaded:i}),u=!l&&o<ja;let c="LIVE";l||(c=u?"DUE":Kt(Math.abs(o),o>2*xa));const h=l?"live":u?"due":"pending";return e.jsx(Jt,{text:"Expected time until start",className:it.chipSlot,"data-hover-only":r||void 0,children:e.jsx("span",{"data-chip-status":h,className:it.chipText,children:c})})}const $c="_container_kcrvg_17",Vc="_list_kcrvg_24",Mc="_bottomSpacer_kcrvg_30",ns={container:$c,list:Vc,bottomSpacer:Mc};function Ts({mode:t}){const{data:s}=Yt(),n=pa(),a=La(r=>r.cursor),i=p.useMemo(()=>t===Ue.Run?n:a,[t,n,a]),l=p.useMemo(()=>qa(s,i).filter(Qt),[s,i]);return l.length===0?e.jsx(Nc,{}):e.jsx(Wc,{mode:t,eventData:l,selectedEventId:n,resolvedFollowEventId:i,rundownId:s.id})}function Wc({mode:t,eventData:s,selectedEventId:n,resolvedFollowEventId:a,rundownId:i}){"use memo";const l=p.useRef(null),r=p.useRef(null),o=ri(i),u=p.useMemo(()=>wc(s),[s]),c=p.useMemo(()=>a?s.findIndex(d=>d.id===a):-1,[s,a]),h=p.useCallback(d=>{o(d)},[o]);p.useEffect(()=>{if(!l.current)return;const d=c!==-1?c:u.index;d!==-1&&(t===Ue.Edit&&d<=3||l.current.scrollToIndex({index:d,align:"start",behavior:"smooth",offset:-50}))},[u.index,c,t]);const m=p.useCallback((d,x)=>{const j=s[d+1],g=!!x.parent&&x.parent!==((j==null?void 0:j.parent)??null);return e.jsx(Lc,{entry:x,currentEventIndex:u.eventIndex,upcomingChipLimit:u.upcomingChipLimit,isRunning:t===Ue.Run&&n!==null,mode:t,onSelect:h,isGroupEnd:g},x.id)},[s,u.eventIndex,u.upcomingChipLimit,t,n,h]);return e.jsx(di,{className:ns.container,ref:r,children:e.jsx(Nn,{ref:l,data:s,computeItemKey:(d,x)=>x.id,itemContent:m,increaseViewportBy:{top:200,bottom:200},customScrollParent:r.current??void 0,components:{List:on,Footer:Uc}})})}function on({children:t,...s}){return e.jsx("ul",{...s,className:ns.list,children:t})}on.displayName="VirtuosoListComponent";function Uc(){return e.jsx("div",{className:ns.bottomSpacer})}const Bc="_panelContainer_1exbp_17",zc="_panelContainerTracking_1exbp_26",Gc="_left_1exbp_31",Kc="_rundownLayout_1exbp_40",Hc="_rundownPanel_1exbp_48",qc="_titlesPanel_1exbp_55",be={panelContainer:Bc,panelContainerTracking:zc,left:Gc,rundownLayout:Kc,rundownPanel:Hc,titlesPanel:qc},Pt=p.lazy(()=>lt(()=>import("./RundownExport-25orDQIW.js"),__vite__mapDeps([15,1,2,16,3,4,17,18,19,20,7,5,6,8,9,10,11,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url)),Qc=p.lazy(()=>lt(()=>import("./TimerControlExport-Ba1vifNg.js"),__vite__mapDeps([41,1,2,16,3,4,17,18,19,21,22,23,42,43,25,26,37,44]),import.meta.url)),Yc=p.lazy(()=>lt(()=>import("./MessageControlExport-BgT9JaXk.js"),__vite__mapDeps([45,1,2,16,3,4,17,18,19,8,9,25,26,46]),import.meta.url));function Jc(){const{layoutMode:t}=Zt();return t===we.CONTROL?e.jsxs("div",{id:"panels",className:be.panelContainer,children:[e.jsxs("div",{className:be.left,children:[e.jsx(Qc,{}),e.jsx(Yc,{})]}),e.jsx(Pt,{})]}):t===we.TRACKING?e.jsxs("div",{id:"panels",className:`${be.panelContainer} ${be.panelContainerTracking}`,children:[e.jsxs("div",{className:be.rundownLayout,children:[e.jsx("div",{className:be.titlesPanel,children:e.jsx(Ts,{mode:Ue.Run})}),e.jsx("div",{className:be.rundownPanel,children:e.jsx(Pt,{})})]}),e.jsx(vc,{})]}):e.jsx("div",{id:"panels",className:be.panelContainer,children:e.jsxs("div",{className:be.rundownLayout,children:[e.jsx("div",{className:be.titlesPanel,children:e.jsx(Ts,{mode:Ue.Edit})}),e.jsx("div",{className:be.rundownPanel,children:e.jsx(Pt,{})})]})})}const Xc=p.memo(Zc);function Zc(){const{layoutMode:t,setLayoutMode:s}=Zt(),n=p.useMemo(()=>[{type:"item",label:"Planning",description:"Edit-focused list with planning stats",icon:t===we.PLANNING?ut:void 0,onClick:()=>s(we.PLANNING)},{type:"item",label:"Tracking",description:"Live timing view with progress and offsets",icon:t===we.TRACKING?ut:void 0,onClick:()=>s(we.TRACKING)},{type:"item",label:"Control",description:"All controls and rundown together",icon:t===we.CONTROL?ut:void 0,onClick:()=>s(we.CONTROL)}],[t,s]);return e.jsx(Ht,{render:e.jsx(Y,{"aria-label":"Layout mode",variant:"subtle-white",size:"xlarge"}),items:n,children:e.jsx(Dn,{})})}const ed="_mainContainer_1m0yz_17",td={mainContainer:ed};function Td(){const{isOpen:t,setLocation:s,close:n}=Xt(),[a,i]=Ee();ya("Editor"),ga(),p.useEffect(()=>{var r;((r=window.process)==null?void 0:r.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=p.useCallback(()=>{t?n():s("settings")},[n,t,s]);return Is([["mod + ,",l]]),e.jsx(ba,{permission:"editor",children:e.jsxs("div",{className:td.mainContainer,"data-testid":"event-editor",children:[e.jsx(rc,{}),e.jsx(fa,{isOpen:a,onClose:i.close}),t?e.jsx(Wo,{}):e.jsx(Jc,{}),e.jsxs(Uo,{children:[e.jsx(Y,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:i.open,children:e.jsx(Pn,{})}),e.jsx(Y,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(Vt,{}):e.jsx(Rn,{})}),e.jsx(Xc,{})]})]})})}export{Td as default};
3
+ //# sourceMappingURL=ProtectedEditor-CsfvVyOU.js.map