@getontime/cli 4.4.2 → 4.5.0

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 (370) hide show
  1. package/client/assets/{Backstage-BdrcXNr9.js → Backstage-DQu8ne-1.js} +2 -2
  2. package/client/assets/Backstage-DQu8ne-1.js.br +0 -0
  3. package/client/assets/Backstage-DQu8ne-1.js.gz +0 -0
  4. package/client/assets/{Backstage-BdrcXNr9.js.map → Backstage-DQu8ne-1.js.map} +1 -1
  5. package/client/assets/{Countdown-DQM2ppPg.js → Countdown-COte1yne.js} +2 -2
  6. package/client/assets/Countdown-COte1yne.js.br +0 -0
  7. package/client/assets/Countdown-COte1yne.js.gz +0 -0
  8. package/client/assets/{Countdown-DQM2ppPg.js.map → Countdown-COte1yne.js.map} +1 -1
  9. package/client/assets/CuesheetTable-BQfxAp-I.js +2 -0
  10. package/client/assets/CuesheetTable-BQfxAp-I.js.br +0 -0
  11. package/client/assets/CuesheetTable-BQfxAp-I.js.gz +0 -0
  12. package/client/assets/CuesheetTable-BQfxAp-I.js.map +1 -0
  13. package/client/assets/CustomTranslationModal-C5mAtBjW.js +2 -0
  14. package/client/assets/CustomTranslationModal-C5mAtBjW.js.br +0 -0
  15. package/client/assets/CustomTranslationModal-C5mAtBjW.js.gz +0 -0
  16. package/client/assets/{CustomTranslationModal-CML7Vsot.js.map → CustomTranslationModal-C5mAtBjW.js.map} +1 -1
  17. package/client/assets/{DelayIndicator-DKS6mZdB.js → DelayIndicator-B0cudY9N.js} +2 -2
  18. package/client/assets/DelayIndicator-B0cudY9N.js.br +0 -0
  19. package/client/assets/DelayIndicator-B0cudY9N.js.gz +0 -0
  20. package/client/assets/DelayIndicator-B0cudY9N.js.map +1 -0
  21. package/client/assets/{EditorFeatureWrapper-C1vLQxiy.js → EditorFeatureWrapper-DpDaCaJ3.js} +2 -2
  22. package/client/assets/EditorFeatureWrapper-DpDaCaJ3.js.br +0 -0
  23. package/client/assets/EditorFeatureWrapper-DpDaCaJ3.js.gz +0 -0
  24. package/client/assets/{EditorFeatureWrapper-C1vLQxiy.js.map → EditorFeatureWrapper-DpDaCaJ3.js.map} +1 -1
  25. package/client/assets/{EditorUtils-BLcTuWz1.js → EditorUtils-k5KpETPG.js} +2 -2
  26. package/client/assets/EditorUtils-k5KpETPG.js.br +0 -0
  27. package/client/assets/EditorUtils-k5KpETPG.js.gz +0 -0
  28. package/client/assets/{EditorUtils-BLcTuWz1.js.map → EditorUtils-k5KpETPG.js.map} +1 -1
  29. package/client/assets/EmptyPage-aTb22KTq.js +2 -0
  30. package/client/assets/EmptyPage-aTb22KTq.js.br +0 -0
  31. package/client/assets/EmptyPage-aTb22KTq.js.gz +0 -0
  32. package/client/assets/{EmptyPage-CYVrjOvI.js.map → EmptyPage-aTb22KTq.js.map} +1 -1
  33. package/client/assets/{FollowButton-DcSbb4R_.js → FollowButton--Bj9S6jO.js} +2 -2
  34. package/client/assets/FollowButton--Bj9S6jO.js.br +0 -0
  35. package/client/assets/FollowButton--Bj9S6jO.js.gz +0 -0
  36. package/client/assets/{FollowButton-DcSbb4R_.js.map → FollowButton--Bj9S6jO.js.map} +1 -1
  37. package/client/assets/MessageControlExport-BN6OfADo.js +3 -0
  38. package/client/assets/MessageControlExport-BN6OfADo.js.br +0 -0
  39. package/client/assets/MessageControlExport-BN6OfADo.js.gz +0 -0
  40. package/client/assets/{MessageControlExport-BgT9JaXk.js.map → MessageControlExport-BN6OfADo.js.map} +1 -1
  41. package/client/assets/{MultiPartProgressBar-W2a-JWPY.js → MultiPartProgressBar-BlLJNQ0D.js} +2 -2
  42. package/client/assets/MultiPartProgressBar-BlLJNQ0D.js.br +0 -0
  43. package/client/assets/MultiPartProgressBar-BlLJNQ0D.js.gz +0 -0
  44. package/client/assets/{MultiPartProgressBar-W2a-JWPY.js.map → MultiPartProgressBar-BlLJNQ0D.js.map} +1 -1
  45. package/client/assets/{OperatorExport-CbWojpp6.js → OperatorExport-CmgIl1lz.js} +2 -2
  46. package/client/assets/OperatorExport-CmgIl1lz.js.br +0 -0
  47. package/client/assets/OperatorExport-CmgIl1lz.js.gz +0 -0
  48. package/client/assets/OperatorExport-CmgIl1lz.js.map +1 -0
  49. package/client/assets/OverviewWrapper-B4nU68Eq.js +2 -0
  50. package/client/assets/OverviewWrapper-B4nU68Eq.js.br +0 -0
  51. package/client/assets/OverviewWrapper-B4nU68Eq.js.gz +0 -0
  52. package/client/assets/{OverviewWrapper-B2i8d3rt.js.map → OverviewWrapper-B4nU68Eq.js.map} +1 -1
  53. package/client/assets/OverviewWrapper-fPfl6o_p.css +1 -0
  54. package/client/assets/OverviewWrapper-fPfl6o_p.css.br +0 -0
  55. package/client/assets/OverviewWrapper-fPfl6o_p.css.gz +0 -0
  56. package/client/assets/{PipHost-Dz2oy7XG.js → PipHost-BZy7ouDv.js} +2 -2
  57. package/client/assets/PipHost-BZy7ouDv.js.br +0 -0
  58. package/client/assets/PipHost-BZy7ouDv.js.gz +0 -0
  59. package/client/assets/{PipHost-Dz2oy7XG.js.map → PipHost-BZy7ouDv.js.map} +1 -1
  60. package/client/assets/{ProjectInfo-BR_7Hp5u.js → ProjectInfo-D0X9vdIX.js} +2 -2
  61. package/client/assets/ProjectInfo-D0X9vdIX.js.br +0 -0
  62. package/client/assets/ProjectInfo-D0X9vdIX.js.gz +0 -0
  63. package/client/assets/{ProjectInfo-BR_7Hp5u.js.map → ProjectInfo-D0X9vdIX.js.map} +1 -1
  64. package/client/assets/ProtectRoute-DSilyhst.js +2 -0
  65. package/client/assets/ProtectRoute-DSilyhst.js.br +0 -0
  66. package/client/assets/ProtectRoute-DSilyhst.js.gz +0 -0
  67. package/client/assets/{ProtectRoute-Bxq6q7ba.js.map → ProtectRoute-DSilyhst.js.map} +1 -1
  68. package/client/assets/ProtectedCuesheet-DRTfZTZN.js +2 -0
  69. package/client/assets/ProtectedCuesheet-DRTfZTZN.js.br +0 -0
  70. package/client/assets/ProtectedCuesheet-DRTfZTZN.js.gz +0 -0
  71. package/client/assets/ProtectedCuesheet-DRTfZTZN.js.map +1 -0
  72. package/client/assets/ProtectedEditor-DNOiQqIU.js +3 -0
  73. package/client/assets/ProtectedEditor-DNOiQqIU.js.br +0 -0
  74. package/client/assets/ProtectedEditor-DNOiQqIU.js.gz +0 -0
  75. package/client/assets/ProtectedEditor-DNOiQqIU.js.map +1 -0
  76. package/client/assets/ProtectedEditor-DyaLP0mG.css +1 -0
  77. package/client/assets/ProtectedEditor-DyaLP0mG.css.br +0 -0
  78. package/client/assets/ProtectedEditor-DyaLP0mG.css.gz +0 -0
  79. package/client/assets/{RundownExport-25orDQIW.js → RundownExport-Bvc1J50m.js} +2 -2
  80. package/client/assets/RundownExport-Bvc1J50m.js.br +0 -0
  81. package/client/assets/RundownExport-Bvc1J50m.js.gz +0 -0
  82. package/client/assets/RundownExport-Bvc1J50m.js.map +1 -0
  83. package/client/assets/{Select-BnGTAeXJ.js → Select-CvUrsmYI.js} +2 -2
  84. package/client/assets/Select-CvUrsmYI.js.br +0 -0
  85. package/client/assets/Select-CvUrsmYI.js.gz +0 -0
  86. package/client/assets/{Select-BnGTAeXJ.js.map → Select-CvUrsmYI.js.map} +1 -1
  87. package/client/assets/{Studio-BK2Klo_K.js → Studio-BSSiKd6k.js} +2 -2
  88. package/client/assets/Studio-BSSiKd6k.js.br +0 -0
  89. package/client/assets/Studio-BSSiKd6k.js.gz +0 -0
  90. package/client/assets/{Studio-BK2Klo_K.js.map → Studio-BSSiKd6k.js.map} +1 -1
  91. package/client/assets/{StyleEditor-DIHQ1PUV.js → StyleEditor-buc-zQHR.js} +2 -2
  92. package/client/assets/StyleEditor-buc-zQHR.js.br +0 -0
  93. package/client/assets/StyleEditor-buc-zQHR.js.gz +0 -0
  94. package/client/assets/{StyleEditor-DIHQ1PUV.js.map → StyleEditor-buc-zQHR.js.map} +1 -1
  95. package/client/assets/{SuperscriptPeriod-EEedc9rG.js → SuperscriptPeriod-CSX8zFgq.js} +2 -2
  96. package/client/assets/SuperscriptPeriod-CSX8zFgq.js.br +0 -0
  97. package/client/assets/SuperscriptPeriod-CSX8zFgq.js.gz +0 -0
  98. package/client/assets/{SuperscriptPeriod-EEedc9rG.js.map → SuperscriptPeriod-CSX8zFgq.js.map} +1 -1
  99. package/client/assets/{SuperscriptTime-BVanhNvd.js → SuperscriptTime-retbmT5o.js} +2 -2
  100. package/client/assets/SuperscriptTime-retbmT5o.js.br +0 -0
  101. package/client/assets/SuperscriptTime-retbmT5o.js.gz +0 -0
  102. package/client/assets/{SuperscriptTime-BVanhNvd.js.map → SuperscriptTime-retbmT5o.js.map} +1 -1
  103. package/client/assets/SwatchPicker-DuWAohyD.js +2 -0
  104. package/client/assets/SwatchPicker-DuWAohyD.js.br +0 -0
  105. package/client/assets/SwatchPicker-DuWAohyD.js.gz +0 -0
  106. package/client/assets/{SwatchPicker-Ckpchvjo.js.map → SwatchPicker-DuWAohyD.js.map} +1 -1
  107. package/client/assets/TimeElements-BfxdLkpO.js +2 -0
  108. package/client/assets/TimeElements-BfxdLkpO.js.br +0 -0
  109. package/client/assets/TimeElements-BfxdLkpO.js.gz +0 -0
  110. package/client/assets/{TimeElements-CYIgGk0T.js.map → TimeElements-BfxdLkpO.js.map} +1 -1
  111. package/client/assets/{TimeInput-Cwl9vLWA.js → TimeInput-BjOTgjcv.js} +2 -2
  112. package/client/assets/TimeInput-BjOTgjcv.js.br +0 -0
  113. package/client/assets/TimeInput-BjOTgjcv.js.gz +0 -0
  114. package/client/assets/{TimeInput-Cwl9vLWA.js.map → TimeInput-BjOTgjcv.js.map} +1 -1
  115. package/client/assets/{TimelinePage-D4QNdk-Z.js → TimelinePage-pjff5TxG.js} +2 -2
  116. package/client/assets/TimelinePage-pjff5TxG.js.br +0 -0
  117. package/client/assets/TimelinePage-pjff5TxG.js.gz +0 -0
  118. package/client/assets/TimelinePage-pjff5TxG.js.map +1 -0
  119. package/client/assets/{Timer-BJQKNHfo.js → Timer-ahF-O2zN.js} +2 -2
  120. package/client/assets/Timer-ahF-O2zN.js.br +0 -0
  121. package/client/assets/Timer-ahF-O2zN.js.gz +0 -0
  122. package/client/assets/{Timer-BJQKNHfo.js.map → Timer-ahF-O2zN.js.map} +1 -1
  123. package/client/assets/TimerControlExport-De2n8HWG.js +2 -0
  124. package/client/assets/TimerControlExport-De2n8HWG.js.br +0 -0
  125. package/client/assets/TimerControlExport-De2n8HWG.js.gz +0 -0
  126. package/client/assets/TimerControlExport-De2n8HWG.js.map +1 -0
  127. package/client/assets/TimerDisplay-DeFQvmo9.js +2 -0
  128. package/client/assets/TimerDisplay-DeFQvmo9.js.br +0 -0
  129. package/client/assets/TimerDisplay-DeFQvmo9.js.gz +0 -0
  130. package/client/assets/{TimerDisplay-tVcUk9j3.js.map → TimerDisplay-DeFQvmo9.js.map} +1 -1
  131. package/client/assets/{TitleCard-BNjv58eq.js → TitleCard-BiaQE4ZK.js} +2 -2
  132. package/client/assets/TitleCard-BiaQE4ZK.js.br +0 -0
  133. package/client/assets/TitleCard-BiaQE4ZK.js.gz +0 -0
  134. package/client/assets/{TitleCard-BNjv58eq.js.map → TitleCard-BiaQE4ZK.js.map} +1 -1
  135. package/client/assets/{Tooltip-DZJ7u9gm.js → Tooltip-C5iPq6NR.js} +2 -2
  136. package/client/assets/Tooltip-C5iPq6NR.js.br +0 -0
  137. package/client/assets/Tooltip-C5iPq6NR.js.gz +0 -0
  138. package/client/assets/{Tooltip-DZJ7u9gm.js.map → Tooltip-C5iPq6NR.js.map} +1 -1
  139. package/client/assets/{ViewLogo-2I7w5Yms.js → ViewLogo-DcDhyyIF.js} +2 -2
  140. package/client/assets/ViewLogo-DcDhyyIF.js.br +0 -0
  141. package/client/assets/ViewLogo-DcDhyyIF.js.gz +0 -0
  142. package/client/assets/{ViewLogo-2I7w5Yms.js.map → ViewLogo-DcDhyyIF.js.map} +1 -1
  143. package/client/assets/{ViewParamsEditor-BX2RM8sx.js → ViewParamsEditor-DeMdkxxC.js} +2 -2
  144. package/client/assets/ViewParamsEditor-DeMdkxxC.js.br +0 -0
  145. package/client/assets/ViewParamsEditor-DeMdkxxC.js.gz +0 -0
  146. package/client/assets/{ViewParamsEditor-BX2RM8sx.js.map → ViewParamsEditor-DeMdkxxC.js.map} +1 -1
  147. package/client/assets/{editorSettings-_x6YKRfR.js → editorSettings-xk5GwlLv.js} +2 -2
  148. package/client/assets/editorSettings-xk5GwlLv.js.br +0 -0
  149. package/client/assets/editorSettings-xk5GwlLv.js.gz +0 -0
  150. package/client/assets/{editorSettings-_x6YKRfR.js.map → editorSettings-xk5GwlLv.js.map} +1 -1
  151. package/client/assets/{getProgress-ZUTmCn_v.js → getProgress-CWSCZOIN.js} +2 -2
  152. package/client/assets/getProgress-CWSCZOIN.js.br +0 -0
  153. package/client/assets/getProgress-CWSCZOIN.js.gz +0 -0
  154. package/client/assets/{getProgress-ZUTmCn_v.js.map → getProgress-CWSCZOIN.js.map} +1 -1
  155. package/client/assets/index-3aosT33y.js +3 -0
  156. package/client/assets/index-3aosT33y.js.br +0 -0
  157. package/client/assets/index-3aosT33y.js.gz +0 -0
  158. package/client/assets/index-3aosT33y.js.map +1 -0
  159. package/client/assets/{offset-VthsmtrO.js → offset-yVqq_CB1.js} +2 -2
  160. package/client/assets/offset-yVqq_CB1.js.br +0 -0
  161. package/client/assets/offset-yVqq_CB1.js.gz +0 -0
  162. package/client/assets/{offset-VthsmtrO.js.map → offset-yVqq_CB1.js.map} +1 -1
  163. package/client/assets/parseUserTime-wAKk9aCJ.js +2 -0
  164. package/client/assets/parseUserTime-wAKk9aCJ.js.br +0 -0
  165. package/client/assets/parseUserTime-wAKk9aCJ.js.gz +0 -0
  166. package/client/assets/{parseUserTime-sZbEBi61.js.map → parseUserTime-wAKk9aCJ.js.map} +1 -1
  167. package/client/assets/{playbackstate-Dl_ZJABT.js → playbackstate-BZ9WYn2k.js} +2 -2
  168. package/client/assets/playbackstate-BZ9WYn2k.js.br +0 -0
  169. package/client/assets/playbackstate-BZ9WYn2k.js.gz +0 -0
  170. package/client/assets/{playbackstate-Dl_ZJABT.js.map → playbackstate-BZ9WYn2k.js.map} +1 -1
  171. package/client/assets/{presentation.utils-Z61KykAH.js → presentation.utils-lyuuD4A5.js} +2 -2
  172. package/client/assets/presentation.utils-lyuuD4A5.js.br +0 -0
  173. package/client/assets/presentation.utils-lyuuD4A5.js.gz +0 -0
  174. package/client/assets/{presentation.utils-Z61KykAH.js.map → presentation.utils-lyuuD4A5.js.map} +1 -1
  175. package/client/assets/{rundownUtils-CXZRD6yP.js → rundownUtils-XX_c4Pcl.js} +2 -2
  176. package/client/assets/rundownUtils-XX_c4Pcl.js.br +0 -0
  177. package/client/assets/rundownUtils-XX_c4Pcl.js.gz +0 -0
  178. package/client/assets/{rundownUtils-CXZRD6yP.js.map → rundownUtils-XX_c4Pcl.js.map} +1 -1
  179. package/client/assets/{timer.utils-B4bvsns3.js → timer.utils-CWHFVz06.js} +2 -2
  180. package/client/assets/timer.utils-CWHFVz06.js.br +0 -0
  181. package/client/assets/timer.utils-CWHFVz06.js.gz +0 -0
  182. package/client/assets/{timer.utils-B4bvsns3.js.map → timer.utils-CWHFVz06.js.map} +1 -1
  183. package/client/assets/useCustomFields-kBD1jvDA.js +2 -0
  184. package/client/assets/useCustomFields-kBD1jvDA.js.br +0 -0
  185. package/client/assets/useCustomFields-kBD1jvDA.js.gz +0 -0
  186. package/client/assets/{useCustomFields-BBE4LBBr.js.map → useCustomFields-kBD1jvDA.js.map} +1 -1
  187. package/client/assets/{useEventSelection-Bpbu89c7.js → useEventSelection-Cvdw9all.js} +2 -2
  188. package/client/assets/useEventSelection-Cvdw9all.js.br +0 -0
  189. package/client/assets/useEventSelection-Cvdw9all.js.gz +0 -0
  190. package/client/assets/{useEventSelection-Bpbu89c7.js.map → useEventSelection-Cvdw9all.js.map} +1 -1
  191. package/client/assets/{useProjectData-C110zIXC.js → useProjectData-gGT2eczr.js} +2 -2
  192. package/client/assets/useProjectData-gGT2eczr.js.br +0 -0
  193. package/client/assets/useProjectData-gGT2eczr.js.gz +0 -0
  194. package/client/assets/{useProjectData-C110zIXC.js.map → useProjectData-gGT2eczr.js.map} +1 -1
  195. package/client/assets/{useReport-DqSBq4MG.js → useReport-CG6m_Zb0.js} +2 -2
  196. package/client/assets/useReport-CG6m_Zb0.js.br +0 -0
  197. package/client/assets/useReport-CG6m_Zb0.js.gz +0 -0
  198. package/client/assets/{useReport-DqSBq4MG.js.map → useReport-CG6m_Zb0.js.map} +1 -1
  199. package/client/assets/{useRundown-DAo6huE4.js → useRundown-C6stroSA.js} +2 -2
  200. package/client/assets/useRundown-C6stroSA.js.br +0 -0
  201. package/client/assets/useRundown-C6stroSA.js.gz +0 -0
  202. package/client/assets/useRundown-C6stroSA.js.map +1 -0
  203. package/client/assets/{useSelectAndRevealEntry-DTg0hmxA.js → useSelectAndRevealEntry-D79sYFHr.js} +2 -2
  204. package/client/assets/useSelectAndRevealEntry-D79sYFHr.js.br +0 -0
  205. package/client/assets/useSelectAndRevealEntry-D79sYFHr.js.gz +0 -0
  206. package/client/assets/{useSelectAndRevealEntry-DTg0hmxA.js.map → useSelectAndRevealEntry-D79sYFHr.js.map} +1 -1
  207. package/client/assets/{useWindowTitle-DM8dIp8L.js → useWindowTitle-CQ8nEeel.js} +2 -2
  208. package/client/assets/useWindowTitle-CQ8nEeel.js.br +0 -0
  209. package/client/assets/useWindowTitle-CQ8nEeel.js.gz +0 -0
  210. package/client/assets/{useWindowTitle-DM8dIp8L.js.map → useWindowTitle-CQ8nEeel.js.map} +1 -1
  211. package/client/assets/{validateEvent-GnPt-e9-.js → validateEvent-BnwPmDph.js} +2 -2
  212. package/client/assets/validateEvent-BnwPmDph.js.br +0 -0
  213. package/client/assets/validateEvent-BnwPmDph.js.gz +0 -0
  214. package/client/assets/{validateEvent-GnPt-e9-.js.map → validateEvent-BnwPmDph.js.map} +1 -1
  215. package/client/assets/{vendor-BKUJ0_Du.js → vendor-Dt3_Fdfs.js} +2 -2
  216. package/client/assets/vendor-Dt3_Fdfs.js.br +0 -0
  217. package/client/assets/vendor-Dt3_Fdfs.js.gz +0 -0
  218. package/client/assets/{vendor-BKUJ0_Du.js.map → vendor-Dt3_Fdfs.js.map} +1 -1
  219. package/client/assets/{viewLoader.utils-4lL4PiNI.js → viewLoader.utils-H7r-zNPP.js} +2 -2
  220. package/client/assets/viewLoader.utils-H7r-zNPP.js.br +0 -0
  221. package/client/assets/viewLoader.utils-H7r-zNPP.js.gz +0 -0
  222. package/client/assets/{viewLoader.utils-4lL4PiNI.js.map → viewLoader.utils-H7r-zNPP.js.map} +1 -1
  223. package/client/assets/{viewUtils-29a3Mmiu.js → viewUtils-k0tARVDN.js} +2 -2
  224. package/client/assets/viewUtils-k0tARVDN.js.br +0 -0
  225. package/client/assets/viewUtils-k0tARVDN.js.gz +0 -0
  226. package/client/assets/{viewUtils-29a3Mmiu.js.map → viewUtils-k0tARVDN.js.map} +1 -1
  227. package/client/index.html +2 -2
  228. package/package.json +1 -1
  229. package/server/index.cjs +104 -104
  230. package/client/assets/Backstage-BdrcXNr9.js.br +0 -0
  231. package/client/assets/Backstage-BdrcXNr9.js.gz +0 -0
  232. package/client/assets/Countdown-DQM2ppPg.js.br +0 -0
  233. package/client/assets/Countdown-DQM2ppPg.js.gz +0 -0
  234. package/client/assets/CuesheetTable-B5LQVh5m.js +0 -2
  235. package/client/assets/CuesheetTable-B5LQVh5m.js.br +0 -0
  236. package/client/assets/CuesheetTable-B5LQVh5m.js.gz +0 -0
  237. package/client/assets/CuesheetTable-B5LQVh5m.js.map +0 -1
  238. package/client/assets/CustomTranslationModal-CML7Vsot.js +0 -2
  239. package/client/assets/CustomTranslationModal-CML7Vsot.js.br +0 -0
  240. package/client/assets/CustomTranslationModal-CML7Vsot.js.gz +0 -0
  241. package/client/assets/DelayIndicator-DKS6mZdB.js.br +0 -0
  242. package/client/assets/DelayIndicator-DKS6mZdB.js.gz +0 -0
  243. package/client/assets/DelayIndicator-DKS6mZdB.js.map +0 -1
  244. package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.br +0 -0
  245. package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.gz +0 -0
  246. package/client/assets/EditorUtils-BLcTuWz1.js.br +0 -0
  247. package/client/assets/EditorUtils-BLcTuWz1.js.gz +0 -0
  248. package/client/assets/EmptyPage-CYVrjOvI.js +0 -2
  249. package/client/assets/EmptyPage-CYVrjOvI.js.br +0 -0
  250. package/client/assets/EmptyPage-CYVrjOvI.js.gz +0 -0
  251. package/client/assets/FollowButton-DcSbb4R_.js.br +0 -0
  252. package/client/assets/FollowButton-DcSbb4R_.js.gz +0 -0
  253. package/client/assets/MessageControlExport-BgT9JaXk.js +0 -3
  254. package/client/assets/MessageControlExport-BgT9JaXk.js.br +0 -0
  255. package/client/assets/MessageControlExport-BgT9JaXk.js.gz +0 -0
  256. package/client/assets/MultiPartProgressBar-W2a-JWPY.js.br +0 -0
  257. package/client/assets/MultiPartProgressBar-W2a-JWPY.js.gz +0 -0
  258. package/client/assets/OperatorExport-CbWojpp6.js.br +0 -0
  259. package/client/assets/OperatorExport-CbWojpp6.js.gz +0 -0
  260. package/client/assets/OperatorExport-CbWojpp6.js.map +0 -1
  261. package/client/assets/OverviewWrapper-B2i8d3rt.js +0 -2
  262. package/client/assets/OverviewWrapper-B2i8d3rt.js.br +0 -0
  263. package/client/assets/OverviewWrapper-B2i8d3rt.js.gz +0 -0
  264. package/client/assets/OverviewWrapper-DOYzR0Ef.css +0 -1
  265. package/client/assets/OverviewWrapper-DOYzR0Ef.css.br +0 -0
  266. package/client/assets/OverviewWrapper-DOYzR0Ef.css.gz +0 -0
  267. package/client/assets/PipHost-Dz2oy7XG.js.br +0 -0
  268. package/client/assets/PipHost-Dz2oy7XG.js.gz +0 -0
  269. package/client/assets/ProjectInfo-BR_7Hp5u.js.br +0 -0
  270. package/client/assets/ProjectInfo-BR_7Hp5u.js.gz +0 -0
  271. package/client/assets/ProtectRoute-Bxq6q7ba.js +0 -2
  272. package/client/assets/ProtectRoute-Bxq6q7ba.js.br +0 -0
  273. package/client/assets/ProtectRoute-Bxq6q7ba.js.gz +0 -0
  274. package/client/assets/ProtectedCuesheet-C7AqD2dy.js +0 -2
  275. package/client/assets/ProtectedCuesheet-C7AqD2dy.js.br +0 -0
  276. package/client/assets/ProtectedCuesheet-C7AqD2dy.js.gz +0 -0
  277. package/client/assets/ProtectedCuesheet-C7AqD2dy.js.map +0 -1
  278. package/client/assets/ProtectedEditor-CsfvVyOU.js +0 -3
  279. package/client/assets/ProtectedEditor-CsfvVyOU.js.br +0 -0
  280. package/client/assets/ProtectedEditor-CsfvVyOU.js.gz +0 -0
  281. package/client/assets/ProtectedEditor-CsfvVyOU.js.map +0 -1
  282. package/client/assets/ProtectedEditor-DID9cfOA.css +0 -1
  283. package/client/assets/ProtectedEditor-DID9cfOA.css.br +0 -0
  284. package/client/assets/ProtectedEditor-DID9cfOA.css.gz +0 -0
  285. package/client/assets/RundownExport-25orDQIW.js.br +0 -0
  286. package/client/assets/RundownExport-25orDQIW.js.gz +0 -0
  287. package/client/assets/RundownExport-25orDQIW.js.map +0 -1
  288. package/client/assets/Select-BnGTAeXJ.js.br +0 -0
  289. package/client/assets/Select-BnGTAeXJ.js.gz +0 -0
  290. package/client/assets/Studio-BK2Klo_K.js.br +0 -0
  291. package/client/assets/Studio-BK2Klo_K.js.gz +0 -0
  292. package/client/assets/StyleEditor-DIHQ1PUV.js.br +0 -0
  293. package/client/assets/StyleEditor-DIHQ1PUV.js.gz +0 -0
  294. package/client/assets/SuperscriptPeriod-EEedc9rG.js.br +0 -0
  295. package/client/assets/SuperscriptPeriod-EEedc9rG.js.gz +0 -0
  296. package/client/assets/SuperscriptTime-BVanhNvd.js.br +0 -0
  297. package/client/assets/SuperscriptTime-BVanhNvd.js.gz +0 -0
  298. package/client/assets/SwatchPicker-Ckpchvjo.js +0 -2
  299. package/client/assets/SwatchPicker-Ckpchvjo.js.br +0 -0
  300. package/client/assets/SwatchPicker-Ckpchvjo.js.gz +0 -0
  301. package/client/assets/TimeElements-CYIgGk0T.js +0 -2
  302. package/client/assets/TimeElements-CYIgGk0T.js.br +0 -0
  303. package/client/assets/TimeElements-CYIgGk0T.js.gz +0 -0
  304. package/client/assets/TimeInput-Cwl9vLWA.js.br +0 -0
  305. package/client/assets/TimeInput-Cwl9vLWA.js.gz +0 -0
  306. package/client/assets/TimelinePage-D4QNdk-Z.js.br +0 -0
  307. package/client/assets/TimelinePage-D4QNdk-Z.js.gz +0 -0
  308. package/client/assets/TimelinePage-D4QNdk-Z.js.map +0 -1
  309. package/client/assets/Timer-BJQKNHfo.js.br +0 -0
  310. package/client/assets/Timer-BJQKNHfo.js.gz +0 -0
  311. package/client/assets/TimerControlExport-Ba1vifNg.js +0 -2
  312. package/client/assets/TimerControlExport-Ba1vifNg.js.br +0 -0
  313. package/client/assets/TimerControlExport-Ba1vifNg.js.gz +0 -0
  314. package/client/assets/TimerControlExport-Ba1vifNg.js.map +0 -1
  315. package/client/assets/TimerDisplay-tVcUk9j3.js +0 -2
  316. package/client/assets/TimerDisplay-tVcUk9j3.js.br +0 -0
  317. package/client/assets/TimerDisplay-tVcUk9j3.js.gz +0 -0
  318. package/client/assets/TitleCard-BNjv58eq.js.br +0 -0
  319. package/client/assets/TitleCard-BNjv58eq.js.gz +0 -0
  320. package/client/assets/Tooltip-DZJ7u9gm.js.br +0 -4
  321. package/client/assets/Tooltip-DZJ7u9gm.js.gz +0 -0
  322. package/client/assets/ViewLogo-2I7w5Yms.js.br +0 -0
  323. package/client/assets/ViewLogo-2I7w5Yms.js.gz +0 -0
  324. package/client/assets/ViewParamsEditor-BX2RM8sx.js.br +0 -0
  325. package/client/assets/ViewParamsEditor-BX2RM8sx.js.gz +0 -0
  326. package/client/assets/editorSettings-_x6YKRfR.js.br +0 -6
  327. package/client/assets/editorSettings-_x6YKRfR.js.gz +0 -0
  328. package/client/assets/getProgress-ZUTmCn_v.js.br +0 -0
  329. package/client/assets/getProgress-ZUTmCn_v.js.gz +0 -0
  330. package/client/assets/index-Dm-4OTmY.js +0 -3
  331. package/client/assets/index-Dm-4OTmY.js.br +0 -0
  332. package/client/assets/index-Dm-4OTmY.js.gz +0 -0
  333. package/client/assets/index-Dm-4OTmY.js.map +0 -1
  334. package/client/assets/offset-VthsmtrO.js.br +0 -0
  335. package/client/assets/offset-VthsmtrO.js.gz +0 -0
  336. package/client/assets/parseUserTime-sZbEBi61.js +0 -2
  337. package/client/assets/parseUserTime-sZbEBi61.js.br +0 -0
  338. package/client/assets/parseUserTime-sZbEBi61.js.gz +0 -0
  339. package/client/assets/playbackstate-Dl_ZJABT.js.br +0 -0
  340. package/client/assets/playbackstate-Dl_ZJABT.js.gz +0 -0
  341. package/client/assets/presentation.utils-Z61KykAH.js.br +0 -0
  342. package/client/assets/presentation.utils-Z61KykAH.js.gz +0 -0
  343. package/client/assets/rundownUtils-CXZRD6yP.js.br +0 -0
  344. package/client/assets/rundownUtils-CXZRD6yP.js.gz +0 -0
  345. package/client/assets/timer.utils-B4bvsns3.js.br +0 -0
  346. package/client/assets/timer.utils-B4bvsns3.js.gz +0 -0
  347. package/client/assets/useCustomFields-BBE4LBBr.js +0 -2
  348. package/client/assets/useCustomFields-BBE4LBBr.js.br +0 -0
  349. package/client/assets/useCustomFields-BBE4LBBr.js.gz +0 -0
  350. package/client/assets/useEventSelection-Bpbu89c7.js.br +0 -0
  351. package/client/assets/useEventSelection-Bpbu89c7.js.gz +0 -0
  352. package/client/assets/useProjectData-C110zIXC.js.br +0 -0
  353. package/client/assets/useProjectData-C110zIXC.js.gz +0 -0
  354. package/client/assets/useReport-DqSBq4MG.js.br +0 -0
  355. package/client/assets/useReport-DqSBq4MG.js.gz +0 -0
  356. package/client/assets/useRundown-DAo6huE4.js.br +0 -0
  357. package/client/assets/useRundown-DAo6huE4.js.gz +0 -0
  358. package/client/assets/useRundown-DAo6huE4.js.map +0 -1
  359. package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.br +0 -0
  360. package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.gz +0 -0
  361. package/client/assets/useWindowTitle-DM8dIp8L.js.br +0 -0
  362. package/client/assets/useWindowTitle-DM8dIp8L.js.gz +0 -0
  363. package/client/assets/validateEvent-GnPt-e9-.js.br +0 -0
  364. package/client/assets/validateEvent-GnPt-e9-.js.gz +0 -0
  365. package/client/assets/vendor-BKUJ0_Du.js.br +0 -0
  366. package/client/assets/vendor-BKUJ0_Du.js.gz +0 -0
  367. package/client/assets/viewLoader.utils-4lL4PiNI.js.br +0 -0
  368. package/client/assets/viewLoader.utils-4lL4PiNI.js.gz +0 -0
  369. package/client/assets/viewUtils-29a3Mmiu.js.br +0 -0
  370. package/client/assets/viewUtils-29a3Mmiu.js.gz +0 -0
