@getontime/cli 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/client/assets/{Backstage-ZSqb8OU6.js → Backstage-CAjkmeJm.js} +2 -2
  2. package/client/assets/Backstage-CAjkmeJm.js.br +0 -0
  3. package/client/assets/Backstage-CAjkmeJm.js.gz +0 -0
  4. package/client/assets/{Backstage-ZSqb8OU6.js.map → Backstage-CAjkmeJm.js.map} +1 -1
  5. package/client/assets/{Countdown-DVRZbeRP.js → Countdown-ChuA9az_.js} +2 -2
  6. package/client/assets/Countdown-ChuA9az_.js.br +0 -0
  7. package/client/assets/Countdown-ChuA9az_.js.gz +0 -0
  8. package/client/assets/{Countdown-DVRZbeRP.js.map → Countdown-ChuA9az_.js.map} +1 -1
  9. package/client/assets/{CustomTranslationModal-D_Cy0d_H.js → CustomTranslationModal-C3R_2T5s.js} +2 -2
  10. package/client/assets/CustomTranslationModal-C3R_2T5s.js.br +0 -0
  11. package/client/assets/CustomTranslationModal-C3R_2T5s.js.gz +0 -0
  12. package/client/assets/{CustomTranslationModal-D_Cy0d_H.js.map → CustomTranslationModal-C3R_2T5s.js.map} +1 -1
  13. package/client/assets/{DelayIndicator-B_JKLKYW.js → DelayIndicator-vT7n8ypf.js} +2 -2
  14. package/client/assets/DelayIndicator-vT7n8ypf.js.br +0 -0
  15. package/client/assets/DelayIndicator-vT7n8ypf.js.gz +0 -0
  16. package/client/assets/{DelayIndicator-B_JKLKYW.js.map → DelayIndicator-vT7n8ypf.js.map} +1 -1
  17. package/client/assets/{EditorFeatureWrapper-DzBxDvRn.js → EditorFeatureWrapper-DHfuO3EA.js} +2 -2
  18. package/client/assets/EditorFeatureWrapper-DHfuO3EA.js.br +0 -0
  19. package/client/assets/EditorFeatureWrapper-DHfuO3EA.js.gz +0 -0
  20. package/client/assets/{EditorFeatureWrapper-DzBxDvRn.js.map → EditorFeatureWrapper-DHfuO3EA.js.map} +1 -1
  21. package/client/assets/{EditorUtils-De0umjb-.js → EditorUtils-Da5ALK1P.js} +2 -2
  22. package/client/assets/EditorUtils-Da5ALK1P.js.br +0 -0
  23. package/client/assets/EditorUtils-Da5ALK1P.js.gz +0 -0
  24. package/client/assets/{EditorUtils-De0umjb-.js.map → EditorUtils-Da5ALK1P.js.map} +1 -1
  25. package/client/assets/{Empty-BYF0tVRk.js → Empty-gWT_HMeu.js} +2 -2
  26. package/client/assets/Empty-gWT_HMeu.js.br +0 -0
  27. package/client/assets/Empty-gWT_HMeu.js.gz +0 -0
  28. package/client/assets/{Empty-BYF0tVRk.js.map → Empty-gWT_HMeu.js.map} +1 -1
  29. package/client/assets/{EmptyPage-DYH2bswA.js → EmptyPage-Dcbg6rmF.js} +2 -2
  30. package/client/assets/EmptyPage-Dcbg6rmF.js.br +0 -0
  31. package/client/assets/EmptyPage-Dcbg6rmF.js.gz +0 -0
  32. package/client/assets/{EmptyPage-DYH2bswA.js.map → EmptyPage-Dcbg6rmF.js.map} +1 -1
  33. package/client/assets/{FollowButton-DyWsvyFF.js → FollowButton-CSqJSvix.js} +2 -2
  34. package/client/assets/FollowButton-CSqJSvix.js.br +0 -0
  35. package/client/assets/FollowButton-CSqJSvix.js.gz +0 -0
  36. package/client/assets/{FollowButton-DyWsvyFF.js.map → FollowButton-CSqJSvix.js.map} +1 -1
  37. package/client/assets/{MessageControlExport-yLGU2dMq.js → MessageControlExport-lXK21piH.js} +2 -2
  38. package/client/assets/MessageControlExport-lXK21piH.js.br +0 -0
  39. package/client/assets/MessageControlExport-lXK21piH.js.gz +0 -0
  40. package/client/assets/{MessageControlExport-yLGU2dMq.js.map → MessageControlExport-lXK21piH.js.map} +1 -1
  41. package/client/assets/{MilestoneEditor-GkzJ-h1C.js → MilestoneEditor-Bge8xLrV.js} +2 -2
  42. package/client/assets/MilestoneEditor-Bge8xLrV.js.br +0 -0
  43. package/client/assets/MilestoneEditor-Bge8xLrV.js.gz +0 -0
  44. package/client/assets/{MilestoneEditor-GkzJ-h1C.js.map → MilestoneEditor-Bge8xLrV.js.map} +1 -1
  45. package/client/assets/{Modal-BKL-5GzU.js → Modal-C2sFA0zf.js} +2 -2
  46. package/client/assets/Modal-C2sFA0zf.js.br +0 -0
  47. package/client/assets/Modal-C2sFA0zf.js.gz +0 -0
  48. package/client/assets/{Modal-BKL-5GzU.js.map → Modal-C2sFA0zf.js.map} +1 -1
  49. package/client/assets/{MultiPartProgressBar-BITERKS0.js → MultiPartProgressBar-D3jJZjb5.js} +2 -2
  50. package/client/assets/MultiPartProgressBar-D3jJZjb5.js.br +0 -0
  51. package/client/assets/MultiPartProgressBar-D3jJZjb5.js.gz +0 -0
  52. package/client/assets/{MultiPartProgressBar-BITERKS0.js.map → MultiPartProgressBar-D3jJZjb5.js.map} +1 -1
  53. package/client/assets/{OperatorExport-DMZ6eQfT.js → OperatorExport-BUhxjLUx.js} +2 -2
  54. package/client/assets/OperatorExport-BUhxjLUx.js.br +0 -0
  55. package/client/assets/OperatorExport-BUhxjLUx.js.gz +0 -0
  56. package/client/assets/{OperatorExport-DMZ6eQfT.js.map → OperatorExport-BUhxjLUx.js.map} +1 -1
  57. package/client/assets/{OverviewWrapper-riM6vPno.js → OverviewWrapper-BveJ6GjK.js} +2 -2
  58. package/client/assets/OverviewWrapper-BveJ6GjK.js.br +0 -0
  59. package/client/assets/OverviewWrapper-BveJ6GjK.js.gz +0 -0
  60. package/client/assets/{OverviewWrapper-riM6vPno.js.map → OverviewWrapper-BveJ6GjK.js.map} +1 -1
  61. package/client/assets/{ProjectInfo-DxtMq70a.js → ProjectInfo-z4k3cipS.js} +2 -2
  62. package/client/assets/ProjectInfo-z4k3cipS.js.br +0 -0
  63. package/client/assets/ProjectInfo-z4k3cipS.js.gz +0 -0
  64. package/client/assets/{ProjectInfo-DxtMq70a.js.map → ProjectInfo-z4k3cipS.js.map} +1 -1
  65. package/client/assets/{ProtectRoute-p1fmtLeu.js → ProtectRoute-CrcWfOlG.js} +2 -2
  66. package/client/assets/ProtectRoute-CrcWfOlG.js.br +0 -0
  67. package/client/assets/ProtectRoute-CrcWfOlG.js.gz +0 -0
  68. package/client/assets/{ProtectRoute-p1fmtLeu.js.map → ProtectRoute-CrcWfOlG.js.map} +1 -1
  69. package/client/assets/{ProtectedCuesheet-CvRnqT0z.js → ProtectedCuesheet-Deo4Aw6f.js} +2 -2
  70. package/client/assets/ProtectedCuesheet-Deo4Aw6f.js.br +0 -0
  71. package/client/assets/ProtectedCuesheet-Deo4Aw6f.js.gz +0 -0
  72. package/client/assets/{ProtectedCuesheet-CvRnqT0z.js.map → ProtectedCuesheet-Deo4Aw6f.js.map} +1 -1
  73. package/client/assets/{ProtectedEditor-D4UXj1xL.js → ProtectedEditor-C_SYWpL2.js} +3 -3
  74. package/client/assets/ProtectedEditor-C_SYWpL2.js.br +0 -0
  75. package/client/assets/ProtectedEditor-C_SYWpL2.js.gz +0 -0
  76. package/client/assets/{ProtectedEditor-D4UXj1xL.js.map → ProtectedEditor-C_SYWpL2.js.map} +1 -1
  77. package/client/assets/{RundownEntry-B1dSz1wu.js → RundownEntry-D61IqkXb.js} +2 -2
  78. package/client/assets/RundownEntry-D61IqkXb.js.br +0 -0
  79. package/client/assets/RundownEntry-D61IqkXb.js.gz +0 -0
  80. package/client/assets/{RundownEntry-B1dSz1wu.js.map → RundownEntry-D61IqkXb.js.map} +1 -1
  81. package/client/assets/RundownExport-1zBZurIG.css +1 -0
  82. package/client/assets/RundownExport-1zBZurIG.css.br +0 -0
  83. package/client/assets/RundownExport-1zBZurIG.css.gz +0 -0
  84. package/client/assets/{RundownExport-WjLpncYT.js → RundownExport-C6YhMGOC.js} +3 -3
  85. package/client/assets/RundownExport-C6YhMGOC.js.br +0 -0
  86. package/client/assets/RundownExport-C6YhMGOC.js.gz +0 -0
  87. package/client/assets/{RundownExport-WjLpncYT.js.map → RundownExport-C6YhMGOC.js.map} +1 -1
  88. package/client/assets/{Select-niU9Razm.js → Select-CedN80WS.js} +2 -2
  89. package/client/assets/Select-CedN80WS.js.br +0 -0
  90. package/client/assets/Select-CedN80WS.js.gz +0 -0
  91. package/client/assets/{Select-niU9Razm.js.map → Select-CedN80WS.js.map} +1 -1
  92. package/client/assets/{Studio-CWdJq4bx.js → Studio-DUzPBS6P.js} +2 -2
  93. package/client/assets/Studio-DUzPBS6P.js.br +0 -0
  94. package/client/assets/Studio-DUzPBS6P.js.gz +0 -0
  95. package/client/assets/{Studio-CWdJq4bx.js.map → Studio-DUzPBS6P.js.map} +1 -1
  96. package/client/assets/{StyleEditor-BIFjHsgD.js → StyleEditor-D2z65PB7.js} +2 -2
  97. package/client/assets/StyleEditor-D2z65PB7.js.br +0 -0
  98. package/client/assets/StyleEditor-D2z65PB7.js.gz +0 -0
  99. package/client/assets/{StyleEditor-BIFjHsgD.js.map → StyleEditor-D2z65PB7.js.map} +1 -1
  100. package/client/assets/{SuperscriptTime-DCTyUARx.js → SuperscriptTime-CIrcMcyg.js} +2 -2
  101. package/client/assets/SuperscriptTime-CIrcMcyg.js.br +0 -0
  102. package/client/assets/SuperscriptTime-CIrcMcyg.js.gz +0 -0
  103. package/client/assets/{SuperscriptTime-DCTyUARx.js.map → SuperscriptTime-CIrcMcyg.js.map} +1 -1
  104. package/client/assets/{TimeElements-DBVGVx71.js → TimeElements-CALNfv6u.js} +2 -2
  105. package/client/assets/TimeElements-CALNfv6u.js.br +0 -0
  106. package/client/assets/TimeElements-CALNfv6u.js.gz +0 -0
  107. package/client/assets/{TimeElements-DBVGVx71.js.map → TimeElements-CALNfv6u.js.map} +1 -1
  108. package/client/assets/{TimeInput-wQ67FbW6.js → TimeInput-Dg1naiy3.js} +2 -2
  109. package/client/assets/TimeInput-Dg1naiy3.js.br +0 -0
  110. package/client/assets/TimeInput-Dg1naiy3.js.gz +0 -0
  111. package/client/assets/{TimeInput-wQ67FbW6.js.map → TimeInput-Dg1naiy3.js.map} +1 -1
  112. package/client/assets/{TimelinePage-DZefE2vQ.js → TimelinePage-Cwm0svjN.js} +2 -2
  113. package/client/assets/TimelinePage-Cwm0svjN.js.br +0 -0
  114. package/client/assets/TimelinePage-Cwm0svjN.js.gz +0 -0
  115. package/client/assets/{TimelinePage-DZefE2vQ.js.map → TimelinePage-Cwm0svjN.js.map} +1 -1
  116. package/client/assets/Timer-BVXskRjc.js +2 -0
  117. package/client/assets/Timer-BVXskRjc.js.br +0 -0
  118. package/client/assets/Timer-BVXskRjc.js.gz +0 -0
  119. package/client/assets/Timer-BVXskRjc.js.map +1 -0
  120. package/client/assets/Timer-BvEmZbmF.css +1 -0
  121. package/client/assets/Timer-BvEmZbmF.css.br +0 -0
  122. package/client/assets/Timer-BvEmZbmF.css.gz +0 -0
  123. package/client/assets/{TimerControlExport-C1C_vBX4.js → TimerControlExport-C8ECtLBd.js} +2 -2
  124. package/client/assets/TimerControlExport-C8ECtLBd.js.br +0 -0
  125. package/client/assets/TimerControlExport-C8ECtLBd.js.gz +0 -0
  126. package/client/assets/{TimerControlExport-C1C_vBX4.js.map → TimerControlExport-C8ECtLBd.js.map} +1 -1
  127. package/client/assets/{TitleCard-B4N-kCM3.js → TitleCard-CZl9wSHS.js} +2 -2
  128. package/client/assets/TitleCard-CZl9wSHS.js.br +0 -0
  129. package/client/assets/TitleCard-CZl9wSHS.js.gz +0 -0
  130. package/client/assets/{TitleCard-B4N-kCM3.js.map → TitleCard-CZl9wSHS.js.map} +1 -1
  131. package/client/assets/{Tooltip-DJ8Y4CO4.js → Tooltip-D9XRnwOW.js} +2 -2
  132. package/client/assets/Tooltip-D9XRnwOW.js.br +4 -0
  133. package/client/assets/Tooltip-D9XRnwOW.js.gz +0 -0
  134. package/client/assets/{Tooltip-DJ8Y4CO4.js.map → Tooltip-D9XRnwOW.js.map} +1 -1
  135. package/client/assets/{ViewLogo-Dd60EREE.js → ViewLogo-_3Z1hIHi.js} +2 -2
  136. package/client/assets/ViewLogo-_3Z1hIHi.js.br +0 -0
  137. package/client/assets/ViewLogo-_3Z1hIHi.js.gz +0 -0
  138. package/client/assets/{ViewLogo-Dd60EREE.js.map → ViewLogo-_3Z1hIHi.js.map} +1 -1
  139. package/client/assets/{ViewParamsEditor-BWEYbq_S.js → ViewParamsEditor-Bca1TIDW.js} +2 -2
  140. package/client/assets/ViewParamsEditor-Bca1TIDW.js.br +0 -0
  141. package/client/assets/ViewParamsEditor-Bca1TIDW.js.gz +0 -0
  142. package/client/assets/{ViewParamsEditor-BWEYbq_S.js.map → ViewParamsEditor-Bca1TIDW.js.map} +1 -1
  143. package/client/assets/{dateConfig-8rhb0Dbh.js → dateConfig-DRQGMWDF.js} +2 -2
  144. package/client/assets/dateConfig-DRQGMWDF.js.br +0 -0
  145. package/client/assets/dateConfig-DRQGMWDF.js.gz +0 -0
  146. package/client/assets/{dateConfig-8rhb0Dbh.js.map → dateConfig-DRQGMWDF.js.map} +1 -1
  147. package/client/assets/{editorSettings-LMnfWux6.js → editorSettings-BU0pTMSY.js} +2 -2
  148. package/client/assets/editorSettings-BU0pTMSY.js.br +0 -0
  149. package/client/assets/editorSettings-BU0pTMSY.js.gz +0 -0
  150. package/client/assets/{editorSettings-LMnfWux6.js.map → editorSettings-BU0pTMSY.js.map} +1 -1
  151. package/client/assets/{getProgress-CyJTu6f5.js → getProgress-Cw79NL_O.js} +2 -2
  152. package/client/assets/getProgress-Cw79NL_O.js.br +0 -0
  153. package/client/assets/getProgress-Cw79NL_O.js.gz +0 -0
  154. package/client/assets/{getProgress-CyJTu6f5.js.map → getProgress-Cw79NL_O.js.map} +1 -1
  155. package/client/assets/{index-5QAOtSTh.js → index-BQEUaoAf.js} +3 -3
  156. package/client/assets/index-BQEUaoAf.js.br +0 -0
  157. package/client/assets/index-BQEUaoAf.js.gz +0 -0
  158. package/client/assets/{index-5QAOtSTh.js.map → index-BQEUaoAf.js.map} +1 -1
  159. package/client/assets/{offset-CLDSqOP5.js → offset-DJAHqjFW.js} +2 -2
  160. package/client/assets/offset-DJAHqjFW.js.br +0 -0
  161. package/client/assets/offset-DJAHqjFW.js.gz +0 -0
  162. package/client/assets/{offset-CLDSqOP5.js.map → offset-DJAHqjFW.js.map} +1 -1
  163. package/client/assets/{parseUserTime-CCDHpp7D.js → parseUserTime-BeTKj08M.js} +2 -2
  164. package/client/assets/parseUserTime-BeTKj08M.js.br +0 -0
  165. package/client/assets/parseUserTime-BeTKj08M.js.gz +0 -0
  166. package/client/assets/{parseUserTime-CCDHpp7D.js.map → parseUserTime-BeTKj08M.js.map} +1 -1
  167. package/client/assets/{playbackstate-6lBh6omZ.js → playbackstate-B_khF6xU.js} +2 -2
  168. package/client/assets/playbackstate-B_khF6xU.js.br +0 -0
  169. package/client/assets/playbackstate-B_khF6xU.js.gz +0 -0
  170. package/client/assets/{playbackstate-6lBh6omZ.js.map → playbackstate-B_khF6xU.js.map} +1 -1
  171. package/client/assets/{presentation.utils-BUIuV_2e.js → presentation.utils-KwY-ACf7.js} +2 -2
  172. package/client/assets/presentation.utils-KwY-ACf7.js.br +0 -0
  173. package/client/assets/presentation.utils-KwY-ACf7.js.gz +0 -0
  174. package/client/assets/{presentation.utils-BUIuV_2e.js.map → presentation.utils-KwY-ACf7.js.map} +1 -1
  175. package/client/assets/{rundownUtils-Cnd2prRX.js → rundownUtils-BZHazkXR.js} +2 -2
  176. package/client/assets/rundownUtils-BZHazkXR.js.br +0 -0
  177. package/client/assets/rundownUtils-BZHazkXR.js.gz +0 -0
  178. package/client/assets/{rundownUtils-Cnd2prRX.js.map → rundownUtils-BZHazkXR.js.map} +1 -1
  179. package/client/assets/{useCustomFields-BuxKsqGS.js → useCustomFields-DqCYz8Kt.js} +2 -2
  180. package/client/assets/useCustomFields-DqCYz8Kt.js.br +0 -0
  181. package/client/assets/useCustomFields-DqCYz8Kt.js.gz +0 -0
  182. package/client/assets/{useCustomFields-BuxKsqGS.js.map → useCustomFields-DqCYz8Kt.js.map} +1 -1
  183. package/client/assets/{useFollowComponent-iGQv4zoS.js → useFollowComponent-Ctfhf2or.js} +2 -2
  184. package/client/assets/useFollowComponent-Ctfhf2or.js.br +0 -0
  185. package/client/assets/useFollowComponent-Ctfhf2or.js.gz +0 -0
  186. package/client/assets/{useFollowComponent-iGQv4zoS.js.map → useFollowComponent-Ctfhf2or.js.map} +1 -1
  187. package/client/assets/{useProjectData-CetvEK9E.js → useProjectData-C1hVamxc.js} +2 -2
  188. package/client/assets/useProjectData-C1hVamxc.js.br +0 -0
  189. package/client/assets/useProjectData-C1hVamxc.js.gz +0 -0
  190. package/client/assets/{useProjectData-CetvEK9E.js.map → useProjectData-C1hVamxc.js.map} +1 -1
  191. package/client/assets/{useReport-PEFRsOhF.js → useReport-B4dMYcNL.js} +2 -2
  192. package/client/assets/useReport-B4dMYcNL.js.br +0 -0
  193. package/client/assets/useReport-B4dMYcNL.js.gz +0 -0
  194. package/client/assets/{useReport-PEFRsOhF.js.map → useReport-B4dMYcNL.js.map} +1 -1
  195. package/client/assets/useRundown-BfpjcCEJ.js +2 -0
  196. package/client/assets/useRundown-BfpjcCEJ.js.br +0 -0
  197. package/client/assets/useRundown-BfpjcCEJ.js.gz +0 -0
  198. package/client/assets/{useRundown-D8CYATNi.js.map → useRundown-BfpjcCEJ.js.map} +1 -1
  199. package/client/assets/{useWindowTitle-b5fN0StF.js → useWindowTitle-DqdFTWns.js} +2 -2
  200. package/client/assets/useWindowTitle-DqdFTWns.js.br +0 -0
  201. package/client/assets/useWindowTitle-DqdFTWns.js.gz +0 -0
  202. package/client/assets/{useWindowTitle-b5fN0StF.js.map → useWindowTitle-DqdFTWns.js.map} +1 -1
  203. package/client/assets/{validateEvent-Bvgk1E-Y.js → validateEvent-P9sf7C10.js} +2 -2
  204. package/client/assets/validateEvent-P9sf7C10.js.br +3 -0
  205. package/client/assets/validateEvent-P9sf7C10.js.gz +0 -0
  206. package/client/assets/{validateEvent-Bvgk1E-Y.js.map → validateEvent-P9sf7C10.js.map} +1 -1
  207. package/client/assets/{vendor-Cu5xgv5K.js → vendor-CCiSQ9k9.js} +2 -2
  208. package/client/assets/vendor-CCiSQ9k9.js.br +0 -0
  209. package/client/assets/vendor-CCiSQ9k9.js.gz +0 -0
  210. package/client/assets/{vendor-Cu5xgv5K.js.map → vendor-CCiSQ9k9.js.map} +1 -1
  211. package/client/assets/{viewLoader.utils-BPhACxyG.js → viewLoader.utils-CmM-4-pk.js} +2 -2
  212. package/client/assets/viewLoader.utils-CmM-4-pk.js.br +0 -0
  213. package/client/assets/viewLoader.utils-CmM-4-pk.js.gz +0 -0
  214. package/client/assets/{viewLoader.utils-BPhACxyG.js.map → viewLoader.utils-CmM-4-pk.js.map} +1 -1
  215. package/client/index.html +2 -2
  216. package/external/demo/app.js +2 -2
  217. package/package.json +1 -1
  218. package/server/index.cjs +66 -57
  219. package/client/assets/Backstage-ZSqb8OU6.js.br +0 -0
  220. package/client/assets/Backstage-ZSqb8OU6.js.gz +0 -0
  221. package/client/assets/Countdown-DVRZbeRP.js.br +0 -0
  222. package/client/assets/Countdown-DVRZbeRP.js.gz +0 -0
  223. package/client/assets/CustomTranslationModal-D_Cy0d_H.js.br +0 -0
  224. package/client/assets/CustomTranslationModal-D_Cy0d_H.js.gz +0 -0
  225. package/client/assets/DelayIndicator-B_JKLKYW.js.br +0 -0
  226. package/client/assets/DelayIndicator-B_JKLKYW.js.gz +0 -0
  227. package/client/assets/EditorFeatureWrapper-DzBxDvRn.js.br +0 -0
  228. package/client/assets/EditorFeatureWrapper-DzBxDvRn.js.gz +0 -0
  229. package/client/assets/EditorUtils-De0umjb-.js.br +0 -0
  230. package/client/assets/EditorUtils-De0umjb-.js.gz +0 -0
  231. package/client/assets/Empty-BYF0tVRk.js.br +0 -2
  232. package/client/assets/Empty-BYF0tVRk.js.gz +0 -0
  233. package/client/assets/EmptyPage-DYH2bswA.js.br +0 -0
  234. package/client/assets/EmptyPage-DYH2bswA.js.gz +0 -0
  235. package/client/assets/FollowButton-DyWsvyFF.js.br +0 -0
  236. package/client/assets/FollowButton-DyWsvyFF.js.gz +0 -0
  237. package/client/assets/MessageControlExport-yLGU2dMq.js.br +0 -0
  238. package/client/assets/MessageControlExport-yLGU2dMq.js.gz +0 -0
  239. package/client/assets/MilestoneEditor-GkzJ-h1C.js.br +0 -0
  240. package/client/assets/MilestoneEditor-GkzJ-h1C.js.gz +0 -0
  241. package/client/assets/Modal-BKL-5GzU.js.br +0 -0
  242. package/client/assets/Modal-BKL-5GzU.js.gz +0 -0
  243. package/client/assets/MultiPartProgressBar-BITERKS0.js.br +0 -0
  244. package/client/assets/MultiPartProgressBar-BITERKS0.js.gz +0 -0
  245. package/client/assets/OperatorExport-DMZ6eQfT.js.br +0 -0
  246. package/client/assets/OperatorExport-DMZ6eQfT.js.gz +0 -0
  247. package/client/assets/OverviewWrapper-riM6vPno.js.br +0 -0
  248. package/client/assets/OverviewWrapper-riM6vPno.js.gz +0 -0
  249. package/client/assets/ProjectInfo-DxtMq70a.js.br +0 -0
  250. package/client/assets/ProjectInfo-DxtMq70a.js.gz +0 -0
  251. package/client/assets/ProtectRoute-p1fmtLeu.js.br +0 -0
  252. package/client/assets/ProtectRoute-p1fmtLeu.js.gz +0 -0
  253. package/client/assets/ProtectedCuesheet-CvRnqT0z.js.br +0 -0
  254. package/client/assets/ProtectedCuesheet-CvRnqT0z.js.gz +0 -0
  255. package/client/assets/ProtectedEditor-D4UXj1xL.js.br +0 -0
  256. package/client/assets/ProtectedEditor-D4UXj1xL.js.gz +0 -0
  257. package/client/assets/RundownEntry-B1dSz1wu.js.br +0 -0
  258. package/client/assets/RundownEntry-B1dSz1wu.js.gz +0 -0
  259. package/client/assets/RundownExport-CUtaG16H.css +0 -1
  260. package/client/assets/RundownExport-CUtaG16H.css.br +0 -0
  261. package/client/assets/RundownExport-CUtaG16H.css.gz +0 -0
  262. package/client/assets/RundownExport-WjLpncYT.js.br +0 -0
  263. package/client/assets/RundownExport-WjLpncYT.js.gz +0 -0
  264. package/client/assets/Select-niU9Razm.js.br +0 -0
  265. package/client/assets/Select-niU9Razm.js.gz +0 -0
  266. package/client/assets/Studio-CWdJq4bx.js.br +0 -0
  267. package/client/assets/Studio-CWdJq4bx.js.gz +0 -0
  268. package/client/assets/StyleEditor-BIFjHsgD.js.br +0 -0
  269. package/client/assets/StyleEditor-BIFjHsgD.js.gz +0 -0
  270. package/client/assets/SuperscriptTime-DCTyUARx.js.br +0 -0
  271. package/client/assets/SuperscriptTime-DCTyUARx.js.gz +0 -0
  272. package/client/assets/TimeElements-DBVGVx71.js.br +0 -0
  273. package/client/assets/TimeElements-DBVGVx71.js.gz +0 -0
  274. package/client/assets/TimeInput-wQ67FbW6.js.br +0 -0
  275. package/client/assets/TimeInput-wQ67FbW6.js.gz +0 -0
  276. package/client/assets/TimelinePage-DZefE2vQ.js.br +0 -0
  277. package/client/assets/TimelinePage-DZefE2vQ.js.gz +0 -0
  278. package/client/assets/Timer-Bs450x86.js +0 -2
  279. package/client/assets/Timer-Bs450x86.js.br +0 -0
  280. package/client/assets/Timer-Bs450x86.js.gz +0 -0
  281. package/client/assets/Timer-Bs450x86.js.map +0 -1
  282. package/client/assets/Timer-DGNfbBKM.css +0 -1
  283. package/client/assets/Timer-DGNfbBKM.css.br +0 -0
  284. package/client/assets/Timer-DGNfbBKM.css.gz +0 -0
  285. package/client/assets/TimerControlExport-C1C_vBX4.js.br +0 -0
  286. package/client/assets/TimerControlExport-C1C_vBX4.js.gz +0 -0
  287. package/client/assets/TitleCard-B4N-kCM3.js.br +0 -0
  288. package/client/assets/TitleCard-B4N-kCM3.js.gz +0 -0
  289. package/client/assets/Tooltip-DJ8Y4CO4.js.br +0 -0
  290. package/client/assets/Tooltip-DJ8Y4CO4.js.gz +0 -0
  291. package/client/assets/ViewLogo-Dd60EREE.js.br +0 -0
  292. package/client/assets/ViewLogo-Dd60EREE.js.gz +0 -0
  293. package/client/assets/ViewParamsEditor-BWEYbq_S.js.br +0 -0
  294. package/client/assets/ViewParamsEditor-BWEYbq_S.js.gz +0 -0
  295. package/client/assets/dateConfig-8rhb0Dbh.js.br +0 -0
  296. package/client/assets/dateConfig-8rhb0Dbh.js.gz +0 -0
  297. package/client/assets/editorSettings-LMnfWux6.js.br +0 -0
  298. package/client/assets/editorSettings-LMnfWux6.js.gz +0 -0
  299. package/client/assets/getProgress-CyJTu6f5.js.br +0 -0
  300. package/client/assets/getProgress-CyJTu6f5.js.gz +0 -0
  301. package/client/assets/index-5QAOtSTh.js.br +0 -0
  302. package/client/assets/index-5QAOtSTh.js.gz +0 -0
  303. package/client/assets/offset-CLDSqOP5.js.br +0 -0
  304. package/client/assets/offset-CLDSqOP5.js.gz +0 -0
  305. package/client/assets/parseUserTime-CCDHpp7D.js.br +0 -0
  306. package/client/assets/parseUserTime-CCDHpp7D.js.gz +0 -0
  307. package/client/assets/playbackstate-6lBh6omZ.js.br +0 -0
  308. package/client/assets/playbackstate-6lBh6omZ.js.gz +0 -0
  309. package/client/assets/presentation.utils-BUIuV_2e.js.br +0 -0
  310. package/client/assets/presentation.utils-BUIuV_2e.js.gz +0 -0
  311. package/client/assets/rundownUtils-Cnd2prRX.js.br +0 -0
  312. package/client/assets/rundownUtils-Cnd2prRX.js.gz +0 -0
  313. package/client/assets/useCustomFields-BuxKsqGS.js.br +0 -0
  314. package/client/assets/useCustomFields-BuxKsqGS.js.gz +0 -0
  315. package/client/assets/useFollowComponent-iGQv4zoS.js.br +0 -0
  316. package/client/assets/useFollowComponent-iGQv4zoS.js.gz +0 -0
  317. package/client/assets/useProjectData-CetvEK9E.js.br +0 -0
  318. package/client/assets/useProjectData-CetvEK9E.js.gz +0 -0
  319. package/client/assets/useReport-PEFRsOhF.js.br +0 -0
  320. package/client/assets/useReport-PEFRsOhF.js.gz +0 -0
  321. package/client/assets/useRundown-D8CYATNi.js +0 -2
  322. package/client/assets/useRundown-D8CYATNi.js.br +0 -0
  323. package/client/assets/useRundown-D8CYATNi.js.gz +0 -0
  324. package/client/assets/useWindowTitle-b5fN0StF.js.br +0 -0
  325. package/client/assets/useWindowTitle-b5fN0StF.js.gz +0 -0
  326. package/client/assets/validateEvent-Bvgk1E-Y.js.br +0 -0
  327. package/client/assets/validateEvent-Bvgk1E-Y.js.gz +0 -0
  328. package/client/assets/vendor-Cu5xgv5K.js.br +0 -0
  329. package/client/assets/vendor-Cu5xgv5K.js.gz +0 -0
  330. package/client/assets/viewLoader.utils-BPhACxyG.js.br +0 -0
  331. package/client/assets/viewLoader.utils-BPhACxyG.js.gz +0 -0
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-D_Cy0d_H.js","./vendor-Cu5xgv5K.js","./vendor-4xP-6xVS.css","./index-5QAOtSTh.js","./index-De0uf0Ta.css","./useWindowTitle-b5fN0StF.js","./useWindowTitle-DrFGLRMI.css","./Modal-BKL-5GzU.js","./useProjectData-CetvEK9E.js","./useProjectData-Cw1aXCwD.css","./Modal-BgJx3SNK.css","./StyleEditor-BIFjHsgD.js","./StyleEditor-Bie84LSc.css","./RundownExport-WjLpncYT.js","./EditorUtils-De0umjb-.js","./EditorUtils-BXko-IuN.css","./ProtectRoute-p1fmtLeu.js","./ProtectRoute-Bm5sjStK.css","./useRundown-D8CYATNi.js","./MilestoneEditor-GkzJ-h1C.js","./TimeInput-wQ67FbW6.js","./parseUserTime-CCDHpp7D.js","./TimeInput-BrVdiuOQ.css","./dateConfig-8rhb0Dbh.js","./validateEvent-Bvgk1E-Y.js","./editorSettings-LMnfWux6.js","./editorSettings-BqHbWs9b.css","./rundownUtils-Cnd2prRX.js","./useCustomFields-BuxKsqGS.js","./Select-niU9Razm.js","./Select-Cd08aEcf.css","./Tooltip-DJ8Y4CO4.js","./Tooltip-CKb7gU2M.css","./offset-CLDSqOP5.js","./MilestoneEditor-906SVj5M.css","./Empty-BYF0tVRk.js","./Empty-DvR62o5B.css","./useFollowComponent-iGQv4zoS.js","./RundownExport-CUtaG16H.css","./TimerControlExport-C1C_vBX4.js","./useReport-PEFRsOhF.js","./Editor.module-DvV2efYs.js","./Editor-B_NlyOLw.css","./TimerControlExport-D8kqHQB0.css","./MessageControlExport-yLGU2dMq.js","./MessageControlExport-DPgqVb-4.css"])))=>i.map(i=>d[i]);
2
- import{h as j,j as e,ac as Xt,e as H,k as Ct,ad as ce,ae as Es,af as Rs,ag as Ze,ah as he,T as me,aa as st,ai as Os,x as Zt,aj as Ts,ak as At,f as As,O as _t,A as Fs,al as Is,am as Ls,an as Ge,ao as $s,P as ct,C as Ce,ap as es,aq as ts,ar as Ft,as as Vs,at as Ws,l as ss,au as Ms,$ as He,t as kt,av as Us,v as qs,M as zs,I as Bs,m as Ks}from"./vendor-Cu5xgv5K.js";import{P as Gs}from"./ProtectRoute-p1fmtLeu.js";import{i as ge,N as Dt,Q as Hs,R as Qs,S as et,r as Ys,U as Js,V as _e,W as Xe,X as N,Y as Ie,Z as Ee,_ as R,$ as ee,a0 as Q,a1 as ft,a2 as Xs,a3 as Zs,a4 as Nt,a5 as en,a6 as ns,a7 as A,B as f,a8 as ie,a9 as we,aa as Ae,ab as fe,ac as oe,ad as M,ae as U,af as $,ag as V,ah as $e,ai as Z,aj as ve,ak as nt,al as tn,am as sn,an as Pt,g as Ne,ao as rs,ap as Et,aq as as,ar as re,O as Se,as as nn,at as It,au as is,av as ls,aw as Rt,ax as rn,ay as an,az as os,aA as dt,y as Ue,aB as ln,aC as on,aD as Oe,aE as cs,aF as vt,T as Qe,aG as cn,aH as ds,aI as Lt,aJ as dn,aK as un,aL as hn,aM as Le,aN as mn,aO as xn,d as jn,aP as pn,K as gn,aQ as fn,aR as vn,aS as yn,c as bn,aT as wn,aU as Sn,aV as $t,aW as Cn,aX as Vt,aY as _n,aZ as kn}from"./index-5QAOtSTh.js";import{I as je,C as Dn,u as Nn}from"./useWindowTitle-b5fN0StF.js";import{e as Pn,u as rt,T as B,t as ut,a as En,b as Rn,d as On,c as Tn,f as An,g as Fn,S as In,h as Ln,D as us,M as at}from"./Modal-BKL-5GzU.js";import{S as be,u as $n,a as Vn,b as Wn,c as ht}from"./useProjectData-CetvEK9E.js";import{i as hs,R as ms,s as Mn,G as Un,a as qn,O as zn,T as Bn}from"./OverviewWrapper-riM6vPno.js";import{e as Kn,f as Gn,g as Hn,i as xs,h as js,j as Qn,k as Yn,l as Jn,m as Xn,n as Zn,o as er,p as tr}from"./useRundown-D8CYATNi.js";import{S as ne}from"./Select-niU9Razm.js";import{u as it,p as sr,e as nr,d as rr}from"./useCustomFields-BuxKsqGS.js";import{u as ar,d as ir}from"./useReport-PEFRsOhF.js";import{T as yt,u as ps,e as ze}from"./editorSettings-LMnfWux6.js";import{S as lr,L as or,T as cr}from"./EditorUtils-De0umjb-.js";import{T as gs}from"./Tooltip-DJ8Y4CO4.js";import{A as fs,T as Be}from"./TimeInput-wQ67FbW6.js";import{T as Wt,E as mt}from"./validateEvent-Bvgk1E-Y.js";import{p as Ke}from"./parseUserTime-CCDHpp7D.js";import{S as dr,P as ur,O as hr,M as mr,C as xr}from"./TimeElements-DBVGVx71.js";import{s as xt}from"./Editor.module-DvV2efYs.js";import"./offset-CLDSqOP5.js";import"./playbackstate-6lBh6omZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof St<"u"?St:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f1393d16-b64c-4844-a352-d91476718e0b",t._sentryDebugIdIdentifier="sentry-dbid-f1393d16-b64c-4844-a352-d91476718e0b")}catch{}})();function jr(t){return t.trim().replaceAll(" ","_")}const pr={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"},gr=(t,s,n={})=>{const{isDisabled:r=!1}=n,a=j.useCallback(l=>{l.key===s&&!l.repeat&&!r&&(l.preventDefault(),t())},[t,r,s]);j.useEffect(()=>(document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}),[a])},fr="_link_70oau_17",vr="_inline_70oau_27",Mt={link:fr,inline:vr};function se({href:t,inline:s,children:n}){const r=a=>{a.preventDefault(),Dt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:ge([Mt.link,s&&Mt.inline]),onClick:r,children:[n," ",e.jsx(Xt,{style:{fontSize:"1em"}})]})}async function yr(){const t=await H.get(Hs);return{url:t.data.html_url,version:t.data.tag_name}}const Ut={url:"",version:"",hasUpdates:!1};function vs(){const{data:t,status:s,isFetching:n,isError:r,refetch:a}=Ct({queryKey:Js,queryFn:yr,placeholderData:(i,h)=>i,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:Ys,enabled:et}),l=(t==null?void 0:t.version)&&!t.version.includes(Qs);return{data:t?{...t,hasUpdates:l}:Ut,placeholder:Ut,status:s,isFetching:n,isError:r,refetch:a}}function br(){const{data:t,isError:s}=vs();return s?e.jsxs(_e,{children:[`You are currently using Ontime version ${Xe}`,e.jsx(N,{children:`Could not fetch version information: ${s}`})]}):t.hasUpdates?e.jsxs(_e,{children:[`You are currently using Ontime version ${Xe}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Ie?"You can restart your stage to get the latest available version.":e.jsx(se,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(_e,{children:`You are currently using the latest version of Ontime: ${Xe}`})}function wr(){return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"About Ontime"}),e.jsxs(R,{children:[e.jsxs(ee,{children:[e.jsx(Q,{children:"Ontime"}),e.jsxs(_e,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(se,{href:ft,children:"www.getontime.no"})]}),e.jsxs(_e,{children:["Considering sponsoring our work",e.jsx(se,{href:Xs,children:"GitHub Sponsors"}),e.jsx(se,{href:Zs,children:"Buy Me a Coffee"})]}),e.jsxs(_e,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(se,{href:ft,children:"www.getontime.no"})]})]}),e.jsx(Q,{children:"Current version"}),e.jsx(br,{}),e.jsx(Q,{children:"Links"}),e.jsx(se,{href:Nt,children:"Read the docs"}),e.jsx(se,{href:en,children:"Follow the project on GitHub"}),e.jsx(se,{href:ns,children:"Discord server"})]})]})}function ae(t,s){const n=j.useRef(null);return j.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const Sr="https://docs.getontime.no/api/protocols/osc/";function Cr({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var w,y,b;const{handleSubmit:r,reset:a,register:l,setError:c,watch:i,setValue:h,formState:{errors:o,isSubmitting:d,isDirty:m,isValid:u}}=ce({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),g=async v=>{try{await Pn(v),a(v)}catch(O){const _=V(O);c("root",{message:_})}},x=()=>{a({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},p=!d&&m&&u;return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Automation settings",e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",onClick:x,disabled:!p,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!p,loading:d,children:"Save"})]})]}),(o==null?void 0:o.root)&&e.jsx(N,{children:o.root.message}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{children:[e.jsx("p",{children:"Control Ontime and share its data with external systems in your workflow."}),e.jsx("p",{children:"- Automations allow Ontime to send its data on lifecycle triggers."}),e.jsx("p",{children:"- OSC Input tells Ontime to listen to messages on the specific port."}),e.jsx("br",{}),e.jsx(se,{href:Sr,children:"See the docs"})]})}),e.jsxs(R,{as:"form",id:"automation-settings-form",onSubmit:r(g),onKeyDown:v=>we(v,x),children:[e.jsx(Ae,{isLoading:!1}),e.jsx(fe,{children:"Automation"}),e.jsx(oe,{children:e.jsxs(M,{children:[e.jsx(U,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(w=o.enabledAutomations)==null?void 0:w.message}),e.jsx(be,{size:"large",checked:i("enabledAutomations"),onCheckedChange:v=>h("enabledAutomations",v,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(fe,{children:"OSC Input"}),e.jsxs(oe,{children:[Ie&&e.jsx(je,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(M,{children:[e.jsx(U,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(y=o.enabledOscIn)==null?void 0:y.message}),e.jsx(be,{size:"large",checked:i("enabledOscIn"),onCheckedChange:v=>h("enabledOscIn",v,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(b=o.oscPortIn)==null?void 0:b.message}),e.jsx($,{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:hs,message:"Value should be numeric"}})})]})]})]})]})}const _r=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],kr=["{{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}}"],Dr=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],Nr=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function Pr(t){return[..._r,...kr,...Dr,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...Nr,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Er(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 r=s.substring(0,n+1);if(t.endsWith(r))return s.substring(n+1)}return""}function Rr(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Or="_wrapper_11839_17",Tr="_suggestions_11839_21",qt={wrapper:Or,suggestions:Tr},Ar=j.forwardRef(function(s,n){const{value:r,onChange:a,...l}=s,{data:c}=it(),i=Es(()=>x(!1)),h=j.useMemo(()=>Pr(c),[c]),[o,d]=j.useState(r||""),[m,u]=j.useState([]),[g,x]=j.useState(!1),p=b=>{const v=Rr(b);return h.filter(O=>O.startsWith(v))},w=b=>{d(b.target.value),b.target.value.endsWith("{")?(x(!0),u(p(b.target.value))):b.target.value===""||b.target.value.endsWith("}}")?x(!1):g&&u(p(b.target.value)),a==null||a(b)},y=b=>{d(v=>{const O=Er(v,b);return v+O}),x(!1)};return e.jsxs("div",{className:qt.wrapper,ref:Rs(i,n),children:[e.jsx($,{value:o,...l,onChange:w,fluid:!0}),g&&m.length>0&&e.jsx("ul",{className:qt.suggestions,children:m.map(b=>e.jsx("li",{onClick:()=>y(b),children:b},b))})]})}),bt=[{id:1,label:"On Load",value:"onLoad"},{id:2,label:"On Start",value:"onStart"},{id:3,label:"On Pause",value:"onPause"},{id:4,label:"On Stop",value:"onStop"},{id:5,label:"Every second",value:"onClock"},{id:6,label:"On Timer Update",value:"onUpdate"},{id:7,label:"On Finish",value:"onFinish"},{id:8,label:"On Warning",value:"onWarning"},{id:9,label:"On Danger",value:"onDanger"}];function zt(t){return Object.hasOwn(t,"id")}const Fr=[{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"}],Ir=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Lr(t){return[...Fr,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Ir,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function $r(t){const s={},n=[];for(let r=0;r<t.length;r++){const a=t[r];Object.hasOwn(s,a.trigger)||(s[a.trigger]=[]),s[a.trigger].includes(a.automationId)?n.push(r):s[a.trigger].push(a.automationId)}return n.length>0?n:void 0}const Vr="_outerColumn_dem8v_17",Wr="_innerColumn_dem8v_25",Mr="_ruleSection_dem8v_31",Ur="_titleSection_dem8v_37",qr="_filterSection_dem8v_38",zr="_oscSection_dem8v_39",Br="_httpSection_dem8v_40",Kr="_actionSection_dem8v_41",Gr="_test_dem8v_95",Hr="_outputCard_dem8v_99",le={outerColumn:Vr,innerColumn:Wr,ruleSection:Mr,titleSection:Ur,filterSection:qr,oscSection:zr,httpSection:Br,actionSection:Kr,test:Gr,outputCard:Hr};function Qr({index:t,register:s,setValue:n,rowErrors:r,value:a,children:l,watch:c}){var d,m,u,g,x;const[i,h]=j.useState(a),o=p=>{n(`outputs.${t}.action`,p,{shouldDirty:!0}),h(p)};return e.jsxs("div",{className:le.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ne,{onValueChange:p=>{o(p)},value:c(`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:(d=r==null?void 0:r.action)==null?void 0:d.message})]}),i.startsWith("aux")&&i.endsWith("set")&&e.jsxs("label",{children:["New time",e.jsx($,{...s(`outputs.${t}.time`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"eg: 10m5s"}),e.jsx(N,{children:(m=r==null?void 0:r.time)==null?void 0:m.message})]}),i==="message-set"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Text (leave empty for no change)",e.jsx($,{...s(`outputs.${t}.text`),fluid:!0,placeholder:"eg: Timer is finished"}),e.jsx(N,{children:(u=r==null?void 0:r.text)==null?void 0:u.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ne,{onValueChange:p=>{const w=p==="untouched"?void 0:p;n(`outputs.${t}.visible`,w,{shouldDirty:!0})},value:c(`outputs.${t}.visible`)===void 0?"untouched":c(`outputs.${t}.visible`),options:[{value:"untouched",label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(N,{children:(g=r==null?void 0:r.visible)==null?void 0:g.message})]})]}),i==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ne,{onValueChange:p=>{n(`outputs.${t}.secondarySource`,p,{shouldDirty:!0})},value:c(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source",disabled:!0},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"external",label:"External"},{value:"null",label:"None"}]}),e.jsx(N,{children:(x=r==null?void 0:r.secondarySource)==null?void 0:x.message})]}),e.jsx("div",{className:le.test,children:l})]})}const Yr="https://docs.getontime.no/api/automation/#using-variables-in-automation";function Jr({automation:t,onClose:s}){var K;const n=zt(t),{data:r}=it(),{refetch:a}=rt(),l=j.useMemo(()=>Lr(r),[r]),{control:c,handleSubmit:i,getValues:h,register:o,setError:d,setFocus:m,setValue:u,watch:g,formState:{errors:x,isSubmitting:p,isDirty:w,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:b,append:v,remove:O}=Ze({name:"filters",control:c}),{fields:_,append:P,remove:T}=Ze({name:"outputs",control:c});j.useEffect(()=>{m("title")},[m]);const S=()=>{v({field:"",operator:"equals",value:""})},q=()=>{P({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},z=()=>{P({type:"http",url:""})},de=()=>{P({type:"ontime",action:"aux1-start"})},Y=async I=>{try{const C=h(`outputs.${I}`);if(!C.targetIP||!C.targetPort||!C.address)return;await ut({type:"osc",targetIP:C.targetIP,targetPort:C.targetPort,address:C.address,args:C.args})}catch{}},L=async I=>{try{const C=h(`outputs.${I}`);if(!C.url)return;await ut({type:"http",url:C.url})}catch{}},E=async I=>{try{const C=h(`outputs.${I}`);await ut({...C,type:"ontime"})}catch{}},F=async I=>{zt(t)?await C(t.id,{id:t.id,...I}):await k(I),a();async function C(W,te){try{await En(W,te),s()}catch(ue){d("root",{message:V(ue)})}}async function k(W){try{await Rn(W),s()}catch(te){d("root",{message:V(te)})}}},D=!p&&w&&y;return e.jsxs($e,{as:"form",name:"automation-form",onSubmit:i(F),className:le.outerColumn,onKeyDown:I=>we(I,s),children:[e.jsx(Q,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:le.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:le.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx($,{...o("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(N,{children:(K=x.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:le.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:le.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(ms,{orientation:"horizontal",value:g("filterRule"),onValueChange:I=>u("filterRule",I,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),b.map((I,C)=>{var W,te,ue,Re,We,Me;const k=`filters.${C}.field.${I.id}`;return e.jsxs("div",{className:le.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ne,{value:g(`filters.${C}.field`),onValueChange:ke=>u(`filters.${C}.field`,ke,{shouldDirty:!0}),options:l.map(({value:ke,label:J})=>({value:ke,label:J})),"aria-label":"Event field"}),e.jsx(N,{children:(ue=(te=(W=x.filters)==null?void 0:W[C])==null?void 0:te.field)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ne,{value:g(`filters.${C}.operator`),onValueChange:ke=>u(`filters.${C}.operator`,ke,{shouldDirty:!0}),options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(N,{children:(Me=(We=(Re=x.filters)==null?void 0:Re[C])==null?void 0:We.operator)==null?void 0:Me.message})]}),e.jsxs("label",{children:["Value to match",e.jsx($,{...o(`filters.${C}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>O(C),children:e.jsx(he,{})})})]})]},k)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:S,children:["Add filter ",e.jsx(me,{})]})})]})]}),e.jsxs("div",{className:le.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(je,{children:["Automation outputs can be used to send data from Ontime to external software.",e.jsx(se,{href:Yr,children:"See the documentation for templates"})]}),_.map((I,C)=>{var k,W,te,ue,Re,We,Me,ke;if(Kn(I)){const J=(k=x.outputs)==null?void 0:k[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"OSC"}),e.jsxs("div",{className:le.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx($,{...o(`outputs.${C}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(N,{children:(W=J==null?void 0:J.targetIP)==null?void 0:W.message})]}),e.jsxs("label",{children:["Target Port",e.jsx($,{...o(`outputs.${C}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:Tt=>Tt===""?0:Number(Tt),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:(te=J==null?void 0:J.targetPort)==null?void 0:te.message})]}),e.jsxs("label",{children:["Address",e.jsx($,{...o(`outputs.${C}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(N,{children:(ue=J==null?void 0:J.address)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(Ar,{...o(`outputs.${C}.args`),value:I.args,placeholder:"1"}),e.jsx(N,{children:(Re=J==null?void 0:J.args)==null?void 0:Re.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>Y(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]})]},I.id)}if(Gn(I)){const J=(We=x.outputs)==null?void 0:We[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"HTTP"}),e.jsxs("div",{className:le.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx($,{...o(`outputs.${C}.url`,{required:{value:!0,message:"Required field"},pattern:{value:Mn,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(N,{children:(Me=J==null?void 0:J.url)==null?void 0:Me.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>L(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]})]},I.id)}if(Hn(I)){const J=(ke=x.outputs)==null?void 0:ke[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"Ontime action"}),e.jsxs(Qr,{value:I.action,index:C,register:o,rowErrors:J,setValue:u,watch:g,children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>E(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]},I.id)}return null}),e.jsxs(A,{relation:"inner",children:[e.jsxs(f,{onClick:q,children:["OSC ",e.jsx(me,{})]}),e.jsxs(f,{onClick:z,children:["HTTP ",e.jsx(me,{})]}),e.jsxs(f,{onClick:de,children:["Ontime action ",e.jsx(me,{})]})]})]}),e.jsxs(A,{align:"end",children:[(x==null?void 0:x.root)&&e.jsx(N,{children:x.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!D,loading:p,children:"Save"})]})]})}const Bt={title:"",filterRule:"all",filters:[],outputs:[]};function Xr(t){const{automations:s}=t,{refetch:n}=rt(),[r,a]=j.useState(null),[l,c]=j.useState(null),i=async o=>{try{c(null),await On(o)}catch(d){c(V(d))}finally{n()}},h=Object.keys(s);return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!r,onClick:()=>a(Bt),children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),r!==null&&e.jsx(Jr,{automation:r,onClose:()=>a(null)}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"45%"},children:"Title"}),e.jsx("th",{style:{width:"15%"},children:"Trigger rule"}),e.jsx("th",{style:{width:"15%"},children:"Filters"}),e.jsx("th",{style:{width:"15%"},children:"Outputs"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[h.length===0&&e.jsx(nt,{handleClick:r?void 0:()=>a(Bt)}),h.map(o=>Object.hasOwn(s,o)?e.jsx(j.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[o].title}),e.jsx("td",{children:e.jsx(B,{children:s[o].filterRule})}),e.jsx("td",{children:s[o].filters.length}),e.jsx("td",{children:s[o].outputs.length}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>a(s[o]),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>i(o),children:e.jsx(he,{})})]})]})},o):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(N,{children:l})})})]})]})]})}function ys({automations:t,initialId:s,initialTitle:n,initialAutomationId:r,initialTrigger:a,onCancel:l,postSubmit:c}){var O,_,P,T;const{handleSubmit:i,register:h,setFocus:o,setError:d,watch:m,setValue:u,formState:{errors:g,isSubmitting:x,isValid:p,isDirty:w}}=ce({defaultValues:{title:n,trigger:a??bt[0].value,automationId:r??((O=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:O.id)},resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{o("title")},[o]);const y=async S=>{if(s){try{await Tn(s,{id:s,...S}),c()}catch(q){d("root",{message:`Failed to save changes to trigger ${V(q)}`})}return}try{await An(S),c()}catch(q){d("root",{message:`Failed to save trigger ${V(q)}`})}},b=Object.keys(t).map(S=>({value:S,label:t[S].title})),v=w&&p;return e.jsxs($e,{as:"form",name:"trigger-form",onSubmit:i(y),onKeyDown:S=>we(S,l),children:[e.jsx(Q,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx($,{...h("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(N,{children:(_=g.title)==null?void 0:_.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ne,{value:m("trigger"),onValueChange:S=>u("trigger",S,{shouldDirty:!0}),options:bt.map(S=>({value:S.value,label:S.label})),"aria-label":"Lifecycle trigger"}),e.jsx(N,{children:(P=g.trigger)==null?void 0:P.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ne,{value:m("automationId"),onValueChange:S=>u("automationId",S,{shouldDirty:!0}),options:b,"aria-label":"Automation title"}),e.jsx(N,{children:(T=g.automationId)==null?void 0:T.message})]}),e.jsxs(A,{align:"end",children:[e.jsx(f,{disabled:x,onClick:l,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!v,loading:x,children:"Save"})]})]})}function Zr(t){var m,u;const{automations:s,id:n,title:r,trigger:a,automationId:l,duplicate:c,handleDelete:i,postSubmit:h}=t,[o,d]=j.useState(!1);return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(ys,{automations:s,initialId:n,initialTitle:r,initialTrigger:a,initialAutomationId:l,onCancel:()=>d(!1),postSubmit:()=>{d(!1),h()}})})}):e.jsxs("tr",{"data-warn":c,children:[e.jsxs(A,{as:"td",relation:"inner",children:[c&&e.jsx(Os,{color:"#FFBC56"}),r]}),e.jsx("td",{children:e.jsx(B,{children:(m=bt.find(g=>g.value===a))==null?void 0:m.label})}),e.jsx("td",{children:e.jsx(B,{children:(u=s==null?void 0:s[l])==null?void 0:u.title})}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>d(!0),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:i,children:e.jsx(he,{})})]})]})}function ea(t){const{triggers:s,automations:n}=t,[r,a]=j.useState(!1),{refetch:l}=rt(),[c,i]=j.useState(null),h=async u=>{try{await Fn(u)}catch(g){i(V(g))}finally{l()}},o=()=>{a(!1),l()},d=j.useMemo(()=>$r(s),[s]),m=Object.keys(n).length>0;return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!m,loading:!1,onClick:()=>a(!0),children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[d&&e.jsx(N,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),r&&e.jsx(ys,{automations:n,onCancel:()=>a(!1),postSubmit:o}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"35%"},children:"Title"}),e.jsx("th",{style:{width:"25%"},children:"Lifecycle trigger"}),e.jsx("th",{style:{width:"25%"},children:"Automation"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[!r&&s.length===0&&e.jsx(nt,{label:"Create an automation to attach triggers to",handleClick:m?()=>a(!0):void 0}),s.map((u,g)=>e.jsxs(j.Fragment,{children:[e.jsx(Zr,{automations:n,id:u.id,title:u.title,trigger:u.trigger,automationId:u.automationId,duplicate:d==null?void 0:d.includes(g),handleDelete:()=>h(u.id),postSubmit:o}),c&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(N,{children:c})})})]},u.id))]})]})]})]})}function ta({location:t}){const{data:s,status:n}=rt(),r=ae("settings",t),a=ae("triggers",t),l=ae("automations",t),c=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Automation"}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:c}),e.jsx("div",{ref:r,children:e.jsx(Cr,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(Xr,{automations:s.automations})}),e.jsx("div",{ref:a,children:e.jsx(ea,{triggers:s.triggers,automations:s.automations})})]})]})}const sa="_goIcon_1fzu7_17",na={goIcon:sa};function ra(){const{data:t}=tn(),s=n=>Dt(n);return e.jsx(A,{children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!et)return null;const r=sn(n.address);return e.jsxs(Pt,{copyValue:r,onClick:()=>s(r),children:[`${n.name} - ${n.address}`," ",e.jsx(Zt,{className:na.goIcon})]},n.name)})})}function aa(t){return Ts(t)}function ia(t,s,n){if(Object.keys(t).length===0)return[];if(n.length===0)return[];const r=[];let a=1;for(let l=0;l<n.length;l++){const c=n[l],i=s[c];!i||!xs(i)||(c in t||r.push({id:c,index:a,title:i.title,cue:i.cue,scheduledStart:i.timeStart,actualEnd:null,scheduledEnd:i.timeEnd,actualStart:null}),c in t&&r.push({id:c,index:a,title:i.title,cue:i.cue,scheduledStart:i.timeStart,actualEnd:t[c].endedAt,scheduledEnd:i.timeEnd,actualStart:t[c].startedAt}),a++)}return r}const la=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function oa(t){const s=[];s.push(la);for(const n of t)s.push([String(n.index),n.title,n.cue,Ne(n.scheduledStart),Ne(n.actualStart),Ne(n.scheduledEnd),Ne(n.actualEnd)]);return aa(s)}const ca="_blink_15peo_1",da="_fourtyfive_15peo_13",ua="_over_15peo_17",ha="_under_15peo_21",Ye={blink:ca,fourtyfive:da,over:ua,under:ha};function ma(){const{data:t}=ar(),{data:s}=js(),n=async()=>await ir(),r=l=>{if(!l)return;const c=oa(l),i=rs(c,"text/csv;charset=utf-8;");Et(i,"ontime-report.csv")},a=j.useMemo(()=>ia(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Report"}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(fe,{children:["Manage report",e.jsxs(A,{children:[e.jsxs(f,{onClick:()=>r(a),disabled:a.length===0,children:[e.jsx(At,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:a.length===0,children:[e.jsx(At,{}),"Clear All"]})]})]})}),e.jsx(R,{children:e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Scheduled Start"}),e.jsx("th",{children:"Actual Start"}),e.jsx("th",{children:"Scheduled End"}),e.jsx("th",{children:"Actual End"})]})}),e.jsxs("tbody",{children:[a.length===0&&e.jsx(nt,{label:"Reports are generated when running through the show."}),a.map(l=>{const c=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",i=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:ge([c&&Ye[c]]),children:Ne(l.scheduledStart)}),e.jsx("th",{className:ge([c&&Ye[c]]),children:Ne(l.actualStart)}),e.jsx("th",{className:ge([i&&Ye[i]]),children:Ne(l.scheduledEnd)}),e.jsx("th",{className:ge([i&&Ye[i]]),children:Ne(l.actualEnd)})]},l.id)})]})]})})]})})}const xa="_expand_1sy0c_17",ja="_column_1sy0c_21",Kt={expand:xa,column:ja},pa=[{value:Se.Cuesheet,label:"Cuesheet"},{value:Se.Operator,label:"Operator"},{value:Se.Timer,label:"Timer"},{value:Se.Backstage,label:"Backstage"},{value:Se.Timeline,label:"Timeline"},{value:Se.StudioClock,label:"Studio Clock"},{value:Se.Countdown,label:"Countdown"},{value:Se.ProjectInfo,label:"Project Info"}],ga={alias:"",target:Se.Timer,search:"",enabled:!0};function fa({urlPreset:t,onClose:s}){var _,P;const{addPreset:n,updatePreset:r,isMutating:a}=as(),{handleSubmit:l,register:c,setFocus:i,setError:h,clearErrors:o,setValue:d,getValues:m,watch:u,formState:{errors:g,isSubmitting:x,isValid:p,isDirty:w}}=ce({defaultValues:t??ga,resetOptions:{keepDirtyValues:!0}}),y=j.useRef(null),b=async T=>{try{t?await r(t.alias,T):await n(T),s()}catch(S){h("root",{message:V(S)})}};j.useEffect(()=>{i("alias")},[i]);const v=()=>{var T;o();try{const S=nn(m("alias"),((T=y.current)==null?void 0:T.value.trim())??"");d("target",S.target,{shouldDirty:!0,shouldValidate:!0}),d("search",S.search,{shouldDirty:!0,shouldValidate:!0})}catch(S){h("root",{message:It(S)});return}},O=T=>{try{return new URLSearchParams(T),!0}catch(S){return It(S)||"Invalid URL parameters"}};return e.jsxs($e,{as:"form",onSubmit:l(b),onKeyDown:T=>we(T,s),className:Kt.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(re,{children:"Alias"}),e.jsx($,{...c("alias",{required:"Alias is required"})})]}),e.jsxs("div",{className:Kt.expand,children:[e.jsx(re,{children:"Generate options (paste URL to generate options)"}),e.jsxs(A,{children:[e.jsx($,{placeholder:"Paste URL",fluid:!0,ref:y}),e.jsx(f,{onClick:v,children:"Generate"})]})]})]}),e.jsx("div",{children:" - or -"}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(re,{children:"Target"}),e.jsx(ne,{options:pa,...c("target",{required:"Target is required"}),value:u("target"),onValueChange:T=>d("target",T,{shouldDirty:!0})})]}),e.jsxs("div",{children:[e.jsx(re,{children:"Parameters"}),e.jsx(yt,{fluid:!0,rows:3,...c("search",{validate:O})}),e.jsx(N,{children:(_=g.search)==null?void 0:_.message})]}),e.jsxs("div",{children:[e.jsx(N,{children:(P=g.root)==null?void 0:P.message}),e.jsxs(A,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!p||!w,loading:x||a,children:"Save"})]})]})]})}const va="https://docs.getontime.no/features/url-presets/";function ya(){const[t,s]=j.useState({isOpen:!1,preset:void 0}),{data:n,status:r}=is(),{deletePreset:a,isMutating:l}=as(),c=()=>s({isOpen:!0}),i=o=>s({isOpen:!0,preset:o}),h=()=>s({isOpen:!1,preset:void 0});return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["URL presets",e.jsxs(f,{onClick:c,children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{children:["URL presets are user pre-defined aliases to Ontime URLs.",e.jsx("br",{}),"This URL can contain full configuration including parameters, or simply route to a specific view.",e.jsx("br",{}),e.jsx("br",{}),"The easiest way to get started is to copy an URL from your browser and paste it into the form.",e.jsx(se,{href:va,children:"See the docs"})]})}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:r==="pending"}),t.isOpen&&e.jsx(fa,{urlPreset:t.preset,onClose:h}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Enabled"}),e.jsx("th",{children:"Target view"}),e.jsx("th",{children:"Alias"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[n.length===0&&e.jsx(nt,{handleClick:c}),n.map((o,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(be,{defaultChecked:o.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(B,{children:o.target})}),e.jsx("td",{style:{width:"100%"},children:o.alias}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white",onClick:m=>ls(o.alias,m),disabled:l,children:e.jsx(Xt,{})}),e.jsx(Z,{onClick:()=>i(o),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${d}`,disabled:l,children:e.jsx(st,{})}),e.jsx(Z,{onClick:()=>a(o.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${d}`,disabled:l,children:e.jsx(he,{})})]})]},o.alias))]})]})]})]})})}function ba({location:t}){const s=ae("presets",t),n=ae("link",t),r=ae("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(ya,{})}),e.jsx("div",{ref:n,children:e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Share Ontime Link"}),!Ie&&e.jsxs(e.Fragment,{children:[e.jsx(_e,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(ra,{})]}),e.jsx(ie,{}),e.jsx(Un,{})]})})}),e.jsx("div",{ref:r,children:e.jsx(ma,{})})]})}const lt=`${Rt}/excel`;async function wa(t){const s=new FormData;s.append("excel",t),await H.post(`${lt}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})}async function Sa(){return(await H.get(`${lt}/worksheets`)).data}async function Ca(t){return(await H.post(`${lt}/preview`,{options:t})).data}async function _a(t,s){try{const n=await H.get(`${lt}/${t}/export`,{responseType:"blob"});Et(n.data,`${s??"Ontime_rundown"}.xlsx`)}catch(n){console.error("Error downloading file:",n)}}const Ve=`${Rt}/sheets`,ka=async()=>(await H.get(`${Ve}/connect`)).data,Da=async(t,s)=>{const n=new FormData;return n.append("client_secret",t),(await H.post(`${Ve}/${s}/connect`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},Na=async()=>(await H.post(`${Ve}/revoke`)).data,Pa=async(t,s)=>(await H.post(`${Ve}/${t}/read`,{options:s})).data,bs=async t=>(await H.post(`${Ve}/${t}/worksheets`)).data,Ea=async(t,s)=>(await H.post(`${Ve}/${t}/write`,{options:s})).data;function Ra(t){if(!Oa(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 ws(t){if(!Ta(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 Oa(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Ta(t){return t==null?void 0:t.name.endsWith(".json")}function Aa(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 ye=`${Rt}/db`;function Ss(t){return H.post(`${ye}/download`,{filename:t})}async function Fa(t){try{const{data:s,name:n}=await qa(t),r=JSON.stringify(s,null,2),a=rs(r,"application/json;charset=utf-8;");Et(a,`${n}.json`)}catch(s){console.error(s)}}async function Cs(t){const s=new FormData;return s.append("project",t),(await H.post(`${ye}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function _s(t){return await H.patch(ye,t)}async function Ia(t){return(await H.post(`${ye}/new`,t)).data}async function La(t){return(await H.post(`${ye}/quick`,t)).data}async function $a(){return(await H.get(`${ye}/all`)).data}async function ks(t){return(await H.post(`${ye}/load`,{filename:t})).data}async function Va(){return(await H.post(`${ye}/demo`)).data}async function Wa(t,s){const n=`${ye}/${t}/duplicate`,r=decodeURIComponent(n);return(await H.post(r,{newFilename:s})).data}async function Ma(t,s){const n=`${ye}/${t}/rename`,r=decodeURIComponent(n);return(await H.put(r,{newFilename:s})).data}async function Ua(t){const s=`${ye}/${t}`,n=decodeURIComponent(s);return(await H.delete(n)).data}async function qa(t){const s=await Ss(t),n=s.headers["Content-Disposition"];let r=t;if(n!=null){const a=n.indexOf('"')+1,l=n.lastIndexOf('"');r=n.substring(a,l)}return{data:s.data,name:r}}const za={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},Gt={stepData:za,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,spreadsheetImportMap:pr},G=As((t,s)=>({...Gt,patchStepData:n=>{const r=s().stepData;t({stepData:{...r,...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}),patchSpreadsheetImportMap:(n,r)=>{const a=s().spreadsheetImportMap;a[n]!==r&&(a[n]=r)},reset:()=>t(Gt),resetPreview:()=>t({rundown:null,customFields:null})}));function ot(){const t=_t(),s=G(d=>d.patchStepData),n=G(d=>d.setRundown),r=G(d=>d.setCustomFields);return{connect:async(d,m)=>{try{return await Da(d,m)}catch(u){s({authenticate:{available:!1,error:V(u)}})}},revoke:async()=>{try{return await Na()}catch(d){s({authenticate:{available:!1,error:V(d)}})}},verifyAuth:async()=>{try{return await ka()}catch(d){s({authenticate:{available:!1,error:V(d)}})}},importRundownPreview:async(d,m)=>{try{const u=await Pa(d,m);n(u.rundown),r(u.customFields)}catch(u){s({pullPush:{available:!0,error:V(u)}})}},importRundown:async(d,m)=>{try{await _s({rundowns:d,customFields:m}),await t.invalidateQueries({queryKey:[rn,an]})}catch(u){s({pullPush:{available:!0,error:V(u)}})}},exportRundown:async(d,m)=>{try{await Ea(d,m),s({pullPush:{available:!1,error:""}})}catch(u){s({pullPush:{available:!0,error:V(u)}})}}}}const wt={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 Ba(t){return typeof t!="object"||t===null?!1:Object.keys(wt).every(n=>Object.hasOwn(t,n))}function Ht(t){const s=t.custom.reduce((n,{ontimeName:r,importName:a})=>(r&&a&&(n[r.trim()]=a.trim()),n),{});return{worksheet:t.Worksheet,flag:t.Flag,timeStart:t.Start,linkStart:t["Link start"],timeEnd:t.End,duration:t.Duration,cue:t.Cue,title:t.Title,countToEnd:t["Count to end"],skip:t.Skip,note:t.Note,colour:t.Colour,endAction:t["End action"],timerType:t["Timer type"],timeWarning:t["Time warning"],timeDanger:t["Time danger"],custom:s,id:t.ID}}function Ka(t){localStorage.setItem("import-options",JSON.stringify(t))}function Ga(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function Ha(){try{const t=Ga();return Ba(t)?t:wt}catch{return wt}}const Qa="_uploadSection_10owf_17",Ya="_finishSection_10owf_18",Ja="_error_10owf_40",Xa="_success_10owf_43",Za="_singleActionCell_10owf_47",Pe={uploadSection:Qa,finishSection:Ya,error:Ja,success:Xa,singleActionCell:Za};function ei({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:r,onSubmitImport:a}){const l=Ha(),{revoke:c}=ot(),{control:i,handleSubmit:h,register:o,setValue:d,watch:m,formState:{errors:u,isValid:g}}=ce({mode:"onChange",defaultValues:l,values:l}),{fields:x,append:p,remove:w}=Ze({control:i,name:"custom"}),y=G(E=>E.stepData),b=G(E=>E.worksheetNames),[v,O]=j.useState("");j.useEffect(()=>{!b||b.length===0||b.includes(l.Worksheet)||d("Worksheet",b[0],{shouldValidate:!0,shouldDirty:!0})},[b,d,l.Worksheet]);const _=async E=>{O("export");const F=Ht(E);await r(F),O("")},P=async()=>{await c(),n()},T=async E=>{O("import");const F=Ht(E);Ka(E),await a(F),O("")},S=E=>{w(E)},q=()=>{p({})},z=!!v,de=s&&!z,Y=!z&&!y.worksheet.error,L=!t&&g&&(de||Y);return e.jsxs(R,{as:"form",id:"import-map",children:[e.jsxs(fe,{children:["Import options",e.jsxs(A,{children:[!s&&e.jsx(gs,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:P,disabled:z,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:z,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:h(_),disabled:!Y,loading:v==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:h(T),disabled:!L,loading:v==="import",children:"Import preview"})]})]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Ontime field"}),e.jsx("th",{children:"Column name in spreadsheet"}),e.jsx("th",{className:Pe.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([E,F])=>E==="custom"?null:E==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx(ne,{id:F,value:m(E),onValueChange:D=>d(E,D,{shouldDirty:!0}),options:(b==null?void 0:b.map(D=>({value:D,label:D})))||[]})}),e.jsx("td",{className:Pe.singleActionCell})]},F):e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx($,{id:F,fluid:!0,maxLength:25,defaultValue:F,placeholder:"Use default column name",...o(E)})}),e.jsx("td",{className:Pe.singleActionCell})]},F)),x.map((E,F)=>{var k,W,te;const D=E.ontimeName,K=E.importName,I=(te=(W=(k=u.custom)==null?void 0:k[F])==null?void 0:W.ontimeName)==null?void 0:te.message,C=`custom.${F}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx($,{maxLength:25,fluid:!0,defaultValue:D,placeholder:"Name of the field as shown in Ontime",...o(`custom.${F}.ontimeName`,{validate:ue=>os.isAlphanumericWithSpace(ue)?!0:"Only alphanumeric characters and space are allowed"})}),I&&e.jsx(N,{children:I})]}),e.jsx("td",{children:e.jsx($,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...o(`custom.${F}.importName`)})}),e.jsx("td",{className:Pe.singleActionCell,children:e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>S(F),children:e.jsx(he,{})})})]},C)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(A,{as:"td",align:"end",children:e.jsxs(f,{onClick:q,children:["Add custom field ",e.jsx(me,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(N,{children:y.worksheet.error})]})}const ti="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function si(){return e.jsxs(je,{children:["Ontime can import data from spreadsheets by: ",e.jsx("br",{}),"- importing the spreadsheet file in Ontime ",e.jsx("br",{}),"- synchronising your project with a Google Sheet",e.jsx("br",{}),e.jsx("br",{}),"To synchronise with a Google Sheet, you will need to allow Ontime to authenticate with your Google account.",e.jsx(se,{href:ti,children:"See the docs"})]})}function ni(t){const{onCancel:s}=t,{revoke:n,connect:r,verifyAuth:a}=ot(),[l,c]=j.useState(null),[i,h]=j.useState(null),[o,d]=j.useState(""),[m,u]=j.useState(""),g=G(D=>D.sheetId),x=G(D=>D.setSheetId),p=G(D=>D.setWorksheets),w=G(D=>D.patchStepData),y=G(D=>D.authenticationStatus),b=G(D=>D.setAuthenticationStatus),v=G(D=>D.stepData.authenticate.error),O=async()=>{const D=await a();D&&b(D.authenticated)};j.useEffect(()=>{w({authenticate:{available:!1,error:""}}),q()},[]);const _=async()=>{d("cancel"),await n(),await O(),d("")},P=()=>{s()},T=D=>{var K;(K=D.target.files)!=null&&K.length&&c(D.target.files[0])},S=async()=>{if(!l||!g)return;w({worksheet:{available:!1,error:""}}),d("connect");const D=await r(l,g);D&&(u(D.verification_url),h(D.user_code)),d("")},q=async(D=0)=>{const K=await a();if(K!=null&&K.authenticated&&(b(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const I=await bs(K.sheetId);p(I)}catch(I){const C=V(I);w({worksheet:{available:!1,error:C}})}d("");return}if(D<=10){setTimeout(()=>q(D+1),2e3);return}d("")},z=async()=>{d("authenticate"),Dt(m),window.addEventListener("focus",async()=>{q()},{once:!0})},de=l&&g,Y=!!i&&!!m,L=!!o,E=y==="authenticated",F=y==="pending";return e.jsxs(R,{children:[e.jsxs(fe,{children:["Sync with Google Sheet (experimental)",E?e.jsx(f,{onClick:_,loading:o==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:P,children:"Go Back"})]}),e.jsxs(oe,{children:[e.jsx(re,{children:"Upload Client Secret provided by Google"}),e.jsx(N,{children:v}),e.jsx($,{fluid:!0,type:"file",onChange:T,accept:".json",disabled:L||Y})]}),e.jsxs(oe,{children:[e.jsx(re,{children:"Enter ID of sheet to synchronise"}),e.jsx(N,{children:void 0}),e.jsx($,{fluid:!0,placeholder:"Sheet ID",onChange:D=>x(D.target.value),disabled:L||Y})]}),Y?e.jsx(oe,{children:e.jsxs(A,{children:[F&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Pt,{copyValue:i??"",disabled:!Y,children:i||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:z,disabled:!Y,children:[e.jsx(Is,{}),"Authenticate"]})]})}):e.jsx(oe,{children:e.jsx(A,{children:e.jsxs(f,{onClick:S,disabled:!de||L,loading:o==="connect",children:[e.jsx(Fs,{}),"Connect"]})})})]})}const ri="_center_1q0ge_17",ai="_nowrap_1q0ge_21",ii="_secondaryRow_1q0ge_25",li="_linkStartActive_1q0ge_30",oi="_flex_1q0ge_36",ci="_subdued_1q0ge_42",X={center:ri,nowrap:ai,secondaryRow:ii,linkStartActive:li,flex:oi,subdued:ci};function jt(t){return t?"Yes":void 0}function di(t){const{rundown:s,customFields:n}=t;let r=0;const a=Object.keys(n),l=a.map(c=>n[c].label);return e.jsxs(ve,{className:X.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"}),l.map(c=>e.jsx("th",{children:c},c)),e.jsx("th",{children:"ID"})]})}),e.jsx("tbody",{children:s.flatOrder.map(c=>{const i=s.entries[c];if(Qn(i)){const u=i.colour?dt(i.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{className:X.center,children:e.jsx(B,{children:"-"})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{})," ",e.jsx("td",{children:i.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:{...u},children:i.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(g=>{let x="";return g in i.custom&&(x=i.custom[g]),e.jsx("td",{children:x},g)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]},i.id)}if(Yn(i)){const u=i.colour?dt(i.colour):{};return e.jsxs(j.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{className:X.nowrap,children:i.cue}),e.jsx("td",{children:i.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:{...u},children:i.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(g=>{let x="";return g in i.custom&&(x=i.custom[g]),e.jsx("td",{children:x},g)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]}),i.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:X.secondaryRow,children:["Note: ",i.note]})})]},i.id)}if(!xs(i))return null;r+=1;const h=i.colour?dt(i.colour):{},o=jt(i.countToEnd),d=jt(i.skip),m=jt(i.flag);return e.jsxs(j.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:X.center,children:e.jsx(B,{children:r})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{className:X.nowrap,children:i.cue}),e.jsx("td",{children:i.title}),e.jsx("td",{className:X.center,children:m&&e.jsx(B,{children:m})}),e.jsxs("td",{className:X.flex,children:[e.jsx("span",{className:i.linkStart?X.subdued:void 0,children:Ue(i.timeStart)}),i.linkStart&&e.jsx(Ls,{className:X.linkStartActive})]}),e.jsx("td",{children:Ue(i.timeEnd)}),e.jsx("td",{children:Ue(i.duration)}),e.jsx("td",{children:Ue(i.timeWarning)}),e.jsx("td",{children:Ue(i.timeDanger)}),e.jsx("td",{className:X.center,children:o&&e.jsx(B,{children:o})}),e.jsx("td",{children:d&&e.jsx(B,{children:d})}),e.jsx("td",{style:{...h},children:i.colour}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.timerType})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.endAction})}),a.map(u=>{let g="";return u in i.custom&&(g=i.custom[u]),e.jsx("td",{children:g},u)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]}),i.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:X.secondaryRow,children:["Note: ",i.note]})})]},i.id)})})]})}function ui(t){const{rundown:s,customFields:n,onFinished:r,onCancel:a}=t,{data:l}=js(),[c,i]=j.useState(!1),{importRundown:h}=ot(),o=G(u=>u.resetPreview),d=()=>{o(),a()},m=async()=>{i(!0),await h({[l.id]:{...s,id:l.id,title:l.title}},n),i(!1),r()};return e.jsxs(R,{children:[e.jsxs(fe,{children:["Review Rundown",e.jsxs(A,{children:[e.jsx(f,{onClick:d,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{onClick:m,variant:"primary",loading:c,children:"Apply"})]})]}),e.jsx(di,{rundown:s,customFields:n})]})}function hi(){const[t,s]=j.useState("none"),[n,r]=j.useState(""),[a,l]=j.useState("none"),{exportRundown:c,importRundownPreview:i,verifyAuth:h}=ot(),o=G(k=>k.setWorksheets),d=G(k=>k.authenticationStatus),m=G(k=>k.setAuthenticationStatus),u=G(k=>k.rundown),g=G(k=>k.setRundown),x=G(k=>k.customFields),p=G(k=>k.setCustomFields),w=G(k=>k.setSheetId),y=G(k=>k.sheetId),b=j.useRef(null),v=async k=>{var te;const W=(te=k.target.files)==null?void 0:te[0];if(!W){o(null),l("none");return}try{l("loading"),Ra(W),await wa(W);const ue=await Sa();o(ue),s("excel"),l("done")}catch(ue){const Re=ln(ue);r(`Error uploading file: ${Re}`),o(null),l("none")}},O=()=>{var k;(k=b.current)==null||k.click()},_=()=>{s("none"),g(null),l("none"),o(null),p(null),r(""),w(null)},P=async()=>{const k=await h();if(k&&(m(k.authenticated),w(k.sheetId),k.authenticated==="authenticated"&&k.sheetId))try{const W=await bs(k.sheetId);o(W)}catch(W){const te=V(W);r(`Error getting worksheets: ${te}`)}s("gsheet")},T=()=>{_()},S=async k=>{if(r(""),t==="excel")try{const W=await Ca(k);g(W.rundown),p(W.customFields)}catch(W){r(V(W))}if(t==="gsheet"){if(!y)return;await i(y,k)}},q=async()=>{if(_(),d==="authenticated"){const k=await h();k&&m(k.authenticated)}},z=()=>{s("finished"),g(null),l("none"),o(null),p(null),r("")},de=async k=>{y&&await c(y,k)},Y=t==="excel",L=t==="gsheet",E=d==="authenticated",F=t==="none",D=t==="finished",K=L&&!E,I=L&&E||Y&&a==="done",C=u!==null&&x!==null;return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(N,{children:n}),F&&e.jsxs(e.Fragment,{children:[e.jsx(si,{}),e.jsx("input",{ref:b,style:{display:"none"},type:"file",onChange:v,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Pe.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:O,loading:a==="loading",children:[e.jsx(Ge,{}),"Import from spreadsheet"]}),e.jsx(re,{children:"Accepts .xlsx files"})]}),e.jsx(lr,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:P,disabled:a!=="none",children:[e.jsx($s,{}),"Synchronise with Google"]}),e.jsx(re,{children:"Start authentication process"})]})]})]}),D&&e.jsxs("div",{className:Pe.finishSection,children:[n?e.jsx("span",{className:Pe.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Pe.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:_,children:"Return"})]}),K&&e.jsx(ni,{onCancel:T}),I&&!C&&e.jsx(ei,{hasErrors:!!n,isSpreadsheet:Y,onCancel:q,onSubmitExport:de,onSubmitImport:S}),C&&e.jsx(ui,{rundown:u,customFields:x,onFinished:z,onCancel:q})]})})}const mi="_halfWidth_6p65m_17",xi="_fullWidth_6p65m_21",ji="_twoCols_6p65m_25",pi="_current_6p65m_31",tt={halfWidth:mi,fullWidth:xi,twoCols:ji,current:pi};function Ds({onSubmit:t,onCancel:s,initialColour:n,initialLabel:r,initialKey:a}){const{data:l}=it(),[c,i]=j.useState(n||""),{handleSubmit:h,register:o,setFocus:d,setError:m,setValue:u,getValues:g,watch:x,formState:{errors:p,isSubmitting:w,isValid:y,isDirty:b}}=ce({defaultValues:{type:"text",label:r||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),v=async S=>{const{type:q,label:z,colour:de}=S,Y={type:q,colour:de,label:z};try{await t(Y)}catch(L){m("root",{type:"custom",message:V(L)})}};j.useEffect(()=>{d("label")},[d]);const O=S=>{i(S),u("colour",S,{shouldDirty:!0})},_=g("colour"),P=b&&y,T=a!==void 0;return e.jsxs($e,{as:"form",onSubmit:h(v),onKeyDown:S=>we(S,s),children:[e.jsxs(je,{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(re,{children:"Type"}),e.jsx(ms,{orientation:"horizontal",disabled:T,onValueChange:S=>u("type",S,{shouldDirty:!0}),value:x("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:tt.twoCols,children:[e.jsxs("label",{children:[e.jsx(re,{children:"Label (only alphanumeric characters are allowed)"}),p.label&&e.jsx(N,{children:p.label.message}),e.jsx($,{...o("label",{required:{value:!0,message:"Required field"},onChange:()=>u("key",jr(g("label"))??"N/A"),validate:S=>S.trim().length===0?"Required field":os.isAlphanumericWithSpace(S)?!T&&T&&Object.keys(l).includes(S)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(re,{children:"Key (use in Integrations and API)"}),e.jsx($,{...o("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(re,{children:"Colour"}),e.jsx(In,{name:"colour",value:_,handleChange:(S,q)=>O(q)})]}),p.root&&e.jsx(N,{children:p.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!P,loading:w,children:"Save"})]})]})}function gi(t){const{colour:s,label:n,fieldKey:r,type:a,onEdit:l,onDelete:c}=t,[i,h]=j.useState(!1),o=async d=>{await l(r,d),h(!1)};return i?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ds,{onCancel:()=>h(!1),onSubmit:o,initialColour:s,initialLabel:n,initialKey:r})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Ln,{color:s})}),e.jsx("td",{children:e.jsx(B,{children:a})}),e.jsx("td",{className:tt.halfWidth,children:n}),e.jsx("td",{className:tt.fullWidth,children:e.jsx(Pt,{size:"small",copyValue:r,children:r})}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>h(!0),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>c(r),children:e.jsx(he,{})})]})]})}function fi(){const{data:t,refetch:s}=it(),[n,r]=j.useState(!1),a=()=>{r(!0)},l=()=>{r(!1)},c=async o=>{await sr(o),s(),r(!1)},i=async(o,d)=>{await nr(o,d),s()},h=async o=>{try{await rr(o),s()}catch{}};return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Custom fields",e.jsxs(f,{onClick:a,children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{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(fs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(se,{href:on,children:"See the docs"})]})}),e.jsxs(R,{children:[n&&e.jsx(Ds,{onSubmit:c,onCancel:l}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Key (used in Automations)"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:Object.entries(t).map(([o,{colour:d,label:m,type:u}])=>e.jsx(gi,{fieldKey:o,colour:d,label:m,type:u,onEdit:i,onDelete:h},o))})]})]})]})})}function vi(){const{data:t,status:s,isError:n,refetch:r,isFetching:a}=Ct({queryKey:Oe,queryFn:er,placeholderData:(l,c)=>l,refetchInterval:cs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:r,isFetching:a}}function Ns(){const t=_t(),{mutateAsync:s}=ct({mutationFn:Jn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}}),{mutateAsync:n}=ct({mutationFn:Xn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}}),{mutateAsync:r}=ct({mutationFn:Zn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}});return{create:s,remove:n,load:r}}function yi({onClose:t}){const{create:s}=Ns(),{handleSubmit:n,register:r,setFocus:a,setError:l,formState:{errors:c,isSubmitting:i}}=ce({defaultValues:{title:""}}),h=async o=>{try{await s(o.title||"untitled"),t()}catch(d){l("root",{message:`Failed to create rundown. ${d}`})}};return j.useEffect(()=>{a("title")},[a]),e.jsxs($e,{as:"form",onSubmit:n(h),children:[e.jsx(R,{children:e.jsxs("label",{children:[e.jsx(re,{children:"Rundown title"}),e.jsx($,{...r("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:i,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:i,children:"Create rundown"})]}),c.root&&e.jsx(N,{children:c.root.message})]})}function bi(){var b;const{data:t}=vi(),{remove:s,load:n}=Ns(),[r,a]=Ce(),[l,c]=Ce(),[i,h]=Ce(),[o,d]=j.useState(""),[m,u]=j.useState(null),g=v=>{u(null),d(v),c.open()},x=v=>{u(null),d(v),a.open()},p=async()=>{try{await n(o)}catch(v){u(`Failed to load rundown. ${V(v)}`)}finally{c.close()}},w=async()=>{try{await s(o)}catch(v){u(`Failed to delete rundown. ${V(v)}`)}finally{a.close()}},y=async(v,O)=>{await _a(v,O)};return e.jsxs(e.Fragment,{children:[e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage project rundowns",e.jsx(A,{children:e.jsxs(f,{onClick:()=>{u(null),h.open()},children:["New ",e.jsx(me,{})]})})]}),e.jsx(ie,{}),e.jsxs(R,{children:[i&&e.jsx(yi,{onClose:h.close}),m&&e.jsx(N,{children:m}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"# Entries"}),e.jsx("th",{style:{width:"100%"},children:"Title"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:(b=t==null?void 0:t.rundowns)==null?void 0:b.map(({id:v,numEntries:O,title:_})=>{const P=t.loaded===v;return e.jsxs("tr",{className:ge([P&&tt.current]),children:[e.jsx("td",{children:O}),e.jsxs("td",{children:[_," ",P&&e.jsx(B,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(us,{render:e.jsx(Z,{variant:"ghosted-white"}),items:[{type:"item",icon:Ge,label:"Load",onClick:()=>g(v),disabled:P},{type:"item",icon:es,label:"Download .xlsx",onClick:()=>y(v,_)},{type:"item",icon:he,label:"Delete",onClick:()=>x(v),disabled:P}],children:e.jsx(ts,{})})})]},v)})})]})]})]})}),e.jsx(vt,{isOpen:r,onClose:a.close,title:"Load 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:a.close,children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"large",onClick:w,children:"Delete rundown"})]})}),e.jsx(vt,{isOpen:l,onClose:c.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:c.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:p,children:"Load rundown"})]})})]})}function wi(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:r,defaultDangerTime:a,defaultTimerType:l,defaultEndAction:c,setDefaultDuration:i,setLinkPrevious:h,setTimeStrategy:o,setWarnTime:d,setDangerTime:m,setDefaultTimerType:u,setDefaultEndAction:g}=ps(y=>y),x=Ke(t),p=Ke(r),w=Ke(a);return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Rundown defaults"}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(fe,{children:"Default settings for new events"}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(be,{size:"large",checked:s,onCheckedChange:h})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ne,{value:n,onValueChange:y=>o(y),options:[{value:Wt.LockDuration,label:"Duration"},{value:Wt.LockEnd,label:"End Time"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Default duration",description:"Default duration for new events"}),e.jsx(Be,{name:"defaultDuration",submitHandler:(y,b)=>i(b),time:x,placeholder:ze.duration})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ne,{value:l,onValueChange:y=>u(y),options:[{value:Qe.CountDown,label:"Count down"},{value:Qe.CountUp,label:"Count up"},{value:Qe.Clock,label:"Clock"},{value:Qe.None,label:"None"}]})]}),e.jsxs(M,{children:[e.jsx(U,{title:"End Action",description:"Default end action for new events"}),e.jsx(ne,{value:c,onValueChange:y=>g(y),options:[{value:mt.None,label:"None"},{value:mt.LoadNext,label:"Load next"},{value:mt.PlayNext,label:"Play next"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Be,{name:"warnTime",submitHandler:(y,b)=>d(b),time:p,placeholder:ze.warnTime})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Be,{name:"dangerTime",submitHandler:(y,b)=>m(b),time:w,placeholder:ze.dangerTime})]})]})]})]})})}function Si({location:t}){const s=ae("defaults",t),n=ae("custom",t),r=ae("rundowns",t),a=ae("sheets",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(wi,{})}),e.jsx("div",{ref:n,children:e.jsx(fi,{})}),e.jsx("div",{ref:r,children:e.jsx(bi,{})}),e.jsx("div",{ref:a,children:e.jsx(hi,{})})]})}const Ci="_textEntry_dpb46_17",_i="_inlineEntry_dpb46_25",ki="_redirect_dpb46_32",Di="_label_dpb46_36",De={textEntry:Ci,inlineEntry:_i,redirect:ki,label:Di};function Ni({id:t,isOpen:s,name:n,currentPath:r,origin:a,onClose:l}){const{data:c}=is(),[i,h]=j.useState(r),[o,d]=j.useState("/"),{setRedirect:m}=ds,u=p=>{p==="/"||p===r||(p.startsWith("preset-")?m({target:t,redirect:p.slice(7)}):m({target:t,redirect:p}),l())},g=c.filter(p=>p.enabled),x=[...cn.map(p=>({value:`/${p.url}`,label:p.label})),...g.map(p=>({value:`preset-${p.alias}`,label:`URL Preset: ${p.alias}`}))];return e.jsx(at,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(je,{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(fs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:De.inlineEntry,children:[e.jsx("span",{className:De.label,children:"Enter custom path"}),e.jsxs("label",{className:De.textEntry,children:[a,e.jsx($,{placeholder:"eg. /timer",fluid:!0,value:i,onChange:p=>h(p.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:i===r||i==="",className:De.redirect,onClick:()=>u(i),children:["Redirect",e.jsx(Ft,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:De.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:De.inlineEntry,children:[e.jsxs("label",{className:De.textEntry,children:[a,e.jsx(ne,{fluid:!0,options:x,defaultValue:x[0].value,onValueChange:p=>d(p),disabled:g.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:De.redirect,disabled:g.length===0||o==="/",onClick:()=>u(o),children:["Redirect ",e.jsx(Ft,{})]})]})]})]})})}const Pi="_blink_vtewd_1",Ei="_halfWidthNoWrap_vtewd_25",Ri="_copiable_vtewd_30",St="_self_vtewd_35",qe={blink:Pi,halfWidthNoWrap:Ei,copiable:Ri,self:St};function Oi(){const t=Lt(x=>x.id),s=Lt(x=>x.clients),[n,r]=Ce(),[a,l]=Ce(),{setIdentify:c}=ds,[i,h]=j.useState(""),o=x=>{h(x),l.open()},d=x=>{h(x),r.open()},m=Object.entries(s).filter(([x,{type:p}])=>p==="ontime"),u=Object.entries(s).filter(([x,{type:p}])=>p!=="ontime"),g=s[i];return e.jsxs(e.Fragment,{children:[n&&g!==void 0&&e.jsx(Ni,{id:i,name:g.name,origin:g.origin,currentPath:g.path,isOpen:n,onClose:r.close}),a&&e.jsx(dn,{id:i,name:g==null?void 0:g.name,isOpen:a,onClose:l.close}),e.jsxs(R,{children:[e.jsxs(fe,{children:["Ontime Clients (",m.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:{width:"20%"},children:"Client Name"}),e.jsx("td",{children:"Path"}),e.jsx("td",{})]})}),e.jsx("tbody",{children:m.map(([x,p])=>{const{identify:w,name:y,path:b}=p,v=t===x;return e.jsxs("tr",{className:ge([v&&qe.self]),children:[e.jsxs(A,{relation:"inner",as:"td",children:[v&&e.jsx(B,{children:"SELF"}),y]}),e.jsx("td",{className:qe.copiable,children:b}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${w?qe.blink:""}`,disabled:v,variant:w?"primary":"subtle","data-testid":v?"":"not-self-identify",onClick:()=>{c({target:x,identify:!w})},children:"Identify"}),e.jsx(f,{size:"small","data-testid":v?"":"not-self-rename",onClick:()=>o(x),children:"Rename"}),e.jsx(f,{size:"small",disabled:v,"data-testid":v?"":"not-self-redirect",onClick:()=>d(x),children:"Redirect"})]})]},x)})})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsxs(fe,{children:["Other Clients (",u.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:qe.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:qe.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:u.map(([x,p])=>{const{name:w,type:y}=p;return e.jsxs("tr",{children:[e.jsx("td",{children:w}),e.jsx("td",{children:y})]},x)})})]})]})]})}function Ti(){return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Manage clients"}),e.jsx(ie,{}),e.jsx(Oi,{})]})})}const Ai="_iconRotate_l21m9_17",Fi={iconRotate:Ai};function Ii(){const t=s=>{ls("log",s)};return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(Zt,{className:Fi.iconRotate})]})]}),e.jsx(ie,{}),e.jsx(un,{})]})})}function Li({location:t}){const s=ae("clients",t),n=ae("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Network"}),hn,e.jsx("div",{ref:n,children:e.jsx(Ii,{})}),e.jsx("div",{ref:s,children:e.jsx(Ti,{})})]})}const Qt={project:{title:""},settings:{timeFormat:"24",language:"en"}};function $i({isOpen:t,onClose:s}){var y,b,v,O;const{defaultWarnTime:n,defaultDangerTime:r,setDangerTime:a,setWarnTime:l}=ps(),{handleSubmit:c,register:i,formState:{errors:h,isSubmitting:o,isValid:d},watch:m,setError:u,setValue:g}=ce({defaultValues:Qt,values:Qt,resetOptions:{keepDirtyValues:!0}}),x=async _=>{try{_.project.title===""&&(_.project.title="untitled"),await La(_),await Le(),s()}catch(P){u("root",{message:V(P)})}},p=Ke(n),w=Ke(r);return e.jsx(at,{isOpen:t,onClose:s,showBackdrop:!0,showCloseButton:!0,title:"Create new project...",bodyElements:e.jsxs("form",{onSubmit:c(x),id:"quick-start",children:[e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Project title",description:"Shown as the title in some views"}),e.jsx($,{maxLength:150,placeholder:"Project title",fluid:!0,...i("project.title")})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Time format",description:"Default time format to show in views 12 /24 hours",error:(b=(y=h.settings)==null?void 0:y.timeFormat)==null?void 0:b.message}),e.jsx(ne,{value:m("settings.timeFormat"),onValueChange:_=>g("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(M,{children:[e.jsx(U,{title:"Views language",description:"Language to be displayed in views",error:(O=(v=h.settings)==null?void 0:v.language)==null?void 0:O.message}),e.jsx(ne,{value:m("settings.language"),onValueChange:_=>g("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(M,{children:[e.jsx(U,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Be,{name:"warnTime",submitHandler:(_,P)=>l(P),time:p,placeholder:ze.warnTime})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Be,{name:"dangerTime",submitHandler:(_,P)=>a(P),time:w,placeholder:ze.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:!d,loading:o,children:"Create project"})]})})}const Vi="_current_1iru7_17",Wi="_isEditing_1iru7_21",Mi="_form_1iru7_25",Ui="_formInput_1iru7_33",qi="_saveButton_1iru7_37",zi="_containCell_1iru7_41",Bi="_innerColumn_1iru7_49",Ki="_inlineLabels_1iru7_57",Gi="_warningInfo_1iru7_62",Hi="_empty_1iru7_66",xe={current:Vi,isEditing:Wi,form:Mi,formInput:Ui,saveButton:qi,containCell:zi,innerColumn:Bi,inlineLabels:Ki,warningInfo:Gi,empty:Hi};function Qi({onClose:t}){const[s,n]=j.useState(null),{handleSubmit:r,register:a,formState:{isSubmitting:l,isValid:c},setFocus:i}=ce({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{i("title")},[i]);const h=async o=>{try{n(null);const d=o.title??"untitled";await Ia({filename:d}),t()}catch(d){n(V(d))}};return e.jsxs($e,{as:"form",onSubmit:r(h),onKeyDown:o=>we(o,t),children:[e.jsxs(fe,{children:["Create new project",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:l,children:"Cancel"}),e.jsx(f,{disabled:!c,type:"submit",loading:l,variant:"primary",children:"Create project"})]})]}),s&&e.jsx(N,{children:s}),e.jsxs(R,{className:xe.innerColumn,children:[e.jsx(re,{children:"Project title"}),e.jsx($,{fluid:!0,placeholder:"Your project name",...a("title")})]})]})}const Yi={files:[],lastLoadedProject:""};function Ji(){const{data:t,status:s,refetch:n}=Ct({queryKey:mn,queryFn:$a,placeholderData:(r,a)=>r,retry:5,retryDelay:r=>r*2500,refetchInterval:cs,networkMode:"always"});return{data:t??Yi,status:s,refetch:n}}function Ps(){const t=Ji(),{files:s,lastLoadedProject:n}=t.data,r=j.useMemo(()=>{if(!s.length)return[];const a=s.findIndex(i=>i.filename===n);if(a===-1)return s;const l=[...s];return[l.splice(a,1)[0],...l]},[s,n]);return{...t,data:{reorderedProjectFiles:r,lastLoadedProject:t.data.lastLoadedProject}}}function Xi({action:t,filename:s,onSubmit:n,onCancel:r}){const{handleSubmit:a,register:l,formState:{isSubmitting:c,isDirty:i,isValid:h},setFocus:o}=ce({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return j.useEffect(()=>{o("filename")},[o]),e.jsxs("form",{onSubmit:a(n),onKeyDown:d=>we(d,r),className:xe.form,children:[e.jsx($,{className:xe.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{onClick:r,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!i||!h||c,type:"submit",className:xe.saveButton,children:t})]})]})}async function Zi(t,s){const n={};for(const r in s)tr(r,t)&&s[r]&&(r==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[r]:t[r]}));return n}function el({onClose:t,fileName:s}){const[n,r]=j.useState(null),a=_t(),{handleSubmit:l,watch:c,setValue:i,formState:{isSubmitting:h,isValid:o,isDirty:d}}=ce({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),m=async u=>{if(Object.values(u).every(x=>!x)){r("At least one option must be selected");return}try{r(null);const{data:x}=await Ss(s);if(!x.settings.version.startsWith("4.")){r("The project you are attempting to merge is from an older version and it need to be migrated first");return}const p=await Zi(x,u);await _s(p),await a.invalidateQueries({queryKey:xn}),t()}catch(x){r(V(x))}};return e.jsxs(R,{as:"form",onSubmit:l(m),children:[e.jsxs(fe,{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:!o||!d,loading:h,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(N,{children:n}),e.jsxs(R,{className:ge([xe.innerColumn,xe.inlineLabels]),children:[e.jsxs(re,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(je,{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(be,{size:"large",checked:c("project"),onCheckedChange:u=>i("project",u,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("rundowns"),onCheckedChange:u=>i("rundowns",u,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("viewSettings"),onCheckedChange:u=>i("viewSettings",u,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("urlPresets"),onCheckedChange:u=>i("urlPresets",u,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("automation"),onCheckedChange:u=>i("automation",u,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function tl({current:t,updatedAt:s,editingFilename:n,editingMode:r,filename:a,onRefetch:l,onSubmit:c,onToggleEditMode:i}){const[h,o]=j.useState(null),[d,m]=j.useState(!1),u=_=>async P=>{m(!0),o(null);try{if(!P.filename){o("Filename cannot be blank");return}await(_==="rename"?Ma:Wa)(a,P.filename),await l(),c()}catch(T){o(V(T))}finally{m(!1)}},g=async _=>{m(!0),o(null);try{await ks(_),await l(),await Le()}catch(P){o(V(P))}finally{m(!1)}},x=async _=>{m(!0),o(null);try{await Ua(_),await l()}catch(P){o(V(P))}finally{m(!1)}},p=(_,P)=>{o(null),i(_,P)},w=()=>{p(null,null)},y=a===n,b=(r==="rename"||r==="duplicate")&&a===n,v=r==="merge"&&y,O=ge([t&&!y&&xe.current,y&&xe.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:O,children:b?e.jsx("td",{colSpan:99,children:e.jsx(Xi,{action:r,filename:a,onSubmit:u(r==="duplicate"?"duplicate":"rename"),onCancel:w})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:xe.containCell,children:a}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(sl,{current:t,filename:a,onChangeEditMode:p,onDelete:x,onLoad:g,isDisabled:d||v,onMerge:_=>p("merge",_)})})]})},a),v&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(el,{onClose:w,fileName:a})})})]})}function sl(t){const{current:s,filename:n,isDisabled:r,onChangeEditMode:a,onDelete:l,onLoad:c,onMerge:i}=t,h=()=>{a("rename",n)},o=()=>{a("duplicate",n)},d=async()=>{await Fa(n)};return e.jsx(us,{render:e.jsx(Z,{variant:"ghosted-white"}),disabled:r,items:[{type:"item",icon:Ge,label:"Load",onClick:()=>c(n),disabled:s},{type:"item",icon:Ge,label:"Partial Load",onClick:()=>i(n),disabled:s},{type:"item",icon:Vs,label:"Rename",onClick:h},{type:"item",icon:Ws,label:"Duplicate",onClick:o},{type:"item",icon:es,label:"Download",onClick:d},{type:"divider"},{type:"item",icon:he,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(ts,{})})}function nl(){const{data:t,refetch:s,status:n}=Ps(),[r,a]=j.useState(null),[l,c]=j.useState(null),i=(m,u)=>{a(g=>g===m&&u===l?null:m),c(u)},h=()=>{a(null),c(null)},o=async()=>{await s()};if(n==="pending")return e.jsx("div",{className:xe.empty,children:e.jsx(Ae,{isLoading:!0})});const d=t.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[d>20&&e.jsxs(je,{className:xe.warningInfo,type:"warning",children:["You have ",d," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:xe.containCell,children:"File Name"}),e.jsx("th",{children:"Last Used"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.reorderedProjectFiles.map(m=>e.jsx(tl,{filename:m.filename,updatedAt:m.updatedAt,onToggleEditMode:i,onSubmit:h,onRefetch:o,editingFilename:l,editingMode:r,current:m.filename===t.lastLoadedProject},m.filename))})]})]})}function rl(){const[t,s]=ss(),[n,r]=j.useState(""),[a,l]=j.useState(null),c=j.useRef(null),i=t.get("new")==="true",h=()=>{t.set("new",i?"false":"true"),s(t)},o=()=>{var u;(u=c.current)==null||u.click()},d=async u=>{var x,p;const g=(p=(x=u.target)==null?void 0:x.files)==null?void 0:p[0];if(g){l("import");try{ws(g),await Cs(g)}catch(w){const y=V(w);r(`Error uploading file: ${y}`)}finally{await Le()}l(null)}},m=()=>{t.delete("new"),s(t)};return e.jsxs(R,{children:[e.jsx("input",{ref:c,style:{display:"none"},type:"file",onChange:d,accept:".json","data-testid":"file-input"}),e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage projects",e.jsxs(A,{children:[e.jsx(f,{onClick:o,disabled:!!a||i,loading:a==="import",children:"Import"}),e.jsxs(f,{onClick:h,disabled:!!a||i,children:["New ",e.jsx(me,{})]})]})]}),n&&e.jsx(N,{children:n}),e.jsx(ie,{}),i&&e.jsx(Qi,{onClose:m}),e.jsx(nl,{})]})]})}function al({location:t,setLocation:s}){const n=ae("list",t),r=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Project"}),e.jsx($i,{isOpen:t==="create",onClose:r}),e.jsx("div",{ref:n,children:e.jsx(rl,{})})]})}const il="_container_cq029_17",ll={container:il};function Yt({register:t,formName:s,disabled:n}){const[r,a]=j.useState(!1);return e.jsxs("div",{className:ll.container,children:[e.jsx($,{type:r?"text":"password",maxLength:4,...t(s,{pattern:{value:qn,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(Z,{onMouseDown:()=>a(!0),onMouseUp:()=>a(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(Ms,{})})]})}const ol=j.lazy(()=>He(()=>import("./CustomTranslationModal-D_Cy0d_H.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url));function cl(){var _,P,T,S,q;const{data:t,status:s,refetch:n}=jn(),{handleSubmit:r,register:a,reset:l,setError:c,watch:i,setValue:h,formState:{isSubmitting:o,isDirty:d,isValid:m,errors:u}}=ce({mode:"onChange",defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}}),[g,x]=Ce();j.useEffect(()=>{t&&l(t)},[t,l]);const p=async z=>{try{await pn(z)}catch(de){const Y=V(de);c("root",{message:Y})}finally{await n()}},w=s==="pending",y=o||!d||!m,b="",v=()=>{l(t)},O=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(ol,{isOpen:g,onClose:x.close}),e.jsx(R,{as:"form",onSubmit:r(p),onKeyDown:z=>we(z,v),id:"app-settings",children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["General settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!d||o,variant:"ghosted",onClick:v,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:o,disabled:y,variant:"primary",children:"Save"})]})]}),b,e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:O}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Ontime server port",description:Ie?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(_=u.serverPort)==null?void 0:_.message}),e.jsx($,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Ie,...a("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:hs,message:"Value should be numeric"}})})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(P=u.editorKey)==null?void 0:P.message}),e.jsx(Yt,{register:a,formName:"editorKey",disabled:w})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(T=u.operatorKey)==null?void 0:T.message}),e.jsx(Yt,{register:a,formName:"operatorKey",disabled:w})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Time format",description:"Default time format to show in views 12 /24 hours",error:(S=u.timeFormat)==null?void 0:S.message}),e.jsx(ne,{value:i("timeFormat"),onValueChange:z=>h("timeFormat",z,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Views language",description:"Language to be displayed in views",error:(q=u.language)==null?void 0:q.message}),e.jsx(ne,{value:i("language"),onValueChange:z=>h("language",z,{shouldDirty:!0}),disabled:w,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:x.open,children:"Edit custom translation"})]})]})]})]})})]})}const dl="_uploadLogoCard_m5263_17",ul="_customDataItem_m5263_32",hl="_titleRow_m5263_39",ml="_customImage_m5263_48",xl="_imageContainer_m5263_54",Fe={uploadLogoCard:dl,customDataItem:ul,titleRow:hl,customImage:ml,imageContainer:xl};function jl(){var Y;const{data:t,status:s}=$n(),{updateProjectData:n}=Vn(),{handleSubmit:r,register:a,reset:l,formState:{isSubmitting:c,isValid:i,isDirty:h,errors:o},setError:d,clearErrors:m,watch:u,control:g,setValue:x}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:p,append:w,remove:y}=Ze({control:g,name:"custom"});j.useEffect(()=>{t&&l(t)},[t,l]);const b=async L=>{var F;const E=(F=L.target.files)==null?void 0:F[0];if(m("logo"),!!E)try{Aa(E);const D=await Wn(E);x("logo",D.data.logoFilename,{shouldDirty:!0})}catch(D){const K=V(D);d("logo",{message:K})}},{ref:v,...O}=a("logo"),_=j.useRef(null),P=()=>{var L;(L=_.current)==null||L.click()},T=L=>{L.preventDefault(),L.stopPropagation(),x("logo",null,{shouldDirty:!0})},S=()=>{w({title:"",value:"",url:""})},q=async L=>{try{m(),await n(L)}catch(E){const F=V(E);d("root",{message:F})}},z=()=>{l(t)},de=s==="pending";return e.jsx(R,{as:"form",onSubmit:r(q),onKeyDown:L=>we(L,z),children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Project data",e.jsxs(A,{children:[e.jsx(f,{onClick:z,disabled:c||!h,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!h||!i,loading:c,children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:de}),e.jsxs("label",{children:["Project title",e.jsx($,{fluid:!0,maxLength:50,placeholder:"Project title is shown in production views",...a("title")})]}),e.jsx(R,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...O,ref:L=>{v(L),_.current=L},onChange:b}),e.jsxs(ee,{className:Fe.uploadLogoCard,children:[u("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${gn}/${u("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:c||!u("logo"),onClick:T,children:[e.jsx(he,{}),"Delete"]})]}):e.jsxs(f,{disabled:c,onClick:P,type:"button",children:[e.jsx(Ge,{}),"Upload logo"]}),((Y=o==null?void 0:o.logo)==null?void 0:Y.message)&&e.jsx(N,{children:o.logo.message})]})]})}),e.jsxs("label",{children:["Project description",e.jsx($,{fluid:!0,maxLength:100,placeholder:"Euro Love, Malmö 2024",...a("description")})]}),e.jsxs("label",{children:["Project info",e.jsx(yt,{fluid:!0,maxLength:150,placeholder:"Wi-Fi password: 1234",resize:"vertical",...a("info")})]}),e.jsxs("label",{children:["Project QR code URL",e.jsx($,{fluid:!0,placeholder:Nt,...a("url")})]}),e.jsxs(R,{style:{marginTop:0},children:[e.jsxs(M,{children:[e.jsx(U,{title:"Custom data",description:""}),e.jsxs(f,{onClick:S,children:["Add ",e.jsx(me,{})]})]}),p.length>0&&p.map((L,E)=>{var D,K,I;const F=(D=o.custom)==null?void 0:D[E];return e.jsxs("div",{className:Fe.customDataItem,children:[e.jsxs("div",{className:Fe.titleRow,children:[e.jsxs("label",{className:Fe.title,children:["Title",e.jsx($,{fluid:!0,defaultValue:L.title,placeholder:"Title of your custom data",...a(`custom.${E}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>y(E),children:[e.jsx(he,{}),"Delete"]})]}),((K=F==null?void 0:F.title)==null?void 0:K.message)&&e.jsx(N,{children:F.title.message}),e.jsxs("label",{children:["Text",e.jsx(yt,{fluid:!0,rows:3,resize:"vertical",defaultValue:L.value,placeholder:"Text of your custom data",...a(`custom.${E}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),((I=F==null?void 0:F.value)==null?void 0:I.message)&&e.jsx(N,{children:F.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Fe.customImage,children:[e.jsx($,{fluid:!0,defaultValue:L.url,placeholder:"Paste image URL (optional)",...a(`custom.${E}.url`)}),e.jsx("div",{className:Fe.imageContainer,children:u(`custom.${E}.url`)&&e.jsx("img",{src:u(`custom.${E}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},L.id)})]})]})]})})}const pl="_editorActions_18rtd_17",gl="_right_18rtd_21",fl="_column_18rtd_26",pt={editorActions:pl,right:gl,column:fl},vl=j.lazy(()=>He(()=>import("./StyleEditor-BIFjHsgD.js"),__vite__mapDeps([11,1,2,12]),import.meta.url));function yl({isOpen:t,onClose:s}){const[n,r]=j.useState(""),[a,l]=j.useState(!1),[c,i]=j.useState(!1),[h,o]=j.useState(!1),[d,m]=j.useState(null),u=j.useRef(null),g=async()=>{try{o(!0);const w=await fn();r(w)}catch{}finally{o(!1)}},x=async()=>{try{i(!0),u.current&&(await vn(u.current.getCss()),r(u.current.getCss()),l(!1))}catch{}finally{i(!1)}},p=()=>r("");return j.useEffect(()=>{async function w(){if(t)try{const y=await yn();r(y)}catch{m("Failed to load CSS from server")}}w()},[t]),e.jsx(at,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(vl,{ref:u,initialValue:n,language:"css",isDirty:a,setIsDirty:l}),footerElements:e.jsxs("div",{className:pt.column,children:[e.jsx(je,{children:"Invalid CSS will be refused by the browser"}),d&&e.jsx(N,{className:pt.right,children:`Error: ${d}`}),e.jsxs(A,{align:"apart",className:pt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:g,disabled:c||h,children:"Reset to example"}),e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:p,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:x,disabled:c||h||!a,loading:c,children:"Save changes"})]})]})]})})}const bl="https://docs.getontime.no/features/custom-styling/";function wl(){var w;const{data:t,status:s,mutateAsync:n}=bn(),[r,a]=Ce(),{control:l,handleSubmit:c,setError:i,reset:h,setValue:o,watch:d,formState:{isSubmitting:m,isDirty:u,errors:g}}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{t&&h(t)},[t,h]);const x=async y=>{try{n(y)}catch(b){const v=V(b);i("root",{message:v})}},p=()=>{h(t)};return l?e.jsx(R,{as:"form",onSubmit:c(x),onKeyDown:y=>we(y,p),id:"view-settings",children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["View settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!u,variant:"ghosted",onClick:p,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:m,disabled:!u,variant:"primary",children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(je,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(se,{href:bl,children:"See the docs"})]}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:s==="pending"}),e.jsx(N,{children:(w=g.root)==null?void 0:w.message}),e.jsxs(oe,{children:[e.jsx(yl,{isOpen:r,onClose:a.close}),e.jsxs(M,{children:[e.jsx(U,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(be,{size:"large",checked:d("overrideStyles"),onCheckedChange:y=>o("overrideStyles",y,{shouldDirty:!0})}),e.jsx(f,{onClick:a.open,disabled:m,children:"Edit CSS override"})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(ht,{name:"normalColor",control:l})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(ht,{name:"warningColor",control:l})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(ht,{name:"dangerColor",control:l})]})]})]})]})}):null}function Sl({location:t}){const s=ae("data",t),n=ae("general",t),r=ae("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(jl,{})}),e.jsx("div",{ref:n,children:e.jsx(cl,{})}),e.jsx("div",{ref:r,children:e.jsx(wl,{})})]})}function Cl(){const{isElectron:t,sendToElectron:s}=wn(),[n,r]=Ce(),a=j.useRef(null),l=()=>{s("shutdown","now"),r.close()},c=t||et;return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Shutdown Ontime"}),e.jsxs(R,{children:[Ie?e.jsx(Sn,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(_e,{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:r.open,disabled:!(t||et),children:"Shutdown ontime"}),!c&&e.jsx(re,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(vt,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:r.close,bodyElements:e.jsxs(_e,{children:["This will shutdown the Ontime server. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{ref:a,onClick:r.close,variant:"ghosted-white",children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:l,disabled:!c,children:"Shutdown"})]})})]})]})}const _l="_corner_1dxip_17",kl="_contentWrapper_1dxip_24",Dl="_content_1dxip_24",gt={corner:_l,contentWrapper:kl,content:Dl};function Nl({onClose:t,children:s}){return e.jsxs("div",{className:gt.contentWrapper,children:[e.jsx("div",{className:gt.content,children:s}),e.jsx("div",{className:gt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(kt,{})]})})]})}const Pl=[{id:"settings",label:"Settings",secondary:[{id:"settings__data",label:"Project data"},{id:"settings__general",label:"General settings"},{id:"settings__view",label:"View settings"}]},{id:"project",label:"Project",split:!0,secondary:[{id:"project__create",label:"Create..."},{id:"project__list",label:"Manage projects"}]},{id:"manage",label:"Project settings",secondary:[{id:"manage__defaults",label:"Rundown defaults"},{id:"manage__custom",label:"Custom fields"},{id:"manage__rundowns",label:"Manage rundowns"},{id:"manage__sheets",label:"Import spreadsheet"},{id:"manage__sheets",label:"Sync with Google Sheet"}]},{id:"automation",label:"Automation",split:!0,secondary:[{id:"automation__settings",label:"Automation settings"},{id:"automation__automations",label:"Manage automations"},{id:"automation__triggers",label:"Manage triggers"}]},{id:"sharing",label:"Sharing and reporting",split:!0,secondary:[{id:"sharing__presets",label:"URL Presets"},{id:"sharing__link",label:"Share link"},{id:"sharing__report",label:"Runtime report"}]},{id:"network",label:"Network",split:!0,secondary:[{id:"network__log",label:"Event log"},{id:"network__clients",label:"Manage clients"}]},{id:"about",label:"About",split:!0},{id:"shutdown",label:"Shutdown",split:!0}];function El(){const{data:t}=vs();return{options:j.useMemo(()=>Pl.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Je="settings";function Ot(){const[t,s]=ss(),n=j.useMemo(()=>t.get(Je)??"project",[t]),r=j.useMemo(()=>!!t.get(Je),[t]),[a,l]=n.split("__"),c=j.useCallback(()=>{t.delete(Je),s(t)},[t,s]),i=j.useCallback(h=>{t.set(Je,h),s(t)},[t,s]);return{isOpen:r,panel:a,location:l,setLocation:i,close:c}}const Rl="_tabs_86c70_17",Ol="_primary_86c70_31",Tl="_secondary_86c70_32",Al="_active_86c70_54",Fl="_highlight_86c70_58",Il="_split_86c70_68",Te={tabs:Rl,primary:Ol,secondary:Tl,active:Al,highlight:Fl,split:Il};function Ll({selectedPanel:t,location:s}){const{options:n}=El();return e.jsx("ul",{className:Te.tabs,children:n.map(r=>{const a=t===r.id;return r.highlight?e.jsx(gs,{text:r.highlight,render:e.jsx("span",{}),children:e.jsx(Jt,{panel:r,location:s,isSelected:a})},r.id):e.jsx(Jt,{panel:r,location:s,isSelected:a},r.id)})})}function Jt(t){var c;const{panel:s,isSelected:n,location:r}=t,{setLocation:a}=Ot(),l=ge([Te.primary,n&&Te.active,s.split&&Te.split,s.highlight&&Te.highlight]);return e.jsxs(j.Fragment,{children:[e.jsx("li",{onClick:()=>a(s.id),onKeyDown:i=>{$t(i)&&a(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(c=s.secondary)==null?void 0:c.map((i,h)=>{const o=i.id.split("__")[1],d=ge([Te.secondary,n&&r===o?Te.active:null]);return e.jsx("li",{onClick:()=>a(i.id),onKeyDown:m=>{$t(m)&&a(i.id)},className:d,role:"button",children:i.label},i.id+h)})]},s.id)}const $l="_container_1fy3l_17",Vl={container:$l};function Wl(){const{close:t,panel:s,location:n,setLocation:r}=Ot();return gr(t,"Escape"),e.jsx("div",{className:Vl.container,children:e.jsxs(Us,{children:[e.jsx(Ll,{selectedPanel:s,location:n}),e.jsxs(Nl,{onClose:t,children:[s==="settings"&&e.jsx(Sl,{location:n}),s==="project"&&e.jsx(al,{location:n,setLocation:r}),s==="manage"&&e.jsx(Si,{location:n}),s==="automation"&&e.jsx(ta,{location:n}),s==="sharing"&&e.jsx(ba,{location:n}),s==="network"&&e.jsx(Li,{location:n}),s==="about"&&e.jsx(wr,{}),s==="shutdown"&&e.jsx(Cl,{})]})]})})}const Ml=j.memo(Ul);function Ul({children:t}){return e.jsxs(zn,{navElements:t,children:[e.jsx(Bn,{}),e.jsx(dr,{}),e.jsx(ur,{}),e.jsx(hr,{}),e.jsx(mr,{}),e.jsx(xr,{})]})}function ql({onFinish:t}){const s=j.useRef(null),n=()=>{var a;(a=s.current)==null||a.click()},r=async a=>{var c,i;const l=(i=(c=a.target)==null?void 0:c.files)==null?void 0:i[0];if(l)try{ws(l),await Cs(l)}catch{}finally{await Le(),t()}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:s,style:{display:"none"},type:"file",onChange:r,accept:".json","data-testid":"file-input"}),e.jsx(f,{onClick:n,children:"Import project"})]})}const zl="_sections_khqv6_17",Bl="_column_khqv6_23",Kl="_about_khqv6_23",Gl="_inline_khqv6_35",Hl="_header_khqv6_41",Ql="_logo_khqv6_48",Yl="_buttonRow_khqv6_53",Jl="_tableContainer_khqv6_62",Xl="_table_khqv6_62",Zl="_current_khqv6_75",pe={sections:zl,column:Bl,about:Kl,inline:Gl,header:Hl,logo:Ql,buttonRow:Yl,tableContainer:Jl,table:Xl,current:Zl};function eo(t){const{loadProject:s,onClose:n}=t,{data:r}=Ps();return e.jsx("tbody",{children:r.reorderedProjectFiles.map(a=>a.filename===r.lastLoadedProject?e.jsxs("tr",{className:pe.current,onClick:n,children:[e.jsx("td",{children:a.filename}),e.jsx("td",{children:"Loaded from last session"})]},a.filename):e.jsxs("tr",{onClick:()=>s(a.filename),children:[e.jsx("td",{children:a.filename}),e.jsx("td",{children:new Date(a.updatedAt).toLocaleString()})]},a.filename))})}function to({onClose:t}){const s=qs(),n=async l=>{try{await ks(l),await Le(),t()}catch{}},r=async()=>{try{await Va(),await Le(),t()}catch{}},a=()=>{s("/editor?settings=project__create"),t()};return e.jsx(at,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:pe.sections,children:[e.jsxs("div",{className:pe.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:pe.logo}),e.jsxs("div",{children:["Ontime v",Xe]}),e.jsx(se,{href:ft,children:"Website"}),e.jsx(se,{href:Nt,children:"Read the docs"}),e.jsx(se,{href:ns,children:"Discord server"})]}),e.jsxs("div",{className:pe.column,children:[e.jsxs("div",{className:pe.header,children:["Welcome to Ontime",e.jsx(Z,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(kt,{})})]}),e.jsx(cr,{children:"Select project"}),e.jsx("div",{className:pe.tableContainer,children:e.jsxs("table",{className:pe.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(eo,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:pe.column,children:[e.jsxs("div",{className:pe.buttonRow,children:[e.jsx(f,{onClick:r,children:"Load demo project"}),e.jsx(ql,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:a,children:"Create new..."})]}),e.jsxs(or,{className:pe.inline,children:[e.jsx(Dn,{defaultChecked:!0,onCheckedChange:l=>Cn(l)}),"Show this modal on next startup"]})]})})}function so(){const t=Vt(n=>n.showDialog),s=Vt(n=>n.clearDialog);return t?e.jsx(to,{onClose:s}):null}const no=j.lazy(()=>He(()=>import("./RundownExport-WjLpncYT.js").then(t=>t.R),__vite__mapDeps([13,1,2,14,3,4,15,16,17,18,8,9,19,20,21,22,23,24,25,26,27,28,29,30,31,32,7,10,33,34,35,36,37,38]),import.meta.url)),ro=j.lazy(()=>He(()=>import("./TimerControlExport-C1C_vBX4.js"),__vite__mapDeps([39,1,2,14,3,4,15,16,17,20,21,22,31,32,40,41,42,43]),import.meta.url)),ao=j.lazy(()=>He(()=>import("./MessageControlExport-yLGU2dMq.js"),__vite__mapDeps([44,1,2,14,3,4,15,16,17,29,30,31,32,41,42,45]),import.meta.url));function io(){const{isOpen:t,setLocation:s,close:n}=Ot(),[r,a]=Ce();Nn("Editor"),_n(),j.useEffect(()=>{var c;((c=window.process)==null?void 0:c.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=j.useCallback(()=>{t?n():s("settings")},[n,t,s]);return zs([["mod + ,",l]]),e.jsxs("div",{className:xt.mainContainer,"data-testid":"event-editor",children:[e.jsx(so,{}),e.jsx(kn,{isOpen:r,onClose:a.close}),e.jsxs(Ml,{children:[e.jsx(Z,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:a.open,children:e.jsx(Bs,{})}),e.jsx(Z,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(kt,{}):e.jsx(Ks,{})})]}),t?e.jsx(Wl,{}):e.jsxs("div",{id:"panels",className:xt.panelContainer,children:[e.jsxs("div",{className:xt.left,children:[e.jsx(ro,{}),e.jsx(ao,{})]}),e.jsx(no,{})]})]})}function Po(){return e.jsx(Gs,{permission:"editor",children:e.jsx(io,{})})}export{Po as default};
3
- //# sourceMappingURL=ProtectedEditor-D4UXj1xL.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CustomTranslationModal-C3R_2T5s.js","./vendor-CCiSQ9k9.js","./vendor-4xP-6xVS.css","./index-BQEUaoAf.js","./index-De0uf0Ta.css","./useWindowTitle-DqdFTWns.js","./useWindowTitle-DrFGLRMI.css","./Modal-C2sFA0zf.js","./useProjectData-C1hVamxc.js","./useProjectData-Cw1aXCwD.css","./Modal-BgJx3SNK.css","./StyleEditor-D2z65PB7.js","./StyleEditor-Bie84LSc.css","./RundownExport-C6YhMGOC.js","./EditorUtils-Da5ALK1P.js","./EditorUtils-BXko-IuN.css","./ProtectRoute-CrcWfOlG.js","./ProtectRoute-Bm5sjStK.css","./useRundown-BfpjcCEJ.js","./MilestoneEditor-Bge8xLrV.js","./TimeInput-Dg1naiy3.js","./parseUserTime-BeTKj08M.js","./TimeInput-BrVdiuOQ.css","./dateConfig-DRQGMWDF.js","./validateEvent-P9sf7C10.js","./editorSettings-BU0pTMSY.js","./editorSettings-BqHbWs9b.css","./rundownUtils-BZHazkXR.js","./useCustomFields-DqCYz8Kt.js","./Select-CedN80WS.js","./Select-Cd08aEcf.css","./Tooltip-D9XRnwOW.js","./Tooltip-CKb7gU2M.css","./offset-DJAHqjFW.js","./MilestoneEditor-906SVj5M.css","./Empty-gWT_HMeu.js","./Empty-DvR62o5B.css","./useFollowComponent-Ctfhf2or.js","./RundownExport-1zBZurIG.css","./TimerControlExport-C8ECtLBd.js","./useReport-B4dMYcNL.js","./Editor.module-DvV2efYs.js","./Editor-B_NlyOLw.css","./TimerControlExport-D8kqHQB0.css","./MessageControlExport-lXK21piH.js","./MessageControlExport-DPgqVb-4.css"])))=>i.map(i=>d[i]);
2
+ import{h as j,j as e,ac as Xt,e as H,k as Ct,ad as ce,ae as Es,af as Rs,ag as Ze,ah as he,T as me,aa as st,ai as Os,x as Zt,aj as Ts,ak as At,f as As,O as _t,A as Fs,al as Is,am as Ls,an as Ge,ao as $s,P as ct,C as Ce,ap as es,aq as ts,ar as Ft,as as Vs,at as Ws,l as ss,au as Ms,$ as He,t as kt,av as Us,v as qs,M as zs,I as Bs,m as Ks}from"./vendor-CCiSQ9k9.js";import{P as Gs}from"./ProtectRoute-CrcWfOlG.js";import{i as ge,N as Dt,Q as Hs,R as Qs,S as et,r as Ys,U as Js,V as _e,W as Xe,X as N,Y as Ie,Z as Ee,_ as R,$ as ee,a0 as Q,a1 as ft,a2 as Xs,a3 as Zs,a4 as Nt,a5 as en,a6 as ns,a7 as A,B as f,a8 as ie,a9 as we,aa as Ae,ab as fe,ac as oe,ad as M,ae as U,af as $,ag as V,ah as $e,ai as Z,aj as ve,ak as nt,al as tn,am as sn,an as Pt,g as Ne,ao as rs,ap as Et,aq as as,ar as re,O as Se,as as nn,at as It,au as is,av as ls,aw as Rt,ax as rn,ay as an,az as os,aA as dt,y as Ue,aB as ln,aC as on,aD as Oe,aE as cs,aF as vt,T as Qe,aG as cn,aH as ds,aI as Lt,aJ as dn,aK as un,aL as hn,aM as Le,aN as mn,aO as xn,d as jn,aP as pn,K as gn,aQ as fn,aR as vn,aS as yn,c as bn,aT as wn,aU as Sn,aV as $t,aW as Cn,aX as Vt,aY as _n,aZ as kn}from"./index-BQEUaoAf.js";import{I as je,C as Dn,u as Nn}from"./useWindowTitle-DqdFTWns.js";import{e as Pn,u as rt,T as B,t as ut,a as En,b as Rn,d as On,c as Tn,f as An,g as Fn,S as In,h as Ln,D as us,M as at}from"./Modal-C2sFA0zf.js";import{S as be,u as $n,a as Vn,b as Wn,c as ht}from"./useProjectData-C1hVamxc.js";import{i as hs,R as ms,s as Mn,G as Un,a as qn,O as zn,T as Bn}from"./OverviewWrapper-BveJ6GjK.js";import{e as Kn,f as Gn,g as Hn,i as xs,h as js,j as Qn,k as Yn,l as Jn,m as Xn,n as Zn,o as er,p as tr}from"./useRundown-BfpjcCEJ.js";import{S as ne}from"./Select-CedN80WS.js";import{u as it,p as sr,e as nr,d as rr}from"./useCustomFields-DqCYz8Kt.js";import{u as ar,d as ir}from"./useReport-B4dMYcNL.js";import{T as yt,u as ps,e as ze}from"./editorSettings-BU0pTMSY.js";import{S as lr,L as or,T as cr}from"./EditorUtils-Da5ALK1P.js";import{T as gs}from"./Tooltip-D9XRnwOW.js";import{A as fs,T as Be}from"./TimeInput-Dg1naiy3.js";import{T as Wt,E as mt}from"./validateEvent-P9sf7C10.js";import{p as Ke}from"./parseUserTime-BeTKj08M.js";import{S as dr,P as ur,O as hr,M as mr,C as xr}from"./TimeElements-CALNfv6u.js";import{s as xt}from"./Editor.module-DvV2efYs.js";import"./offset-DJAHqjFW.js";import"./playbackstate-B_khF6xU.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof St<"u"?St:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f1393d16-b64c-4844-a352-d91476718e0b",t._sentryDebugIdIdentifier="sentry-dbid-f1393d16-b64c-4844-a352-d91476718e0b")}catch{}})();function jr(t){return t.trim().replaceAll(" ","_")}const pr={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"},gr=(t,s,n={})=>{const{isDisabled:r=!1}=n,a=j.useCallback(l=>{l.key===s&&!l.repeat&&!r&&(l.preventDefault(),t())},[t,r,s]);j.useEffect(()=>(document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}),[a])},fr="_link_70oau_17",vr="_inline_70oau_27",Mt={link:fr,inline:vr};function se({href:t,inline:s,children:n}){const r=a=>{a.preventDefault(),Dt(t)};return e.jsxs("a",{href:"#!",target:"_blank",rel:"noreferrer",className:ge([Mt.link,s&&Mt.inline]),onClick:r,children:[n," ",e.jsx(Xt,{style:{fontSize:"1em"}})]})}async function yr(){const t=await H.get(Hs);return{url:t.data.html_url,version:t.data.tag_name}}const Ut={url:"",version:"",hasUpdates:!1};function vs(){const{data:t,status:s,isFetching:n,isError:r,refetch:a}=Ct({queryKey:Js,queryFn:yr,placeholderData:(i,h)=>i,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,staleTime:Ys,enabled:et}),l=(t==null?void 0:t.version)&&!t.version.includes(Qs);return{data:t?{...t,hasUpdates:l}:Ut,placeholder:Ut,status:s,isFetching:n,isError:r,refetch:a}}function br(){const{data:t,isError:s}=vs();return s?e.jsxs(_e,{children:[`You are currently using Ontime version ${Xe}`,e.jsx(N,{children:`Could not fetch version information: ${s}`})]}):t.hasUpdates?e.jsxs(_e,{children:[`You are currently using Ontime version ${Xe}.`,e.jsx("br",{}),e.jsx("br",{}),`A new version ${t.version} is available.`," ",e.jsx("br",{}),Ie?"You can restart your stage to get the latest available version.":e.jsx(se,{href:t.url,children:"Please visit the release page to download"})]}):e.jsx(_e,{children:`You are currently using the latest version of Ontime: ${Xe}`})}function wr(){return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"About Ontime"}),e.jsxs(R,{children:[e.jsxs(ee,{children:[e.jsx(Q,{children:"Ontime"}),e.jsxs(_e,{children:["Free, open-source software for managing rundowns and event timers",e.jsx(se,{href:ft,children:"www.getontime.no"})]}),e.jsxs(_e,{children:["Considering sponsoring our work",e.jsx(se,{href:Xs,children:"GitHub Sponsors"}),e.jsx(se,{href:Zs,children:"Buy Me a Coffee"})]}),e.jsxs(_e,{children:["If you are looking for an online version of Ontime, consider trying out our cloud service",e.jsx(se,{href:ft,children:"www.getontime.no"})]})]}),e.jsx(Q,{children:"Current version"}),e.jsx(br,{}),e.jsx(Q,{children:"Links"}),e.jsx(se,{href:Nt,children:"Read the docs"}),e.jsx(se,{href:en,children:"Follow the project on GitHub"}),e.jsx(se,{href:ns,children:"Discord server"})]})]})}function ae(t,s){const n=j.useRef(null);return j.useEffect(()=>{s&&n.current&&s===t&&n.current.scrollIntoView({behavior:"smooth",block:"center"})},[s,t]),n}const Sr="https://docs.getontime.no/api/protocols/osc/";function Cr({enabledAutomations:t,enabledOscIn:s,oscPortIn:n}){var w,y,b;const{handleSubmit:r,reset:a,register:l,setError:c,watch:i,setValue:h,formState:{errors:o,isSubmitting:d,isDirty:m,isValid:u}}=ce({mode:"onChange",defaultValues:{enabledAutomations:t,enabledOscIn:s,oscPortIn:n},resetOptions:{keepDirtyValues:!1}}),g=async v=>{try{await Pn(v),a(v)}catch(O){const _=V(O);c("root",{message:_})}},x=()=>{a({enabledAutomations:t,enabledOscIn:s,oscPortIn:n})},p=!d&&m&&u;return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Automation settings",e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",onClick:x,disabled:!p,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",form:"automation-settings-form",disabled:!p,loading:d,children:"Save"})]})]}),(o==null?void 0:o.root)&&e.jsx(N,{children:o.root.message}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{children:[e.jsx("p",{children:"Control Ontime and share its data with external systems in your workflow."}),e.jsx("p",{children:"- Automations allow Ontime to send its data on lifecycle triggers."}),e.jsx("p",{children:"- OSC Input tells Ontime to listen to messages on the specific port."}),e.jsx("br",{}),e.jsx(se,{href:Sr,children:"See the docs"})]})}),e.jsxs(R,{as:"form",id:"automation-settings-form",onSubmit:r(g),onKeyDown:v=>we(v,x),children:[e.jsx(Ae,{isLoading:!1}),e.jsx(fe,{children:"Automation"}),e.jsx(oe,{children:e.jsxs(M,{children:[e.jsx(U,{title:"Enable automations",description:"Allow Ontime to send messages on lifecycle triggers",error:(w=o.enabledAutomations)==null?void 0:w.message}),e.jsx(be,{size:"large",checked:i("enabledAutomations"),onCheckedChange:v=>h("enabledAutomations",v,{shouldDirty:!0,shouldValidate:!0})})]})}),e.jsx(fe,{children:"OSC Input"}),e.jsxs(oe,{children:[Ie&&e.jsx(je,{children:"For security reasons OSC integrations are not available in the cloud service."}),e.jsxs(M,{children:[e.jsx(U,{title:"OSC input",description:"Allow control of Ontime through OSC",error:(y=o.enabledOscIn)==null?void 0:y.message}),e.jsx(be,{size:"large",checked:i("enabledOscIn"),onCheckedChange:v=>h("enabledOscIn",v,{shouldDirty:!0,shouldValidate:!0})})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Listen on port",description:"Port for incoming OSC. Default: 8888",error:(b=o.oscPortIn)==null?void 0:b.message}),e.jsx($,{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:hs,message:"Value should be numeric"}})})]})]})]})]})}const _r=["{{human.clock}}","{{human.duration}}","{{human.expectedEnd}}","{{human.runningTimer}}","{{human.elapsedTime}}","{{human.startedAt}}"],kr=["{{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}}"],Dr=["{{eventNow.id}}","{{eventNow.cue}}","{{eventNow.title}}","{{eventNow.note}}","{{eventNow.timeStart}}","{{eventNow.timeEnd}}","{{eventNow.duration}}","{{eventNow.colour}}","{{eventNow.delay}}"],Nr=["{{eventNext.id}}","{{eventNext.cue}}","{{eventNext.title}}","{{eventNext.note}}","{{eventNext.timeStart}}","{{eventNext.timeEnd}}","{{eventNext.duration}}","{{eventNext.colour}}","{{eventNext.delay}}"];function Pr(t){return[..._r,...kr,...Dr,...Object.entries(t).map(([s])=>`{{eventNow.custom.${s}}}`),...Nr,...Object.entries(t).map(([s])=>`{{eventNext.custom.${s}}}`)]}function Er(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 r=s.substring(0,n+1);if(t.endsWith(r))return s.substring(n+1)}return""}function Rr(t){const s=t.lastIndexOf("{{");return s!==-1?t.slice(s):""}const Or="_wrapper_11839_17",Tr="_suggestions_11839_21",qt={wrapper:Or,suggestions:Tr},Ar=j.forwardRef(function(s,n){const{value:r,onChange:a,...l}=s,{data:c}=it(),i=Es(()=>x(!1)),h=j.useMemo(()=>Pr(c),[c]),[o,d]=j.useState(r||""),[m,u]=j.useState([]),[g,x]=j.useState(!1),p=b=>{const v=Rr(b);return h.filter(O=>O.startsWith(v))},w=b=>{d(b.target.value),b.target.value.endsWith("{")?(x(!0),u(p(b.target.value))):b.target.value===""||b.target.value.endsWith("}}")?x(!1):g&&u(p(b.target.value)),a==null||a(b)},y=b=>{d(v=>{const O=Er(v,b);return v+O}),x(!1)};return e.jsxs("div",{className:qt.wrapper,ref:Rs(i,n),children:[e.jsx($,{value:o,...l,onChange:w,fluid:!0}),g&&m.length>0&&e.jsx("ul",{className:qt.suggestions,children:m.map(b=>e.jsx("li",{onClick:()=>y(b),children:b},b))})]})}),bt=[{id:1,label:"On Load",value:"onLoad"},{id:2,label:"On Start",value:"onStart"},{id:3,label:"On Pause",value:"onPause"},{id:4,label:"On Stop",value:"onStop"},{id:5,label:"Every second",value:"onClock"},{id:6,label:"On Timer Update",value:"onUpdate"},{id:7,label:"On Finish",value:"onFinish"},{id:8,label:"On Warning",value:"onWarning"},{id:9,label:"On Danger",value:"onDanger"}];function zt(t){return Object.hasOwn(t,"id")}const Fr=[{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"}],Ir=[{value:"eventNext.id",label:"Next ID"},{value:"eventNext.title",label:"Next Title"},{value:"eventNext.cue",label:"Next Cue"}];function Lr(t){return[...Fr,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNow.custom.${s}`,label:`Custom: ${n}`})),...Ir,...Object.entries(t).map(([s,{label:n}])=>({value:`eventNext.custom.${s}`,label:`Next custom: ${n}`}))]}function $r(t){const s={},n=[];for(let r=0;r<t.length;r++){const a=t[r];Object.hasOwn(s,a.trigger)||(s[a.trigger]=[]),s[a.trigger].includes(a.automationId)?n.push(r):s[a.trigger].push(a.automationId)}return n.length>0?n:void 0}const Vr="_outerColumn_dem8v_17",Wr="_innerColumn_dem8v_25",Mr="_ruleSection_dem8v_31",Ur="_titleSection_dem8v_37",qr="_filterSection_dem8v_38",zr="_oscSection_dem8v_39",Br="_httpSection_dem8v_40",Kr="_actionSection_dem8v_41",Gr="_test_dem8v_95",Hr="_outputCard_dem8v_99",le={outerColumn:Vr,innerColumn:Wr,ruleSection:Mr,titleSection:Ur,filterSection:qr,oscSection:zr,httpSection:Br,actionSection:Kr,test:Gr,outputCard:Hr};function Qr({index:t,register:s,setValue:n,rowErrors:r,value:a,children:l,watch:c}){var d,m,u,g,x;const[i,h]=j.useState(a),o=p=>{n(`outputs.${t}.action`,p,{shouldDirty:!0}),h(p)};return e.jsxs("div",{className:le.actionSection,children:[e.jsxs("label",{children:["Action",e.jsx(ne,{onValueChange:p=>{o(p)},value:c(`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:(d=r==null?void 0:r.action)==null?void 0:d.message})]}),i.startsWith("aux")&&i.endsWith("set")&&e.jsxs("label",{children:["New time",e.jsx($,{...s(`outputs.${t}.time`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"eg: 10m5s"}),e.jsx(N,{children:(m=r==null?void 0:r.time)==null?void 0:m.message})]}),i==="message-set"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Text (leave empty for no change)",e.jsx($,{...s(`outputs.${t}.text`),fluid:!0,placeholder:"eg: Timer is finished"}),e.jsx(N,{children:(u=r==null?void 0:r.text)==null?void 0:u.message})]}),e.jsxs("label",{children:["Visibility",e.jsx(ne,{onValueChange:p=>{const w=p==="untouched"?void 0:p;n(`outputs.${t}.visible`,w,{shouldDirty:!0})},value:c(`outputs.${t}.visible`)===void 0?"untouched":c(`outputs.${t}.visible`),options:[{value:"untouched",label:"Untouched"},{value:!0,label:"Show"},{value:!1,label:"Hide"}]}),e.jsx(N,{children:(g=r==null?void 0:r.visible)==null?void 0:g.message})]})]}),i==="message-secondary"&&e.jsxs("label",{children:["Timer secondary source",e.jsx(ne,{onValueChange:p=>{n(`outputs.${t}.secondarySource`,p,{shouldDirty:!0})},value:c(`outputs.${t}.secondarySource`),options:[{value:null,label:"Select secondary source",disabled:!0},{value:"aux1",label:"Auxiliary timer 1"},{value:"aux2",label:"Auxiliary timer 2"},{value:"aux3",label:"Auxiliary timer 3"},{value:"external",label:"External"},{value:"null",label:"None"}]}),e.jsx(N,{children:(x=r==null?void 0:r.secondarySource)==null?void 0:x.message})]}),e.jsx("div",{className:le.test,children:l})]})}const Yr="https://docs.getontime.no/api/automation/#using-variables-in-automation";function Jr({automation:t,onClose:s}){var K;const n=zt(t),{data:r}=it(),{refetch:a}=rt(),l=j.useMemo(()=>Lr(r),[r]),{control:c,handleSubmit:i,getValues:h,register:o,setError:d,setFocus:m,setValue:u,watch:g,formState:{errors:x,isSubmitting:p,isDirty:w,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:b,append:v,remove:O}=Ze({name:"filters",control:c}),{fields:_,append:P,remove:T}=Ze({name:"outputs",control:c});j.useEffect(()=>{m("title")},[m]);const S=()=>{v({field:"",operator:"equals",value:""})},q=()=>{P({type:"osc",targetIP:"",targetPort:void 0,address:"",args:""})},z=()=>{P({type:"http",url:""})},de=()=>{P({type:"ontime",action:"aux1-start"})},Y=async I=>{try{const C=h(`outputs.${I}`);if(!C.targetIP||!C.targetPort||!C.address)return;await ut({type:"osc",targetIP:C.targetIP,targetPort:C.targetPort,address:C.address,args:C.args})}catch{}},L=async I=>{try{const C=h(`outputs.${I}`);if(!C.url)return;await ut({type:"http",url:C.url})}catch{}},E=async I=>{try{const C=h(`outputs.${I}`);await ut({...C,type:"ontime"})}catch{}},F=async I=>{zt(t)?await C(t.id,{id:t.id,...I}):await k(I),a();async function C(W,te){try{await En(W,te),s()}catch(ue){d("root",{message:V(ue)})}}async function k(W){try{await Rn(W),s()}catch(te){d("root",{message:V(te)})}}},D=!p&&w&&y;return e.jsxs($e,{as:"form",name:"automation-form",onSubmit:i(F),className:le.outerColumn,onKeyDown:I=>we(I,s),children:[e.jsx(Q,{children:n?"Edit automation":"Create automation"}),e.jsxs("div",{className:le.innerSection,children:[e.jsx("h3",{children:"Automation options"}),e.jsxs("div",{className:le.titleSection,children:[e.jsxs("label",{children:["Title",e.jsx($,{...o("title",{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"Load preset"})]}),e.jsx(N,{children:(K=x.title)==null?void 0:K.message})]})]}),e.jsxs("div",{className:le.innerSection,children:[e.jsx("h3",{children:"Filters (optional)"}),e.jsxs("div",{className:le.ruleSection,children:[e.jsxs("label",{children:["Trigger outputs if",e.jsx(ms,{orientation:"horizontal",value:g("filterRule"),onValueChange:I=>u("filterRule",I,{shouldDirty:!0}),items:[{value:"all",label:"All filters pass"},{value:"any",label:"Any filter passes"}]})]}),b.map((I,C)=>{var W,te,ue,Re,We,Me;const k=`filters.${C}.field.${I.id}`;return e.jsxs("div",{className:le.filterSection,children:[e.jsxs("label",{children:["Runtime data source",e.jsx(ne,{value:g(`filters.${C}.field`),onValueChange:ke=>u(`filters.${C}.field`,ke,{shouldDirty:!0}),options:l.map(({value:ke,label:J})=>({value:ke,label:J})),"aria-label":"Event field"}),e.jsx(N,{children:(ue=(te=(W=x.filters)==null?void 0:W[C])==null?void 0:te.field)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Matching condition",e.jsx(ne,{value:g(`filters.${C}.operator`),onValueChange:ke=>u(`filters.${C}.operator`,ke,{shouldDirty:!0}),options:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"},{value:"contains",label:"contains"}],"aria-label":"Operator"}),e.jsx(N,{children:(Me=(We=(Re=x.filters)==null?void 0:Re[C])==null?void 0:We.operator)==null?void 0:Me.message})]}),e.jsxs("label",{children:["Value to match",e.jsx($,{...o(`filters.${C}.value`),fluid:!0,placeholder:"<empty / no value>"})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsx("div",{children:e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>O(C),children:e.jsx(he,{})})})]})]},k)}),e.jsx("div",{children:e.jsxs(f,{type:"submit",onClick:S,children:["Add filter ",e.jsx(me,{})]})})]})]}),e.jsxs("div",{className:le.innerColumn,children:[e.jsx("h3",{children:"Outputs"}),e.jsxs(je,{children:["Automation outputs can be used to send data from Ontime to external software.",e.jsx(se,{href:Yr,children:"See the documentation for templates"})]}),_.map((I,C)=>{var k,W,te,ue,Re,We,Me,ke;if(Kn(I)){const J=(k=x.outputs)==null?void 0:k[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"OSC"}),e.jsxs("div",{className:le.oscSection,children:[e.jsxs("label",{children:["Target IP",e.jsx($,{...o(`outputs.${C}.targetIP`,{required:{value:!0,message:"Required field"}}),fluid:!0,placeholder:"127.0.0.1"}),e.jsx(N,{children:(W=J==null?void 0:J.targetIP)==null?void 0:W.message})]}),e.jsxs("label",{children:["Target Port",e.jsx($,{...o(`outputs.${C}.targetPort`,{required:{value:!0,message:"Required field"},setValueAs:Tt=>Tt===""?0:Number(Tt),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:(te=J==null?void 0:J.targetPort)==null?void 0:te.message})]}),e.jsxs("label",{children:["Address",e.jsx($,{...o(`outputs.${C}.address`),fluid:!0,placeholder:"/cue/start"}),e.jsx(N,{children:(ue=J==null?void 0:J.address)==null?void 0:ue.message})]}),e.jsxs("label",{children:["Arguments",e.jsx(Ar,{...o(`outputs.${C}.args`),value:I.args,placeholder:"1"}),e.jsx(N,{children:(Re=J==null?void 0:J.args)==null?void 0:Re.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>Y(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]})]},I.id)}if(Gn(I)){const J=(We=x.outputs)==null?void 0:We[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"HTTP"}),e.jsxs("div",{className:le.httpSection,children:[e.jsxs("label",{children:["Target URL",e.jsx($,{...o(`outputs.${C}.url`,{required:{value:!0,message:"Required field"},pattern:{value:Mn,message:"HTTP messages should target http:// or https://"}}),fluid:!0,placeholder:"http://127.0.0.1/start/1"}),e.jsx(N,{children:(Me=J==null?void 0:J.url)==null?void 0:Me.message})]}),e.jsxs("div",{children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>L(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]})]},I.id)}if(Hn(I)){const J=(ke=x.outputs)==null?void 0:ke[C];return e.jsxs("div",{className:le.outputCard,children:[e.jsx(B,{children:"Ontime action"}),e.jsxs(Qr,{value:I.action,index:C,register:o,rowErrors:J,setValue:u,watch:g,children:[e.jsx("span",{children:" "}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{variant:"ghosted-white",onClick:()=>E(C),children:"Test"}),e.jsx(Z,{"aria-label":"Delete",variant:"ghosted-destructive",onClick:()=>T(C),children:e.jsx(he,{})})]})]})]},I.id)}return null}),e.jsxs(A,{relation:"inner",children:[e.jsxs(f,{onClick:q,children:["OSC ",e.jsx(me,{})]}),e.jsxs(f,{onClick:z,children:["HTTP ",e.jsx(me,{})]}),e.jsxs(f,{onClick:de,children:["Ontime action ",e.jsx(me,{})]})]})]}),e.jsxs(A,{align:"end",children:[(x==null?void 0:x.root)&&e.jsx(N,{children:x.root.message}),e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!D,loading:p,children:"Save"})]})]})}const Bt={title:"",filterRule:"all",filters:[],outputs:[]};function Xr(t){const{automations:s}=t,{refetch:n}=rt(),[r,a]=j.useState(null),[l,c]=j.useState(null),i=async o=>{try{c(null),await On(o)}catch(d){c(V(d))}finally{n()}},h=Object.keys(s);return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage automations",e.jsxs(f,{type:"submit",disabled:!!r,onClick:()=>a(Bt),children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),r!==null&&e.jsx(Jr,{automation:r,onClose:()=>a(null)}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"45%"},children:"Title"}),e.jsx("th",{style:{width:"15%"},children:"Trigger rule"}),e.jsx("th",{style:{width:"15%"},children:"Filters"}),e.jsx("th",{style:{width:"15%"},children:"Outputs"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[h.length===0&&e.jsx(nt,{handleClick:r?void 0:()=>a(Bt)}),h.map(o=>Object.hasOwn(s,o)?e.jsx(j.Fragment,{children:e.jsxs("tr",{children:[e.jsx("td",{children:s[o].title}),e.jsx("td",{children:e.jsx(B,{children:s[o].filterRule})}),e.jsx("td",{children:s[o].filters.length}),e.jsx("td",{children:s[o].outputs.length}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>a(s[o]),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>i(o),children:e.jsx(he,{})})]})]})},o):null),l&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(N,{children:l})})})]})]})]})}function ys({automations:t,initialId:s,initialTitle:n,initialAutomationId:r,initialTrigger:a,onCancel:l,postSubmit:c}){var O,_,P,T;const{handleSubmit:i,register:h,setFocus:o,setError:d,watch:m,setValue:u,formState:{errors:g,isSubmitting:x,isValid:p,isDirty:w}}=ce({defaultValues:{title:n,trigger:a??bt[0].value,automationId:r??((O=t==null?void 0:t[Object.keys(t)[0]])==null?void 0:O.id)},resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{o("title")},[o]);const y=async S=>{if(s){try{await Tn(s,{id:s,...S}),c()}catch(q){d("root",{message:`Failed to save changes to trigger ${V(q)}`})}return}try{await An(S),c()}catch(q){d("root",{message:`Failed to save trigger ${V(q)}`})}},b=Object.keys(t).map(S=>({value:S,label:t[S].title})),v=w&&p;return e.jsxs($e,{as:"form",name:"trigger-form",onSubmit:i(y),onKeyDown:S=>we(S,l),children:[e.jsx(Q,{children:s?"Edit trigger":"Create trigger"}),e.jsxs("label",{children:["Title",e.jsx($,{...h("title",{required:{value:!0,message:"Required field"}}),fluid:!0,defaultValue:n}),e.jsx(N,{children:(_=g.title)==null?void 0:_.message})]}),e.jsxs("label",{children:["Lifecycle trigger",e.jsx(ne,{value:m("trigger"),onValueChange:S=>u("trigger",S,{shouldDirty:!0}),options:bt.map(S=>({value:S.value,label:S.label})),"aria-label":"Lifecycle trigger"}),e.jsx(N,{children:(P=g.trigger)==null?void 0:P.message})]}),e.jsxs("label",{children:["Automation title",e.jsx(ne,{value:m("automationId"),onValueChange:S=>u("automationId",S,{shouldDirty:!0}),options:b,"aria-label":"Automation title"}),e.jsx(N,{children:(T=g.automationId)==null?void 0:T.message})]}),e.jsxs(A,{align:"end",children:[e.jsx(f,{disabled:x,onClick:l,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!v,loading:x,children:"Save"})]})]})}function Zr(t){var m,u;const{automations:s,id:n,title:r,trigger:a,automationId:l,duplicate:c,handleDelete:i,postSubmit:h}=t,[o,d]=j.useState(!1);return o?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(ys,{automations:s,initialId:n,initialTitle:r,initialTrigger:a,initialAutomationId:l,onCancel:()=>d(!1),postSubmit:()=>{d(!1),h()}})})}):e.jsxs("tr",{"data-warn":c,children:[e.jsxs(A,{as:"td",relation:"inner",children:[c&&e.jsx(Os,{color:"#FFBC56"}),r]}),e.jsx("td",{children:e.jsx(B,{children:(m=bt.find(g=>g.value===a))==null?void 0:m.label})}),e.jsx("td",{children:e.jsx(B,{children:(u=s==null?void 0:s[l])==null?void 0:u.title})}),e.jsxs(A,{align:"end",relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>d(!0),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:i,children:e.jsx(he,{})})]})]})}function ea(t){const{triggers:s,automations:n}=t,[r,a]=j.useState(!1),{refetch:l}=rt(),[c,i]=j.useState(null),h=async u=>{try{await Fn(u)}catch(g){i(V(g))}finally{l()}},o=()=>{a(!1),l()},d=j.useMemo(()=>$r(s),[s]),m=Object.keys(n).length>0;return e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage triggers",e.jsxs(f,{type:"submit",form:"trigger-form",disabled:!m,loading:!1,onClick:()=>a(!0),children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[d&&e.jsx(N,{children:"You have created multiple links between the same trigger and automation which can performance issues."}),r&&e.jsx(ys,{automations:n,onCancel:()=>a(!1),postSubmit:o}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"35%"},children:"Title"}),e.jsx("th",{style:{width:"25%"},children:"Lifecycle trigger"}),e.jsx("th",{style:{width:"25%"},children:"Automation"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[!r&&s.length===0&&e.jsx(nt,{label:"Create an automation to attach triggers to",handleClick:m?()=>a(!0):void 0}),s.map((u,g)=>e.jsxs(j.Fragment,{children:[e.jsx(Zr,{automations:n,id:u.id,title:u.title,trigger:u.trigger,automationId:u.automationId,duplicate:d==null?void 0:d.includes(g),handleDelete:()=>h(u.id),postSubmit:o}),c&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx(N,{children:c})})})]},u.id))]})]})]})]})}function ta({location:t}){const{data:s,status:n}=rt(),r=ae("settings",t),a=ae("triggers",t),l=ae("automations",t),c=n==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Automation"}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:c}),e.jsx("div",{ref:r,children:e.jsx(Cr,{enabledAutomations:s.enabledAutomations,enabledOscIn:s.enabledOscIn,oscPortIn:s.oscPortIn})}),e.jsx("div",{ref:l,children:e.jsx(Xr,{automations:s.automations})}),e.jsx("div",{ref:a,children:e.jsx(ea,{triggers:s.triggers,automations:s.automations})})]})]})}const sa="_goIcon_1fzu7_17",na={goIcon:sa};function ra(){const{data:t}=tn(),s=n=>Dt(n);return e.jsx(A,{children:t.networkInterfaces.map(n=>{if(n.name==="localhost"&&!et)return null;const r=sn(n.address);return e.jsxs(Pt,{copyValue:r,onClick:()=>s(r),children:[`${n.name} - ${n.address}`," ",e.jsx(Zt,{className:na.goIcon})]},n.name)})})}function aa(t){return Ts(t)}function ia(t,s,n){if(Object.keys(t).length===0)return[];if(n.length===0)return[];const r=[];let a=1;for(let l=0;l<n.length;l++){const c=n[l],i=s[c];!i||!xs(i)||(c in t||r.push({id:c,index:a,title:i.title,cue:i.cue,scheduledStart:i.timeStart,actualEnd:null,scheduledEnd:i.timeEnd,actualStart:null}),c in t&&r.push({id:c,index:a,title:i.title,cue:i.cue,scheduledStart:i.timeStart,actualEnd:t[c].endedAt,scheduledEnd:i.timeEnd,actualStart:t[c].startedAt}),a++)}return r}const la=["Index","Title","Cue","Scheduled Start","Actual Start","Scheduled End","Actual End"];function oa(t){const s=[];s.push(la);for(const n of t)s.push([String(n.index),n.title,n.cue,Ne(n.scheduledStart),Ne(n.actualStart),Ne(n.scheduledEnd),Ne(n.actualEnd)]);return aa(s)}const ca="_blink_15peo_1",da="_fourtyfive_15peo_13",ua="_over_15peo_17",ha="_under_15peo_21",Ye={blink:ca,fourtyfive:da,over:ua,under:ha};function ma(){const{data:t}=ar(),{data:s}=js(),n=async()=>await ir(),r=l=>{if(!l)return;const c=oa(l),i=rs(c,"text/csv;charset=utf-8;");Et(i,"ontime-report.csv")},a=j.useMemo(()=>ia(t,s.entries,s.flatOrder),[t,s.entries,s.flatOrder]);return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Report"}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(fe,{children:["Manage report",e.jsxs(A,{children:[e.jsxs(f,{onClick:()=>r(a),disabled:a.length===0,children:[e.jsx(At,{}),"Export CSV"]}),e.jsxs(f,{variant:"subtle-destructive",onClick:n,disabled:a.length===0,children:[e.jsx(At,{}),"Clear All"]})]})]})}),e.jsx(R,{children:e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"#"}),e.jsx("th",{children:"Cue"}),e.jsx("th",{children:"Title"}),e.jsx("th",{children:"Scheduled Start"}),e.jsx("th",{children:"Actual Start"}),e.jsx("th",{children:"Scheduled End"}),e.jsx("th",{children:"Actual End"})]})}),e.jsxs("tbody",{children:[a.length===0&&e.jsx(nt,{label:"Reports are generated when running through the show."}),a.map(l=>{const c=l.actualStart===null?null:l.actualStart<=l.scheduledStart?"under":"over",i=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:ge([c&&Ye[c]]),children:Ne(l.scheduledStart)}),e.jsx("th",{className:ge([c&&Ye[c]]),children:Ne(l.actualStart)}),e.jsx("th",{className:ge([i&&Ye[i]]),children:Ne(l.scheduledEnd)}),e.jsx("th",{className:ge([i&&Ye[i]]),children:Ne(l.actualEnd)})]},l.id)})]})]})})]})})}const xa="_expand_1sy0c_17",ja="_column_1sy0c_21",Kt={expand:xa,column:ja},pa=[{value:Se.Cuesheet,label:"Cuesheet"},{value:Se.Operator,label:"Operator"},{value:Se.Timer,label:"Timer"},{value:Se.Backstage,label:"Backstage"},{value:Se.Timeline,label:"Timeline"},{value:Se.StudioClock,label:"Studio Clock"},{value:Se.Countdown,label:"Countdown"},{value:Se.ProjectInfo,label:"Project Info"}],ga={alias:"",target:Se.Timer,search:"",enabled:!0};function fa({urlPreset:t,onClose:s}){var _,P;const{addPreset:n,updatePreset:r,isMutating:a}=as(),{handleSubmit:l,register:c,setFocus:i,setError:h,clearErrors:o,setValue:d,getValues:m,watch:u,formState:{errors:g,isSubmitting:x,isValid:p,isDirty:w}}=ce({defaultValues:t??ga,resetOptions:{keepDirtyValues:!0}}),y=j.useRef(null),b=async T=>{try{t?await r(t.alias,T):await n(T),s()}catch(S){h("root",{message:V(S)})}};j.useEffect(()=>{i("alias")},[i]);const v=()=>{var T;o();try{const S=nn(m("alias"),((T=y.current)==null?void 0:T.value.trim())??"");d("target",S.target,{shouldDirty:!0,shouldValidate:!0}),d("search",S.search,{shouldDirty:!0,shouldValidate:!0})}catch(S){h("root",{message:It(S)});return}},O=T=>{try{return new URLSearchParams(T),!0}catch(S){return It(S)||"Invalid URL parameters"}};return e.jsxs($e,{as:"form",onSubmit:l(b),onKeyDown:T=>we(T,s),className:Kt.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(re,{children:"Alias"}),e.jsx($,{...c("alias",{required:"Alias is required"})})]}),e.jsxs("div",{className:Kt.expand,children:[e.jsx(re,{children:"Generate options (paste URL to generate options)"}),e.jsxs(A,{children:[e.jsx($,{placeholder:"Paste URL",fluid:!0,ref:y}),e.jsx(f,{onClick:v,children:"Generate"})]})]})]}),e.jsx("div",{children:" - or -"}),e.jsx("div",{children:"2. Choose a view and its parameters"}),e.jsxs("div",{children:[e.jsx(re,{children:"Target"}),e.jsx(ne,{options:pa,...c("target",{required:"Target is required"}),value:u("target"),onValueChange:T=>d("target",T,{shouldDirty:!0})})]}),e.jsxs("div",{children:[e.jsx(re,{children:"Parameters"}),e.jsx(yt,{fluid:!0,rows:3,...c("search",{validate:O})}),e.jsx(N,{children:(_=g.search)==null?void 0:_.message})]}),e.jsxs("div",{children:[e.jsx(N,{children:(P=g.root)==null?void 0:P.message}),e.jsxs(A,{align:"end",children:[e.jsx(f,{onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!p||!w,loading:x||a,children:"Save"})]})]})]})}const va="https://docs.getontime.no/features/url-presets/";function ya(){const[t,s]=j.useState({isOpen:!1,preset:void 0}),{data:n,status:r}=is(),{deletePreset:a,isMutating:l}=as(),c=()=>s({isOpen:!0}),i=o=>s({isOpen:!0,preset:o}),h=()=>s({isOpen:!1,preset:void 0});return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["URL presets",e.jsxs(f,{onClick:c,children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{children:["URL presets are user pre-defined aliases to Ontime URLs.",e.jsx("br",{}),"This URL can contain full configuration including parameters, or simply route to a specific view.",e.jsx("br",{}),e.jsx("br",{}),"The easiest way to get started is to copy an URL from your browser and paste it into the form.",e.jsx(se,{href:va,children:"See the docs"})]})}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:r==="pending"}),t.isOpen&&e.jsx(fa,{urlPreset:t.preset,onClose:h}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Enabled"}),e.jsx("th",{children:"Target view"}),e.jsx("th",{children:"Alias"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[n.length===0&&e.jsx(nt,{handleClick:c}),n.map((o,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(be,{defaultChecked:o.enabled,onCheckedChange:()=>{}})}),e.jsx("td",{children:e.jsx(B,{children:o.target})}),e.jsx("td",{style:{width:"100%"},children:o.alias}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white",onClick:m=>ls(o.alias,m),disabled:l,children:e.jsx(Xt,{})}),e.jsx(Z,{onClick:()=>i(o),variant:"ghosted-white","aria-label":"Edit entry","data-testid":`field__edit_${d}`,disabled:l,children:e.jsx(st,{})}),e.jsx(Z,{onClick:()=>a(o.alias),variant:"ghosted-destructive","aria-label":"Delete entry","data-testid":`field__delete_${d}`,disabled:l,children:e.jsx(he,{})})]})]},o.alias))]})]})]})]})})}function ba({location:t}){const s=ae("presets",t),n=ae("link",t),r=ae("report",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Sharing and reporting"}),e.jsx("div",{ref:s,children:e.jsx(ya,{})}),e.jsx("div",{ref:n,children:e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Share Ontime Link"}),!Ie&&e.jsxs(e.Fragment,{children:[e.jsx(_e,{children:"Ontime is streaming on the following network interfaces"}),e.jsx(ra,{})]}),e.jsx(ie,{}),e.jsx(Un,{})]})})}),e.jsx("div",{ref:r,children:e.jsx(ma,{})})]})}const lt=`${Rt}/excel`;async function wa(t){const s=new FormData;s.append("excel",t),await H.post(`${lt}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})}async function Sa(){return(await H.get(`${lt}/worksheets`)).data}async function Ca(t){return(await H.post(`${lt}/preview`,{options:t})).data}async function _a(t,s){try{const n=await H.get(`${lt}/${t}/export`,{responseType:"blob"});Et(n.data,`${s??"Ontime_rundown"}.xlsx`)}catch(n){console.error("Error downloading file:",n)}}const Ve=`${Rt}/sheets`,ka=async()=>(await H.get(`${Ve}/connect`)).data,Da=async(t,s)=>{const n=new FormData;return n.append("client_secret",t),(await H.post(`${Ve}/${s}/connect`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},Na=async()=>(await H.post(`${Ve}/revoke`)).data,Pa=async(t,s)=>(await H.post(`${Ve}/${t}/read`,{options:s})).data,bs=async t=>(await H.post(`${Ve}/${t}/worksheets`)).data,Ea=async(t,s)=>(await H.post(`${Ve}/${t}/write`,{options:s})).data;function Ra(t){if(!Oa(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 ws(t){if(!Ta(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 Oa(t){return t==null?void 0:t.name.endsWith(".xlsx")}function Ta(t){return t==null?void 0:t.name.endsWith(".json")}function Aa(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 ye=`${Rt}/db`;function Ss(t){return H.post(`${ye}/download`,{filename:t})}async function Fa(t){try{const{data:s,name:n}=await qa(t),r=JSON.stringify(s,null,2),a=rs(r,"application/json;charset=utf-8;");Et(a,`${n}.json`)}catch(s){console.error(s)}}async function Cs(t){const s=new FormData;return s.append("project",t),(await H.post(`${ye}/upload`,s,{headers:{"Content-Type":"multipart/form-data"}})).data}async function _s(t){return await H.patch(ye,t)}async function Ia(t){return(await H.post(`${ye}/new`,t)).data}async function La(t){return(await H.post(`${ye}/quick`,t)).data}async function $a(){return(await H.get(`${ye}/all`)).data}async function ks(t){return(await H.post(`${ye}/load`,{filename:t})).data}async function Va(){return(await H.post(`${ye}/demo`)).data}async function Wa(t,s){const n=`${ye}/${t}/duplicate`,r=decodeURIComponent(n);return(await H.post(r,{newFilename:s})).data}async function Ma(t,s){const n=`${ye}/${t}/rename`,r=decodeURIComponent(n);return(await H.put(r,{newFilename:s})).data}async function Ua(t){const s=`${ye}/${t}`,n=decodeURIComponent(s);return(await H.delete(n)).data}async function qa(t){const s=await Ss(t),n=s.headers["Content-Disposition"];let r=t;if(n!=null){const a=n.indexOf('"')+1,l=n.lastIndexOf('"');r=n.substring(a,l)}return{data:s.data,name:r}}const za={authenticate:{available:!1,error:""},sheetId:{available:!1,error:""},worksheet:{available:!1,error:""},pullPush:{available:!1,error:""}},Gt={stepData:za,worksheetNames:null,sheetId:null,authenticationStatus:"not_authenticated",rundown:null,customFields:null,spreadsheetImportMap:pr},G=As((t,s)=>({...Gt,patchStepData:n=>{const r=s().stepData;t({stepData:{...r,...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}),patchSpreadsheetImportMap:(n,r)=>{const a=s().spreadsheetImportMap;a[n]!==r&&(a[n]=r)},reset:()=>t(Gt),resetPreview:()=>t({rundown:null,customFields:null})}));function ot(){const t=_t(),s=G(d=>d.patchStepData),n=G(d=>d.setRundown),r=G(d=>d.setCustomFields);return{connect:async(d,m)=>{try{return await Da(d,m)}catch(u){s({authenticate:{available:!1,error:V(u)}})}},revoke:async()=>{try{return await Na()}catch(d){s({authenticate:{available:!1,error:V(d)}})}},verifyAuth:async()=>{try{return await ka()}catch(d){s({authenticate:{available:!1,error:V(d)}})}},importRundownPreview:async(d,m)=>{try{const u=await Pa(d,m);n(u.rundown),r(u.customFields)}catch(u){s({pullPush:{available:!0,error:V(u)}})}},importRundown:async(d,m)=>{try{await _s({rundowns:d,customFields:m}),await t.invalidateQueries({queryKey:[rn,an]})}catch(u){s({pullPush:{available:!0,error:V(u)}})}},exportRundown:async(d,m)=>{try{await Ea(d,m),s({pullPush:{available:!1,error:""}})}catch(u){s({pullPush:{available:!0,error:V(u)}})}}}}const wt={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 Ba(t){return typeof t!="object"||t===null?!1:Object.keys(wt).every(n=>Object.hasOwn(t,n))}function Ht(t){const s=t.custom.reduce((n,{ontimeName:r,importName:a})=>(r&&a&&(n[r.trim()]=a.trim()),n),{});return{worksheet:t.Worksheet,flag:t.Flag,timeStart:t.Start,linkStart:t["Link start"],timeEnd:t.End,duration:t.Duration,cue:t.Cue,title:t.Title,countToEnd:t["Count to end"],skip:t.Skip,note:t.Note,colour:t.Colour,endAction:t["End action"],timerType:t["Timer type"],timeWarning:t["Time warning"],timeDanger:t["Time danger"],custom:s,id:t.ID}}function Ka(t){localStorage.setItem("import-options",JSON.stringify(t))}function Ga(){const t=localStorage.getItem("import-options");if(!t)throw new Error("no import options found");return JSON.parse(t)}function Ha(){try{const t=Ga();return Ba(t)?t:wt}catch{return wt}}const Qa="_uploadSection_10owf_17",Ya="_finishSection_10owf_18",Ja="_error_10owf_40",Xa="_success_10owf_43",Za="_singleActionCell_10owf_47",Pe={uploadSection:Qa,finishSection:Ya,error:Ja,success:Xa,singleActionCell:Za};function ei({hasErrors:t,isSpreadsheet:s,onCancel:n,onSubmitExport:r,onSubmitImport:a}){const l=Ha(),{revoke:c}=ot(),{control:i,handleSubmit:h,register:o,setValue:d,watch:m,formState:{errors:u,isValid:g}}=ce({mode:"onChange",defaultValues:l,values:l}),{fields:x,append:p,remove:w}=Ze({control:i,name:"custom"}),y=G(E=>E.stepData),b=G(E=>E.worksheetNames),[v,O]=j.useState("");j.useEffect(()=>{!b||b.length===0||b.includes(l.Worksheet)||d("Worksheet",b[0],{shouldValidate:!0,shouldDirty:!0})},[b,d,l.Worksheet]);const _=async E=>{O("export");const F=Ht(E);await r(F),O("")},P=async()=>{await c(),n()},T=async E=>{O("import");const F=Ht(E);Ka(E),await a(F),O("")},S=E=>{w(E)},q=()=>{p({})},z=!!v,de=s&&!z,Y=!z&&!y.worksheet.error,L=!t&&g&&(de||Y);return e.jsxs(R,{as:"form",id:"import-map",children:[e.jsxs(fe,{children:["Import options",e.jsxs(A,{children:[!s&&e.jsx(gs,{text:"Revoke the google authentication",render:e.jsx(f,{}),onClick:P,disabled:z,children:"Revoke"}),e.jsx(f,{onClick:n,disabled:z,children:"Cancel"}),!s&&e.jsx(f,{variant:"primary",onClick:h(_),disabled:!Y,loading:v==="export",children:"Export"}),e.jsx(f,{variant:"primary",onClick:h(T),disabled:!L,loading:v==="import",children:"Import preview"})]})]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Ontime field"}),e.jsx("th",{children:"Column name in spreadsheet"}),e.jsx("th",{className:Pe.singleActionCell})]})}),e.jsxs("tbody",{children:[Object.entries(l).map(([E,F])=>E==="custom"?null:E==="Worksheet"?e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx(ne,{id:F,value:m(E),onValueChange:D=>d(E,D,{shouldDirty:!0}),options:(b==null?void 0:b.map(D=>({value:D,label:D})))||[]})}),e.jsx("td",{className:Pe.singleActionCell})]},F):e.jsxs("tr",{children:[e.jsx("td",{children:E}),e.jsx("td",{children:e.jsx($,{id:F,fluid:!0,maxLength:25,defaultValue:F,placeholder:"Use default column name",...o(E)})}),e.jsx("td",{className:Pe.singleActionCell})]},F)),x.map((E,F)=>{var k,W,te;const D=E.ontimeName,K=E.importName,I=(te=(W=(k=u.custom)==null?void 0:k[F])==null?void 0:W.ontimeName)==null?void 0:te.message,C=`custom.${F}.ontimeName`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx($,{maxLength:25,fluid:!0,defaultValue:D,placeholder:"Name of the field as shown in Ontime",...o(`custom.${F}.ontimeName`,{validate:ue=>os.isAlphanumericWithSpace(ue)?!0:"Only alphanumeric characters and space are allowed"})}),I&&e.jsx(N,{children:I})]}),e.jsx("td",{children:e.jsx($,{maxLength:25,fluid:!0,defaultValue:K,placeholder:"Name of the column in the spreadsheet",...o(`custom.${F}.importName`)})}),e.jsx("td",{className:Pe.singleActionCell,children:e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>S(F),children:e.jsx(he,{})})})]},C)}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx(A,{as:"td",align:"end",children:e.jsxs(f,{onClick:q,children:["Add custom field ",e.jsx(me,{})]})}),e.jsx("td",{})]})]})]}),e.jsx(N,{children:y.worksheet.error})]})}const ti="https://docs.getontime.no/features/import-spreadsheet-gsheet/";function si(){return e.jsxs(je,{children:["Ontime can import data from spreadsheets by: ",e.jsx("br",{}),"- importing the spreadsheet file in Ontime ",e.jsx("br",{}),"- synchronising your project with a Google Sheet",e.jsx("br",{}),e.jsx("br",{}),"To synchronise with a Google Sheet, you will need to allow Ontime to authenticate with your Google account.",e.jsx(se,{href:ti,children:"See the docs"})]})}function ni(t){const{onCancel:s}=t,{revoke:n,connect:r,verifyAuth:a}=ot(),[l,c]=j.useState(null),[i,h]=j.useState(null),[o,d]=j.useState(""),[m,u]=j.useState(""),g=G(D=>D.sheetId),x=G(D=>D.setSheetId),p=G(D=>D.setWorksheets),w=G(D=>D.patchStepData),y=G(D=>D.authenticationStatus),b=G(D=>D.setAuthenticationStatus),v=G(D=>D.stepData.authenticate.error),O=async()=>{const D=await a();D&&b(D.authenticated)};j.useEffect(()=>{w({authenticate:{available:!1,error:""}}),q()},[]);const _=async()=>{d("cancel"),await n(),await O(),d("")},P=()=>{s()},T=D=>{var K;(K=D.target.files)!=null&&K.length&&c(D.target.files[0])},S=async()=>{if(!l||!g)return;w({worksheet:{available:!1,error:""}}),d("connect");const D=await r(l,g);D&&(u(D.verification_url),h(D.user_code)),d("")},q=async(D=0)=>{const K=await a();if(K!=null&&K.authenticated&&(b(K.authenticated),K.authenticated!=="pending")){if(K.authenticated=="authenticated")try{const I=await bs(K.sheetId);p(I)}catch(I){const C=V(I);w({worksheet:{available:!1,error:C}})}d("");return}if(D<=10){setTimeout(()=>q(D+1),2e3);return}d("")},z=async()=>{d("authenticate"),Dt(m),window.addEventListener("focus",async()=>{q()},{once:!0})},de=l&&g,Y=!!i&&!!m,L=!!o,E=y==="authenticated",F=y==="pending";return e.jsxs(R,{children:[e.jsxs(fe,{children:["Sync with Google Sheet (experimental)",E?e.jsx(f,{onClick:_,loading:o==="cancel",children:"Revoke Authentication"}):e.jsx(f,{onClick:P,children:"Go Back"})]}),e.jsxs(oe,{children:[e.jsx(re,{children:"Upload Client Secret provided by Google"}),e.jsx(N,{children:v}),e.jsx($,{fluid:!0,type:"file",onChange:T,accept:".json",disabled:L||Y})]}),e.jsxs(oe,{children:[e.jsx(re,{children:"Enter ID of sheet to synchronise"}),e.jsx(N,{children:void 0}),e.jsx($,{fluid:!0,placeholder:"Sheet ID",onChange:D=>x(D.target.value),disabled:L||Y})]}),Y?e.jsx(oe,{children:e.jsxs(A,{children:[F&&e.jsx("span",{children:"Authenticating..."}),e.jsx(Pt,{copyValue:i??"",disabled:!Y,children:i||"Upload files to generate Auth Key"}),e.jsxs(f,{onClick:z,disabled:!Y,children:[e.jsx(Is,{}),"Authenticate"]})]})}):e.jsx(oe,{children:e.jsx(A,{children:e.jsxs(f,{onClick:S,disabled:!de||L,loading:o==="connect",children:[e.jsx(Fs,{}),"Connect"]})})})]})}const ri="_center_1q0ge_17",ai="_nowrap_1q0ge_21",ii="_secondaryRow_1q0ge_25",li="_linkStartActive_1q0ge_30",oi="_flex_1q0ge_36",ci="_subdued_1q0ge_42",X={center:ri,nowrap:ai,secondaryRow:ii,linkStartActive:li,flex:oi,subdued:ci};function jt(t){return t?"Yes":void 0}function di(t){const{rundown:s,customFields:n}=t;let r=0;const a=Object.keys(n),l=a.map(c=>n[c].label);return e.jsxs(ve,{className:X.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"}),l.map(c=>e.jsx("th",{children:c},c)),e.jsx("th",{children:"ID"})]})}),e.jsx("tbody",{children:s.flatOrder.map(c=>{const i=s.entries[c];if(Qn(i)){const u=i.colour?dt(i.colour):{};return e.jsxs("tr",{children:[e.jsx("td",{className:X.center,children:e.jsx(B,{children:"-"})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{})," ",e.jsx("td",{children:i.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:{...u},children:i.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(g=>{let x="";return g in i.custom&&(x=i.custom[g]),e.jsx("td",{children:x},g)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]},i.id)}if(Yn(i)){const u=i.colour?dt(i.colour):{};return e.jsxs(j.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{})," ",e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{className:X.nowrap,children:i.cue}),e.jsx("td",{children:i.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:{...u},children:i.colour}),e.jsx("td",{})," ",e.jsx("td",{})," ",a.map(g=>{let x="";return g in i.custom&&(x=i.custom[g]),e.jsx("td",{children:x},g)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]}),i.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:X.secondaryRow,children:["Note: ",i.note]})})]},i.id)}if(!xs(i))return null;r+=1;const h=i.colour?dt(i.colour):{},o=jt(i.countToEnd),d=jt(i.skip),m=jt(i.flag);return e.jsxs(j.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:X.center,children:e.jsx(B,{children:r})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.type})}),e.jsx("td",{className:X.nowrap,children:i.cue}),e.jsx("td",{children:i.title}),e.jsx("td",{className:X.center,children:m&&e.jsx(B,{children:m})}),e.jsxs("td",{className:X.flex,children:[e.jsx("span",{className:i.linkStart?X.subdued:void 0,children:Ue(i.timeStart)}),i.linkStart&&e.jsx(Ls,{className:X.linkStartActive})]}),e.jsx("td",{children:Ue(i.timeEnd)}),e.jsx("td",{children:Ue(i.duration)}),e.jsx("td",{children:Ue(i.timeWarning)}),e.jsx("td",{children:Ue(i.timeDanger)}),e.jsx("td",{className:X.center,children:o&&e.jsx(B,{children:o})}),e.jsx("td",{children:d&&e.jsx(B,{children:d})}),e.jsx("td",{style:{...h},children:i.colour}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.timerType})}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.endAction})}),a.map(u=>{let g="";return u in i.custom&&(g=i.custom[u]),e.jsx("td",{children:g},u)}),e.jsx("td",{className:X.center,children:e.jsx(B,{children:i.id})})]}),i.note&&e.jsx("tr",{children:e.jsxs("td",{colSpan:99,className:X.secondaryRow,children:["Note: ",i.note]})})]},i.id)})})]})}function ui(t){const{rundown:s,customFields:n,onFinished:r,onCancel:a}=t,{data:l}=js(),[c,i]=j.useState(!1),{importRundown:h}=ot(),o=G(u=>u.resetPreview),d=()=>{o(),a()},m=async()=>{i(!0),await h({[l.id]:{...s,id:l.id,title:l.title}},n),i(!1),r()};return e.jsxs(R,{children:[e.jsxs(fe,{children:["Review Rundown",e.jsxs(A,{children:[e.jsx(f,{onClick:d,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{onClick:m,variant:"primary",loading:c,children:"Apply"})]})]}),e.jsx(di,{rundown:s,customFields:n})]})}function hi(){const[t,s]=j.useState("none"),[n,r]=j.useState(""),[a,l]=j.useState("none"),{exportRundown:c,importRundownPreview:i,verifyAuth:h}=ot(),o=G(k=>k.setWorksheets),d=G(k=>k.authenticationStatus),m=G(k=>k.setAuthenticationStatus),u=G(k=>k.rundown),g=G(k=>k.setRundown),x=G(k=>k.customFields),p=G(k=>k.setCustomFields),w=G(k=>k.setSheetId),y=G(k=>k.sheetId),b=j.useRef(null),v=async k=>{var te;const W=(te=k.target.files)==null?void 0:te[0];if(!W){o(null),l("none");return}try{l("loading"),Ra(W),await wa(W);const ue=await Sa();o(ue),s("excel"),l("done")}catch(ue){const Re=ln(ue);r(`Error uploading file: ${Re}`),o(null),l("none")}},O=()=>{var k;(k=b.current)==null||k.click()},_=()=>{s("none"),g(null),l("none"),o(null),p(null),r(""),w(null)},P=async()=>{const k=await h();if(k&&(m(k.authenticated),w(k.sheetId),k.authenticated==="authenticated"&&k.sheetId))try{const W=await bs(k.sheetId);o(W)}catch(W){const te=V(W);r(`Error getting worksheets: ${te}`)}s("gsheet")},T=()=>{_()},S=async k=>{if(r(""),t==="excel")try{const W=await Ca(k);g(W.rundown),p(W.customFields)}catch(W){r(V(W))}if(t==="gsheet"){if(!y)return;await i(y,k)}},q=async()=>{if(_(),d==="authenticated"){const k=await h();k&&m(k.authenticated)}},z=()=>{s("finished"),g(null),l("none"),o(null),p(null),r("")},de=async k=>{y&&await c(y,k)},Y=t==="excel",L=t==="gsheet",E=d==="authenticated",F=t==="none",D=t==="finished",K=L&&!E,I=L&&E||Y&&a==="done",C=u!==null&&x!==null;return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Synchronise your rundown with an external source"}),n&&e.jsx(N,{children:n}),F&&e.jsxs(e.Fragment,{children:[e.jsx(si,{}),e.jsx("input",{ref:b,style:{display:"none"},type:"file",onChange:v,accept:".xlsx","data-testid":"file-input"}),e.jsxs("div",{className:Pe.uploadSection,children:[e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:O,loading:a==="loading",children:[e.jsx(Ge,{}),"Import from spreadsheet"]}),e.jsx(re,{children:"Accepts .xlsx files"})]}),e.jsx(lr,{orientation:"vertical"}),e.jsxs("div",{children:[e.jsxs(f,{variant:"primary",onClick:P,disabled:a!=="none",children:[e.jsx($s,{}),"Synchronise with Google"]}),e.jsx(re,{children:"Start authentication process"})]})]})]}),D&&e.jsxs("div",{className:Pe.finishSection,children:[n?e.jsx("span",{className:Pe.error,children:"Import failed"},"finish__error"):e.jsx("span",{className:Pe.success,children:"Import successful"},"finish__success"),e.jsx(f,{variant:"primary",onClick:_,children:"Return"})]}),K&&e.jsx(ni,{onCancel:T}),I&&!C&&e.jsx(ei,{hasErrors:!!n,isSpreadsheet:Y,onCancel:q,onSubmitExport:de,onSubmitImport:S}),C&&e.jsx(ui,{rundown:u,customFields:x,onFinished:z,onCancel:q})]})})}const mi="_halfWidth_6p65m_17",xi="_fullWidth_6p65m_21",ji="_twoCols_6p65m_25",pi="_current_6p65m_31",tt={halfWidth:mi,fullWidth:xi,twoCols:ji,current:pi};function Ds({onSubmit:t,onCancel:s,initialColour:n,initialLabel:r,initialKey:a}){const{data:l}=it(),[c,i]=j.useState(n||""),{handleSubmit:h,register:o,setFocus:d,setError:m,setValue:u,getValues:g,watch:x,formState:{errors:p,isSubmitting:w,isValid:y,isDirty:b}}=ce({defaultValues:{type:"text",label:r||"",colour:n||""},resetOptions:{keepDirtyValues:!0}}),v=async S=>{const{type:q,label:z,colour:de}=S,Y={type:q,colour:de,label:z};try{await t(Y)}catch(L){m("root",{type:"custom",message:V(L)})}};j.useEffect(()=>{d("label")},[d]);const O=S=>{i(S),u("colour",S,{shouldDirty:!0})},_=g("colour"),P=b&&y,T=a!==void 0;return e.jsxs($e,{as:"form",onSubmit:h(v),onKeyDown:S=>we(S,s),children:[e.jsxs(je,{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(re,{children:"Type"}),e.jsx(ms,{orientation:"horizontal",disabled:T,onValueChange:S=>u("type",S,{shouldDirty:!0}),value:x("type"),items:[{value:"text",label:"Text"},{value:"image",label:"Image"}]})]}),e.jsxs("div",{className:tt.twoCols,children:[e.jsxs("label",{children:[e.jsx(re,{children:"Label (only alphanumeric characters are allowed)"}),p.label&&e.jsx(N,{children:p.label.message}),e.jsx($,{...o("label",{required:{value:!0,message:"Required field"},onChange:()=>u("key",jr(g("label"))??"N/A"),validate:S=>S.trim().length===0?"Required field":os.isAlphanumericWithSpace(S)?!T&&T&&Object.keys(l).includes(S)?"Custom fields must be unique":!0:"Only alphanumeric characters and space are allowed"}),fluid:!0})]}),e.jsxs("label",{children:[e.jsx(re,{children:"Key (use in Integrations and API)"}),e.jsx($,{...o("key"),variant:"ghosted",readOnly:!0,fluid:!0})]})]}),e.jsxs("label",{children:[e.jsx(re,{children:"Colour"}),e.jsx(In,{name:"colour",value:_,handleChange:(S,q)=>O(q)})]}),p.root&&e.jsx(N,{children:p.root.message}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",onClick:s,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:!P,loading:w,children:"Save"})]})]})}function gi(t){const{colour:s,label:n,fieldKey:r,type:a,onEdit:l,onDelete:c}=t,[i,h]=j.useState(!1),o=async d=>{await l(r,d),h(!1)};return i?e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(Ds,{onCancel:()=>h(!1),onSubmit:o,initialColour:s,initialLabel:n,initialKey:r})})}):e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(Ln,{color:s})}),e.jsx("td",{children:e.jsx(B,{children:a})}),e.jsx("td",{className:tt.halfWidth,children:n}),e.jsx("td",{className:tt.fullWidth,children:e.jsx(Pt,{size:"small",copyValue:r,children:r})}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(Z,{variant:"ghosted-white","aria-label":"Edit entry",onClick:()=>h(!0),children:e.jsx(st,{})}),e.jsx(Z,{variant:"ghosted-destructive","aria-label":"Delete entry",onClick:()=>c(r),children:e.jsx(he,{})})]})]})}function fi(){const{data:t,refetch:s}=it(),[n,r]=j.useState(!1),a=()=>{r(!0)},l=()=>{r(!1)},c=async o=>{await sr(o),s(),r(!1)},i=async(o,d)=>{await nr(o,d),s()},h=async o=>{try{await rr(o),s()}catch{}};return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Custom fields",e.jsxs(f,{onClick:a,children:["New ",e.jsx(me,{})]})]}),e.jsx(ie,{}),e.jsx(R,{children:e.jsxs(je,{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(fs,{search:"settings=automation__automations",children:"Automation"}),", please note the generated key.",e.jsx(se,{href:on,children:"See the docs"})]})}),e.jsxs(R,{children:[n&&e.jsx(Ds,{onSubmit:c,onCancel:l}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Colour"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Key (used in Automations)"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:Object.entries(t).map(([o,{colour:d,label:m,type:u}])=>e.jsx(gi,{fieldKey:o,colour:d,label:m,type:u,onEdit:i,onDelete:h},o))})]})]})]})})}function vi(){const{data:t,status:s,isError:n,refetch:r,isFetching:a}=Ct({queryKey:Oe,queryFn:er,placeholderData:(l,c)=>l,refetchInterval:cs});return{data:t??{loaded:"",rundowns:[]},status:s,isError:n,refetch:r,isFetching:a}}function Ns(){const t=_t(),{mutateAsync:s}=ct({mutationFn:Jn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}}),{mutateAsync:n}=ct({mutationFn:Xn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}}),{mutateAsync:r}=ct({mutationFn:Zn,onMutate:()=>{t.cancelQueries({queryKey:Oe})},onSuccess:a=>{t.setQueryData(Oe,a.data)}});return{create:s,remove:n,load:r}}function yi({onClose:t}){const{create:s}=Ns(),{handleSubmit:n,register:r,setFocus:a,setError:l,formState:{errors:c,isSubmitting:i}}=ce({defaultValues:{title:""}}),h=async o=>{try{await s(o.title||"untitled"),t()}catch(d){l("root",{message:`Failed to create rundown. ${d}`})}};return j.useEffect(()=>{a("title")},[a]),e.jsxs($e,{as:"form",onSubmit:n(h),children:[e.jsx(R,{children:e.jsxs("label",{children:[e.jsx(re,{children:"Rundown title"}),e.jsx($,{...r("title"),fluid:!0,placeholder:"Your rundown name"})]})}),e.jsxs(A,{relation:"inner",align:"end",children:[e.jsx(f,{variant:"ghosted",disabled:i,onClick:t,children:"Cancel"}),e.jsx(f,{type:"submit",variant:"primary",disabled:i,children:"Create rundown"})]}),c.root&&e.jsx(N,{children:c.root.message})]})}function bi(){var b;const{data:t}=vi(),{remove:s,load:n}=Ns(),[r,a]=Ce(),[l,c]=Ce(),[i,h]=Ce(),[o,d]=j.useState(""),[m,u]=j.useState(null),g=v=>{u(null),d(v),c.open()},x=v=>{u(null),d(v),a.open()},p=async()=>{try{await n(o)}catch(v){u(`Failed to load rundown. ${V(v)}`)}finally{c.close()}},w=async()=>{try{await s(o)}catch(v){u(`Failed to delete rundown. ${V(v)}`)}finally{a.close()}},y=async(v,O)=>{await _a(v,O)};return e.jsxs(e.Fragment,{children:[e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage project rundowns",e.jsx(A,{children:e.jsxs(f,{onClick:()=>{u(null),h.open()},children:["New ",e.jsx(me,{})]})})]}),e.jsx(ie,{}),e.jsxs(R,{children:[i&&e.jsx(yi,{onClose:h.close}),m&&e.jsx(N,{children:m}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"# Entries"}),e.jsx("th",{style:{width:"100%"},children:"Title"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:(b=t==null?void 0:t.rundowns)==null?void 0:b.map(({id:v,numEntries:O,title:_})=>{const P=t.loaded===v;return e.jsxs("tr",{className:ge([P&&tt.current]),children:[e.jsx("td",{children:O}),e.jsxs("td",{children:[_," ",P&&e.jsx(B,{children:"Loaded"})]}),e.jsx("td",{children:e.jsx(us,{render:e.jsx(Z,{variant:"ghosted-white"}),items:[{type:"item",icon:Ge,label:"Load",onClick:()=>g(v),disabled:P},{type:"item",icon:es,label:"Download .xlsx",onClick:()=>y(v,_)},{type:"item",icon:he,label:"Delete",onClick:()=>x(v),disabled:P}],children:e.jsx(ts,{})})})]},v)})})]})]})]})}),e.jsx(vt,{isOpen:r,onClose:a.close,title:"Load 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:a.close,children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"large",onClick:w,children:"Delete rundown"})]})}),e.jsx(vt,{isOpen:l,onClose:c.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:c.close,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:p,children:"Load rundown"})]})})]})}function wi(){const{defaultDuration:t,linkPrevious:s,defaultTimeStrategy:n,defaultWarnTime:r,defaultDangerTime:a,defaultTimerType:l,defaultEndAction:c,setDefaultDuration:i,setLinkPrevious:h,setTimeStrategy:o,setWarnTime:d,setDangerTime:m,setDefaultTimerType:u,setDefaultEndAction:g}=ps(y=>y),x=Ke(t),p=Ke(r),w=Ke(a);return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Rundown defaults"}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(fe,{children:"Default settings for new events"}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Link previous",description:"Whether the start time of new events should be linked to the previous event end time"}),e.jsx(be,{size:"large",checked:s,onCheckedChange:h})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Timer strategy",description:"Which time should be maintained when event schedule is recalculated"}),e.jsx(ne,{value:n,onValueChange:y=>o(y),options:[{value:Wt.LockDuration,label:"Duration"},{value:Wt.LockEnd,label:"End Time"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Default duration",description:"Default duration for new events"}),e.jsx(Be,{name:"defaultDuration",submitHandler:(y,b)=>i(b),time:x,placeholder:ze.duration})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Timer type",description:"Default type of timer for new events"}),e.jsx(ne,{value:l,onValueChange:y=>u(y),options:[{value:Qe.CountDown,label:"Count down"},{value:Qe.CountUp,label:"Count up"},{value:Qe.Clock,label:"Clock"},{value:Qe.None,label:"None"}]})]}),e.jsxs(M,{children:[e.jsx(U,{title:"End Action",description:"Default end action for new events"}),e.jsx(ne,{value:c,onValueChange:y=>g(y),options:[{value:mt.None,label:"None"},{value:mt.LoadNext,label:"Load next"},{value:mt.PlayNext,label:"Play next"}]})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Be,{name:"warnTime",submitHandler:(y,b)=>d(b),time:p,placeholder:ze.warnTime})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Be,{name:"dangerTime",submitHandler:(y,b)=>m(b),time:w,placeholder:ze.dangerTime})]})]})]})]})})}function Si({location:t}){const s=ae("defaults",t),n=ae("custom",t),r=ae("rundowns",t),a=ae("sheets",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Project data"}),e.jsx("div",{ref:s,children:e.jsx(wi,{})}),e.jsx("div",{ref:n,children:e.jsx(fi,{})}),e.jsx("div",{ref:r,children:e.jsx(bi,{})}),e.jsx("div",{ref:a,children:e.jsx(hi,{})})]})}const Ci="_textEntry_dpb46_17",_i="_inlineEntry_dpb46_25",ki="_redirect_dpb46_32",Di="_label_dpb46_36",De={textEntry:Ci,inlineEntry:_i,redirect:ki,label:Di};function Ni({id:t,isOpen:s,name:n,currentPath:r,origin:a,onClose:l}){const{data:c}=is(),[i,h]=j.useState(r),[o,d]=j.useState("/"),{setRedirect:m}=ds,u=p=>{p==="/"||p===r||(p.startsWith("preset-")?m({target:t,redirect:p.slice(7)}):m({target:t,redirect:p}),l())},g=c.filter(p=>p.enabled),x=[...cn.map(p=>({value:`/${p.url}`,label:p.label})),...g.map(p=>({value:`preset-${p.alias}`,label:`URL Preset: ${p.alias}`}))];return e.jsx(at,{isOpen:s,onClose:l,showCloseButton:!0,showBackdrop:!0,title:`Redirect: ${n}`,bodyElements:e.jsxs(e.Fragment,{children:[e.jsxs(je,{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(fs,{search:"settings=sharing__presets",children:"Manage URL Presets"})]}),e.jsxs("div",{className:De.inlineEntry,children:[e.jsx("span",{className:De.label,children:"Enter custom path"}),e.jsxs("label",{className:De.textEntry,children:[a,e.jsx($,{placeholder:"eg. /timer",fluid:!0,value:i,onChange:p=>h(p.target.value)})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect",disabled:i===r||i==="",className:De.redirect,onClick:()=>u(i),children:["Redirect",e.jsx(Ft,{})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:De.label,children:"Select View or URL Preset"}),e.jsxs("div",{className:De.inlineEntry,children:[e.jsxs("label",{className:De.textEntry,children:[a,e.jsx(ne,{fluid:!0,options:x,defaultValue:x[0].value,onValueChange:p=>d(p),disabled:g.length===0})]}),e.jsxs(f,{variant:"primary","aria-label":"Redirect to preset",className:De.redirect,disabled:g.length===0||o==="/",onClick:()=>u(o),children:["Redirect ",e.jsx(Ft,{})]})]})]})]})})}const Pi="_blink_vtewd_1",Ei="_halfWidthNoWrap_vtewd_25",Ri="_copiable_vtewd_30",St="_self_vtewd_35",qe={blink:Pi,halfWidthNoWrap:Ei,copiable:Ri,self:St};function Oi(){const t=Lt(x=>x.id),s=Lt(x=>x.clients),[n,r]=Ce(),[a,l]=Ce(),{setIdentify:c}=ds,[i,h]=j.useState(""),o=x=>{h(x),l.open()},d=x=>{h(x),r.open()},m=Object.entries(s).filter(([x,{type:p}])=>p==="ontime"),u=Object.entries(s).filter(([x,{type:p}])=>p!=="ontime"),g=s[i];return e.jsxs(e.Fragment,{children:[n&&g!==void 0&&e.jsx(Ni,{id:i,name:g.name,origin:g.origin,currentPath:g.path,isOpen:n,onClose:r.close}),a&&e.jsx(dn,{id:i,name:g==null?void 0:g.name,isOpen:a,onClose:l.close}),e.jsxs(R,{children:[e.jsxs(fe,{children:["Ontime Clients (",m.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:{width:"20%"},children:"Client Name"}),e.jsx("td",{children:"Path"}),e.jsx("td",{})]})}),e.jsx("tbody",{children:m.map(([x,p])=>{const{identify:w,name:y,path:b}=p,v=t===x;return e.jsxs("tr",{className:ge([v&&qe.self]),children:[e.jsxs(A,{relation:"inner",as:"td",children:[v&&e.jsx(B,{children:"SELF"}),y]}),e.jsx("td",{className:qe.copiable,children:b}),e.jsxs(A,{relation:"inner",as:"td",children:[e.jsx(f,{size:"small",className:`${w?qe.blink:""}`,disabled:v,variant:w?"primary":"subtle","data-testid":v?"":"not-self-identify",onClick:()=>{c({target:x,identify:!w})},children:"Identify"}),e.jsx(f,{size:"small","data-testid":v?"":"not-self-rename",onClick:()=>o(x),children:"Rename"}),e.jsx(f,{size:"small",disabled:v,"data-testid":v?"":"not-self-redirect",onClick:()=>d(x),children:"Redirect"})]})]},x)})})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsxs(fe,{children:["Other Clients (",u.length,")"]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:qe.halfWidthNoWrap,children:"Client Name"}),e.jsx("td",{className:qe.halfWidthNoWrap,children:"Client type"})]})}),e.jsx("tbody",{children:u.map(([x,p])=>{const{name:w,type:y}=p;return e.jsxs("tr",{children:[e.jsx("td",{children:w}),e.jsx("td",{children:y})]},x)})})]})]})]})}function Ti(){return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsx(Q,{children:"Manage clients"}),e.jsx(ie,{}),e.jsx(Oi,{})]})})}const Ai="_iconRotate_l21m9_17",Fi={iconRotate:Ai};function Ii(){const t=s=>{ls("log",s)};return e.jsx(R,{children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Event log",e.jsxs(f,{onClick:t,children:["Extract ",e.jsx(Zt,{className:Fi.iconRotate})]})]}),e.jsx(ie,{}),e.jsx(un,{})]})})}function Li({location:t}){const s=ae("clients",t),n=ae("log",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Network"}),hn,e.jsx("div",{ref:n,children:e.jsx(Ii,{})}),e.jsx("div",{ref:s,children:e.jsx(Ti,{})})]})}const Qt={project:{title:""},settings:{timeFormat:"24",language:"en"}};function $i({isOpen:t,onClose:s}){var y,b,v,O;const{defaultWarnTime:n,defaultDangerTime:r,setDangerTime:a,setWarnTime:l}=ps(),{handleSubmit:c,register:i,formState:{errors:h,isSubmitting:o,isValid:d},watch:m,setError:u,setValue:g}=ce({defaultValues:Qt,values:Qt,resetOptions:{keepDirtyValues:!0}}),x=async _=>{try{_.project.title===""&&(_.project.title="untitled"),await La(_),await Le(),s()}catch(P){u("root",{message:V(P)})}},p=Ke(n),w=Ke(r);return e.jsx(at,{isOpen:t,onClose:s,showBackdrop:!0,showCloseButton:!0,title:"Create new project...",bodyElements:e.jsxs("form",{onSubmit:c(x),id:"quick-start",children:[e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Project title",description:"Shown as the title in some views"}),e.jsx($,{maxLength:150,placeholder:"Project title",fluid:!0,...i("project.title")})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Time format",description:"Default time format to show in views 12 /24 hours",error:(b=(y=h.settings)==null?void 0:y.timeFormat)==null?void 0:b.message}),e.jsx(ne,{value:m("settings.timeFormat"),onValueChange:_=>g("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(M,{children:[e.jsx(U,{title:"Views language",description:"Language to be displayed in views",error:(O=(v=h.settings)==null?void 0:v.language)==null?void 0:O.message}),e.jsx(ne,{value:m("settings.language"),onValueChange:_=>g("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(M,{children:[e.jsx(U,{title:"Warning time",description:"Default threshold for warning time in an event"}),e.jsx(Be,{name:"warnTime",submitHandler:(_,P)=>l(P),time:p,placeholder:ze.warnTime})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger time",description:"Default threshold for danger time in an event"}),e.jsx(Be,{name:"dangerTime",submitHandler:(_,P)=>a(P),time:w,placeholder:ze.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:!d,loading:o,children:"Create project"})]})})}const Vi="_current_1iru7_17",Wi="_isEditing_1iru7_21",Mi="_form_1iru7_25",Ui="_formInput_1iru7_33",qi="_saveButton_1iru7_37",zi="_containCell_1iru7_41",Bi="_innerColumn_1iru7_49",Ki="_inlineLabels_1iru7_57",Gi="_warningInfo_1iru7_62",Hi="_empty_1iru7_66",xe={current:Vi,isEditing:Wi,form:Mi,formInput:Ui,saveButton:qi,containCell:zi,innerColumn:Bi,inlineLabels:Ki,warningInfo:Gi,empty:Hi};function Qi({onClose:t}){const[s,n]=j.useState(null),{handleSubmit:r,register:a,formState:{isSubmitting:l,isValid:c},setFocus:i}=ce({defaultValues:{title:""},values:{title:""},resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{i("title")},[i]);const h=async o=>{try{n(null);const d=o.title??"untitled";await Ia({filename:d}),t()}catch(d){n(V(d))}};return e.jsxs($e,{as:"form",onSubmit:r(h),onKeyDown:o=>we(o,t),children:[e.jsxs(fe,{children:["Create new project",e.jsxs(A,{children:[e.jsx(f,{onClick:t,variant:"ghosted",disabled:l,children:"Cancel"}),e.jsx(f,{disabled:!c,type:"submit",loading:l,variant:"primary",children:"Create project"})]})]}),s&&e.jsx(N,{children:s}),e.jsxs(R,{className:xe.innerColumn,children:[e.jsx(re,{children:"Project title"}),e.jsx($,{fluid:!0,placeholder:"Your project name",...a("title")})]})]})}const Yi={files:[],lastLoadedProject:""};function Ji(){const{data:t,status:s,refetch:n}=Ct({queryKey:mn,queryFn:$a,placeholderData:(r,a)=>r,retry:5,retryDelay:r=>r*2500,refetchInterval:cs,networkMode:"always"});return{data:t??Yi,status:s,refetch:n}}function Ps(){const t=Ji(),{files:s,lastLoadedProject:n}=t.data,r=j.useMemo(()=>{if(!s.length)return[];const a=s.findIndex(i=>i.filename===n);if(a===-1)return s;const l=[...s];return[l.splice(a,1)[0],...l]},[s,n]);return{...t,data:{reorderedProjectFiles:r,lastLoadedProject:t.data.lastLoadedProject}}}function Xi({action:t,filename:s,onSubmit:n,onCancel:r}){const{handleSubmit:a,register:l,formState:{isSubmitting:c,isDirty:i,isValid:h},setFocus:o}=ce({defaultValues:{filename:s},values:{filename:s},resetOptions:{keepDirtyValues:!0}});return j.useEffect(()=>{o("filename")},[o]),e.jsxs("form",{onSubmit:a(n),onKeyDown:d=>we(d,r),className:xe.form,children:[e.jsx($,{className:xe.formInput,id:"filename",placeholder:"Enter new name",...l("filename",{required:!0})}),e.jsxs(A,{relation:"inner",children:[e.jsx(f,{onClick:r,variant:"ghosted",disabled:c,children:"Cancel"}),e.jsx(f,{variant:"primary",disabled:!i||!h||c,type:"submit",className:xe.saveButton,children:t})]})]})}async function Zi(t,s){const n={};for(const r in s)tr(r,t)&&s[r]&&(r==="rundowns"&&(n.customFields=t.customFields),Object.assign(n,{[r]:t[r]}));return n}function el({onClose:t,fileName:s}){const[n,r]=j.useState(null),a=_t(),{handleSubmit:l,watch:c,setValue:i,formState:{isSubmitting:h,isValid:o,isDirty:d}}=ce({defaultValues:{project:!1,rundowns:!1,viewSettings:!1,urlPresets:!1,automation:!1},resetOptions:{keepDirtyValues:!0}}),m=async u=>{if(Object.values(u).every(x=>!x)){r("At least one option must be selected");return}try{r(null);const{data:x}=await Ss(s);if(!x.settings.version.startsWith("4.")){r("The project you are attempting to merge is from an older version and it need to be migrated first");return}const p=await Zi(x,u);await _s(p),await a.invalidateQueries({queryKey:xn}),t()}catch(x){r(V(x))}};return e.jsxs(R,{as:"form",onSubmit:l(m),children:[e.jsxs(fe,{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:!o||!d,loading:h,variant:"primary",children:"Merge"})]})]}),n&&e.jsx(N,{children:n}),e.jsxs(R,{className:ge([xe.innerColumn,xe.inlineLabels]),children:[e.jsxs(re,{children:["Select data from ",e.jsx("i",{children:`"${s}"`})," to merge into the current project."]}),e.jsxs(je,{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(be,{size:"large",checked:c("project"),onCheckedChange:u=>i("project",u,{shouldDirty:!0})}),"Project data"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("rundowns"),onCheckedChange:u=>i("rundowns",u,{shouldDirty:!0})}),"Rundown + Custom Fields"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("viewSettings"),onCheckedChange:u=>i("viewSettings",u,{shouldDirty:!0})}),"View Settings"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("urlPresets"),onCheckedChange:u=>i("urlPresets",u,{shouldDirty:!0})}),"URL Presets"]}),e.jsxs("label",{children:[e.jsx(be,{size:"large",checked:c("automation"),onCheckedChange:u=>i("automation",u,{shouldDirty:!0})}),"Automation Settings"]})]})]})}function tl({current:t,updatedAt:s,editingFilename:n,editingMode:r,filename:a,onRefetch:l,onSubmit:c,onToggleEditMode:i}){const[h,o]=j.useState(null),[d,m]=j.useState(!1),u=_=>async P=>{m(!0),o(null);try{if(!P.filename){o("Filename cannot be blank");return}await(_==="rename"?Ma:Wa)(a,P.filename),await l(),c()}catch(T){o(V(T))}finally{m(!1)}},g=async _=>{m(!0),o(null);try{await ks(_),await l(),await Le()}catch(P){o(V(P))}finally{m(!1)}},x=async _=>{m(!0),o(null);try{await Ua(_),await l()}catch(P){o(V(P))}finally{m(!1)}},p=(_,P)=>{o(null),i(_,P)},w=()=>{p(null,null)},y=a===n,b=(r==="rename"||r==="duplicate")&&a===n,v=r==="merge"&&y,O=ge([t&&!y&&xe.current,y&&xe.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:O,children:b?e.jsx("td",{colSpan:99,children:e.jsx(Xi,{action:r,filename:a,onSubmit:u(r==="duplicate"?"duplicate":"rename"),onCancel:w})}):e.jsxs(e.Fragment,{children:[e.jsx("td",{className:xe.containCell,children:a}),e.jsx("td",{children:t?"Currently loaded":new Date(s).toLocaleString()}),e.jsx("td",{children:e.jsx(sl,{current:t,filename:a,onChangeEditMode:p,onDelete:x,onLoad:g,isDisabled:d||v,onMerge:_=>p("merge",_)})})]})},a),v&&e.jsx("tr",{children:e.jsx("td",{colSpan:99,children:e.jsx(el,{onClose:w,fileName:a})})})]})}function sl(t){const{current:s,filename:n,isDisabled:r,onChangeEditMode:a,onDelete:l,onLoad:c,onMerge:i}=t,h=()=>{a("rename",n)},o=()=>{a("duplicate",n)},d=async()=>{await Fa(n)};return e.jsx(us,{render:e.jsx(Z,{variant:"ghosted-white"}),disabled:r,items:[{type:"item",icon:Ge,label:"Load",onClick:()=>c(n),disabled:s},{type:"item",icon:Ge,label:"Partial Load",onClick:()=>i(n),disabled:s},{type:"item",icon:Vs,label:"Rename",onClick:h},{type:"item",icon:Ws,label:"Duplicate",onClick:o},{type:"item",icon:es,label:"Download",onClick:d},{type:"divider"},{type:"item",icon:he,label:"Delete",onClick:()=>l(n),disabled:s}],children:e.jsx(ts,{})})}function nl(){const{data:t,refetch:s,status:n}=Ps(),[r,a]=j.useState(null),[l,c]=j.useState(null),i=(m,u)=>{a(g=>g===m&&u===l?null:m),c(u)},h=()=>{a(null),c(null)},o=async()=>{await s()};if(n==="pending")return e.jsx("div",{className:xe.empty,children:e.jsx(Ae,{isLoading:!0})});const d=t.reorderedProjectFiles.length;return e.jsxs(e.Fragment,{children:[d>20&&e.jsxs(je,{className:xe.warningInfo,type:"warning",children:["You have ",d," projects. Consider deleting unused projects to improve performance."]}),e.jsxs(ve,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:xe.containCell,children:"File Name"}),e.jsx("th",{children:"Last Used"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.reorderedProjectFiles.map(m=>e.jsx(tl,{filename:m.filename,updatedAt:m.updatedAt,onToggleEditMode:i,onSubmit:h,onRefetch:o,editingFilename:l,editingMode:r,current:m.filename===t.lastLoadedProject},m.filename))})]})]})}function rl(){const[t,s]=ss(),[n,r]=j.useState(""),[a,l]=j.useState(null),c=j.useRef(null),i=t.get("new")==="true",h=()=>{t.set("new",i?"false":"true"),s(t)},o=()=>{var u;(u=c.current)==null||u.click()},d=async u=>{var x,p;const g=(p=(x=u.target)==null?void 0:x.files)==null?void 0:p[0];if(g){l("import");try{ws(g),await Cs(g)}catch(w){const y=V(w);r(`Error uploading file: ${y}`)}finally{await Le()}l(null)}},m=()=>{t.delete("new"),s(t)};return e.jsxs(R,{children:[e.jsx("input",{ref:c,style:{display:"none"},type:"file",onChange:d,accept:".json","data-testid":"file-input"}),e.jsxs(ee,{children:[e.jsxs(Q,{children:["Manage projects",e.jsxs(A,{children:[e.jsx(f,{onClick:o,disabled:!!a||i,loading:a==="import",children:"Import"}),e.jsxs(f,{onClick:h,disabled:!!a||i,children:["New ",e.jsx(me,{})]})]})]}),n&&e.jsx(N,{children:n}),e.jsx(ie,{}),i&&e.jsx(Qi,{onClose:m}),e.jsx(nl,{})]})]})}function al({location:t,setLocation:s}){const n=ae("list",t),r=()=>{s("project")};return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Project"}),e.jsx($i,{isOpen:t==="create",onClose:r}),e.jsx("div",{ref:n,children:e.jsx(rl,{})})]})}const il="_container_cq029_17",ll={container:il};function Yt({register:t,formName:s,disabled:n}){const[r,a]=j.useState(!1);return e.jsxs("div",{className:ll.container,children:[e.jsx($,{type:r?"text":"password",maxLength:4,...t(s,{pattern:{value:qn,message:"Only alphanumeric characters are allowed"}}),placeholder:"-",disabled:n}),e.jsx(Z,{onMouseDown:()=>a(!0),onMouseUp:()=>a(!1),variant:"ghosted","aria-label":"Show pin code",children:e.jsx(Ms,{})})]})}const ol=j.lazy(()=>He(()=>import("./CustomTranslationModal-C3R_2T5s.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url));function cl(){var _,P,T,S,q;const{data:t,status:s,refetch:n}=jn(),{handleSubmit:r,register:a,reset:l,setError:c,watch:i,setValue:h,formState:{isSubmitting:o,isDirty:d,isValid:m,errors:u}}=ce({mode:"onChange",defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}}),[g,x]=Ce();j.useEffect(()=>{t&&l(t)},[t,l]);const p=async z=>{try{await pn(z)}catch(de){const Y=V(de);c("root",{message:Y})}finally{await n()}},w=s==="pending",y=o||!d||!m,b="",v=()=>{l(t)},O=s==="pending";return e.jsxs(e.Fragment,{children:[e.jsx(ol,{isOpen:g,onClose:x.close}),e.jsx(R,{as:"form",onSubmit:r(p),onKeyDown:z=>we(z,v),id:"app-settings",children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["General settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!d||o,variant:"ghosted",onClick:v,children:"Revert to saved"}),e.jsx(f,{type:"submit",form:"app-settings",name:"general-settings-submit",loading:o,disabled:y,variant:"primary",children:"Save"})]})]}),b,e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:O}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Ontime server port",description:Ie?"Server port disabled for Ontime Cloud":"Port ontime server listens in. Defaults to 4001 (needs app restart)",error:(_=u.serverPort)==null?void 0:_.message}),e.jsx($,{id:"serverPort",type:"number",maxLength:5,style:{width:"75px"},disabled:Ie,...a("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:hs,message:"Value should be numeric"}})})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Editor pin code",description:"Protect the editor view with a pin code",error:(P=u.editorKey)==null?void 0:P.message}),e.jsx(Yt,{register:a,formName:"editorKey",disabled:w})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Operator pin code",description:"Protect the operator and cuesheet views with a pin code",error:(T=u.operatorKey)==null?void 0:T.message}),e.jsx(Yt,{register:a,formName:"operatorKey",disabled:w})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Time format",description:"Default time format to show in views 12 /24 hours",error:(S=u.timeFormat)==null?void 0:S.message}),e.jsx(ne,{value:i("timeFormat"),onValueChange:z=>h("timeFormat",z,{shouldDirty:!0}),defaultValue:"24",options:[{value:"12",label:"12 hours 11:00:10 PM"},{value:"24",label:"24 hours 23:00:10"}]})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Views language",description:"Language to be displayed in views",error:(q=u.language)==null?void 0:q.message}),e.jsx(ne,{value:i("language"),onValueChange:z=>h("language",z,{shouldDirty:!0}),disabled:w,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:x.open,children:"Edit custom translation"})]})]})]})]})})]})}const dl="_uploadLogoCard_m5263_17",ul="_customDataItem_m5263_32",hl="_titleRow_m5263_39",ml="_customImage_m5263_48",xl="_imageContainer_m5263_54",Fe={uploadLogoCard:dl,customDataItem:ul,titleRow:hl,customImage:ml,imageContainer:xl};function jl(){var Y;const{data:t,status:s}=$n(),{updateProjectData:n}=Vn(),{handleSubmit:r,register:a,reset:l,formState:{isSubmitting:c,isValid:i,isDirty:h,errors:o},setError:d,clearErrors:m,watch:u,control:g,setValue:x}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0},mode:"onChange"}),{fields:p,append:w,remove:y}=Ze({control:g,name:"custom"});j.useEffect(()=>{t&&l(t)},[t,l]);const b=async L=>{var F;const E=(F=L.target.files)==null?void 0:F[0];if(m("logo"),!!E)try{Aa(E);const D=await Wn(E);x("logo",D.data.logoFilename,{shouldDirty:!0})}catch(D){const K=V(D);d("logo",{message:K})}},{ref:v,...O}=a("logo"),_=j.useRef(null),P=()=>{var L;(L=_.current)==null||L.click()},T=L=>{L.preventDefault(),L.stopPropagation(),x("logo",null,{shouldDirty:!0})},S=()=>{w({title:"",value:"",url:""})},q=async L=>{try{m(),await n(L)}catch(E){const F=V(E);d("root",{message:F})}},z=()=>{l(t)},de=s==="pending";return e.jsx(R,{as:"form",onSubmit:r(q),onKeyDown:L=>we(L,z),children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["Project data",e.jsxs(A,{children:[e.jsx(f,{onClick:z,disabled:c||!h,children:"Revert to saved"}),e.jsx(f,{variant:"primary",type:"submit",disabled:!h||!i,loading:c,children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:de}),e.jsxs("label",{children:["Project title",e.jsx($,{fluid:!0,maxLength:50,placeholder:"Project title is shown in production views",...a("title")})]}),e.jsx(R,{style:{marginTop:0},children:e.jsxs("label",{children:["Project logo",e.jsx("input",{type:"file",style:{display:"none"},accept:"image/*",...O,ref:L=>{v(L),_.current=L},onChange:b}),e.jsxs(ee,{className:Fe.uploadLogoCard,children:[u("logo")?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`${gn}/${u("logo")}`}),e.jsxs(f,{variant:"subtle-destructive",disabled:c||!u("logo"),onClick:T,children:[e.jsx(he,{}),"Delete"]})]}):e.jsxs(f,{disabled:c,onClick:P,type:"button",children:[e.jsx(Ge,{}),"Upload logo"]}),((Y=o==null?void 0:o.logo)==null?void 0:Y.message)&&e.jsx(N,{children:o.logo.message})]})]})}),e.jsxs("label",{children:["Project description",e.jsx($,{fluid:!0,maxLength:100,placeholder:"Euro Love, Malmö 2024",...a("description")})]}),e.jsxs("label",{children:["Project info",e.jsx(yt,{fluid:!0,maxLength:150,placeholder:"Wi-Fi password: 1234",resize:"vertical",...a("info")})]}),e.jsxs("label",{children:["Project QR code URL",e.jsx($,{fluid:!0,placeholder:Nt,...a("url")})]}),e.jsxs(R,{style:{marginTop:0},children:[e.jsxs(M,{children:[e.jsx(U,{title:"Custom data",description:""}),e.jsxs(f,{onClick:S,children:["Add ",e.jsx(me,{})]})]}),p.length>0&&p.map((L,E)=>{var D,K,I;const F=(D=o.custom)==null?void 0:D[E];return e.jsxs("div",{className:Fe.customDataItem,children:[e.jsxs("div",{className:Fe.titleRow,children:[e.jsxs("label",{className:Fe.title,children:["Title",e.jsx($,{fluid:!0,defaultValue:L.title,placeholder:"Title of your custom data",...a(`custom.${E}.title`,{required:{value:!0,message:"Field cannot be empty"}})})]}),e.jsxs(f,{variant:"subtle-destructive",onClick:()=>y(E),children:[e.jsx(he,{}),"Delete"]})]}),((K=F==null?void 0:F.title)==null?void 0:K.message)&&e.jsx(N,{children:F.title.message}),e.jsxs("label",{children:["Text",e.jsx(yt,{fluid:!0,rows:3,resize:"vertical",defaultValue:L.value,placeholder:"Text of your custom data",...a(`custom.${E}.value`,{required:{value:!0,message:"Field cannot be empty"}})}),((I=F==null?void 0:F.value)==null?void 0:I.message)&&e.jsx(N,{children:F.value.message})]}),e.jsxs("label",{children:["Image URL (optional)",e.jsxs("div",{className:Fe.customImage,children:[e.jsx($,{fluid:!0,defaultValue:L.url,placeholder:"Paste image URL (optional)",...a(`custom.${E}.url`)}),e.jsx("div",{className:Fe.imageContainer,children:u(`custom.${E}.url`)&&e.jsx("img",{src:u(`custom.${E}.url`),alt:"",loading:"lazy",className:"info__image"})})]})]})]},L.id)})]})]})]})})}const pl="_editorActions_18rtd_17",gl="_right_18rtd_21",fl="_column_18rtd_26",pt={editorActions:pl,right:gl,column:fl},vl=j.lazy(()=>He(()=>import("./StyleEditor-D2z65PB7.js"),__vite__mapDeps([11,1,2,12]),import.meta.url));function yl({isOpen:t,onClose:s}){const[n,r]=j.useState(""),[a,l]=j.useState(!1),[c,i]=j.useState(!1),[h,o]=j.useState(!1),[d,m]=j.useState(null),u=j.useRef(null),g=async()=>{try{o(!0);const w=await fn();r(w)}catch{}finally{o(!1)}},x=async()=>{try{i(!0),u.current&&(await vn(u.current.getCss()),r(u.current.getCss()),l(!1))}catch{}finally{i(!1)}},p=()=>r("");return j.useEffect(()=>{async function w(){if(t)try{const y=await yn();r(y)}catch{m("Failed to load CSS from server")}}w()},[t]),e.jsx(at,{title:"Edit CSS override",isOpen:t,onClose:s,showCloseButton:!0,showBackdrop:!0,bodyElements:e.jsx(vl,{ref:u,initialValue:n,language:"css",isDirty:a,setIsDirty:l}),footerElements:e.jsxs("div",{className:pt.column,children:[e.jsx(je,{children:"Invalid CSS will be refused by the browser"}),d&&e.jsx(N,{className:pt.right,children:`Error: ${d}`}),e.jsxs(A,{align:"apart",className:pt.editorActions,children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:g,disabled:c||h,children:"Reset to example"}),e.jsxs(A,{children:[e.jsx(f,{variant:"ghosted",size:"large",onClick:p,children:"Clear"}),e.jsx(f,{size:"large",onClick:s,children:"Cancel"}),e.jsx(f,{variant:"primary",size:"large",onClick:x,disabled:c||h||!a,loading:c,children:"Save changes"})]})]})]})})}const bl="https://docs.getontime.no/features/custom-styling/";function wl(){var w;const{data:t,status:s,mutateAsync:n}=bn(),[r,a]=Ce(),{control:l,handleSubmit:c,setError:i,reset:h,setValue:o,watch:d,formState:{isSubmitting:m,isDirty:u,errors:g}}=ce({defaultValues:t,values:t,resetOptions:{keepDirtyValues:!0}});j.useEffect(()=>{t&&h(t)},[t,h]);const x=async y=>{try{n(y)}catch(b){const v=V(b);i("root",{message:v})}},p=()=>{h(t)};return l?e.jsx(R,{as:"form",onSubmit:c(x),onKeyDown:y=>we(y,p),id:"view-settings",children:e.jsxs(ee,{children:[e.jsxs(Q,{children:["View settings",e.jsxs(A,{children:[e.jsx(f,{disabled:!u,variant:"ghosted",onClick:p,children:"Revert to saved"}),e.jsx(f,{type:"submit",loading:m,disabled:!u,variant:"primary",children:"Save"})]})]}),e.jsx(ie,{}),e.jsxs(je,{children:["You can customise the styles applied to Ontime views by providing overriding CSS rules.",e.jsx("br",{}),e.jsx(se,{href:bl,children:"See the docs"})]}),e.jsxs(R,{children:[e.jsx(Ae,{isLoading:s==="pending"}),e.jsx(N,{children:(w=g.root)==null?void 0:w.message}),e.jsxs(oe,{children:[e.jsx(yl,{isOpen:r,onClose:a.close}),e.jsxs(M,{children:[e.jsx(U,{title:"Override CSS styles",description:"Enables overriding view styles with custom stylesheet"}),e.jsx(be,{size:"large",checked:d("overrideStyles"),onCheckedChange:y=>o("overrideStyles",y,{shouldDirty:!0})}),e.jsx(f,{onClick:a.open,disabled:m,children:"Edit CSS override"})]})]}),e.jsxs(oe,{children:[e.jsxs(M,{children:[e.jsx(U,{title:"Timer colour",description:"Default colour of a running timer"}),e.jsx(ht,{name:"normalColor",control:l})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Warning colour",description:"Colour of a running timer in warning mode"}),e.jsx(ht,{name:"warningColor",control:l})]}),e.jsxs(M,{children:[e.jsx(U,{title:"Danger colour",description:"Colour of a running timer in danger mode"}),e.jsx(ht,{name:"dangerColor",control:l})]})]})]})]})}):null}function Sl({location:t}){const s=ae("data",t),n=ae("general",t),r=ae("view",t);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Settings"}),e.jsx("div",{ref:s,children:e.jsx(jl,{})}),e.jsx("div",{ref:n,children:e.jsx(cl,{})}),e.jsx("div",{ref:r,children:e.jsx(wl,{})})]})}function Cl(){const{isElectron:t,sendToElectron:s}=wn(),[n,r]=Ce(),a=j.useRef(null),l=()=>{s("shutdown","now"),r.close()},c=t||et;return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Shutdown Ontime"}),e.jsxs(R,{children:[Ie?e.jsx(Sn,{children:"For security reasons, shutting down the server must be done from the Ontime Cloud dashboard."}):e.jsxs(_e,{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:r.open,disabled:!(t||et),children:"Shutdown ontime"}),!c&&e.jsx(re,{children:"Note: Ontime can only be shutdown from the machine it is running in."}),e.jsx(vt,{isOpen:n,title:"Shutdown Ontime",showCloseButton:!0,onClose:r.close,bodyElements:e.jsxs(_e,{children:["This will shutdown the Ontime server. ",e.jsx("br",{})," Are you sure?"]}),footerElements:e.jsxs(e.Fragment,{children:[e.jsx(f,{ref:a,onClick:r.close,variant:"ghosted-white",children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:l,disabled:!c,children:"Shutdown"})]})})]})]})}const _l="_corner_1dxip_17",kl="_contentWrapper_1dxip_24",Dl="_content_1dxip_24",gt={corner:_l,contentWrapper:kl,content:Dl};function Nl({onClose:t,children:s}){return e.jsxs("div",{className:gt.contentWrapper,children:[e.jsx("div",{className:gt.content,children:s}),e.jsx("div",{className:gt.corner,children:e.jsxs(f,{size:"large",onClick:t,children:["Close settings ",e.jsx(kt,{})]})})]})}const Pl=[{id:"settings",label:"Settings",secondary:[{id:"settings__data",label:"Project data"},{id:"settings__general",label:"General settings"},{id:"settings__view",label:"View settings"}]},{id:"project",label:"Project",split:!0,secondary:[{id:"project__create",label:"Create..."},{id:"project__list",label:"Manage projects"}]},{id:"manage",label:"Project settings",secondary:[{id:"manage__defaults",label:"Rundown defaults"},{id:"manage__custom",label:"Custom fields"},{id:"manage__rundowns",label:"Manage rundowns"},{id:"manage__sheets",label:"Import spreadsheet"},{id:"manage__sheets",label:"Sync with Google Sheet"}]},{id:"automation",label:"Automation",split:!0,secondary:[{id:"automation__settings",label:"Automation settings"},{id:"automation__automations",label:"Manage automations"},{id:"automation__triggers",label:"Manage triggers"}]},{id:"sharing",label:"Sharing and reporting",split:!0,secondary:[{id:"sharing__presets",label:"URL Presets"},{id:"sharing__link",label:"Share link"},{id:"sharing__report",label:"Runtime report"}]},{id:"network",label:"Network",split:!0,secondary:[{id:"network__log",label:"Event log"},{id:"network__clients",label:"Manage clients"}]},{id:"about",label:"About",split:!0},{id:"shutdown",label:"Shutdown",split:!0}];function El(){const{data:t}=vs();return{options:j.useMemo(()=>Pl.map(n=>({...n,highlight:n.id==="about"&&t.hasUpdates?"New version available":void 0})),[t])}}const Je="settings";function Ot(){const[t,s]=ss(),n=j.useMemo(()=>t.get(Je)??"project",[t]),r=j.useMemo(()=>!!t.get(Je),[t]),[a,l]=n.split("__"),c=j.useCallback(()=>{t.delete(Je),s(t)},[t,s]),i=j.useCallback(h=>{t.set(Je,h),s(t)},[t,s]);return{isOpen:r,panel:a,location:l,setLocation:i,close:c}}const Rl="_tabs_86c70_17",Ol="_primary_86c70_31",Tl="_secondary_86c70_32",Al="_active_86c70_54",Fl="_highlight_86c70_58",Il="_split_86c70_68",Te={tabs:Rl,primary:Ol,secondary:Tl,active:Al,highlight:Fl,split:Il};function Ll({selectedPanel:t,location:s}){const{options:n}=El();return e.jsx("ul",{className:Te.tabs,children:n.map(r=>{const a=t===r.id;return r.highlight?e.jsx(gs,{text:r.highlight,render:e.jsx("span",{}),children:e.jsx(Jt,{panel:r,location:s,isSelected:a})},r.id):e.jsx(Jt,{panel:r,location:s,isSelected:a},r.id)})})}function Jt(t){var c;const{panel:s,isSelected:n,location:r}=t,{setLocation:a}=Ot(),l=ge([Te.primary,n&&Te.active,s.split&&Te.split,s.highlight&&Te.highlight]);return e.jsxs(j.Fragment,{children:[e.jsx("li",{onClick:()=>a(s.id),onKeyDown:i=>{$t(i)&&a(s.id)},className:l,tabIndex:0,role:"button",children:s.label},s.id),(c=s.secondary)==null?void 0:c.map((i,h)=>{const o=i.id.split("__")[1],d=ge([Te.secondary,n&&r===o?Te.active:null]);return e.jsx("li",{onClick:()=>a(i.id),onKeyDown:m=>{$t(m)&&a(i.id)},className:d,role:"button",children:i.label},i.id+h)})]},s.id)}const $l="_container_1fy3l_17",Vl={container:$l};function Wl(){const{close:t,panel:s,location:n,setLocation:r}=Ot();return gr(t,"Escape"),e.jsx("div",{className:Vl.container,children:e.jsxs(Us,{children:[e.jsx(Ll,{selectedPanel:s,location:n}),e.jsxs(Nl,{onClose:t,children:[s==="settings"&&e.jsx(Sl,{location:n}),s==="project"&&e.jsx(al,{location:n,setLocation:r}),s==="manage"&&e.jsx(Si,{location:n}),s==="automation"&&e.jsx(ta,{location:n}),s==="sharing"&&e.jsx(ba,{location:n}),s==="network"&&e.jsx(Li,{location:n}),s==="about"&&e.jsx(wr,{}),s==="shutdown"&&e.jsx(Cl,{})]})]})})}const Ml=j.memo(Ul);function Ul({children:t}){return e.jsxs(zn,{navElements:t,children:[e.jsx(Bn,{}),e.jsx(dr,{}),e.jsx(ur,{}),e.jsx(hr,{}),e.jsx(mr,{}),e.jsx(xr,{})]})}function ql({onFinish:t}){const s=j.useRef(null),n=()=>{var a;(a=s.current)==null||a.click()},r=async a=>{var c,i;const l=(i=(c=a.target)==null?void 0:c.files)==null?void 0:i[0];if(l)try{ws(l),await Cs(l)}catch{}finally{await Le(),t()}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:s,style:{display:"none"},type:"file",onChange:r,accept:".json","data-testid":"file-input"}),e.jsx(f,{onClick:n,children:"Import project"})]})}const zl="_sections_khqv6_17",Bl="_column_khqv6_23",Kl="_about_khqv6_23",Gl="_inline_khqv6_35",Hl="_header_khqv6_41",Ql="_logo_khqv6_48",Yl="_buttonRow_khqv6_53",Jl="_tableContainer_khqv6_62",Xl="_table_khqv6_62",Zl="_current_khqv6_75",pe={sections:zl,column:Bl,about:Kl,inline:Gl,header:Hl,logo:Ql,buttonRow:Yl,tableContainer:Jl,table:Xl,current:Zl};function eo(t){const{loadProject:s,onClose:n}=t,{data:r}=Ps();return e.jsx("tbody",{children:r.reorderedProjectFiles.map(a=>a.filename===r.lastLoadedProject?e.jsxs("tr",{className:pe.current,onClick:n,children:[e.jsx("td",{children:a.filename}),e.jsx("td",{children:"Loaded from last session"})]},a.filename):e.jsxs("tr",{onClick:()=>s(a.filename),children:[e.jsx("td",{children:a.filename}),e.jsx("td",{children:new Date(a.updatedAt).toLocaleString()})]},a.filename))})}function to({onClose:t}){const s=qs(),n=async l=>{try{await ks(l),await Le(),t()}catch{}},r=async()=>{try{await Va(),await Le(),t()}catch{}},a=()=>{s("/editor?settings=project__create"),t()};return e.jsx(at,{isOpen:!0,onClose:()=>t(),showBackdrop:!0,bodyElements:e.jsxs("div",{className:pe.sections,children:[e.jsxs("div",{className:pe.about,children:[e.jsx("img",{src:"ontime-logo.png",alt:"ontime",className:pe.logo}),e.jsxs("div",{children:["Ontime v",Xe]}),e.jsx(se,{href:ft,children:"Website"}),e.jsx(se,{href:Nt,children:"Read the docs"}),e.jsx(se,{href:ns,children:"Discord server"})]}),e.jsxs("div",{className:pe.column,children:[e.jsxs("div",{className:pe.header,children:["Welcome to Ontime",e.jsx(Z,{"aria-label":"close welcome modal",variant:"subtle-white",onClick:()=>t(),children:e.jsx(kt,{})})]}),e.jsx(cr,{children:"Select project"}),e.jsx("div",{className:pe.tableContainer,children:e.jsxs("table",{className:pe.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"File Name"}),e.jsx("th",{children:"Last Used"})]})}),e.jsx(eo,{loadProject:n,onClose:()=>t()})]})})]})]}),footerElements:e.jsxs("div",{className:pe.column,children:[e.jsxs("div",{className:pe.buttonRow,children:[e.jsx(f,{onClick:r,children:"Load demo project"}),e.jsx(ql,{onFinish:()=>t()}),e.jsx(f,{variant:"primary",onClick:a,children:"Create new..."})]}),e.jsxs(or,{className:pe.inline,children:[e.jsx(Dn,{defaultChecked:!0,onCheckedChange:l=>Cn(l)}),"Show this modal on next startup"]})]})})}function so(){const t=Vt(n=>n.showDialog),s=Vt(n=>n.clearDialog);return t?e.jsx(to,{onClose:s}):null}const no=j.lazy(()=>He(()=>import("./RundownExport-C6YhMGOC.js").then(t=>t.R),__vite__mapDeps([13,1,2,14,3,4,15,16,17,18,8,9,19,20,21,22,23,24,25,26,27,28,29,30,31,32,7,10,33,34,35,36,37,38]),import.meta.url)),ro=j.lazy(()=>He(()=>import("./TimerControlExport-C8ECtLBd.js"),__vite__mapDeps([39,1,2,14,3,4,15,16,17,20,21,22,31,32,40,41,42,43]),import.meta.url)),ao=j.lazy(()=>He(()=>import("./MessageControlExport-lXK21piH.js"),__vite__mapDeps([44,1,2,14,3,4,15,16,17,29,30,31,32,41,42,45]),import.meta.url));function io(){const{isOpen:t,setLocation:s,close:n}=Ot(),[r,a]=Ce();Nn("Editor"),_n(),j.useEffect(()=>{var c;((c=window.process)==null?void 0:c.type)==="renderer"&&window.ipcRenderer.on("user-request-shutdown",()=>{s("shutdown")})},[s]);const l=j.useCallback(()=>{t?n():s("settings")},[n,t,s]);return zs([["mod + ,",l]]),e.jsxs("div",{className:xt.mainContainer,"data-testid":"event-editor",children:[e.jsx(so,{}),e.jsx(kn,{isOpen:r,onClose:a.close}),e.jsxs(Ml,{children:[e.jsx(Z,{"aria-label":"Toggle navigation",variant:"subtle-white",size:"xlarge",onClick:a.open,children:e.jsx(Bs,{})}),e.jsx(Z,{"aria-label":"Toggle settings",variant:"subtle-white",size:"xlarge",onClick:l,children:t?e.jsx(kt,{}):e.jsx(Ks,{})})]}),t?e.jsx(Wl,{}):e.jsxs("div",{id:"panels",className:xt.panelContainer,children:[e.jsxs("div",{className:xt.left,children:[e.jsx(ro,{}),e.jsx(ao,{})]}),e.jsx(no,{})]})]})}function Po(){return e.jsx(Gs,{permission:"editor",children:e.jsx(io,{})})}export{Po as default};
3
+ //# sourceMappingURL=ProtectedEditor-C_SYWpL2.js.map