@@ -0,0 +1,2 @@
1
+ import{h as d,j as e,A as f}from"./vendor-Dt3_Fdfs.js";import{e as h,ah as p,ak as b,bX as g,U as x}from"./index-3aosT33y.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="9b03d113-450b-45f2-8c0c-2d5d6891fce6",t._sentryDebugIdIdentifier="sentry-dbid-9b03d113-450b-45f2-8c0c-2d5d6891fce6")}catch{}})();const y="_container_o8th0_17",_="_pin_o8th0_27",m="_pinFailed_o8th0_51",c={container:y,pin:_,pinFailed:m};function v({permission:t,handleValidation:n}){const[s,o]=d.useState(""),[i,r]=d.useState(!1),u=()=>{n(s)||(r(!0),o(""))},l=a=>{o(a),i&&r(!1)};return e.jsxs("div",{className:c.container,children:[`Ontime ${t}`,e.jsxs("form",{onSubmit:a=>{a.preventDefault(),u()},className:h([c.pin,i&&c.pinFailed]),children:[e.jsx(p,{type:"password",maxLength:4,height:"large",value:s,onChange:a=>l(a.target.value)}),e.jsx(b,{type:"submit",variant:"primary","aria-label":"Enter",children:e.jsx(f,{})})]})]})}function w({permission:t,children:n}){const{editorAuth:s,operatorAuth:o,validate:i}=d.useContext(g),r=d.useCallback(l=>i(l,t),[t,i]);return x||(t==="editor"?s:t==="operator"?o:!1)?e.jsx(e.Fragment,{children:n}):e.jsx(v,{permission:t,handleValidation:r})}export{w as P};
2
+ //# sourceMappingURL=ProtectRoute-DSilyhst.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProtectRoute-Bxq6q7ba.js","sources":["../../src/common/components/protect-route/PinPage.tsx","../../src/common/components/protect-route/ProtectRoute.tsx"],"sourcesContent":["import { PropsWithChildren, useState } from 'react';\nimport { IoCheckmark } from 'react-icons/io5';\n\nimport { cx } from '../../utils/styleUtils';\nimport IconButton from '../buttons/IconButton';\nimport Input from '../input/input/Input';\n\nimport style from './PinPage.module.scss';\n\ninterface PinPageProps {\n permission: 'editor' | 'operator';\n handleValidation: (pin: string) => boolean;\n}\n\nexport default function PinPage({ permission, handleValidation }: PropsWithChildren<PinPageProps>) {\n const [pin, setPin] = useState('');\n const [failed, setFailed] = useState(false);\n\n const validate = () => {\n const isValid = handleValidation(pin);\n if (!isValid) {\n setFailed(true);\n setPin('');\n }\n };\n\n const handleInputChange = (value: string) => {\n setPin(value);\n if (failed) setFailed(false);\n };\n\n return (\n <div className={style.container}>\n {`Ontime ${permission}`}\n <form\n onSubmit={(event) => {\n event.preventDefault();\n validate();\n }}\n className={cx([style.pin, failed && style.pinFailed])}\n >\n <Input\n type='password'\n maxLength={4}\n height='large'\n value={pin}\n onChange={(e) => handleInputChange(e.target.value)}\n />\n <IconButton type='submit' variant='primary' aria-label='Enter'>\n <IoCheckmark />\n </IconButton>\n </form>\n </div>\n );\n}\n","import { PropsWithChildren, useCallback, useContext } from 'react';\n\nimport { isLocalhost } from '../../../externals';\nimport { AppContext } from '../../context/AppContext';\n\nimport PinPage from './PinPage';\n\ninterface ProtectRouteProps {\n permission: 'editor' | 'operator';\n}\n\nexport default function ProtectRoute({ permission, children }: PropsWithChildren<ProtectRouteProps>) {\n const { editorAuth, operatorAuth, validate } = useContext(AppContext);\n\n const handleValidation = useCallback(\n (pin: string) => {\n return validate(pin, permission);\n },\n [permission, validate],\n );\n\n const hasRelevantAuth = () => {\n if (permission === 'editor') {\n return editorAuth;\n }\n if (permission === 'operator') {\n return operatorAuth;\n }\n return false;\n };\n\n if (isLocalhost || hasRelevantAuth()) {\n // eslint-disable-next-line react/jsx-no-useless-fragment -- trying to make typescript happy\n return <>{children}</>;\n }\n\n return <PinPage permission={permission} handleValidation={handleValidation} />;\n}\n"],"names":["PinPage","permission","handleValidation","pin","setPin","useState","failed","setFailed","validate","handleInputChange","value","jsxs","style","container","event","preventDefault","cx","pinFailed","jsx","Input","e","target","IconButton","IoCheckmark","ProtectRoute","children","editorAuth","operatorAuth","useContext","AppContext","useCallback","isLocalhost"],"mappings":"kkBAcA,SAAwBA,EAAQ,CAAEC,WAAAA,EAAYC,iBAAAA,CAAkD,EAAG,CACjG,KAAM,CAACC,EAAKC,CAAM,EAAIC,EAAAA,SAAS,EAAE,EAC3B,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAS,EAAK,EAEpCG,EAAWA,IAAM,CACLN,EAAiBC,CAAG,IAElCI,EAAU,EAAI,EACdH,EAAO,EAAE,EAEb,EAEMK,EAAqBC,GAAkB,CAC3CN,EAAOM,CAAK,EACRJ,KAAkB,EAAK,CAC7B,EAEA,OACGK,EAAAA,KAAA,MAAA,CAAI,UAAWC,EAAMC,UACnB,SAAA,CAAA,UAAUZ,CAAU,GACrBU,EAAAA,KAAC,OACC,CAAA,SAAqBG,GAAA,CACnBA,EAAMC,eAAe,EACZP,EAAA,CAAA,EAEX,UAAWQ,EAAG,CAACJ,EAAMT,IAAKG,GAAUM,EAAMK,SAAS,CAAC,EAEpD,SAAA,CAAAC,EAAA,IAACC,EACC,CAAA,KAAK,WACL,UAAW,EACX,OAAO,QACP,MAAOhB,EACP,SAAiBM,GAAAA,EAAkBW,EAAEC,OAAOX,KAAK,EAAE,EAErDQ,EAAAA,IAACI,EAAW,CAAA,KAAK,SAAS,QAAQ,UAAU,aAAW,QACrD,SAACJ,EAAA,IAAAK,EAAA,CAAW,CAAA,CACd,CAAA,CAAA,CACF,CAAA,CAAA,EACF,CAEJ,CC3CA,SAAwBC,EAAa,CAAEvB,WAAAA,EAAYwB,SAAAA,CAA+C,EAAG,CAC7F,KAAA,CAAEC,WAAAA,EAAYC,aAAAA,EAAcnB,SAAAA,CAAAA,EAAaoB,EAAAA,WAAWC,CAAU,EAE9D3B,EAAmB4B,cACtB3B,GACQK,EAASL,EAAKF,CAAU,EAEjC,CAACA,EAAYO,CAAQ,CACvB,EAYIuB,OAAAA,IATE9B,IAAe,SACVyB,EAELzB,IAAe,WACV0B,EAEF,sBAKGF,SAAAA,EAAS,EAGdP,EAAA,IAAClB,EAAQ,CAAA,WAAAC,EAAwB,iBAAAC,CAAsC,CAAA,CAChF"}
1
+ {"version":3,"file":"ProtectRoute-DSilyhst.js","sources":["../../src/common/components/protect-route/PinPage.tsx","../../src/common/components/protect-route/ProtectRoute.tsx"],"sourcesContent":["import { PropsWithChildren, useState } from 'react';\nimport { IoCheckmark } from 'react-icons/io5';\n\nimport { cx } from '../../utils/styleUtils';\nimport IconButton from '../buttons/IconButton';\nimport Input from '../input/input/Input';\n\nimport style from './PinPage.module.scss';\n\ninterface PinPageProps {\n permission: 'editor' | 'operator';\n handleValidation: (pin: string) => boolean;\n}\n\nexport default function PinPage({ permission, handleValidation }: PropsWithChildren<PinPageProps>) {\n const [pin, setPin] = useState('');\n const [failed, setFailed] = useState(false);\n\n const validate = () => {\n const isValid = handleValidation(pin);\n if (!isValid) {\n setFailed(true);\n setPin('');\n }\n };\n\n const handleInputChange = (value: string) => {\n setPin(value);\n if (failed) setFailed(false);\n };\n\n return (\n <div className={style.container}>\n {`Ontime ${permission}`}\n <form\n onSubmit={(event) => {\n event.preventDefault();\n validate();\n }}\n className={cx([style.pin, failed && style.pinFailed])}\n >\n <Input\n type='password'\n maxLength={4}\n height='large'\n value={pin}\n onChange={(e) => handleInputChange(e.target.value)}\n />\n <IconButton type='submit' variant='primary' aria-label='Enter'>\n <IoCheckmark />\n </IconButton>\n </form>\n </div>\n );\n}\n","import { PropsWithChildren, useCallback, useContext } from 'react';\n\nimport { isLocalhost } from '../../../externals';\nimport { AppContext } from '../../context/AppContext';\n\nimport PinPage from './PinPage';\n\ninterface ProtectRouteProps {\n permission: 'editor' | 'operator';\n}\n\nexport default function ProtectRoute({ permission, children }: PropsWithChildren<ProtectRouteProps>) {\n const { editorAuth, operatorAuth, validate } = useContext(AppContext);\n\n const handleValidation = useCallback(\n (pin: string) => {\n return validate(pin, permission);\n },\n [permission, validate],\n );\n\n const hasRelevantAuth = () => {\n if (permission === 'editor') {\n return editorAuth;\n }\n if (permission === 'operator') {\n return operatorAuth;\n }\n return false;\n };\n\n if (isLocalhost || hasRelevantAuth()) {\n // eslint-disable-next-line react/jsx-no-useless-fragment -- trying to make typescript happy\n return <>{children}</>;\n }\n\n return <PinPage permission={permission} handleValidation={handleValidation} />;\n}\n"],"names":["PinPage","permission","handleValidation","pin","setPin","useState","failed","setFailed","validate","handleInputChange","value","jsxs","style","container","event","preventDefault","cx","pinFailed","jsx","Input","e","target","IconButton","IoCheckmark","ProtectRoute","children","editorAuth","operatorAuth","useContext","AppContext","useCallback","isLocalhost"],"mappings":"kkBAcA,SAAwBA,EAAQ,CAAEC,WAAAA,EAAYC,iBAAAA,CAAkD,EAAG,CACjG,KAAM,CAACC,EAAKC,CAAM,EAAIC,EAAAA,SAAS,EAAE,EAC3B,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAS,EAAK,EAEpCG,EAAWA,IAAM,CACLN,EAAiBC,CAAG,IAElCI,EAAU,EAAI,EACdH,EAAO,EAAE,EAEb,EAEMK,EAAqBC,GAAkB,CAC3CN,EAAOM,CAAK,EACRJ,KAAkB,EAAK,CAC7B,EAEA,OACGK,EAAAA,KAAA,MAAA,CAAI,UAAWC,EAAMC,UACnB,SAAA,CAAA,UAAUZ,CAAU,GACrBU,EAAAA,KAAC,OACC,CAAA,SAAqBG,GAAA,CACnBA,EAAMC,eAAe,EACZP,EAAA,CAAA,EAEX,UAAWQ,EAAG,CAACJ,EAAMT,IAAKG,GAAUM,EAAMK,SAAS,CAAC,EAEpD,SAAA,CAAAC,EAAA,IAACC,EACC,CAAA,KAAK,WACL,UAAW,EACX,OAAO,QACP,MAAOhB,EACP,SAAiBM,GAAAA,EAAkBW,EAAEC,OAAOX,KAAK,EAAE,EAErDQ,EAAAA,IAACI,EAAW,CAAA,KAAK,SAAS,QAAQ,UAAU,aAAW,QACrD,SAACJ,EAAA,IAAAK,EAAA,CAAW,CAAA,CACd,CAAA,CAAA,CACF,CAAA,CAAA,EACF,CAEJ,CC3CA,SAAwBC,EAAa,CAAEvB,WAAAA,EAAYwB,SAAAA,CAA+C,EAAG,CAC7F,KAAA,CAAEC,WAAAA,EAAYC,aAAAA,EAAcnB,SAAAA,CAAAA,EAAaoB,EAAAA,WAAWC,CAAU,EAE9D3B,EAAmB4B,cACtB3B,GACQK,EAASL,EAAKF,CAAU,EAEjC,CAACA,EAAYO,CAAQ,CACvB,EAYIuB,OAAAA,IATE9B,IAAe,SACVyB,EAELzB,IAAe,WACV0B,EAEF,sBAKGF,SAAAA,EAAS,EAGdP,EAAA,IAAClB,EAAQ,CAAA,WAAAC,EAAwB,iBAAAC,CAAsC,CAAA,CAChF"}
@@ -0,0 +1,2 @@
1
+ import{o as g,h as n,j as s,aG as C,C as b,I as x}from"./vendor-Dt3_Fdfs.js";import{P as j}from"./ProtectRoute-DSilyhst.js";import{a as v,be as M,b9 as c,bf as m,bg as w,P as y,bh as P,bd as O,ak as E}from"./index-3aosT33y.js";import{u as S,g as T,m as I,C as k,a as _,E as D,b as W}from"./CuesheetTable-BQfxAp-I.js";import{u as R}from"./DelayIndicator-B0cudY9N.js";import{u as A}from"./useWindowTitle-CQ8nEeel.js";import{T as l,O as p,a as F,M as $,C as L}from"./TimeElements-BfxdLkpO.js";import{O as h,T as N}from"./OverviewWrapper-B4nU68Eq.js";import{M as z}from"./MultiPartProgressBar-BlLJNQ0D.js";import{E as V}from"./EmptyPage-aTb22KTq.js";import{u as B}from"./useCustomFields-kBD1jvDA.js";import"./useEventSelection-Cvdw9all.js";import"./SwatchPicker-DuWAohyD.js";import"./Select-CvUrsmYI.js";import"./useRundown-C6stroSA.js";import"./EditorUtils-k5KpETPG.js";import"./TimeInput-BjOTgjcv.js";import"./parseUserTime-wAKk9aCJ.js";import"./validateEvent-BnwPmDph.js";import"./Tooltip-C5iPq6NR.js";import"./offset-yVqq_CB1.js";import"./editorSettings-xk5GwlLv.js";import"./rundownUtils-XX_c4Pcl.js";import"./SuperscriptPeriod-CSX8zFgq.js";/* empty css */import"./playbackstate-BZ9WYn2k.js";import"./useProjectData-gGT2eczr.js";import"./getProgress-CWSCZOIN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="913a7498-5076-47be-8cf4-1bc177f1c419",e._sentryDebugIdIdentifier="sentry-dbid-913a7498-5076-47be-8cf4-1bc177f1c419")}catch{}})();function G(){const{width:e}=g();return n.useMemo(()=>e<800,[e])}const H=n.memo(K);function K({children:e}){return G()?s.jsx(q,{children:e}):s.jsx(J,{children:e})}function q({children:e}){return s.jsxs(h,{navElements:e,children:[s.jsx(l,{}),s.jsx(p,{})]})}function J({children:e}){return s.jsxs(h,{navElements:e,children:[s.jsx(N,{}),s.jsx(F,{shouldFormat:!0}),s.jsx(l,{}),s.jsx(p,{}),s.jsx($,{}),s.jsx(L,{shouldFormat:!0})]})}const Q="_progressOverride_av4z0_17",U={progressOverride:Q};function X(){const{data:e}=v(),{current:o,duration:r,timeWarning:t,timeDanger:u}=M();return s.jsx(z,{now:o,complete:r,normalColor:e.normalColor,warning:t,warningColor:e.warningColor,danger:u,dangerColor:e.dangerColor,className:U.progressOverride,ignoreCssOverride:!0})}function Y(e){const o=S(a=>a.setPermissions),r=w==="rw",t=n.useMemo(()=>T(e,r),[e,r]),[u,i]=C({key:e?`${e.alias}${m.cuesheetMode}`:m.cuesheetMode,defaultValue:e?c.Run:c.Edit}),d=t.canChangeMode?u:c.Run,f=n.useCallback(a=>{t.canChangeMode&&i(a)},[t.canChangeMode,i]);return n.useEffect(()=>{o(t)},[t,o]),n.useEffect(()=>{t.canChangeMode||i(a=>a===c.Run?a:c.Run)},[t.canChangeMode,i]),{cuesheetMode:d,setCuesheetMode:f}}const Z=n.memo(ee);function ee(){const{data:e,status:o}=B(),r=n.use(y),{cuesheetMode:t,setCuesheetMode:u}=Y(r),i=n.useMemo(()=>I(e,t,r),[e,t,r]),d=!e||o==="pending";return s.jsx(k,{columns:i,children:d?s.jsx(V,{text:"Loading..."}):s.jsx(_,{columns:i,cuesheetMode:t,tableRoot:"cuesheet",setCuesheetMode:u})})}const se="_tableWrapper_h9gr1_17",te={tableWrapper:se};function oe(){const[e,o]=b(),r=R();A("Cuesheet");const t=P();return s.jsxs(D,{actions:r,children:[s.jsx(O,{isOpen:e,onClose:o.close}),s.jsx(W,{}),s.jsxs("div",{className:te.tableWrapper,"data-testid":"cuesheet",children:[s.jsx(H,{children:!t&&s.jsx(E,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:o.open,children:s.jsx(x,{})})}),s.jsx(X,{}),s.jsx(Z,{})]})]})}function _e(){return s.jsx(j,{permission:"operator",children:s.jsx(oe,{})})}export{_e as default};
2
+ //# sourceMappingURL=ProtectedCuesheet-DRTfZTZN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtectedCuesheet-DRTfZTZN.js","sources":["../../src/common/hooks/useIsMobileScreen.ts","../../src/features/overview/CuesheetOverview.tsx","../../src/views/cuesheet/cuesheet-progress/CuesheetProgress.tsx","../../src/views/cuesheet/useApplyCuesheetPolicy.ts","../../src/views/cuesheet/CuesheetTableWrapper.tsx","../../src/views/cuesheet/CuesheetPage.tsx","../../src/views/cuesheet/ProtectedCuesheet.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { useViewportSize } from '@mantine/hooks';\n\nexport function useIsMobileScreen(): boolean {\n const { width } = useViewportSize();\n\n return useMemo(() => width < 800, [width]);\n}\n","import { memo, PropsWithChildren } from 'react';\n\nimport { useIsMobileScreen } from '../../common/hooks/useIsMobileScreen';\n\nimport {\n ClockOverview,\n MetadataTimes,\n OffsetOverview,\n StartTimesRuntime,\n TimerOverview,\n} from './composite/TimeElements';\nimport TitleOverview from './composite/TitleOverview';\nimport { OverviewWrapper } from './OverviewWrapper';\n\nexport default memo(CuesheetOverview);\nfunction CuesheetOverview({ children }: PropsWithChildren) {\n const isMobileScreen = useIsMobileScreen();\n\n if (isMobileScreen) {\n return <CuesheetMobile>{children}</CuesheetMobile>;\n }\n return <CuesheetDesktop>{children}</CuesheetDesktop>;\n}\n\nfunction CuesheetMobile({ children }: PropsWithChildren) {\n return (\n <OverviewWrapper navElements={children}>\n <TimerOverview />\n <OffsetOverview />\n </OverviewWrapper>\n );\n}\n\nfunction CuesheetDesktop({ children }: PropsWithChildren) {\n return (\n <OverviewWrapper navElements={children}>\n <TitleOverview />\n <StartTimesRuntime shouldFormat />\n <TimerOverview />\n <OffsetOverview />\n <MetadataTimes />\n <ClockOverview shouldFormat />\n </OverviewWrapper>\n );\n}\n","import MultiPartProgressBar from '../../../common/components/multi-part-progress-bar/MultiPartProgressBar';\nimport { useProgressData } from '../../../common/hooks/useSocket';\nimport useViewSettings from '../../../common/hooks-query/useViewSettings';\n\nimport styles from './CuesheetProgress.module.scss';\n\nexport default function CuesheetProgress() {\n const { data } = useViewSettings();\n const { current, duration, timeWarning, timeDanger } = useProgressData();\n\n return (\n <MultiPartProgressBar\n now={current}\n complete={duration}\n normalColor={data.normalColor}\n warning={timeWarning}\n warningColor={data.warningColor}\n danger={timeDanger}\n dangerColor={data.dangerColor}\n className={styles.progressOverride}\n ignoreCssOverride\n />\n );\n}\n","import { useCallback, useEffect, useMemo } from 'react';\nimport { useSessionStorage } from '@mantine/hooks';\nimport { URLPreset } from 'ontime-types';\n\nimport { sessionScope } from '../../externals';\nimport { AppMode, sessionKeys } from '../../ontimeConfig';\n\nimport { getCuesheetPermissionsPolicy } from './cuesheet.policies';\nimport { useCuesheetPermissions } from './useTablePermissions';\n\n/**\n * Applies cuesheet permissions to shared state and exposes the effective mode for the UI.\n */\nexport function useApplyCuesheetPolicy(preset: URLPreset | undefined): {\n cuesheetMode: AppMode;\n setCuesheetMode: (mode: AppMode) => void;\n} {\n const setPermissions = useCuesheetPermissions((state) => state.setPermissions);\n const canShareInSession = sessionScope === 'rw';\n const permissions = useMemo(\n () => getCuesheetPermissionsPolicy(preset, canShareInSession),\n [preset, canShareInSession],\n );\n\n const [storedCuesheetMode, setStoredCuesheetMode] = useSessionStorage({\n key: preset ? `${preset.alias}${sessionKeys.cuesheetMode}` : sessionKeys.cuesheetMode,\n defaultValue: preset ? AppMode.Run : AppMode.Edit,\n });\n\n const cuesheetMode = permissions.canChangeMode ? storedCuesheetMode : AppMode.Run;\n const setCuesheetMode = useCallback(\n (mode: AppMode) => {\n if (!permissions.canChangeMode) {\n return;\n }\n\n setStoredCuesheetMode(mode);\n },\n [permissions.canChangeMode, setStoredCuesheetMode],\n );\n\n // Keep the shared permissions store aligned with the active preset policy.\n useEffect(() => {\n setPermissions(permissions);\n }, [permissions, setPermissions]);\n\n // Force Run mode whenever the policy forbids mode switching.\n useEffect(() => {\n if (!permissions.canChangeMode) {\n setStoredCuesheetMode((mode) => (mode === AppMode.Run ? mode : AppMode.Run));\n }\n }, [permissions.canChangeMode, setStoredCuesheetMode]);\n\n return { cuesheetMode, setCuesheetMode };\n}\n","import { memo, use, useMemo } from 'react';\n\nimport EmptyPage from '../../common/components/state/EmptyPage';\nimport { PresetContext } from '../../common/context/PresetContext';\nimport useCustomFields from '../../common/hooks-query/useCustomFields';\n\nimport CuesheetDnd from './cuesheet-dnd/CuesheetDnd';\nimport { makeCuesheetColumns } from './cuesheet-table/cuesheet-table-elements/cuesheetColsFactory';\nimport CuesheetTable from './cuesheet-table/CuesheetTable';\nimport { useApplyCuesheetPolicy } from './useApplyCuesheetPolicy';\n\nexport default memo(CuesheetTableWrapper);\nfunction CuesheetTableWrapper() {\n const { data: customFields, status: customFieldStatus } = useCustomFields();\n const preset = use(PresetContext);\n const { cuesheetMode, setCuesheetMode } = useApplyCuesheetPolicy(preset);\n\n const columns = useMemo(\n () => makeCuesheetColumns(customFields, cuesheetMode, preset),\n [customFields, cuesheetMode, preset],\n );\n\n const isLoading = !customFields || customFieldStatus === 'pending';\n\n return (\n <CuesheetDnd columns={columns}>\n {isLoading ? (\n <EmptyPage text='Loading...' />\n ) : (\n <CuesheetTable\n columns={columns}\n cuesheetMode={cuesheetMode}\n tableRoot='cuesheet'\n setCuesheetMode={setCuesheetMode}\n />\n )}\n </CuesheetDnd>\n );\n}\n","import { IoApps } from 'react-icons/io5';\nimport { useDisclosure } from '@mantine/hooks';\n\nimport IconButton from '../../common/components/buttons/IconButton';\nimport NavigationMenu from '../../common/components/navigation-menu/NavigationMenu';\nimport { EntryActionsProvider } from '../../common/context/EntryActionsContext';\nimport { useEntryActions } from '../../common/hooks/useEntryAction';\nimport { useWindowTitle } from '../../common/hooks/useWindowTitle';\nimport { getIsNavigationLocked } from '../../externals';\nimport CuesheetOverview from '../../features/overview/CuesheetOverview';\n\nimport EntryEditModal from './cuesheet-edit-modal/EntryEditModal';\nimport CuesheetProgress from './cuesheet-progress/CuesheetProgress';\nimport CuesheetTableWrapper from './CuesheetTableWrapper';\n\nimport styles from './CuesheetPage.module.scss';\n\nexport default function CuesheetPage() {\n const [isMenuOpen, menuHandler] = useDisclosure();\n const entryActions = useEntryActions();\n\n useWindowTitle('Cuesheet');\n\n const isLocked = getIsNavigationLocked();\n\n return (\n <EntryActionsProvider actions={entryActions}>\n <NavigationMenu isOpen={isMenuOpen} onClose={menuHandler.close} />\n <EntryEditModal />\n <div className={styles.tableWrapper} data-testid='cuesheet'>\n <CuesheetOverview>\n {!isLocked && (\n <IconButton aria-label='Toggle navigation' variant='subtle-white' size='xlarge' onClick={menuHandler.open}>\n <IoApps />\n </IconButton>\n )}\n </CuesheetOverview>\n <CuesheetProgress />\n <CuesheetTableWrapper />\n </div>\n </EntryActionsProvider>\n );\n}\n","import ProtectRoute from '../../common/components/protect-route/ProtectRoute';\n\nimport CuesheetPage from './CuesheetPage';\n\nexport default function ProtectedCuesheet() {\n return (\n <ProtectRoute permission='operator'>\n <CuesheetPage />\n </ProtectRoute>\n );\n}\n"],"names":["useIsMobileScreen","width","useViewportSize","useMemo","memo","CuesheetOverview","children","jsx","CuesheetMobile","CuesheetDesktop","jsxs","OverviewWrapper","TimerOverview","OffsetOverview","TitleOverview","StartTimesRuntime","MetadataTimes","ClockOverview","CuesheetProgress","data","useViewSettings","current","duration","timeWarning","timeDanger","useProgressData","MultiPartProgressBar","normalColor","warningColor","dangerColor","styles","progressOverride","useApplyCuesheetPolicy","preset","setPermissions","useCuesheetPermissions","state","canShareInSession","sessionScope","permissions","getCuesheetPermissionsPolicy","storedCuesheetMode","setStoredCuesheetMode","useSessionStorage","key","alias","sessionKeys","cuesheetMode","defaultValue","AppMode","Run","Edit","canChangeMode","setCuesheetMode","useCallback","mode","useEffect","CuesheetTableWrapper","customFields","status","customFieldStatus","useCustomFields","use","PresetContext","columns","makeCuesheetColumns","isLoading","CuesheetDnd","EmptyPage","CuesheetTable","CuesheetPage","isMenuOpen","menuHandler","useDisclosure","entryActions","useEntryActions","useWindowTitle","isLocked","getIsNavigationLocked","EntryActionsProvider","NavigationMenu","close","EntryEditModal","tableWrapper","IconButton","open","IoApps","ProtectedCuesheet","ProtectRoute"],"mappings":"imDAGO,SAASA,GAA6B,CACrC,KAAA,CAAEC,MAAAA,GAAUC,EAAgB,EAElC,OAAOC,UAAQ,IAAMF,EAAQ,IAAK,CAACA,CAAK,CAAC,CAC3C,CCOA,MAAeG,EAAAA,EAAAA,KAAKC,CAAgB,EACpC,SAASA,EAAiB,CAAEC,SAAAA,CAA4B,EAAG,CAGzD,OAFuBN,EAAkB,EAGhCO,MAACC,GAAgBF,SAAAA,EAAS,EAE5BC,MAACE,GAAiBH,SAAAA,EAAS,CACpC,CAEA,SAASE,EAAe,CAAEF,SAAAA,CAA4B,EAAG,CAErD,OAAAI,EAAA,KAACC,EAAgB,CAAA,YAAaL,EAC5B,SAAA,CAAAC,EAAA,IAACK,EAAa,EAAA,QACbC,EAAc,CAAA,CAAA,CAAA,EACjB,CAEJ,CAEA,SAASJ,EAAgB,CAAEH,SAAAA,CAA4B,EAAG,CAEtD,OAAAI,EAAA,KAACC,EAAgB,CAAA,YAAaL,EAC5B,SAAA,CAAAC,EAAA,IAACO,EAAa,EAAA,EACdP,EAAAA,IAACQ,EAAkB,CAAA,aAAY,EAAA,CAAA,QAC9BH,EAAa,EAAA,QACbC,EAAc,EAAA,QACdG,EAAa,EAAA,EACdT,EAAAA,IAACU,EAAc,CAAA,aAAY,EAAA,CAAA,CAAA,EAC7B,CAEJ,6DCtCA,SAAwBC,GAAmB,CACnC,KAAA,CAAEC,KAAAA,GAASC,EAAgB,EAC3B,CAAEC,QAAAA,EAASC,SAAAA,EAAUC,YAAAA,EAAaC,WAAAA,GAAeC,EAAgB,EAGrE,OAAAlB,MAACmB,GACC,IAAKL,EACL,SAAUC,EACV,YAAaH,EAAKQ,YAClB,QAASJ,EACT,aAAcJ,EAAKS,aACnB,OAAQJ,EACR,YAAaL,EAAKU,YAClB,UAAWC,EAAOC,iBAClB,kBAAiB,EACjB,CAAA,CAEN,CCVO,SAASC,EAAuBC,EAGrC,CACA,MAAMC,EAAiBC,EAAkCC,GAAAA,EAAMF,cAAc,EACvEG,EAAoBC,IAAiB,KACrCC,EAAcpC,UAClB,IAAMqC,EAA6BP,EAAQI,CAAiB,EAC5D,CAACJ,EAAQI,CAAiB,CAC5B,EAEM,CAACI,EAAoBC,CAAqB,EAAIC,EAAkB,CACpEC,IAAKX,EAAS,GAAGA,EAAOY,KAAK,GAAGC,EAAYC,YAAY,GAAKD,EAAYC,aACzEC,aAAcf,EAASgB,EAAQC,IAAMD,EAAQE,IAAAA,CAC9C,EAEKJ,EAAeR,EAAYa,cAAgBX,EAAqBQ,EAAQC,IACxEG,EAAkBC,cACrBC,GAAkB,CACZhB,EAAYa,eAIjBV,EAAsBa,CAAI,CAE5B,EAAA,CAAChB,EAAYa,cAAeV,CAAqB,CACnD,EAGAc,OAAAA,EAAAA,UAAU,IAAM,CACdtB,EAAeK,CAAW,CAAA,EACzB,CAACA,EAAaL,CAAc,CAAC,EAGhCsB,EAAAA,UAAU,IAAM,CACTjB,EAAYa,eACfV,KAAiCa,IAASN,EAAQC,IAAMK,EAAON,EAAQC,GAAI,CAE5E,EAAA,CAACX,EAAYa,cAAeV,CAAqB,CAAC,EAE9C,CAAEK,aAAAA,EAAcM,gBAAAA,CAAgB,CACzC,CC3CA,MAAejD,EAAAA,EAAAA,KAAKqD,EAAoB,EACxC,SAASA,IAAuB,CACxB,KAAA,CAAEtC,KAAMuC,EAAcC,OAAQC,GAAsBC,EAAgB,EACpE5B,EAAS6B,MAAIC,CAAa,EAC1B,CAAEhB,aAAAA,EAAcM,gBAAAA,CAAAA,EAAoBrB,EAAuBC,CAAM,EAEjE+B,EAAU7D,EAAAA,QACd,IAAM8D,EAAoBP,EAAcX,EAAcd,CAAM,EAC5D,CAACyB,EAAcX,EAAcd,CAAM,CACrC,EAEMiC,EAAY,CAACR,GAAgBE,IAAsB,UAEzD,aACGO,EAAY,CAAA,QAAAH,EACVE,SACCA,EAAA3D,EAAA,IAAC6D,GAAU,KAAK,eAEhB7D,EAAA,IAAC8D,GACC,QAAAL,EACA,aAAAjB,EACA,UAAU,WACV,gBAAAM,CAEH,CAAA,EACH,CAEJ,wDCrBA,SAAwBiB,IAAe,CACrC,KAAM,CAACC,EAAYC,CAAW,EAAIC,EAAc,EAC1CC,EAAeC,EAAgB,EAErCC,EAAe,UAAU,EAEzB,MAAMC,EAAWC,EAAsB,EAGrC,OAAApE,EAAA,KAACqE,EAAqB,CAAA,QAASL,EAC7B,SAAA,CAAAnE,EAAA,IAACyE,EAAe,CAAA,OAAQT,EAAY,QAASC,EAAYS,MAAM,QAC9DC,EAAc,EAAA,SACd,MAAI,CAAA,UAAWpD,GAAOqD,aAAc,cAAY,WAC/C,SAAA,CAAA5E,EAAAA,IAACF,GACE,SAACwE,CAAAA,GACCtE,MAAA6E,EAAA,CAAW,aAAW,oBAAoB,QAAQ,eAAe,KAAK,SAAS,QAASZ,EAAYa,KACnG,SAAC9E,EAAA,IAAA+E,EAAA,CAAA,CAAM,CACT,CAAA,EAEJ,QACCpE,EAAgB,EAAA,QAChBuC,EAAoB,CAAA,CAAA,CAAA,CACvB,CAAA,CAAA,EACF,CAEJ,CCtCA,SAAwB8B,IAAoB,CAC1C,aACGC,EAAa,CAAA,WAAW,WACvB,SAAAjF,MAAC+D,IAAY,CAAA,EACf,CAEJ"}
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-C5mAtBjW.js","./vendor-Dt3_Fdfs.js","./vendor-4xP-6xVS.css","./index-3aosT33y.js","./index-Cm69j2Ld.css","./SwatchPicker-DuWAohyD.js","./SwatchPicker-DxatRu17.css","./useEventSelection-Cvdw9all.js","./Select-CvUrsmYI.js","./Select-Cd08aEcf.css","./useCustomFields-kBD1jvDA.js","./useRundown-C6stroSA.js","./useEventSelection-D_Et8xSN.css","./StyleEditor-buc-zQHR.js","./StyleEditor-Bie84LSc.css","./RundownExport-Bvc1J50m.js","./EditorUtils-k5KpETPG.js","./EditorUtils-L4Sg72o_.css","./ProtectRoute-DSilyhst.js","./ProtectRoute-Bm5sjStK.css","./CuesheetTable-BQfxAp-I.js","./TimeInput-BjOTgjcv.js","./parseUserTime-wAKk9aCJ.js","./TimeInput-Cu-N5DmX.css","./validateEvent-BnwPmDph.js","./Tooltip-C5iPq6NR.js","./Tooltip-CKb7gU2M.css","./DelayIndicator-B0cudY9N.js","./editorSettings-xk5GwlLv.js","./editorSettings-BqHbWs9b.css","./rundownUtils-XX_c4Pcl.js","./DelayIndicator-VuYhhwTj.css","./offset-yVqq_CB1.js","./EmptyPage-aTb22KTq.js","./EmptyPage-Ci10HwDK.css","./CuesheetTable-BJ30G538.css","./useSelectAndRevealEntry-D79sYFHr.js","./useReport-CG6m_Zb0.js","./playbackstate-BZ9WYn2k.js","./getProgress-CWSCZOIN.js","./RundownExport-CzaSrbaj.css","./TimerControlExport-De2n8HWG.js","./TimerDisplay-DeFQvmo9.js","./TimerDisplay-B-FvT2T-.css","./TimerControlExport-X_cQKSFg.css","./MessageControlExport-BN6OfADo.js","./MessageControlExport-D_pNX6Vj.css"])))=>i.map(i=>d[i]);
2
+ import{h as p,j as e,ac as Ps,a as X,k as Vt,ad as ce,ae as hn,af as mn,ag as ht,ah as pe,T as ge,aa as pt,ai as xn,y as gt,aj as jn,ak as ls,f as pn,O as Mt,A as dt,al as gn,am as fn,an as it,ao as bn,P as Je,C as Ee,ap as Rs,aq as Es,ar as yn,as as Is,at as os,au as vn,av as Ls,l as wn,aw as Sn,$ as rt,v as Wt,ax as Cn,x as _n,ay as kn,M as As,az as Tn,aA as cs,aB as Nn,aC as Dn,aD as Pn,aE as Rn,aF as En,I as In,m as Ln}from"./vendor-Dt3_Fdfs.js";import{e as Ce,Q as Ut,R as An,S as Fn,U as mt,s as On,V as $n,W as Ie,X as ut,Y as N,Z as ft,_ as Me,$ as R,a0 as se,a1 as q,a2 as It,a3 as Vn,a4 as Mn,a5 as Bt,a6 as Wn,a7 as Fs,a8 as Un,a9 as A,B as f,aa as le,ab as fe,ac as Be,ad as _e,ae as oe,af as U,ag as z,ah as M,ai as V,aj as ze,ak as J,al as ke,am as bt,an as Bn,ao as zn,ap as zt,f as $e,aq as Os,ar as Kt,as as $s,at as ae,x as Lt,O as Re,au as Kn,av as ds,aw as Vs,ax as Ms,ay as Gt,az as Le,aA as Gn,aB as Hn,aC as qn,aD as Ht,aE as St,m as Oe,k as qt,aF as Qn,aG as Yn,aH as ve,aI as Ws,aJ as xt,T as lt,aK as Jn,aL as Us,aM as us,aN as Xn,aO as Zn,aP as ea,aQ as Qe,aR as ta,aS as sa,b as na,aT as aa,N as ia,aU as Ct,aV as ra,aW as la,aX as oa,aY as ca,a as da,aZ as ua,a_ as ha,a$ as hs,b0 as ma,b1 as ms,K as xa,b2 as ja,b3 as pa,b4 as ga,b5 as Ke,h as Xe,y as xs,b6 as Ze,b7 as ot,b8 as et,b9 as Ue,ba as fa,M as ba,bb as ya,o as va,bc as wa,bd as Sa}from"./index-3aosT33y.js";import{P as Ca}from"./ProtectRoute-DSilyhst.js";import{u as _a}from"./useWindowTitle-CQ8nEeel.js";import{i as Bs,e as ka,u as yt,R as zs,T as H,s as Ta,t as _t,a as Na,b as Da,d as Pa,c as Ra,f as Ea,g as Ia,h as La,G as Aa,S as Fa,j as Oa,D as Qt,M as Yt,k as $a,l as Va}from"./useEventSelection-Cvdw9all.js";import{I as xe,S as De,a as kt,C as Ma}from"./SwatchPicker-DuWAohyD.js";import{f as Wa,g as Ua,h as Ba,i as Jt,u as Xt,j as za,k as Ka,l as Ga,m as Ha,r as qa,n as Qa,o as Ya,p as Ja,q as Xa,s as Za}from"./useRundown-C6stroSA.js";import{S as re}from"./Select-CvUrsmYI.js";import{u as vt,p as ei,e as ti,d as si}from"./useCustomFields-kBD1jvDA.js";import{u as ni,d as ai}from"./useReport-CG6m_Zb0.js";import{T as At,u as Ks,e as nt}from"./editorSettings-xk5GwlLv.js";import{S as ii,L as ri,T as li}from"./EditorUtils-k5KpETPG.js";import{T as Zt}from"./Tooltip-C5iPq6NR.js";import{A as Gs,T as He}from"./TimeInput-BjOTgjcv.js";import{T as js,E as Tt}from"./validateEvent-BnwPmDph.js";import{p as qe}from"./parseUserTime-wAKk9aCJ.js";import{u as oi,a as ci,b as di}from"./useProjectData-gGT2eczr.js";import{u as es,a as ts,E as Se,b as ui}from"./useSelectAndRevealEntry-D79sYFHr.js";import{S as hi,P as mi,C as ss,a as Hs,b as qs,O as Qs,M as Ys}from"./TimeElements-BfxdLkpO.js";import{O as xi,s as ns,T as Js,S as ji}from"./OverviewWrapper-B4nU68Eq.js";import{g as pi,T as Ae,a as gi}from"./TimerDisplay-DeFQvmo9.js";import"./offset-yVqq_CB1.js";import"./SuperscriptPeriod-CSX8zFgq.js";/* empty css */import"./playbackstate-BZ9WYn2k.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof $t<"u"?$t:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="56d9e5a2-7e51-413b-a8e8-c110ad23f596",t._sentryDebugIdIdentifier="sentry-dbid-56d9e5a2-7e51-413b-a8e8-c110ad23f596")}catch{}})();function fi(t){return t.trim().replaceAll(" ","_")}const bi={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"},yi=(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])},vi="_link_70oau_17",wi="_inline_70oau_27",ps={link:vi,inline:wi};function ne({href:t,inline:s,children:n}){const a=i=>{i.preventDefault(),Ut(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:Ce([ps.link,s&&ps.inline]),onClick:a,children:[n," ",e.jsx(Ps,{style:{fontSize:"1em"}})]})}async function Si(t){const s=await X.get(An,{signal:t==null?void 0:t.signal});return{url:s.data.html_url,version:s.data.tag_name}}const gs={url:"",version:"",hasUpdates:!1};function Xs(){const{data:t,status:s,isFetching:n,isError:a,refetch:i}=Vt({queryKey:$n,queryFn:({signal:o})=>Si({signal:o}),placeholderData:(o,h)=>o,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:On,enabled:mt}),l=(t==null?void 0:t.version)&&!t.version.includes(Fn);return{data:t?{...t,hasUpdates:l}:gs,placeholder:gs,status:s,isFetching:n,isError:a,refetch:i}}function Ci(){const{data:t,isError:s}=Xs();return s?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ut}`,e.jsx(N,{children:"Could not fetch version information"})]}):t.hasUpdates?e.jsxs(Ie,{children:[`You are currently using Ontime version ${ut}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),ft?"You can restart your stage to get the latest available version.":e.jsx(ne,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(Ie,{children:`You are currently using the latest version of Ontime: ${ut}`})}function _i(){return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"About Ontime"}),e.jsxs(R,{children:[e.jsxs(se,{children:[e.jsx(q,{children:"Ontime"}),e.jsxs(Ie,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(ne,{href:It,children:"www.getontime.no"})]}),e.jsxs(Ie,{children:["Considering sponsoring our work",e.jsx(ne,{href:Vn,children:"GitHub Sponsors"}),e.jsx(ne,{href:Mn,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(ne,{href:It,children:"www.getontime.no"})]})]}),e.jsx(q,{children:"Current version"}),e.jsx(Ci,{}),e.jsx(q,{children:"Links"}),e.jsx(ne,{href:Bt,children:"Read the docs"}),e.jsx(ne,{href:Wn,children:"Follow the project on GitHub"}),e.jsx(ne,{href:Fs,children:"Discord server"}),e.jsx(ne,{href:Un,children:"Subreddit"})]})]})}function ie(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 ki="https://docs.getontime.no/api/protocols/osc/";function Ti({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var b,y,w;const{handleSubmit:a,reset:i,register:l,setError:r,watch:o,setValue:h,formState:{errors:c,isSubmitting:u,isDirty:j,isValid:d}}=ce({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),x=async S=>{try{await ka(S),i(S)}catch(F){const _=V(F);r("root",{message:_})}},m=()=>{i({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},g=!u&&j&&d;return e.jsxs(se,{children:[e.jsxs(q,{children:["Automation settings",e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",onClick:m,disabled:!g,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!g,loading:u,children:"Save"})]})]}),(c==null?void 0:c.root)&&e.jsx(N,{children:c.root.message}),e.jsx(le,{}),e.jsx(R,{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(ne,{href:ki,children:"See the docs"})]})}),e.jsxs(R,{as:"form",id:"automation-settings-form",onSubmit:a(x),onKeyDown:S=>fe(S,m),children:[e.jsx(Be,{isLoading:!1}),e.jsx(_e,{children:"Automation"}),e.jsx(oe,{children:e.jsxs(U,{children:[e.jsx(z,{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=>h("enabledAutomations",S,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(_e,{children:"OSC Input"}),e.jsxs(oe,{children:[ft&&e.jsx(xe,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(U,{children:[e.jsx(z,{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=>h("enabledOscIn",S,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(U,{children:[e.jsx(z,{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:Bs,message:"Value should be numeric"}})})]})]})]})]})}const Ni=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],Di=["{{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}}"],Pi=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],Ri=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"],Nt=t=>[`{{auxtimer${t}.current}}`,`{{auxtimer${t}.duration}}`,`{{auxtimer${t}.playback}}`,`{{auxtimer${t}.direction}}`];function Ei(t){return[...Ni,...Di,...Pi,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...Ri,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`),...Nt(1),...Nt(2),...Nt(3)]}function Ii(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 Li(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Ai="_wrapper_1dmtf_17",Fi="_suggestions_1dmtf_21",fs={wrapper:Ai,suggestions:Fi},Oi=p.forwardRef(function(s,n){const{value:a,onChange:i,...l}=s,{data:r}=vt(),o=hn(()=>m(!1)),h=p.useMemo(()=>Ei(r),[r]),[c,u]=p.useState(a||""),[j,d]=p.useState([]),[x,m]=p.useState(!1),g=w=>{const S=Li(w);return h.filter(F=>F.startsWith(S))},b=w=>{u(w.target.value),w.target.value.endsWith("{")?(m(!0),d(g(w.target.value))):w.target.value===""||w.target.value.endsWith("}}")?m(!1):x&&d(g(w.target.value)),i==null||i(w)},y=w=>{u(S=>{const F=Ii(S,w);return S+F}),m(!1)};return e.jsxs("div",{className:fs.wrapper,ref:mn(o,n),children:[e.jsx(M,{value:c,...l,onChange:b,fluid:!0}),x&&j.length>0&&e.jsx("ul",{className:fs.suggestions,children:j.map(w=>e.jsx("li",{onClick:()=>y(w),children:w},w))})]})}),Ft=[{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 bs(t){return Object.hasOwn(t,"id")}const $i=[{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"}],Vi=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Mi(t){return[...$i,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Vi,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function Wi(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 Ui="_outerColumn_1klj0_17",Bi="_innerColumn_1klj0_25",zi="_ruleSection_1klj0_31",Ki="_titleSection_1klj0_37",Gi="_filterSection_1klj0_38",Hi="_oscSection_1klj0_39",qi="_httpSection_1klj0_40",Qi="_actionSection_1klj0_41",Yi="_test_1klj0_95",Ji="_outputCard_1klj0_99",he={outerColumn:Ui,innerColumn:Bi,ruleSection:zi,titleSection:Ki,filterSection:Gi,oscSection:Hi,httpSection:qi,actionSection:Qi,test:Yi,outputCard:Ji};function Xi({index:t,register:s,setValue:n,rowErrors:a,value:i,children:l,watch:r}){var u,j,d,x,m;const[o,h]=p.useState(i),c=g=>{n(`outputs.${t}.action`,g,{shouldDirty:!0}),h(g)};return e.jsxs("div",{className:he.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(re,{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(N,{children:(u=a==null?void 0:a.action)==null?void 0:u.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(N,{children:(j=a==null?void 0:a.time)==null?void 0:j.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(N,{children:(d=a==null?void 0:a.text)==null?void 0:d.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(re,{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(N,{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(re,{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(N,{children:(m=a==null?void 0:a.secondarySource)==null?void 0:m.message})]}),e.jsx("div",{className:he.test,children:l})]})}const Zi="https://docs.getontime.no/api/automation/#using-variables-in-automation";function er({automation:t,onClose:s}){var G;const n=bs(t),{data:a}=vt(),{refetch:i}=yt(),l=p.useMemo(()=>Mi(a),[a]),{control:r,handleSubmit:o,getValues:h,register:c,setError:u,setFocus:j,setValue:d,watch:x,formState:{errors:m,isSubmitting:g,isDirty:b,isValid:y}}=ce({mode:"onChange",defaultValues:{title:(t==null?void 0:t.title)??"",filterRule:(t==null?void 0:t.filterRule)??"all",filters:(t==null?void 0:t.filters)??[],outputs:(t==null?void 0:t.outputs)??[]},resetOptions:{keepDirtyValues:!0}}),{fields:w,append:S,remove:F}=ht({name:"filters",control:r}),{fields:_,append:I,remove:W}=ht({name:"outputs",control:r});p.useEffect(()=>{j("title")},[j]);const v=()=>{S({field:"",operator:"equals",value:""})},P=()=>{I({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},D=()=>{I({type:"http",url:""})},Q=()=>{I({type:"ontime",action:"aux1-start"})},K=async $=>{try{const k=h(`outputs.${$}`);if(!k.targetIP||!k.targetPort||!k.address)return;await _t({type:"osc",targetIP:k.targetIP,targetPort:k.targetPort,address:k.address,args:k.args})}catch{}},O=async $=>{try{const k=h(`outputs.${$}`);if(!k.url)return;await _t({type:"http",url:k.url})}catch{}},E=async $=>{try{const k=h(`outputs.${$}`);await _t({...k,type:"ontime"})}catch{}},L=async $=>{bs(t)?await k(t.id,{id:t.id,...$}):await be($),i();async function k(ue,de){try{await Na(ue,de),s()}catch(C){u("root",{message:V(C)})}}async function be(ue){try{await Da(ue),s()}catch(de){u("root",{message:V(de)})}}},T=!g&&b&&y;return e.jsxs(ze,{as:"form",name:"automation-form",onSubmit:o(L),className:he.outerColumn,onKeyDown:$=>fe($,s),children:[e.jsx(q,{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(N,{children:(G=m.title)==null?void 0:G.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(zs,{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(($,k)=>{var ue,de,C,ee,Ne,Pe;const be=`filters.${k}.field.${$.id}`;return e.jsxs("div",{className:he.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(re,{value:x(`filters.${k}.field`)||null,onValueChange:je=>{je!==null&&d(`filters.${k}.field`,je,{shouldDirty:!0})},options:l.map(({value:je,label:Z})=>({value:je,label:Z,disabled:je===null})),"aria-label":"Event field"}),e.jsx(N,{children:(C=(de=(ue=m.filters)==null?void 0:ue[k])==null?void 0:de.field)==null?void 0:C.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(re,{value:x(`filters.${k}.operator`),onValueChange:je=>{je!==null&&d(`filters.${k}.operator`,je,{shouldDirty:!0})},options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(N,{children:(Pe=(Ne=(ee=m.filters)==null?void 0:ee[k])==null?void 0:Ne.operator)==null?void 0:Pe.message})]}),e.jsxs("label",{children:["Value to match",e.jsx(M,{...c(`filters.${k}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(J,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>F(k),children:e.jsx(pe,{})})})]})]},be)}),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(ne,{href:Zi,children:"See the documentation for templates"})]}),_.map(($,k)=>{var be,ue,de,C,ee,Ne,Pe,je;if(Wa($)){const Z=(be=m.outputs)==null?void 0:be[k];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.${k}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(N,{children:(ue=Z==null?void 0:Z.targetIP)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Target Port",e.jsx(M,{...c(`outputs.${k}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:rs=>rs===""?0:Number(rs),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(N,{children:(de=Z==null?void 0:Z.targetPort)==null?void 0:de.message})]}),e.jsxs("label",{children:["Address",e.jsx(M,{...c(`outputs.${k}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(N,{children:(C=Z==null?void 0:Z.address)==null?void 0:C.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(Oi,{...c(`outputs.${k}.args`),value:$.args,placeholder:"1"}),e.jsx(N,{children:(ee=Z==null?void 0:Z.args)==null?void 0:ee.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>K(k),children:"Test"}),e.jsx(J,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(k),children:e.jsx(pe,{})})]})]})]})]},$.id)}if(Ua($)){const Z=(Ne=m.outputs)==null?void 0:Ne[k];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.${k}.url`,{required:{value:!0,message:"Required field"},pattern:{value:Ta,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(N,{children:(Pe=Z==null?void 0:Z.url)==null?void 0:Pe.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>O(k),children:"Test"}),e.jsx(J,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(k),children:e.jsx(pe,{})})]})]})]})]},$.id)}if(Ba($)){const Z=(je=m.outputs)==null?void 0:je[k];return e.jsxs("div",{className:he.outputCard,children:[e.jsx(H,{children:"Ontime action"}),e.jsxs(Xi,{value:$.action,index:k,register:c,rowErrors:Z,setValue:d,watch:x,children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>E(k),children:"Test"}),e.jsx(J,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>W(k),children:e.jsx(pe,{})})]})]})]},$.id)}return null}),e.jsxs(A,{relation:"inner",children:[e.jsxs(f,{onClick:P,children:["OSC ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:D,children:["HTTP ",e.jsx(ge,{})]}),e.jsxs(f,{onClick:Q,children:["Ontime action ",e.jsx(ge,{})]})]})]}),e.jsxs(A,{align:"end",children:[(m==null?void 0:m.root)&&e.jsx(N,{children:m.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!T,loading:g,children:"Save"})]})]})}const ys={title:"",filterRule:"all",filters:[],outputs:[]};function tr(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 Pa(c)}catch(u){r(V(u))}finally{n()}},h=Object.keys(s);return e.jsxs(se,{children:[e.jsxs(q,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!a,onClick:()=>i(ys),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),a!==null&&e.jsx(er,{automation:a,onClose:()=>i(null)}),e.jsxs(ke,{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:[h.length===0&&e.jsx(bt,{handleClick:a?void 0:()=>i(ys)}),h.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(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(J,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>i(s[c]),children:e.jsx(pt,{})}),e.jsx(J,{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(N,{children:l})})})]})]})]})}function Zs({automations:t,initialId:s,initialTitle:n,initialAutomationId:a,initialTrigger:i,onCancel:l,postSubmit:r}){var F,_,I,W;const{handleSubmit:o,register:h,setFocus:c,setError:u,watch:j,setValue:d,formState:{errors:x,isSubmitting:m,isValid:g,isDirty:b}}=ce({defaultValues:{title:n,trigger:i??Ft[0].value,automationId:a??((F=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:F.id)},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{c("title")},[c]);const y=async v=>{if(s){try{await Ra(s,{id:s,...v}),r()}catch(P){u("root",{message:`Failed to save changes to trigger ${V(P)}`})}return}try{await Ea(v),r()}catch(P){u("root",{message:`Failed to save trigger ${V(P)}`})}},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=>fe(v,l),children:[e.jsx(q,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx(M,{...h("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(N,{children:(_=x.title)==null?void 0:_.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(re,{value:j("trigger"),onValueChange:v=>{v!==null&&d("trigger",v,{shouldDirty:!0})},options:Ft.map(v=>({value:v.value,label:v.label})),"aria-label":"Lifecycle trigger"}),e.jsx(N,{children:(I=x.trigger)==null?void 0:I.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(re,{value:j("automationId"),onValueChange:v=>{v!==null&&d("automationId",v,{shouldDirty:!0})},options:w,"aria-label":"Automation title"}),e.jsx(N,{children:(W=x.automationId)==null?void 0:W.message})]}),e.jsxs(A,{align:"end",children:[e.jsx(f,{disabled:m,onClick:l,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!S,loading:m,children:"Save"})]})]})}function sr(t){var j,d;const{automations:s,id:n,title:a,trigger:i,automationId:l,duplicate:r,handleDelete:o,postSubmit:h}=t,[c,u]=p.useState(!1);return c?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Zs,{automations:s,initialId:n,initialTitle:a,initialTrigger:i,initialAutomationId:l,onCancel:()=>u(!1),postSubmit:()=>{u(!1),h()}})})}):e.jsxs("tr",{"data-warn":r,children:[e.jsxs(A,{as:"td",relation:"inner",children:[r&&e.jsx(xn,{color:"#FFBC56"}),a]}),e.jsx("td",{children:e.jsx(H,{children:(j=Ft.find(x=>x.value===i))==null?void 0:j.label})}),e.jsx("td",{children:e.jsx(H,{children:(d=s==null?void 0:s[l])==null?void 0:d.title})}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(J,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>u(!0),children:e.jsx(pt,{})}),e.jsx(J,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:o,children:e.jsx(pe,{})})]})]})}function nr(t){const{triggers:s,automations:n}=t,[a,i]=p.useState(!1),{refetch:l}=yt(),[r,o]=p.useState(null),h=async d=>{try{await Ia(d)}catch(x){o(V(x))}finally{l()}},c=()=>{i(!1),l()},u=p.useMemo(()=>Wi(s),[s]),j=Object.keys(n).length>0;return e.jsxs(se,{children:[e.jsxs(q,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!j,loading:!1,onClick:()=>i(!0),children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsxs(R,{children:[u&&e.jsx(N,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),a&&e.jsx(Zs,{automations:n,onCancel:()=>i(!1),postSubmit:c}),e.jsxs(ke,{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:j?()=>i(!0):void 0}),s.map((d,x)=>e.jsxs(p.Fragment,{children:[e.jsx(sr,{automations:n,id:d.id,title:d.title,trigger:d.trigger,automationId:d.automationId,duplicate:u==null?void 0:u.includes(x),handleDelete:()=>h(d.id),postSubmit:c}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(N,{children:r})})})]},d.id))]})]})]})]})}function ar({location:t}){const{data:s,status:n}=yt(),a=ie("settings",t),i=ie("triggers",t),l=ie("automations",t),r=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Automation"}),e.jsxs(R,{children:[e.jsx(Be,{isLoading:r}),e.jsx("div",{ref:a,children:e.jsx(Ti,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(tr,{automations:s.automations})}),e.jsx("div",{ref:i,children:e.jsx(nr,{triggers:s.triggers,automations:s.automations})})]})]})}const ir="_goIcon_1fzu7_17",rr={goIcon:ir};function lr(){const{data:t}=Bn(),s=n=>Ut(n);return e.jsx(A,{wrap:"wrap",children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!mt)return null;const a=zn(n.address);return e.jsxs(zt,{copyValue:a,onClick:()=>s(a),children:[`${n.name} - ${n.address}`," ",e.jsx(gt,{className:rr.goIcon})]},n.name)})})}function or(t){return jn(t)}function cr(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||!Jt(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 dr=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function ur(t){const s=[];s.push(dr);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 or(s)}const hr="_blink_15peo_1",mr="_fourtyfive_15peo_13",xr="_over_15peo_17",jr="_under_15peo_21",ct={blink:hr,fourtyfive:mr,over:xr,under:jr};function pr(){const{data:t}=ni(),{data:s}=Xt(),n=async()=>await ai(),a=l=>{if(!l)return;const r=ur(l),o=Os(r,"text/csv;charset=utf-8;");Kt(o,"ontime-report.csv")},i=p.useMemo(()=>cr(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(R,{children:e.jsxs(se,{children:[e.jsx(q,{children:"Report"}),e.jsx(le,{}),e.jsx(R,{children:e.jsxs(_e,{children:["Manage report",e.jsxs(A,{children:[e.jsxs(f,{onClick:()=>a(i),disabled:i.length===0,children:[e.jsx(ls,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:i.length===0,children:[e.jsx(ls,{}),"Clear All"]})]})]})}),e.jsx(R,{children:e.jsxs(ke,{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:Ce([r&&ct[r]]),children:$e(l.scheduledStart)}),e.jsx("th",{className:Ce([r&&ct[r]]),children:$e(l.actualStart)}),e.jsx("th",{className:Ce([o&&ct[o]]),children:$e(l.scheduledEnd)}),e.jsx("th",{className:Ce([o&&ct[o]]),children:$e(l.actualEnd)})]},l.id)})]})]})})]})})}const gr="_expand_1sy0c_17",fr="_column_1sy0c_21",vs={expand:gr,column:fr},br=[{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"}],yr={alias:"",target:Re.Timer,search:"",enabled:!0};function vr({urlPreset:t,onClose:s}){var _,I,W;const{addPreset:n,updatePreset:a,isMutating:i}=$s(),{handleSubmit:l,register:r,setFocus:o,setError:h,clearErrors:c,setValue:u,getValues:j,watch:d,formState:{errors:x,isSubmitting:m,isValid:g,isDirty:b}}=ce({defaultValues:t??yr,mode:"onChange",resetOptions:{keepDirtyValues:!0}}),y=p.useRef(null),w=async v=>{try{t?await a(t.alias,v):await n(v),s()}catch(P){h("root",{message:V(P)})}};p.useEffect(()=>{o("alias")},[o]);const S=()=>{var v;c();try{const P=Kn(j("alias"),((v=y.current)==null?void 0:v.value.trim())??"");u("target",P.target,{shouldDirty:!0,shouldValidate:!0}),u("search",P.search,{shouldDirty:!0,shouldValidate:!0})}catch(P){h("root",{message:ds(P)});return}},F=v=>{try{return new URLSearchParams(v),!0}catch(P){return ds(P)||"Invalid URL parameters"}};return e.jsxs(ze,{as:"form",onSubmit:l(w),onKeyDown:v=>fe(v,s),className:vs.column,children:[e.jsx("input",{hidden:!0,name:"enabled",value:"true"}),e.jsx("div",{children:"1. Enter URL and let Ontime generate the preset options"}),e.jsxs(A,{children:[e.jsxs("div",{children:[e.jsx(ae,{children:"Alias"}),e.jsx(M,{...r("alias",{required:"Alias is required",pattern:{value:La,message:"Field can only contain URL safe characters (a-z, 0-9, _ and -)"}})})]}),e.jsxs("div",{className:vs.expand,children:[e.jsx(ae,{children:"Generate options (paste URL to generate options)"}),e.jsxs(A,{children:[e.jsx(M,{placeholder:"Paste URL",fluid:!0,ref:y}),e.jsx(f,{onClick:S,children:"Generate"})]})]})]}),((_=x.alias)==null?void 0:_.message)&&e.jsx(N,{children:x.alias.message}),e.jsxs("div",{children:[Lt," or ",Lt]}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(ae,{children:"Target"}),e.jsx(re,{options:br,...r("target",{required:"Target is required"}),value:d("target"),onValueChange:v=>{v!==null&&u("target",v,{shouldDirty:!0})}})]}),e.jsxs("div",{children:[e.jsx(ae,{children:"Parameters"}),e.jsx(At,{fluid:!0,rows:3,...r("search",{validate:F})}),e.jsx(N,{children:(I=x.search)==null?void 0:I.message})]}),e.jsxs("div",{children:[e.jsx(N,{children:(W=x.root)==null?void 0:W.message}),e.jsxs(A,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!g||!b,loading:m||i,children:"Save"})]})]})]})}const wr="https://docs.getontime.no/features/url-presets/";function Sr(){const[t,s]=p.useState({isOpen:!1,preset:void 0}),{data:n,status:a}=Vs(),{deletePreset:i,isMutating:l}=$s(),r=()=>s({isOpen:!0}),o=c=>s({isOpen:!0,preset:c}),h=()=>s({isOpen:!1,preset:void 0});return e.jsx(R,{children:e.jsxs(se,{children:[e.jsxs(q,{children:["URL presets",e.jsxs(f,{onClick:r,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(R,{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(ne,{href:wr,children:"See the docs"})]})}),e.jsxs(R,{children:[e.jsx(Be,{isLoading:a==="pending"}),t.isOpen&&e.jsx(vr,{urlPreset:t.preset,onClose:h}),e.jsxs(ke,{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,u)=>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(A,{relation:"inner",as:"td",children:[e.jsx(J,{variant:"ghosted-white",onClick:j=>Ms(c.alias,j),disabled:l,children:e.jsx(Ps,{})}),e.jsx(J,{onClick:()=>o(c),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${u}`,disabled:l,children:e.jsx(pt,{})}),e.jsx(J,{onClick:()=>i(c.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${u}`,disabled:l,children:e.jsx(pe,{})})]})]},c.alias))]})]})]})]})})}function Cr({location:t}){const s=ie("presets",t),n=ie("link",t),a=ie("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(Sr,{})}),e.jsx("div",{ref:n,children:e.jsx(R,{children:e.jsxs(se,{children:[e.jsx(q,{children:"Share Ontime Link"}),!ft&&e.jsxs(e.Fragment,{children:[e.jsx(Ie,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(lr,{})]}),e.jsx(le,{}),e.jsx(Aa,{})]})})}),e.jsx("div",{ref:a,children:e.jsx(pr,{})})]})}const as=`${Gt}/excel`;async function _r(t,s){const n=new FormData;return n.append("excel",t),(await X.post(`${as}/upload`,n,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data}async function kr(t,s){return(await X.post(`${as}/preview`,{options:t},{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data}async function Tr(t,s,n){try{const a=await X.get(`${as}/${t}/export`,{signal:n==null?void 0:n.signal,timeout:(n==null?void 0:n.timeout)??Le.longTimeout,responseType:"blob"});Kt(a.data,`${s??"Ontime_rundown"}.xlsx`)}catch(a){console.error("Error downloading file:",a)}}const Ye=`${Gt}/sheets`,Nr=async()=>(await X.get(`${Ye}/connect`)).data,Dr=async(t,s,n)=>{const a=new FormData;return a.append("client_secret",t),(await X.post(`${Ye}/${s}/connect`,a,{signal:n==null?void 0:n.signal,timeout:Le.longTimeout,headers:{"Content-Type":"multipart/form-data"}})).data},Pr=async()=>(await X.post(`${Ye}/revoke`)).data,Rr=async(t,s,n)=>(await X.post(`${Ye}/${t}/read`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data,en=async(t,s)=>(await X.post(`${Ye}/${t}/worksheets`,void 0,{signal:s==null?void 0:s.signal,timeout:Le.longTimeout})).data,Er=async(t,s,n)=>(await X.post(`${Ye}/${t}/write`,{options:s},{signal:n==null?void 0:n.signal,timeout:Le.longTimeout})).data;function Ir(t){if(!Lr(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 tn(t){if(!Ar(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 Lr(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Ar(t){return t==null?void 0:t.name.endsWith(".json")}function Fr(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=`${Gt}/db`;function sn(t){return X.post(`${Te}/download`,{filename:t},{timeout:Le.longTimeout})}async function Or(t){try{const{data:s,name:n}=await Kr(t),a=JSON.stringify(s,null,2),i=Os(a,"application/json;charset=utf-8;");Kt(i,`${n}.json`)}catch(s){console.error(s)}}async function nn(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 an(t){return await X.patch(Te,t)}async function $r(t){return(await X.post(`${Te}/new`,t)).data}async function Vr(t){return(await X.post(`${Te}/quick`,t)).data}async function Mr(t){return(await X.get(`${Te}/all`,{signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})).data}async function rn(t){return(await X.post(`${Te}/load`,{filename:t})).data}async function Wr(){return(await X.post(`${Te}/demo`)).data}async function Ur(t,s){const n=`${Te}/${t}/duplicate`,a=decodeURIComponent(n);return(await X.post(a,{newFilename:s})).data}async function Br(t,s){const n=`${Te}/${t}/rename`,a=decodeURIComponent(n);return(await X.put(a,{newFilename:s})).data}async function zr(t){const s=`${Te}/${t}`,n=decodeURIComponent(s);return(await X.delete(n)).data}async function Kr(t){const s=await sn(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 Gr={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},ws={stepData:Gr,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,summary:null,spreadsheetImportMap:bi},B=pn((t,s)=>({...ws,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(ws),resetPreview:()=>t({rundown:null,customFields:null,summary:null})}));function wt(){const t=Mt(),s=B(j=>j.patchStepData),n=B(j=>j.setRundown),a=B(j=>j.setCustomFields),i=B(j=>j.setSummary);return{connect:async(j,d)=>{try{return await Dr(j,d)}catch(x){s({authenticate:{available:!1,error:V(x)}})}},revoke:async()=>{try{return await Pr()}catch(j){s({authenticate:{available:!1,error:V(j)}})}},verifyAuth:async()=>{try{return await Nr()}catch(j){s({authenticate:{available:!1,error:V(j)}})}},importRundownPreview:async(j,d)=>{try{const x=await Rr(j,d);n(x.rundown),a(x.customFields),i(x.summary)}catch(x){s({pullPush:{available:!0,error:V(x)}})}},importRundown:async(j,d)=>{try{await an({rundowns:j,customFields:d}),await t.invalidateQueries({queryKey:[Gn,Hn]})}catch(x){s({pullPush:{available:!0,error:V(x)}})}},exportRundown:async(j,d)=>{try{await Er(j,d),s({pullPush:{available:!1,error:""}})}catch(x){s({pullPush:{available:!0,error:V(x)}})}}}}const Ot={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 Hr(t){return typeof t!="object"||t===null?!1:Object.keys(Ot).every(n=>Object.hasOwn(t,n))}function Ss(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}}const ln=qn("import-map");function qr(t){localStorage.setItem(ln,JSON.stringify(t))}function Qr(){const t=localStorage.getItem(ln);if(!t)throw new Error("no import options found");return JSON.parse(t)}function Yr(){try{const t=Qr();return Hr(t)?t:Ot}catch{return Ot}}const Jr="_uploadSection_10owf_17",Xr="_finishSection_10owf_18",Zr="_error_10owf_40",el="_success_10owf_43",tl="_singleActionCell_10owf_47",Ve={uploadSection:Jr,finishSection:Xr,error:Zr,success:el,singleActionCell:tl};function sl({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:a,onSubmitImport:i}){const l=Yr(),{revoke:r}=wt(),{control:o,handleSubmit:h,register:c,setValue:u,watch:j,formState:{errors:d,isValid:x}}=ce({mode:"onChange",defaultValues:l,values:l}),{fields:m,append:g,remove:b}=ht({control:o,name:"custom"}),y=B(E=>E.stepData),w=B(E=>E.worksheetNames),[S,F]=p.useState("");p.useEffect(()=>{!w||w.length===0||w.includes(l.Worksheet)||u("Worksheet",w[0],{shouldValidate:!0,shouldDirty:!0})},[w,u,l.Worksheet]);const _=async E=>{F("export");const L=Ss(E);await a(L),F("")},I=async()=>{await r(),n()},W=async E=>{F("import");const L=Ss(E);qr(E),await i(L),F("")},v=E=>{b(E)},P=()=>{g({})},D=!!S,Q=s&&!D,K=!D&&!y.worksheet.error,O=!t&&x&&(Q||K);return e.jsxs(R,{as:"form",id:"import-map",children:[e.jsxs(_e,{children:["Import options",e.jsxs(A,{children:[!s&&e.jsx(Zt,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:I,disabled:D,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:D,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:h(_),disabled:!K,loading:S==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:h(W),disabled:!O,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(ke,{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(([E,L])=>E==="custom"?null:E==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx(re,{id:L,value:j(E),onValueChange:T=>{T!==null&&u(E,T,{shouldDirty:!0})},options:(w==null?void 0:w.map(T=>({value:T,label:T})))||[]})}),e.jsx("td",{className:Ve.singleActionCell})]},L):e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx(M,{id:L,fluid:!0,maxLength:25,defaultValue:L,placeholder:"Use default column name",...c(E)})}),e.jsx("td",{className:Ve.singleActionCell})]},L)),m.map((E,L)=>{var be,ue,de;const T=E.ontimeName,G=E.importName,$=(de=(ue=(be=d.custom)==null?void 0:be[L])==null?void 0:ue.ontimeName)==null?void 0:de.message,k=`custom.${L}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx(M,{maxLength:25,fluid:!0,defaultValue:T,placeholder:"Name of the field as shown in Ontime",...c(`custom.${L}.ontimeName`,{validate:C=>Ht.isAlphanumericWithSpace(C)?!0:"Only alphanumeric characters and space are allowed"})}),$&&e.jsx(N,{children:$})]}),e.jsx("td",{children:e.jsx(M,{maxLength:25,fluid:!0,defaultValue:G,placeholder:"Name of the column in the spreadsheet",...c(`custom.${L}.importName`)})}),e.jsx("td",{className:Ve.singleActionCell,children:e.jsx(J,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>v(L),children:e.jsx(pe,{})})})]},k)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(A,{as:"td",align:"end",children:e.jsxs(f,{onClick:P,children:["Add custom field ",e.jsx(ge,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(N,{children:y.worksheet.error})]})}const nl="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function al(){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(ne,{href:nl,children:"See the docs"})]})}function il(t){const{onCancel:s}=t,{revoke:n,connect:a,verifyAuth:i}=wt(),[l,r]=p.useState(null),[o,h]=p.useState(null),[c,u]=p.useState(""),[j,d]=p.useState(""),x=B(T=>T.sheetId),m=B(T=>T.setSheetId),g=B(T=>T.setWorksheets),b=B(T=>T.patchStepData),y=B(T=>T.authenticationStatus),w=B(T=>T.setAuthenticationStatus),S=B(T=>T.stepData.authenticate.error),F=async()=>{const T=await i();T&&w(T.authenticated)};p.useEffect(()=>{b({authenticate:{available:!1,error:""}}),P()},[]);const _=async()=>{u("cancel"),await n(),await F(),u("")},I=()=>{s()},W=T=>{var G;(G=T.target.files)!=null&&G.length&&r(T.target.files[0])},v=async()=>{if(!l||!x)return;b({worksheet:{available:!1,error:""}}),u("connect");const T=await a(l,x);T&&(d(T.verification_url),h(T.user_code)),u("")},P=async(T=0)=>{const G=await i();if(G!=null&&G.authenticated&&(w(G.authenticated),G.authenticated!=="pending")){if(G.authenticated=="authenticated")try{const $=await en(G.sheetId);g($)}catch($){const k=V($);b({worksheet:{available:!1,error:k}})}u("");return}if(T<=10){setTimeout(()=>P(T+1),2e3);return}u("")},D=async()=>{u("authenticate"),Ut(j),window.addEventListener("focus",async()=>{P()},{once:!0})},Q=l&&x,K=!!o&&!!j,O=!!c,E=y==="authenticated",L=y==="pending";return e.jsxs(R,{children:[e.jsxs(_e,{children:["Sync with Google Sheet (experimental)",E?e.jsx(f,{onClick:_,loading:c==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:I,children:"Go Back"})]}),e.jsxs(oe,{children:[e.jsx(ae,{children:"Upload Client Secret provided by Google"}),e.jsx(N,{children:S}),e.jsx(M,{fluid:!0,type:"file",onChange:W,accept:".json",disabled:O||K})]}),e.jsxs(oe,{children:[e.jsx(ae,{children:"Enter ID of sheet to synchronise"}),e.jsx(N,{children:void 0}),e.jsx(M,{fluid:!0,placeholder:"Sheet ID",onChange:T=>m(T.target.value),disabled:O||K})]}),K?e.jsx(oe,{children:e.jsxs(A,{children:[L&&e.jsx("span",{children:"Authenticating..."}),e.jsx(zt,{copyValue:o??"",disabled:!K,children:o||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:D,disabled:!K,children:[e.jsx(gn,{}),"Authenticate"]})]})}):e.jsx(oe,{children:e.jsx(A,{children:e.jsxs(f,{onClick:v,disabled:!Q||O,loading:c==="connect",children:[e.jsx(dt,{}),"Connect"]})})})]})}const rl="_center_l8uww_17",ll="_nowrap_l8uww_21",ol="_secondaryRow_l8uww_25",cl="_linkStartActive_l8uww_30",dl="_flex_l8uww_36",ul="_subdued_l8uww_42",te={center:rl,nowrap:ll,secondaryRow:ol,linkStartActive:cl,flex:dl,subdued:ul};function Dt(t){return t?"Yes":void 0}function hl({rundown:t,customFields:s}){let n=0;const a=Object.keys(s),i=a.map(l=>s[l].label);return e.jsxs(ke,{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(za(r)){const j=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:{...j},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(Ka(r)){const j=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:{...j},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(!Jt(r))return null;n+=1;const o=r.colour?St(r.colour):{},h=Dt(r.countToEnd),c=Dt(r.skip),u=Dt(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:u&&e.jsx(H,{children:u})}),e.jsxs("td",{className:te.flex,children:[e.jsx("span",{className:r.linkStart?te.subdued:void 0,children:Oe(r.timeStart)}),r.linkStart&&e.jsx(fn,{className:te.linkStartActive})]}),e.jsx("td",{children:Oe(r.timeEnd)}),e.jsx("td",{children:Oe(r.duration)}),e.jsx("td",{children:Oe(r.timeWarning)}),e.jsx("td",{children:Oe(r.timeDanger)}),e.jsx("td",{className:te.center,children:h&&e.jsx(H,{children:h})}),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(j=>{let d="";return j in r.custom&&(d=r.custom[j]),e.jsx("td",{children:d},j)}),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 ml({rundown:t,customFields:s,summary:n,onFinished:a,onCancel:i,onBack:l}){const{data:r}=Xt(),[o,h]=p.useState(!1),{importRundown:c}=wt(),u=B(x=>x.resetPreview),j=()=>{u(),i()},d=async()=>{h(!0),await c({[r.id]:{...t,id:r.id,title:r.title}},s),h(!1),a()};return e.jsxs(R,{children:[e.jsxs(_e,{children:["Review Rundown",e.jsxs(A,{children:[e.jsx(f,{onClick:j,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(oe,{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"})," ",Oe(n.start)]}),e.jsxs(U,{children:[e.jsx("b",{children:"End time"})," ",Oe(n.end)]}),e.jsxs(U,{children:[e.jsx("b",{children:"Total duration"})," ",qt(n.duration)]})]}),e.jsx(hl,{rundown:t,customFields:s})]})}function xl(){const[t,s]=p.useState("none"),[n,a]=p.useState(""),[i,l]=p.useState("none"),{exportRundown:r,importRundownPreview:o,verifyAuth:h}=wt(),c=B(C=>C.setWorksheets),u=B(C=>C.authenticationStatus),j=B(C=>C.setAuthenticationStatus),d=B(C=>C.rundown),x=B(C=>C.setRundown),m=B(C=>C.customFields),g=B(C=>C.setCustomFields),b=B(C=>C.summary),y=B(C=>C.setSummary),w=B(C=>C.setSheetId),S=B(C=>C.sheetId),F=B(C=>C.resetPreview),_=p.useRef(null),I=async C=>{var Ne;const ee=(Ne=C.target.files)==null?void 0:Ne[0];if(!ee){c(null),l("none");return}try{l("loading"),Ir(ee);const Pe=await _r(ee);c(Pe),s("excel"),l("done")}catch(Pe){const je=Qn(Pe);a(`Error uploading file: ${je}`),c(null),l("none")}},W=()=>{var C;(C=_.current)==null||C.click()},v=()=>{s("none"),x(null),l("none"),c(null),g(null),y(null),a(""),w(null)},P=async()=>{const C=await h();if(C&&(j(C.authenticated),w(C.sheetId),C.authenticated==="authenticated"&&C.sheetId))try{const ee=await en(C.sheetId);c(ee)}catch(ee){const Ne=V(ee);a(`Error getting worksheets: ${Ne}`)}s("gsheet")},D=()=>{v()},Q=async C=>{if(a(""),t==="excel")try{const ee=await kr(C);x(ee.rundown),g(ee.customFields),y(ee.summary)}catch(ee){a(V(ee))}if(t==="gsheet"){if(!S)return;await o(S,C)}},K=async()=>{if(v(),u==="authenticated"){const C=await h();C&&j(C.authenticated)}},O=()=>{s("finished"),x(null),l("none"),c(null),g(null),a("")},E=async C=>{S&&await r(S,C)},L=t==="excel",T=t==="gsheet",G=u==="authenticated",$=t==="none",k=t==="finished",be=T&&!G,ue=T&&G||L&&i==="done",de=d!==null&&m!==null&&b!==null;return e.jsx(R,{children:e.jsxs(se,{children:[e.jsx(q,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(N,{children:n}),$&&e.jsxs(e.Fragment,{children:[e.jsx(al,{}),e.jsx("input",{ref:_,style:{display:"none"},type:"file",onChange:I,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(it,{}),"Import from spreadsheet"]}),e.jsx(ae,{children:"Accepts .xlsx files"})]}),e.jsx(ii,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:P,disabled:i!=="none",children:[e.jsx(bn,{}),"Synchronise with Google"]}),e.jsx(ae,{children:"Start authentication process"})]})]})]}),k&&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"})]}),be&&e.jsx(il,{onCancel:D}),ue&&!de&&e.jsx(sl,{hasErrors:!!n,isSpreadsheet:L,onCancel:K,onSubmitExport:E,onSubmitImport:Q}),de&&e.jsx(ml,{rundown:d,customFields:m,summary:b,onFinished:O,onCancel:K,onBack:F})]})})}const jl="_halfWidth_6p65m_17",pl="_fullWidth_6p65m_21",gl="_twoCols_6p65m_25",fl="_current_6p65m_31",jt={halfWidth:jl,fullWidth:pl,twoCols:gl,current:fl};function on({onSubmit:t,onCancel:s,initialColour:n,initialLabel:a,initialKey:i}){const{data:l}=vt(),[r,o]=p.useState(n||""),{handleSubmit:h,register:c,setFocus:u,setError:j,setValue:d,getValues:x,watch:m,formState:{errors:g,isSubmitting:b,isValid:y,isDirty:w}}=ce({defaultValues:{type:"text",label:a||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),S=async v=>{const{type:P,label:D,colour:Q}=v,K={type:P,colour:Q,label:D};try{await t(K)}catch(O){j("root",{type:"custom",message:V(O)})}};p.useEffect(()=>{u("label")},[u]);const F=v=>{o(v),d("colour",v,{shouldDirty:!0})},_=x("colour"),I=w&&y,W=i!==void 0;return e.jsxs(ze,{as:"form",onSubmit:h(S),onKeyDown:v=>fe(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(zs,{orientation:"horizontal",disabled:W,onValueChange:v=>d("type",v,{shouldDirty:!0}),value:m("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:jt.twoCols,children:[e.jsxs("label",{children:[e.jsx(ae,{children:"Label (only alphanumeric characters are allowed)"}),g.label&&e.jsx(N,{children:g.label.message}),e.jsx(M,{...c("label",{required:{value:!0,message:"Required field"},onChange:()=>d("key",fi(x("label"))??"N/A"),validate:v=>v.trim().length===0?"Required field":Ht.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(Fa,{name:"colour",value:_,handleChange:(v,P)=>F(P)})]}),g.root&&e.jsx(N,{children:g.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!I,loading:b,children:"Save"})]})]})}function bl(t){const{colour:s,label:n,fieldKey:a,type:i,onEdit:l,onDelete:r}=t,[o,h]=p.useState(!1),c=async u=>{await l(a,u),h(!1)};return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(on,{onCancel:()=>h(!1),onSubmit:c,initialColour:s,initialLabel:n,initialKey:a})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Oa,{color:s})}),e.jsx("td",{children:e.jsx(H,{children:i})}),e.jsx("td",{className:jt.halfWidth,children:n}),e.jsx("td",{className:jt.fullWidth,children:e.jsx(zt,{size:"small",copyValue:a,children:a})}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(J,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>h(!0),children:e.jsx(pt,{})}),e.jsx(J,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>r(a),children:e.jsx(pe,{})})]})]})}function yl(){const{data:t,refetch:s}=vt(),[n,a]=p.useState(!1),i=()=>{a(!0)},l=()=>{a(!1)},r=async c=>{await ei(c),s(),a(!1)},o=async(c,u)=>{await ti(c,u),s()},h=async c=>{try{await si(c),s()}catch{}};return e.jsx(R,{children:e.jsxs(se,{children:[e.jsxs(q,{children:["Custom fields",e.jsxs(f,{onClick:i,children:["New ",e.jsx(ge,{})]})]}),e.jsx(le,{}),e.jsx(R,{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(Gs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(ne,{href:Yn,children:"See the docs"})]})}),e.jsxs(R,{children:[n&&e.jsx(on,{onSubmit:r,onCancel:l}),e.jsxs(ke,{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:u,label:j,type:d}])=>e.jsx(bl,{fieldKey:c,colour:u,label:j,type:d,onEdit:o,onDelete:h},c))})]})]})]})})}function vl(){const{data:t,status:s,isError:n,refetch:a,isFetching:i}=Vt({queryKey:ve,queryFn:({signal:l})=>Ja({signal:l}),placeholderData:(l,r)=>l,refetchInterval:Ws});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:a,isFetching:i}}function cn(){const t=Mt(),{mutateAsync:s}=Je({mutationFn:Ga,onMutate:()=>{t.cancelQueries({queryKey:ve})},onSuccess:r=>{t.setQueryData(ve,r.data)}}),{mutateAsync:n}=Je({mutationFn:Ha,onMutate:()=>{t.cancelQueries({queryKey:ve})},onSuccess:r=>{t.setQueryData(ve,r.data)}}),{mutateAsync:a}=Je({mutationFn:([r,o])=>qa(r,o),onMutate:()=>{t.cancelQueries({queryKey:ve})},onSuccess:r=>{t.setQueryData(ve,r.data)}}),{mutateAsync:i}=Je({mutationFn:Qa,onMutate:()=>{t.cancelQueries({queryKey:ve})},onSuccess:r=>{t.setQueryData(ve,r.data)}}),{mutateAsync:l}=Je({mutationFn:Ya,onMutate:()=>{t.cancelQueries({queryKey:ve})},onSuccess:r=>{t.setQueryData(ve,r.data)}});return{create:s,duplicate:n,remove:i,load:l,rename:a}}function wl({onSubmit:t,onCancel:s,initialTitle:n}){const{handleSubmit:a,register:i,setFocus:l,setError:r,formState:{errors:o,isSubmitting:h,isValid:c,isDirty:u}}=ce({defaultValues:{title:n},mode:"onChange"}),j=async x=>{try{await t(x.title)}catch(m){r("root",{type:"custom",message:V(m)})}};p.useEffect(()=>{l("title")},[l]);const d=u&&c;return e.jsxs(ze,{as:"form",onSubmit:a(j),onKeyDown:x=>fe(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":Ht.isAlphanumericWithSpace(x)===!1?"Title can only contain alphanumeric characters, spaces and underscores":!0}),fluid:!0}),o.title&&e.jsx(N,{children:o.title.message})]}),o.root&&e.jsx(N,{children:o.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!d,loading:h,children:"Save"})]})]})}function Sl({onClose:t}){const{create:s}=cn(),{handleSubmit:n,register:a,setFocus:i,setError:l,formState:{errors:r,isSubmitting:o}}=ce({defaultValues:{title:""}}),h=async c=>{try{await s(c.title||"untitled"),t()}catch(u){l("root",{message:`Failed to create rundown. ${u}`})}};return p.useEffect(()=>{i("title")},[i]),e.jsxs(ze,{as:"form",onSubmit:n(h),children:[e.jsx(R,{children:e.jsxs("label",{children:[e.jsx(ae,{children:"Rundown title"}),e.jsx(M,{...a("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:o,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:o,children:"Create rundown"})]}),r.root&&e.jsx(N,{children:r.root.message})]})}function Cl(){var P;const{data:t}=vl(),{duplicate:s,remove:n,load:a,rename:i}=cn(),[l,r]=Ee(),[o,h]=Ee(),[c,u]=Ee(),[j,d]=p.useState(""),[x,m]=p.useState(null),[g,b]=p.useState(null),y=D=>{b(null),d(D),h.open()},w=D=>{b(null),d(D),r.open()},S=D=>{b(null),m(D)},F=async()=>{try{await a(j)}catch(D){b(`Failed to load rundown. ${V(D)}`)}finally{h.close()}},_=async D=>{b(null),m(null),d("");try{await s(D)}catch(Q){b(`Failed to duplicate rundown. ${V(Q)}`)}},I=async(D,Q)=>{try{await i([D,Q]),m(null)}catch(K){b(`Failed to rename rundown. ${V(K)}`)}},W=async()=>{try{await n(j)}catch(D){b(`Failed to delete rundown. ${V(D)}`)}finally{r.close()}},v=async(D,Q)=>{await Tr(D,Q)};return e.jsxs(e.Fragment,{children:[e.jsx(R,{children:e.jsxs(se,{children:[e.jsxs(q,{children:["Manage project rundowns",e.jsx(A,{children:e.jsxs(f,{onClick:()=>{b(null),u.open()},children:["New ",e.jsx(ge,{})]})})]}),e.jsx(le,{}),e.jsxs(R,{children:[c&&e.jsx(Sl,{onClose:u.close}),g&&e.jsx(N,{children:g}),e.jsxs(ke,{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:(P=t==null?void 0:t.rundowns)==null?void 0:P.map(({id:D,numEntries:Q,title:K})=>{const O=t.loaded===D;return x===D?e.jsx("tr",{children:e.jsx("td",{colSpan:3,children:e.jsx(wl,{onCancel:()=>m(null),onSubmit:L=>I(D,L),initialTitle:K})})},D):e.jsxs("tr",{className:Ce([O&&jt.current]),children:[e.jsx("td",{children:Q}),e.jsxs("td",{children:[K," ",O&&e.jsx(H,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(Qt,{render:e.jsx(J,{variant:"ghosted-white"}),items:[{type:"item",icon:Rs,label:"Rename",onClick:()=>S(D)},{type:"item",icon:it,label:"Load",onClick:()=>y(D),disabled:O},{type:"item",icon:Es,label:"Download .xlsx",onClick:()=>v(D,K)},{type:"item",icon:yn,label:"Duplicate",onClick:()=>_(D)},{type:"divider"},{type:"destructive",icon:pe,label:"Delete",onClick:()=>w(D),disabled:O}],children:e.jsx(Is,{})})})]},D)})})]})]})]})}),e.jsx(xt,{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(xt,{isOpen:o,onClose:h.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:h.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:F,children:"Load rundown"})]})})]})}function _l(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:a,defaultDangerTime:i,defaultTimerType:l,defaultEndAction:r,setDefaultDuration:o,setLinkPrevious:h,setTimeStrategy:c,setWarnTime:u,setDangerTime:j,setDefaultTimerType:d,setDefaultEndAction:x}=Ks(y=>y),m=qe(t),g=qe(a),b=qe(i);return e.jsx(R,{children:e.jsxs(se,{children:[e.jsx(q,{children:"Rundown defaults"}),e.jsx(le,{}),e.jsxs(R,{children:[e.jsx(_e,{children:"Default settings for new events"}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{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:h})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(re,{value:n,onValueChange:y=>{y!==null&&c(y)},options:[{value:js.LockDuration,label:"Duration"},{value:js.LockEnd,label:"End Time"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{title:"Default duration",description:"Default duration for new events"}),e.jsx(He,{name:"defaultDuration",submitHandler:(y,w)=>o(w),time:m,placeholder:nt.duration})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(re,{value:l,onValueChange:y=>{y!==null&&d(y)},options:[{value:lt.CountDown,label:"Count down"},{value:lt.CountUp,label:"Count up"},{value:lt.Clock,label:"Clock"},{value:lt.None,label:"None"}]})]}),e.jsxs(U,{children:[e.jsx(z,{title:"End Action",description:"Default end action for new events"}),e.jsx(re,{value:r,onValueChange:y=>{y!==null&&x(y)},options:[{value:Tt.None,label:"None"},{value:Tt.LoadNext,label:"Load next"},{value:Tt.PlayNext,label:"Play next"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(y,w)=>u(w),time:g,placeholder:nt.warnTime})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(y,w)=>j(w),time:b,placeholder:nt.dangerTime})]})]})]})]})})}function kl({location:t}){const s=ie("defaults",t),n=ie("custom",t),a=ie("rundowns",t),i=ie("sheets",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(_l,{})}),e.jsx("div",{ref:n,children:e.jsx(yl,{})}),e.jsx("div",{ref:a,children:e.jsx(Cl,{})}),e.jsx("div",{ref:i,children:e.jsx(xl,{})})]})}const Tl="_textEntry_1xa10_17",Nl="_inlineEntry_1xa10_25",Dl="_redirect_1xa10_32",Pl="_label_1xa10_36",Fe={textEntry:Tl,inlineEntry:Nl,redirect:Dl,label:Pl};function Rl({id:t,isOpen:s,name:n,currentPath:a,origin:i,onClose:l}){const{data:r}=Vs(),[o,h]=p.useState(a),[c,u]=p.useState("/"),{setRedirect:j}=Us,d=g=>{g==="/"||g===a||(g.startsWith("preset-")?j({target:t,redirect:g.slice(7)}):j({target:t,redirect:g}),l())},x=r.filter(g=>g.enabled),m=[...Jn.map(g=>({value:`/${g.url}`,label:g.label})),...x.map(g=>({value:`preset-${g.alias}`,label:`URL Preset: ${g.alias}`}))];return e.jsx(xt,{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(Gs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:Fe.inlineEntry,children:[e.jsx("span",{className:Fe.label,children:"Enter custom path"}),e.jsxs("label",{className:Fe.textEntry,children:[i,e.jsx(M,{placeholder:"eg. /timer",fluid:!0,value:o,onChange:g=>h(g.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:o===a||o==="",className:Fe.redirect,onClick:()=>d(o),children:["Redirect",e.jsx(os,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:Fe.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:Fe.inlineEntry,children:[e.jsxs("label",{className:Fe.textEntry,children:[i,e.jsx(re,{fluid:!0,options:m,defaultValue:m[0].value,onValueChange:g=>{g!==null&&u(g)},disabled:x.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:Fe.redirect,disabled:x.length===0||c==="/",onClick:()=>d(c),children:["Redirect ",e.jsx(os,{})]})]})]})]})})}const El="_blink_vtewd_1",Il="_halfWidthNoWrap_vtewd_25",Ll="_copiable_vtewd_30",$t="_self_vtewd_35",tt={blink:El,halfWidthNoWrap:Il,copiable:Ll,self:$t};function Al(){const t=us(m=>m.id),s=us(m=>m.clients),[n,a]=Ee(),[i,l]=Ee(),{setIdentify:r}=Us,[o,h]=p.useState(""),c=m=>{h(m),l.open()},u=m=>{h(m),a.open()},j=Object.entries(s).filter(([m,{type:g}])=>g==="ontime"),d=Object.entries(s).filter(([m,{type:g}])=>g!=="ontime"),x=s[o];return e.jsxs(e.Fragment,{children:[n&&x!==void 0&&e.jsx(Rl,{id:o,name:x.name,origin:x.origin,currentPath:x.path,isOpen:n,onClose:a.close}),i&&e.jsx(Xn,{id:o,name:x==null?void 0:x.name,isOpen:i,onClose:l.close}),e.jsxs(R,{children:[e.jsxs(_e,{children:["Ontime Clients (",j.length,")"]}),e.jsxs(ke,{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:j.map(([m,g])=>{const{identify:b,name:y,path:w}=g,S=t===m;return e.jsxs("tr",{className:Ce([S&&tt.self]),children:[e.jsxs(A,{relation:"inner",as:"td",children:[S&&e.jsx(H,{children:"SELF"}),y]}),e.jsx("td",{className:tt.copiable,children:w}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${b?tt.blink:""}`,disabled:S,variant:b?"primary":"subtle","data-testid":S?"":"not-self-identify",onClick:()=>{r({target:m,identify:!b})},children:"Identify"}),e.jsx(f,{size:"small","data-testid":S?"":"not-self-rename",onClick:()=>c(m),children:"Rename"}),e.jsx(f,{size:"small",disabled:S,"data-testid":S?"":"not-self-redirect",onClick:()=>u(m),children:"Redirect"})]})]},m)})})]})]}),e.jsx(le,{}),e.jsxs(R,{children:[e.jsxs(_e,{children:["Other Clients (",d.length,")"]}),e.jsxs(ke,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:tt.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:tt.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:d.map(([m,g])=>{const{name:b,type:y}=g;return e.jsxs("tr",{children:[e.jsx("td",{children:b}),e.jsx("td",{children:y})]},m)})})]})]})]})}function Fl(){return e.jsx(R,{children:e.jsxs(se,{children:[e.jsx(q,{children:"Manage clients"}),e.jsx(le,{}),e.jsx(Al,{})]})})}const Ol="_iconRotate_l21m9_17",$l={iconRotate:Ol};function Vl(){const t=s=>{Ms("log",s)};return e.jsx(R,{children:e.jsxs(se,{children:[e.jsxs(q,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(gt,{className:$l.iconRotate})]})]}),e.jsx(le,{}),e.jsx(Zn,{})]})})}function Ml({location:t}){const s=ie("clients",t),n=ie("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Network"}),ea,e.jsx("div",{ref:n,children:e.jsx(Vl,{})}),e.jsx("div",{ref:s,children:e.jsx(Fl,{})})]})}const Cs={project:{title:""},settings:{timeFormat:"24",language:"en"}};function Wl({isOpen:t,onClose:s}){var y,w,S,F;const{defaultWarnTime:n,defaultDangerTime:a,setDangerTime:i,setWarnTime:l}=Ks(),{handleSubmit:r,register:o,formState:{errors:h,isSubmitting:c,isValid:u},watch:j,setError:d,setValue:x}=ce({defaultValues:Cs,values:Cs,resetOptions:{keepDirtyValues:!0}}),m=async _=>{try{_.project.title===""&&(_.project.title="untitled"),await Vr(_),await Qe(),s()}catch(I){d("root",{message:V(I)})}},g=qe(n),b=qe(a);return e.jsx(Yt,{isOpen:t,onClose:s,showBackdrop:!0,showCloseButton:!0,title:"Create new project...",bodyElements:e.jsxs("form",{onSubmit:r(m),id:"quick-start",children:[e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{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(z,{title:"Time format",description:"Default time format to show in views 12 / 24 hours (does not affect editor)",error:(w=(y=h.settings)==null?void 0:y.timeFormat)==null?void 0:w.message}),e.jsx(re,{value:j("settings.timeFormat"),onValueChange:_=>{_!==null&&x("settings.timeFormat",_,{shouldDirty:!0})},defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Views language",description:"Language to be displayed in views",error:(F=(S=h.settings)==null?void 0:S.language)==null?void 0:F.message}),e.jsx(re,{value:j("settings.language"),onValueChange:_=>{_!==null&&x("settings.language",_,{shouldDirty:!0})},defaultValue:"en",options:[{value:"en",label:"English"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"it",label:"Italian"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(He,{name:"warnTime",submitHandler:(_,I)=>l(I),time:g,placeholder:nt.warnTime})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(He,{name:"dangerTime",submitHandler:(_,I)=>i(I),time:b,placeholder:nt.dangerTime})]})]})]}),footerElements:e.jsxs(e.Fragment,{children:[(h==null?void 0:h.root)&&e.jsx(N,{children:h.root.message}),e.jsx(f,{variant:"ghosted",onClick:s,disabled:!1,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",form:"quick-start",disabled:!u,loading:c,children:"Create project"})]})})}const Ul="_current_13n43_17",Bl="_isEditing_13n43_21",zl="_form_13n43_25",Kl="_formInput_13n43_33",Gl="_saveButton_13n43_37",Hl="_containCell_13n43_41",ql="_sortableHeader_13n43_45",Ql="_innerColumn_13n43_55",Yl="_inlineLabels_13n43_63",Jl="_warningInfo_13n43_68",Xl="_empty_13n43_72",me={current:Ul,isEditing:Bl,form:zl,formInput:Kl,saveButton:Gl,containCell:Hl,sortableHeader:ql,innerColumn:Ql,inlineLabels:Yl,warningInfo:Jl,empty:Xl};function Zl({onClose:t}){const[s,n]=p.useState(null),{handleSubmit:a,register:i,formState:{isSubmitting:l,isValid:r},setFocus:o}=ce({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{o("title")},[o]);const h=async c=>{try{n(null);const u=c.title??"untitled";await $r({filename:u}),t()}catch(u){n(V(u))}};return e.jsxs(ze,{as:"form",onSubmit:a(h),onKeyDown:c=>fe(c,t),children:[e.jsxs(_e,{children:["Create new project",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:l,children:"Cancel"}),e.jsx(f,{disabled:!r,type:"submit",loading:l,variant:"primary",children:"Create project"})]})]}),s&&e.jsx(N,{children:s}),e.jsxs(R,{className:me.innerColumn,children:[e.jsx(ae,{children:"Project title"}),e.jsx(M,{fluid:!0,placeholder:"Your project name",...i("title")})]})]})}const eo={files:[],lastLoadedProject:""};function to(){const{data:t,status:s,refetch:n}=Vt({queryKey:ta,queryFn:({signal:a})=>Mr({signal:a}),placeholderData:(a,i)=>a,refetchInterval:Ws});return{data:t??eo,status:s,refetch:n}}const so={"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 dn(t="modified-desc"){const s=to(),{files:n,lastLoadedProject:a}=s.data,i=p.useMemo(()=>{if(!n.length)return[];const l=[...n].sort(so[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 no({action:t,filename:s,onSubmit:n,onCancel:a}){const{handleSubmit:i,register:l,formState:{isSubmitting:r,isDirty:o,isValid:h},setFocus:c}=ce({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return p.useEffect(()=>{c("filename")},[c]),e.jsxs("form",{onSubmit:i(n),onKeyDown:u=>fe(u,a),className:me.form,children:[e.jsx(M,{className:me.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{onClick:a,variant:"ghosted",disabled:r,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!o||!h||r,type:"submit",className:me.saveButton,children:t})]})]})}async function ao(t,s){const n={};for(const a in s)Xa(a,t)&&s[a]&&(a==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[a]:t[a]}));return n}function io({onClose:t,fileName:s}){const[n,a]=p.useState(null),i=Mt(),{handleSubmit:l,watch:r,setValue:o,formState:{isSubmitting:h,isValid:c,isDirty:u}}=ce({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),j=async d=>{if(Object.values(d).every(m=>!m)){a("At least one option must be selected");return}try{a(null);const{data:m}=await sn(s);if(!m.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 ao(m,d);await an(g),await i.invalidateQueries({queryKey:sa}),t()}catch(m){a(V(m))}};return e.jsxs(R,{as:"form",onSubmit:l(j),children:[e.jsxs(_e,{children:["Partial project merge",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:h,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:!c||!u,loading:h,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(N,{children:n}),e.jsxs(R,{className:Ce([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 ro({current:t,updatedAt:s,editingFilename:n,editingMode:a,filename:i,onRefetch:l,onSubmit:r,onToggleEditMode:o}){const[h,c]=p.useState(null),[u,j]=p.useState(!1),d=_=>async I=>{j(!0),c(null);try{if(!I.filename){c("Filename cannot be blank");return}await(_==="rename"?Br:Ur)(i,I.filename),await l(),r()}catch(W){c(V(W))}finally{j(!1)}},x=async _=>{j(!0),c(null);try{await rn(_),await l(),await Qe()}catch(I){c(V(I))}finally{j(!1)}},m=async _=>{j(!0),c(null);try{await zr(_),await l()}catch(I){c(V(I))}finally{j(!1)}},g=(_,I)=>{c(null),o(_,I)},b=()=>{g(null,null)},y=i===n,w=(a==="rename"||a==="duplicate")&&i===n,S=a==="merge"&&y,F=Ce([t&&!y&&me.current,y&&me.isEditing]);return e.jsxs(e.Fragment,{children:[h&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(N,{children:h})})},"filename-error"),e.jsx("tr",{className:F,children:w?e.jsx("td",{colSpan:99,children:e.jsx(no,{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(lo,{current:t,filename:i,onChangeEditMode:g,onDelete:m,onLoad:x,isDisabled:u||S,onMerge:_=>g("merge",_)})})]})},i),S&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(io,{onClose:b,fileName:i})})})]})}function lo(t){const{current:s,filename:n,isDisabled:a,onChangeEditMode:i,onDelete:l,onLoad:r,onMerge:o}=t,h=()=>{i("rename",n)},c=()=>{i("duplicate",n)},u=async()=>{await Or(n)};return e.jsx(Qt,{render:e.jsx(J,{variant:"ghosted-white"}),disabled:a,items:[{type:"item",icon:it,label:"Load",onClick:()=>r(n),disabled:s},{type:"item",icon:it,label:"Partial Load",onClick:()=>o(n),disabled:s},{type:"item",icon:Rs,label:"Rename",onClick:h},{type:"item",icon:vn,label:"Duplicate",onClick:c},{type:"item",icon:Es,label:"Download",onClick:u},{type:"divider"},{type:"item",icon:pe,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(Is,{})})}function oo(){const[t,s]=p.useState(null),[n,a]=p.useState(null),[i,l]=p.useState("modified-desc"),{data:r,refetch:o,status:h}=dn(i),c=(m,g)=>{s(b=>b===m&&g===n?null:m),a(g)},u=()=>{s(null),a(null)},j=async()=>{await o()},d=m=>{l(g=>{const b=g===`${m}-asc`;return`${m}-${b?"desc":"asc"}`})};if(h==="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(ke,{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(_s,{sortMode:i,type:"alphabetical"})]})}),e.jsx("th",{onClick:()=>d("modified"),children:e.jsxs("span",{className:me.sortableHeader,children:["Last Used",e.jsx(_s,{sortMode:i,type:"modified"})]})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.reorderedProjectFiles.map(m=>e.jsx(ro,{filename:m.filename,updatedAt:m.updatedAt,onToggleEditMode:c,onSubmit:u,onRefetch:j,editingFilename:n,editingMode:t,current:m.filename===r.lastLoadedProject},m.filename))})]})]})}function _s({sortMode:t,type:s}){const n=`${s}-`;return t===`${n}asc`?e.jsx(Ls,{}):t===`${n}desc`?e.jsx(gt,{}):null}function co(){const[t,s]=wn(),[n,a]=p.useState(""),[i,l]=p.useState(null),r=p.useRef(null),o=t.get("new")==="true",h=()=>{t.set("new",o?"false":"true"),s(t)},c=()=>{var d;(d=r.current)==null||d.click()},u=async d=>{var m,g;const x=(g=(m=d.target)==null?void 0:m.files)==null?void 0:g[0];if(x){l("import");try{tn(x),await nn(x)}catch(b){const y=V(b);a(`Error uploading file: ${y}`)}finally{await Qe()}l(null)}},j=()=>{t.delete("new"),s(t)};return e.jsxs(R,{children:[e.jsx("input",{ref:r,style:{display:"none"},type:"file",onChange:u,accept:".json","data-testid":"file-input"}),e.jsxs(se,{children:[e.jsxs(q,{children:["Manage projects",e.jsxs(A,{children:[e.jsx(f,{onClick:c,disabled:!!i||o,loading:i==="import",children:"Import"}),e.jsxs(f,{onClick:h,disabled:!!i||o,children:["New ",e.jsx(ge,{})]})]})]}),n&&e.jsx(N,{children:n}),e.jsx(le,{}),o&&e.jsx(Zl,{onClose:j}),e.jsx(oo,{})]})]})}function uo({location:t,setLocation:s}){const n=ie("list",t),a=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Project"}),e.jsx(Wl,{isOpen:t==="create",onClose:a}),e.jsx("div",{ref:n,children:e.jsx(co,{})})]})}const ho="_container_cq029_17",mo={container:ho};function ks({register:t,formName:s,disabled:n}){const[a,i]=p.useState(!1);return e.jsxs("div",{className:mo.container,children:[e.jsx(M,{type:a?"text":"password",maxLength:4,...t(s,{pattern:{value:$a,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(J,{onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(Sn,{})})]})}const xo=p.lazy(()=>rt(()=>import("./CustomTranslationModal-C5mAtBjW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url));function jo(){var _,I,W,v;const{data:t,status:s,refetch:n}=na(),{handleSubmit:a,register:i,reset:l,setError:r,watch:o,setValue:h,formState:{isSubmitting:c,isDirty:u,isValid:j,errors:d}}=ce({mode:"onChange",defaultValues:t,resetOptions:{keepDirtyValues:!0}}),[x,m]=Ee();p.useEffect(()=>{t&&l(t)},[t,l]);const g=async P=>{try{await aa(P)}catch(D){const Q=V(D);r("root",{message:Q})}finally{await n()}},b=s==="pending",y=c||!u||!j,w="",S=()=>{l(t)},F=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(xo,{isOpen:x,onClose:m.close}),e.jsx(R,{as:"form",onSubmit:a(g),onKeyDown:P=>fe(P,S),id:"app-settings",children:e.jsxs(se,{children:[e.jsxs(q,{children:["General settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!u||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(R,{children:[e.jsx(xe,{children:"Changes to the time format and views language do not affect the editor view"}),e.jsx(Be,{isLoading:F}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(_=d.editorKey)==null?void 0:_.message}),e.jsx(ks,{register:i,formName:"editorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(I=d.operatorKey)==null?void 0:I.message}),e.jsx(ks,{register:i,formName:"operatorKey",disabled:b})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Time format",description:"Default time format to show in views 12 / 24 hours",error:(W=d.timeFormat)==null?void 0:W.message}),e.jsx(re,{value:o("timeFormat"),onValueChange:P=>{P!==null&&h("timeFormat",P,{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(z,{title:"Views language",description:"Language to be displayed in views",error:(v=d.language)==null?void 0:v.message}),e.jsx(re,{value:o("language"),onValueChange:P=>{P!==null&&h("language",P,{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:m.open,children:"Edit custom translation"})]})]})]})]})})]})}const po="_uploadLogoCard_m5263_17",go="_customDataItem_m5263_32",fo="_titleRow_m5263_39",bo="_customImage_m5263_48",yo="_imageContainer_m5263_54",Ge={uploadLogoCard:po,customDataItem:go,titleRow:fo,customImage:bo,imageContainer:yo};function vo(){var K;const{data:t,status:s}=oi(),{updateProjectData:n}=ci(),{handleSubmit:a,register:i,reset:l,formState:{isSubmitting:r,isValid:o,isDirty:h,errors:c},setError:u,clearErrors:j,watch:d,control:x,setValue:m}=ce({defaultValues:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:g,append:b,remove:y}=ht({control:x,name:"custom"});p.useEffect(()=>{t&&l(t)},[t,l]);const w=async O=>{var L;const E=(L=O.target.files)==null?void 0:L[0];if(j("logo"),!!E)try{Fr(E);const T=await di(E);m("logo",T.data.logoFilename,{shouldDirty:!0})}catch(T){const G=V(T);u("logo",{message:G})}},{ref:S,...F}=i("logo"),_=p.useRef(null),I=()=>{var O;(O=_.current)==null||O.click()},W=O=>{O.preventDefault(),O.stopPropagation(),m("logo",null,{shouldDirty:!0})},v=()=>{b({title:"",value:"",url:""})},P=async O=>{try{j(),await n(O)}catch(E){const L=V(E);u("root",{message:L})}},D=()=>{l(t)},Q=s==="pending";return e.jsx(R,{as:"form",onSubmit:a(P),onKeyDown:O=>fe(O,D),children:e.jsxs(se,{children:[e.jsxs(q,{children:["Project data",e.jsxs(A,{children:[e.jsx(f,{onClick:D,disabled:r||!h,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!h||!o,loading:r,children:"Save"})]})]}),e.jsx(le,{}),e.jsxs(R,{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(R,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...F,ref:O=>{S(O),_.current=O},onChange:w}),e.jsxs(se,{className:Ge.uploadLogoCard,children:[d("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${ia}/${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:I,type:"button",children:[e.jsx(it,{}),"Upload logo"]}),((K=c==null?void 0:c.logo)==null?void 0:K.message)&&e.jsx(N,{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(At,{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:Bt,...i("url")})]}),e.jsxs(R,{style:{marginTop:0},children:[e.jsxs(U,{children:[e.jsx(z,{title:"Custom data",description:""}),e.jsxs(f,{onClick:v,children:["Add ",e.jsx(ge,{})]})]}),g.length>0&&g.map((O,E)=>{var T,G,$;const L=(T=c.custom)==null?void 0:T[E];return e.jsxs("div",{className:Ge.customDataItem,children:[e.jsxs("div",{className:Ge.titleRow,children:[e.jsxs("label",{className:Ge.title,children:["Title",e.jsx(M,{fluid:!0,defaultValue:O.title,placeholder:"Title of your custom data",...i(`custom.${E}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>y(E),children:[e.jsx(pe,{}),"Delete"]})]}),((G=L==null?void 0:L.title)==null?void 0:G.message)&&e.jsx(N,{children:L.title.message}),e.jsxs("label",{children:["Text",e.jsx(At,{fluid:!0,rows:3,resize:"vertical",defaultValue:O.value,placeholder:"Text of your custom data",...i(`custom.${E}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),(($=L==null?void 0:L.value)==null?void 0:$.message)&&e.jsx(N,{children:L.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Ge.customImage,children:[e.jsx(M,{fluid:!0,defaultValue:O.url,placeholder:"Paste image URL (optional)",...i(`custom.${E}.url`)}),e.jsx("div",{className:Ge.imageContainer,children:d(`custom.${E}.url`)&&e.jsx("img",{src:d(`custom.${E}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},O.id)})]})]})]})})}function wo(){var x;const{handleSubmit:t,register:s,reset:n,setError:a,formState:{isSubmitting:i,isDirty:l,isValid:r,errors:o}}=ce({mode:"onChange",defaultValues:{serverPort:4001}}),[h,c]=p.useState(!1),u=p.useCallback(m=>{n({serverPort:m.port}),c(m.pendingRestart)},[]);p.useEffect(()=>{Ct().then(u).catch(()=>a("root",{message:"Failed to load server port"}))},[n,a,u]);const j=async m=>{if(m.serverPort<1024||m.serverPort>65535){a("serverPort",{message:"Port must be within range 1024 - 65535"});return}try{await ra(m.serverPort),u(await Ct())}catch(g){a("root",{message:V(g)})}},d=async()=>{try{u(await Ct())}catch{a("root",{message:"Failed to load server port"})}};return e.jsx(R,{as:"form",onSubmit:t(j),onKeyDown:m=>fe(m,d),id:"server-port-settings",children:e.jsxs(se,{children:[e.jsxs(q,{children:["Server port",e.jsxs(A,{children:[h&&e.jsx(H,{children:"A port change is pending and will happen on the next restart"}),e.jsx(f,{disabled:!l||i,variant:"ghosted",onClick:d,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"server-port-settings",name:"server-port-settings-submit",loading:i,disabled:!l||!r||i,variant:"primary",children:"Save"})]})]}),o.root&&e.jsx(N,{children:o.root.message}),e.jsx(le,{}),e.jsx(R,{children:e.jsx(oe,{children:e.jsxs(U,{children:[e.jsx(z,{title:"Ontime server port",description:"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(x=o.serverPort)==null?void 0:x.message}),e.jsx(M,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},...s("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:Bs,message:"Value should be numeric"}})})]})})})]})})}const So="_editorActions_18rtd_17",Co="_right_18rtd_21",_o="_column_18rtd_26",Pt={editorActions:So,right:Co,column:_o},ko=p.lazy(()=>rt(()=>import("./StyleEditor-buc-zQHR.js"),__vite__mapDeps([13,1,2,14]),import.meta.url));function To({isOpen:t,onClose:s}){const[n,a]=p.useState(""),[i,l]=p.useState(!1),[r,o]=p.useState(!1),[h,c]=p.useState(!1),[u,j]=p.useState(null),d=p.useRef(null),x=async()=>{try{c(!0);const b=await la();a(b)}catch{}finally{c(!1)}},m=async()=>{try{o(!0),d.current&&(await oa(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 ca();a(y)}catch{j("Failed to load CSS from server")}}b()},[t]),e.jsx(Yt,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(p.Suspense,{fallback:null,children:e.jsx(ko,{ref:d,initialValue:n,language:"css",isDirty:i,setIsDirty:l})}),footerElements:e.jsxs("div",{className:Pt.column,children:[e.jsx(xe,{children:"Invalid CSS will be refused by the browser"}),u&&e.jsx(N,{className:Pt.right,children:`Error: ${u}`}),e.jsxs(A,{align:"apart",className:Pt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:x,disabled:r||h,children:"Reset to example"}),e.jsxs(A,{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:m,disabled:r||h||!i,loading:r,children:"Save changes"})]})]})]})})}const No="https://docs.getontime.no/features/custom-styling/";function Do(){var b;const{data:t,status:s,mutateAsync:n}=da(),[a,i]=Ee(),{control:l,handleSubmit:r,setError:o,reset:h,setValue:c,watch:u,formState:{isSubmitting:j,isDirty:d,errors:x}}=ce({defaultValues:t,resetOptions:{keepDirtyValues:!0}});p.useEffect(()=>{t&&h(t)},[t,h]);const m=async y=>{try{n(y)}catch(w){const S=V(w);o("root",{message:S})}},g=()=>{h(t)};return l?e.jsx(R,{as:"form",onSubmit:r(m),onKeyDown:y=>fe(y,g),id:"view-settings",children:e.jsxs(se,{children:[e.jsxs(q,{children:["View settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!d,variant:"ghosted",onClick:g,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:j,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(ne,{href:No,children:"See the docs"})]}),e.jsxs(R,{children:[e.jsx(Be,{isLoading:s==="pending"}),e.jsx(N,{children:(b=x.root)==null?void 0:b.message}),e.jsxs(oe,{children:[e.jsx(To,{isOpen:a,onClose:i.close}),e.jsxs(U,{children:[e.jsx(z,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(De,{size:"large",checked:u("overrideStyles"),onCheckedChange:y=>c("overrideStyles",y,{shouldDirty:!0})}),e.jsx(f,{onClick:i.open,disabled:j,children:"Edit CSS override"})]})]}),e.jsxs(oe,{children:[e.jsxs(U,{children:[e.jsx(z,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(kt,{name:"normalColor",control:l})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(kt,{name:"warningColor",control:l})]}),e.jsxs(U,{children:[e.jsx(z,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(kt,{name:"dangerColor",control:l})]})]})]})]})}):null}function Po({location:t}){const s=ie("data",t),n=ie("general",t),a=ie("port",t),i=ie("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(vo,{})}),e.jsx("div",{ref:n,children:e.jsx(jo,{})}),e.jsx("div",{ref:i,children:e.jsx(Do,{})}),e.jsx("div",{ref:a,children:e.jsx(wo,{})})]})}function Ro(){const{isElectron:t,sendToElectron:s}=ua(),[n,a]=Ee(),i=p.useRef(null),l=()=>{s("shutdown","now"),a.close()},r=t||mt;return e.jsxs(e.Fragment,{children:[e.jsx(Me,{children:"Shutdown Ontime"}),e.jsxs(R,{children:[ft?e.jsx(ha,{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||mt),children:"Shutdown ontime"}),!r&&e.jsx(ae,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(xt,{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 Eo="_corner_d5zq9_17",Io="_contentWrapper_d5zq9_24",Lo="_content_d5zq9_24",Rt={corner:Eo,contentWrapper:Io,content:Lo};function Ao({onClose:t,children:s}){return e.jsxs("div",{className:Rt.contentWrapper,children:[e.jsx("div",{className:Rt.content,children:s}),e.jsx("div",{className:Rt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(Wt,{})]})})]})}const Fo=[{id:"settings",label:"Settings",secondary:[{id:"settings__data",label:"Project data"},{id:"settings__general",label:"General settings"},{id:"settings__view",label:"View settings"},{id:"settings__port",label:"Server Port"}]},{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 Oo(){const{data:t}=Xs();return{options:p.useMemo(()=>Fo.map(n=>({...n,secondary:"secondary"in n?[...n.secondary]:void 0,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const $o="_tabs_1n4uf_17",Vo="_primary_1n4uf_33",Mo="_secondary_1n4uf_34",Wo="_active_1n4uf_56",Uo="_highlight_1n4uf_60",Bo="_split_1n4uf_70",We={tabs:$o,primary:Vo,secondary:Mo,active:Wo,highlight:Uo,split:Bo};function zo({selectedPanel:t,location:s}){const{options:n}=Oo();return e.jsx("ul",{className:We.tabs,children:n.map(a=>{const i=t===a.id;return a.highlight?e.jsx(Zt,{text:a.highlight,render:e.jsx("span",{}),children:e.jsx(Ts,{panel:a,location:s,isSelected:i})},a.id):e.jsx(Ts,{panel:a,location:s,isSelected:i},a.id)})})}function Ts(t){var r;const{panel:s,isSelected:n,location:a}=t,{setLocation:i}=es(),l=Ce([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=>{hs(o)&&i(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(r=s.secondary)==null?void 0:r.map((o,h)=>{const c=o.id.split("__")[1],u=Ce([We.secondary,n&&a===c?We.active:null]);return e.jsx("li",{onClick:()=>i(o.id),onKeyDown:j=>{hs(j)&&i(o.id)},className:u,role:"button",children:o.label},o.id+h)})]},s.id)}const Ko="_container_1fy3l_17",Go={container:Ko};function Ho(){const{close:t,panel:s,location:n,setLocation:a}=es();return yi(t,"Escape"),e.jsx("div",{className:Go.container,children:e.jsxs(Cn,{children:[e.jsx(zo,{selectedPanel:s,location:n}),e.jsxs(Ao,{onClose:t,children:[s==="settings"&&e.jsx(Po,{location:n}),s==="project"&&e.jsx(uo,{location:n,setLocation:a}),s==="manage"&&e.jsx(kl,{location:n}),s==="automation"&&e.jsx(ar,{location:n}),s==="sharing"&&e.jsx(Cr,{location:n}),s==="network"&&e.jsx(Ml,{location:n}),s==="about"&&e.jsx(_i,{}),s==="shutdown"&&e.jsx(Ro,{})]})]})})}const qo=p.memo(Qo);function Qo({children:t}){const{layoutMode:s}=ts();return e.jsxs(xi,{navElements:t,children:[s===Se.PLANNING&&e.jsx(Yo,{}),s===Se.TRACKING&&e.jsx(Jo,{}),s===Se.CONTROL&&e.jsx(Xo,{})]})}function Yo(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ns.inline,children:[e.jsx(Js,{}),e.jsx(hi,{}),e.jsx(mi,{})]}),e.jsx(ss,{})]})}function Jo(){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ns.inline,children:[e.jsx(Hs,{}),e.jsx(qs,{}),e.jsx(Qs,{})]}),e.jsx(Ys,{}),e.jsx(ss,{})]})}function Xo(){return e.jsxs(e.Fragment,{children:[e.jsx(Js,{}),e.jsxs("div",{className:ns.inline,children:[e.jsx(Hs,{}),e.jsx(qs,{}),e.jsx(Qs,{})]}),e.jsx(Ys,{}),e.jsx(ss,{})]})}function Zo({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{tn(l),await nn(l)}catch{}finally{await Qe(),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 ec="_sections_ar7bf_17",tc="_column_ar7bf_23",sc="_about_ar7bf_23",nc="_inline_ar7bf_35",ac="_header_ar7bf_41",ic="_logo_ar7bf_48",rc="_buttonRow_ar7bf_53",lc="_tableContainer_ar7bf_62",oc="_table_ar7bf_62",cc="_current_ar7bf_75",we={sections:ec,column:tc,about:sc,inline:nc,header:ac,logo:ic,buttonRow:rc,tableContainer:lc,table:oc,current:cc};function dc(t){const{loadProject:s,onClose:n}=t,{data:a}=dn();return e.jsx("tbody",{children:a.reorderedProjectFiles.map(i=>i.filename===a.lastLoadedProject?e.jsxs("tr",{className:we.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 uc({onClose:t}){const s=_n(),n=async l=>{try{await rn(l),await Qe(),t()}catch{}},a=async()=>{try{await Wr(),await Qe(),t()}catch{}},i=()=>{s("/editor?settings=project__create"),t()};return e.jsx(Yt,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:we.sections,children:[e.jsxs("div",{className:we.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:we.logo}),e.jsxs("div",{children:["Ontime v",ut]}),e.jsx(ne,{href:It,children:"Website"}),e.jsx(ne,{href:Bt,children:"Read the docs"}),e.jsx(ne,{href:Fs,children:"Discord server"})]}),e.jsxs("div",{className:we.column,children:[e.jsxs("div",{className:we.header,children:["Welcome to Ontime",e.jsx(J,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(Wt,{})})]}),e.jsx(li,{children:"Select project"}),e.jsx("div",{className:we.tableContainer,children:e.jsxs("table",{className:we.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(dc,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:we.column,children:[e.jsxs("div",{className:we.buttonRow,children:[e.jsx(f,{onClick:a,children:"Load demo project"}),e.jsx(Zo,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:i,children:"Create new..."})]}),e.jsxs(ri,{className:we.inline,children:[e.jsx(Ma,{defaultChecked:!0,onCheckedChange:l=>ma(l)}),"Show this modal on next startup"]})]})})}function hc(){const t=ms(n=>n.showDialog),s=ms(n=>n.clearDialog);return t?e.jsx(uc,{onClose:s}):null}const mc="_container_12ac0_17",xc="_itemGroup_12ac0_27",jc="_goButton_12ac0_34",pc="_iconButtonWithLabel_12ac0_35",gc="_iconButton_12ac0_35",fc="_goLabel_12ac0_55",bc="_shortcutHint_12ac0_61",yc="_addSection_12ac0_66",vc="_separator_12ac0_70",wc="_timerSection_12ac0_77",Sc="_negativeIndicator_12ac0_84",Cc="_auxSection_12ac0_95",_c="_auxTimeInput_12ac0_108",kc="_auxTimeDisplay_12ac0_109",Y={container:mc,itemGroup:xc,goButton:jc,iconButtonWithLabel:pc,iconButton:gc,goLabel:fc,shortcutHint:bc,addSection:yc,separator:vc,timerSection:wc,negativeIndicator:Sc,auxSection:Cc,auxTimeInput:_c,auxTimeDisplay:kc};function Tc(){const t=xa(),{playback:s,numEvents:n,selectedEventIndex:a}=ja(),{playback:i,direction:l}=pa(1),r=ga(1),[o]=kn({key:"add-time",defaultValue:3e5}),{disableGo:h,disableNext:c,disableAddTime:u,isPlaying:j,goAction:d,goLabel:x}=pi({playback:s,numEvents:n,selectedEventIndex:a,timerPhase:t.phase}),m=u||o===0,g=v=>{m||(v==="add"?Ke.addTime(o):Ke.addTime(-1*o))},b=()=>{i===Ze.Start?et.pause(1):et.start(1)},y=()=>{et.stop(1)},w=()=>{const v=l===ot.CountDown?ot.CountUp:ot.CountDown;et.setDirection(1,v)},S=(v,P)=>{const D=qe(P);et.setDuration(1,D)};As([["Space",()=>!h&&d(),{preventDefault:!0}],["N",()=>!c&&Ke.next(),{preventDefault:!0}],["Escape",()=>s!==Xe.Stop&&Ke.stop(),{preventDefault:!0}]]);const F=t.phase===xs.Pending,_=t.phase===xs.Overtime,I=F?t.secondaryTimer:t.current,W=qt(o);return e.jsxs("div",{className:Y.container,children:[e.jsxs("div",{className:Y.itemGroup,children:[e.jsxs(Ae,{onClick:d,disabled:h,theme:Xe.Play,active:j,className:Y.goButton,children:[e.jsx("span",{className:Y.goLabel,children:x}),e.jsx("span",{className:Y.shortcutHint,children:"[space]"})]}),e.jsxs(Ae,{onClick:Ke.next,disabled:c,className:Y.iconButtonWithLabel,aspect:"square",children:[e.jsx(Tn,{}),e.jsx("span",{className:Y.shortcutHint,children:"[n]"})]}),e.jsxs(Ae,{onClick:Ke.stop,disabled:s===Xe.Stop,className:Y.iconButtonWithLabel,aspect:"square",children:[e.jsx(cs,{}),e.jsx("span",{className:Y.shortcutHint,children:"[esc]"})]}),e.jsxs("div",{className:Y.addSection,children:[e.jsx("div",{className:Y.separator}),e.jsxs(Ae,{onClick:()=>g("remove"),disabled:m,className:Y.iconButtonWithLabel,aspect:"square",children:[e.jsx(Nn,{}),W]}),e.jsxs(Ae,{onClick:()=>g("add"),disabled:m,className:Y.iconButtonWithLabel,aspect:"square",children:[e.jsx(ge,{}),W]})]})]}),e.jsxs("div",{className:Y.timerSection,children:[e.jsx("span",{className:Y.negativeIndicator,"data-active":_,children:Lt}),e.jsx(gi,{time:I,phase:t.phase})]}),e.jsxs("div",{className:Y.auxSection,children:[e.jsx(Ae,{onClick:b,className:Y.iconButton,theme:Xe.Play,aspect:"square",children:i===Ze.Start?e.jsx(Dn,{}):e.jsx(Pn,{})}),e.jsx(Ae,{onClick:y,disabled:i===Ze.Stop,className:Y.iconButton,theme:Xe.Stop,aspect:"square",children:e.jsx(cs,{})}),i!==Ze.Stop?e.jsx("div",{className:Y.auxTimeDisplay,children:Oe(r)}):e.jsx(He,{name:"aux1-tracking",submitHandler:S,time:r,className:Y.auxTimeInput}),e.jsx(Ae,{onClick:w,disabled:i!==Ze.Stop,className:Y.iconButton,aspect:"square",children:l===ot.CountDown?e.jsx(Ls,{}):e.jsx(gt,{})})]})]})}const Ns=5;function Nc(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+Ns:Ns}}const Dc="_container_qfgjn_17",Pc="_emptyState_qfgjn_22",Rc="_emptyMessage_qfgjn_30",Ec="_emptyTitle_qfgjn_36",Ic="_emptyBody_qfgjn_43",st={container:Dc,emptyState:Pc,emptyMessage:Rc,emptyTitle:Ec,emptyBody:Ic};function Lc(){return e.jsx("div",{className:st.container,children:e.jsx("div",{className:st.emptyState,children:e.jsxs("div",{className:st.emptyMessage,children:[e.jsx("h3",{className:st.emptyTitle,children:"No events yet"}),e.jsx("p",{className:st.emptyBody,children:"Add events in the rundown to populate this list."})]})})})}const Ac="_item_1nasm_17",Fc="_title_1nasm_36",Oc="_colourBar_1nasm_76",$c="_chipSlot_1nasm_100",Vc="_chipText_1nasm_121",at={item:Ac,title:Fc,colourBar:Oc,chipSlot:$c,chipText:Vc},Mc=p.memo(Wc);function Wc({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]),h=s>0&&t.eventIndex>s&&t.eventIndex<=s+2,c=i===Ue.Run&&t.isPast,u=t.isLoaded?i===Ue.Run?"running":"selected":c?"past":h?"next":"default",j=a&&!t.isLoaded&&!t.isPast&&!t.skip,d=j&&t.eventIndex<=n;return e.jsxs("li",{"data-state":u,"data-skipped":t.skip||void 0,"data-group-end":l||void 0,className:at.item,onClick:o,children:[e.jsx("div",{className:at.colourBar,style:{backgroundColor:t.groupColour||"transparent"}}),e.jsx("span",{className:at.title,children:t.title||"Untitled"}),j&&e.jsx(Uc,{timeStart:t.timeStart,delay:t.delay,dayOffset:t.dayOffset,totalGap:t.totalGap,isLinkedToLoaded:t.isLinkedToLoaded,isLoaded:t.isLoaded,showOnHover:!d})]})}const Uc=p.memo(Bc);function Bc({timeStart:t,delay:s,dayOffset:n,totalGap:a,isLinkedToLoaded:i,isLoaded:l,showOnHover:r}){const o=fa({timeStart:t,delay:s,dayOffset:n},{totalGap:a,isLinkedToLoaded:i}),h=!l&&o<ya;let c="LIVE";l||(c=h?"DUE":qt(Math.abs(o),o>2*ba));const u=l?"live":h?"due":"pending";return e.jsx(Zt,{text:"Expected time until start",className:at.chipSlot,"data-hover-only":r||void 0,children:e.jsx("span",{"data-chip-status":u,className:at.chipText,children:c})})}const zc="_container_kcrvg_17",Kc="_list_kcrvg_24",Gc="_bottomSpacer_kcrvg_30",is={container:zc,list:Kc,bottomSpacer:Gc};function Ds({mode:t}){const{data:s}=Xt(),n=va(),a=Va(r=>r.cursor),i=p.useMemo(()=>t===Ue.Run?n:a,[t,n,a]),l=p.useMemo(()=>Za(s,i).filter(Jt),[s,i]);return l.length===0?e.jsx(Lc,{}):e.jsx(Hc,{mode:t,eventData:l,selectedEventId:n,resolvedFollowEventId:i,rundownId:s.id})}function Hc({mode:t,eventData:s,selectedEventId:n,resolvedFollowEventId:a,rundownId:i}){"use memo";const l=p.useRef(null),r=p.useRef(null),o=ui(i),h=p.useMemo(()=>Nc(s),[s]),c=p.useMemo(()=>a?s.findIndex(d=>d.id===a):-1,[s,a]),u=p.useCallback(d=>{o(d)},[o]);p.useEffect(()=>{if(!l.current)return;const d=c!==-1?c:h.index;d!==-1&&(t===Ue.Edit&&d<=3||l.current.scrollToIndex({index:d,align:"start",behavior:"smooth",offset:-50}))},[h.index,c,t]);const j=p.useCallback((d,x)=>{const m=s[d+1],g=!!x.parent&&x.parent!==((m==null?void 0:m.parent)??null);return e.jsx(Mc,{entry:x,currentEventIndex:h.eventIndex,upcomingChipLimit:h.upcomingChipLimit,isRunning:t===Ue.Run&&n!==null,mode:t,onSelect:u,isGroupEnd:g},x.id)},[s,h.eventIndex,h.upcomingChipLimit,t,n,u]);return e.jsx(ji,{className:is.container,ref:r,children:e.jsx(Rn,{ref:l,data:s,computeItemKey:(d,x)=>x.id,itemContent:j,increaseViewportBy:{top:200,bottom:200},customScrollParent:r.current??void 0,components:{List:un,Footer:qc}})})}function un({children:t,...s}){return e.jsx("ul",{...s,className:is.list,children:t})}un.displayName="VirtuosoListComponent";function qc(){return e.jsx("div",{className:is.bottomSpacer})}const Qc="_panelContainer_1exbp_17",Yc="_panelContainerTracking_1exbp_26",Jc="_left_1exbp_31",Xc="_rundownLayout_1exbp_40",Zc="_rundownPanel_1exbp_48",ed="_titlesPanel_1exbp_55",ye={panelContainer:Qc,panelContainerTracking:Yc,left:Jc,rundownLayout:Xc,rundownPanel:Zc,titlesPanel:ed},Et=p.lazy(()=>rt(()=>import("./RundownExport-Bvc1J50m.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)),td=p.lazy(()=>rt(()=>import("./TimerControlExport-De2n8HWG.js"),__vite__mapDeps([41,1,2,16,3,4,17,18,19,21,22,23,42,43,25,26,37,44]),import.meta.url)),sd=p.lazy(()=>rt(()=>import("./MessageControlExport-BN6OfADo.js"),__vite__mapDeps([45,1,2,16,3,4,17,18,19,8,9,25,26,46]),import.meta.url));function nd(){const{layoutMode:t}=ts();return t===Se.CONTROL?e.jsxs("div",{id:"panels",className:ye.panelContainer,children:[e.jsxs("div",{className:ye.left,children:[e.jsx(td,{}),e.jsx(sd,{})]}),e.jsx(Et,{})]}):t===Se.TRACKING?e.jsxs("div",{id:"panels",className:`${ye.panelContainer} ${ye.panelContainerTracking}`,children:[e.jsxs("div",{className:ye.rundownLayout,children:[e.jsx("div",{className:ye.titlesPanel,children:e.jsx(Ds,{mode:Ue.Run})}),e.jsx("div",{className:ye.rundownPanel,children:e.jsx(Et,{})})]}),e.jsx(Tc,{})]}):e.jsx("div",{id:"panels",className:ye.panelContainer,children:e.jsxs("div",{className:ye.rundownLayout,children:[e.jsx("div",{className:ye.titlesPanel,children:e.jsx(Ds,{mode:Ue.Edit})}),e.jsx("div",{className:ye.rundownPanel,children:e.jsx(Et,{})})]})})}const ad=p.memo(id);function id(){const{layoutMode:t,setLayoutMode:s}=ts(),n=p.useMemo(()=>[{type:"item",label:"Planning",description:"Edit-focused list with planning stats",icon:t===Se.PLANNING?dt:void 0,onClick:()=>s(Se.PLANNING)},{type:"item",label:"Tracking",description:"Live timing view with progress and offsets",icon:t===Se.TRACKING?dt:void 0,onClick:()=>s(Se.TRACKING)},{type:"item",label:"Control",description:"All controls and rundown together",icon:t===Se.CONTROL?dt:void 0,onClick:()=>s(Se.CONTROL)}],[t,s]);return e.jsx(Qt,{render:e.jsx(J,{"aria-label":"Layout mode",variant:"subtle-white",size:"xlarge"}),items:n,children:e.jsx(En,{})})}const rd="_mainContainer_1m0yz_17",ld={mainContainer:rd};function Id(){const{isOpen:t,setLocation:s,close:n}=es(),[a,i]=Ee();_a("Editor"),wa(),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 As([["mod + ,",l]]),e.jsx(Ca,{permission:"editor",children:e.jsxs("div",{className:ld.mainContainer,"data-testid":"event-editor",children:[e.jsx(hc,{}),e.jsx(Sa,{isOpen:a,onClose:i.close}),t?e.jsx(Ho,{}):e.jsx(nd,{}),e.jsxs(qo,{children:[e.jsx(J,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:i.open,children:e.jsx(In,{})}),e.jsx(J,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(Wt,{}):e.jsx(Ln,{})}),e.jsx(ad,{})]})]})})}export{Id as default};
3
+ //# sourceMappingURL=ProtectedEditor-DNOiQqIU.js.map