@getontime/cli 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/assets/{Backstage-BY9GL_rk.js → Backstage-BdrcXNr9.js} +2 -2
- package/client/assets/Backstage-BdrcXNr9.js.br +0 -0
- package/client/assets/Backstage-BdrcXNr9.js.gz +0 -0
- package/client/assets/{Backstage-BY9GL_rk.js.map → Backstage-BdrcXNr9.js.map} +1 -1
- package/client/assets/{Countdown-CXFgDHND.js → Countdown-DQM2ppPg.js} +2 -2
- package/client/assets/Countdown-DQM2ppPg.js.br +0 -0
- package/client/assets/Countdown-DQM2ppPg.js.gz +0 -0
- package/client/assets/{Countdown-CXFgDHND.js.map → Countdown-DQM2ppPg.js.map} +1 -1
- package/client/assets/{CuesheetTable-BLICUNky.js → CuesheetTable-B5LQVh5m.js} +2 -2
- package/client/assets/CuesheetTable-B5LQVh5m.js.br +0 -0
- package/client/assets/CuesheetTable-B5LQVh5m.js.gz +0 -0
- package/client/assets/{CuesheetTable-BLICUNky.js.map → CuesheetTable-B5LQVh5m.js.map} +1 -1
- package/client/assets/{CustomTranslationModal-4PVZBtkC.js → CustomTranslationModal-CML7Vsot.js} +2 -2
- package/client/assets/CustomTranslationModal-CML7Vsot.js.br +0 -0
- package/client/assets/CustomTranslationModal-CML7Vsot.js.gz +0 -0
- package/client/assets/{CustomTranslationModal-4PVZBtkC.js.map → CustomTranslationModal-CML7Vsot.js.map} +1 -1
- package/client/assets/{DelayIndicator-DUbpd6DG.js → DelayIndicator-DKS6mZdB.js} +2 -2
- package/client/assets/DelayIndicator-DKS6mZdB.js.br +0 -0
- package/client/assets/DelayIndicator-DKS6mZdB.js.gz +0 -0
- package/client/assets/{DelayIndicator-DUbpd6DG.js.map → DelayIndicator-DKS6mZdB.js.map} +1 -1
- package/client/assets/{EditorFeatureWrapper-CV_zaDoG.js → EditorFeatureWrapper-C1vLQxiy.js} +2 -2
- package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.br +0 -0
- package/client/assets/EditorFeatureWrapper-C1vLQxiy.js.gz +0 -0
- package/client/assets/{EditorFeatureWrapper-CV_zaDoG.js.map → EditorFeatureWrapper-C1vLQxiy.js.map} +1 -1
- package/client/assets/{EditorUtils-CLBWDP4k.js → EditorUtils-BLcTuWz1.js} +2 -2
- package/client/assets/EditorUtils-BLcTuWz1.js.br +0 -0
- package/client/assets/EditorUtils-BLcTuWz1.js.gz +0 -0
- package/client/assets/{EditorUtils-CLBWDP4k.js.map → EditorUtils-BLcTuWz1.js.map} +1 -1
- package/client/assets/{EmptyPage-DmpOAg7R.js → EmptyPage-CYVrjOvI.js} +2 -2
- package/client/assets/EmptyPage-CYVrjOvI.js.br +0 -0
- package/client/assets/EmptyPage-CYVrjOvI.js.gz +0 -0
- package/client/assets/{EmptyPage-DmpOAg7R.js.map → EmptyPage-CYVrjOvI.js.map} +1 -1
- package/client/assets/{FollowButton-CAUWz5Ma.js → FollowButton-DcSbb4R_.js} +2 -2
- package/client/assets/FollowButton-DcSbb4R_.js.br +0 -0
- package/client/assets/FollowButton-DcSbb4R_.js.gz +0 -0
- package/client/assets/{FollowButton-CAUWz5Ma.js.map → FollowButton-DcSbb4R_.js.map} +1 -1
- package/client/assets/{MessageControlExport-Dm8IjSr4.js → MessageControlExport-BgT9JaXk.js} +3 -3
- package/client/assets/MessageControlExport-BgT9JaXk.js.br +0 -0
- package/client/assets/MessageControlExport-BgT9JaXk.js.gz +0 -0
- package/client/assets/{MessageControlExport-Dm8IjSr4.js.map → MessageControlExport-BgT9JaXk.js.map} +1 -1
- package/client/assets/{MultiPartProgressBar-Fp-sTN2u.js → MultiPartProgressBar-W2a-JWPY.js} +2 -2
- package/client/assets/MultiPartProgressBar-W2a-JWPY.js.br +0 -0
- package/client/assets/MultiPartProgressBar-W2a-JWPY.js.gz +0 -0
- package/client/assets/{MultiPartProgressBar-Fp-sTN2u.js.map → MultiPartProgressBar-W2a-JWPY.js.map} +1 -1
- package/client/assets/{OperatorExport-CE4ajLPS.js → OperatorExport-CbWojpp6.js} +2 -2
- package/client/assets/OperatorExport-CbWojpp6.js.br +0 -0
- package/client/assets/OperatorExport-CbWojpp6.js.gz +0 -0
- package/client/assets/{OperatorExport-CE4ajLPS.js.map → OperatorExport-CbWojpp6.js.map} +1 -1
- package/client/assets/{OverviewWrapper-BNnAIUP1.js → OverviewWrapper-B2i8d3rt.js} +2 -2
- package/client/assets/OverviewWrapper-B2i8d3rt.js.br +0 -0
- package/client/assets/OverviewWrapper-B2i8d3rt.js.gz +0 -0
- package/client/assets/{OverviewWrapper-BNnAIUP1.js.map → OverviewWrapper-B2i8d3rt.js.map} +1 -1
- package/client/assets/{PipHost-CbNFsfqp.js → PipHost-Dz2oy7XG.js} +2 -2
- package/client/assets/PipHost-Dz2oy7XG.js.br +0 -0
- package/client/assets/PipHost-Dz2oy7XG.js.gz +0 -0
- package/client/assets/{PipHost-CbNFsfqp.js.map → PipHost-Dz2oy7XG.js.map} +1 -1
- package/client/assets/{ProjectInfo-Bf5z4Xsv.js → ProjectInfo-BR_7Hp5u.js} +2 -2
- package/client/assets/ProjectInfo-BR_7Hp5u.js.br +0 -0
- package/client/assets/ProjectInfo-BR_7Hp5u.js.gz +0 -0
- package/client/assets/{ProjectInfo-Bf5z4Xsv.js.map → ProjectInfo-BR_7Hp5u.js.map} +1 -1
- package/client/assets/{ProtectRoute-CCHzyy0I.js → ProtectRoute-Bxq6q7ba.js} +2 -2
- package/client/assets/ProtectRoute-Bxq6q7ba.js.br +0 -0
- package/client/assets/ProtectRoute-Bxq6q7ba.js.gz +0 -0
- package/client/assets/{ProtectRoute-CCHzyy0I.js.map → ProtectRoute-Bxq6q7ba.js.map} +1 -1
- package/client/assets/{ProtectedCuesheet-COI1W_V3.js → ProtectedCuesheet-C7AqD2dy.js} +2 -2
- package/client/assets/ProtectedCuesheet-C7AqD2dy.js.br +0 -0
- package/client/assets/ProtectedCuesheet-C7AqD2dy.js.gz +0 -0
- package/client/assets/{ProtectedCuesheet-COI1W_V3.js.map → ProtectedCuesheet-C7AqD2dy.js.map} +1 -1
- package/client/assets/{ProtectedEditor-BvTFmv-F.js → ProtectedEditor-CsfvVyOU.js} +3 -3
- package/client/assets/ProtectedEditor-CsfvVyOU.js.br +0 -0
- package/client/assets/ProtectedEditor-CsfvVyOU.js.gz +0 -0
- package/client/assets/{ProtectedEditor-BvTFmv-F.js.map → ProtectedEditor-CsfvVyOU.js.map} +1 -1
- package/client/assets/{RundownExport-C_q3KYN_.js → RundownExport-25orDQIW.js} +2 -2
- package/client/assets/RundownExport-25orDQIW.js.br +0 -0
- package/client/assets/RundownExport-25orDQIW.js.gz +0 -0
- package/client/assets/{RundownExport-C_q3KYN_.js.map → RundownExport-25orDQIW.js.map} +1 -1
- package/client/assets/{Select-DQwYPDyI.js → Select-BnGTAeXJ.js} +2 -2
- package/client/assets/Select-BnGTAeXJ.js.br +0 -0
- package/client/assets/Select-BnGTAeXJ.js.gz +0 -0
- package/client/assets/{Select-DQwYPDyI.js.map → Select-BnGTAeXJ.js.map} +1 -1
- package/client/assets/{Studio-DzXTmBx4.js → Studio-BK2Klo_K.js} +2 -2
- package/client/assets/Studio-BK2Klo_K.js.br +0 -0
- package/client/assets/Studio-BK2Klo_K.js.gz +0 -0
- package/client/assets/{Studio-DzXTmBx4.js.map → Studio-BK2Klo_K.js.map} +1 -1
- package/client/assets/{StyleEditor-ClMEMaWh.js → StyleEditor-DIHQ1PUV.js} +2 -2
- package/client/assets/StyleEditor-DIHQ1PUV.js.br +0 -0
- package/client/assets/StyleEditor-DIHQ1PUV.js.gz +0 -0
- package/client/assets/{StyleEditor-ClMEMaWh.js.map → StyleEditor-DIHQ1PUV.js.map} +1 -1
- package/client/assets/{SuperscriptPeriod-CBiZU34J.js → SuperscriptPeriod-EEedc9rG.js} +2 -2
- package/client/assets/SuperscriptPeriod-EEedc9rG.js.br +0 -0
- package/client/assets/SuperscriptPeriod-EEedc9rG.js.gz +0 -0
- package/client/assets/{SuperscriptPeriod-CBiZU34J.js.map → SuperscriptPeriod-EEedc9rG.js.map} +1 -1
- package/client/assets/{SuperscriptTime-DP1CDlOX.js → SuperscriptTime-BVanhNvd.js} +2 -2
- package/client/assets/SuperscriptTime-BVanhNvd.js.br +0 -0
- package/client/assets/SuperscriptTime-BVanhNvd.js.gz +0 -0
- package/client/assets/{SuperscriptTime-DP1CDlOX.js.map → SuperscriptTime-BVanhNvd.js.map} +1 -1
- package/client/assets/{SwatchPicker-Dyxkxf3_.js → SwatchPicker-Ckpchvjo.js} +2 -2
- package/client/assets/SwatchPicker-Ckpchvjo.js.br +0 -0
- package/client/assets/SwatchPicker-Ckpchvjo.js.gz +0 -0
- package/client/assets/{SwatchPicker-Dyxkxf3_.js.map → SwatchPicker-Ckpchvjo.js.map} +1 -1
- package/client/assets/{TimeElements-pDYJeFbV.js → TimeElements-CYIgGk0T.js} +2 -2
- package/client/assets/TimeElements-CYIgGk0T.js.br +0 -0
- package/client/assets/TimeElements-CYIgGk0T.js.gz +0 -0
- package/client/assets/{TimeElements-pDYJeFbV.js.map → TimeElements-CYIgGk0T.js.map} +1 -1
- package/client/assets/{TimeInput-DTWDnaum.js → TimeInput-Cwl9vLWA.js} +2 -2
- package/client/assets/TimeInput-Cwl9vLWA.js.br +0 -0
- package/client/assets/TimeInput-Cwl9vLWA.js.gz +0 -0
- package/client/assets/{TimeInput-DTWDnaum.js.map → TimeInput-Cwl9vLWA.js.map} +1 -1
- package/client/assets/{TimelinePage-DbLt9rQi.js → TimelinePage-D4QNdk-Z.js} +2 -2
- package/client/assets/TimelinePage-D4QNdk-Z.js.br +0 -0
- package/client/assets/TimelinePage-D4QNdk-Z.js.gz +0 -0
- package/client/assets/{TimelinePage-DbLt9rQi.js.map → TimelinePage-D4QNdk-Z.js.map} +1 -1
- package/client/assets/{Timer-BfyVKQ8U.js → Timer-BJQKNHfo.js} +2 -2
- package/client/assets/Timer-BJQKNHfo.js.br +0 -0
- package/client/assets/Timer-BJQKNHfo.js.gz +0 -0
- package/client/assets/{Timer-BfyVKQ8U.js.map → Timer-BJQKNHfo.js.map} +1 -1
- package/client/assets/{TimerControlExport-BJfhJc07.js → TimerControlExport-Ba1vifNg.js} +2 -2
- package/client/assets/TimerControlExport-Ba1vifNg.js.br +0 -0
- package/client/assets/TimerControlExport-Ba1vifNg.js.gz +0 -0
- package/client/assets/{TimerControlExport-BJfhJc07.js.map → TimerControlExport-Ba1vifNg.js.map} +1 -1
- package/client/assets/{TimerDisplay-Dgmbqf65.js → TimerDisplay-tVcUk9j3.js} +2 -2
- package/client/assets/TimerDisplay-tVcUk9j3.js.br +0 -0
- package/client/assets/TimerDisplay-tVcUk9j3.js.gz +0 -0
- package/client/assets/{TimerDisplay-Dgmbqf65.js.map → TimerDisplay-tVcUk9j3.js.map} +1 -1
- package/client/assets/{TitleCard-MUurHeZ7.js → TitleCard-BNjv58eq.js} +2 -2
- package/client/assets/TitleCard-BNjv58eq.js.br +0 -0
- package/client/assets/TitleCard-BNjv58eq.js.gz +0 -0
- package/client/assets/{TitleCard-MUurHeZ7.js.map → TitleCard-BNjv58eq.js.map} +1 -1
- package/client/assets/{Tooltip-DXph8P8p.js → Tooltip-DZJ7u9gm.js} +2 -2
- package/client/assets/Tooltip-DZJ7u9gm.js.br +4 -0
- package/client/assets/Tooltip-DZJ7u9gm.js.gz +0 -0
- package/client/assets/{Tooltip-DXph8P8p.js.map → Tooltip-DZJ7u9gm.js.map} +1 -1
- package/client/assets/{ViewLogo-Ckp7i75x.js → ViewLogo-2I7w5Yms.js} +2 -2
- package/client/assets/ViewLogo-2I7w5Yms.js.br +0 -0
- package/client/assets/ViewLogo-2I7w5Yms.js.gz +0 -0
- package/client/assets/{ViewLogo-Ckp7i75x.js.map → ViewLogo-2I7w5Yms.js.map} +1 -1
- package/client/assets/{ViewParamsEditor-Cxngd15h.js → ViewParamsEditor-BX2RM8sx.js} +2 -2
- package/client/assets/ViewParamsEditor-BX2RM8sx.js.br +0 -0
- package/client/assets/ViewParamsEditor-BX2RM8sx.js.gz +0 -0
- package/client/assets/{ViewParamsEditor-Cxngd15h.js.map → ViewParamsEditor-BX2RM8sx.js.map} +1 -1
- package/client/assets/{editorSettings-D4jfu68W.js → editorSettings-_x6YKRfR.js} +2 -2
- package/client/assets/editorSettings-_x6YKRfR.js.br +6 -0
- package/client/assets/editorSettings-_x6YKRfR.js.gz +0 -0
- package/client/assets/{editorSettings-D4jfu68W.js.map → editorSettings-_x6YKRfR.js.map} +1 -1
- package/client/assets/{getProgress-B9UANc25.js → getProgress-ZUTmCn_v.js} +2 -2
- package/client/assets/getProgress-ZUTmCn_v.js.br +0 -0
- package/client/assets/getProgress-ZUTmCn_v.js.gz +0 -0
- package/client/assets/{getProgress-B9UANc25.js.map → getProgress-ZUTmCn_v.js.map} +1 -1
- package/client/assets/{index-2lQ-45a9.js → index-Dm-4OTmY.js} +3 -3
- package/client/assets/index-Dm-4OTmY.js.br +0 -0
- package/client/assets/index-Dm-4OTmY.js.gz +0 -0
- package/client/assets/{index-2lQ-45a9.js.map → index-Dm-4OTmY.js.map} +1 -1
- package/client/assets/{offset-DAyBfv5b.js → offset-VthsmtrO.js} +2 -2
- package/client/assets/offset-VthsmtrO.js.br +0 -0
- package/client/assets/offset-VthsmtrO.js.gz +0 -0
- package/client/assets/{offset-DAyBfv5b.js.map → offset-VthsmtrO.js.map} +1 -1
- package/client/assets/{parseUserTime-WkVNjkkE.js → parseUserTime-sZbEBi61.js} +2 -2
- package/client/assets/parseUserTime-sZbEBi61.js.br +0 -0
- package/client/assets/parseUserTime-sZbEBi61.js.gz +0 -0
- package/client/assets/{parseUserTime-WkVNjkkE.js.map → parseUserTime-sZbEBi61.js.map} +1 -1
- package/client/assets/{playbackstate-znZk3SSJ.js → playbackstate-Dl_ZJABT.js} +2 -2
- package/client/assets/playbackstate-Dl_ZJABT.js.br +0 -0
- package/client/assets/playbackstate-Dl_ZJABT.js.gz +0 -0
- package/client/assets/{playbackstate-znZk3SSJ.js.map → playbackstate-Dl_ZJABT.js.map} +1 -1
- package/client/assets/{presentation.utils-CjjYs5II.js → presentation.utils-Z61KykAH.js} +2 -2
- package/client/assets/presentation.utils-Z61KykAH.js.br +0 -0
- package/client/assets/presentation.utils-Z61KykAH.js.gz +0 -0
- package/client/assets/{presentation.utils-CjjYs5II.js.map → presentation.utils-Z61KykAH.js.map} +1 -1
- package/client/assets/{rundownUtils-BTQ3EeqN.js → rundownUtils-CXZRD6yP.js} +2 -2
- package/client/assets/rundownUtils-CXZRD6yP.js.br +0 -0
- package/client/assets/rundownUtils-CXZRD6yP.js.gz +0 -0
- package/client/assets/{rundownUtils-BTQ3EeqN.js.map → rundownUtils-CXZRD6yP.js.map} +1 -1
- package/client/assets/timer.utils-B4bvsns3.js +2 -0
- package/client/assets/timer.utils-B4bvsns3.js.br +0 -0
- package/client/assets/timer.utils-B4bvsns3.js.gz +0 -0
- package/client/assets/{timer.utils-B-Ui91P7.js.map → timer.utils-B4bvsns3.js.map} +1 -1
- package/client/assets/{useCustomFields-zr9SUl5o.js → useCustomFields-BBE4LBBr.js} +2 -2
- package/client/assets/useCustomFields-BBE4LBBr.js.br +0 -0
- package/client/assets/useCustomFields-BBE4LBBr.js.gz +0 -0
- package/client/assets/{useCustomFields-zr9SUl5o.js.map → useCustomFields-BBE4LBBr.js.map} +1 -1
- package/client/assets/{useEventSelection-B9mbj1cM.js → useEventSelection-Bpbu89c7.js} +2 -2
- package/client/assets/useEventSelection-Bpbu89c7.js.br +0 -0
- package/client/assets/useEventSelection-Bpbu89c7.js.gz +0 -0
- package/client/assets/{useEventSelection-B9mbj1cM.js.map → useEventSelection-Bpbu89c7.js.map} +1 -1
- package/client/assets/{useProjectData-DD_BQ9eJ.js → useProjectData-C110zIXC.js} +2 -2
- package/client/assets/useProjectData-C110zIXC.js.br +0 -0
- package/client/assets/useProjectData-C110zIXC.js.gz +0 -0
- package/client/assets/{useProjectData-DD_BQ9eJ.js.map → useProjectData-C110zIXC.js.map} +1 -1
- package/client/assets/{useReport-DozG5uz5.js → useReport-DqSBq4MG.js} +2 -2
- package/client/assets/useReport-DqSBq4MG.js.br +0 -0
- package/client/assets/useReport-DqSBq4MG.js.gz +0 -0
- package/client/assets/{useReport-DozG5uz5.js.map → useReport-DqSBq4MG.js.map} +1 -1
- package/client/assets/{useRundown-D6vokFHi.js → useRundown-DAo6huE4.js} +2 -2
- package/client/assets/useRundown-DAo6huE4.js.br +0 -0
- package/client/assets/useRundown-DAo6huE4.js.gz +0 -0
- package/client/assets/{useRundown-D6vokFHi.js.map → useRundown-DAo6huE4.js.map} +1 -1
- package/client/assets/{useSelectAndRevealEntry-Dd6MpVHe.js → useSelectAndRevealEntry-DTg0hmxA.js} +2 -2
- package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.br +0 -0
- package/client/assets/useSelectAndRevealEntry-DTg0hmxA.js.gz +0 -0
- package/client/assets/{useSelectAndRevealEntry-Dd6MpVHe.js.map → useSelectAndRevealEntry-DTg0hmxA.js.map} +1 -1
- package/client/assets/{useWindowTitle-bg-fLPOk.js → useWindowTitle-DM8dIp8L.js} +2 -2
- package/client/assets/useWindowTitle-DM8dIp8L.js.br +0 -0
- package/client/assets/useWindowTitle-DM8dIp8L.js.gz +0 -0
- package/client/assets/{useWindowTitle-bg-fLPOk.js.map → useWindowTitle-DM8dIp8L.js.map} +1 -1
- package/client/assets/{validateEvent-BUgLWn7x.js → validateEvent-GnPt-e9-.js} +2 -2
- package/client/assets/validateEvent-GnPt-e9-.js.br +0 -0
- package/client/assets/validateEvent-GnPt-e9-.js.gz +0 -0
- package/client/assets/{validateEvent-BUgLWn7x.js.map → validateEvent-GnPt-e9-.js.map} +1 -1
- package/client/assets/{vendor-CKDP5hij.js → vendor-BKUJ0_Du.js} +2 -2
- package/client/assets/vendor-BKUJ0_Du.js.br +0 -0
- package/client/assets/{vendor-CKDP5hij.js.gz → vendor-BKUJ0_Du.js.gz} +0 -0
- package/client/assets/{vendor-CKDP5hij.js.map → vendor-BKUJ0_Du.js.map} +1 -1
- package/client/assets/{viewLoader.utils-Bn5zu5sz.js → viewLoader.utils-4lL4PiNI.js} +2 -2
- package/client/assets/viewLoader.utils-4lL4PiNI.js.br +0 -0
- package/client/assets/viewLoader.utils-4lL4PiNI.js.gz +0 -0
- package/client/assets/{viewLoader.utils-Bn5zu5sz.js.map → viewLoader.utils-4lL4PiNI.js.map} +1 -1
- package/client/assets/{viewUtils-DQFwr7hm.js → viewUtils-29a3Mmiu.js} +2 -2
- package/client/assets/viewUtils-29a3Mmiu.js.br +0 -0
- package/client/assets/viewUtils-29a3Mmiu.js.gz +0 -0
- package/client/assets/{viewUtils-DQFwr7hm.js.map → viewUtils-29a3Mmiu.js.map} +1 -1
- package/client/index.html +2 -2
- package/package.json +1 -1
- package/server/index.cjs +1 -1
- package/client/assets/Backstage-BY9GL_rk.js.br +0 -0
- package/client/assets/Backstage-BY9GL_rk.js.gz +0 -0
- package/client/assets/Countdown-CXFgDHND.js.br +0 -0
- package/client/assets/Countdown-CXFgDHND.js.gz +0 -0
- package/client/assets/CuesheetTable-BLICUNky.js.br +0 -0
- package/client/assets/CuesheetTable-BLICUNky.js.gz +0 -0
- package/client/assets/CustomTranslationModal-4PVZBtkC.js.br +0 -0
- package/client/assets/CustomTranslationModal-4PVZBtkC.js.gz +0 -0
- package/client/assets/DelayIndicator-DUbpd6DG.js.br +0 -0
- package/client/assets/DelayIndicator-DUbpd6DG.js.gz +0 -0
- package/client/assets/EditorFeatureWrapper-CV_zaDoG.js.br +0 -0
- package/client/assets/EditorFeatureWrapper-CV_zaDoG.js.gz +0 -0
- package/client/assets/EditorUtils-CLBWDP4k.js.br +0 -0
- package/client/assets/EditorUtils-CLBWDP4k.js.gz +0 -0
- package/client/assets/EmptyPage-DmpOAg7R.js.br +0 -2
- package/client/assets/EmptyPage-DmpOAg7R.js.gz +0 -0
- package/client/assets/FollowButton-CAUWz5Ma.js.br +0 -0
- package/client/assets/FollowButton-CAUWz5Ma.js.gz +0 -0
- package/client/assets/MessageControlExport-Dm8IjSr4.js.br +0 -0
- package/client/assets/MessageControlExport-Dm8IjSr4.js.gz +0 -0
- package/client/assets/MultiPartProgressBar-Fp-sTN2u.js.br +0 -0
- package/client/assets/MultiPartProgressBar-Fp-sTN2u.js.gz +0 -0
- package/client/assets/OperatorExport-CE4ajLPS.js.br +0 -0
- package/client/assets/OperatorExport-CE4ajLPS.js.gz +0 -0
- package/client/assets/OverviewWrapper-BNnAIUP1.js.br +0 -0
- package/client/assets/OverviewWrapper-BNnAIUP1.js.gz +0 -0
- package/client/assets/PipHost-CbNFsfqp.js.br +0 -0
- package/client/assets/PipHost-CbNFsfqp.js.gz +0 -0
- package/client/assets/ProjectInfo-Bf5z4Xsv.js.br +0 -0
- package/client/assets/ProjectInfo-Bf5z4Xsv.js.gz +0 -0
- package/client/assets/ProtectRoute-CCHzyy0I.js.br +0 -0
- package/client/assets/ProtectRoute-CCHzyy0I.js.gz +0 -0
- package/client/assets/ProtectedCuesheet-COI1W_V3.js.br +0 -0
- package/client/assets/ProtectedCuesheet-COI1W_V3.js.gz +0 -0
- package/client/assets/ProtectedEditor-BvTFmv-F.js.br +0 -0
- package/client/assets/ProtectedEditor-BvTFmv-F.js.gz +0 -0
- package/client/assets/RundownExport-C_q3KYN_.js.br +0 -0
- package/client/assets/RundownExport-C_q3KYN_.js.gz +0 -0
- package/client/assets/Select-DQwYPDyI.js.br +0 -0
- package/client/assets/Select-DQwYPDyI.js.gz +0 -0
- package/client/assets/Studio-DzXTmBx4.js.br +0 -0
- package/client/assets/Studio-DzXTmBx4.js.gz +0 -0
- package/client/assets/StyleEditor-ClMEMaWh.js.br +0 -0
- package/client/assets/StyleEditor-ClMEMaWh.js.gz +0 -0
- package/client/assets/SuperscriptPeriod-CBiZU34J.js.br +0 -0
- package/client/assets/SuperscriptPeriod-CBiZU34J.js.gz +0 -0
- package/client/assets/SuperscriptTime-DP1CDlOX.js.br +0 -0
- package/client/assets/SuperscriptTime-DP1CDlOX.js.gz +0 -0
- package/client/assets/SwatchPicker-Dyxkxf3_.js.br +0 -0
- package/client/assets/SwatchPicker-Dyxkxf3_.js.gz +0 -0
- package/client/assets/TimeElements-pDYJeFbV.js.br +0 -0
- package/client/assets/TimeElements-pDYJeFbV.js.gz +0 -0
- package/client/assets/TimeInput-DTWDnaum.js.br +0 -0
- package/client/assets/TimeInput-DTWDnaum.js.gz +0 -0
- package/client/assets/TimelinePage-DbLt9rQi.js.br +0 -0
- package/client/assets/TimelinePage-DbLt9rQi.js.gz +0 -0
- package/client/assets/Timer-BfyVKQ8U.js.br +0 -0
- package/client/assets/Timer-BfyVKQ8U.js.gz +0 -0
- package/client/assets/TimerControlExport-BJfhJc07.js.br +0 -0
- package/client/assets/TimerControlExport-BJfhJc07.js.gz +0 -0
- package/client/assets/TimerDisplay-Dgmbqf65.js.br +0 -0
- package/client/assets/TimerDisplay-Dgmbqf65.js.gz +0 -0
- package/client/assets/TitleCard-MUurHeZ7.js.br +0 -0
- package/client/assets/TitleCard-MUurHeZ7.js.gz +0 -0
- package/client/assets/Tooltip-DXph8P8p.js.br +0 -0
- package/client/assets/Tooltip-DXph8P8p.js.gz +0 -0
- package/client/assets/ViewLogo-Ckp7i75x.js.br +0 -0
- package/client/assets/ViewLogo-Ckp7i75x.js.gz +0 -0
- package/client/assets/ViewParamsEditor-Cxngd15h.js.br +0 -0
- package/client/assets/ViewParamsEditor-Cxngd15h.js.gz +0 -0
- package/client/assets/editorSettings-D4jfu68W.js.br +0 -0
- package/client/assets/editorSettings-D4jfu68W.js.gz +0 -0
- package/client/assets/getProgress-B9UANc25.js.br +0 -0
- package/client/assets/getProgress-B9UANc25.js.gz +0 -0
- package/client/assets/index-2lQ-45a9.js.br +0 -0
- package/client/assets/index-2lQ-45a9.js.gz +0 -0
- package/client/assets/offset-DAyBfv5b.js.br +0 -4
- package/client/assets/offset-DAyBfv5b.js.gz +0 -0
- package/client/assets/parseUserTime-WkVNjkkE.js.br +0 -0
- package/client/assets/parseUserTime-WkVNjkkE.js.gz +0 -0
- package/client/assets/playbackstate-znZk3SSJ.js.br +0 -0
- package/client/assets/playbackstate-znZk3SSJ.js.gz +0 -0
- package/client/assets/presentation.utils-CjjYs5II.js.br +0 -0
- package/client/assets/presentation.utils-CjjYs5II.js.gz +0 -0
- package/client/assets/rundownUtils-BTQ3EeqN.js.br +0 -0
- package/client/assets/rundownUtils-BTQ3EeqN.js.gz +0 -0
- package/client/assets/timer.utils-B-Ui91P7.js +0 -2
- package/client/assets/timer.utils-B-Ui91P7.js.br +0 -0
- package/client/assets/timer.utils-B-Ui91P7.js.gz +0 -0
- package/client/assets/useCustomFields-zr9SUl5o.js.br +0 -0
- package/client/assets/useCustomFields-zr9SUl5o.js.gz +0 -0
- package/client/assets/useEventSelection-B9mbj1cM.js.br +0 -0
- package/client/assets/useEventSelection-B9mbj1cM.js.gz +0 -0
- package/client/assets/useProjectData-DD_BQ9eJ.js.br +0 -0
- package/client/assets/useProjectData-DD_BQ9eJ.js.gz +0 -0
- package/client/assets/useReport-DozG5uz5.js.br +0 -0
- package/client/assets/useReport-DozG5uz5.js.gz +0 -0
- package/client/assets/useRundown-D6vokFHi.js.br +0 -0
- package/client/assets/useRundown-D6vokFHi.js.gz +0 -0
- package/client/assets/useSelectAndRevealEntry-Dd6MpVHe.js.br +0 -0
- package/client/assets/useSelectAndRevealEntry-Dd6MpVHe.js.gz +0 -0
- package/client/assets/useWindowTitle-bg-fLPOk.js.br +0 -0
- package/client/assets/useWindowTitle-bg-fLPOk.js.gz +0 -0
- package/client/assets/validateEvent-BUgLWn7x.js.br +0 -0
- package/client/assets/validateEvent-BUgLWn7x.js.gz +0 -0
- package/client/assets/vendor-CKDP5hij.js.br +0 -0
- package/client/assets/viewLoader.utils-Bn5zu5sz.js.br +0 -0
- package/client/assets/viewLoader.utils-Bn5zu5sz.js.gz +0 -0
- package/client/assets/viewUtils-DQFwr7hm.js.br +0 -0
- package/client/assets/viewUtils-DQFwr7hm.js.gz +0 -0
package/server/index.cjs
CHANGED
|
@@ -261,7 +261,7 @@ content-type: ${U["content-type"]}\r
|
|
|
261
261
|
`),x.bookType=="fods"?_.push("</office:document>"):_.push("</office:document-content>"),_.join("")}}();function ZM(n,o){if(o.bookType=="fods")return KM(n,o);var s=_h(),l="",u=[],m=[];return l="mimetype",fr(s,l,"application/vnd.oasis.opendocument.spreadsheet"),l="content.xml",fr(s,l,KM(n,o)),u.push([l,"text/xml"]),m.push([l,"ContentFile"]),l="styles.xml",fr(s,l,Tue(n,o)),u.push([l,"text/xml"]),m.push([l,"StylesFile"]),l="meta.xml",fr(s,l,_a+a3()),u.push([l,"text/xml"]),m.push([l,"MetadataFile"]),l="manifest.rdf",fr(s,l,Ul(m)),u.push([l,"application/rdf+xml"]),l="META-INF/manifest.xml",fr(s,l,db(u)),s}function jd(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function yA(n){return typeof TextDecoder<"u"?new TextDecoder().decode(n):Er(Ut(n))}function Fue(n){return typeof TextEncoder<"u"?new TextEncoder().encode(n):Ve(Ts(n))}function Cue(n,o){e:for(var s=0;s<=n.length-o.length;++s){for(var l=0;l<o.length;++l)if(n[s+l]!=o[l])continue e;return!0}return!1}function ap(n){var o=n.reduce(function(u,m){return u+m.length},0),s=new Uint8Array(o),l=0;return n.forEach(function(u){s.set(u,l),l+=u.length}),s}function YM(n){return n-=n>>1&1431655765,n=(n&858993459)+(n>>2&858993459),(n+(n>>4)&252645135)*16843009>>>24}function kue(n,o){for(var s=(n[o+15]&127)<<7|n[o+14]>>1,l=n[o+14]&1,u=o+13;u>=o;--u)l=l*256+n[u];return(n[o+15]&128?-l:l)*Math.pow(10,s-6176)}function Oue(n,o,s){var l=Math.floor(s==0?0:Math.LOG10E*Math.log(Math.abs(s)))+6176-20,u=s/Math.pow(10,l-6176);n[o+15]|=l>>7,n[o+14]|=(l&127)<<1;for(var m=0;u>=1;++m,u/=256)n[o+m]=u&255;n[o+15]|=s>=0?0:128}function X2(n,o){var s=o?o[0]:0,l=n[s]&127;e:if(n[s++]>=128&&(l|=(n[s]&127)<<7,n[s++]<128||(l|=(n[s]&127)<<14,n[s++]<128)||(l|=(n[s]&127)<<21,n[s++]<128)||(l+=(n[s]&127)*Math.pow(2,28),++s,n[s++]<128)||(l+=(n[s]&127)*Math.pow(2,35),++s,n[s++]<128)||(l+=(n[s]&127)*Math.pow(2,42),++s,n[s++]<128)))break e;return o&&(o[0]=s),l}function aa(n){var o=new Uint8Array(7);o[0]=n&127;var s=1;e:if(n>127){if(o[s-1]|=128,o[s]=n>>7&127,++s,n<=16383||(o[s-1]|=128,o[s]=n>>14&127,++s,n<=2097151)||(o[s-1]|=128,o[s]=n>>21&127,++s,n<=268435455)||(o[s-1]|=128,o[s]=n/256>>>21&127,++s,n<=34359738367)||(o[s-1]|=128,o[s]=n/65536>>>21&127,++s,n<=4398046511103))break e;o[s-1]|=128,o[s]=n/16777216>>>21&127,++s}return o.slice(0,s)}function Va(n){var o=0,s=n[o]&127;e:if(n[o++]>=128){if(s|=(n[o]&127)<<7,n[o++]<128||(s|=(n[o]&127)<<14,n[o++]<128)||(s|=(n[o]&127)<<21,n[o++]<128))break e;s|=(n[o]&127)<<28}return s}function Yr(n){for(var o=[],s=[0];s[0]<n.length;){var l=s[0],u=X2(n,s),m=u&7;u=Math.floor(u/8);var g=0,x;if(u==0)break;switch(m){case 0:{for(var _=s[0];n[s[0]++]>=128;);x=n.slice(_,s[0])}break;case 5:g=4,x=n.slice(s[0],s[0]+g),s[0]+=g;break;case 1:g=8,x=n.slice(s[0],s[0]+g),s[0]+=g;break;case 2:g=X2(n,s),x=n.slice(s[0],s[0]+g),s[0]+=g;break;case 3:case 4:default:throw new Error("PB Type ".concat(m," for Field ").concat(u," at offset ").concat(l))}var S={data:x,type:m};o[u]==null?o[u]=[S]:o[u].push(S)}return o}function Hn(n){var o=[];return n.forEach(function(s,l){s.forEach(function(u){u.data&&(o.push(aa(l*8+u.type)),u.type==2&&o.push(aa(u.data.length)),o.push(u.data))})}),ap(o)}function wA(n,o){return n?.map(function(s){return o(s.data)})||[]}function lo(n){for(var o,s=[],l=[0];l[0]<n.length;){var u=X2(n,l),m=Yr(n.slice(l[0],l[0]+u));l[0]+=u;var g={id:Va(m[1][0].data),messages:[]};m[2].forEach(function(x){var _=Yr(x.data),S=Va(_[3][0].data);g.messages.push({meta:_,data:n.slice(l[0],l[0]+S)}),l[0]+=S}),(o=m[3])!=null&&o[0]&&(g.merge=Va(m[3][0].data)>>>0>0),s.push(g)}return s}function Zf(n){var o=[];return n.forEach(function(s){var l=[];l[1]=[{data:aa(s.id),type:0}],l[2]=[],s.merge!=null&&(l[3]=[{data:aa(+!!s.merge),type:0}]);var u=[];s.messages.forEach(function(g){u.push(g.data),g.meta[3]=[{type:0,data:aa(g.data.length)}],l[2].push({data:Hn(g.meta),type:2})});var m=Hn(l);o.push(aa(m.length)),o.push(m),u.forEach(function(g){return o.push(g)})}),ap(o)}function Rue(n,o){if(n!=0)throw new Error("Unexpected Snappy chunk type ".concat(n));for(var s=[0],l=X2(o,s),u=[];s[0]<o.length;){var m=o[s[0]]&3;if(m==0){var g=o[s[0]++]>>2;if(g<60)++g;else{var x=g-59;g=o[s[0]],x>1&&(g|=o[s[0]+1]<<8),x>2&&(g|=o[s[0]+2]<<16),x>3&&(g|=o[s[0]+3]<<24),g>>>=0,g++,s[0]+=x}u.push(o.slice(s[0],s[0]+g)),s[0]+=g;continue}else{var _=0,S=0;if(m==1?(S=(o[s[0]]>>2&7)+4,_=(o[s[0]++]&224)<<3,_|=o[s[0]++]):(S=(o[s[0]++]>>2)+1,m==2?(_=o[s[0]]|o[s[0]+1]<<8,s[0]+=2):(_=(o[s[0]]|o[s[0]+1]<<8|o[s[0]+2]<<16|o[s[0]+3]<<24)>>>0,s[0]+=4)),u=[ap(u)],_==0)throw new Error("Invalid offset 0");if(_>u[0].length)throw new Error("Invalid offset beyond length");if(S>=_)for(u.push(u[0].slice(-_)),S-=_;S>=u[u.length-1].length;)u.push(u[u.length-1]),S-=u[u.length-1].length;u.push(u[0].slice(-_,-_+S))}}var A=ap(u);if(A.length!=l)throw new Error("Unexpected length: ".concat(A.length," != ").concat(l));return A}function uo(n){for(var o=[],s=0;s<n.length;){var l=n[s++],u=n[s]|n[s+1]<<8|n[s+2]<<16;s+=3,o.push(Rue(l,n.slice(s,s+u))),s+=u}if(s!==n.length)throw new Error("data is not a valid framed stream!");return ap(o)}function Yf(n){for(var o=[],s=0;s<n.length;){var l=Math.min(n.length-s,268435455),u=new Uint8Array(4);o.push(u);var m=aa(l),g=m.length;o.push(m),l<=60?(g++,o.push(new Uint8Array([l-1<<2]))):l<=256?(g+=2,o.push(new Uint8Array([240,l-1&255]))):l<=65536?(g+=3,o.push(new Uint8Array([244,l-1&255,l-1>>8&255]))):l<=16777216?(g+=4,o.push(new Uint8Array([248,l-1&255,l-1>>8&255,l-1>>16&255]))):l<=4294967296&&(g+=5,o.push(new Uint8Array([252,l-1&255,l-1>>8&255,l-1>>16&255,l-1>>>24&255]))),o.push(n.slice(s,s+l)),g+=l,u[0]=0,u[1]=g&255,u[2]=g>>8&255,u[3]=g>>16&255,s+=l}return ap(o)}function Due(n,o,s,l){var u=jd(n),m=u.getUint32(4,!0),g=(l>1?12:8)+YM(m&(l>1?3470:398))*4,x=-1,_=-1,S=NaN,A=new Date(2001,0,1);m&512&&(x=u.getUint32(g,!0),g+=4),g+=YM(m&(l>1?12288:4096))*4,m&16&&(_=u.getUint32(g,!0),g+=4),m&32&&(S=u.getFloat64(g,!0),g+=8),m&64&&(A.setTime(A.getTime()+u.getFloat64(g,!0)*1e3),g+=8);var R;switch(n[2]){case 0:break;case 2:R={t:"n",v:S};break;case 3:R={t:"s",v:o[_]};break;case 5:R={t:"d",v:A};break;case 6:R={t:"b",v:S>0};break;case 7:R={t:"n",v:S/86400};break;case 8:R={t:"e",v:0};break;case 9:if(x>-1)R={t:"s",v:s[x]};else if(_>-1)R={t:"s",v:o[_]};else if(!isNaN(S))R={t:"n",v:S};else throw new Error("Unsupported cell type ".concat(n.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(n.slice(0,4)))}return R}function Pue(n,o,s){var l=jd(n),u=l.getUint32(8,!0),m=12,g=-1,x=-1,_=NaN,S=NaN,A=new Date(2001,0,1);u&1&&(_=kue(n,m),m+=16),u&2&&(S=l.getFloat64(m,!0),m+=8),u&4&&(A.setTime(A.getTime()+l.getFloat64(m,!0)*1e3),m+=8),u&8&&(x=l.getUint32(m,!0),m+=4),u&16&&(g=l.getUint32(m,!0),m+=4);var R;switch(n[1]){case 0:break;case 2:R={t:"n",v:_};break;case 3:R={t:"s",v:o[x]};break;case 5:R={t:"d",v:A};break;case 6:R={t:"b",v:S>0};break;case 7:R={t:"n",v:S/86400};break;case 8:R={t:"e",v:0};break;case 9:if(g>-1)R={t:"s",v:s[g]};else throw new Error("Unsupported cell type ".concat(n[1]," : ").concat(u&31," : ").concat(n.slice(0,4)));break;case 10:R={t:"n",v:_};break;default:throw new Error("Unsupported cell type ".concat(n[1]," : ").concat(u&31," : ").concat(n.slice(0,4)))}return R}function bA(n,o){var s=new Uint8Array(32),l=jd(s),u=12,m=0;switch(s[0]=5,n.t){case"n":s[1]=2,Oue(s,u,n.v),m|=1,u+=16;break;case"b":s[1]=6,l.setFloat64(u,n.v?1:0,!0),m|=2,u+=8;break;case"s":if(o.indexOf(n.v)==-1)throw new Error("Value ".concat(n.v," missing from SST!"));s[1]=3,l.setUint32(u,o.indexOf(n.v),!0),m|=8,u+=4;break;default:throw"unsupported cell type "+n.t}return l.setUint32(8,m,!0),s.slice(0,u)}function _A(n,o){var s=new Uint8Array(32),l=jd(s),u=12,m=0;switch(s[0]=3,n.t){case"n":s[2]=2,l.setFloat64(u,n.v,!0),m|=32,u+=8;break;case"b":s[2]=6,l.setFloat64(u,n.v?1:0,!0),m|=32,u+=8;break;case"s":if(o.indexOf(n.v)==-1)throw new Error("Value ".concat(n.v," missing from SST!"));s[2]=3,l.setUint32(u,o.indexOf(n.v),!0),m|=16,u+=4;break;default:throw"unsupported cell type "+n.t}return l.setUint32(4,m,!0),s.slice(0,u)}function Iue(n,o,s){switch(n[0]){case 0:case 1:case 2:case 3:return Due(n,o,s,n[0]);case 5:return Pue(n,o,s);default:throw new Error("Unsupported payload version ".concat(n[0]))}}function Fi(n){var o=Yr(n);return X2(o[1][0].data)}function xje(n){var o=[];return o[1]=[{type:0,data:aa(n)}],Hn(o)}function XM(n,o){var s=Yr(o.data),l=Va(s[1][0].data),u=s[3],m=[];return(u||[]).forEach(function(g){var x=Yr(g.data),_=Va(x[1][0].data)>>>0;switch(l){case 1:m[_]=yA(x[3][0].data);break;case 8:{var S=n[Fi(x[9][0].data)][0],A=Yr(S.data),R=n[Fi(A[1][0].data)][0],P=Va(R.meta[1][0].data);if(P!=2001)throw new Error("2000 unexpected reference to ".concat(P));var I=Yr(R.data);m[_]=I[3].map(function(M){return yA(M.data)}).join("")}break}}),m}function Nue(n,o){var s,l,u,m,g,x,_,S,A,R,P,I,M,O,B=Yr(n),Y=Va(B[1][0].data)>>>0,X=Va(B[2][0].data)>>>0,G=((l=(s=B[8])==null?void 0:s[0])==null?void 0:l.data)&&Va(B[8][0].data)>0||!1,Ee,Re;if((m=(u=B[7])==null?void 0:u[0])!=null&&m.data&&o!=0)Ee=(x=(g=B[7])==null?void 0:g[0])==null?void 0:x.data,Re=(S=(_=B[6])==null?void 0:_[0])==null?void 0:S.data;else if((R=(A=B[4])==null?void 0:A[0])!=null&&R.data&&o!=1)Ee=(I=(P=B[4])==null?void 0:P[0])==null?void 0:I.data,Re=(O=(M=B[3])==null?void 0:M[0])==null?void 0:O.data;else throw"NUMBERS Tile missing ".concat(o," cell storage");for(var xe=G?4:1,re=jd(Ee),Fe=[],_e=0;_e<Ee.length/2;++_e){var je=re.getUint16(_e*2,!0);je<65535&&Fe.push([_e,je])}if(Fe.length!=X)throw"Expected ".concat(X," cells, found ").concat(Fe.length);var qe=[];for(_e=0;_e<Fe.length-1;++_e)qe[Fe[_e][0]]=Re.subarray(Fe[_e][1]*xe,Fe[_e+1][1]*xe);return Fe.length>=1&&(qe[Fe[Fe.length-1][0]]=Re.subarray(Fe[Fe.length-1][1]*xe)),{R:Y,cells:qe}}function Mue(n,o){var s,l=Yr(o.data),u=(s=l?.[7])!=null&&s[0]?Va(l[7][0].data)>>>0>0?1:0:-1,m=wA(l[5],function(g){return Nue(g,u)});return{nrows:Va(l[4][0].data)>>>0,data:m.reduce(function(g,x){return g[x.R]||(g[x.R]=[]),x.cells.forEach(function(_,S){if(g[x.R][S])throw new Error("Duplicate cell r=".concat(x.R," c=").concat(S));g[x.R][S]=_}),g},[])}}function Lue(n,o,s){var l,u=Yr(o.data),m={s:{r:0,c:0},e:{r:0,c:0}};if(m.e.r=(Va(u[6][0].data)>>>0)-1,m.e.r<0)throw new Error("Invalid row varint ".concat(u[6][0].data));if(m.e.c=(Va(u[7][0].data)>>>0)-1,m.e.c<0)throw new Error("Invalid col varint ".concat(u[7][0].data));s["!ref"]=or(m);var g=Yr(u[4][0].data),x=XM(n,n[Fi(g[4][0].data)][0]),_=(l=g[17])!=null&&l[0]?XM(n,n[Fi(g[17][0].data)][0]):[],S=Yr(g[3][0].data),A=0;S[1].forEach(function(R){var P=Yr(R.data),I=n[Fi(P[2][0].data)][0],M=Va(I.meta[1][0].data);if(M!=6002)throw new Error("6001 unexpected reference to ".concat(M));var O=Mue(n,I);O.data.forEach(function(B,Y){B.forEach(function(X,G){var Ee=er({r:A+Y,c:G}),Re=Iue(X,x,_);Re&&(s[Ee]=Re)})}),A+=O.nrows})}function Bue(n,o){var s=Yr(o.data),l={"!ref":"A1"},u=n[Fi(s[2][0].data)],m=Va(u[0].meta[1][0].data);if(m!=6001)throw new Error("6000 unexpected reference to ".concat(m));return Lue(n,u[0],l),l}function Uue(n,o){var s,l=Yr(o.data),u={name:(s=l[1])!=null&&s[0]?yA(l[1][0].data):"",sheets:[]},m=wA(l[2],Fi);return m.forEach(function(g){n[g].forEach(function(x){var _=Va(x.meta[1][0].data);_==6e3&&u.sheets.push(Bue(n,x))})}),u}function jue(n,o){var s=RA(),l=Yr(o.data),u=wA(l[1],Fi);if(u.forEach(function(m){n[m].forEach(function(g){var x=Va(g.meta[1][0].data);if(x==2){var _=Uue(n,g);_.sheets.forEach(function(S,A){DA(s,S,A==0?_.name:_.name+"_"+A,!0)})}})}),s.SheetNames.length==0)throw new Error("Empty NUMBERS file");return s}function EA(n){var o,s,l,u,m={},g=[];if(n.FullPaths.forEach(function(_){if(_.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),n.FileIndex.forEach(function(_){if(_.name.match(/\.iwa$/)){var S;try{S=uo(_.content)}catch(R){return console.log("?? "+_.content.length+" "+(R.message||R))}var A;try{A=lo(S)}catch(R){return console.log("## "+(R.message||R))}A.forEach(function(R){m[R.id]=R.messages,g.push(R.id)})}}),!g.length)throw new Error("File has no messages");var x=((u=(l=(s=(o=m?.[1])==null?void 0:o[0])==null?void 0:s.meta)==null?void 0:l[1])==null?void 0:u[0].data)&&Va(m[1][0].meta[1][0].data)==1&&m[1][0];if(x||g.forEach(function(_){m[_].forEach(function(S){var A=Va(S.meta[1][0].data)>>>0;if(A==1)if(!x)x=S;else throw new Error("Document has multiple roots")})}),!x)throw new Error("Cannot find Document root");return jue(m,x)}function que(n,o,s){var l,u,m,g;if(!((l=n[6])!=null&&l[0])||!((u=n[7])!=null&&u[0]))throw"Mutation only works on post-BNC storages!";var x=((g=(m=n[8])==null?void 0:m[0])==null?void 0:g.data)&&Va(n[8][0].data)>0||!1;if(x)throw"Math only works with normal offsets";for(var _=0,S=jd(n[7][0].data),A=0,R=[],P=jd(n[4][0].data),I=0,M=[],O=0;O<o.length;++O){if(o[O]==null){S.setUint16(O*2,65535,!0),P.setUint16(O*2,65535);continue}S.setUint16(O*2,A,!0),P.setUint16(O*2,I,!0);var B,Y;switch(typeof o[O]){case"string":B=bA({t:"s",v:o[O]},s),Y=_A({t:"s",v:o[O]},s);break;case"number":B=bA({t:"n",v:o[O]},s),Y=_A({t:"n",v:o[O]},s);break;case"boolean":B=bA({t:"b",v:o[O]},s),Y=_A({t:"b",v:o[O]},s);break;default:throw new Error("Unsupported value "+o[O])}R.push(B),A+=B.length,M.push(Y),I+=Y.length,++_}for(n[2][0].data=aa(_);O<n[7][0].data.length/2;++O)S.setUint16(O*2,65535,!0),P.setUint16(O*2,65535,!0);return n[6][0].data=ap(R),n[3][0].data=ap(M),_}function $ue(n,o){if(!o||!o.numbers)throw new Error("Must pass a `numbers` option -- check the README");var s=n.Sheets[n.SheetNames[0]];n.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var l=pa(s["!ref"]);l.s.r=l.s.c=0;var u=!1;l.e.c>9&&(u=!0,l.e.c=9),l.e.r>49&&(u=!0,l.e.r=49),u&&console.error("The Numbers writer is currently limited to ".concat(or(l)));var m=X8(s,{range:l,header:1}),g=["~Sh33tJ5~"];m.forEach(function(le){return le.forEach(function(ce){typeof ce=="string"&&g.push(ce)})});var x={},_=[],S=$t.read(o.numbers,{type:"base64"});S.FileIndex.map(function(le,ce){return[le,S.FullPaths[ce]]}).forEach(function(le){var ce=le[0],ze=le[1];if(ce.type==2&&ce.name.match(/\.iwa/)){var wt=ce.content,pt=uo(wt),dt=lo(pt);dt.forEach(function(rt){_.push(rt.id),x[rt.id]={deps:[],location:ze,type:Va(rt.messages[0].meta[1][0].data)}})}}),_.sort(function(le,ce){return le-ce});var A=_.filter(function(le){return le>1}).map(function(le){return[le,aa(le)]});S.FileIndex.map(function(le,ce){return[le,S.FullPaths[ce]]}).forEach(function(le){var ce=le[0],ze=le[1];if(ce.name.match(/\.iwa/)){var wt=lo(uo(ce.content));wt.forEach(function(pt){pt.messages.forEach(function(dt){A.forEach(function(rt){pt.messages.some(function(br){return Va(br.meta[1][0].data)!=11006&&Cue(br.data,rt[1])})&&x[rt[0]].deps.push(pt.id)})})})}});function R(){for(var le=927262;le<2e6;++le)if(!x[le])return le;throw new Error("Too many messages")}for(var P=$t.find(S,x[1].location),I=lo(uo(P.content)),M,O=0;O<I.length;++O){var B=I[O];B.id==1&&(M=B)}var Y=Fi(Yr(M.messages[0].data)[1][0].data);for(P=$t.find(S,x[Y].location),I=lo(uo(P.content)),O=0;O<I.length;++O)B=I[O],B.id==Y&&(M=B);for(Y=Fi(Yr(M.messages[0].data)[2][0].data),P=$t.find(S,x[Y].location),I=lo(uo(P.content)),O=0;O<I.length;++O)B=I[O],B.id==Y&&(M=B);for(Y=Fi(Yr(M.messages[0].data)[2][0].data),P=$t.find(S,x[Y].location),I=lo(uo(P.content)),O=0;O<I.length;++O)B=I[O],B.id==Y&&(M=B);var X=Yr(M.messages[0].data);{X[6][0].data=aa(l.e.r+1),X[7][0].data=aa(l.e.c+1);var G=Fi(X[46][0].data),Ee=$t.find(S,x[G].location),Re=lo(uo(Ee.content));{for(var xe=0;xe<Re.length&&Re[xe].id!=G;++xe);if(Re[xe].id!=G)throw"Bad ColumnRowUIDMapArchive";var re=Yr(Re[xe].messages[0].data);re[1]=[],re[2]=[],re[3]=[];for(var Fe=0;Fe<=l.e.c;++Fe){var _e=[];_e[1]=_e[2]=[{type:0,data:aa(Fe+420690)}],re[1].push({type:2,data:Hn(_e)}),re[2].push({type:0,data:aa(Fe)}),re[3].push({type:0,data:aa(Fe)})}re[4]=[],re[5]=[],re[6]=[];for(var je=0;je<=l.e.r;++je)_e=[],_e[1]=_e[2]=[{type:0,data:aa(je+726270)}],re[4].push({type:2,data:Hn(_e)}),re[5].push({type:0,data:aa(je)}),re[6].push({type:0,data:aa(je)});Re[xe].messages[0].data=Hn(re)}Ee.content=Yf(Zf(Re)),Ee.size=Ee.content.length,delete X[46];var qe=Yr(X[4][0].data);{qe[7][0].data=aa(l.e.r+1);var Ce=Yr(qe[1][0].data),ft=Fi(Ce[2][0].data);Ee=$t.find(S,x[ft].location),Re=lo(uo(Ee.content));{if(Re[0].id!=ft)throw"Bad HeaderStorageBucket";var Rt=Yr(Re[0].messages[0].data);for(je=0;je<m.length;++je){var mt=Yr(Rt[2][0].data);mt[1][0].data=aa(je),mt[4][0].data=aa(m[je].length),Rt[2][je]={type:Rt[2][0].type,data:Hn(mt)}}Re[0].messages[0].data=Hn(Rt)}Ee.content=Yf(Zf(Re)),Ee.size=Ee.content.length;var Gt=Fi(qe[2][0].data);Ee=$t.find(S,x[Gt].location),Re=lo(uo(Ee.content));{if(Re[0].id!=Gt)throw"Bad HeaderStorageBucket";for(Rt=Yr(Re[0].messages[0].data),Fe=0;Fe<=l.e.c;++Fe)mt=Yr(Rt[2][0].data),mt[1][0].data=aa(Fe),mt[4][0].data=aa(l.e.r+1),Rt[2][Fe]={type:Rt[2][0].type,data:Hn(mt)};Re[0].messages[0].data=Hn(Rt)}Ee.content=Yf(Zf(Re)),Ee.size=Ee.content.length;var Nt=Fi(qe[4][0].data);(function(){for(var le=$t.find(S,x[Nt].location),ce=lo(uo(le.content)),ze,wt=0;wt<ce.length;++wt){var pt=ce[wt];pt.id==Nt&&(ze=pt)}var dt=Yr(ze.messages[0].data);{dt[3]=[];var rt=[];g.forEach(function(ca,Mr){rt[1]=[{type:0,data:aa(Mr)}],rt[2]=[{type:0,data:aa(1)}],rt[3]=[{type:2,data:Fue(ca)}],dt[3].push({type:2,data:Hn(rt)})})}ze.messages[0].data=Hn(dt);var br=Zf(ce),ie=Yf(br);le.content=ie,le.size=le.content.length})();var Dr=Yr(qe[3][0].data);{var Et=Dr[1][0];delete Dr[2];var jt=Yr(Et.data);{var et=Fi(jt[2][0].data);(function(){for(var le=$t.find(S,x[et].location),ce=lo(uo(le.content)),ze,wt=0;wt<ce.length;++wt){var pt=ce[wt];pt.id==et&&(ze=pt)}var dt=Yr(ze.messages[0].data);{delete dt[6],delete Dr[7];var rt=new Uint8Array(dt[5][0].data);dt[5]=[];for(var br=0,ie=0;ie<=l.e.r;++ie){var ca=Yr(rt);br+=que(ca,m[ie],g),ca[1][0].data=aa(ie),dt[5].push({data:Hn(ca),type:2})}dt[1]=[{type:0,data:aa(l.e.c+1)}],dt[2]=[{type:0,data:aa(l.e.r+1)}],dt[3]=[{type:0,data:aa(br)}],dt[4]=[{type:0,data:aa(l.e.r+1)}]}ze.messages[0].data=Hn(dt);var Mr=Zf(ce),la=Yf(Mr);le.content=la,le.size=le.content.length})()}Et.data=Hn(jt)}qe[3][0].data=Hn(Dr)}X[4][0].data=Hn(qe)}M.messages[0].data=Hn(X);var se=Zf(I),Me=Yf(se);return P.content=Me,P.size=P.content.length,S}function JM(n){return function(s){for(var l=0;l!=n.length;++l){var u=n[l];s[u[0]]===void 0&&(s[u[0]]=u[1]),u[2]==="n"&&(s[u[0]]=Number(s[u[0]]))}}}function SA(n){JM([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(n)}function AA(n){JM([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(n)}function Vue(n){return hr.WS.indexOf(n)>-1?"sheet":hr.CS&&n==hr.CS?"chart":hr.DS&&n==hr.DS?"dialog":hr.MS&&n==hr.MS?"macro":n&&n.length?n:"sheet"}function Hue(n,o){if(!n)return 0;try{n=o.map(function(l){return l.id||(l.id=l.strRelID),[l.name,n["!id"][l.id].Target,Vue(n["!id"][l.id].Type)]})}catch{return null}return!n||n.length===0?null:n}function Wue(n,o,s,l,u,m,g,x,_,S,A,R){try{m[l]=wd(yi(n,s,!0),o);var P=ja(n,o),I;switch(x){case"sheet":I=gle(P,o,u,_,m[l],S,A,R);break;case"chart":if(I=xle(P,o,u,_,m[l],S,A,R),!I||!I["!drawel"])break;var M=nd(I["!drawel"].Target,o),O=yd(M),B=fE(yi(n,M,!0),wd(yi(n,O,!0),M)),Y=nd(B,M),X=yd(Y);I=Hce(yi(n,Y,!0),Y,_,wd(yi(n,X,!0),Y),S,I);break;case"macro":I=yle(P,o,u,_,m[l],S,A,R);break;case"dialog":I=wle(P,o,u,_,m[l],S,A,R);break;default:throw new Error("Unrecognized sheet type "+x)}g[l]=I;var G=[];m&&m[l]&&ka(m[l]).forEach(function(Ee){var Re="";if(m[l][Ee].Type==hr.CMNT){Re=nd(m[l][Ee].Target,o);var xe=Sle(ja(n,Re,!0),Re,_);if(!xe||!xe.length)return;_8(I,xe,!1)}m[l][Ee].Type==hr.TCMNT&&(Re=nd(m[l][Ee].Target,o),G=G.concat(hE(ja(n,Re,!0),_)))}),G&&G.length&&_8(I,G,!0,_.people||[])}catch(Ee){if(_.WTF)throw Ee}}function po(n){return n.charAt(0)=="/"?n.slice(1):n}function QM(n,o){if(ku(),o=o||{},SA(o),Li(n,"META-INF/manifest.xml")||Li(n,"objectdata.xml"))return GM(n,o);if(Li(n,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof EA<"u"){if(n.FileIndex)return EA(n);var s=$t.utils.cfb_new();return bh(n).forEach(function(Rt){fr(s,Rt,wh(n,Rt))}),EA(s)}throw new Error("Unsupported NUMBERS file")}if(!Li(n,"[Content_Types].xml"))throw Li(n,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Li(n,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var l=bh(n),u=zo(yi(n,"[Content_Types].xml")),m=!1,g,x;if(u.workbooks.length===0&&(x="xl/workbook.xml",ja(n,x,!0)&&u.workbooks.push(x)),u.workbooks.length===0){if(x="xl/workbook.bin",!ja(n,x,!0))throw new Error("Could not find workbook");u.workbooks.push(x),m=!0}u.workbooks[0].slice(-3)=="bin"&&(m=!0);var _={},S={};if(!o.bookSheets&&!o.bookProps){if(Bd=[],u.sst)try{Bd=Ele(ja(n,po(u.sst)),u.sst,o)}catch(Rt){if(o.WTF)throw Rt}o.cellStyles&&u.themes.length&&(_=_le(yi(n,u.themes[0].replace(/^\//,""),!0)||"",u.themes[0],o)),u.style&&(S=ble(ja(n,po(u.style)),u.style,_,o))}u.links.map(function(Rt){try{var mt=wd(yi(n,yd(po(Rt))),Rt);return Tle(ja(n,po(Rt)),mt,Rt,o)}catch{}});var A=vle(ja(n,po(u.workbooks[0])),u.workbooks[0],o),R={},P="";u.coreprops.length&&(P=ja(n,po(u.coreprops[0]),!0),P&&(R=n3(P)),u.extprops.length!==0&&(P=ja(n,po(u.extprops[0]),!0),P&&o3(P,R,o)));var I={};(!o.bookSheets||o.bookProps)&&u.custprops.length!==0&&(P=yi(n,po(u.custprops[0]),!0),P&&(I=$h(P,o)));var M={};if((o.bookSheets||o.bookProps)&&(A.Sheets?g=A.Sheets.map(function(mt){return mt.name}):R.Worksheets&&R.SheetNames.length>0&&(g=R.SheetNames),o.bookProps&&(M.Props=R,M.Custprops=I),o.bookSheets&&typeof g<"u"&&(M.SheetNames=g),o.bookSheets?M.SheetNames:o.bookProps))return M;g={};var O={};o.bookDeps&&u.calcchain&&(O=Ale(ja(n,po(u.calcchain)),u.calcchain,o));var B=0,Y={},X,G;{var Ee=A.Sheets;R.Worksheets=Ee.length,R.SheetNames=[];for(var Re=0;Re!=Ee.length;++Re)R.SheetNames[Re]=Ee[Re].name}var xe=m?"bin":"xml",re=u.workbooks[0].lastIndexOf("/"),Fe=(u.workbooks[0].slice(0,re+1)+"_rels/"+u.workbooks[0].slice(re+1)+".rels").replace(/^\//,"");Li(n,Fe)||(Fe="xl/_rels/workbook."+xe+".rels");var _e=wd(yi(n,Fe,!0),Fe.replace(/_rels.*/,"s5s"));(u.metadata||[]).length>=1&&(o.xlmeta=Fle(ja(n,po(u.metadata[0])),u.metadata[0],o)),(u.people||[]).length>=1&&(o.people=gE(ja(n,po(u.people[0])),o)),_e&&(_e=Hue(_e,A.Sheets));var je=ja(n,"xl/worksheets/sheet.xml",!0)?1:0;e:for(B=0;B!=R.Worksheets;++B){var qe="sheet";if(_e&&_e[B]?(X="xl/"+_e[B][1].replace(/[\/]?xl\//,""),Li(n,X)||(X=_e[B][1]),Li(n,X)||(X=Fe.replace(/_rels\/.*$/,"")+_e[B][1]),qe=_e[B][2]):(X="xl/worksheets/sheet"+(B+1-je)+"."+xe,X=X.replace(/sheet0\./,"sheet.")),G=X.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),o&&o.sheets!=null)switch(typeof o.sheets){case"number":if(B!=o.sheets)continue e;break;case"string":if(R.SheetNames[B].toLowerCase()!=o.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(o.sheets)){for(var Ce=!1,ft=0;ft!=o.sheets.length;++ft)typeof o.sheets[ft]=="number"&&o.sheets[ft]==B&&(Ce=1),typeof o.sheets[ft]=="string"&&o.sheets[ft].toLowerCase()==R.SheetNames[B].toLowerCase()&&(Ce=1);if(!Ce)continue e}}Wue(n,X,G,R.SheetNames[B],B,Y,g,qe,o,A,_,S)}return M={Directory:u,Workbook:A,Props:R,Custprops:I,Deps:O,Sheets:g,SheetNames:R.SheetNames,Strings:Bd,Styles:S,Themes:_,SSF:ia(q)},o&&o.bookFiles&&(n.files?(M.keys=l,M.files=n.files):(M.keys=[],M.files={},n.FullPaths.forEach(function(Rt,mt){Rt=Rt.replace(/^Root Entry[\/]/,""),M.keys.push(Rt),M.files[Rt]=n.FileIndex[mt]}))),o&&o.bookVBA&&(u.vba.length>0?M.vbaraw=ja(n,po(u.vba[0]),!0):u.defaults&&u.defaults.bin===SE&&(M.vbaraw=ja(n,"xl/vbaProject.bin",!0))),M}function Gue(n,o){var s=o||{},l="Workbook",u=$t.find(n,l);try{if(l="/!DataSpaces/Version",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);if(t_(u.content),l="/!DataSpaces/DataSpaceMap",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);var m=a_(u.content);if(m.length!==1||m[0].comps.length!==1||m[0].comps[0].t!==0||m[0].name!=="StrongEncryptionDataSpace"||m[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+l);if(l="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);var g=n_(u.content);if(g.length!=1||g[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+l);if(l="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);s_(u.content)}catch{}if(l="/EncryptionInfo",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);var x=o_(u.content);if(l="/EncryptedPackage",u=$t.find(n,l),!u||!u.content)throw new Error("ECMA-376 Encrypted file missing "+l);if(x[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(x[1],u.content,s.password||"",s);if(x[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(x[1],u.content,s.password||"",s);throw new Error("File is password-protected")}function zue(n,o){return o.bookType=="ods"?ZM(n,o):o.bookType=="numbers"?$ue(n,o):o.bookType=="xlsb"?Kue(n,o):eL(n,o)}function Kue(n,o){Kc=1024,n&&!n.SSF&&(n.SSF=ia(q)),n&&n.SSF&&(ku(),ed(n.SSF),o.revssf=rd(n.SSF),o.revssf[n.SSF[65535]]=0,o.ssf=n.SSF),o.rels={},o.wbrels={},o.Strings=[],o.Strings.Count=0,o.Strings.Unique=0,Ud?o.revStrings=new Map:(o.revStrings={},o.revStrings.foo=[],delete o.revStrings.foo);var s=o.bookType=="xlsb"?"bin":"xml",l=ur.indexOf(o.bookType)>-1,u=Uh();AA(o=o||{});var m=_h(),g="",x=0;if(o.cellXfs=[],ac(o.cellXfs,{},{revssf:{General:0}}),n.Props||(n.Props={}),g="docProps/core.xml",fr(m,g,i3(n.Props,o)),u.coreprops.push(g),Ar(o.rels,2,g,hr.CORE_PROPS),g="docProps/app.xml",!(n.Props&&n.Props.SheetNames))if(!n.Workbook||!n.Workbook.Sheets)n.Props.SheetNames=n.SheetNames;else{for(var _=[],S=0;S<n.SheetNames.length;++S)(n.Workbook.Sheets[S]||{}).Hidden!=2&&_.push(n.SheetNames[S]);n.Props.SheetNames=_}for(n.Props.Worksheets=n.Props.SheetNames.length,fr(m,g,c3(n.Props,o)),u.extprops.push(g),Ar(o.rels,3,g,hr.EXT_PROPS),n.Custprops!==n.Props&&ka(n.Custprops||{}).length>0&&(g="docProps/custom.xml",fr(m,g,Hu(n.Custprops,o)),u.custprops.push(g),Ar(o.rels,4,g,hr.CUST_PROPS)),x=1;x<=n.SheetNames.length;++x){var A={"!id":{}},R=n.Sheets[n.SheetNames[x-1]],P=(R||{})["!type"]||"sheet";switch(P){case"chart":default:g="xl/worksheets/sheet"+x+"."+s,fr(m,g,kle(x-1,g,o,n,A)),u.sheets.push(g),Ar(o.wbrels,-1,"worksheets/sheet"+x+"."+s,hr.WS[0])}if(R){var I=R["!comments"],M=!1,O="";I&&I.length>0&&(O="xl/comments"+x+"."+s,fr(m,O,Dle(I,O,o)),u.comments.push(O),Ar(A,-1,"../comments"+x+"."+s,hr.CMNT),M=!0),R["!legacy"]&&M&&fr(m,"xl/drawings/vmlDrawing"+x+".vml",k2(x,R["!comments"])),delete R["!comments"],delete R["!legacy"]}A["!id"].rId1&&fr(m,yd(g),Vu(A))}return o.Strings!=null&&o.Strings.length>0&&(g="xl/sharedStrings."+s,fr(m,g,Rle(o.Strings,g,o)),u.strs.push(g),Ar(o.wbrels,-1,"sharedStrings."+s,hr.SST)),g="xl/workbook."+s,fr(m,g,Cle(n,g,o)),u.workbooks.push(g),Ar(o.rels,1,g,hr.WB),g="xl/theme/theme1.xml",fr(m,g,T2(n.Themes,o)),u.themes.push(g),Ar(o.wbrels,-1,"theme/theme1.xml",hr.THEME),g="xl/styles."+s,fr(m,g,Ole(n,g,o)),u.styles.push(g),Ar(o.wbrels,-1,"styles."+s,hr.STY),n.vbaraw&&l&&(g="xl/vbaProject.bin",fr(m,g,n.vbaraw),u.vba.push(g),Ar(o.wbrels,-1,"vbaProject.bin",hr.VBA)),g="xl/metadata."+s,fr(m,g,Ple(g)),u.metadata.push(g),Ar(o.wbrels,-1,"metadata."+s,hr.XLMETA),fr(m,"[Content_Types].xml",t3(u,o)),fr(m,"_rels/.rels",Vu(o.rels)),fr(m,"xl/_rels/workbook."+s+".rels",Vu(o.wbrels)),delete o.revssf,delete o.ssf,m}function eL(n,o){Kc=1024,n&&!n.SSF&&(n.SSF=ia(q)),n&&n.SSF&&(ku(),ed(n.SSF),o.revssf=rd(n.SSF),o.revssf[n.SSF[65535]]=0,o.ssf=n.SSF),o.rels={},o.wbrels={},o.Strings=[],o.Strings.Count=0,o.Strings.Unique=0,Ud?o.revStrings=new Map:(o.revStrings={},o.revStrings.foo=[],delete o.revStrings.foo);var s="xml",l=ur.indexOf(o.bookType)>-1,u=Uh();AA(o=o||{});var m=_h(),g="",x=0;if(o.cellXfs=[],ac(o.cellXfs,{},{revssf:{General:0}}),n.Props||(n.Props={}),g="docProps/core.xml",fr(m,g,i3(n.Props,o)),u.coreprops.push(g),Ar(o.rels,2,g,hr.CORE_PROPS),g="docProps/app.xml",!(n.Props&&n.Props.SheetNames))if(!n.Workbook||!n.Workbook.Sheets)n.Props.SheetNames=n.SheetNames;else{for(var _=[],S=0;S<n.SheetNames.length;++S)(n.Workbook.Sheets[S]||{}).Hidden!=2&&_.push(n.SheetNames[S]);n.Props.SheetNames=_}n.Props.Worksheets=n.Props.SheetNames.length,fr(m,g,c3(n.Props,o)),u.extprops.push(g),Ar(o.rels,3,g,hr.EXT_PROPS),n.Custprops!==n.Props&&ka(n.Custprops||{}).length>0&&(g="docProps/custom.xml",fr(m,g,Hu(n.Custprops,o)),u.custprops.push(g),Ar(o.rels,4,g,hr.CUST_PROPS));var A=["SheetJ5"];for(o.tcid=0,x=1;x<=n.SheetNames.length;++x){var R={"!id":{}},P=n.Sheets[n.SheetNames[x-1]],I=(P||{})["!type"]||"sheet";switch(I){case"chart":default:g="xl/worksheets/sheet"+x+"."+s,fr(m,g,H8(x-1,o,n,R)),u.sheets.push(g),Ar(o.wbrels,-1,"worksheets/sheet"+x+"."+s,hr.WS[0])}if(P){var M=P["!comments"],O=!1,B="";if(M&&M.length>0){var Y=!1;M.forEach(function(X){X[1].forEach(function(G){G.T==!0&&(Y=!0)})}),Y&&(B="xl/threadedComments/threadedComment"+x+"."+s,fr(m,B,vE(M,A,o)),u.threadedcomments.push(B),Ar(R,-1,"../threadedComments/threadedComment"+x+"."+s,hr.TCMNT)),B="xl/comments"+x+"."+s,fr(m,B,E8(M,o)),u.comments.push(B),Ar(R,-1,"../comments"+x+"."+s,hr.CMNT),O=!0}P["!legacy"]&&O&&fr(m,"xl/drawings/vmlDrawing"+x+".vml",k2(x,P["!comments"])),delete P["!comments"],delete P["!legacy"]}R["!id"].rId1&&fr(m,yd(g),Vu(R))}return o.Strings!=null&&o.Strings.length>0&&(g="xl/sharedStrings."+s,fr(m,g,x2(o.Strings,o)),u.strs.push(g),Ar(o.wbrels,-1,"sharedStrings."+s,hr.SST)),g="xl/workbook."+s,fr(m,g,OM(n,o)),u.workbooks.push(g),Ar(o.rels,1,g,hr.WB),g="xl/theme/theme1.xml",fr(m,g,T2(n.Themes,o)),u.themes.push(g),Ar(o.wbrels,-1,"theme/theme1.xml",hr.THEME),g="xl/styles."+s,fr(m,g,c8(n,o)),u.styles.push(g),Ar(o.wbrels,-1,"styles."+s,hr.STY),n.vbaraw&&l&&(g="xl/vbaProject.bin",fr(m,g,n.vbaraw),u.vba.push(g),Ar(o.wbrels,-1,"vbaProject.bin",hr.VBA)),g="xl/metadata."+s,fr(m,g,b8()),u.metadata.push(g),Ar(o.wbrels,-1,"metadata."+s,hr.XLMETA),A.length>1&&(g="xl/persons/person.xml",fr(m,g,xE(A,o)),u.people.push(g),Ar(o.wbrels,-1,"persons/person.xml",hr.PEOPLE)),fr(m,"[Content_Types].xml",t3(u,o)),fr(m,"_rels/.rels",Vu(o.rels)),fr(m,"xl/_rels/workbook."+s+".rels",Vu(o.wbrels)),delete o.revssf,delete o.ssf,m}function TA(n,o){var s="";switch((o||{}).type||"base64"){case"buffer":return[n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]];case"base64":s=Ae(n.slice(0,12));break;case"binary":s=n;break;case"array":return[n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]];default:throw new Error("Unrecognized type "+(o&&o.type||"undefined"))}return[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3),s.charCodeAt(4),s.charCodeAt(5),s.charCodeAt(6),s.charCodeAt(7)]}function Zue(n,o){return $t.find(n,"EncryptedPackage")?Gue(n,o):z8(n,o)}function Yue(n,o){var s,l=n,u=o||{};return u.type||(u.type=pe&&Buffer.isBuffer(n)?"buffer":"base64"),s=Px(l,u),QM(s,u)}function tL(n,o){var s=0;e:for(;s<n.length;)switch(n.charCodeAt(s)){case 10:case 13:case 32:++s;break;case 60:return gA(n.slice(s),o);default:break e}return so.to_workbook(n,o)}function Xue(n,o){var s="",l=TA(n,o);switch(o.type){case"base64":s=Ae(n);break;case"binary":s=n;break;case"buffer":s=n.toString("binary");break;case"array":s=Dc(n);break;default:throw new Error("Unrecognized type "+o.type)}return l[0]==239&&l[1]==187&&l[2]==191&&(s=Er(s)),o.type="binary",tL(s,o)}function Jue(n,o){var s=n;return o.type=="base64"&&(s=Ae(s)),s=r.utils.decode(1200,s.slice(2),"str"),o.type="binary",tL(s,o)}function Que(n){return n.match(/[^\x00-\x7F]/)?Ts(n):n}function FA(n,o,s,l){return l?(s.type="string",so.to_workbook(n,s)):so.to_workbook(o,s)}function K8(n,o){y();var s=o||{};if(typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer)return K8(new Uint8Array(n),(s=ia(s),s.type="array",s));typeof Uint8Array<"u"&&n instanceof Uint8Array&&!s.type&&(s.type=typeof Deno<"u"?"buffer":"array");var l=n,u=[0,0,0,0],m=!1;if(s.cellStyles&&(s.cellNF=!0,s.sheetStubs=!0),rp={},s.dateNF&&(rp.dateNF=s.dateNF),s.type||(s.type=pe&&Buffer.isBuffer(n)?"buffer":"base64"),s.type=="file"&&(s.type=pe?"buffer":"binary",l=Vw(n),typeof Uint8Array<"u"&&!pe&&(s.type="array")),s.type=="string"&&(m=!0,s.type="binary",s.codepage=65001,l=Que(n)),s.type=="array"&&typeof Uint8Array<"u"&&n instanceof Uint8Array&&typeof ArrayBuffer<"u"){var g=new ArrayBuffer(3),x=new Uint8Array(g);if(x.foo="bar",!x.foo)return s=ia(s),s.type="array",K8(Zt(l),s)}switch((u=TA(l,s))[0]){case 208:if(u[1]===207&&u[2]===17&&u[3]===224&&u[4]===161&&u[5]===177&&u[6]===26&&u[7]===225)return Zue($t.read(l,s),s);break;case 9:if(u[1]<=8)return z8(l,s);break;case 60:return gA(l,s);case 73:if(u[1]===73&&u[2]===42&&u[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(u[1]===68)return z3(l,s);break;case 84:if(u[1]===65&&u[2]===66&&u[3]===76)return W3.to_workbook(l,s);break;case 80:return u[1]===75&&u[2]<9&&u[3]<9?Yue(l,s):FA(n,l,s,m);case 239:return u[3]===60?gA(l,s):FA(n,l,s,m);case 255:if(u[1]===254)return Jue(l,s);if(u[1]===0&&u[2]===2&&u[3]===0)return Gc.to_workbook(l,s);break;case 0:if(u[1]===0&&(u[2]>=2&&u[3]===0||u[2]===0&&(u[3]===8||u[3]===9)))return Gc.to_workbook(l,s);break;case 3:case 131:case 139:case 140:return m2.to_workbook(l,s);case 123:if(u[1]===92&&u[2]===114&&u[3]===116)return s8.to_workbook(l,s);break;case 10:case 13:case 32:return Xue(l,s);case 137:if(u[1]===80&&u[2]===78&&u[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return f2.indexOf(u[0])>-1&&u[2]<=12&&u[3]<=31?m2.to_workbook(l,s):FA(n,l,s,m)}function rL(n,o){var s=o||{};return s.type="file",K8(n,s)}function aL(n,o){switch(o.type){case"base64":case"binary":break;case"buffer":case"array":o.type="";break;case"file":return Rc(o.file,$t.write(n,{type:pe?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+o.bookType+"' files");default:throw new Error("Unrecognized type "+o.type)}return $t.write(n,o)}function epe(n,o){var s=ia(o||{}),l=zue(n,s);return nL(l,s)}function tpe(n,o){var s=ia(o||{}),l=eL(n,s);return nL(l,s)}function nL(n,o){var s={},l=pe?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(o.compression&&(s.compression="DEFLATE"),o.password)s.type=l;else switch(o.type){case"base64":s.type="base64";break;case"binary":s.type="string";break;case"string":throw new Error("'string' output type invalid for '"+o.bookType+"' files");case"buffer":case"file":s.type=l;break;default:throw new Error("Unrecognized type "+o.type)}var u=n.FullPaths?$t.write(n,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[s.type]||s.type,compression:!!o.compression}):n.generate(s);if(typeof Deno<"u"&&typeof u=="string"){if(o.type=="binary"||o.type=="base64")return u;u=new Uint8Array(Lt(u))}return o.password&&typeof encrypt_agile<"u"?aL(encrypt_agile(u,o.password),o):o.type==="file"?Rc(o.file,u):o.type=="string"?Er(u):u}function rpe(n,o){var s=o||{},l=iue(n,s);return aL(l,s)}function Yc(n,o,s){s||(s="");var l=s+n;switch(o.type){case"base64":return me(Ts(l));case"binary":return Ts(l);case"string":return n;case"file":return Rc(o.file,l,"utf8");case"buffer":return pe?we(l,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(l):Yc(l,{type:"binary"}).split("").map(function(u){return u.charCodeAt(0)})}throw new Error("Unrecognized type "+o.type)}function ape(n,o){switch(o.type){case"base64":return me(n);case"binary":return n;case"string":return n;case"file":return Rc(o.file,n,"binary");case"buffer":return pe?we(n,"binary"):n.split("").map(function(s){return s.charCodeAt(0)})}throw new Error("Unrecognized type "+o.type)}function Z8(n,o){switch(o.type){case"string":case"base64":case"binary":for(var s="",l=0;l<n.length;++l)s+=String.fromCharCode(n[l]);return o.type=="base64"?me(s):o.type=="string"?Er(s):s;case"file":return Rc(o.file,n);case"buffer":return n;default:throw new Error("Unrecognized type "+o.type)}}function CA(n,o){y(),kM(n);var s=ia(o||{});if(s.cellStyles&&(s.cellNF=!0,s.sheetStubs=!0),s.type=="array"){s.type="binary";var l=CA(n,s);return s.type="array",Lt(l)}return tpe(n,s)}function Y8(n,o){y(),kM(n);var s=ia(o||{});if(s.cellStyles&&(s.cellNF=!0,s.sheetStubs=!0),s.type=="array"){s.type="binary";var l=Y8(n,s);return s.type="array",Lt(l)}var u=0;if(s.sheet&&(typeof s.sheet=="number"?u=s.sheet:u=n.SheetNames.indexOf(s.sheet),!n.SheetNames[u]))throw new Error("Sheet not found: "+s.sheet+" : "+typeof s.sheet);switch(s.bookType||"xlsb"){case"xml":case"xlml":return Yc(Jle(n,s),s);case"slk":case"sylk":return Yc(Pf.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"htm":case"html":return Yc(jM(n.Sheets[n.SheetNames[u]],s),s);case"txt":return ape(lL(n.Sheets[n.SheetNames[u]],s),s);case"csv":return Yc(OA(n.Sheets[n.SheetNames[u]],s),s,"\uFEFF");case"dif":return Yc(W3.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"dbf":return Z8(m2.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"prn":return Yc(so.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"rtf":return Yc(s8.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"eth":return Yc(G3.from_sheet(n.Sheets[n.SheetNames[u]],s),s);case"fods":return Yc(ZM(n,s),s);case"wk1":return Z8(Gc.sheet_to_wk1(n.Sheets[n.SheetNames[u]],s),s);case"wk3":return Z8(Gc.book_to_wk3(n,s),s);case"biff2":s.biff||(s.biff=2);case"biff3":s.biff||(s.biff=3);case"biff4":return s.biff||(s.biff=4),Z8(IM(n,s),s);case"biff5":s.biff||(s.biff=5);case"biff8":case"xla":case"xls":return s.biff||(s.biff=8),rpe(n,s);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return epe(n,s);default:throw new Error("Unrecognized bookType |"+s.bookType+"|")}}function kA(n){if(!n.bookType){var o={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},s=n.file.slice(n.file.lastIndexOf(".")).toLowerCase();s.match(/^\.[a-z]+$/)&&(n.bookType=s.slice(1)),n.bookType=o[n.bookType]||n.bookType}}function iL(n,o,s){var l=s||{};return l.type="file",l.file=o,kA(l),Y8(n,l)}function npe(n,o,s){var l=s||{};return l.type="file",l.file=o,kA(l),CA(n,l)}function ipe(n,o,s,l){var u=s||{};u.type="file",u.file=n,kA(u),u.type="buffer";var m=l;return m instanceof Function||(m=s),As.writeFile(n,Y8(o,u),m)}function sL(n,o,s,l,u,m,g,x){var _=fe(s),S=x.defval,A=x.raw||!Object.prototype.hasOwnProperty.call(x,"raw"),R=!0,P=u===1?[]:{};if(u!==1)if(Object.defineProperty)try{Object.defineProperty(P,"__rowNum__",{value:s,enumerable:!1})}catch{P.__rowNum__=s}else P.__rowNum__=s;if(!g||n[s])for(var I=o.s.c;I<=o.e.c;++I){var M=g?n[s][I]:n[l[I]+_];if(M===void 0||M.t===void 0){if(S===void 0)continue;m[I]!=null&&(P[m[I]]=S);continue}var O=M.v;switch(M.t){case"z":if(O==null)break;continue;case"e":O=O==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+M.t)}if(m[I]!=null){if(O==null)if(M.t=="e"&&O===null)P[m[I]]=null;else if(S!==void 0)P[m[I]]=S;else if(A&&O===null)P[m[I]]=null;else continue;else P[m[I]]=A&&(M.t!=="n"||M.t==="n"&&x.rawNumbers!==!1)?O:Ui(M,O,x);O!=null&&(R=!1)}}return{row:P,isempty:R}}function X8(n,o){if(n==null||n["!ref"]==null)return[];var s={t:"n",v:0},l=0,u=1,m=[],g=0,x="",_={s:{r:0,c:0},e:{r:0,c:0}},S=o||{},A=S.range!=null?S.range:n["!ref"];switch(S.header===1?l=1:S.header==="A"?l=2:Array.isArray(S.header)?l=3:S.header==null&&(l=0),typeof A){case"string":_=Rr(A);break;case"number":_=Rr(n["!ref"]),_.s.r=A;break;default:_=A}l>0&&(u=0);var R=fe(_.s.r),P=[],I=[],M=0,O=0,B=Array.isArray(n),Y=_.s.r,X=0,G={};B&&!n[Y]&&(n[Y]=[]);var Ee=S.skipHidden&&n["!cols"]||[],Re=S.skipHidden&&n["!rows"]||[];for(X=_.s.c;X<=_.e.c;++X)if(!(Ee[X]||{}).hidden)switch(P[X]=Ot(X),s=B?n[Y][X]:n[P[X]+R],l){case 1:m[X]=X-_.s.c;break;case 2:m[X]=P[X];break;case 3:m[X]=S.header[X-_.s.c];break;default:if(s==null&&(s={w:"__EMPTY",t:"s"}),x=g=Ui(s,null,S),O=G[g]||0,!O)G[g]=1;else{do x=g+"_"+O++;while(G[x]);G[g]=O,G[x]=1}m[X]=x}for(Y=_.s.r+u;Y<=_.e.r;++Y)if(!(Re[Y]||{}).hidden){var xe=sL(n,_,Y,P,l,m,B,S);(xe.isempty===!1||(l===1?S.blankrows!==!1:S.blankrows))&&(I[M++]=xe.row)}return I.length=M,I}var oL=/"/g;function cL(n,o,s,l,u,m,g,x){for(var _=!0,S=[],A="",R=fe(s),P=o.s.c;P<=o.e.c;++P)if(l[P]){var I=x.dense?(n[s]||[])[P]:n[l[P]+R];if(I==null)A="";else if(I.v!=null){_=!1,A=""+(x.rawNumbers&&I.t=="n"?I.v:Ui(I,null,x));for(var M=0,O=0;M!==A.length;++M)if((O=A.charCodeAt(M))===u||O===m||O===34||x.forceQuotes){A='"'+A.replace(oL,'""')+'"';break}A=="ID"&&(A='"ID"')}else I.f!=null&&!I.F?(_=!1,A="="+I.f,A.indexOf(",")>=0&&(A='"'+A.replace(oL,'""')+'"')):A="";S.push(A)}return x.blankrows===!1&&_?null:S.join(g)}function OA(n,o){var s=[],l=o??{};if(n==null||n["!ref"]==null)return"";var u=Rr(n["!ref"]),m=l.FS!==void 0?l.FS:",",g=m.charCodeAt(0),x=l.RS!==void 0?l.RS:`
|
|
262
262
|
`,_=x.charCodeAt(0),S=new RegExp((m=="|"?"\\|":m)+"+$"),A="",R=[];l.dense=Array.isArray(n);for(var P=l.skipHidden&&n["!cols"]||[],I=l.skipHidden&&n["!rows"]||[],M=u.s.c;M<=u.e.c;++M)(P[M]||{}).hidden||(R[M]=Ot(M));for(var O=0,B=u.s.r;B<=u.e.r;++B)(I[B]||{}).hidden||(A=cL(n,u,B,R,g,_,m,l),A!=null&&(l.strip&&(A=A.replace(S,"")),(A||l.blankrows!==!1)&&s.push((O++?x:"")+A)));return delete l.dense,s.join("")}function lL(n,o){o||(o={}),o.FS=" ",o.RS=`
|
|
263
263
|
`;var s=OA(n,o);if(typeof r>"u"||o.type=="string")return s;var l=r.utils.encode(1200,s,"str");return"\xFF\xFE"+l}function spe(n){var o="",s,l="";if(n==null||n["!ref"]==null)return[];var u=Rr(n["!ref"]),m="",g=[],x,_=[],S=Array.isArray(n);for(x=u.s.c;x<=u.e.c;++x)g[x]=Ot(x);for(var A=u.s.r;A<=u.e.r;++A)for(m=fe(A),x=u.s.c;x<=u.e.c;++x)if(o=g[x]+m,s=S?(n[A]||[])[x]:n[o],l="",s!==void 0){if(s.F!=null){if(o=s.F,!s.f)continue;l=s.f,o.indexOf(":")==-1&&(o=o+":"+o)}if(s.f!=null)l=s.f;else{if(s.t=="z")continue;if(s.t=="n"&&s.v!=null)l=""+s.v;else if(s.t=="b")l=s.v?"TRUE":"FALSE";else if(s.w!==void 0)l="'"+s.w;else{if(s.v===void 0)continue;s.t=="s"?l="'"+s.v:l=""+s.v}}_[_.length]=o+"="+l}return _}function uL(n,o,s){var l=s||{},u=+!l.skipHeader,m=n||{},g=0,x=0;if(m&&l.origin!=null)if(typeof l.origin=="number")g=l.origin;else{var _=typeof l.origin=="string"?ha(l.origin):l.origin;g=_.r,x=_.c}var S,A={s:{c:0,r:0},e:{c:x,r:g+o.length-1+u}};if(m["!ref"]){var R=Rr(m["!ref"]);A.e.c=Math.max(A.e.c,R.e.c),A.e.r=Math.max(A.e.r,R.e.r),g==-1&&(g=R.e.r+1,A.e.r=g+o.length-1+u)}else g==-1&&(g=0,A.e.r=o.length-1+u);var P=l.header||[],I=0;o.forEach(function(O,B){ka(O).forEach(function(Y){(I=P.indexOf(Y))==-1&&(P[I=P.length]=Y);var X=O[Y],G="z",Ee="",Re=er({c:x+I,r:g+B+u});S=J2(m,Re),X&&typeof X=="object"&&!(X instanceof Date)?m[Re]=X:(typeof X=="number"?G="n":typeof X=="boolean"?G="b":typeof X=="string"?G="s":X instanceof Date?(G="d",l.cellDates||(G="n",X=Za(X)),Ee=l.dateNF||q[14]):X===null&&l.nullError&&(G="e",X=0),S?(S.t=G,S.v=X,delete S.w,delete S.R,Ee&&(S.z=Ee)):m[Re]=S={t:G,v:X},Ee&&(S.z=Ee))})}),A.e.c=Math.max(A.e.c,x+P.length-1);var M=fe(g);if(u)for(I=0;I<P.length;++I)m[Ot(I+x)+M]={t:"s",v:P[I]};return m["!ref"]=or(A),m}function ope(n,o){return uL(null,n,o)}function J2(n,o,s){if(typeof o=="string"){if(Array.isArray(n)){var l=ha(o);return n[l.r]||(n[l.r]=[]),n[l.r][l.c]||(n[l.r][l.c]={t:"z"})}return n[o]||(n[o]={t:"z"})}return typeof o!="number"?J2(n,er(o)):J2(n,er({r:o,c:s||0}))}function cpe(n,o){if(typeof o=="number"){if(o>=0&&n.SheetNames.length>o)return o;throw new Error("Cannot find sheet # "+o)}else if(typeof o=="string"){var s=n.SheetNames.indexOf(o);if(s>-1)return s;throw new Error("Cannot find sheet name |"+o+"|")}else throw new Error("Cannot find sheet |"+o+"|")}function RA(){return{SheetNames:[],Sheets:{}}}function DA(n,o,s,l){var u=1;if(!s)for(;u<=65535&&n.SheetNames.indexOf(s="Sheet"+u)!=-1;++u,s=void 0);if(!s||n.SheetNames.length>=65535)throw new Error("Too many worksheets");if(l&&n.SheetNames.indexOf(s)>=0){var m=s.match(/(^.*?)(\d+)$/);u=m&&+m[2]||0;var g=m&&m[1]||s;for(++u;u<=65535&&n.SheetNames.indexOf(s=g+u)!=-1;++u);}if(CM(s),n.SheetNames.indexOf(s)>=0)throw new Error("Worksheet with name |"+s+"| already exists!");return n.SheetNames.push(s),n.Sheets[s]=o,s}function lpe(n,o,s){n.Workbook||(n.Workbook={}),n.Workbook.Sheets||(n.Workbook.Sheets=[]);var l=cpe(n,o);switch(n.Workbook.Sheets[l]||(n.Workbook.Sheets[l]={}),s){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+s)}n.Workbook.Sheets[l].Hidden=s}function upe(n,o){return n.z=o,n}function pL(n,o,s){return o?(n.l={Target:o},s&&(n.l.Tooltip=s)):delete n.l,n}function ppe(n,o,s){return pL(n,"#"+o,s)}function dpe(n,o,s){n.c||(n.c=[]),n.c.push({t:o,a:s||"SheetJS"})}function fpe(n,o,s,l){for(var u=typeof o!="string"?o:Rr(o),m=typeof o=="string"?o:or(o),g=u.s.r;g<=u.e.r;++g)for(var x=u.s.c;x<=u.e.c;++x){var _=J2(n,g,x);_.t="n",_.F=m,delete _.v,g==u.s.r&&x==u.s.c&&(_.f=s,l&&(_.D=!0))}return n}var mpe={encode_col:Ot,encode_row:fe,encode_cell:er,encode_range:or,decode_col:kt,decode_row:to,split_cell:oa,decode_cell:ha,decode_range:pa,format_cell:Ui,sheet_add_aoa:Kr,sheet_add_json:uL,sheet_add_dom:qM,aoa_to_sheet:Mu,json_to_sheet:ope,table_to_sheet:$M,table_to_book:Eue,sheet_to_csv:OA,sheet_to_txt:lL,sheet_to_json:X8,sheet_to_html:jM,sheet_to_formulae:spe,sheet_to_row_object_array:X8,sheet_get_cell:J2,book_new:RA,book_append_sheet:DA,book_set_sheet_visibility:lpe,cell_set_number_format:upe,cell_set_hyperlink:pL,cell_set_internal_link:ppe,cell_add_comment:dpe,sheet_set_array_formula:fpe,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}},J8;function dL(n){J8=n}function hpe(n,o){var s=J8(),l=o??{};if(n==null||n["!ref"]==null)return s.push(null),s;var u=Rr(n["!ref"]),m=l.FS!==void 0?l.FS:",",g=m.charCodeAt(0),x=l.RS!==void 0?l.RS:`
|
|
264
|
-
`,_=x.charCodeAt(0),S=new RegExp((m=="|"?"\\|":m)+"+$"),A="",R=[];l.dense=Array.isArray(n);for(var P=l.skipHidden&&n["!cols"]||[],I=l.skipHidden&&n["!rows"]||[],M=u.s.c;M<=u.e.c;++M)(P[M]||{}).hidden||(R[M]=Ot(M));var O=u.s.r,B=!1,Y=0;return s._read=function(){if(!B)return B=!0,s.push("\uFEFF");for(;O<=u.e.r;)if(++O,!(I[O-1]||{}).hidden&&(A=cL(n,u,O-1,R,g,_,m,l),A!=null&&(l.strip&&(A=A.replace(S,"")),A||l.blankrows!==!1)))return s.push((Y++?x:"")+A);return s.push(null)},s}function vpe(n,o){var s=J8(),l=o||{},u=l.header!=null?l.header:LM,m=l.footer!=null?l.footer:BM;s.push(u);var g=pa(n["!ref"]);l.dense=Array.isArray(n),s.push(UM(n,g,l));var x=g.s.r,_=!1;return s._read=function(){if(x>g.e.r)return _||(_=!0,s.push("</table>"+m)),s.push(null);for(;x<=g.e.r;){s.push(MM(n,g,x,l)),++x;break}},s}function gpe(n,o){var s=J8({objectMode:!0});if(n==null||n["!ref"]==null)return s.push(null),s;var l={t:"n",v:0},u=0,m=1,g=[],x=0,_="",S={s:{r:0,c:0},e:{r:0,c:0}},A=o||{},R=A.range!=null?A.range:n["!ref"];switch(A.header===1?u=1:A.header==="A"?u=2:Array.isArray(A.header)&&(u=3),typeof R){case"string":S=Rr(R);break;case"number":S=Rr(n["!ref"]),S.s.r=R;break;default:S=R}u>0&&(m=0);var P=fe(S.s.r),I=[],M=0,O=Array.isArray(n),B=S.s.r,Y=0,X={};O&&!n[B]&&(n[B]=[]);var G=A.skipHidden&&n["!cols"]||[],Ee=A.skipHidden&&n["!rows"]||[];for(Y=S.s.c;Y<=S.e.c;++Y)if(!(G[Y]||{}).hidden)switch(I[Y]=Ot(Y),l=O?n[B][Y]:n[I[Y]+P],u){case 1:g[Y]=Y-S.s.c;break;case 2:g[Y]=I[Y];break;case 3:g[Y]=A.header[Y-S.s.c];break;default:if(l==null&&(l={w:"__EMPTY",t:"s"}),_=x=Ui(l,null,A),M=X[x]||0,!M)X[x]=1;else{do _=x+"_"+M++;while(X[_]);X[x]=M,X[_]=1}g[Y]=_}return B=S.s.r+m,s._read=function(){for(;B<=S.e.r;)if(!(Ee[B-1]||{}).hidden){var Re=sL(n,S,B,I,u,g,O,A);if(++B,Re.isempty===!1||(u===1?A.blankrows!==!1:A.blankrows)){s.push(Re.row);return}}return s.push(null)},s}var fL={to_json:gpe,to_html:vpe,to_csv:hpe,set_readable:dL};if(typeof z8<"u"&&(e.parse_xlscfb=z8),e.parse_zip=QM,e.read=K8,e.readFile=rL,e.readFileSync=rL,e.write=Y8,e.writeFile=iL,e.writeFileSync=iL,e.writeFileAsync=ipe,e.utils=mpe,e.writeXLSX=CA,e.writeFileXLSX=npe,e.SSF=gh,typeof fL<"u"&&(e.stream=fL),typeof $t<"u"&&(e.CFB=$t),typeof require<"u"){var mL=require("stream");(mL||{}).Readable&&dL(mL.Readable)}}typeof dM<"u"?Fw(dM):typeof fx<"u"&&fx.exports?Fw(fx.exports):typeof define=="function"&&define.amd?define("xlsx",function(){return dx.version||Fw(dx),dx}):Fw(dx);if(typeof window<"u"&&!window.XLSX)try{window.XLSX=dx}catch{}});var hje={};wL(hje,{initAssets:()=>dje,shutdown:()=>fh,startIntegrations:()=>mje,startServer:()=>fje});module.exports=_L(hje);var Qc=(r=>(r.LoadNext="load-next",r.None="none",r.PlayNext="play-next",r))(Qc||{});var sc=(a=>(a.LockEnd="lock-end",a.LockDuration="lock-duration",a))(sc||{});var ho=(i=>(i.CountDown="count-down",i.CountUp="count-up",i.Clock="clock",i.None="none",i))(ho||{});var Lpe=["aux1-start","aux1-stop","aux1-pause","aux2-start","aux2-stop","aux2-pause","aux3-start","aux3-stop","aux3-pause"],Bpe=["aux1-set","aux2-set","aux3-set"],NA=[...Lpe,...Bpe,"message-set","message-secondary"];var Vd=(y=>(y.Editor="editor",y.Cuesheet="cuesheet",y.Operator="op",y.Timer="timer",y.Backstage="backstage",y.Timeline="timeline",y.StudioClock="studio",y.Countdown="countdown",y.ProjectInfo="info",y))(Vd||{});var Yl=(c=>(c.Roll="roll",c.Play="play",c.Pause="pause",c.Stop="stop",c.Armed="armed",c))(Yl||{});var n4=(y=>(y.onLoad="onLoad",y.onStart="onStart",y.onPause="onPause",y.onStop="onStop",y.onClock="onClock",y.onUpdate="onUpdate",y.onFinish="onFinish",y.onWarning="onWarning",y.onDanger="onDanger",y))(n4||{}),Xf=Object.keys(n4);var Hd=(a=>(a.Absolute="absolute",a.Relative="relative",a))(Hd||{});var el={clock:0,timer:{addedTime:0,current:null,duration:null,elapsed:null,expectedFinish:null,phase:"none",playback:"stop",secondaryTimer:null,startedAt:null},message:{timer:{text:"",visible:!1,blink:!1,blackout:!1,secondarySource:null},secondary:""},rundown:{selectedEventIndex:null,numEvents:0,plannedStart:0,plannedEnd:0,actualStart:null,actualGroupStart:null,currentDay:null},offset:{absolute:0,relative:0,mode:"absolute",expectedFlagStart:null,expectedGroupEnd:null,expectedRundownEnd:null},groupNow:null,eventNow:null,eventNext:null,eventFlag:null,auxtimer1:{current:0,direction:"count-up",duration:0,playback:"stop"},auxtimer2:{current:0,direction:"count-up",duration:0,playback:"stop"},auxtimer3:{current:0,direction:"count-up",duration:0,playback:"stop"},ping:1};function kr(e){return e?.type==="event"}function Ns(e){return!e.skip}function fs(e){return e?.type==="delay"}function ya(e){return e?.type==="group"}function ms(e){return e?.type==="milestone"}function MA(e,t){return e in t}function LA(e){return e.type==="osc"}function BA(e){return e.type==="http"}function UA(e){return e.type==="ontime"}var jA={"common.expected_finish":"Expected Finish","common.minutes":"min","common.seconds":"sec","common.now":"Now","common.next":"Next","common.scheduled_start":"Scheduled start","common.scheduled_end":"Scheduled end","common.expected_start":"Expected start","common.expected_end":"Expected end","common.stage_timer":"Stage Timer","common.started_at":"Started At","common.time_now":"Time now","common.no_data":"No data","countdown.ended":"Event ended at","countdown.running":"Event running","countdown.loaded":"Event loaded","countdown.select_event":"Select an event to follow","countdown.to_start":"Time to start","countdown.waiting":"Waiting for event start","countdown.overtime":"in overtime","countdown.all_have_finished":"All selected events have finished","timeline.live":"live","timeline.done":"done","timeline.due":"due","timeline.followedby":"Followed by","project.title":"Title","project.description":"Description","project.info":"Project Info","project.url":"Project URL"};(function(){CL().config(Object.assign({},OL(),DL()(process.argv)))})();var Dw=qt(Tn(),1),cce=qt(require("http"),1),xM=qt(xH(),1),lce=qt(SH(),1),uce=qt(RH(),1);var VH=require("url"),Tr=require("path");function w1(e,t){return{start:e!=="stop"&&e!=="play",pause:e==="play",roll:e!=="roll"&&t!=="overtime",stop:e!=="stop",reload:e!=="stop"&&e!=="roll"}}function oC(e,t="lock-duration"){return Object.values(sc).includes(e)?e:t}function nu(e,t="none"){return Object.values(Qc).includes(e)?e:t}function c0(e,t="count-down"){return Object.values(ho).includes(e)?e:t}function R4(e){return Object.values(ho).includes(e)}var ol=1e3,Yi=1e3*60,Zn=1e3*60*60,Or=864e5,cC=Or-ol;function xp(e,t="count-down"){if(e===null)return 0;let a=0;return t==="count-down"&&(a=Math.ceil(e/ol)),t==="count-up"&&(a=Math.floor(e/ol)),a===0?0:a}function DH(e){return Math.floor(e/60)}function PH(e){return Math.floor(e/3600)}function lC(e,t){let a=e.timeStrategy==="lock-end",r=e.timeStrategy==="lock-duration",i=t.timeEnd;return{timeStart:i,timeEnd:a?e.timeEnd:IH(i,e.duration),duration:r?e.duration:cc(i,e.timeEnd)}}function $6e(e,t,a){let r=b1(e),i=b1(t),c=b1(a);return e!=null&&t!=null?{timeStart:r,duration:cc(r,i),timeEnd:i,timeStrategy:a!=null?"lock-duration":"lock-end"}:e==null&&t==null?a==null?{timeStart:0,duration:0,timeEnd:0,timeStrategy:"lock-duration"}:{timeStart:r,duration:c,timeEnd:c,timeStrategy:"lock-duration"}:e!=null?{timeStart:r,duration:c,timeEnd:(r+c)%Or,timeStrategy:"lock-duration"}:t!=null?{timeStart:i-c,duration:c,timeEnd:i,timeStrategy:a!=null?"lock-duration":"lock-end"}:{timeStart:r,duration:c,timeEnd:i,timeStrategy:"lock-duration"}}function D4(e,t,a,r){if(r==null)return $6e(e,t,a);let i=oC(r),c=b1(e),p=b1(t),f=b1(a);return i==="lock-end"?f=cc(c,p):p=IH(c,f),{timeStart:c,duration:f,timeEnd:p,timeStrategy:i}}function cc(e,t){return t<e?t+Or-e:t-e}function IH(e,t){return(e+t)%Or}function b1(e){let t=Number(e);return isNaN(t)?0:Math.floor(t)}function Bs(e,t,a){let r=[...a];return e===0?r.unshift(t):e>=r.length?r.push(t):r.splice(e,0,t),r}function uC(e,t){return t.filter((a,r)=>r!==e)}function pC(e,t){for(let a=0;a<t.length;a++){let r=t[a],i=e[r];if(kr(i)&&Ns(i))return{firstEvent:i,firstIndex:a}}return{firstEvent:null,firstIndex:null}}function dC(e,t){if(t.length<1)return{lastEvent:null,lastIndex:null};for(let a=t.length-1;a>=0;a--){let r=t[a],i=e[r];if(kr(i)&&!i.skip)return{lastEvent:i,lastIndex:a}}return{lastEvent:null,lastIndex:null}}function fC(e,t,a){let r=t.findIndex(i=>i===a);if(r<0)return{nextEvent:null,nextIndex:null};for(let i=r+1;i<t.length;i++){let c=t[i],p=e[c];if(kr(p))return{nextEvent:p,nextIndex:i}}return{nextEvent:null,nextIndex:null}}function mC(e,t,a){let r=t.findIndex(i=>i===a);if(r<0)return{previousEvent:null,previousIndex:null};for(let i=r-1;i>=0;i--){let c=t[i],p=e[c];if(kr(p))return{previousEvent:p,previousIndex:i}}return{previousEvent:null,previousIndex:null}}function P4(e,t,a,r){if(a)return a;if(!r)return null;let i=t?t.entries:e.order;if(!i||i.length===0)return null;let c=i.findIndex(p=>p===r);return c<1?null:i[c-1]}function hC(e,t){if(t.parent)return t.parent;let a=t.after??t.before;if(!a)return null;let r=e.entries[a];return r&&"parent"in r&&r.parent?r.parent:null}function i5(e,t,a,r){if(r)if("parent"in t&&(t.parent=r.id),a){let i=r.entries.indexOf(a)+1,c=e.flatOrder.indexOf(a)+1;r.entries=Bs(i,t.id,r.entries),e.flatOrder=Bs(c,t.id,e.flatOrder)}else{r.entries=Bs(0,t.id,r.entries);let i=e.flatOrder.indexOf(r.id)+1;e.flatOrder=Bs(i,t.id,e.flatOrder)}else if(a){let i=e.order.indexOf(a)+1,c=e.flatOrder.indexOf(a)+1;e.order=Bs(i,t.id,e.order),e.flatOrder=Bs(c,t.id,e.flatOrder)}else e.order=Bs(0,t.id,e.order),e.flatOrder=Bs(0,t.id,e.flatOrder);return e.entries[t.id]=t,t}function NH(e){return typeof e=="number"&&!isNaN(e)?!0:typeof e=="string"&&e.trim()!==""?!isNaN(parseFloat(e)):!1}var V6e=/^(\D*)(\d+)(\.\d+)?$/;function H6e(e){let t=V6e.exec(e);if(t){let[,a,r,i]=t;if(i){if(i===".99")i=".100";else{let p=`${"0".repeat(i.length-2)}1`;i=(Number(i)+ +`0.${p}`).toFixed(i.length-1).toString().replace("0.",".")}return`${a}${r}${i}`}return r=(Number(r)+1).toString(),`${a}${r}`}return`${e}2`}function vC(e,t,a){if(a===null||t.length===0)return f();let r=e[a];if(!kr(r)&&(r=mC(e,t,a).previousEvent,!kr(r)))return f();let i=H6e(r.cue),{nextEvent:c}=fC(e,t,a);if(i!==c?.cue)return i;if(NH(i))return p(r.cue);return`${r.cue}.1`;function p(v){return(Number(v)+.1).toString()}function f(){return pC(e,t).firstEvent?.cue==="1"?"0.1":"1"}}var gC=require("node:crypto");var W6e=128,l0,_1;function G6e(e){!l0||l0.length<e?(l0=Buffer.allocUnsafe(e*W6e),gC.webcrypto.getRandomValues(l0),_1=0):_1+e>l0.length&&(gC.webcrypto.getRandomValues(l0),_1=0),_1+=e}function z6e(e){return G6e(e|=0),l0.subarray(_1-e,_1)}function K6e(e,t,a){let r=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*r*t/e.length);return(c=t)=>{let p="";for(;;){let f=a(i),v=i;for(;v--;)if(p+=e[f[v]&r]||"",p.length>=c)return p}}}function MH(e,t=21){return K6e(e,t,z6e)}var Z6e=MH("1234567890abcdef",6),Ta=()=>Z6e();function xC(e){let t=Object.keys(e);if(t.length===0)throw new Error("No rundowns found in project");let a=t[0];return e[a]}var I4={type:"event",flag:!1,title:"",note:"",endAction:"none",timerType:"count-down",timeStrategy:"lock-duration",linkStart:!1,countToEnd:!1,timeStart:0,timeEnd:0,duration:0,skip:!1,colour:"",timeWarning:12e4,timeDanger:6e4,triggers:[],custom:{},parent:null,revision:0,delay:0,dayOffset:0,gap:0},fHe={type:"delay",duration:0,parent:null},yC={type:"milestone",cue:"",title:"",note:"",colour:"",custom:{},parent:null,revision:0},wC={type:"group",title:"",note:"",entries:[],targetDuration:null,colour:"",custom:{},revision:0,timeStart:null,timeEnd:null,duration:0,isFirstLinked:!1};var ga=(e,t="")=>typeof e=="string"?e.trim():e==null||e.constructor===Object?t:e.toString().trim();function E1(e){return{type:"delay",id:e?.id??Ta(),duration:e?.duration??0,parent:e?.parent??null}}var S1=(e,t="")=>{if(Object.keys(e).length===0)return null;let a=typeof t=="number"?String(t+1):t,r={id:e?.id??Ta(),cue:a,...I4};return X6e(r,e)};function u0(e){return e?{id:e.id??Ta(),type:"group",title:e.title??"",note:e.note??"",entries:e.entries??[],targetDuration:e.targetDuration??null,colour:ga(e.colour,""),custom:e.custom??{},revision:0,timeStart:null,timeEnd:null,duration:0,isFirstLinked:!1}:{...wC,id:Ta()}}function A1(e){return e?{id:e.id??Ta(),type:"milestone",cue:e.cue??"",title:e.title??"",note:e.note??"",colour:ga(e.colour,""),custom:e.custom??{},parent:e.parent??null,revision:0}:{...yC,id:Ta()}}function Y6e(e,t,a){return e&&!t?"lock-end":!e&&t?"lock-duration":a}function X6e(e,t){if(Object.keys(t).length===0)return e;let{timeStart:a,timeEnd:r,duration:i,timeStrategy:c}=D4(t?.timeStart??e.timeStart,t?.timeEnd??e.timeEnd,t?.duration??e.duration,t?.timeStrategy??Y6e(t?.timeEnd,t?.duration,e.timeStrategy));return{id:e.id,type:"event",flag:typeof t.flag=="boolean"?t.flag:e.flag,title:ga(t.title,e.title),timeStart:a,timeEnd:r,duration:i,timeStrategy:c,linkStart:typeof t.linkStart=="boolean"?t.linkStart:e.linkStart,endAction:nu(t.endAction,e.endAction),timerType:c0(t.timerType,e.timerType),countToEnd:typeof t.countToEnd=="boolean"?t.countToEnd:e.countToEnd,skip:typeof t.skip=="boolean"?t.skip:e.skip,note:ga(t.note,e.note),colour:ga(t.colour,e.colour),delay:e.delay,dayOffset:e.dayOffset,gap:e.gap,cue:ga(t.cue??null,e.cue),parent:e.parent,revision:e.revision,timeWarning:t.timeWarning??e.timeWarning,timeDanger:t.timeDanger??e.timeDanger,custom:{...e.custom,...t.custom},triggers:t.triggers??e.triggers}}function bC(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)}function N4(e){return String(e).padStart(2,"0")}function lc(e,t){if(e==null)return t?.fallback??"...";let a=e<0,r=Math.abs(xp(e,t?.direction)),i=r%60,c=DH(r)%60,p=PH(r);return`${a?"-":""}${[p,c,i].map(N4).join(":")}`}function _C(e){return e.startsWith("00:0")?e.slice(4):e.startsWith("00:")?e.slice(3):e.startsWith("-00:0")?`-${e.slice(5)}`:e.startsWith("-00:")?`-${e.slice(4)}`:e}function p0(e){let{isAM:t,isPM:a,value:r}=ege(e.toLowerCase()),i=Q6e(r);if(i!==null)return i;let c=/[\s,:.]+/,[p,f,v]=r.split(c),y=0,b=a;if(p!=null&&f!=null&&v!=null){let E=un(p);E===12&&(t&&(E=0),b=!1),y=E*Zn,y+=un(f)*Yi,y+=un(v)*ol}else if(p!=null&&f==null&&v==null){let{inferredMillis:E,addAM:T}=J6e(p,t,a);y=E,b=T<12&&a}else if(p!=null&&f!=null&&v==null){let E=un(p);E===12&&(t&&(E=0),b=!1),y=E*Zn,y+=un(f)*Yi}return b&&(y+=12*Zn),y}function J6e(e,t,a){let r=e.length,i=0,c=0;if(r===1)a||t?(i=un(e)*Zn,t&&(c=i)):i=un(e)*Yi;else if(r===2)a||t?(e==="12"&&t?i=0:i=un(e)*Zn,(t||e==="12")&&(c=12)):i=un(e)*Yi;else if(r===3)i=un(e[0])*Zn+un(e.substring(1))*Yi;else if(r===4)i=un(e.substring(0,2))*Zn+un(e.substring(2))*Yi;else if(r>=5){let p=un(e.substring(0,2)),f=un(e.substring(2,4)),v=un(e.substring(4));i=p*Zn+f*Yi+v*ol}return{inferredMillis:i,addAM:c}}function Q6e(e){let t=/(\d+)h(?:(\d+)(?!s))?/i.exec(e),a=t?un(t[1]):0,r=t?.[2]?un(t[2]):0,i=/(\d+)m/i.exec(e),c=i?un(i[1]):r,p=/(\d+)s/i.exec(e),f=p?un(p[1]):0;return t||i||p?a*Zn+c*Yi+f*ol:null}function ege(e){return e.endsWith("pm")?{isAM:!1,isPM:!0,value:e.slice(0,-2)}:e.endsWith("p")?{isAM:!1,isPM:!0,value:e.slice(0,-1)}:e.endsWith("am")?{isAM:!0,isPM:!1,value:e.slice(0,-2)}:e.endsWith("a")?{isAM:!0,isPM:!1,value:e.slice(0,-1)}:{isAM:!1,isPM:!1,value:e}}function un(e){let t=Number(e);return isNaN(t)?0:Math.abs(t)}var cl={isOnlyNumbers:/^\d+$/,isIPAddress:/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/,startsWithHttp:/^https?:\/\//,startsWithSlash:/^\//,isAlphanumeric:/^[a-z0-9]+$/i,isAlphanumericWithSpace:/^[a-z0-9_ ]+$/i,isASCII:/^[ -~]+$/,isASCIIorEmpty:/^$|^[ -~]+$/,isNotEmpty:/\S/},ll={isOnlyNumbers:e=>cl.isOnlyNumbers.test(e),isIPAddress:e=>cl.isIPAddress.test(e),startsWithHttp:e=>cl.startsWithHttp.test(e),startsWithSlash:e=>cl.startsWithSlash.test(e),isAlphanumeric:e=>cl.isAlphanumeric.test(e),isAlphanumericWithSpace:e=>cl.isAlphanumericWithSpace.test(e),isASCII:e=>cl.isASCII.test(e),isASCIIorEmpty:e=>cl.isASCIIorEmpty.test(e),isNotEmpty:e=>cl.isNotEmpty.test(e)};var M4=e=>{let t=/^#((?:[a-f\d]{1}){3,4})$/i,a=/^#((?:[a-f\d]{2}){3,4})$/i;return t.test(e)||a.test(e)};var tge=/\\?.|^$/g,EC=(e,t=!0)=>{let a=e.match(tge);if(!a||a[0]=="")return null;let r=a.reduce((i,c)=>(c==='"'?(i.inQuotes^=1,t&&(i.array[i.array.length-1]+=c.replace(/\\(.)/,"$1"))):!i.inQuotes&&c===" "?i.array.push(""):i.array[i.array.length-1]+=c.replace(/\\(.)/,"$1"),i),{array:[""],inQuotes:0}).array.filter(i=>i!="");return r.length?r:null};function uc(e){return e.trim().replaceAll(" ","_")}function L4(e,t){let a=e.split("."),r=t;for(let i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function SC(e){return Object.keys(e).length===0}function AC(e){return Object.keys(e).forEach(t=>e[t]===void 0&&delete e[t]),e}function St(e){return e instanceof Error?e.message:String(e)}function s5(e){let t=e.replace(/[a-zA-Z0-9]/g,a=>/[a-zA-Z]/.test(a)?String.fromCharCode((a<="Z"?90:122)>=(a=a.charCodeAt(0)+13)?a:a-26):String.fromCharCode((a<="4"?57:48)>=(a=a.charCodeAt(0)+5)?a:a-10));return e.startsWith("_")?t.replace("_",""):`_${t}`}function B4(e,t){let{timeStart:a,dayOffset:r,delay:i}=e,{currentDay:c,totalGap:p,isLinkedToLoaded:f,offset:v,mode:y,actualStart:b,plannedStart:E}=t,T=r-c,k=Math.max(0,a+i)+T*Or,D=0;y==="relative"&&(D=(b??0)+c*Or-(E??0));let U=k+D,z=U+v;return f?z:p>v?U:z-p}function TC(e,t,a){let r=t<e?t+Or:t;return e<=a&&a<=r}function FC(e,t){if(!t)return 0;let a=e.timeStart+e.dayOffset*Or,r=t.timeStart+t.duration+t.dayOffset*Or;return a===r?0:(a>r,a-r)}function CC(e,t){if(!t)return!0;let a=e.timeStart+e.duration+e.dayOffset*Or,r=t.timeStart+t.duration+t.dayOffset*Or;return a>=r}var o5={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"};function U4(e){return typeof e!="object"||e===null?!1:Object.keys(o5).every(a=>Object.hasOwn(e,a))}function d0(e){return e==="play"||e==="pause"||e==="roll"}function OC(e,t,a=.5){let r=a,i=1-r;return{red:Math.round(e.red*r+t.red*i),green:Math.round(e.green*r+t.green*i),blue:Math.round(e.blue*r+t.blue*i),alpha:1}}function RC(e){if(e.startsWith("#"))return kC(e);let t=e.toLocaleLowerCase();return t in j4?kC(j4[t]):null}function kC(e){if(!M4(e))return null;let t=e.toLocaleLowerCase();t=t.replace(/^#/,"");let a=1;if(t.length===8){let f=t.slice(6,8);a=parseInt(f,16)/255,t=t.slice(0,6)}if(t.length===4){let f=t.slice(3,4).repeat(2);a=parseInt(f,16)/255,t=t.slice(0,3)}t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let r=parseInt(t,16),i=r>>16,c=r>>8&255,p=r&255;return isNaN(i)||isNaN(c)||isNaN(p)||isNaN(a)?null:{red:i,green:c,blue:p,alpha:a}}function DC(e){return(e.red*299+e.green*587+e.blue*114)/1e3>=128}var j4={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd3"};var Fn={skipLimit:1e3,updateRate:32,notificationRate:1e3,triggerAhead:10,auxTimerDefault:5*Yi},Ur={appState:"app-state.json",corrupt:"corrupt files",migrate:"migrated files",crash:"crash logs",demoProject:"demo project.json",newProject:"new project.json",database:{directory:"db",filename:"db.json"},external:"external",demo:"demo",projects:"projects",sheets:{directory:"sheets"},restoreFile:"ontime.restore",user:"user",styles:{directory:"styles",filename:"override.css"},uploads:"uploads",logo:"logo",translations:{directory:"translations",filename:"translations.json"}};var f0=require("fs"),su=require("fs/promises"),Us=require("path");function PC(e){console.log(rge(e))}function iu(e){console.error(age(e))}function c5(e){console.log(nge(e))}function l5(e){console.log(ige(e))}function rge(e){return`\x1B[32m${e}\x1B[0m`}function age(e){return`\x1B[31m${e}\x1B[0m`}function nge(e){return`\x1B[96m${e}\x1B[0m`}function ige(e){return`\x1B[2m${e}\x1B[0m`}var cr={boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",number:e=>typeof e=="number",defined:e=>e!==void 0,object:e=>typeof e=="object"&&e!==null&&!Array.isArray(e),objectWithKeys:(e,t)=>t.every(a=>a in e),array:e=>Array.isArray(e)};function Cn(e){if(!(0,f0.existsSync)(e))try{(0,f0.mkdirSync)(e,{recursive:!0})}catch(t){throw new Error(`Could not create directory: ${t}`)}}function T1(e){return e&&(e.endsWith(".json")?e:`${e}.json`)}async function LH(e){return(0,su.readdir)(e)}var u5=e=>(0,Us.parse)(e).name;function IC(e,t){let a=e.split(".").pop();return e.replace(`.${a}`,` ${t}.${a}`)}function BH(e,t){let a=t;for(;r(a);)a=sge(a);return a;function r(i){return(0,f0.existsSync)((0,Us.join)(e,i))}}function NC(e){return(0,Us.basename)(e)}async function MC(e,t){let a=await(0,su.readdir)(e,{withFileTypes:!0});for(let r of a){let i=(0,Us.join)(e,r.name),c=(0,Us.join)(t,r.name);r.isDirectory()?await MC(i,c):await(0,su.copyFile)(i,c)}}async function yp(e,t){try{await(0,su.copyFile)(e,t,f0.constants.COPYFILE_EXCL),await(0,su.unlink)(e)}catch(a){throw cr.object(a)&&"code"in a&&a.code==="EEXIST"?(iu(`rename error: File already exists ${t}`),new Error("File already exists")):(iu(`rename error ${a}`),new Error("Unknown file rename error"))}}function sge(e){let{dir:t,name:a,ext:r}=(0,Us.parse)(e);if(!a.endsWith(")"))return(0,Us.join)(t,`${a} (1)${r}`);let i=a.lastIndexOf(" (");if(i===-1)return(0,Us.join)(t,`${a} (1)${r}`);let c=Number(a.slice(i+2,-1));return isNaN(c)?(0,Us.join)(t,`${a} (1)${r}`):(0,Us.join)(t,`${a.slice(0,i)} (${c+1})${r}`)}var wp=async e=>await(0,su.unlink)(e).catch(t=>{console.error("Could not delete file:",t)});var LC=process.env.NODE_ENV||"production",ul=!!process.env.IS_TEST,UH=ul?"test":LC,q4=LC==="docker",ki=q4||LC==="production"&&!ul,bp=!!process.env.IS_CLOUD;var $H={};function BC(){if(process.env.ONTIME_DATA)return(0,Tr.join)(process.env.ONTIME_DATA);switch(process.platform){case"darwin":return(0,Tr.join)(process.env.HOME,"Library","Application Support","Ontime");case"win32":return(0,Tr.join)(process.env.APPDATA,"Ontime");case"linux":return(0,Tr.join)(process.env.HOME,".Ontime");default:throw new Error("Could not resolve public folder for platform")}}$H.url&&(globalThis.__dirname=(0,VH.fileURLToPath)($H.url));var jH=(0,Tr.dirname)(__dirname),$4=ki?jH:(0,Tr.join)(jH,"../"),Xi={root:$4,clientDir:ki?(0,Tr.join)($4,"client/"):(0,Tr.join)($4,"../../client/build/"),demoDir:(0,Tr.join)($4,"external",Ur.demo)},Oi={clientIndexHtml:(0,Tr.join)(Xi.clientDir,"index.html"),cssOverride:(0,Tr.join)(Xi.root,Ur.user,Ur.styles.directory,Ur.styles.filename),translationsFile:(0,Tr.join)(Xi.root,Ur.user,Ur.translations.directory,Ur.translations.filename),externalReadme:(0,Tr.join)(Xi.root,Ur.external,"README.md"),userReadme:(0,Tr.join)(Xi.root,Ur.user,"README.md"),cssReadme:(0,Tr.join)(Xi.root,Ur.user,Ur.styles.directory,"README.md"),translationReadme:(0,Tr.join)(Xi.root,Ur.user,Ur.translations.directory,"README.md"),login:(0,Tr.join)(Xi.root,"html/login.html"),logo:(0,Tr.join)(Xi.root,Ur.user,Ur.logo,"ontime-logo.png")},_o=BC();Cn(_o);var qH=ki?_o:(0,Tr.join)($4,"external"),ar={root:_o,crashDir:(0,Tr.join)(_o,Ur.crash),projectsDir:(0,Tr.join)(_o,Ur.projects),corruptDir:(0,Tr.join)(_o,Ur.corrupt),migrateDir:(0,Tr.join)(_o,Ur.migrate),uploadsDir:(0,Tr.join)(_o,Ur.uploads),externalDir:(0,Tr.join)(qH,ki?Ur.external:""),demoDir:(0,Tr.join)(qH,ki?"/external/":"",Ur.demo),userDir:(0,Tr.join)(_o,Ur.user),stylesDir:(0,Tr.join)(_o,Ur.user,Ur.styles.directory),logoDir:(0,Tr.join)(_o,Ur.user,Ur.logo),translationsDir:(0,Tr.join)(_o,Ur.user,Ur.translations.directory)},kn={appState:(0,Tr.join)(ar.root,Ur.appState),restoreFile:(0,Tr.join)(ar.root,Ur.restoreFile),cssOverride:(0,Tr.join)(ar.stylesDir,Ur.styles.filename),translationsFile:(0,Tr.join)(ar.translationsDir,Ur.translations.filename),externalReadme:(0,Tr.join)(ar.externalDir,"README.md"),userReadme:(0,Tr.join)(ar.userDir,"README.md"),cssReadme:(0,Tr.join)(ar.stylesDir,"README.md"),translationReadme:(0,Tr.join)(ar.translationsDir,"README.md")};var p5=require("node:fs");var UC=process.env.SESSION_PASSWORD,jC=process.env.ROUTER_PREFIX;function HH(e=jC){if(!e)return"";try{let t=(0,p5.readFileSync)(Oi.clientIndexHtml,{encoding:"utf-8",flag:"r"}).replace('<base href="/" />',`<base href="/${e}/" ${bp?"data-is-cloud":""}/>`);(0,p5.writeFileSync)(Oi.clientIndexHtml,t,{encoding:"utf-8",flag:"w"})}catch{}return`/${e}`}var Eo="4.4.1";var qC=qt(Tn(),1),WH=[qC.default.urlencoded({extended:!0}),qC.default.json({limit:"1mb"})];var QH=qt(JH(),1),eW=require("node:path");var VC=(0,QH.default)(Xi.clientDir,{enableBrotli:!0,orderPreference:["br"],serveStatic:{etag:!1,lastModified:!1,immutable:!0,maxAge:"1y",setHeaders:(e,t)=>{(0,eW.extname)(t)===".html"&&e.setHeader("Cache-Control","public, max-age=0")}}});var tO=qt(Tn(),1),HK=qt(aW(),1);var nW=require("node:crypto");function f5(e){return(0,nW.createHash)("sha256").update(e).digest("base64url")}var sW=require("node:fs/promises");var h5=require("node:fs/promises"),F1=require("node:path"),iW=require("node:url");function Pge(e){let t=e instanceof URL?(0,iW.fileURLToPath)(e):e.toString();return(0,F1.join)((0,F1.dirname)(t),`.${(0,F1.basename)(t)}.tmp`)}async function Ige(e,t,a){for(let r=0;r<t;r++)try{return await e()}catch(i){if(r<t-1)await new Promise(c=>setTimeout(c,a));else throw i}}var m5=class{#e;#t;#r=!1;#n=null;#i=null;#s=null;#a=null;#o(t){return this.#a=t,this.#s||=new Promise((a,r)=>{this.#i=[a,r]}),new Promise((a,r)=>{this.#s?.then(a).catch(r)})}async#c(t){this.#r=!0;try{await(0,h5.writeFile)(this.#t,t,"utf-8"),await Ige(async()=>{await(0,h5.rename)(this.#t,this.#e)},10,100),this.#n?.[0]()}catch(a){throw a instanceof Error&&this.#n?.[1](a),a}finally{if(this.#r=!1,this.#n=this.#i,this.#i=this.#s=null,this.#a!==null){let a=this.#a;this.#a=null,await this.write(a)}}}constructor(t){this.#e=t,this.#t=Pge(t)}async write(t){return this.#r?this.#o(t):this.#c(t)}};var v5=class{#e;#t;constructor(t){this.#e=t,this.#t=new m5(t)}async read(){let t;try{t=await(0,sW.readFile)(this.#e,"utf-8")}catch(a){if(a.code==="ENOENT")return null;throw a}return t}write(t){return this.#t.write(t)}};var g5=class{#e;#t;#r;constructor(t,{parse:a,stringify:r}){this.#e=new v5(t),this.#t=a,this.#r=r}async read(){let t=await this.#e.read();return t===null?null:this.#t(t)}write(t){return this.#e.write(this.#r(t))}};var _p=class extends g5{constructor(t){super(t,{parse:JSON.parse,stringify:a=>JSON.stringify(a,null,2)})}};var x5=class{#e=null;read(){return Promise.resolve(this.#e)}write(t){return this.#e=t,Promise.resolve()}};function Nge(e,t){if(e===void 0)throw new Error("lowdb: missing adapter");if(t===void 0)throw new Error("lowdb: missing default data")}var C1=class{adapter;data;constructor(t,a){Nge(t,a),this.adapter=t,this.data=a}async read(){let t=await this.adapter.read();t&&(this.data=t)}async write(){this.data&&await this.adapter.write(this.data)}async update(t){t(this.data),await this.write()}};async function oW(e,t){let a=process.env.NODE_ENV==="test"?new x5:new _p(e),r=new C1(a,t);return await r.read(),r}function y5(e,t){let a=structuredClone(e),r=structuredClone(t),{rundowns:i={},project:c={},settings:p={},viewSettings:f={},urlPresets:v=[],customFields:y={},automation:b}=r;return{rundowns:{...e.rundowns,...i},project:{...a.project,...c},settings:{...a.settings,...p},viewSettings:{...a.viewSettings,...f},urlPresets:[...a.urlPresets,...v],customFields:{...a.customFields,...y},automation:b??a.automation}}var pr={};async function cW(e,t){let a=await oW(e,t);a.data=t,await a.write(),await a.read(),pr=a}function Ht(){if(pr===null)throw new Error("Database not initialized");return{getData:Mge,setProjectData:Lge,getProjectData:Bge,setCustomFields:Uge,getCustomFields:qge,setRundown:$ge,mergeRundown:jge,getSettings:Vge,setSettings:Hge,getUrlPresets:Wge,setUrlPresets:Gge,getViewSettings:zge,setViewSettings:Kge,getAutomation:Zge,setAutomation:Yge,getRundown:Xge,getProjectRundowns:Qge,mergeIntoData:exe,deleteRundown:Jge}}function Mge(){return pr.data}async function Lge(e){return pr.data.project={...structuredClone(pr.data.project),...structuredClone(e)},await pl(),pr.data.project}function Bge(){return pr.data.project}async function Uge(e){return pr.data.customFields={...e},await pl(),pr.data.customFields}async function jge(e,t){return pr.data.customFields={...pr.data.customFields,...e},Object.entries(t).forEach(([a,r])=>{pr.data.rundowns[a]=r}),await pl(),{rundowns:pr.data.rundowns,customFields:pr.data.customFields}}function qge(){return pr.data.customFields}async function $ge(e,t){pr.data.rundowns[e]=structuredClone(t),await pl()}function Vge(){return pr.data.settings}async function Hge(e){return pr.data.settings={...e},await pl(),pr.data.settings}function Wge(){return pr.data.urlPresets}async function Gge(e){return pr.data.urlPresets=e,await pl(),pr.data.urlPresets}function zge(){return pr.data.viewSettings}async function Kge(e){return pr.data.viewSettings={...e},await pl(),pr.data.viewSettings}function Zge(){return pr.data.automation}async function Yge(e){return pr.data.automation={...e},await pl(),pr.data.automation}function Xge(e){if(!(e in pr.data.rundowns))throw new Error(`Rundown with id: ${e} not found`);let t=pr.data.rundowns[e];if(!t)throw new Error(`Rundown with id: ${e} not found`);return t}async function Jge(e){if(!(e in pr.data.rundowns))throw new Error(`Rundown with id: ${e} not found`);return delete pr.data.rundowns[e],await pl(),pr.data.rundowns}function Qge(){return pr.data.rundowns}async function exe(e){let t=y5(pr.data,e);return pr.data.project=t.project,pr.data.settings=t.settings,pr.data.viewSettings=t.viewSettings,pr.data.automation=t.automation,pr.data.urlPresets=t.urlPresets,pr.data.customFields=t.customFields,pr.data.rundowns=t.rundowns,await pl(),pr.data}var h0=null,m0=null,txe=3e3;async function pl(){ul||(h0&&clearTimeout(h0),h0=setTimeout(async()=>{h0=null,m0&&await m0;try{m0=pr.write(),await m0}catch(e){console.error("Failed to persist database:",e)}finally{m0=null}},txe))}async function lW(){ul||(h0&&(clearTimeout(h0),h0=null),m0&&await m0,await pr.write())}var w3e=qt(nG(),1),b3e=qt(ek(),1),_3e=qt(ak(),1),pk=qt(R5(),1),dk=qt(fG(),1);var mG=["ambient","analog","artistic","binaural","bright","cinematic","clean","cool","crisp","dark","deep","distorted","dreamy","dynamic","electric","explosive","flickering","fluid","glitchy","glowing","harmonious","hazy","intense","low-fi","mellow","melodic","metallic","moody","muted","nostalgic","noisy","organic","panoramic","percussive","powerful","psychedelic","quirky","raw","resonant","retro","sharp","shimmering","smooth","soft","soulful","sparkling","spacious","subtle","surround","tilted","uplifting","vibrant","warm"],hG=["acoustics","animation","audio","barndoor","beat","brightness","bulb","channel","chroma","cinema","clip","color","codec","composition","compression","contrast","darkness","display","distortion","dolly","downlight","drum","echo","edit","effect","film","fixture","flash","footage","format","floodlight","flicker","frame","fresnel","gel","glow","gobo","groove","guitar","harmony","highlight","illumination","instrument","instrumental","jib","lamp","led","light","luminance","mastering","melody","microphone","mix","mixing","moving light","note","pattern","piano","picture","production","record","reflection","reverb","resolution","sampler","sample","saxophone","screen","signal","softlight","song","sound","soundtrack","speaker","spot","strobe","streaming","surround","synth","tune","trumpet","uplight","video","violin","visual","voice","wave","wash"];function P5(){return`${mG[Math.floor(Math.random()*mG.length)]} ${hG[Math.floor(Math.random()*hG.length)]}`}var I5=e=>{if(typeof e=="object"&&e!==null&&!Array.isArray(e))return Object.keys(e).length===0;throw new Error("Variable is not an object")},vG=e=>Object.keys(e).reduce((t,a)=>(typeof e[a]<"u"&&(t[a]=e[a]),t),{});var b0={},To={init(e){b0=e},get(e){return b0[e]},set(e,t){b0[e]=t,Ri.sendAsJson("runtime-data",{[e]:t})},createBatch(){let e={};return{add(t,a){e[t]=a},send(){I5(e)||(b0={...b0,...e},Ri.sendAsJson("runtime-data",e))}}},poll(){return b0},broadcast(){Ri.sendAsJson("runtime-data",b0)}};function gG(e){let t=e.getHours(),a=e.getMinutes(),r=e.getSeconds();return t*Zn+a*Yi+r*ol}function M1(e){if(e instanceof Date)return gG(e);if(typeof e=="string"){if(bC(e)){let t=new Date(e);if(t instanceof Date&&!isNaN(t.getTime()))return gG(t)}return p0(e)}return typeof e=="number"?e*Yi:0}function xG(e){let t=e.getTimezoneOffset(),a=Intl.DateTimeFormat().resolvedOptions().timeZone,r=t<0?"+":"-",i=Math.abs(t),c=Math.floor(i/60),p=i%60;return`GMT ${r}${N4(c)}:${N4(p)} ${a}`}function Ap(){let e=new Date,t=e.getHours()*36e5;return t+=e.getMinutes()*6e4,t+=e.getSeconds()*1e3,t+=e.getMilliseconds(),t}function N5(){let e=new Date,t=e.getHours()*36e5;return t+=e.getMinutes()*6e4,t+=e.getSeconds()*1e3,t+=e.getMilliseconds(),[e.getTime(),t]}var fk=class{queue;escalateErrorFn;canLog=!1;constructor(){this.queue=[],this.escalateErrorFn=null,this.canLog=!ki}init(t){this.queue.forEach(a=>{this._push(a)}),this.queue=[],t&&(this.escalateErrorFn=t)}addToQueue(t){this.queue.push(t),this.queue.length>100&&this.queue.pop()}_push(t){(this.canLog||t.level==="SEVERE")&&(t.level==="SEVERE"?iu(`[${t.level}] ${t.origin} ${t.text}`):l5(`[${t.level}] ${t.origin} ${t.text}`)),this.addToQueue(t);try{Ri.sendAsJson("log",t)}catch{}}emit(t,a,r){let i={id:Ta(),level:t,origin:a,text:r,time:lc(Ap())};this._push(i)}info(t,a){this.emit("INFO",t,a)}warning(t,a){this.emit("WARN",t,a)}error(t,a,r=!1){this.emit("ERROR",t,a),r&&this.escalateErrorFn?.(a,!1)}crash(t,a){this.emit("SEVERE",t,a),this.escalateErrorFn?.(a,!0)}dump(){let t=this.queue;return this.queue=[],t}shutdown(){this.queue=[]}},At=new fk;var L1=class{state={duration:0,current:0,playback:"stop",direction:"count-down"};startedAt=null;pausedAt=null;initialDuration=0;constructor(t=0){this.state.duration=t,this.initialDuration=t,this.state.current=t}reset(){this.state={duration:0,current:0,playback:"stop",direction:"count-down"}}setTime(t){return this.state.duration=t,this.initialDuration=t,this.state.current=t,this.state}addTime(t){return this.state.duration+=t,this.state.current+=t,this.state}setDirection(t,a){return this.state.playback==="start"&&(this.startedAt=a,this.state.duration=this.state.current),this.state.direction=t,this.update(a),this.state}start(t){if(this.state.playback==="pause"){let a=this.pausedAt-this.startedAt;this.startedAt=t-a}else this.state.playback==="stop"&&(this.startedAt=t);return this.state.playback="start",this.update(t)}pause(t){return this.state.playback!=="start"?this.state:(this.state.playback="pause",this.pausedAt=t,this.state)}stop(){return this.state.playback="stop",this.state.duration=this.initialDuration,this.state.current=this.initialDuration,this.startedAt=null,this.state}update(t){if(this.state.playback==="start"){let a=t-this.startedAt;this.state.direction==="count-down"?this.state.current=this.state.duration-a:this.state.direction==="count-up"&&(this.state.current=this.state.duration+a)}return this.state}};var pu=class{aux1;aux2;aux3;interval=null;emit;getTime;constructor(t,a){this.aux1=new L1(Fn.auxTimerDefault),this.aux2=new L1(Fn.auxTimerDefault),this.aux3=new L1(Fn.auxTimerDefault),this.emit=t,this.getTime=a}hasActiveTimers(){return this.aux1.state.playback==="start"||this.aux2.state.playback==="start"||this.aux3.state.playback==="start"}startInterval(){this.interval||(this.interval=setInterval(this.update.bind(this),500))}stopInterval(){this.interval&&!this.hasActiveTimers()&&(clearInterval(this.interval),this.interval=null)}setDirection(t,a){return a===1?this.aux1.setDirection(t,this.getTime()):a===2?this.aux2.setDirection(t,this.getTime()):this.aux3.setDirection(t,this.getTime())}start(t){return this.startInterval(),t===1?this.aux1.start(this.getTime()):t===2?this.aux2.start(this.getTime()):this.aux3.start(this.getTime())}pause(t){let a;return t===1?a=this.aux1.pause(this.getTime()):t===2?a=this.aux2.pause(this.getTime()):a=this.aux3.pause(this.getTime()),this.hasActiveTimers()||this.stopInterval(),a}stop(t){let a;return t===1?a=this.aux1.stop():t===2?a=this.aux2.stop():a=this.aux3.stop(),this.hasActiveTimers()||this.stopInterval(),a}setTime(t,a){return a===1?this.aux1.setTime(t):a===2?this.aux2.setTime(t):this.aux3.setTime(t)}addTime(t,a){let r=a===1?this.aux1:a===2?this.aux2:this.aux3;return r.state.playback==="start"?(r.addTime(t),r.update(this.getTime())):r.addTime(t)}update(){let t={},a=this.getTime();this.aux1.state.playback==="start"&&(t.auxtimer1=this.aux1.update(a)),this.aux2.state.playback==="start"&&(t.auxtimer2=this.aux2.update(a)),this.aux3.state.playback==="start"&&(t.auxtimer3=this.aux3.update(a)),Object.keys(t).length>0&&this.emit(t)}};va([B1],pu.prototype,"setDirection",1),va([B1],pu.prototype,"start",1),va([B1],pu.prototype,"pause",1),va([B1],pu.prototype,"stop",1),va([B1],pu.prototype,"setTime",1),va([B1],pu.prototype,"addTime",1);function B1(e,t,a){let r=a.value;return a.value=function(...i){let c=r.apply(this,i),p=i[i.length-1];return this.emit({[`auxtimer${p}`]:c}),c},a}var E3e=e=>{for(let[t,a]of Object.entries(e))To.set(t,a)},S3e=()=>Date.now(),pn=new pu(E3e,S3e);function yG(e,t){let a=!1,r=null,i=()=>{r==null?a=!1:(e(...r),r=null,setTimeout(i,t))};return(...c)=>a?(r=c,!0):(e(...c),a=!0,setTimeout(i,t),!1)}var wG=()=>{},bG=e=>{};function _G(e,t){wG=yG(e,100),bG=t}function A3e(){return bG("message")}function X4(e){let t={...A3e()};if(e.timer!==void 0){let a=AC(e.timer);t.timer={...t.timer,...a}}return"secondary"in e&&e.secondary!==void 0&&(t.secondary=e.secondary),wG("message",t),t}function EG(e){if(!cr.boolean(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function Xn(e){if(!cr.string(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function M5(e){if(!cr.number(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function dc(e){if(!cr.object(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function hk(e){if(!cr.array(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function fl(e,t){if(!cr.objectWithKeys(e,t))throw new Error(`Unexpected payload type: ${String(e)}`)}function U1(e,t){if(typeof e!="string"||!Object.values(t).includes(e))throw new Error("Invalid value received");return e}function Tp(e){if(e==null||typeof e=="object")throw new Error("Invalid value received");return String(e)}function du(e){if(typeof e=="boolean")return e;if(typeof e=="string")switch(e.toLocaleLowerCase()){case"true":case"1":case"yes":return!0;case"false":case"0":case"no":case"":return!1;default:throw new Error("Invalid value received")}if(typeof e=="number"){if(e===0)return!1;if(e===1)return!0}throw new Error("Invalid value received")}function _0(e){if(e==null)throw new Error("Invalid value received");let t=Number(e);if(isNaN(t))throw new Error("Invalid value received");return t}function SG(e){if(typeof e!="string")throw new Error("Invalid colour value received");let t=e.toLocaleLowerCase();if(t.startsWith("#")){if(!M4(t))throw new Error("Invalid hex colour received");return t}if(t==="")return t;if(!(t in j4))throw new Error("Invalid colour name received");return t}function AG(e){return decodeURI(Tp(e))}function TG(e){dc(e);let t={};return"text"in e&&(t.text=decodeURI(Tp(e.text))),"visible"in e&&(t.visible=du(e.visible)),"blink"in e&&(t.blink=du(e.blink)),"blackout"in e&&(t.blackout=du(e.blackout)),"secondarySource"in e&&(t.secondarySource=F3e(e.secondarySource)),t}function T3e(e){return e==="aux1"||e==="aux2"||e==="aux3"||e==="secondary"||e===null}function F3e(e){return T3e(e)?e:null}var C3e=Object.getOwnPropertyNames,k3e=Object.getOwnPropertySymbols,O3e=Object.prototype.hasOwnProperty;function FG(e,t){return function(r,i,c){return e(r,i,c)&&t(r,i,c)}}function L5(e){return function(a,r,i){if(!a||!r||typeof a!="object"||typeof r!="object")return e(a,r,i);var c=i.cache,p=c.get(a),f=c.get(r);if(p&&f)return p===r&&f===a;c.set(a,r),c.set(r,a);var v=e(a,r,i);return c.delete(a),c.delete(r),v}}function CG(e){return C3e(e).concat(k3e(e))}var R3e=Object.hasOwn||function(e,t){return O3e.call(e,t)};function E0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var D3e="__v",P3e="__o",I3e="_owner",kG=Object.getOwnPropertyDescriptor,OG=Object.keys;function N3e(e,t,a){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!a.equals(e[r],t[r],r,r,e,t,a))return!1;return!0}function M3e(e,t){return E0(e.getTime(),t.getTime())}function L3e(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function B3e(e,t){return e===t}function RG(e,t,a){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),c=e.entries(),p,f,v=0;(p=c.next())&&!p.done;){for(var y=t.entries(),b=!1,E=0;(f=y.next())&&!f.done;){if(i[E]){E++;continue}var T=p.value,C=f.value;if(a.equals(T[0],C[0],v,E,e,t,a)&&a.equals(T[1],C[1],T[0],C[0],e,t,a)){b=i[E]=!0;break}E++}if(!b)return!1;v++}return!0}var U3e=E0;function j3e(e,t,a){var r=OG(e),i=r.length;if(OG(t).length!==i)return!1;for(;i-- >0;)if(!NG(e,t,a,r[i]))return!1;return!0}function J4(e,t,a){var r=CG(e),i=r.length;if(CG(t).length!==i)return!1;for(var c,p,f;i-- >0;)if(c=r[i],!NG(e,t,a,c)||(p=kG(e,c),f=kG(t,c),(p||f)&&(!p||!f||p.configurable!==f.configurable||p.enumerable!==f.enumerable||p.writable!==f.writable)))return!1;return!0}function q3e(e,t){return E0(e.valueOf(),t.valueOf())}function $3e(e,t){return e.source===t.source&&e.flags===t.flags}function DG(e,t,a){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),c=e.values(),p,f;(p=c.next())&&!p.done;){for(var v=t.values(),y=!1,b=0;(f=v.next())&&!f.done;){if(!i[b]&&a.equals(p.value,f.value,p.value,f.value,e,t,a)){y=i[b]=!0;break}b++}if(!y)return!1}return!0}function V3e(e,t){var a=e.length;if(t.length!==a)return!1;for(;a-- >0;)if(e[a]!==t[a])return!1;return!0}function H3e(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function NG(e,t,a,r){return(r===I3e||r===P3e||r===D3e)&&(e.$$typeof||t.$$typeof)?!0:R3e(t,r)&&a.equals(e[r],t[r],r,r,e,t,a)}var W3e="[object Arguments]",G3e="[object Boolean]",z3e="[object Date]",K3e="[object Error]",Z3e="[object Map]",Y3e="[object Number]",X3e="[object Object]",J3e="[object RegExp]",Q3e="[object Set]",e8e="[object String]",t8e="[object URL]",r8e=Array.isArray,PG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,IG=Object.assign,a8e=Object.prototype.toString.call.bind(Object.prototype.toString);function n8e(e){var t=e.areArraysEqual,a=e.areDatesEqual,r=e.areErrorsEqual,i=e.areFunctionsEqual,c=e.areMapsEqual,p=e.areNumbersEqual,f=e.areObjectsEqual,v=e.arePrimitiveWrappersEqual,y=e.areRegExpsEqual,b=e.areSetsEqual,E=e.areTypedArraysEqual,T=e.areUrlsEqual;return function(k,D,U){if(k===D)return!0;if(k==null||D==null)return!1;var z=typeof k;if(z!==typeof D)return!1;if(z!=="object")return z==="number"?p(k,D,U):z==="function"?i(k,D,U):!1;var oe=k.constructor;if(oe!==D.constructor)return!1;if(oe===Object)return f(k,D,U);if(r8e(k))return t(k,D,U);if(PG!=null&&PG(k))return E(k,D,U);if(oe===Date)return a(k,D,U);if(oe===RegExp)return y(k,D,U);if(oe===Map)return c(k,D,U);if(oe===Set)return b(k,D,U);var me=a8e(k);return me===z3e?a(k,D,U):me===J3e?y(k,D,U):me===Z3e?c(k,D,U):me===Q3e?b(k,D,U):me===X3e?typeof k.then!="function"&&typeof D.then!="function"&&f(k,D,U):me===t8e?T(k,D,U):me===K3e?r(k,D,U):me===W3e?f(k,D,U):me===G3e||me===Y3e||me===e8e?v(k,D,U):!1}}function i8e(e){var t=e.circular,a=e.createCustomConfig,r=e.strict,i={areArraysEqual:r?J4:N3e,areDatesEqual:M3e,areErrorsEqual:L3e,areFunctionsEqual:B3e,areMapsEqual:r?FG(RG,J4):RG,areNumbersEqual:U3e,areObjectsEqual:r?J4:j3e,arePrimitiveWrappersEqual:q3e,areRegExpsEqual:$3e,areSetsEqual:r?FG(DG,J4):DG,areTypedArraysEqual:r?J4:V3e,areUrlsEqual:H3e};if(a&&(i=IG({},i,a(i))),t){var c=L5(i.areArraysEqual),p=L5(i.areMapsEqual),f=L5(i.areObjectsEqual),v=L5(i.areSetsEqual);i=IG({},i,{areArraysEqual:c,areMapsEqual:p,areObjectsEqual:f,areSetsEqual:v})}return i}function s8e(e){return function(t,a,r,i,c,p,f){return e(t,a,f)}}function o8e(e){var t=e.circular,a=e.comparator,r=e.createState,i=e.equals,c=e.strict;if(r)return function(v,y){var b=r(),E=b.cache,T=E===void 0?t?new WeakMap:void 0:E,C=b.meta;return a(v,y,{cache:T,equals:i,meta:C,strict:c})};if(t)return function(v,y){return a(v,y,{cache:new WeakMap,equals:i,meta:void 0,strict:c})};var p={cache:void 0,equals:i,meta:void 0,strict:c};return function(v,y){return a(v,y,p)}}var fu=Fp(),tKe=Fp({strict:!0}),rKe=Fp({circular:!0}),aKe=Fp({circular:!0,strict:!0}),nKe=Fp({createInternalComparator:function(){return E0}}),iKe=Fp({strict:!0,createInternalComparator:function(){return E0}}),sKe=Fp({circular:!0,createInternalComparator:function(){return E0}}),oKe=Fp({circular:!0,createInternalComparator:function(){return E0},strict:!0});function Fp(e){e===void 0&&(e={});var t=e.circular,a=t===void 0?!1:t,r=e.createInternalComparator,i=e.createState,c=e.strict,p=c===void 0?!1:c,f=i8e(e),v=n8e(f),y=r?r(v):s8e(v);return o8e({circular:a,comparator:v,createState:i,equals:y,strict:p})}var MG=(e,t)=>t<e?t+Or:t;function S0(e){let{startedAt:t,duration:a,addedTime:r}=e.timer;if(e.eventNow===null)return null;let{countToEnd:i,timeEnd:c}=e.eventNow,{pausedAt:p}=e._timer,{clock:f}=e;if(t===null)return null;let v=p!=null?f-p:0;if(i)return c+r+v;let y=t+a+r+v;return y>Or?y-Or:Math.max(y,t)}function Q4(e){let{startedAt:t,duration:a,addedTime:r}=e.timer,{countToEnd:i,timeStart:c,timeEnd:p}=e.eventNow,{pausedAt:f}=e._timer,{clock:v}=e;if(i)return(c>p?Or:0)-v+p+r;if(t===null)return a;if(f!=null)return t+a+r-f;let b=t>v?Or:0;return t+a+r-v-b}function LG(e,t,a){if(e.timer.expectedFinish===null||e.timer.startedAt===null)return!1;let{startedAt:r,expectedFinish:i}=e.timer,{clock:c}=e,f=t>Or-a&&c<a?c+Or:c,v=t-f,y=Math.abs(v)>a,b=i>=r?i:i+Or;return y&&(f>b||f<r)}function ev(e){let{eventNow:t,clock:a,_startDayOffset:r}=e,{addedTime:i,current:c,startedAt:p}=e.timer;if(t===null||p===null||r===null)return{absolute:0,relative:0};let{countToEnd:f,timeStart:v,dayOffset:y}=t,{plannedStart:b,actualStart:E}=e.rundown,T=p+r*Or-(v+y*Or),C=Math.abs(Math.min(c,0)),k=e._timer.pausedAt===null?0:a-e._timer.pausedAt,D=T+C+k+i,U=D+b-E-r*Or;return f?{absolute:C,relative:U}:{absolute:D,relative:U}}function gk(e){if(!d0(e.timer.playback))return"none";let t=e.timer.current;if(t===null||e.eventNow===null||e.timer.secondaryTimer!=null)return"pending";if(t<0)return"overtime";let a=e.eventNow.timeDanger;if(t<=a)return"danger";let r=e.eventNow.timeWarning;return t<=r?"warning":"default"}function xk(e,t){let a=t-e;return a>=12*Zn?-1:a<-12*Zn?1:0}function BG(e,t,a){if(kr(t))return S1(t,vC(e.entries,e.order,a));let r=t.id||j1(e);if(fs(t))return E1({duration:t.duration??0,id:r});if(ya(t))return u0({id:r,title:t.title??""});if(ms(t))return A1({...t,id:r});throw new Error("Invalid event type")}function c8e(e,t){if(Object.keys(t).length===0)return e;let{timeStart:a,timeEnd:r,duration:i,timeStrategy:c}=D4(t?.timeStart??e.timeStart,t?.timeEnd??e.timeEnd,t?.duration??e.duration,t?.timeStrategy??p8e(t?.timeEnd,t?.duration,e.timeStrategy));return{id:e.id,type:"event",flag:typeof t.flag=="boolean"?t.flag:e.flag,title:ga(t.title,e.title),timeStart:a,timeEnd:r,duration:i,timeStrategy:c,linkStart:typeof t.linkStart=="boolean"?t.linkStart:e.linkStart,endAction:nu(t.endAction,e.endAction),timerType:c0(t.timerType,e.timerType),countToEnd:typeof t.countToEnd=="boolean"?t.countToEnd:e.countToEnd,skip:typeof t.skip=="boolean"?t.skip:e.skip,note:ga(t.note,e.note),colour:ga(t.colour,e.colour),delay:e.delay,dayOffset:e.dayOffset,gap:e.gap,cue:ga(t.cue??null,e.cue),parent:e.parent,revision:e.revision,timeWarning:t.timeWarning??e.timeWarning,timeDanger:t.timeDanger??e.timeDanger,custom:{...e.custom,...t.custom},triggers:t.triggers??e.triggers}}function l8e(e,t){if(Object.keys(t).length===0)return e;let a=()=>typeof t.targetDuration=="number"?t.targetDuration:t.targetDuration===null||t.targetDuration===""?null:e.targetDuration;return{id:e.id,type:"group",title:ga(t.title,e.title),note:ga(t.note,e.note),entries:t.entries??e.entries,targetDuration:a(),colour:ga(t.colour,e.colour),revision:e.revision,timeStart:e.timeStart,timeEnd:e.timeEnd,duration:e.duration,isFirstLinked:e.isFirstLinked,custom:{...e.custom,...t.custom}}}function u8e(e,t){return Object.keys(t).length===0?e:{id:e.id,type:"milestone",cue:ga(t.cue??null,e.cue),title:ga(t.title,e.title),note:ga(t.note,e.note),colour:ga(t.colour,e.colour),revision:e.revision,custom:{...e.custom,...t.custom},parent:e.parent}}function UG(e,t){if(kr(e)){let a=c8e(e,t);return a.revision++,a}if(ya(e)){let a=l8e(e,t);return a.revision++,a}if(ms(e)){let a=u8e(e,t);return a.revision++,a}return{...e,...t}}function p8e(e,t,a){return e&&!t?"lock-end":!e&&t?"lock-duration":a}function j1(e){let t;do t=Ta();while(e.entries[t]);return t}var jG=(C=>(C[C.id=0]="id",C[C.type=1]="type",C[C.cue=2]="cue",C[C.title=3]="title",C[C.note=4]="note",C[C.endAction=5]="endAction",C[C.timerType=6]="timerType",C[C.countToEnd=7]="countToEnd",C[C.colour=8]="colour",C[C.timeWarning=9]="timeWarning",C[C.timeDanger=10]="timeDanger",C[C.custom=11]="custom",C[C.triggers=12]="triggers",C))(jG||{});function qG(e){return Object.keys(e).some(yk)}function yk(e){return!(e in jG)}function wk(e,t){return Object.keys(t).some(a=>!Object.hasOwn(e,a)||e[a]!==t[a])}function bk(e,t){let a=e.findIndex(r=>r===t);return a===-1?e:e.toSpliced(a,1)}function d8e(e,t){let a=structuredClone(e);return a.id=t,a.revision=0,a}function f8e(e,t){let a=structuredClone(e);return a.id=t,a}function m8e(e,t){let a=structuredClone(e);return a.id=t,a}function h8e(e,t){let a=structuredClone(e);return a.id=t,a.entries=[],a.title=`${e.title||"Untitled"} (copy)`,a.revision=0,a}function $G(e,t){let a=j1(t),r=h8e(e,a),i=[],c=[];for(let p=0;p<e.entries.length;p++){let f=e.entries[p],v=t.entries[f];if(!v)continue;let y=j1(t),b=_k(v,y);b.parent=r.id,c.push(y),i.push(b)}return r.entries=c,{newGroup:r,nestedEntries:i}}function _k(e,t){if(kr(e))return d8e(e,t);if(fs(e))return f8e(e,t);if(ms(e))return m8e(e,t);throw new Error(`Unsupported entry type for cloning: ${e}`)}function VG(e,t){return!t||t.duration===0?0:t.timeStart+t.duration>=Or||e.timeStart<=t.timeStart?1:0}function q1(e,t){for(let a in e)Object.hasOwn(t,a)?e[a]===""&&delete e[a]:delete e[a]}function HG(e,t){let a=e.timedEventOrder[t],r=e.playableEventOrder.findIndex(i=>i===a);return r<0?null:r}function Ek(e,t){let a=e.playableEventOrder[t];return e.timedEventOrder.findIndex(i=>i===a)}function A0(e){return Object.values(e).map(({id:t,flatOrder:a,title:r,revision:i})=>({id:t,numEntries:a.length,title:r,revision:i}))}function WG(e,t){let a=Ta(),r=structuredClone(e);return r.id=a,r.title=t,r.revision=0,r}function GG(e,t,a){let r=t.playableEventOrder[0];if(!r)return{event:null,index:null};let i=0;for(let c=0;c<t.playableEventOrder.length;c++){let p=t.playableEventOrder[c];if(!p)continue;let f=e.entries[p];if(f.duration===0)continue;f.timeStart>f.timeEnd&&i++;let v=Or*i,y=f.timeStart+v,b=f.timeEnd+v,E=MG(y,b);if(E<=a)continue;return E>Or&&a<f.timeEnd||a>=f.timeStart?{event:f,index:Ek(t,c)}:{event:f,index:Ek(t,c),isPending:!0}}return{event:e.entries[r],index:0,isPending:!0}}function tv(e,t){return e<t?e+Or:e}var ee={clock:Ap(),groupNow:null,eventNow:null,eventNext:null,eventFlag:null,offset:{...el.offset},timer:{...el.timer},rundown:{...el.rundown},_timer:{forceFinish:null,pausedAt:null,secondaryTarget:null,hasFinished:!1},_rundown:{totalDelay:0},_group:null,_flag:null,_end:null,_startEpoch:null,_startDayOffset:null};function na(){return{...ee,eventNow:ee.eventNow?{...ee.eventNow}:null,eventNext:ee.eventNext?{...ee.eventNext}:null,eventFlag:ee.eventFlag?{...ee.eventFlag}:null,groupNow:ee.groupNow?{...ee.groupNow}:null,offset:{...ee.offset},rundown:{...ee.rundown},timer:{...ee.timer},_timer:{...ee._timer},_rundown:{...ee._rundown}}}function zG(){ee.eventNow=null,ee.eventNext=null,ee.offset.absolute=0,ee.offset.relative=0,ee.offset.expectedFlagStart=null,ee.offset.expectedGroupEnd=null,ee.offset.expectedRundownEnd=null,ee.rundown.selectedEventIndex=null,ee.timer.playback="stop",ee.clock=Ap(),ee.timer={...el.timer},ee._timer.forceFinish=null,ee._timer.pausedAt=null,ee._timer.secondaryTarget=null,ee._timer.hasFinished=!1}function v8e(){ee.eventNow=null,ee.eventNext=null,ee.eventFlag=null,ee._flag=null,ee.groupNow=null,ee._group=null,ee.rundown.actualStart=null,ee.rundown.selectedEventIndex=null,ee.offset.absolute=0,ee.offset.relative=0,ee.offset.expectedRundownEnd=null,ee.offset.expectedGroupEnd=null,ee.offset.expectedFlagStart=null,ee._end=null,ee.timer.playback="stop",ee.clock=Ap(),ee.timer={...el.timer},ee._timer.forceFinish=null,ee._timer.pausedAt=null,ee._timer.secondaryTarget=null,ee._timer.hasFinished=!1,ee._startEpoch=null,ee._startDayOffset=null,ee.rundown.currentDay=null}function g8e(e){for(let t in e)t in ee.timer?ee.timer[t]=e[t]:t in ee._timer&&(ee._timer[t]=e[t])}function KG(e){ee._rundown.totalDelay=e.totalDelay,ee.rundown.numEvents=e.numEvents,ee.rundown.plannedStart=e.firstStart,ee.rundown.plannedEnd=e.firstStart===null?null:e.firstStart+e.totalDuration,d0(ee.timer.playback)&&$1()}function Sk(e,t,a,r){zG();let{timedEventOrder:i}=a;if(i.length===0)return!1;let c=i.findIndex(p=>p===e.id);if(c===-1)return!1;if(Ak(t,a,c),Tk(t,a,c),Ck(t,a,c),ee.timer.playback="armed",ee.timer.duration=cc(e.timeStart,e.timeEnd),ee.timer.current=Q4(ee),ee.rundown.numEvents=a.timedEventOrder.length,r){g8e(r);let p=r?.startEpoch,f=r?.firstStart,v=r?.currentDay;if((f===null||typeof f=="number")&&(p===null||typeof p=="number")){ee.rundown.actualStart=f,ee._startEpoch=p,f!==null&&ee.rundown.plannedStart!==null&&(ee._startDayOffset=xk(ee.rundown.plannedStart,f)),v!==void 0&&(ee.rundown.currentDay=v);let{absolute:y,relative:b}=ev(ee);ee.offset.absolute=y,ee.offset.relative=b,$1()}}return e.id===ee.eventNow?.id}function Ak(e,t,a=ee.rundown.selectedEventIndex){if(a===null){ee.rundown.selectedEventIndex=null,ee.eventNow=null;return}let r=t.timedEventOrder[a];if(!r){ee.eventNow=null;return}let i=e.entries[r];ee.rundown.selectedEventIndex=a,ee.eventNow=i}function Tk(e,t,a=ee.rundown.selectedEventIndex){if(a===null){ee.eventNext=null;return}let r=HG(t,a);if(r===null||r>t.playableEventOrder.length-2){ee.eventNext=null;return}let i=t.playableEventOrder[r+1];if(!i){ee.eventNext=null;return}ee.eventNext=e.entries[i]}function ZG(e,t,a,r){Sk(t,a,r,e)}function x8e(e){if(ee.eventNow!==null){if(e){if(ee.eventNow=e,ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=Q4(ee),ee.timer.expectedFinish=S0(ee),ee.timer.playback==="roll"){let t=ee.clock-ee.offset.absolute;ee._timer.secondaryTarget!==null&&(ee.eventNow.timeStart<t&&t<ee.eventNow.timeEnd?(ee._timer.secondaryTarget=ee.eventNow.timeStart,ee.timer.secondaryTimer=ee._timer.secondaryTarget-t):ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,t))}return ee.eventNow.id}return ee.timer.playback="armed",ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=ee.timer.duration,ee.timer.startedAt=null,ee._timer.hasFinished=!1,ee.timer.addedTime=0,ee._timer.pausedAt=null,ee.timer.elapsed=null,ee.timer.expectedFinish=S0(ee),ee.eventNow.id}}function YG(e,t){let a=t.timedEventOrder.findIndex(r=>r===ee.eventNow?.id);Ak(e,t,a>=0?a:void 0),Tk(e,t,a>=0?a:void 0),x8e(ee.eventNow??void 0),Ck(e,t,a)}function XG(e=ee){if(e.eventNow===null||e.timer.playback==="play")return!1;let[t,a]=N5();if(e.clock=a,e.timer.secondaryTimer=null,e._timer.pausedAt){let c=e.clock-e._timer.pausedAt;e.timer.addedTime+=c,e._timer.pausedAt=null}e.timer.startedAt===null&&(e.timer.startedAt=e.clock),e.timer.playback="play",e.timer.expectedFinish=S0(e),e.timer.elapsed=0,e.rundown.actualStart===null&&(e._startDayOffset=xk(e.eventNow.timeStart,e.clock)+e.eventNow.dayOffset,e.rundown.currentDay=e._startDayOffset,e._startEpoch=t,e.rundown.actualStart=e.clock),e.groupNow!==null&&e.rundown.actualGroupStart===null&&(e.rundown.actualGroupStart=e.clock),ee.timer.phase=gk(ee);let{absolute:r,relative:i}=ev(ee);return ee.offset.absolute=r,ee.offset.relative=i,$1(),!0}function JG(e=ee){return e.timer.playback!=="play"?!1:(e.timer.playback="pause",e.clock=Ap(),e._timer.pausedAt=e.clock,!0)}function B5(e=ee){return e.timer.playback==="stop"?!1:(v8e(),!0)}function QG(e){if(ee.timer.current===null)return!1;e<0&&Math.abs(e)>ee.timer.current&&!ee._timer.hasFinished?ee._timer.forceFinish=Ap():ee.timer.current<0&&ee.timer.current+e>0&&(ee._timer.hasFinished=!1),ee.timer.addedTime+=e,ee.timer.current+=e;let{absolute:a,relative:r}=ev(ee);return ee.offset.absolute=a,ee.offset.relative=r,ee.timer.expectedFinish=S0(ee),$1(),!0}function ez(){let e=ee.clock,[t,a]=N5();if(ee.clock=a,!d0(ee.timer.playback))return p();if(ee._startDayOffset!==null&&ee._startEpoch&&(ee.rundown.currentDay=ee._startDayOffset+Math.floor((t-ee._startEpoch)/Or)),ee.timer.playback==="roll"&&ee.timer.secondaryTimer!==null){let v=e>ee.clock;return f(v)}ee.timer.secondaryTimer=null,ee.timer.current=Q4(ee),ee.timer.expectedFinish=S0(ee),ee.timer.phase=gk(ee),ee.timer.elapsed=ee.timer.duration-ee.timer.current;let{absolute:r,relative:i}=ev(ee);ee.offset.absolute=r,ee.offset.relative=i;let c=!!ee._timer.forceFinish||ee.timer.current<=Fn.triggerAhead&&!ee._timer.hasFinished;return c?ee._timer.hasFinished=!0:ee.timer.expectedFinish=S0(ee),$1(),{hasTimerFinished:c,hasSecondaryTimerFinished:!1};function p(){return{hasTimerFinished:!1,hasSecondaryTimerFinished:!1}}function f(v){let y=ee.clock+ee.offset.absolute;return ee.timer.phase="pending",v&&(ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,y)),ee.timer.secondaryTimer=ee._timer.secondaryTarget-y,{hasTimerFinished:!1,hasSecondaryTimerFinished:ee.timer.secondaryTimer<=0}}}function Fk(e,t,a){if(ee.timer.playback==="play"&&ee.rundown.selectedEventIndex!==null)return ee.timer.playback="roll",{eventId:ee.eventNow?.id??null,didStart:!1};let[r,i]=N5();if(ee.clock=i,ee.timer.playback==="armed"||ee.timer.phase==="pending"){a&&(ee.offset={...a}),ee.timer.playback="roll";let b=ee.eventNow.timeEnd<ee.eventNow.timeStart?ee.eventNow.timeEnd+Or:ee.eventNow.timeEnd;ee.timer.expectedFinish=b;let E=ee.clock-ee.offset.absolute;ee.timer.duration=cc(ee.eventNow.timeStart,b),ee.timer.current=ee.timer.duration,ee.timer.elapsed=0;let T=TC(ee.eventNow.timeStart,ee.eventNow.timeEnd,E);if(T){let C=ee.eventNow.timeStart;ee.timer.startedAt=C,ee.timer.secondaryTimer=null,ee.groupNow!==null&&ee.rundown.actualGroupStart===null&&(ee.rundown.actualGroupStart=C),ee.rundown.actualStart===null&&(ee.rundown.actualStart=C,ee._startDayOffset=0,ee._startEpoch=r)}else ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,E),ee.timer.secondaryTimer=ee._timer.secondaryTarget-E,ee.timer.phase="pending";return{eventId:ee.eventNow.id,didStart:T}}if(t.playableEventOrder.length===0)throw new Error("No playable events found");zG(),a&&(ee.offset={...a});let c=ee.clock-ee.offset.absolute,{index:p,isPending:f}=GG(e,t,c);if(Ak(e,t,p),Tk(e,t,p),Ck(e,t,p),ee.timer.playback="roll",ee.rundown.numEvents=t.timedEventOrder.length,f)return ee.timer.phase="pending",ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,c),ee.timer.secondaryTimer=ee._timer.secondaryTarget-c,ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=ee.timer.duration,{eventId:ee.eventNow.id,didStart:!1};let v=ee.eventNow.timeStart,y=ee.eventNow.timeEnd<ee.eventNow.timeStart?ee.eventNow.timeEnd+Or:ee.eventNow.timeEnd;return ee.timer.startedAt=v,ee.timer.expectedFinish=y,ee.timer.duration=cc(ee.eventNow.timeStart,y),ee.timer.current=Q4(ee),ee.timer.elapsed=0,ee.rundown.actualStart=v,ee.groupNow!==null&&ee.rundown.actualGroupStart===null&&(ee.rundown.actualGroupStart=v),ee._startDayOffset=0,ee._startEpoch=r,{eventId:ee.eventNow.id,didStart:!0}}function $1(e=ee){e.offset.expectedRundownEnd=null,e.offset.expectedGroupEnd=null,e.offset.expectedFlagStart=null,e.offset.expectedRundownEnd=null;let{offset:t}=e,{plannedStart:a,actualStart:r}=e.rundown,{eventNow:i}=e;if(i){if(e.groupNow){let{_group:c}=e;if(c!==null){let{event:p,accumulatedGap:f,isLinkedToLoaded:v}=c,y=B4(p,{currentDay:e.rundown.currentDay,totalGap:f,isLinkedToLoaded:v,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedGroupEnd=y+p.duration}}if(e.eventFlag){let{_flag:c}=e;if(c){let{event:p,accumulatedGap:f,isLinkedToLoaded:v}=c,y=B4(p,{currentDay:e.rundown.currentDay,totalGap:f,isLinkedToLoaded:v,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedFlagStart=y}}if(e._end){let{event:c,accumulatedGap:p,isLinkedToLoaded:f}=e._end,v=B4(c,{currentDay:e.rundown.currentDay,totalGap:p,isLinkedToLoaded:f,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedRundownEnd=v+c.duration}}}function Ck(e,t,a,r=ee){let i=r.groupNow?.id;if(r.groupNow=null,r._group=null,r.eventFlag=null,r._flag=null,r._end=null,a===null||r.eventNow===null){r.rundown.actualGroupStart=null;return}let c=r.eventNow.parent,p=t.flags.length!==0,{playableEventOrder:f}=t,{entries:v}=e,y=c?v[c].entries:null;r.groupNow=c?v[c]:null;let b=y?dC(e.entries,y).lastEvent:null;i!==c&&(r.rundown.actualGroupStart=null);let E=!p,T=b===null,C=0,k=!0;for(let z=a;z<f.length;z++){let oe=v[f[z]];kr(oe)&&(z!==a&&(C+=oe.gap,k=k&&oe.linkStart,!E&&t.flags.includes(oe.id)&&(E=!0,r.eventFlag=oe,r._flag={event:oe,isLinkedToLoaded:k,accumulatedGap:C})),!T&&oe.id===b?.id&&(T=!0,r._group={event:b,isLinkedToLoaded:k,accumulatedGap:C}))}let D=f.at(-1),U=D?v[D]:null;U&&(r._end={event:U,isLinkedToLoaded:k,accumulatedGap:C})}function tz(e){ee.offset.mode=e,d0(ee.timer.playback)&&$1()}var V1=new Map,H1=null;function az(){return H1===null&&(H1=Object.fromEntries(V1)),H1}function kk(e){H1=null,e?V1.delete(e):V1.clear()}function W1(e,t){if(!t.eventNow?.id)return;let a=t.eventNow.id;if(e==="onStart"){V1.set(a,{startedAt:t.timer.startedAt,endedAt:null}),H1=null;return}if(e==="onStop"){let r=V1.get(a)?.startedAt??null;V1.set(a,{startedAt:r,endedAt:t.clock}),H1=null,dn("report")}}var fi=e=>e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),rv=e=>{if(typeof e!="string")throw new On("can't pack a non-string into an osc-string");if(e.indexOf("\0")!==-1)throw new On("Can't pack an osc-string that contains NULL characters");let t=new TextEncoder().encode(e),a=4-t.length%4,r=new ArrayBuffer(t.length+a);return new Uint8Array(r).set(t),r},G1=e=>{let t=fi(e),a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=a.indexOf(0);if(r===-1)throw new On("All osc-strings must contain a null character");let i=a.slice(0,r),c=4-i.length%4;if(a.length<r+c)throw new On("Not enough padding for osc-string");for(let p=0;p<c;p++)if(a[i.length+p]!==0)throw new On("Corrupt padding for osc-string");return{value:new TextDecoder().decode(i),rest:fc(t,r+c)}},fc=(e,t)=>new DataView(e.buffer,e.byteOffset+t,e.byteLength-t),Ok=e=>{let t=fi(e),a=4;if(t.byteLength<a)throw new On("buffer is not big enough for integer type");return{value:t.getInt32(0,!1),rest:fc(t,a)}},nz=e=>{let t=fi(e),a=4;if(t.byteLength<a*2)throw new On("buffer is not big enough to contain a timetag");let r=t.getUint32(0,!1),i=t.getUint32(a,!1);return{value:[r,i],rest:fc(t,a*2)}};var iz=e=>{let t=e.getTime()/1e3,a=Math.floor(t);return w8e(a,t-a)},w8e=(e,t)=>{let a=e+2208988800,r=Math.round(4294967296*t);return[a,r]};var sz=e=>{let t,a;typeof e=="object"&&"getTime"in e?[t,a]=iz(e):[t,a]=e;let r=new DataView(new ArrayBuffer(8));return r.setUint32(0,t,!1),r.setUint32(4,a,!1),r.buffer},oz=e=>{let t=new DataView(new ArrayBuffer(4));return t.setInt32(0,e,!1),t.buffer},b8e=(e,t)=>{switch(e){case"s":{let{value:a,rest:r}=G1(t);return{value:{type:"string",value:a},rest:r}}case"S":{let{value:a,rest:r}=G1(t);return{value:{type:"symbol",value:a},rest:r}}case"i":{let{value:a,rest:r}=Ok(t);return{value:{type:"integer",value:a},rest:r}}case"t":{let{value:a,rest:r}=nz(t);return{value:{type:"timetag",value:a},rest:r}}case"f":{let a=fi(t);return{value:{type:"float",value:a.getFloat32(0,!1)},rest:fc(a,4)}}case"d":{let a=fi(t);return{value:{type:"double",value:a.getFloat64(0,!1)},rest:fc(a,8)}}case"b":{let a=fi(t),{value:r,rest:i}=Ok(a),c=(4-r%4)%4;return{value:{type:"blob",value:new DataView(i.buffer,i.byteOffset,r)},rest:fc(i,r+c)}}case"r":{let a=fi(t);return{value:{type:"color",value:{red:a.getUint8(0),green:a.getUint8(1),blue:a.getUint8(2),alpha:a.getUint8(3)}},rest:fc(a,4)}}case"T":return{value:{type:"true",value:!0},rest:fi(t)};case"F":return{value:{type:"false",value:!1},rest:fi(t)};case"N":return{value:{type:"null",value:null},rest:fi(t)};case"I":return{value:{type:"bang",value:"bang"},rest:fi(t)};case"c":{let a=fi(t),r=a.getUint32(0,!1);return{value:{type:"character",value:String.fromCodePoint(r)},rest:fc(a,4)}}case"h":{let a=fi(t);return{value:{type:"bigint",value:a.getBigInt64(0,!1)},rest:fc(a,8)}}case"m":{let a=fi(t);if(a.byteLength<4)throw new On("buffer is not big enough to contain a midi packet");return{value:{type:"midi",value:[...new Uint8Array(a.buffer,a.byteOffset,4)]},rest:fc(a,4)}}}},_8e=e=>{switch(e.type){case"string":return rv(e.value);case"symbol":return rv(e.value);case"integer":return oz(e.value);case"timetag":return sz(e.value);case"character":{let t=[...e.value];if(t.length!==1)throw new On("Can only send a single character");let a=new DataView(new ArrayBuffer(4));return a.setUint32(0,t[0].codePointAt(0)??0,!1),a.buffer}case"float":{let t=new DataView(new ArrayBuffer(4));return t.setFloat32(0,e.value,!1),t.buffer}case"bigint":{let t=new DataView(new ArrayBuffer(8));return t.setBigInt64(0,e.value,!1),t.buffer}case"double":{let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e.value,!1),t.buffer}case"blob":{let t=fi(e.value),a=(4-e.value.byteLength%4)%4,r=new DataView(new ArrayBuffer(4+e.value.byteLength+a));return r.setUint32(0,e.value.byteLength,!1),new Uint8Array(r.buffer,r.byteOffset+4).set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),r.buffer}case"color":{let t=new DataView(new ArrayBuffer(16));return t.setUint8(0,e.value.red),t.setUint8(1,e.value.green),t.setUint8(2,e.value.blue),t.setUint8(3,e.value.alpha),t.buffer}case"midi":return new Uint8Array(e.value).buffer;case"true":return new ArrayBuffer(0);case"false":return new ArrayBuffer(0);case"null":return new ArrayBuffer(0);case"bang":return new ArrayBuffer(0)}},E8e={string:"s",integer:"i",timetag:"t",float:"f",double:"d",blob:"b",true:"T",false:"F",null:"N",bang:"I",symbol:"S",character:"c",color:"r",midi:"m",bigint:"h"},S8e=e=>{if(e===null)return{type:"null"};if(typeof e=="object"&&"type"in e)return e;if(e==="bang")return{type:"bang"};if(typeof e=="string")return{type:"string",value:e};if(typeof e=="number")return{type:"float",value:e};if(e instanceof Date)return{type:"timetag",value:e};if(e instanceof ArrayBuffer)return{type:"blob",value:e};if(typeof e=="object"&&"buffer"in e)return{type:"blob",value:e};if(typeof e=="object"&&"red"in e)return{type:"color",value:e};if(typeof e=="bigint")return{type:"bigint",value:e};if(e===!0)return{type:"true"};if(e===!1)return{type:"false"};throw new On("Invalid argument: "+e)},A8e=e=>{let{value:t,rest:a}=G1(e);if(e=a,t[0]!=="/")throw new On("addresses must start with /");if(!e.byteLength)return{address:t,args:[],oscType:"message"};let r=G1(e),i=r.value;if(e=r.rest,i[0]!==",")throw new On("Argument lists must begin with ,");let c=[],p=[c];for(let f of i.slice(1)){if(f==="["){p.push([]);continue}if(f==="]"){if(p.length<=1)throw new On("Mismatched ']' character.");{let y=p.pop();p[p.length-1].push({type:"array",value:y})}continue}let v=b8e(f,e);if(v===void 0)throw new On("I don't understand the argument code "+f);e=v.rest,p[p.length-1].push(v.value)}if(p.length!==1)throw new On("Mismatched '[' character");return{address:t,args:c,oscType:"message"}},T8e=e=>{let t=G1(e),a=t.value;if(e=t.rest,a!=="#bundle")throw new On("osc-bundles must begin with #bundle");let r=nz(e),i=r.value;e=r.rest;let c=O8e(e,p=>Rk(p));return{timetag:i,elements:c,oscType:"bundle"}},Rk=e=>k8e(e)?T8e(e):A8e(e),cz=e=>{let t="",a=[];for(let r of e)if(r!==null&&(Array.isArray(r)||typeof r=="object"&&"type"in r&&r.type==="array")){let{type:i,args:c}=cz(Array.isArray(r)?r:r.value);t+="["+i+"]",a=a.concat(c)}else{let i=S8e(r),c=E8e[i.type],p=_8e(i);t+=c,a.push(p)}return{type:t,args:a}},lz=e=>{let t=e.reduce((i,c)=>i+c.byteLength,0),a=new Uint8Array(t),r=0;for(let i of e){let c=fi(i);a.set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength),r),r+=c.byteLength}return a.buffer},F8e=e=>{let t=typeof e=="string"?e:e.address,a=typeof e=="string"?[]:e.args===void 0?[]:Array.isArray(e.args)?e.args:[e.args],r=rv(t),{type:i,args:c}=cz(a);return new DataView(lz([r,rv(","+i)].concat(c)))},C8e=e=>{let t=e.elements===void 0?[]:Array.isArray(e.elements)?e.elements:[e.elements],a=rv("#bundle"),r=sz(e.timetag),i=t.reduce((c,p)=>{let f=Dk(p),v=oz(f.byteLength);return c.concat([new DataView(v),f])},new Array);return new DataView(lz([a,r,...i]))},Dk=e=>typeof e=="object"&&"timetag"in e?C8e(e):F8e(e);var On=class extends Error{constructor(t){super(t),this.name="OSCError"}},k8e=e=>G1(e).value==="#bundle",O8e=(e,t)=>{let a=fi(e),r=new Array;for(;a.byteLength;){let{value:i,rest:c}=Ok(a);if(a=c,i>a.byteLength)throw new On("Invalid bundle list: size of element is bigger than buffer");let p=new DataView(a.buffer,a.byteOffset,i);try{r.push(t(p))}catch{}a=fc(a,i)}return r};var uz=e=>Rk(e),pz=e=>Dk(e);var wz=qt(require("node:dgram"),1);function fz(e){return["equals","not_equals","greater_than","less_than","contains"].includes(e)}function mz(e){return e==="all"||e==="any"}function hz(e){return NA.includes(e)}function dz(e){let t=Number(e);return Number.isNaN(t)?e.startsWith('"')&&e.endsWith('"')?{type:"string",value:e.substring(1,e.length-1)}:e==="TRUE"?{type:"true"}:e==="FALSE"?{type:"false"}:{type:"string",value:e}:{type:e.includes(".")?"float":"integer",value:t}}function vz(e){if(typeof e>"u"||e==="")return;let t=EC(e);return t?t.length===1?dz(t[0]):t.map(dz):void 0}var D8e=/{{(.*?)}}/g;function K1(e,t,a=P8e){let r=e,i=Array.from(r.matchAll(D8e));for(let c of i){let p=c[1],f=p.split("."),v;if(f[0]==="human"){let y=f[1];if(y in a){let b=`{{${a[y].key}}}`,E=K1(b,t,a);v=a[y].cb(E)}else v=void 0}else v=L4(p,t);v!==void 0&&(r=r.replace(c[0],v))}return r}function z1(e,t=!1){let a=null;if(e!=="null"){let i=Number(e);Number.isNaN(i)||(a=i)}let r=lc(a,{fallback:t?"00:00":"00:00:00"});return t&&(r=_C(r)),r}var P8e={clock:{key:"clock",cb:e=>z1(e)},duration:{key:"timer.duration",cb:e=>z1(e,!0)},expectedEnd:{key:"timer.expectedFinish",cb:e=>z1(e)},runningTimer:{key:"timer.current",cb:e=>z1(e,!0)},elapsedTime:{key:"timer.elapsed",cb:e=>z1(e,!0)},startedAt:{key:"timer.startedAt",cb:e=>z1(e)}};function Pk(e,t){return typeof e=="boolean"?I8e(e,t):typeof e=="string"?e.toLowerCase()===t:t===""?e==null:e==t}function Ik(e,t){return typeof e=="boolean"?!1:typeof e=="string"?e.toLowerCase().includes(t):typeof e=="number"?e.toString().toLowerCase().includes(t):!1}function gz(e,t){if(typeof e!="number")return!1;let a=Number(t);return isNaN(a)?!1:e>a}function xz(e,t){if(typeof e!="number")return!1;let a=Number(t);return isNaN(a)?!1:e<a}function I8e(e,t){return t==="true"?e===!0:t==="false"?e===!1:!1}function N8e(e,t,a){for(let r=0;r<t.length;r++){let i=t[r],c=e[i];if(kr(c)&&c.triggers){for(let p of c.triggers)if(p.automationId===a)return c.id}}}function yz(e,t){for(let a in e){let r=e[a],i=N8e(r.entries,r.flatOrder,t);if(i)return[r.title,i]}}var M8e=wz.createSocket("udp4");function bz(e,t){let a=L8e(e,t);B8e(e.targetIP,e.targetPort,a)}function L8e(e,t){let a=K1(e.address,t),r=e.args?K1(e.args,t):void 0,i=vz(r);return{address:a,args:i}}function B8e(e,t,a){let r=pz(a);M8e.send(r,0,r.byteLength,t,e,i=>{i&&At.warning("TX",`Failed sending OSC: ${i}`)})}function _z(e,t){let a=U8e(e,t);j8e(a)}function U8e(e,t){return K1(e.url,t)}async function j8e(e){try{let t=await fetch(e);t.ok||(t.status>=500&&t.status<600?At.warning("TX",`HTTP Integration: Server refused message ${t.status}`):t.status>=400?At.warning("TX",`HTTP Integration: Failed sending message ${t.status}`):At.warning("TX",`HTTP Integration: Failed sending message ${t.status}`))}catch(t){if(!(t instanceof Error)){At.warning("TX",`HTTP Integration: Failed sending message ${t}`);return}At.warning("TX",`HTTP Integration: ${t.name} ${t.message}`)}}function Z1(){return Ht().getAutomation()}function Ez(){return Z1().enabledAutomations}function Y1(){return Z1().triggers}function av(){return Z1().automations}async function Sz(e){return await T0(e),Z1()}async function Az(e){let t=Y1(),a=q8e(t),r={...e,id:a};return t.push(r),await T0({triggers:t}),r}async function Tz(e,t){let a=Y1(),r=a.findIndex(c=>c.id===e);if(r===-1)throw new Error(`Automation with id ${e} not found`);a[r]={...a[r],...t,id:e},await T0({triggers:a});let i=a[r];if(!i)throw new Error(`Failed to update trigger with id ${e}`);return i}async function Fz(e){let t=Y1(),a=t.findIndex(r=>r.id===e);if(a===-1)throw new Error(`Automation with id ${e} not found`);t=uC(a,t),await T0({triggers:t})}async function Cz(e){let t=av(),a=$8e(t);return t[a]={...e,id:a},await T0({automations:t}),t[a]}async function kz(e,t){let a=av();if(!Object.hasOwn(a,e))throw new Error(`Automation with id ${e} not found`);return a[e]={...t,id:e},await T0({automations:a}),a[e]}async function Oz(e,t){let a=av();if(!Object.hasOwn(a,t))return;let r=Y1().filter(c=>c.automationId===t);if(r.length){let p=r[0]?.title??"Unknown trigger";throw new Error(`Unable to delete automation used in trigger ${p}${r.length>1?` and ${r.length-1} more`:""}`)}let i=yz(e,t);if(i)throw new Error(`Unable to delete automation used in rundown: ${i[0]}, in event with ID: ${i[1]}`);delete a[t],await T0({automations:a})}async function T0(e){let t=Ht().getAutomation();Object.keys(e).forEach(a=>{let r=a;e[r]===void 0&&delete e[r]}),await Ht().setAutomation({...t,...e})}function q8e(e){let t="";do t=Ta();while(a(t));function a(r){return e.some(i=>i.id===r)}return t}function $8e(e){let t="";do t=Ta();while(Object.hasOwn(e,t));return t}function Rz(e){let t=e.action;switch(t){case"aux1-start":return pn.start(1);case"aux1-stop":return pn.stop(1);case"aux1-pause":return pn.pause(1);case"aux1-set":{let a=p0(e.time);return pn.setTime(a,1)}case"aux2-start":return pn.start(2);case"aux2-stop":return pn.stop(2);case"aux2-pause":return pn.pause(2);case"aux2-set":{let a=p0(e.time);return pn.setTime(a,2)}case"aux3-start":return pn.start(3);case"aux3-stop":return pn.stop(3);case"aux3-pause":return pn.pause(3);case"aux3-set":{let a=p0(e.time);return pn.setTime(a,3)}case"message-set":{X4({timer:{text:e.text,visible:e.visible}});break}case"message-secondary":{X4({timer:{secondarySource:e.secondarySource}});break}default:{At.warning("TX",`Unknown action type: ${t}`);break}}}function qs(e,t){if(!Ez())return;let a=Y1();t.eventNow?.triggers&&(a=a.concat(t.eventNow.triggers));let r=a.filter(c=>c.trigger===e);if(r.length===0)return;let i=av();Object.keys(i).length!==0&&r.forEach(c=>{let p=i[c.automationId];if(!p||p.outputs.length===0)return;H8e(p.filters,p.filterRule,t)&&Pz(p.outputs,t)})}function Dz(e){Pz([e])}function H8e(e,t,a){if(e.length===0)return!0;if(t==="all")return e.every(r);return e.some(r);function r(i){let{field:c,operator:p,value:f}=i,v=f.toLowerCase(),y=L4(c,a);switch(p){case"equals":return Pk(y,v);case"not_equals":return!Pk(y,v);case"greater_than":return gz(y,f);case"less_than":return xz(y,f);case"contains":return Ik(y,v);case"not_contains":return!Ik(y,v);default:return!1}}}function Pz(e,t){let a=t??na();e.forEach(r=>{LA(r)&&!bp?bz(r,a):BA(r)?_z(r,a):UA(r)?Rz(r):At.warning("TX",`Unknown output type: ${r}`)})}var Iz={id:"default",title:"Default",order:[],flatOrder:[],entries:{},revision:0},Nk={rundowns:{default:{...Iz}},project:{title:"",description:"",url:"",info:"",logo:null,custom:[]},settings:{version:Eo,serverPort:4001,editorKey:null,operatorKey:null,timeFormat:"24",language:"en"},viewSettings:{overrideStyles:!1,normalColor:"#ffffffcc",warningColor:"#ffa528",dangerColor:"#ff7300"},urlPresets:[],customFields:{},automation:{enabledAutomations:!0,enabledOscIn:!0,oscPortIn:8888,triggers:[],automations:{}}};function Mk(e){let t=nv(e),a=structuredClone(Nk);return a.rundowns={[t.id]:t},a}function nv(e){let t=e||Ta(),a=structuredClone(Iz);return a.id=t,a}function $s(e){if(Object.hasOwn(Nk,e))return structuredClone(Nk[e]);throw new Error(`Key ${e} does not exist on DatabaseModel`)}function X1(e,t,a){if(!e.rundowns||SC(e.rundowns)){a?.("No data found to import");let c=nv();return{[c.id]:c}}let r={},i=Object.keys(e.rundowns);for(let c of i){console.log("Found rundown, importing...");let p=e.rundowns[c],f=Lk(p,t,a);r[f.id]=f}return r}function Lk(e,t,a){let r={id:e.id||Ta(),title:e.title??"",entries:{},order:[],flatOrder:[],revision:e.revision??1},i=0;for(let c=0;c<e.order.length;c++){let p=e.order[c],f=e.entries[p];if(!f){a?.("Could not find referenced event, skipping");continue}if(r.order.includes(f.id)){a?.("ID collision on event import, skipping");continue}let v=p,y,b=[];if(kr(f)){if(y=S1(f,i),y==null){a?.("Skipping event without payload");continue}q1(y.custom,t),i+=1}else if(fs(f))y=E1({duration:f.duration,id:v});else if(ms(f))y=A1({...f,id:v}),q1(y.custom,t);else if(f.type==="block"||ya(f)){for(let E=0;E<f.entries.length;E++){let T=f.entries[E],C=e.entries[T],k=null;if(kr(C)){if(k=S1(C,i),k==null){a?.("Skipping event without payload");continue}k.parent=f.id,q1(k.custom,t),i+=1}else fs(C)?(k=E1({duration:C.duration,id:T}),k.parent=f.id):ms(C)&&(k=A1({...C,id:T}),k.parent=f.id,q1(k.custom,t));k&&(b.push(T),r.entries[T]=k)}y=u0({...structuredClone(f),id:v}),f.entries?.length>0&&(y.entries=f.entries.filter(E=>Object.hasOwn(e.entries,E))),q1(y.custom,t)}else{a?.("Unknown event type, skipping");continue}y&&(r.entries[v]=y,r.order.push(v),r.flatOrder.push(v),r.flatOrder.push(...b))}return console.log(`Imported rundown ${r.title} with ${r.flatOrder.length} entries`),r}function G8e(e,t){for(let a in t.custom)a in e||delete t.custom[a];return t}function Nz(e){let t={totalDelay:0,totalDuration:0,totalDays:0,firstStart:null,lastEnd:null,assignedCustomFields:{},playableEventOrder:[],timedEventOrder:[],flatEntryOrder:[],flags:[],entries:{},order:[],previousEvent:null,latestEvent:null,previousEntry:null};function a(i,c){let p=z8e(t,e,i,c);return t=p.processedData,p}function r(){return t}return{process:a,getMetadata:r}}function z8e(e,t,a,r){let i={...e},c=structuredClone(a);if(i.flatEntryOrder.push(c.id),kr(c)){if(i.timedEventOrder.push(c.id),c.linkStart)if(i.previousEvent){let p=lC(c,i.previousEvent);c.timeStart=p.timeStart,c.timeEnd=p.timeEnd,c.duration=p.duration}else c.linkStart=!1;if(G8e(t,c),i.totalDays+=VG(c,i.previousEvent),c.dayOffset=i.totalDays,c.delay=0,c.gap=0,c.parent=r,Ns(c)){if(i.playableEventOrder.push(c.id),i.firstStart===null&&(i.firstStart=c.timeStart),c.flag&&i.flags.push(c.id),c.gap=FC(c,i.latestEvent),c.gap===0?i.totalDuration+=c.duration:c.gap>0?i.totalDuration+=c.gap+c.duration:c.gap<0&&(i.totalDuration+=Math.max(c.duration+c.gap,0)),i.totalDelay>0&&c.gap>0){let p=0;fs(i.previousEntry)&&(p=i.previousEntry.duration,i.totalDelay-=p),i.totalDelay=Math.max(i.totalDelay-c.gap,0),i.totalDelay+=p}c.delay=i.totalDelay,i.previousEvent=c,CC(c,i.latestEvent)&&(i.latestEvent=c,i.lastEnd=c.timeEnd)}}else fs(c)&&(i.totalDelay+=c.duration,c.parent=r);return r||i.order.push(c.id),i.entries[c.id]=c,i.previousEntry=c,{processedData:i,processedEntry:c}}var wa={id:"",title:"",order:[],flatOrder:[],entries:{},revision:0},mc={totalDelay:0,totalDuration:0,totalDays:0,firstStart:null,lastEnd:null,playableEventOrder:[],timedEventOrder:[],flatEntryOrder:[],flags:[]},mu={},Xr=()=>wa,Fo=()=>mc,hc=()=>mu,J1=e=>wa.entries[e];function Ji(e){let t=e.mutableRundown?structuredClone(wa):wa,a=e.mutableCustomFields?structuredClone(mu):mu;function r(i=!0){if(e.mutableRundown){if(wa.revision=wa.revision+1,wa.title=t.title,!i)wa.entries=t.entries,wa.order=t.order,wa.flatOrder=t.flatOrder;else{let c=Q1(t,mu),{previousEvent:p,latestEvent:f,previousEntry:v,entries:y,order:b,...E}=c;wa.entries=y,wa.order=b,wa.flatOrder=E.flatEntryOrder,mc=E}Ht().setRundown(wa.id,wa)}return e.mutableCustomFields&&(mu=a,Ht().setCustomFields(mu)),{rundown:wa,rundownMetadata:mc,customFields:mu,revision:wa.revision}}return{customFields:a,rundown:t,rundownMetadata:mc,commit:r}}function Mz(e,t){let a=e.entries[t.id];if(!a)throw new Error(`Entry with id ${t.id} not found`);let r=UG(a,t);e.entries[a.id]=r;let i=qG(t);return{entry:r,didInvalidate:i}}function K8e(e,t){if(ya(t))for(let r=0;r<t.entries.length;r++){let i=t.entries[r];a(i)}else if(t.parent){let r=e.entries[t.parent];if(r&&ya(r)){let i=bk(r.entries,t.id);Mz(e,{id:r.id,entries:i})}}a(t.id);function a(r){e.order=bk(e.order,r),delete e.entries[r]}}function Z8e(e){return e.order=[],e.flatOrder=[],e.entries={},e}function Y8e(e,t,a,r){let i=t?.parent??null,c=(()=>{if(ya(a)){if("parent"in t&&t.parent===a.id)return null;if(r==="insert"){if(ya(t))throw new Error("Cannot insert a group into another group");return a.id}return null}return a.parent??null})();"parent"in t&&(t.parent=c);let p=i===null?e.order:e.entries[i].entries,f=c===null?e.order:e.entries[c].entries,v=p.indexOf(t.id),y=(()=>{let b=f.indexOf(a.id);return r==="before"?b:r==="after"?p===f&&v<=b?b:b+1:f.length})();p.splice(v,1),f.splice(y,0,t.id)}function X8e(e,t){let a=mc.flatEntryOrder.indexOf(t.id);if(t.duration===0||a===mc.flatEntryOrder.length-1)return;let r=t.duration,i=null,c=!0;for(let p=a+1;p<mc.flatEntryOrder.length;p++){let f=mc.flatEntryOrder[p],v=e.entries[f];if(!kr(v))continue;let y=c;if(c=!1,i!==null&&(v.linkStart&&r<0&&i.timeStart+r<0&&(y=!0),v.gap>0&&(r=Math.max(r-v.gap,0)),r===0))break;i={...v},y&&(v.linkStart=!1,y=!1),v.timeStart=Math.max(0,v.timeStart+r),v.timeEnd=Math.max(v.duration,v.timeEnd+r),v.revision+=1}}function J8e(e,t,a){e.entries[t.id]={...a,id:t.id,timeStart:t.timeStart,timeEnd:t.timeEnd,duration:t.duration,linkStart:t.linkStart,parent:t.parent,delay:t.delay,gap:t.gap,dayOffset:t.dayOffset,revision:t.revision++},e.entries[a.id]={...t,id:a.id,timeStart:a.timeStart,timeEnd:a.timeEnd,duration:a.duration,linkStart:a.linkStart,parent:a.parent,delay:a.delay,gap:a.gap,dayOffset:a.dayOffset,revision:a.revision++}}function Q8e(e,t,a){if(ya(t)){let{newGroup:r,nestedEntries:i}=$G(t,e);e.entries[r.id]=r;for(let f=0;f<i.length;f++){let v=i[f];e.entries[v.id]=v}let c=e.order.indexOf(t.id)+1,p=a?.after??a?.before;return p&&e.entries[p]&&(a?.after?c=e.order.indexOf(p)+1:a?.before&&(c=e.order.indexOf(p))),e.order=Bs(c,r.id,e.order),r}else{let r=_k(t,j1(e)),i=null,c=a?.after??a?.before;if(c){let f=e.entries[c];if(f&&!ya(f)&&f.parent){let v=e.entries[f.parent];v&&ya(v)&&(i=v)}}else if(t.parent){let f=e.entries[t.parent];f&&ya(f)&&(i=f)}let p=P4(e,i,a?.after,a?.before);return p||(p=t.id),i5(e,r,p,i)}}function e9e(e,t){let a=u0({id:j1(e)}),r=[],i=-1;for(let p=0;p<t.length;p++){let f=t[p],v=e.entries[f];!v||ya(v)||(i===-1&&(i=e.order.indexOf(f)),r.push(f),v.parent=a.id,e.flatOrder=e.flatOrder.filter(y=>y!==f),e.order=e.order.filter(y=>y!==f))}a.entries=r;let c=Math.max(0,i);return e.order=Bs(c,a.id,e.order),e.entries[a.id]=a,a}function t9e(e,t){let a=t.entries,r=e.order.indexOf(t.id);e.order.splice(r,1,...a),delete e.entries[t.id];for(let i=0;i<a.length;i++){let c=a[i],p=e.entries[c];if(!p)throw new Error("Entry not found");p.parent=null}}var Vs={add:i5,edit:Mz,remove:K8e,removeAll:Z8e,reorder:Y8e,applyDelay:X8e,swap:J8e,clone:Q8e,group:e9e,ungroup:t9e};async function Bk(e,t){await Ht().setRundown(e,t)}function r9e(e,t,a){return e[t]={label:a.label,type:a.type,colour:a.colour},{[t]:a}}function a9e(e,t,a,r){let i=r?.label?uc(r.label??t):t;return e[i]={...a,...r},{oldKey:t,newKey:i}}function n9e(e,t){delete e[t]}function i9e(e,t,a){Object.keys(e.entries).forEach(r=>{let i=e.entries[r];"custom"in i&&i.custom[t]&&(i.custom[a]=i.custom[t],delete i.custom[t])})}function s9e(e,t){Object.keys(e.entries).forEach(a=>{let r=e.entries[a];"custom"in r&&r.custom[t]&&delete r.custom[t]})}var hu={add:r9e,edit:a9e,remove:n9e,renameUsages:i9e,removeUsages:s9e};function o9e(e,t){let a=structuredClone(e),r=structuredClone(t),i=Q1(a,r);wa.id=a.id,wa.title=a.title,mu=r;let{previousEvent:c,latestEvent:p,previousEntry:f,entries:v,order:y,...b}=i;return wa.entries=v,wa.order=y,wa.flatOrder=b.flatEntryOrder,wa.revision=a.revision,mc=b,Ht().setRundown(wa.id,wa),{rundown:a,rundownMetadata:mc,customFields:r,revision:a.revision}}var Lz={init:o9e,get:()=>({rundown:wa,metadata:mc,customFields:mu})};function Q1(e,t){let{process:a,getMetadata:r}=Nz(t);for(let i=0;i<e.order.length;i++){let c=e.order[i],p=e.entries[c];if(!p)continue;let{processedEntry:f}=a(p,null);if(ya(f)){let v=null,y=null,b=!1,E=[];f.duration=0;for(let T=0;T<f.entries.length;T++){let C=f.entries[T],k=e.entries[C];if(!k)continue;E.push(k.id);let{processedEntry:D}=a(k,f.id);!kr(D)||!Ns(D)||(v===null&&(v=D.timeStart,b=!!D.linkStart),y=D.timeEnd,T>0&&(f.duration+=D.gap),f.duration=f.duration+D.duration)}f.timeStart=v,f.timeEnd=y,f.isFirstLinked=b,f.entries=E}}return r()}var U5=class e{_interval;static _refreshInterval;endCallback=void 0;onUpdateCallback=void 0;constructor(t){e._refreshInterval=t.refresh,this._interval=setInterval(()=>{this.update()},e._refreshInterval)}setOnUpdateCallback(t){this.onUpdateCallback=t}start(){if(!XG())return!1;let a=na().timer.current-Fn.triggerAhead;return this.endCallback=setTimeout(()=>this.update(),a),!0}pause(){return JG()?(clearTimeout(this.endCallback),!0):!1}stop(){return B5()?(clearTimeout(this.endCallback),!0):!1}addTime(t){if(!QG(t))return!1;clearTimeout(this.endCallback);let a=na();return this.endCallback=setTimeout(()=>this.update(),a.timer.expectedFinish),!0}update(){let t=ez();this.onUpdateCallback?.(t)}shutdown(){clearInterval(this._interval),clearTimeout(this.endCallback)}};function Bz(e){return!(!cr.object(e)||!cr.objectWithKeys(e,["playback","selectedEventId","startedAt","addedTime","pausedAt","firstStart","startEpoch","currentDay"])||!cr.string(e.playback)&&!Object.values(Yl).includes(e.playback)||!cr.string(e.selectedEventId)&&e.selectedEventId!==null||!cr.number(e.startedAt)&&e.startedAt!==null||!cr.number(e.addedTime)||!cr.number(e.pausedAt)&&e.pausedAt!==null||!cr.number(e.firstStart)&&e.firstStart!==null||!cr.number(e.startEpoch)&&e.startEpoch!==null||!cr.number(e.currentDay)&&e.currentDay!==null)}var Uk=0,Uz=null,j5=null,iv={save:c9e,load:l9e,clear:u9e};async function c9e(e,t=qz){if(!(Uk>3)&&!fu(e,Uz))try{await t(e),Uz={...e},Uk=0}catch{Uk+=1}}async function l9e(e=p9e){try{let t=await e();if(Bz(t))return t}catch{}return null}async function u9e(e=qz){try{await e(null)}catch{}}async function jz(){return j5||(j5=new _p(kn.restoreFile),j5)}async function p9e(){return(await jz()).read()}async function qz(e){return(await jz()).write(e)}function q5(e,t,a="count-down"){return xp(t??null,a)!==xp(e??null,a)}function jk(e,t){return xp(t,"count-up")!==xp(e,"count-up")}function $z(e,t){return e===void 0?!0:q5(e.current,t.current)||q5(e.secondaryTimer,t.secondaryTimer)||e.addedTime!==t.addedTime||e.duration!==t.duration||e.phase!==t.phase||e.playback!==t.playback||e.startedAt!==t.startedAt}function Vz(e,t,a){return e===void 0||e.mode!==t.mode?!0:a&&!fu(e,t)}function Hz(e,t){if(!e.length)return;if(!t)return $5(e);let a=e.findIndex(r=>r===t);return a<1?$5(e):e.at(a-1)}function Wz(e,t){if(!e.length)return;if(!t)return $5(e);let a=e.findIndex(r=>r===t);return a===-1||a>=e.length-1?$5(e):e.at(a+1)}function qk(e,t,a,r=0,i=!1){let c=i?r:r+1;for(let p=c;p<t.length;p++){let f=t[p],v=e.entries[f];if(kr(v)&&Ns(v)&&v.cue===a)return v}for(let p=0;p<c;p++){let f=t[p],v=e.entries[f];if(kr(v)&&Ns(v)&&v.cue===a)return v}}function $5(e){return e.at(0)}function $k(e,t,a){let r=t[a];if(r)return e.entries[r]}var Fa=class Fa{eventTimer;lastIntegrationClockUpdate=-1;lastIntegrationTimerValue=-1;static previousState;constructor(t){this.eventTimer=t,Fa.previousState={}}setOffsetMode(t){tz(t)}checkTimerUpdate({hasTimerFinished:t,hasSecondaryTimerFinished:a}){let r=na();Fa.previousState.timer?.phase!==r.timer.phase&&(r.timer.phase==="warning"?process.nextTick(()=>{qs("onWarning",r)}):r.timer.phase==="danger"&&process.nextTick(()=>{qs("onDanger",r)})),r.timer.playback==="roll"&&(a?this.rollLoaded(r.offset):t?(process.nextTick(()=>{qs("onFinish",r)}),this.handleLoadNext(),this.rollLoaded(r.offset)):Fa.previousState?.clock&&LG(r,Fa.previousState.clock,Fn.skipLimit)&&(At.warning("PLAYBACK","Time skip detected, reloading roll"),this.roll(!0))),r.timer.playback==="play"&&t&&(process.nextTick(()=>{qs("onFinish",r)}),r.eventNow&&(r.eventNow.endAction==="load-next"?setTimeout(this.loadNext.bind(this),0):r.eventNow.endAction==="play-next"&&setTimeout(this.startNext.bind(this),0))),q5(this.lastIntegrationTimerValue,r.timer.current)&&(process.nextTick(()=>{qs("onUpdate",r)}),this.lastIntegrationTimerValue=r.timer.current??-1),jk(this.lastIntegrationClockUpdate,r.clock)&&(process.nextTick(()=>{qs("onClock",r)}),this.lastIntegrationClockUpdate=r.clock)}init(t){At.info("SERVER","Runtime service started"),this.eventTimer.setOnUpdateCallback(a=>this.checkTimerUpdate(a)),t&&this.resume(t)}shutdown(){this.eventTimer&&(At.info("SERVER","Runtime service shutting down"),this.eventTimer.shutdown())}notifyOfChangedEvents(t){let a=na();if(!(a.eventNow!==null||a.eventNext!==null))return;t.playableEventOrder.length===0&&B5();let i=Xr(),c=Fo();YG(i,c)}loadEvent(t,a){if(!Ns(t))return At.warning("PLAYBACK",`Refused skipped event with ID ${t.id}`),!1;let r=na(),i=Xr(),c=Fo(),p=Sk(t,i,c,a);if(p){At.info("PLAYBACK",`Loaded event with ID ${t.id}`);let f=na();process.nextTick(()=>{W1("onStop",r),qs("onLoad",f)})}return p}getRuntimeState(){return{playback:na().timer.playback}}startById(t){let a=J1(t);return!a||!kr(a)||!this.loadEvent(a)?!1:this.handleStart()}startByIndex(t){let a=Xr(),{timedEventOrder:r}=Fo(),i=$k(a,r,t);return!i||!this.loadEvent(i)?!1:this.handleStart()}startByCue(t){let a=na(),r=Xr(),{timedEventOrder:i}=Fo(),c=qk(r,i,t,a.rundown.selectedEventIndex??void 0,a.timer.playback==="armed");return!c||!this.loadEvent(c)?!1:this.handleStart()}loadById(t){let a=J1(t);return!a||!kr(a)?!1:this.loadEvent(a)}loadByIndex(t){let a=Xr(),{timedEventOrder:r}=Fo(),i=$k(a,r,t);return i?this.loadEvent(i):!1}loadByCue(t){let a=na(),r=Xr(),{playableEventOrder:i}=Fo(),c=qk(r,i,t,a.rundown.selectedEventIndex??void 0,!1);return c?this.loadEvent(c):!1}handleLoadPrevious(){let t=na(),{playableEventOrder:a}=Fo(),r=Hz(a,t.eventNow?.id);if(r){let i=J1(r);if(i&&kr(i))return this.loadEvent(i)}return!1}loadPrevious(){return this.handleLoadPrevious()}handleLoadNext(t){let a=na(),{playableEventOrder:r}=Fo(),i=Wz(r,t??a.eventNow?.id);if(i){let c=J1(i);return!c||!kr(c)?!1:a.timer.playback==="roll"?c.duration===0?this.handleLoadNext(i):this.loadEvent(c,{firstStart:a.rundown.actualStart}):this.loadEvent(c)}return At.info("PLAYBACK","No next event found! Continuing playback"),!1}loadNext(){return this.handleLoadNext()}handleStart(){let t=na();if(!w1(t.timer.playback,t.timer.phase).start)return!1;let r=this.eventTimer?.start()??!1,i=na();return At.info("PLAYBACK",`Play Mode ${i.timer.playback.toUpperCase()}`),r&&process.nextTick(()=>{W1("onStart",i),qs("onStart",i)}),r}start(){return this.handleStart()}startPrevious(){return this.handleLoadPrevious()?this.handleStart():!1}startNext(){return this.handleLoadNext()?this.handleStart():!1}pause(){let t=na();if(!w1(t.timer.playback,t.timer.phase).pause)return;this.eventTimer?.pause();let r=na();At.info("PLAYBACK",`Play Mode ${r.timer.playback.toUpperCase()}`),process.nextTick(()=>{qs("onPause",r)})}stop(){let t=na();if(!w1(t.timer.playback,t.timer.phase).stop)return!1;if(this.eventTimer?.stop()){let i=na();return At.info("PLAYBACK",`Play Mode ${i.timer.playback.toUpperCase()}`),process.nextTick(()=>{W1("onStop",t),qs("onStop",i)}),!0}return!1}reload(){let t=na();return t.eventNow?this.loadEvent(t.eventNow):!1}rollLoaded(t){let a=Xr(),r=Fo();try{Fk(a,r,t)}catch(i){At.error("SERVER",`Roll: ${i}`)}}roll(t=!1){let a=na();if(!t&&!w1(a.timer.playback,a.timer.phase).roll)return;try{let i=Xr(),c=Fo(),p=Fk(i,c),f=na();p.eventId!==a.eventNow?.id&&(At.info("PLAYBACK",`Loaded event with ID ${p.eventId}`),process.nextTick(()=>{W1("onStop",a),qs("onLoad",f)})),p.didStart&&process.nextTick(()=>{W1("onStart",f),qs("onStart",f)})}catch(i){At.error("SERVER",`Roll: ${i}`);return}let r=na();a.timer.playback!==r.timer.playback&&At.info("PLAYBACK",`Play Mode ${r.timer.playback.toUpperCase()}`)}resume(t){let{selectedEventId:a,playback:r}=t;if(r==="roll"){this.roll();return}if(!a)return;let i=J1(a);if(!kr(i)||!Ns(i))return;let c=Xr(),p=Fo();ZG(t,i,c,p),At.info("PLAYBACK","Resuming playback")}addTime(t){this.eventTimer.addTime(t)&&At.info("PLAYBACK",`${t>0?"Added":"Removed"} ${lc(t)}`)}};va([Rn],Fa.prototype,"setOffsetMode",1),va([Rn],Fa.prototype,"checkTimerUpdate",1),va([Rn],Fa.prototype,"startById",1),va([Rn],Fa.prototype,"startByIndex",1),va([Rn],Fa.prototype,"startByCue",1),va([Rn],Fa.prototype,"loadById",1),va([Rn],Fa.prototype,"loadByIndex",1),va([Rn],Fa.prototype,"loadByCue",1),va([Rn],Fa.prototype,"loadPrevious",1),va([Rn],Fa.prototype,"loadNext",1),va([Rn],Fa.prototype,"start",1),va([Rn],Fa.prototype,"startPrevious",1),va([Rn],Fa.prototype,"startNext",1),va([Rn],Fa.prototype,"pause",1),va([Rn],Fa.prototype,"stop",1),va([Rn],Fa.prototype,"reload",1),va([Rn],Fa.prototype,"roll",1),va([Rn],Fa.prototype,"resume",1),va([Rn],Fa.prototype,"addTime",1);var mi=Fa,d9e=new U5({refresh:Fn.updateRate,updateInterval:Fn.notificationRate}),ua=new mi(d9e);function Rn(e,t,a){let r=a.value;return a.value=function(...i){let c=r.apply(this,i),p=na(),f=To.createBatch(),v=!1;v||=oe("eventNow"),v||=oe("eventNext"),v||=oe("eventFlag"),v||=oe("groupNow");let y=!mi.previousState?.timer,b=mi.previousState?.offset?.mode!==p.offset.mode,E=mi.previousState.timer?.playback!==p.timer.playback,T=!y&&mi.previousState?.timer.addedTime!==p.timer.addedTime,C=v||y||E||b||T,k=$z(mi.previousState?.timer,p.timer);k&&(f.add("timer",p.timer),mi.previousState.timer={...p.timer});let D=k||jk(mi.previousState.clock,p.clock);D&&(f.add("clock",p.clock),mi.previousState.clock=p.clock),Vz(mi.previousState?.offset,p.offset,D||C)&&(f.add("offset",p.offset),mi.previousState.offset=structuredClone(p.offset)),!fu(mi.previousState.rundown,p.rundown)&&(f.add("rundown",p.rundown),mi.previousState.rundown=structuredClone(p.rundown));function oe(me){let Ae=mi.previousState[me],pe=p[me];return!Ae&&!pe||Ae?.id===pe?.id&&fu(Ae,pe)?!1:(f.add(me,pe),mi.previousState[me]=structuredClone(pe),!0)}return C&&iv.save({playback:p.timer.playback,selectedEventId:p.eventNow?.id??null,startedAt:p.timer.startedAt,addedTime:p.timer.addedTime,pausedAt:p._timer.pausedAt,firstStart:p.rundown.actualStart,startEpoch:p._startEpoch,currentDay:p.rundown.currentDay}).catch(me=>{}),f.send(),c},a}function em(e){if(e>cC||e<0)throw new Error("Times should be from 0 to 23:59:59");return e}var Vk={title:Tp,note:Tp,cue:Tp,skip:du,flag:du,countToEnd:du,colour:SG,custom:Tp,timeWarning:e=>em(_0(e)),timeDanger:e=>em(_0(e)),endAction:e=>U1(e,Qc),timerType:e=>U1(e,ho),linkStart:du,timeStrategy:e=>U1(e,sc),targetDuration:e=>em(_0(e)),duration:e=>em(_0(e)),timeStart:e=>em(_0(e)),timeEnd:e=>em(_0(e))};function Gz(e,t){if(e.startsWith("custom:")){let r=e.split(":")[1],i=Vk.custom;return{custom:{[r]:i(t)}}}if(!MA(e,Vk))throw new Error(`Property ${e} not permitted`);let a=Vk[e];return{[e]:a(t)}}function zz(e,t,a,r){if(typeof t!="string"||a===void 0)return!1;if(t.startsWith("custom:")&&Object.hasOwn(e,"custom")){let i=t.slice(7);return i?Object.hasOwn(r,i):!1}return Object.hasOwn(e,t)}var f9e=new _p(kn.appState),Co=new C1(f9e,{});async function Kz(e){return(await V5())?.projectName===e}async function V5(){if(!ul)return await Co.read(),{projectName:Co.data.projectName,rundownId:Co.data.rundownId}}async function Zz(e,t){ul||(Co.data.projectName=e,Co.data.rundownId=t,await Co.write())}async function Yz(e){ul||(Co.data.rundownId=e,await Co.write())}async function Xz(e){return ul||e?!1:(await Co.read(),Co.data.showWelcomeDialog??!0)}async function Jz(e){return Co.data.showWelcomeDialog=e,await Co.write(),e}async function Qz(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});if(e?.id&&Object.hasOwn(t.entries,e.id))throw new Error(`Event with ID ${e.id} already exists`);let r=hC(t,e),i=null;if(r){let y=t.entries[r];if(!y||!ya(y))throw new Error(`Invalid parent event with ID ${r}`);i=y}let c=P4(t,i,e?.after,e?.before),p=BG(t,e,c);Vs.add(t,p,c,i);let{rundownMetadata:f,revision:v}=a();return setImmediate(()=>{ko(f),Di(f,v,{timer:[p.id],external:!0})}),p}async function H5(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e.id];if(!r)throw new Error("Entry not found");if(e?.type&&r.type!==e.type)throw new Error("Invalid event type");if(!wk(r,e))return r;let{entry:i,didInvalidate:c}=Vs.edit(t,e),{rundownMetadata:p,revision:f}=a(c);return setImmediate(()=>{ko(p),Di(p,f,{timer:c?!0:[i.id],external:!0})}),i}async function eK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1});if("cue"in t&&t.cue==="")throw new Error("Cue value invalid");let i=!1,c=[],p=[];for(let b=0;b<e.length;b++){let E=e[b],T=a.entries[E];if(!T)continue;if(t?.type&&T.type!==t.type)throw new Error("Invalid event type");if(!wk(T,t))continue;let{entry:C,didInvalidate:k}=Vs.edit(a,{...t,id:E});c.push(E),p.push(C),k&&(i=!0)}let{rundown:f,rundownMetadata:v,revision:y}=r(i);return setImmediate(()=>{ko(v),Di(v,y,{timer:i?!0:c,external:!0})}),f}async function tK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});for(let p=0;p<e.length;p++){let f=t.entries[e[p]];f&&Vs.remove(t,f)}let{rundown:r,rundownMetadata:i,revision:c}=a();return setImmediate(()=>{ko(i),Di(i,c,{timer:e,external:!0})}),r}async function rK(){let{rundown:e,commit:t}=Ji({mutableRundown:!0,mutableCustomFields:!1});Vs.removeAll(e);let{rundown:a,rundownMetadata:r,revision:i}=t();return setImmediate(()=>{ko(r),Di(r,i,{timer:!0,external:!0})}),a}async function aK(e,t,a){let{rundown:r,commit:i}=Ji({mutableRundown:!0,mutableCustomFields:!1}),c=r.entries[e],p=r.entries[t];if(!c||!p)throw new Error("Event not found");Vs.reorder(r,c,p,a);let{rundown:f,rundownMetadata:v,revision:y}=i();return setImmediate(()=>{ko(v),Di(v,y,{timer:!0,external:!0})}),f}async function nK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e];if(!r||!fs(r))throw new Error("Given delay ID not found");Vs.applyDelay(t,r),Vs.remove(t,r);let{rundown:i,rundownMetadata:c,revision:p}=a();return setImmediate(()=>{ko(c),Di(c,p,{timer:!0,external:!0})}),i}async function iK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1}),i=a.entries[e],c=a.entries[t];if(!i||!c)throw new Error("Event not found");if(!kr(i)||!kr(c))throw new Error("Both entries must be events");Vs.swap(a,i,c);let{rundown:p,rundownMetadata:f,revision:v}=r();return setImmediate(()=>{ko(f),Di(f,v,{timer:!0,external:!0})}),p}async function sK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1}),i=a.entries[e];if(!i)throw new Error("Could not find entry to clone");let c=Vs.clone(a,i,t),{rundown:p,rundownMetadata:f,revision:v}=r();return setImmediate(()=>{ko(f),ya(c)?Di(f,v,{timer:c.entries,external:!0}):kr(c)?Di(f,v,{timer:[c.id],external:!0}):fs(c)&&Di(f,v,{external:!0})}),p}async function oK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});Vs.group(t,e);let{rundown:r,rundownMetadata:i,revision:c}=a();return setImmediate(()=>{ko(i),Di(i,c,{external:!0,timer:!0})}),r}async function cK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e];if(!r||!ya(r))throw new Error(`Group with ID ${e} not found or is not a group`);Vs.ungroup(t,r);let{rundown:i,rundownMetadata:c,revision:p}=a();return setImmediate(()=>{ko(c),Di(c,p,{external:!0})}),i}async function lK(e){let t=uc(e.label);if(!t)throw new Error("Unable to convert label to a valid key");let{customFields:a,commit:r}=Ji({mutableRundown:!1,mutableCustomFields:!0});if(Object.hasOwn(a,t))throw new Error("Label already exists");hu.add(a,t,e);let{customFields:i}=r(!1);return setImmediate(()=>{dn("custom-fields")}),i}async function uK(e,t,a){let{customFields:r,rundown:i,commit:c}=Ji({mutableRundown:!0,mutableCustomFields:!0});if(!(e in r))throw new Error("Could not find label");let p=r[e];if(t.type&&p.type!==t.type)throw new Error("Change of field type is not allowed");let{oldKey:f,newKey:v}=hu.edit(r,e,p,t);if(f!==v){hu.renameUsages(i,f,v);for(let T of Object.keys(a))if(T!==i.id){let C=structuredClone(a[T]);hu.renameUsages(C,f,v),await Bk(T,C)}hu.remove(r,f)}let{rundownMetadata:y,revision:b,customFields:E}=c(!1);return setImmediate(()=>{dn("custom-fields"),Di(y,b,{timer:!0,external:!0})}),E}async function pK(e,t){let{customFields:a,rundown:r,commit:i}=Ji({mutableRundown:!0,mutableCustomFields:!0});if(!(e in a))return a;hu.removeUsages(r,e);for(let v of Object.keys(t))if(v!==r.id){let y=structuredClone(t[v]);hu.removeUsages(y,e),await Bk(v,y)}hu.remove(a,e);let{rundownMetadata:c,revision:p,customFields:f}=i(!1);return setImmediate(()=>{dn("custom-fields"),Di(c,p,{timer:!0,external:!0})}),f}function ko(e){let t=e.timedEventOrder.length;KG({numEvents:t,...e})}function Di(e,t,a){a.timer&&ua.notifyOfChangedEvents(e),a.reload?dn("all"):a.external&&dn("rundown",t)}async function dK(e){let t=Ht();if(e===Xr().id)return t.getProjectRundowns();let a=t.getRundown(e),r=t.getCustomFields();return await tm(a,r),t.getProjectRundowns()}async function tm(e,t,a=!1){ua.stop();let{rundownMetadata:r,revision:i}=Lz.init(e,t);At.info("SERVER",`Switch to rundown: ${e.id}`),ko(r),setImmediate(()=>{Di(r,i,{timer:!0,external:!0,reload:a}),Yz(e.id).catch(c=>{At.error("SERVER",`Failed to persist last loaded rundown: ${c}`)})})}var mK=null;function rm(e,t,a){let r=e.toLowerCase(),i=h9e[r];if(mK=new Date,i)return i(t);throw new Error(`Unhandled message ${e}`)}function hK(){return mK}var h9e={version:()=>({payload:Eo}),poll:()=>({payload:To.poll()}),change:async e=>{if(dc(e),Object.keys(e).length===0)throw new Error("Payload is empty");let t=Object.keys(e).at(0);if(!t)throw new Error("Missing Event ID");let{entries:a}=Xr(),r=hc(),i=a[t];if(!i)throw new Error("ID do not exits in rundown");let c=e[t],p={id:t},f=!1;return Object.entries(c).forEach(([v,y])=>{if(!zz(i,v,y,r))throw new Error("Invalid property or value");let b=Gz(v,y),E=Object.keys(b)[0];f=f||yk(E),p.custom&&b.custom?Object.assign(p.custom,b.custom):Object.assign(p,b)}),await H5(p),{payload:"success"}},message:e=>{dc(e);let t={timer:"timer"in e?TG(e.timer):void 0,secondary:"secondary"in e?AG(e.secondary):void 0};return{payload:X4(t)}},start:e=>{if(e===void 0)return vc(ua.start(),"Unable to start");if(e&&typeof e=="object"){if("index"in e){let t=F0(e.index);if(t<=0)throw new Error(`Event index out of range ${t}`);return vc(ua.startByIndex(t-1),`Event index not recognised or out of range ${t}`)}if("id"in e)return Xn(e.id),vc(ua.startById(e.id),`Unable to start ID: ${e.id}`);if("cue"in e){let t=fK(e.cue);return vc(ua.startByCue(t),`Unable to start CUE: ${t}`)}}if(e==="next")return vc(ua.startNext(),"Unable to start next event");if(e==="previous")return vc(ua.startPrevious(),"Unable to start previous event");throw new Error("No matching start function")},pause:()=>(ua.pause(),{payload:"success"}),stop:()=>(ua.stop(),{payload:"success"}),reload:()=>(ua.reload(),{payload:"success"}),roll:()=>(ua.roll(),{payload:"success"}),load:e=>{if(e&&typeof e=="object"){if("index"in e){let t=F0(e.index);if(t<=0)throw new Error(`Event index out of range ${t}`);return vc(ua.loadByIndex(t-1),`Event index not recognised or out of range ${t}`)}if("id"in e)return Xn(e.id),vc(ua.loadById(e.id),`Unable to load ID: ${e.id}`);if("cue"in e){let t=fK(e.cue);return vc(ua.loadByCue(t),`Unable to load CUE: ${t}`)}}if(e==="next")return vc(ua.loadNext(),"Unable to load next event");if(e==="previous")return vc(ua.loadPrevious(),"Unable to load previous event");throw new Error("No matching method provided")},addtime:e=>{let t=(()=>{if(e&&typeof e=="object"){if("add"in e)return F0(e.add);if("remove"in e)return F0(e.remove)*-1}return F0(e)})();if(M5(t),t===0)return{payload:"success"};if(Math.abs(t)>Zn)throw new Error(`Payload too large: ${t}`);return ua.addTime(t),{payload:"success"}},auxtimer:e=>{dc(e);let t=Object.keys(e).at(0);if(t!=="1"&&t!=="2"&&t!=="3")throw new Error("Invalid auxtimer index");let a=e[t],r=Number(t);if(typeof a=="string")switch(a){case"start":return{payload:pn.start(r)};case"pause":return{payload:pn.pause(r)};case"stop":return{payload:pn.stop(r)};default:throw new Error("Invalid command")}if(a&&typeof a=="object"){if("duration"in a)return{payload:pn.setTime(F0(a.duration),r)};if("addtime"in a)return{payload:pn.addTime(F0(a.addtime),r)};if("direction"in a){if(a.direction==="count-up"||a.direction==="count-down")return{payload:pn.setDirection(a.direction,r)};throw new Error("Invalid direction payload")}}throw new Error("No matching method provided")},client:e=>{if(dc(e),!("target"in e)||typeof e.target!="string")throw new Error("No or invalid client target");if("rename"in e&&typeof e.rename=="string"){let{target:t,rename:a}=e;return Ri.renameClient(t,a),{payload:"success"}}if("redirect"in e&&typeof e.redirect=="string"){let{target:t,redirect:a}=e;return Ri.redirectClient(t,a),{payload:"success"}}if("identify"in e&&typeof e.identify=="boolean"){let{target:t,identify:a}=e;return Ri.identifyClient(t,a),{payload:"success"}}throw new Error("No matching method provided")},offsetmode:e=>{let t=U1(e,Hd);return ua.setOffsetMode(t),{payload:"success"}}};function F0(e){let t=Number(e);if(isNaN(t))throw new Error("Payload is not a valid number");return t}function fK(e){if(typeof e=="number")return String(e);if(typeof e=="string")return e;throw new Error("Payload is not a valid string or number")}function vc(e,t){if(!e)throw new Error(t);return{payload:"success"}}var vK=null,Hk=class{MAX_PAYLOAD=1024*256;wss;clients;lastConnection=null;shouldShowWelcome=!0;constructor(){if(vK)throw new Error("There can be only one");vK=this,this.clients=new Map,this.wss=null}init(t,a,r){this.shouldShowWelcome=a,this.wss=new dk.default({path:`${r}/ws`,server:t,maxPayload:this.MAX_PAYLOAD}),this.wss.on("connection",(i,c)=>{gK(i,c,y=>{y&&i.close(1008,"Unauthorized")});let p=Ta(),f=P5();function v(y,b){i.send(JSON.stringify({tag:y,payload:b}))}this.clients.set(p,{type:"unknown",identify:!1,name:f,origin:"",path:""}),this.lastConnection=new Date,At.info("CLIENT",`${this.clients.size} Connections with new: ${f}`),v("client-init",{clientId:p,clientName:f}),this.sendClientList(),v("runtime-data",To.poll()),i.on("error",console.error),i.on("close",()=>{this.clients.delete(p),At.info("CLIENT",`${this.clients.size} Connections with disconnected: ${f}`),this.sendClientList()}),i.on("message",async y=>{try{let b=JSON.parse(y.toString()),{tag:E,payload:T}=b;switch(E){case"ping":{v("pong",T);break}case"client-set":{let k={...this.getOrCreateClient(p),...T};this.clients.set(p,k),this.shouldShowWelcome&&k.path?.toLowerCase().includes("editor")&&(this.shouldShowWelcome=!1,v("dialog",{dialog:"welcome"})),this.sendClientList();break}case"client-set-path":{let C=this.getOrCreateClient(p);C.path=T,this.clients.set(p,C),this.shouldShowWelcome&&T.toLowerCase().includes("editor")&&(this.shouldShowWelcome=!1,v("dialog",{dialog:"welcome"})),this.sendClientList();break}case"log":{At.emit(T.level,T.origin,T.text);break}default:{try{let C=await rm(E,T,"ws");C&&i.send(JSON.stringify({tag:E,payload:C.payload}))}catch(C){At.error("RX",`WS IN: ${C}`)}break}}}catch{}})})}getStats(){return{connectedClients:this.clients.size,lastConnection:this.lastConnection}}getOrCreateClient(t){return this.clients.has(t)||this.clients.set(t,{type:"unknown",identify:!1,name:P5(),origin:"",path:""}),this.clients.get(t)}sendClientList(){let t=Object.fromEntries(this.clients.entries());this.sendAsJson("client-list",t)}getClientList(){return Array.from(this.clients.keys())}renameClient(t,a){let r=this.clients.get(t);if(!r)throw new Error(`Client "${t}" not found`);At.info("CLIENT",`Client ${r.name} renamed to ${a}`),this.clients.set(t,{...r,name:a}),this.sendAsJson("client-rename",{name:a,target:t}),this.sendClientList()}redirectClient(t,a){if(!this.clients.get(t))throw new Error(`Client "${t}" not found`);this.sendAsJson("client-redirect",{target:t,path:a})}identifyClient(t,a){let r=this.clients.get(t);if(!r)throw new Error(`Client "${t}" not found`);this.clients.set(t,{...r,identify:a}),this.sendClientList()}sendAsJson(t,a){try{let r=JSON.stringify({tag:t,payload:a});this.wss?.clients.forEach(i=>{i.readyState===pk.default.OPEN&&i.send(r)})}catch{}}shutdown(){this.wss?.close()}},Ri=new Hk;function dn(e,t=null){Ri.sendAsJson("refetch",{target:e,revision:t})}var z5=require("fs/promises"),zk=require("path");var xK={rundowns:{default:{id:"default",title:"Demo project",order:["e2163f","7eaf99","f60403","6b0edb"],flatOrder:["e2163f","7eaf99","9bf60f","bf71a2","c2697f","fa593e","a8b0b3","f60403","0aaa7d","6b0edb","02afca","75ce86","e10ed9","07df89"],entries:{e2163f:{id:"e2163f",type:"milestone",cue:"Demo",title:"Clear all, or Create New Project to start fresh",note:`Moderator - Emma Thompson
|
|
264
|
+
`,_=x.charCodeAt(0),S=new RegExp((m=="|"?"\\|":m)+"+$"),A="",R=[];l.dense=Array.isArray(n);for(var P=l.skipHidden&&n["!cols"]||[],I=l.skipHidden&&n["!rows"]||[],M=u.s.c;M<=u.e.c;++M)(P[M]||{}).hidden||(R[M]=Ot(M));var O=u.s.r,B=!1,Y=0;return s._read=function(){if(!B)return B=!0,s.push("\uFEFF");for(;O<=u.e.r;)if(++O,!(I[O-1]||{}).hidden&&(A=cL(n,u,O-1,R,g,_,m,l),A!=null&&(l.strip&&(A=A.replace(S,"")),A||l.blankrows!==!1)))return s.push((Y++?x:"")+A);return s.push(null)},s}function vpe(n,o){var s=J8(),l=o||{},u=l.header!=null?l.header:LM,m=l.footer!=null?l.footer:BM;s.push(u);var g=pa(n["!ref"]);l.dense=Array.isArray(n),s.push(UM(n,g,l));var x=g.s.r,_=!1;return s._read=function(){if(x>g.e.r)return _||(_=!0,s.push("</table>"+m)),s.push(null);for(;x<=g.e.r;){s.push(MM(n,g,x,l)),++x;break}},s}function gpe(n,o){var s=J8({objectMode:!0});if(n==null||n["!ref"]==null)return s.push(null),s;var l={t:"n",v:0},u=0,m=1,g=[],x=0,_="",S={s:{r:0,c:0},e:{r:0,c:0}},A=o||{},R=A.range!=null?A.range:n["!ref"];switch(A.header===1?u=1:A.header==="A"?u=2:Array.isArray(A.header)&&(u=3),typeof R){case"string":S=Rr(R);break;case"number":S=Rr(n["!ref"]),S.s.r=R;break;default:S=R}u>0&&(m=0);var P=fe(S.s.r),I=[],M=0,O=Array.isArray(n),B=S.s.r,Y=0,X={};O&&!n[B]&&(n[B]=[]);var G=A.skipHidden&&n["!cols"]||[],Ee=A.skipHidden&&n["!rows"]||[];for(Y=S.s.c;Y<=S.e.c;++Y)if(!(G[Y]||{}).hidden)switch(I[Y]=Ot(Y),l=O?n[B][Y]:n[I[Y]+P],u){case 1:g[Y]=Y-S.s.c;break;case 2:g[Y]=I[Y];break;case 3:g[Y]=A.header[Y-S.s.c];break;default:if(l==null&&(l={w:"__EMPTY",t:"s"}),_=x=Ui(l,null,A),M=X[x]||0,!M)X[x]=1;else{do _=x+"_"+M++;while(X[_]);X[x]=M,X[_]=1}g[Y]=_}return B=S.s.r+m,s._read=function(){for(;B<=S.e.r;)if(!(Ee[B-1]||{}).hidden){var Re=sL(n,S,B,I,u,g,O,A);if(++B,Re.isempty===!1||(u===1?A.blankrows!==!1:A.blankrows)){s.push(Re.row);return}}return s.push(null)},s}var fL={to_json:gpe,to_html:vpe,to_csv:hpe,set_readable:dL};if(typeof z8<"u"&&(e.parse_xlscfb=z8),e.parse_zip=QM,e.read=K8,e.readFile=rL,e.readFileSync=rL,e.write=Y8,e.writeFile=iL,e.writeFileSync=iL,e.writeFileAsync=ipe,e.utils=mpe,e.writeXLSX=CA,e.writeFileXLSX=npe,e.SSF=gh,typeof fL<"u"&&(e.stream=fL),typeof $t<"u"&&(e.CFB=$t),typeof require<"u"){var mL=require("stream");(mL||{}).Readable&&dL(mL.Readable)}}typeof dM<"u"?Fw(dM):typeof fx<"u"&&fx.exports?Fw(fx.exports):typeof define=="function"&&define.amd?define("xlsx",function(){return dx.version||Fw(dx),dx}):Fw(dx);if(typeof window<"u"&&!window.XLSX)try{window.XLSX=dx}catch{}});var hje={};wL(hje,{initAssets:()=>dje,shutdown:()=>fh,startIntegrations:()=>mje,startServer:()=>fje});module.exports=_L(hje);var Qc=(r=>(r.LoadNext="load-next",r.None="none",r.PlayNext="play-next",r))(Qc||{});var sc=(a=>(a.LockEnd="lock-end",a.LockDuration="lock-duration",a))(sc||{});var ho=(i=>(i.CountDown="count-down",i.CountUp="count-up",i.Clock="clock",i.None="none",i))(ho||{});var Lpe=["aux1-start","aux1-stop","aux1-pause","aux2-start","aux2-stop","aux2-pause","aux3-start","aux3-stop","aux3-pause"],Bpe=["aux1-set","aux2-set","aux3-set"],NA=[...Lpe,...Bpe,"message-set","message-secondary"];var Vd=(y=>(y.Editor="editor",y.Cuesheet="cuesheet",y.Operator="op",y.Timer="timer",y.Backstage="backstage",y.Timeline="timeline",y.StudioClock="studio",y.Countdown="countdown",y.ProjectInfo="info",y))(Vd||{});var Yl=(c=>(c.Roll="roll",c.Play="play",c.Pause="pause",c.Stop="stop",c.Armed="armed",c))(Yl||{});var n4=(y=>(y.onLoad="onLoad",y.onStart="onStart",y.onPause="onPause",y.onStop="onStop",y.onClock="onClock",y.onUpdate="onUpdate",y.onFinish="onFinish",y.onWarning="onWarning",y.onDanger="onDanger",y))(n4||{}),Xf=Object.keys(n4);var Hd=(a=>(a.Absolute="absolute",a.Relative="relative",a))(Hd||{});var el={clock:0,timer:{addedTime:0,current:null,duration:null,elapsed:null,expectedFinish:null,phase:"none",playback:"stop",secondaryTimer:null,startedAt:null},message:{timer:{text:"",visible:!1,blink:!1,blackout:!1,secondarySource:null},secondary:""},rundown:{selectedEventIndex:null,numEvents:0,plannedStart:0,plannedEnd:0,actualStart:null,actualGroupStart:null,currentDay:null},offset:{absolute:0,relative:0,mode:"absolute",expectedFlagStart:null,expectedGroupEnd:null,expectedRundownEnd:null},groupNow:null,eventNow:null,eventNext:null,eventFlag:null,auxtimer1:{current:0,direction:"count-up",duration:0,playback:"stop"},auxtimer2:{current:0,direction:"count-up",duration:0,playback:"stop"},auxtimer3:{current:0,direction:"count-up",duration:0,playback:"stop"},ping:1};function kr(e){return e?.type==="event"}function Ns(e){return!e.skip}function fs(e){return e?.type==="delay"}function ya(e){return e?.type==="group"}function ms(e){return e?.type==="milestone"}function MA(e,t){return e in t}function LA(e){return e.type==="osc"}function BA(e){return e.type==="http"}function UA(e){return e.type==="ontime"}var jA={"common.expected_finish":"Expected Finish","common.minutes":"min","common.seconds":"sec","common.now":"Now","common.next":"Next","common.scheduled_start":"Scheduled start","common.scheduled_end":"Scheduled end","common.expected_start":"Expected start","common.expected_end":"Expected end","common.stage_timer":"Stage Timer","common.started_at":"Started At","common.time_now":"Time now","common.no_data":"No data","countdown.ended":"Event ended at","countdown.running":"Event running","countdown.loaded":"Event loaded","countdown.select_event":"Select an event to follow","countdown.to_start":"Time to start","countdown.waiting":"Waiting for event start","countdown.overtime":"in overtime","countdown.all_have_finished":"All selected events have finished","timeline.live":"live","timeline.done":"done","timeline.due":"due","timeline.followedby":"Followed by","project.title":"Title","project.description":"Description","project.info":"Project Info","project.url":"Project URL"};(function(){CL().config(Object.assign({},OL(),DL()(process.argv)))})();var Dw=qt(Tn(),1),cce=qt(require("http"),1),xM=qt(xH(),1),lce=qt(SH(),1),uce=qt(RH(),1);var VH=require("url"),Tr=require("path");function w1(e,t){return{start:e!=="stop"&&e!=="play",pause:e==="play",roll:e!=="roll"&&t!=="overtime",stop:e!=="stop",reload:e!=="stop"&&e!=="roll"}}function oC(e,t="lock-duration"){return Object.values(sc).includes(e)?e:t}function nu(e,t="none"){return Object.values(Qc).includes(e)?e:t}function c0(e,t="count-down"){return Object.values(ho).includes(e)?e:t}function R4(e){return Object.values(ho).includes(e)}var ol=1e3,Yi=1e3*60,Zn=1e3*60*60,Or=864e5,cC=Or-ol;function xp(e,t="count-down"){if(e===null)return 0;let a=0;return t==="count-down"&&(a=Math.ceil(e/ol)),t==="count-up"&&(a=Math.floor(e/ol)),a===0?0:a}function DH(e){return Math.floor(e/60)}function PH(e){return Math.floor(e/3600)}function lC(e,t){let a=e.timeStrategy==="lock-end",r=e.timeStrategy==="lock-duration",i=t.timeEnd;return{timeStart:i,timeEnd:a?e.timeEnd:IH(i,e.duration),duration:r?e.duration:cc(i,e.timeEnd)}}function $6e(e,t,a){let r=b1(e),i=b1(t),c=b1(a);return e!=null&&t!=null?{timeStart:r,duration:cc(r,i),timeEnd:i,timeStrategy:a!=null?"lock-duration":"lock-end"}:e==null&&t==null?a==null?{timeStart:0,duration:0,timeEnd:0,timeStrategy:"lock-duration"}:{timeStart:r,duration:c,timeEnd:c,timeStrategy:"lock-duration"}:e!=null?{timeStart:r,duration:c,timeEnd:(r+c)%Or,timeStrategy:"lock-duration"}:t!=null?{timeStart:i-c,duration:c,timeEnd:i,timeStrategy:a!=null?"lock-duration":"lock-end"}:{timeStart:r,duration:c,timeEnd:i,timeStrategy:"lock-duration"}}function D4(e,t,a,r){if(r==null)return $6e(e,t,a);let i=oC(r),c=b1(e),p=b1(t),f=b1(a);return i==="lock-end"?f=cc(c,p):p=IH(c,f),{timeStart:c,duration:f,timeEnd:p,timeStrategy:i}}function cc(e,t){return t<e?t+Or-e:t-e}function IH(e,t){return(e+t)%Or}function b1(e){let t=Number(e);return isNaN(t)?0:Math.floor(t)}function Bs(e,t,a){let r=[...a];return e===0?r.unshift(t):e>=r.length?r.push(t):r.splice(e,0,t),r}function uC(e,t){return t.filter((a,r)=>r!==e)}function pC(e,t){for(let a=0;a<t.length;a++){let r=t[a],i=e[r];if(kr(i)&&Ns(i))return{firstEvent:i,firstIndex:a}}return{firstEvent:null,firstIndex:null}}function dC(e,t){if(t.length<1)return{lastEvent:null,lastIndex:null};for(let a=t.length-1;a>=0;a--){let r=t[a],i=e[r];if(kr(i)&&!i.skip)return{lastEvent:i,lastIndex:a}}return{lastEvent:null,lastIndex:null}}function fC(e,t,a){let r=t.findIndex(i=>i===a);if(r<0)return{nextEvent:null,nextIndex:null};for(let i=r+1;i<t.length;i++){let c=t[i],p=e[c];if(kr(p))return{nextEvent:p,nextIndex:i}}return{nextEvent:null,nextIndex:null}}function mC(e,t,a){let r=t.findIndex(i=>i===a);if(r<0)return{previousEvent:null,previousIndex:null};for(let i=r-1;i>=0;i--){let c=t[i],p=e[c];if(kr(p))return{previousEvent:p,previousIndex:i}}return{previousEvent:null,previousIndex:null}}function P4(e,t,a,r){if(a)return a;if(!r)return null;let i=t?t.entries:e.order;if(!i||i.length===0)return null;let c=i.findIndex(p=>p===r);return c<1?null:i[c-1]}function hC(e,t){if(t.parent)return t.parent;let a=t.after??t.before;if(!a)return null;let r=e.entries[a];return r&&"parent"in r&&r.parent?r.parent:null}function i5(e,t,a,r){if(r)if("parent"in t&&(t.parent=r.id),a){let i=r.entries.indexOf(a)+1,c=e.flatOrder.indexOf(a)+1;r.entries=Bs(i,t.id,r.entries),e.flatOrder=Bs(c,t.id,e.flatOrder)}else{r.entries=Bs(0,t.id,r.entries);let i=e.flatOrder.indexOf(r.id)+1;e.flatOrder=Bs(i,t.id,e.flatOrder)}else if(a){let i=e.order.indexOf(a)+1,c=e.flatOrder.indexOf(a)+1;e.order=Bs(i,t.id,e.order),e.flatOrder=Bs(c,t.id,e.flatOrder)}else e.order=Bs(0,t.id,e.order),e.flatOrder=Bs(0,t.id,e.flatOrder);return e.entries[t.id]=t,t}function NH(e){return typeof e=="number"&&!isNaN(e)?!0:typeof e=="string"&&e.trim()!==""?!isNaN(parseFloat(e)):!1}var V6e=/^(\D*)(\d+)(\.\d+)?$/;function H6e(e){let t=V6e.exec(e);if(t){let[,a,r,i]=t;if(i){if(i===".99")i=".100";else{let p=`${"0".repeat(i.length-2)}1`;i=(Number(i)+ +`0.${p}`).toFixed(i.length-1).toString().replace("0.",".")}return`${a}${r}${i}`}return r=(Number(r)+1).toString(),`${a}${r}`}return`${e}2`}function vC(e,t,a){if(a===null||t.length===0)return f();let r=e[a];if(!kr(r)&&(r=mC(e,t,a).previousEvent,!kr(r)))return f();let i=H6e(r.cue),{nextEvent:c}=fC(e,t,a);if(i!==c?.cue)return i;if(NH(i))return p(r.cue);return`${r.cue}.1`;function p(v){return(Number(v)+.1).toString()}function f(){return pC(e,t).firstEvent?.cue==="1"?"0.1":"1"}}var gC=require("node:crypto");var W6e=128,l0,_1;function G6e(e){!l0||l0.length<e?(l0=Buffer.allocUnsafe(e*W6e),gC.webcrypto.getRandomValues(l0),_1=0):_1+e>l0.length&&(gC.webcrypto.getRandomValues(l0),_1=0),_1+=e}function z6e(e){return G6e(e|=0),l0.subarray(_1-e,_1)}function K6e(e,t,a){let r=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*r*t/e.length);return(c=t)=>{let p="";for(;;){let f=a(i),v=i;for(;v--;)if(p+=e[f[v]&r]||"",p.length>=c)return p}}}function MH(e,t=21){return K6e(e,t,z6e)}var Z6e=MH("1234567890abcdef",6),Ta=()=>Z6e();function xC(e){let t=Object.keys(e);if(t.length===0)throw new Error("No rundowns found in project");let a=t[0];return e[a]}var I4={type:"event",flag:!1,title:"",note:"",endAction:"none",timerType:"count-down",timeStrategy:"lock-duration",linkStart:!1,countToEnd:!1,timeStart:0,timeEnd:0,duration:0,skip:!1,colour:"",timeWarning:12e4,timeDanger:6e4,triggers:[],custom:{},parent:null,revision:0,delay:0,dayOffset:0,gap:0},fHe={type:"delay",duration:0,parent:null},yC={type:"milestone",cue:"",title:"",note:"",colour:"",custom:{},parent:null,revision:0},wC={type:"group",title:"",note:"",entries:[],targetDuration:null,colour:"",custom:{},revision:0,timeStart:null,timeEnd:null,duration:0,isFirstLinked:!1};var ga=(e,t="")=>typeof e=="string"?e.trim():e==null||e.constructor===Object?t:e.toString().trim();function E1(e){return{type:"delay",id:e?.id??Ta(),duration:e?.duration??0,parent:e?.parent??null}}var S1=(e,t="")=>{if(Object.keys(e).length===0)return null;let a=typeof t=="number"?String(t+1):t,r={id:e?.id??Ta(),cue:a,...I4};return X6e(r,e)};function u0(e){return e?{id:e.id??Ta(),type:"group",title:e.title??"",note:e.note??"",entries:e.entries??[],targetDuration:e.targetDuration??null,colour:ga(e.colour,""),custom:e.custom??{},revision:0,timeStart:null,timeEnd:null,duration:0,isFirstLinked:!1}:{...wC,id:Ta()}}function A1(e){return e?{id:e.id??Ta(),type:"milestone",cue:e.cue??"",title:e.title??"",note:e.note??"",colour:ga(e.colour,""),custom:e.custom??{},parent:e.parent??null,revision:0}:{...yC,id:Ta()}}function Y6e(e,t,a){return e&&!t?"lock-end":!e&&t?"lock-duration":a}function X6e(e,t){if(Object.keys(t).length===0)return e;let{timeStart:a,timeEnd:r,duration:i,timeStrategy:c}=D4(t?.timeStart??e.timeStart,t?.timeEnd??e.timeEnd,t?.duration??e.duration,t?.timeStrategy??Y6e(t?.timeEnd,t?.duration,e.timeStrategy));return{id:e.id,type:"event",flag:typeof t.flag=="boolean"?t.flag:e.flag,title:ga(t.title,e.title),timeStart:a,timeEnd:r,duration:i,timeStrategy:c,linkStart:typeof t.linkStart=="boolean"?t.linkStart:e.linkStart,endAction:nu(t.endAction,e.endAction),timerType:c0(t.timerType,e.timerType),countToEnd:typeof t.countToEnd=="boolean"?t.countToEnd:e.countToEnd,skip:typeof t.skip=="boolean"?t.skip:e.skip,note:ga(t.note,e.note),colour:ga(t.colour,e.colour),delay:e.delay,dayOffset:e.dayOffset,gap:e.gap,cue:ga(t.cue??null,e.cue),parent:e.parent,revision:e.revision,timeWarning:t.timeWarning??e.timeWarning,timeDanger:t.timeDanger??e.timeDanger,custom:{...e.custom,...t.custom},triggers:t.triggers??e.triggers}}function bC(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)}function N4(e){return String(e).padStart(2,"0")}function lc(e,t){if(e==null)return t?.fallback??"...";let a=e<0,r=Math.abs(xp(e,t?.direction)),i=r%60,c=DH(r)%60,p=PH(r);return`${a?"-":""}${[p,c,i].map(N4).join(":")}`}function _C(e){return e.startsWith("00:0")?e.slice(4):e.startsWith("00:")?e.slice(3):e.startsWith("-00:0")?`-${e.slice(5)}`:e.startsWith("-00:")?`-${e.slice(4)}`:e}function p0(e){let{isAM:t,isPM:a,value:r}=ege(e.toLowerCase()),i=Q6e(r);if(i!==null)return i;let c=/[\s,:.]+/,[p,f,v]=r.split(c),y=0,b=a;if(p!=null&&f!=null&&v!=null){let E=un(p);E===12&&(t&&(E=0),b=!1),y=E*Zn,y+=un(f)*Yi,y+=un(v)*ol}else if(p!=null&&f==null&&v==null){let{inferredMillis:E,addAM:T}=J6e(p,t,a);y=E,b=T<12&&a}else if(p!=null&&f!=null&&v==null){let E=un(p);E===12&&(t&&(E=0),b=!1),y=E*Zn,y+=un(f)*Yi}return b&&(y+=12*Zn),y}function J6e(e,t,a){let r=e.length,i=0,c=0;if(r===1)a||t?(i=un(e)*Zn,t&&(c=i)):i=un(e)*Yi;else if(r===2)a||t?(e==="12"&&t?i=0:i=un(e)*Zn,(t||e==="12")&&(c=12)):i=un(e)*Yi;else if(r===3)i=un(e[0])*Zn+un(e.substring(1))*Yi;else if(r===4)i=un(e.substring(0,2))*Zn+un(e.substring(2))*Yi;else if(r>=5){let p=un(e.substring(0,2)),f=un(e.substring(2,4)),v=un(e.substring(4));i=p*Zn+f*Yi+v*ol}return{inferredMillis:i,addAM:c}}function Q6e(e){let t=/(\d+)h(?:(\d+)(?!s))?/i.exec(e),a=t?un(t[1]):0,r=t?.[2]?un(t[2]):0,i=/(\d+)m/i.exec(e),c=i?un(i[1]):r,p=/(\d+)s/i.exec(e),f=p?un(p[1]):0;return t||i||p?a*Zn+c*Yi+f*ol:null}function ege(e){return e.endsWith("pm")?{isAM:!1,isPM:!0,value:e.slice(0,-2)}:e.endsWith("p")?{isAM:!1,isPM:!0,value:e.slice(0,-1)}:e.endsWith("am")?{isAM:!0,isPM:!1,value:e.slice(0,-2)}:e.endsWith("a")?{isAM:!0,isPM:!1,value:e.slice(0,-1)}:{isAM:!1,isPM:!1,value:e}}function un(e){let t=Number(e);return isNaN(t)?0:Math.abs(t)}var cl={isOnlyNumbers:/^\d+$/,isIPAddress:/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/,startsWithHttp:/^https?:\/\//,startsWithSlash:/^\//,isAlphanumeric:/^[a-z0-9]+$/i,isAlphanumericWithSpace:/^[a-z0-9_ ]+$/i,isASCII:/^[ -~]+$/,isASCIIorEmpty:/^$|^[ -~]+$/,isNotEmpty:/\S/},ll={isOnlyNumbers:e=>cl.isOnlyNumbers.test(e),isIPAddress:e=>cl.isIPAddress.test(e),startsWithHttp:e=>cl.startsWithHttp.test(e),startsWithSlash:e=>cl.startsWithSlash.test(e),isAlphanumeric:e=>cl.isAlphanumeric.test(e),isAlphanumericWithSpace:e=>cl.isAlphanumericWithSpace.test(e),isASCII:e=>cl.isASCII.test(e),isASCIIorEmpty:e=>cl.isASCIIorEmpty.test(e),isNotEmpty:e=>cl.isNotEmpty.test(e)};var M4=e=>{let t=/^#((?:[a-f\d]{1}){3,4})$/i,a=/^#((?:[a-f\d]{2}){3,4})$/i;return t.test(e)||a.test(e)};var tge=/\\?.|^$/g,EC=(e,t=!0)=>{let a=e.match(tge);if(!a||a[0]=="")return null;let r=a.reduce((i,c)=>(c==='"'?(i.inQuotes^=1,t&&(i.array[i.array.length-1]+=c.replace(/\\(.)/,"$1"))):!i.inQuotes&&c===" "?i.array.push(""):i.array[i.array.length-1]+=c.replace(/\\(.)/,"$1"),i),{array:[""],inQuotes:0}).array.filter(i=>i!="");return r.length?r:null};function uc(e){return e.trim().replaceAll(" ","_")}function L4(e,t){let a=e.split("."),r=t;for(let i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return r}function SC(e){return Object.keys(e).length===0}function AC(e){return Object.keys(e).forEach(t=>e[t]===void 0&&delete e[t]),e}function St(e){return e instanceof Error?e.message:String(e)}function s5(e){let t=e.replace(/[a-zA-Z0-9]/g,a=>/[a-zA-Z]/.test(a)?String.fromCharCode((a<="Z"?90:122)>=(a=a.charCodeAt(0)+13)?a:a-26):String.fromCharCode((a<="4"?57:48)>=(a=a.charCodeAt(0)+5)?a:a-10));return e.startsWith("_")?t.replace("_",""):`_${t}`}function B4(e,t){let{timeStart:a,dayOffset:r,delay:i}=e,{currentDay:c,totalGap:p,isLinkedToLoaded:f,offset:v,mode:y,actualStart:b,plannedStart:E}=t,T=r-c,k=Math.max(0,a+i)+T*Or,D=0;y==="relative"&&(D=(b??0)+c*Or-(E??0));let U=k+D,z=U+v;return f?z:p>v?U:z-p}function TC(e,t,a){let r=t<e?t+Or:t;return e<=a&&a<=r}function FC(e,t){if(!t)return 0;let a=e.timeStart+e.dayOffset*Or,r=t.timeStart+t.duration+t.dayOffset*Or;return a===r?0:(a>r,a-r)}function CC(e,t){if(!t)return!0;let a=e.timeStart+e.duration+e.dayOffset*Or,r=t.timeStart+t.duration+t.dayOffset*Or;return a>=r}var o5={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"};function U4(e){return typeof e!="object"||e===null?!1:Object.keys(o5).every(a=>Object.hasOwn(e,a))}function d0(e){return e==="play"||e==="pause"||e==="roll"}function OC(e,t,a=.5){let r=a,i=1-r;return{red:Math.round(e.red*r+t.red*i),green:Math.round(e.green*r+t.green*i),blue:Math.round(e.blue*r+t.blue*i),alpha:1}}function RC(e){if(e.startsWith("#"))return kC(e);let t=e.toLocaleLowerCase();return t in j4?kC(j4[t]):null}function kC(e){if(!M4(e))return null;let t=e.toLocaleLowerCase();t=t.replace(/^#/,"");let a=1;if(t.length===8){let f=t.slice(6,8);a=parseInt(f,16)/255,t=t.slice(0,6)}if(t.length===4){let f=t.slice(3,4).repeat(2);a=parseInt(f,16)/255,t=t.slice(0,3)}t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let r=parseInt(t,16),i=r>>16,c=r>>8&255,p=r&255;return isNaN(i)||isNaN(c)||isNaN(p)||isNaN(a)?null:{red:i,green:c,blue:p,alpha:a}}function DC(e){return(e.red*299+e.green*587+e.blue*114)/1e3>=128}var j4={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd3"};var Fn={skipLimit:1e3,updateRate:32,notificationRate:1e3,triggerAhead:10,auxTimerDefault:5*Yi},Ur={appState:"app-state.json",corrupt:"corrupt files",migrate:"migrated files",crash:"crash logs",demoProject:"demo project.json",newProject:"new project.json",database:{directory:"db",filename:"db.json"},external:"external",demo:"demo",projects:"projects",sheets:{directory:"sheets"},restoreFile:"ontime.restore",user:"user",styles:{directory:"styles",filename:"override.css"},uploads:"uploads",logo:"logo",translations:{directory:"translations",filename:"translations.json"}};var f0=require("fs"),su=require("fs/promises"),Us=require("path");function PC(e){console.log(rge(e))}function iu(e){console.error(age(e))}function c5(e){console.log(nge(e))}function l5(e){console.log(ige(e))}function rge(e){return`\x1B[32m${e}\x1B[0m`}function age(e){return`\x1B[31m${e}\x1B[0m`}function nge(e){return`\x1B[96m${e}\x1B[0m`}function ige(e){return`\x1B[2m${e}\x1B[0m`}var cr={boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",number:e=>typeof e=="number",defined:e=>e!==void 0,object:e=>typeof e=="object"&&e!==null&&!Array.isArray(e),objectWithKeys:(e,t)=>t.every(a=>a in e),array:e=>Array.isArray(e)};function Cn(e){if(!(0,f0.existsSync)(e))try{(0,f0.mkdirSync)(e,{recursive:!0})}catch(t){throw new Error(`Could not create directory: ${t}`)}}function T1(e){return e&&(e.endsWith(".json")?e:`${e}.json`)}async function LH(e){return(0,su.readdir)(e)}var u5=e=>(0,Us.parse)(e).name;function IC(e,t){let a=e.split(".").pop();return e.replace(`.${a}`,` ${t}.${a}`)}function BH(e,t){let a=t;for(;r(a);)a=sge(a);return a;function r(i){return(0,f0.existsSync)((0,Us.join)(e,i))}}function NC(e){return(0,Us.basename)(e)}async function MC(e,t){let a=await(0,su.readdir)(e,{withFileTypes:!0});for(let r of a){let i=(0,Us.join)(e,r.name),c=(0,Us.join)(t,r.name);r.isDirectory()?await MC(i,c):await(0,su.copyFile)(i,c)}}async function yp(e,t){try{await(0,su.copyFile)(e,t,f0.constants.COPYFILE_EXCL),await(0,su.unlink)(e)}catch(a){throw cr.object(a)&&"code"in a&&a.code==="EEXIST"?(iu(`rename error: File already exists ${t}`),new Error("File already exists")):(iu(`rename error ${a}`),new Error("Unknown file rename error"))}}function sge(e){let{dir:t,name:a,ext:r}=(0,Us.parse)(e);if(!a.endsWith(")"))return(0,Us.join)(t,`${a} (1)${r}`);let i=a.lastIndexOf(" (");if(i===-1)return(0,Us.join)(t,`${a} (1)${r}`);let c=Number(a.slice(i+2,-1));return isNaN(c)?(0,Us.join)(t,`${a} (1)${r}`):(0,Us.join)(t,`${a.slice(0,i)} (${c+1})${r}`)}var wp=async e=>await(0,su.unlink)(e).catch(t=>{console.error("Could not delete file:",t)});var LC=process.env.NODE_ENV||"production",ul=!!process.env.IS_TEST,UH=ul?"test":LC,q4=LC==="docker",ki=q4||LC==="production"&&!ul,bp=!!process.env.IS_CLOUD;var $H={};function BC(){if(process.env.ONTIME_DATA)return(0,Tr.join)(process.env.ONTIME_DATA);switch(process.platform){case"darwin":return(0,Tr.join)(process.env.HOME,"Library","Application Support","Ontime");case"win32":return(0,Tr.join)(process.env.APPDATA,"Ontime");case"linux":return(0,Tr.join)(process.env.HOME,".Ontime");default:throw new Error("Could not resolve public folder for platform")}}$H.url&&(globalThis.__dirname=(0,VH.fileURLToPath)($H.url));var jH=(0,Tr.dirname)(__dirname),$4=ki?jH:(0,Tr.join)(jH,"../"),Xi={root:$4,clientDir:ki?(0,Tr.join)($4,"client/"):(0,Tr.join)($4,"../../client/build/"),demoDir:(0,Tr.join)($4,"external",Ur.demo)},Oi={clientIndexHtml:(0,Tr.join)(Xi.clientDir,"index.html"),cssOverride:(0,Tr.join)(Xi.root,Ur.user,Ur.styles.directory,Ur.styles.filename),translationsFile:(0,Tr.join)(Xi.root,Ur.user,Ur.translations.directory,Ur.translations.filename),externalReadme:(0,Tr.join)(Xi.root,Ur.external,"README.md"),userReadme:(0,Tr.join)(Xi.root,Ur.user,"README.md"),cssReadme:(0,Tr.join)(Xi.root,Ur.user,Ur.styles.directory,"README.md"),translationReadme:(0,Tr.join)(Xi.root,Ur.user,Ur.translations.directory,"README.md"),login:(0,Tr.join)(Xi.root,"html/login.html"),logo:(0,Tr.join)(Xi.root,Ur.user,Ur.logo,"ontime-logo.png")},_o=BC();Cn(_o);var qH=ki?_o:(0,Tr.join)($4,"external"),ar={root:_o,crashDir:(0,Tr.join)(_o,Ur.crash),projectsDir:(0,Tr.join)(_o,Ur.projects),corruptDir:(0,Tr.join)(_o,Ur.corrupt),migrateDir:(0,Tr.join)(_o,Ur.migrate),uploadsDir:(0,Tr.join)(_o,Ur.uploads),externalDir:(0,Tr.join)(qH,ki?Ur.external:""),demoDir:(0,Tr.join)(qH,ki?"/external/":"",Ur.demo),userDir:(0,Tr.join)(_o,Ur.user),stylesDir:(0,Tr.join)(_o,Ur.user,Ur.styles.directory),logoDir:(0,Tr.join)(_o,Ur.user,Ur.logo),translationsDir:(0,Tr.join)(_o,Ur.user,Ur.translations.directory)},kn={appState:(0,Tr.join)(ar.root,Ur.appState),restoreFile:(0,Tr.join)(ar.root,Ur.restoreFile),cssOverride:(0,Tr.join)(ar.stylesDir,Ur.styles.filename),translationsFile:(0,Tr.join)(ar.translationsDir,Ur.translations.filename),externalReadme:(0,Tr.join)(ar.externalDir,"README.md"),userReadme:(0,Tr.join)(ar.userDir,"README.md"),cssReadme:(0,Tr.join)(ar.stylesDir,"README.md"),translationReadme:(0,Tr.join)(ar.translationsDir,"README.md")};var p5=require("node:fs");var UC=process.env.SESSION_PASSWORD,jC=process.env.ROUTER_PREFIX;function HH(e=jC){if(!e)return"";try{let t=(0,p5.readFileSync)(Oi.clientIndexHtml,{encoding:"utf-8",flag:"r"}).replace('<base href="/" />',`<base href="/${e}/" ${bp?"data-is-cloud":""}/>`);(0,p5.writeFileSync)(Oi.clientIndexHtml,t,{encoding:"utf-8",flag:"w"})}catch{}return`/${e}`}var Eo="4.4.2";var qC=qt(Tn(),1),WH=[qC.default.urlencoded({extended:!0}),qC.default.json({limit:"1mb"})];var QH=qt(JH(),1),eW=require("node:path");var VC=(0,QH.default)(Xi.clientDir,{enableBrotli:!0,orderPreference:["br"],serveStatic:{etag:!1,lastModified:!1,immutable:!0,maxAge:"1y",setHeaders:(e,t)=>{(0,eW.extname)(t)===".html"&&e.setHeader("Cache-Control","public, max-age=0")}}});var tO=qt(Tn(),1),HK=qt(aW(),1);var nW=require("node:crypto");function f5(e){return(0,nW.createHash)("sha256").update(e).digest("base64url")}var sW=require("node:fs/promises");var h5=require("node:fs/promises"),F1=require("node:path"),iW=require("node:url");function Pge(e){let t=e instanceof URL?(0,iW.fileURLToPath)(e):e.toString();return(0,F1.join)((0,F1.dirname)(t),`.${(0,F1.basename)(t)}.tmp`)}async function Ige(e,t,a){for(let r=0;r<t;r++)try{return await e()}catch(i){if(r<t-1)await new Promise(c=>setTimeout(c,a));else throw i}}var m5=class{#e;#t;#r=!1;#n=null;#i=null;#s=null;#a=null;#o(t){return this.#a=t,this.#s||=new Promise((a,r)=>{this.#i=[a,r]}),new Promise((a,r)=>{this.#s?.then(a).catch(r)})}async#c(t){this.#r=!0;try{await(0,h5.writeFile)(this.#t,t,"utf-8"),await Ige(async()=>{await(0,h5.rename)(this.#t,this.#e)},10,100),this.#n?.[0]()}catch(a){throw a instanceof Error&&this.#n?.[1](a),a}finally{if(this.#r=!1,this.#n=this.#i,this.#i=this.#s=null,this.#a!==null){let a=this.#a;this.#a=null,await this.write(a)}}}constructor(t){this.#e=t,this.#t=Pge(t)}async write(t){return this.#r?this.#o(t):this.#c(t)}};var v5=class{#e;#t;constructor(t){this.#e=t,this.#t=new m5(t)}async read(){let t;try{t=await(0,sW.readFile)(this.#e,"utf-8")}catch(a){if(a.code==="ENOENT")return null;throw a}return t}write(t){return this.#t.write(t)}};var g5=class{#e;#t;#r;constructor(t,{parse:a,stringify:r}){this.#e=new v5(t),this.#t=a,this.#r=r}async read(){let t=await this.#e.read();return t===null?null:this.#t(t)}write(t){return this.#e.write(this.#r(t))}};var _p=class extends g5{constructor(t){super(t,{parse:JSON.parse,stringify:a=>JSON.stringify(a,null,2)})}};var x5=class{#e=null;read(){return Promise.resolve(this.#e)}write(t){return this.#e=t,Promise.resolve()}};function Nge(e,t){if(e===void 0)throw new Error("lowdb: missing adapter");if(t===void 0)throw new Error("lowdb: missing default data")}var C1=class{adapter;data;constructor(t,a){Nge(t,a),this.adapter=t,this.data=a}async read(){let t=await this.adapter.read();t&&(this.data=t)}async write(){this.data&&await this.adapter.write(this.data)}async update(t){t(this.data),await this.write()}};async function oW(e,t){let a=process.env.NODE_ENV==="test"?new x5:new _p(e),r=new C1(a,t);return await r.read(),r}function y5(e,t){let a=structuredClone(e),r=structuredClone(t),{rundowns:i={},project:c={},settings:p={},viewSettings:f={},urlPresets:v=[],customFields:y={},automation:b}=r;return{rundowns:{...e.rundowns,...i},project:{...a.project,...c},settings:{...a.settings,...p},viewSettings:{...a.viewSettings,...f},urlPresets:[...a.urlPresets,...v],customFields:{...a.customFields,...y},automation:b??a.automation}}var pr={};async function cW(e,t){let a=await oW(e,t);a.data=t,await a.write(),await a.read(),pr=a}function Ht(){if(pr===null)throw new Error("Database not initialized");return{getData:Mge,setProjectData:Lge,getProjectData:Bge,setCustomFields:Uge,getCustomFields:qge,setRundown:$ge,mergeRundown:jge,getSettings:Vge,setSettings:Hge,getUrlPresets:Wge,setUrlPresets:Gge,getViewSettings:zge,setViewSettings:Kge,getAutomation:Zge,setAutomation:Yge,getRundown:Xge,getProjectRundowns:Qge,mergeIntoData:exe,deleteRundown:Jge}}function Mge(){return pr.data}async function Lge(e){return pr.data.project={...structuredClone(pr.data.project),...structuredClone(e)},await pl(),pr.data.project}function Bge(){return pr.data.project}async function Uge(e){return pr.data.customFields={...e},await pl(),pr.data.customFields}async function jge(e,t){return pr.data.customFields={...pr.data.customFields,...e},Object.entries(t).forEach(([a,r])=>{pr.data.rundowns[a]=r}),await pl(),{rundowns:pr.data.rundowns,customFields:pr.data.customFields}}function qge(){return pr.data.customFields}async function $ge(e,t){pr.data.rundowns[e]=structuredClone(t),await pl()}function Vge(){return pr.data.settings}async function Hge(e){return pr.data.settings={...e},await pl(),pr.data.settings}function Wge(){return pr.data.urlPresets}async function Gge(e){return pr.data.urlPresets=e,await pl(),pr.data.urlPresets}function zge(){return pr.data.viewSettings}async function Kge(e){return pr.data.viewSettings={...e},await pl(),pr.data.viewSettings}function Zge(){return pr.data.automation}async function Yge(e){return pr.data.automation={...e},await pl(),pr.data.automation}function Xge(e){if(!(e in pr.data.rundowns))throw new Error(`Rundown with id: ${e} not found`);let t=pr.data.rundowns[e];if(!t)throw new Error(`Rundown with id: ${e} not found`);return t}async function Jge(e){if(!(e in pr.data.rundowns))throw new Error(`Rundown with id: ${e} not found`);return delete pr.data.rundowns[e],await pl(),pr.data.rundowns}function Qge(){return pr.data.rundowns}async function exe(e){let t=y5(pr.data,e);return pr.data.project=t.project,pr.data.settings=t.settings,pr.data.viewSettings=t.viewSettings,pr.data.automation=t.automation,pr.data.urlPresets=t.urlPresets,pr.data.customFields=t.customFields,pr.data.rundowns=t.rundowns,await pl(),pr.data}var h0=null,m0=null,txe=3e3;async function pl(){ul||(h0&&clearTimeout(h0),h0=setTimeout(async()=>{h0=null,m0&&await m0;try{m0=pr.write(),await m0}catch(e){console.error("Failed to persist database:",e)}finally{m0=null}},txe))}async function lW(){ul||(h0&&(clearTimeout(h0),h0=null),m0&&await m0,await pr.write())}var w3e=qt(nG(),1),b3e=qt(ek(),1),_3e=qt(ak(),1),pk=qt(R5(),1),dk=qt(fG(),1);var mG=["ambient","analog","artistic","binaural","bright","cinematic","clean","cool","crisp","dark","deep","distorted","dreamy","dynamic","electric","explosive","flickering","fluid","glitchy","glowing","harmonious","hazy","intense","low-fi","mellow","melodic","metallic","moody","muted","nostalgic","noisy","organic","panoramic","percussive","powerful","psychedelic","quirky","raw","resonant","retro","sharp","shimmering","smooth","soft","soulful","sparkling","spacious","subtle","surround","tilted","uplifting","vibrant","warm"],hG=["acoustics","animation","audio","barndoor","beat","brightness","bulb","channel","chroma","cinema","clip","color","codec","composition","compression","contrast","darkness","display","distortion","dolly","downlight","drum","echo","edit","effect","film","fixture","flash","footage","format","floodlight","flicker","frame","fresnel","gel","glow","gobo","groove","guitar","harmony","highlight","illumination","instrument","instrumental","jib","lamp","led","light","luminance","mastering","melody","microphone","mix","mixing","moving light","note","pattern","piano","picture","production","record","reflection","reverb","resolution","sampler","sample","saxophone","screen","signal","softlight","song","sound","soundtrack","speaker","spot","strobe","streaming","surround","synth","tune","trumpet","uplight","video","violin","visual","voice","wave","wash"];function P5(){return`${mG[Math.floor(Math.random()*mG.length)]} ${hG[Math.floor(Math.random()*hG.length)]}`}var I5=e=>{if(typeof e=="object"&&e!==null&&!Array.isArray(e))return Object.keys(e).length===0;throw new Error("Variable is not an object")},vG=e=>Object.keys(e).reduce((t,a)=>(typeof e[a]<"u"&&(t[a]=e[a]),t),{});var b0={},To={init(e){b0=e},get(e){return b0[e]},set(e,t){b0[e]=t,Ri.sendAsJson("runtime-data",{[e]:t})},createBatch(){let e={};return{add(t,a){e[t]=a},send(){I5(e)||(b0={...b0,...e},Ri.sendAsJson("runtime-data",e))}}},poll(){return b0},broadcast(){Ri.sendAsJson("runtime-data",b0)}};function gG(e){let t=e.getHours(),a=e.getMinutes(),r=e.getSeconds();return t*Zn+a*Yi+r*ol}function M1(e){if(e instanceof Date)return gG(e);if(typeof e=="string"){if(bC(e)){let t=new Date(e);if(t instanceof Date&&!isNaN(t.getTime()))return gG(t)}return p0(e)}return typeof e=="number"?e*Yi:0}function xG(e){let t=e.getTimezoneOffset(),a=Intl.DateTimeFormat().resolvedOptions().timeZone,r=t<0?"+":"-",i=Math.abs(t),c=Math.floor(i/60),p=i%60;return`GMT ${r}${N4(c)}:${N4(p)} ${a}`}function Ap(){let e=new Date,t=e.getHours()*36e5;return t+=e.getMinutes()*6e4,t+=e.getSeconds()*1e3,t+=e.getMilliseconds(),t}function N5(){let e=new Date,t=e.getHours()*36e5;return t+=e.getMinutes()*6e4,t+=e.getSeconds()*1e3,t+=e.getMilliseconds(),[e.getTime(),t]}var fk=class{queue;escalateErrorFn;canLog=!1;constructor(){this.queue=[],this.escalateErrorFn=null,this.canLog=!ki}init(t){this.queue.forEach(a=>{this._push(a)}),this.queue=[],t&&(this.escalateErrorFn=t)}addToQueue(t){this.queue.push(t),this.queue.length>100&&this.queue.pop()}_push(t){(this.canLog||t.level==="SEVERE")&&(t.level==="SEVERE"?iu(`[${t.level}] ${t.origin} ${t.text}`):l5(`[${t.level}] ${t.origin} ${t.text}`)),this.addToQueue(t);try{Ri.sendAsJson("log",t)}catch{}}emit(t,a,r){let i={id:Ta(),level:t,origin:a,text:r,time:lc(Ap())};this._push(i)}info(t,a){this.emit("INFO",t,a)}warning(t,a){this.emit("WARN",t,a)}error(t,a,r=!1){this.emit("ERROR",t,a),r&&this.escalateErrorFn?.(a,!1)}crash(t,a){this.emit("SEVERE",t,a),this.escalateErrorFn?.(a,!0)}dump(){let t=this.queue;return this.queue=[],t}shutdown(){this.queue=[]}},At=new fk;var L1=class{state={duration:0,current:0,playback:"stop",direction:"count-down"};startedAt=null;pausedAt=null;initialDuration=0;constructor(t=0){this.state.duration=t,this.initialDuration=t,this.state.current=t}reset(){this.state={duration:0,current:0,playback:"stop",direction:"count-down"}}setTime(t){return this.state.duration=t,this.initialDuration=t,this.state.current=t,this.state}addTime(t){return this.state.duration+=t,this.state.current+=t,this.state}setDirection(t,a){return this.state.playback==="start"&&(this.startedAt=a,this.state.duration=this.state.current),this.state.direction=t,this.update(a),this.state}start(t){if(this.state.playback==="pause"){let a=this.pausedAt-this.startedAt;this.startedAt=t-a}else this.state.playback==="stop"&&(this.startedAt=t);return this.state.playback="start",this.update(t)}pause(t){return this.state.playback!=="start"?this.state:(this.state.playback="pause",this.pausedAt=t,this.state)}stop(){return this.state.playback="stop",this.state.duration=this.initialDuration,this.state.current=this.initialDuration,this.startedAt=null,this.state}update(t){if(this.state.playback==="start"){let a=t-this.startedAt;this.state.direction==="count-down"?this.state.current=this.state.duration-a:this.state.direction==="count-up"&&(this.state.current=this.state.duration+a)}return this.state}};var pu=class{aux1;aux2;aux3;interval=null;emit;getTime;constructor(t,a){this.aux1=new L1(Fn.auxTimerDefault),this.aux2=new L1(Fn.auxTimerDefault),this.aux3=new L1(Fn.auxTimerDefault),this.emit=t,this.getTime=a}hasActiveTimers(){return this.aux1.state.playback==="start"||this.aux2.state.playback==="start"||this.aux3.state.playback==="start"}startInterval(){this.interval||(this.interval=setInterval(this.update.bind(this),500))}stopInterval(){this.interval&&!this.hasActiveTimers()&&(clearInterval(this.interval),this.interval=null)}setDirection(t,a){return a===1?this.aux1.setDirection(t,this.getTime()):a===2?this.aux2.setDirection(t,this.getTime()):this.aux3.setDirection(t,this.getTime())}start(t){return this.startInterval(),t===1?this.aux1.start(this.getTime()):t===2?this.aux2.start(this.getTime()):this.aux3.start(this.getTime())}pause(t){let a;return t===1?a=this.aux1.pause(this.getTime()):t===2?a=this.aux2.pause(this.getTime()):a=this.aux3.pause(this.getTime()),this.hasActiveTimers()||this.stopInterval(),a}stop(t){let a;return t===1?a=this.aux1.stop():t===2?a=this.aux2.stop():a=this.aux3.stop(),this.hasActiveTimers()||this.stopInterval(),a}setTime(t,a){return a===1?this.aux1.setTime(t):a===2?this.aux2.setTime(t):this.aux3.setTime(t)}addTime(t,a){let r=a===1?this.aux1:a===2?this.aux2:this.aux3;return r.state.playback==="start"?(r.addTime(t),r.update(this.getTime())):r.addTime(t)}update(){let t={},a=this.getTime();this.aux1.state.playback==="start"&&(t.auxtimer1=this.aux1.update(a)),this.aux2.state.playback==="start"&&(t.auxtimer2=this.aux2.update(a)),this.aux3.state.playback==="start"&&(t.auxtimer3=this.aux3.update(a)),Object.keys(t).length>0&&this.emit(t)}};va([B1],pu.prototype,"setDirection",1),va([B1],pu.prototype,"start",1),va([B1],pu.prototype,"pause",1),va([B1],pu.prototype,"stop",1),va([B1],pu.prototype,"setTime",1),va([B1],pu.prototype,"addTime",1);function B1(e,t,a){let r=a.value;return a.value=function(...i){let c=r.apply(this,i),p=i[i.length-1];return this.emit({[`auxtimer${p}`]:c}),c},a}var E3e=e=>{for(let[t,a]of Object.entries(e))To.set(t,a)},S3e=()=>Date.now(),pn=new pu(E3e,S3e);function yG(e,t){let a=!1,r=null,i=()=>{r==null?a=!1:(e(...r),r=null,setTimeout(i,t))};return(...c)=>a?(r=c,!0):(e(...c),a=!0,setTimeout(i,t),!1)}var wG=()=>{},bG=e=>{};function _G(e,t){wG=yG(e,100),bG=t}function A3e(){return bG("message")}function X4(e){let t={...A3e()};if(e.timer!==void 0){let a=AC(e.timer);t.timer={...t.timer,...a}}return"secondary"in e&&e.secondary!==void 0&&(t.secondary=e.secondary),wG("message",t),t}function EG(e){if(!cr.boolean(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function Xn(e){if(!cr.string(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function M5(e){if(!cr.number(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function dc(e){if(!cr.object(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function hk(e){if(!cr.array(e))throw new Error(`Unexpected payload type: ${String(e)}`)}function fl(e,t){if(!cr.objectWithKeys(e,t))throw new Error(`Unexpected payload type: ${String(e)}`)}function U1(e,t){if(typeof e!="string"||!Object.values(t).includes(e))throw new Error("Invalid value received");return e}function Tp(e){if(e==null||typeof e=="object")throw new Error("Invalid value received");return String(e)}function du(e){if(typeof e=="boolean")return e;if(typeof e=="string")switch(e.toLocaleLowerCase()){case"true":case"1":case"yes":return!0;case"false":case"0":case"no":case"":return!1;default:throw new Error("Invalid value received")}if(typeof e=="number"){if(e===0)return!1;if(e===1)return!0}throw new Error("Invalid value received")}function _0(e){if(e==null)throw new Error("Invalid value received");let t=Number(e);if(isNaN(t))throw new Error("Invalid value received");return t}function SG(e){if(typeof e!="string")throw new Error("Invalid colour value received");let t=e.toLocaleLowerCase();if(t.startsWith("#")){if(!M4(t))throw new Error("Invalid hex colour received");return t}if(t==="")return t;if(!(t in j4))throw new Error("Invalid colour name received");return t}function AG(e){return decodeURI(Tp(e))}function TG(e){dc(e);let t={};return"text"in e&&(t.text=decodeURI(Tp(e.text))),"visible"in e&&(t.visible=du(e.visible)),"blink"in e&&(t.blink=du(e.blink)),"blackout"in e&&(t.blackout=du(e.blackout)),"secondarySource"in e&&(t.secondarySource=F3e(e.secondarySource)),t}function T3e(e){return e==="aux1"||e==="aux2"||e==="aux3"||e==="secondary"||e===null}function F3e(e){return T3e(e)?e:null}var C3e=Object.getOwnPropertyNames,k3e=Object.getOwnPropertySymbols,O3e=Object.prototype.hasOwnProperty;function FG(e,t){return function(r,i,c){return e(r,i,c)&&t(r,i,c)}}function L5(e){return function(a,r,i){if(!a||!r||typeof a!="object"||typeof r!="object")return e(a,r,i);var c=i.cache,p=c.get(a),f=c.get(r);if(p&&f)return p===r&&f===a;c.set(a,r),c.set(r,a);var v=e(a,r,i);return c.delete(a),c.delete(r),v}}function CG(e){return C3e(e).concat(k3e(e))}var R3e=Object.hasOwn||function(e,t){return O3e.call(e,t)};function E0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var D3e="__v",P3e="__o",I3e="_owner",kG=Object.getOwnPropertyDescriptor,OG=Object.keys;function N3e(e,t,a){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!a.equals(e[r],t[r],r,r,e,t,a))return!1;return!0}function M3e(e,t){return E0(e.getTime(),t.getTime())}function L3e(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function B3e(e,t){return e===t}function RG(e,t,a){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),c=e.entries(),p,f,v=0;(p=c.next())&&!p.done;){for(var y=t.entries(),b=!1,E=0;(f=y.next())&&!f.done;){if(i[E]){E++;continue}var T=p.value,C=f.value;if(a.equals(T[0],C[0],v,E,e,t,a)&&a.equals(T[1],C[1],T[0],C[0],e,t,a)){b=i[E]=!0;break}E++}if(!b)return!1;v++}return!0}var U3e=E0;function j3e(e,t,a){var r=OG(e),i=r.length;if(OG(t).length!==i)return!1;for(;i-- >0;)if(!NG(e,t,a,r[i]))return!1;return!0}function J4(e,t,a){var r=CG(e),i=r.length;if(CG(t).length!==i)return!1;for(var c,p,f;i-- >0;)if(c=r[i],!NG(e,t,a,c)||(p=kG(e,c),f=kG(t,c),(p||f)&&(!p||!f||p.configurable!==f.configurable||p.enumerable!==f.enumerable||p.writable!==f.writable)))return!1;return!0}function q3e(e,t){return E0(e.valueOf(),t.valueOf())}function $3e(e,t){return e.source===t.source&&e.flags===t.flags}function DG(e,t,a){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),c=e.values(),p,f;(p=c.next())&&!p.done;){for(var v=t.values(),y=!1,b=0;(f=v.next())&&!f.done;){if(!i[b]&&a.equals(p.value,f.value,p.value,f.value,e,t,a)){y=i[b]=!0;break}b++}if(!y)return!1}return!0}function V3e(e,t){var a=e.length;if(t.length!==a)return!1;for(;a-- >0;)if(e[a]!==t[a])return!1;return!0}function H3e(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function NG(e,t,a,r){return(r===I3e||r===P3e||r===D3e)&&(e.$$typeof||t.$$typeof)?!0:R3e(t,r)&&a.equals(e[r],t[r],r,r,e,t,a)}var W3e="[object Arguments]",G3e="[object Boolean]",z3e="[object Date]",K3e="[object Error]",Z3e="[object Map]",Y3e="[object Number]",X3e="[object Object]",J3e="[object RegExp]",Q3e="[object Set]",e8e="[object String]",t8e="[object URL]",r8e=Array.isArray,PG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,IG=Object.assign,a8e=Object.prototype.toString.call.bind(Object.prototype.toString);function n8e(e){var t=e.areArraysEqual,a=e.areDatesEqual,r=e.areErrorsEqual,i=e.areFunctionsEqual,c=e.areMapsEqual,p=e.areNumbersEqual,f=e.areObjectsEqual,v=e.arePrimitiveWrappersEqual,y=e.areRegExpsEqual,b=e.areSetsEqual,E=e.areTypedArraysEqual,T=e.areUrlsEqual;return function(k,D,U){if(k===D)return!0;if(k==null||D==null)return!1;var z=typeof k;if(z!==typeof D)return!1;if(z!=="object")return z==="number"?p(k,D,U):z==="function"?i(k,D,U):!1;var oe=k.constructor;if(oe!==D.constructor)return!1;if(oe===Object)return f(k,D,U);if(r8e(k))return t(k,D,U);if(PG!=null&&PG(k))return E(k,D,U);if(oe===Date)return a(k,D,U);if(oe===RegExp)return y(k,D,U);if(oe===Map)return c(k,D,U);if(oe===Set)return b(k,D,U);var me=a8e(k);return me===z3e?a(k,D,U):me===J3e?y(k,D,U):me===Z3e?c(k,D,U):me===Q3e?b(k,D,U):me===X3e?typeof k.then!="function"&&typeof D.then!="function"&&f(k,D,U):me===t8e?T(k,D,U):me===K3e?r(k,D,U):me===W3e?f(k,D,U):me===G3e||me===Y3e||me===e8e?v(k,D,U):!1}}function i8e(e){var t=e.circular,a=e.createCustomConfig,r=e.strict,i={areArraysEqual:r?J4:N3e,areDatesEqual:M3e,areErrorsEqual:L3e,areFunctionsEqual:B3e,areMapsEqual:r?FG(RG,J4):RG,areNumbersEqual:U3e,areObjectsEqual:r?J4:j3e,arePrimitiveWrappersEqual:q3e,areRegExpsEqual:$3e,areSetsEqual:r?FG(DG,J4):DG,areTypedArraysEqual:r?J4:V3e,areUrlsEqual:H3e};if(a&&(i=IG({},i,a(i))),t){var c=L5(i.areArraysEqual),p=L5(i.areMapsEqual),f=L5(i.areObjectsEqual),v=L5(i.areSetsEqual);i=IG({},i,{areArraysEqual:c,areMapsEqual:p,areObjectsEqual:f,areSetsEqual:v})}return i}function s8e(e){return function(t,a,r,i,c,p,f){return e(t,a,f)}}function o8e(e){var t=e.circular,a=e.comparator,r=e.createState,i=e.equals,c=e.strict;if(r)return function(v,y){var b=r(),E=b.cache,T=E===void 0?t?new WeakMap:void 0:E,C=b.meta;return a(v,y,{cache:T,equals:i,meta:C,strict:c})};if(t)return function(v,y){return a(v,y,{cache:new WeakMap,equals:i,meta:void 0,strict:c})};var p={cache:void 0,equals:i,meta:void 0,strict:c};return function(v,y){return a(v,y,p)}}var fu=Fp(),tKe=Fp({strict:!0}),rKe=Fp({circular:!0}),aKe=Fp({circular:!0,strict:!0}),nKe=Fp({createInternalComparator:function(){return E0}}),iKe=Fp({strict:!0,createInternalComparator:function(){return E0}}),sKe=Fp({circular:!0,createInternalComparator:function(){return E0}}),oKe=Fp({circular:!0,createInternalComparator:function(){return E0},strict:!0});function Fp(e){e===void 0&&(e={});var t=e.circular,a=t===void 0?!1:t,r=e.createInternalComparator,i=e.createState,c=e.strict,p=c===void 0?!1:c,f=i8e(e),v=n8e(f),y=r?r(v):s8e(v);return o8e({circular:a,comparator:v,createState:i,equals:y,strict:p})}var MG=(e,t)=>t<e?t+Or:t;function S0(e){let{startedAt:t,duration:a,addedTime:r}=e.timer;if(e.eventNow===null)return null;let{countToEnd:i,timeEnd:c}=e.eventNow,{pausedAt:p}=e._timer,{clock:f}=e;if(t===null)return null;let v=p!=null?f-p:0;if(i)return c+r+v;let y=t+a+r+v;return y>Or?y-Or:Math.max(y,t)}function Q4(e){let{startedAt:t,duration:a,addedTime:r}=e.timer,{countToEnd:i,timeStart:c,timeEnd:p}=e.eventNow,{pausedAt:f}=e._timer,{clock:v}=e;if(i)return(c>p?Or:0)-v+p+r;if(t===null)return a;if(f!=null)return t+a+r-f;let b=t>v?Or:0;return t+a+r-v-b}function LG(e,t,a){if(e.timer.expectedFinish===null||e.timer.startedAt===null)return!1;let{startedAt:r,expectedFinish:i}=e.timer,{clock:c}=e,f=t>Or-a&&c<a?c+Or:c,v=t-f,y=Math.abs(v)>a,b=i>=r?i:i+Or;return y&&(f>b||f<r)}function ev(e){let{eventNow:t,clock:a,_startDayOffset:r}=e,{addedTime:i,current:c,startedAt:p}=e.timer;if(t===null||p===null||r===null)return{absolute:0,relative:0};let{countToEnd:f,timeStart:v,dayOffset:y}=t,{plannedStart:b,actualStart:E}=e.rundown,T=p+r*Or-(v+y*Or),C=Math.abs(Math.min(c,0)),k=e._timer.pausedAt===null?0:a-e._timer.pausedAt,D=T+C+k+i,U=D+b-E-r*Or;return f?{absolute:C,relative:U}:{absolute:D,relative:U}}function gk(e){if(!d0(e.timer.playback))return"none";let t=e.timer.current;if(t===null||e.eventNow===null||e.timer.secondaryTimer!=null)return"pending";if(t<0)return"overtime";let a=e.eventNow.timeDanger;if(t<=a)return"danger";let r=e.eventNow.timeWarning;return t<=r?"warning":"default"}function xk(e,t){let a=t-e;return a>=12*Zn?-1:a<-12*Zn?1:0}function BG(e,t,a){if(kr(t))return S1(t,vC(e.entries,e.order,a));let r=t.id||j1(e);if(fs(t))return E1({duration:t.duration??0,id:r});if(ya(t))return u0({id:r,title:t.title??""});if(ms(t))return A1({...t,id:r});throw new Error("Invalid event type")}function c8e(e,t){if(Object.keys(t).length===0)return e;let{timeStart:a,timeEnd:r,duration:i,timeStrategy:c}=D4(t?.timeStart??e.timeStart,t?.timeEnd??e.timeEnd,t?.duration??e.duration,t?.timeStrategy??p8e(t?.timeEnd,t?.duration,e.timeStrategy));return{id:e.id,type:"event",flag:typeof t.flag=="boolean"?t.flag:e.flag,title:ga(t.title,e.title),timeStart:a,timeEnd:r,duration:i,timeStrategy:c,linkStart:typeof t.linkStart=="boolean"?t.linkStart:e.linkStart,endAction:nu(t.endAction,e.endAction),timerType:c0(t.timerType,e.timerType),countToEnd:typeof t.countToEnd=="boolean"?t.countToEnd:e.countToEnd,skip:typeof t.skip=="boolean"?t.skip:e.skip,note:ga(t.note,e.note),colour:ga(t.colour,e.colour),delay:e.delay,dayOffset:e.dayOffset,gap:e.gap,cue:ga(t.cue??null,e.cue),parent:e.parent,revision:e.revision,timeWarning:t.timeWarning??e.timeWarning,timeDanger:t.timeDanger??e.timeDanger,custom:{...e.custom,...t.custom},triggers:t.triggers??e.triggers}}function l8e(e,t){if(Object.keys(t).length===0)return e;let a=()=>typeof t.targetDuration=="number"?t.targetDuration:t.targetDuration===null||t.targetDuration===""?null:e.targetDuration;return{id:e.id,type:"group",title:ga(t.title,e.title),note:ga(t.note,e.note),entries:t.entries??e.entries,targetDuration:a(),colour:ga(t.colour,e.colour),revision:e.revision,timeStart:e.timeStart,timeEnd:e.timeEnd,duration:e.duration,isFirstLinked:e.isFirstLinked,custom:{...e.custom,...t.custom}}}function u8e(e,t){return Object.keys(t).length===0?e:{id:e.id,type:"milestone",cue:ga(t.cue??null,e.cue),title:ga(t.title,e.title),note:ga(t.note,e.note),colour:ga(t.colour,e.colour),revision:e.revision,custom:{...e.custom,...t.custom},parent:e.parent}}function UG(e,t){if(kr(e)){let a=c8e(e,t);return a.revision++,a}if(ya(e)){let a=l8e(e,t);return a.revision++,a}if(ms(e)){let a=u8e(e,t);return a.revision++,a}return{...e,...t}}function p8e(e,t,a){return e&&!t?"lock-end":!e&&t?"lock-duration":a}function j1(e){let t;do t=Ta();while(e.entries[t]);return t}var jG=(C=>(C[C.id=0]="id",C[C.type=1]="type",C[C.cue=2]="cue",C[C.title=3]="title",C[C.note=4]="note",C[C.endAction=5]="endAction",C[C.timerType=6]="timerType",C[C.countToEnd=7]="countToEnd",C[C.colour=8]="colour",C[C.timeWarning=9]="timeWarning",C[C.timeDanger=10]="timeDanger",C[C.custom=11]="custom",C[C.triggers=12]="triggers",C))(jG||{});function qG(e){return Object.keys(e).some(yk)}function yk(e){return!(e in jG)}function wk(e,t){return Object.keys(t).some(a=>!Object.hasOwn(e,a)||e[a]!==t[a])}function bk(e,t){let a=e.findIndex(r=>r===t);return a===-1?e:e.toSpliced(a,1)}function d8e(e,t){let a=structuredClone(e);return a.id=t,a.revision=0,a}function f8e(e,t){let a=structuredClone(e);return a.id=t,a}function m8e(e,t){let a=structuredClone(e);return a.id=t,a}function h8e(e,t){let a=structuredClone(e);return a.id=t,a.entries=[],a.title=`${e.title||"Untitled"} (copy)`,a.revision=0,a}function $G(e,t){let a=j1(t),r=h8e(e,a),i=[],c=[];for(let p=0;p<e.entries.length;p++){let f=e.entries[p],v=t.entries[f];if(!v)continue;let y=j1(t),b=_k(v,y);b.parent=r.id,c.push(y),i.push(b)}return r.entries=c,{newGroup:r,nestedEntries:i}}function _k(e,t){if(kr(e))return d8e(e,t);if(fs(e))return f8e(e,t);if(ms(e))return m8e(e,t);throw new Error(`Unsupported entry type for cloning: ${e}`)}function VG(e,t){return!t||t.duration===0?0:t.timeStart+t.duration>=Or||e.timeStart<=t.timeStart?1:0}function q1(e,t){for(let a in e)Object.hasOwn(t,a)?e[a]===""&&delete e[a]:delete e[a]}function HG(e,t){let a=e.timedEventOrder[t],r=e.playableEventOrder.findIndex(i=>i===a);return r<0?null:r}function Ek(e,t){let a=e.playableEventOrder[t];return e.timedEventOrder.findIndex(i=>i===a)}function A0(e){return Object.values(e).map(({id:t,flatOrder:a,title:r,revision:i})=>({id:t,numEntries:a.length,title:r,revision:i}))}function WG(e,t){let a=Ta(),r=structuredClone(e);return r.id=a,r.title=t,r.revision=0,r}function GG(e,t,a){let r=t.playableEventOrder[0];if(!r)return{event:null,index:null};let i=0;for(let c=0;c<t.playableEventOrder.length;c++){let p=t.playableEventOrder[c];if(!p)continue;let f=e.entries[p];if(f.duration===0)continue;f.timeStart>f.timeEnd&&i++;let v=Or*i,y=f.timeStart+v,b=f.timeEnd+v,E=MG(y,b);if(E<=a)continue;return E>Or&&a<f.timeEnd||a>=f.timeStart?{event:f,index:Ek(t,c)}:{event:f,index:Ek(t,c),isPending:!0}}return{event:e.entries[r],index:0,isPending:!0}}function tv(e,t){return e<t?e+Or:e}var ee={clock:Ap(),groupNow:null,eventNow:null,eventNext:null,eventFlag:null,offset:{...el.offset},timer:{...el.timer},rundown:{...el.rundown},_timer:{forceFinish:null,pausedAt:null,secondaryTarget:null,hasFinished:!1},_rundown:{totalDelay:0},_group:null,_flag:null,_end:null,_startEpoch:null,_startDayOffset:null};function na(){return{...ee,eventNow:ee.eventNow?{...ee.eventNow}:null,eventNext:ee.eventNext?{...ee.eventNext}:null,eventFlag:ee.eventFlag?{...ee.eventFlag}:null,groupNow:ee.groupNow?{...ee.groupNow}:null,offset:{...ee.offset},rundown:{...ee.rundown},timer:{...ee.timer},_timer:{...ee._timer},_rundown:{...ee._rundown}}}function zG(){ee.eventNow=null,ee.eventNext=null,ee.offset.absolute=0,ee.offset.relative=0,ee.offset.expectedFlagStart=null,ee.offset.expectedGroupEnd=null,ee.offset.expectedRundownEnd=null,ee.rundown.selectedEventIndex=null,ee.timer.playback="stop",ee.clock=Ap(),ee.timer={...el.timer},ee._timer.forceFinish=null,ee._timer.pausedAt=null,ee._timer.secondaryTarget=null,ee._timer.hasFinished=!1}function v8e(){ee.eventNow=null,ee.eventNext=null,ee.eventFlag=null,ee._flag=null,ee.groupNow=null,ee._group=null,ee.rundown.actualStart=null,ee.rundown.selectedEventIndex=null,ee.offset.absolute=0,ee.offset.relative=0,ee.offset.expectedRundownEnd=null,ee.offset.expectedGroupEnd=null,ee.offset.expectedFlagStart=null,ee._end=null,ee.timer.playback="stop",ee.clock=Ap(),ee.timer={...el.timer},ee._timer.forceFinish=null,ee._timer.pausedAt=null,ee._timer.secondaryTarget=null,ee._timer.hasFinished=!1,ee._startEpoch=null,ee._startDayOffset=null,ee.rundown.currentDay=null}function g8e(e){for(let t in e)t in ee.timer?ee.timer[t]=e[t]:t in ee._timer&&(ee._timer[t]=e[t])}function KG(e){ee._rundown.totalDelay=e.totalDelay,ee.rundown.numEvents=e.numEvents,ee.rundown.plannedStart=e.firstStart,ee.rundown.plannedEnd=e.firstStart===null?null:e.firstStart+e.totalDuration,d0(ee.timer.playback)&&$1()}function Sk(e,t,a,r){zG();let{timedEventOrder:i}=a;if(i.length===0)return!1;let c=i.findIndex(p=>p===e.id);if(c===-1)return!1;if(Ak(t,a,c),Tk(t,a,c),Ck(t,a,c),ee.timer.playback="armed",ee.timer.duration=cc(e.timeStart,e.timeEnd),ee.timer.current=Q4(ee),ee.rundown.numEvents=a.timedEventOrder.length,r){g8e(r);let p=r?.startEpoch,f=r?.firstStart,v=r?.currentDay;if((f===null||typeof f=="number")&&(p===null||typeof p=="number")){ee.rundown.actualStart=f,ee._startEpoch=p,f!==null&&ee.rundown.plannedStart!==null&&(ee._startDayOffset=xk(ee.rundown.plannedStart,f)),v!==void 0&&(ee.rundown.currentDay=v);let{absolute:y,relative:b}=ev(ee);ee.offset.absolute=y,ee.offset.relative=b,$1()}}return e.id===ee.eventNow?.id}function Ak(e,t,a=ee.rundown.selectedEventIndex){if(a===null){ee.rundown.selectedEventIndex=null,ee.eventNow=null;return}let r=t.timedEventOrder[a];if(!r){ee.eventNow=null;return}let i=e.entries[r];ee.rundown.selectedEventIndex=a,ee.eventNow=i}function Tk(e,t,a=ee.rundown.selectedEventIndex){if(a===null){ee.eventNext=null;return}let r=HG(t,a);if(r===null||r>t.playableEventOrder.length-2){ee.eventNext=null;return}let i=t.playableEventOrder[r+1];if(!i){ee.eventNext=null;return}ee.eventNext=e.entries[i]}function ZG(e,t,a,r){Sk(t,a,r,e)}function x8e(e){if(ee.eventNow!==null){if(e){if(ee.eventNow=e,ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=Q4(ee),ee.timer.expectedFinish=S0(ee),ee.timer.playback==="roll"){let t=ee.clock-ee.offset.absolute;ee._timer.secondaryTarget!==null&&(ee.eventNow.timeStart<t&&t<ee.eventNow.timeEnd?(ee._timer.secondaryTarget=ee.eventNow.timeStart,ee.timer.secondaryTimer=ee._timer.secondaryTarget-t):ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,t))}return ee.eventNow.id}return ee.timer.playback="armed",ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=ee.timer.duration,ee.timer.startedAt=null,ee._timer.hasFinished=!1,ee.timer.addedTime=0,ee._timer.pausedAt=null,ee.timer.elapsed=null,ee.timer.expectedFinish=S0(ee),ee.eventNow.id}}function YG(e,t){let a=t.timedEventOrder.findIndex(r=>r===ee.eventNow?.id);Ak(e,t,a>=0?a:void 0),Tk(e,t,a>=0?a:void 0),x8e(ee.eventNow??void 0),Ck(e,t,a)}function XG(e=ee){if(e.eventNow===null||e.timer.playback==="play")return!1;let[t,a]=N5();if(e.clock=a,e.timer.secondaryTimer=null,e._timer.pausedAt){let c=e.clock-e._timer.pausedAt;e.timer.addedTime+=c,e._timer.pausedAt=null}e.timer.startedAt===null&&(e.timer.startedAt=e.clock),e.timer.playback="play",e.timer.expectedFinish=S0(e),e.timer.elapsed=0,e.rundown.actualStart===null&&(e._startDayOffset=xk(e.eventNow.timeStart,e.clock)+e.eventNow.dayOffset,e.rundown.currentDay=e._startDayOffset,e._startEpoch=t,e.rundown.actualStart=e.clock),e.groupNow!==null&&e.rundown.actualGroupStart===null&&(e.rundown.actualGroupStart=e.clock),ee.timer.phase=gk(ee);let{absolute:r,relative:i}=ev(ee);return ee.offset.absolute=r,ee.offset.relative=i,$1(),!0}function JG(e=ee){return e.timer.playback!=="play"?!1:(e.timer.playback="pause",e.clock=Ap(),e._timer.pausedAt=e.clock,!0)}function B5(e=ee){return e.timer.playback==="stop"?!1:(v8e(),!0)}function QG(e){if(ee.timer.current===null)return!1;e<0&&Math.abs(e)>ee.timer.current&&!ee._timer.hasFinished?ee._timer.forceFinish=Ap():ee.timer.current<0&&ee.timer.current+e>0&&(ee._timer.hasFinished=!1),ee.timer.addedTime+=e,ee.timer.current+=e;let{absolute:a,relative:r}=ev(ee);return ee.offset.absolute=a,ee.offset.relative=r,ee.timer.expectedFinish=S0(ee),$1(),!0}function ez(){let e=ee.clock,[t,a]=N5();if(ee.clock=a,!d0(ee.timer.playback))return p();if(ee._startDayOffset!==null&&ee._startEpoch&&(ee.rundown.currentDay=ee._startDayOffset+Math.floor((t-ee._startEpoch)/Or)),ee.timer.playback==="roll"&&ee.timer.secondaryTimer!==null){let v=e>ee.clock;return f(v)}ee.timer.secondaryTimer=null,ee.timer.current=Q4(ee),ee.timer.expectedFinish=S0(ee),ee.timer.phase=gk(ee),ee.timer.elapsed=ee.timer.duration-ee.timer.current;let{absolute:r,relative:i}=ev(ee);ee.offset.absolute=r,ee.offset.relative=i;let c=!!ee._timer.forceFinish||ee.timer.current<=Fn.triggerAhead&&!ee._timer.hasFinished;return c?ee._timer.hasFinished=!0:ee.timer.expectedFinish=S0(ee),$1(),{hasTimerFinished:c,hasSecondaryTimerFinished:!1};function p(){return{hasTimerFinished:!1,hasSecondaryTimerFinished:!1}}function f(v){let y=ee.clock+ee.offset.absolute;return ee.timer.phase="pending",v&&(ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,y)),ee.timer.secondaryTimer=ee._timer.secondaryTarget-y,{hasTimerFinished:!1,hasSecondaryTimerFinished:ee.timer.secondaryTimer<=0}}}function Fk(e,t,a){if(ee.timer.playback==="play"&&ee.rundown.selectedEventIndex!==null)return ee.timer.playback="roll",{eventId:ee.eventNow?.id??null,didStart:!1};let[r,i]=N5();if(ee.clock=i,ee.timer.playback==="armed"||ee.timer.phase==="pending"){a&&(ee.offset={...a}),ee.timer.playback="roll";let b=ee.eventNow.timeEnd<ee.eventNow.timeStart?ee.eventNow.timeEnd+Or:ee.eventNow.timeEnd;ee.timer.expectedFinish=b;let E=ee.clock-ee.offset.absolute;ee.timer.duration=cc(ee.eventNow.timeStart,b),ee.timer.current=ee.timer.duration,ee.timer.elapsed=0;let T=TC(ee.eventNow.timeStart,ee.eventNow.timeEnd,E);if(T){let C=ee.eventNow.timeStart;ee.timer.startedAt=C,ee.timer.secondaryTimer=null,ee.groupNow!==null&&ee.rundown.actualGroupStart===null&&(ee.rundown.actualGroupStart=C),ee.rundown.actualStart===null&&(ee.rundown.actualStart=C,ee._startDayOffset=0,ee._startEpoch=r)}else ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,E),ee.timer.secondaryTimer=ee._timer.secondaryTarget-E,ee.timer.phase="pending";return{eventId:ee.eventNow.id,didStart:T}}if(t.playableEventOrder.length===0)throw new Error("No playable events found");zG(),a&&(ee.offset={...a});let c=ee.clock-ee.offset.absolute,{index:p,isPending:f}=GG(e,t,c);if(Ak(e,t,p),Tk(e,t,p),Ck(e,t,p),ee.timer.playback="roll",ee.rundown.numEvents=t.timedEventOrder.length,f)return ee.timer.phase="pending",ee._timer.secondaryTarget=tv(ee.eventNow.timeStart,c),ee.timer.secondaryTimer=ee._timer.secondaryTarget-c,ee.timer.duration=cc(ee.eventNow.timeStart,ee.eventNow.timeEnd),ee.timer.current=ee.timer.duration,{eventId:ee.eventNow.id,didStart:!1};let v=ee.eventNow.timeStart,y=ee.eventNow.timeEnd<ee.eventNow.timeStart?ee.eventNow.timeEnd+Or:ee.eventNow.timeEnd;return ee.timer.startedAt=v,ee.timer.expectedFinish=y,ee.timer.duration=cc(ee.eventNow.timeStart,y),ee.timer.current=Q4(ee),ee.timer.elapsed=0,ee.rundown.actualStart=v,ee.groupNow!==null&&ee.rundown.actualGroupStart===null&&(ee.rundown.actualGroupStart=v),ee._startDayOffset=0,ee._startEpoch=r,{eventId:ee.eventNow.id,didStart:!0}}function $1(e=ee){e.offset.expectedRundownEnd=null,e.offset.expectedGroupEnd=null,e.offset.expectedFlagStart=null,e.offset.expectedRundownEnd=null;let{offset:t}=e,{plannedStart:a,actualStart:r}=e.rundown,{eventNow:i}=e;if(i){if(e.groupNow){let{_group:c}=e;if(c!==null){let{event:p,accumulatedGap:f,isLinkedToLoaded:v}=c,y=B4(p,{currentDay:e.rundown.currentDay,totalGap:f,isLinkedToLoaded:v,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedGroupEnd=y+p.duration}}if(e.eventFlag){let{_flag:c}=e;if(c){let{event:p,accumulatedGap:f,isLinkedToLoaded:v}=c,y=B4(p,{currentDay:e.rundown.currentDay,totalGap:f,isLinkedToLoaded:v,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedFlagStart=y}}if(e._end){let{event:c,accumulatedGap:p,isLinkedToLoaded:f}=e._end,v=B4(c,{currentDay:e.rundown.currentDay,totalGap:p,isLinkedToLoaded:f,mode:t.mode,offset:t.mode==="absolute"?t.absolute:t.relative,plannedStart:a,actualStart:r});e.offset.expectedRundownEnd=v+c.duration}}}function Ck(e,t,a,r=ee){let i=r.groupNow?.id;if(r.groupNow=null,r._group=null,r.eventFlag=null,r._flag=null,r._end=null,a===null||r.eventNow===null){r.rundown.actualGroupStart=null;return}let c=r.eventNow.parent,p=t.flags.length!==0,{playableEventOrder:f}=t,{entries:v}=e,y=c?v[c].entries:null;r.groupNow=c?v[c]:null;let b=y?dC(e.entries,y).lastEvent:null;i!==c&&(r.rundown.actualGroupStart=null);let E=!p,T=b===null,C=0,k=!0;for(let z=a;z<f.length;z++){let oe=v[f[z]];kr(oe)&&(z!==a&&(C+=oe.gap,k=k&&oe.linkStart,!E&&t.flags.includes(oe.id)&&(E=!0,r.eventFlag=oe,r._flag={event:oe,isLinkedToLoaded:k,accumulatedGap:C})),!T&&oe.id===b?.id&&(T=!0,r._group={event:b,isLinkedToLoaded:k,accumulatedGap:C}))}let D=f.at(-1),U=D?v[D]:null;U&&(r._end={event:U,isLinkedToLoaded:k,accumulatedGap:C})}function tz(e){ee.offset.mode=e,d0(ee.timer.playback)&&$1()}var V1=new Map,H1=null;function az(){return H1===null&&(H1=Object.fromEntries(V1)),H1}function kk(e){H1=null,e?V1.delete(e):V1.clear()}function W1(e,t){if(!t.eventNow?.id)return;let a=t.eventNow.id;if(e==="onStart"){V1.set(a,{startedAt:t.timer.startedAt,endedAt:null}),H1=null;return}if(e==="onStop"){let r=V1.get(a)?.startedAt??null;V1.set(a,{startedAt:r,endedAt:t.clock}),H1=null,dn("report")}}var fi=e=>e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),rv=e=>{if(typeof e!="string")throw new On("can't pack a non-string into an osc-string");if(e.indexOf("\0")!==-1)throw new On("Can't pack an osc-string that contains NULL characters");let t=new TextEncoder().encode(e),a=4-t.length%4,r=new ArrayBuffer(t.length+a);return new Uint8Array(r).set(t),r},G1=e=>{let t=fi(e),a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=a.indexOf(0);if(r===-1)throw new On("All osc-strings must contain a null character");let i=a.slice(0,r),c=4-i.length%4;if(a.length<r+c)throw new On("Not enough padding for osc-string");for(let p=0;p<c;p++)if(a[i.length+p]!==0)throw new On("Corrupt padding for osc-string");return{value:new TextDecoder().decode(i),rest:fc(t,r+c)}},fc=(e,t)=>new DataView(e.buffer,e.byteOffset+t,e.byteLength-t),Ok=e=>{let t=fi(e),a=4;if(t.byteLength<a)throw new On("buffer is not big enough for integer type");return{value:t.getInt32(0,!1),rest:fc(t,a)}},nz=e=>{let t=fi(e),a=4;if(t.byteLength<a*2)throw new On("buffer is not big enough to contain a timetag");let r=t.getUint32(0,!1),i=t.getUint32(a,!1);return{value:[r,i],rest:fc(t,a*2)}};var iz=e=>{let t=e.getTime()/1e3,a=Math.floor(t);return w8e(a,t-a)},w8e=(e,t)=>{let a=e+2208988800,r=Math.round(4294967296*t);return[a,r]};var sz=e=>{let t,a;typeof e=="object"&&"getTime"in e?[t,a]=iz(e):[t,a]=e;let r=new DataView(new ArrayBuffer(8));return r.setUint32(0,t,!1),r.setUint32(4,a,!1),r.buffer},oz=e=>{let t=new DataView(new ArrayBuffer(4));return t.setInt32(0,e,!1),t.buffer},b8e=(e,t)=>{switch(e){case"s":{let{value:a,rest:r}=G1(t);return{value:{type:"string",value:a},rest:r}}case"S":{let{value:a,rest:r}=G1(t);return{value:{type:"symbol",value:a},rest:r}}case"i":{let{value:a,rest:r}=Ok(t);return{value:{type:"integer",value:a},rest:r}}case"t":{let{value:a,rest:r}=nz(t);return{value:{type:"timetag",value:a},rest:r}}case"f":{let a=fi(t);return{value:{type:"float",value:a.getFloat32(0,!1)},rest:fc(a,4)}}case"d":{let a=fi(t);return{value:{type:"double",value:a.getFloat64(0,!1)},rest:fc(a,8)}}case"b":{let a=fi(t),{value:r,rest:i}=Ok(a),c=(4-r%4)%4;return{value:{type:"blob",value:new DataView(i.buffer,i.byteOffset,r)},rest:fc(i,r+c)}}case"r":{let a=fi(t);return{value:{type:"color",value:{red:a.getUint8(0),green:a.getUint8(1),blue:a.getUint8(2),alpha:a.getUint8(3)}},rest:fc(a,4)}}case"T":return{value:{type:"true",value:!0},rest:fi(t)};case"F":return{value:{type:"false",value:!1},rest:fi(t)};case"N":return{value:{type:"null",value:null},rest:fi(t)};case"I":return{value:{type:"bang",value:"bang"},rest:fi(t)};case"c":{let a=fi(t),r=a.getUint32(0,!1);return{value:{type:"character",value:String.fromCodePoint(r)},rest:fc(a,4)}}case"h":{let a=fi(t);return{value:{type:"bigint",value:a.getBigInt64(0,!1)},rest:fc(a,8)}}case"m":{let a=fi(t);if(a.byteLength<4)throw new On("buffer is not big enough to contain a midi packet");return{value:{type:"midi",value:[...new Uint8Array(a.buffer,a.byteOffset,4)]},rest:fc(a,4)}}}},_8e=e=>{switch(e.type){case"string":return rv(e.value);case"symbol":return rv(e.value);case"integer":return oz(e.value);case"timetag":return sz(e.value);case"character":{let t=[...e.value];if(t.length!==1)throw new On("Can only send a single character");let a=new DataView(new ArrayBuffer(4));return a.setUint32(0,t[0].codePointAt(0)??0,!1),a.buffer}case"float":{let t=new DataView(new ArrayBuffer(4));return t.setFloat32(0,e.value,!1),t.buffer}case"bigint":{let t=new DataView(new ArrayBuffer(8));return t.setBigInt64(0,e.value,!1),t.buffer}case"double":{let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e.value,!1),t.buffer}case"blob":{let t=fi(e.value),a=(4-e.value.byteLength%4)%4,r=new DataView(new ArrayBuffer(4+e.value.byteLength+a));return r.setUint32(0,e.value.byteLength,!1),new Uint8Array(r.buffer,r.byteOffset+4).set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),r.buffer}case"color":{let t=new DataView(new ArrayBuffer(16));return t.setUint8(0,e.value.red),t.setUint8(1,e.value.green),t.setUint8(2,e.value.blue),t.setUint8(3,e.value.alpha),t.buffer}case"midi":return new Uint8Array(e.value).buffer;case"true":return new ArrayBuffer(0);case"false":return new ArrayBuffer(0);case"null":return new ArrayBuffer(0);case"bang":return new ArrayBuffer(0)}},E8e={string:"s",integer:"i",timetag:"t",float:"f",double:"d",blob:"b",true:"T",false:"F",null:"N",bang:"I",symbol:"S",character:"c",color:"r",midi:"m",bigint:"h"},S8e=e=>{if(e===null)return{type:"null"};if(typeof e=="object"&&"type"in e)return e;if(e==="bang")return{type:"bang"};if(typeof e=="string")return{type:"string",value:e};if(typeof e=="number")return{type:"float",value:e};if(e instanceof Date)return{type:"timetag",value:e};if(e instanceof ArrayBuffer)return{type:"blob",value:e};if(typeof e=="object"&&"buffer"in e)return{type:"blob",value:e};if(typeof e=="object"&&"red"in e)return{type:"color",value:e};if(typeof e=="bigint")return{type:"bigint",value:e};if(e===!0)return{type:"true"};if(e===!1)return{type:"false"};throw new On("Invalid argument: "+e)},A8e=e=>{let{value:t,rest:a}=G1(e);if(e=a,t[0]!=="/")throw new On("addresses must start with /");if(!e.byteLength)return{address:t,args:[],oscType:"message"};let r=G1(e),i=r.value;if(e=r.rest,i[0]!==",")throw new On("Argument lists must begin with ,");let c=[],p=[c];for(let f of i.slice(1)){if(f==="["){p.push([]);continue}if(f==="]"){if(p.length<=1)throw new On("Mismatched ']' character.");{let y=p.pop();p[p.length-1].push({type:"array",value:y})}continue}let v=b8e(f,e);if(v===void 0)throw new On("I don't understand the argument code "+f);e=v.rest,p[p.length-1].push(v.value)}if(p.length!==1)throw new On("Mismatched '[' character");return{address:t,args:c,oscType:"message"}},T8e=e=>{let t=G1(e),a=t.value;if(e=t.rest,a!=="#bundle")throw new On("osc-bundles must begin with #bundle");let r=nz(e),i=r.value;e=r.rest;let c=O8e(e,p=>Rk(p));return{timetag:i,elements:c,oscType:"bundle"}},Rk=e=>k8e(e)?T8e(e):A8e(e),cz=e=>{let t="",a=[];for(let r of e)if(r!==null&&(Array.isArray(r)||typeof r=="object"&&"type"in r&&r.type==="array")){let{type:i,args:c}=cz(Array.isArray(r)?r:r.value);t+="["+i+"]",a=a.concat(c)}else{let i=S8e(r),c=E8e[i.type],p=_8e(i);t+=c,a.push(p)}return{type:t,args:a}},lz=e=>{let t=e.reduce((i,c)=>i+c.byteLength,0),a=new Uint8Array(t),r=0;for(let i of e){let c=fi(i);a.set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength),r),r+=c.byteLength}return a.buffer},F8e=e=>{let t=typeof e=="string"?e:e.address,a=typeof e=="string"?[]:e.args===void 0?[]:Array.isArray(e.args)?e.args:[e.args],r=rv(t),{type:i,args:c}=cz(a);return new DataView(lz([r,rv(","+i)].concat(c)))},C8e=e=>{let t=e.elements===void 0?[]:Array.isArray(e.elements)?e.elements:[e.elements],a=rv("#bundle"),r=sz(e.timetag),i=t.reduce((c,p)=>{let f=Dk(p),v=oz(f.byteLength);return c.concat([new DataView(v),f])},new Array);return new DataView(lz([a,r,...i]))},Dk=e=>typeof e=="object"&&"timetag"in e?C8e(e):F8e(e);var On=class extends Error{constructor(t){super(t),this.name="OSCError"}},k8e=e=>G1(e).value==="#bundle",O8e=(e,t)=>{let a=fi(e),r=new Array;for(;a.byteLength;){let{value:i,rest:c}=Ok(a);if(a=c,i>a.byteLength)throw new On("Invalid bundle list: size of element is bigger than buffer");let p=new DataView(a.buffer,a.byteOffset,i);try{r.push(t(p))}catch{}a=fc(a,i)}return r};var uz=e=>Rk(e),pz=e=>Dk(e);var wz=qt(require("node:dgram"),1);function fz(e){return["equals","not_equals","greater_than","less_than","contains"].includes(e)}function mz(e){return e==="all"||e==="any"}function hz(e){return NA.includes(e)}function dz(e){let t=Number(e);return Number.isNaN(t)?e.startsWith('"')&&e.endsWith('"')?{type:"string",value:e.substring(1,e.length-1)}:e==="TRUE"?{type:"true"}:e==="FALSE"?{type:"false"}:{type:"string",value:e}:{type:e.includes(".")?"float":"integer",value:t}}function vz(e){if(typeof e>"u"||e==="")return;let t=EC(e);return t?t.length===1?dz(t[0]):t.map(dz):void 0}var D8e=/{{(.*?)}}/g;function K1(e,t,a=P8e){let r=e,i=Array.from(r.matchAll(D8e));for(let c of i){let p=c[1],f=p.split("."),v;if(f[0]==="human"){let y=f[1];if(y in a){let b=`{{${a[y].key}}}`,E=K1(b,t,a);v=a[y].cb(E)}else v=void 0}else v=L4(p,t);v!==void 0&&(r=r.replace(c[0],v))}return r}function z1(e,t=!1){let a=null;if(e!=="null"){let i=Number(e);Number.isNaN(i)||(a=i)}let r=lc(a,{fallback:t?"00:00":"00:00:00"});return t&&(r=_C(r)),r}var P8e={clock:{key:"clock",cb:e=>z1(e)},duration:{key:"timer.duration",cb:e=>z1(e,!0)},expectedEnd:{key:"timer.expectedFinish",cb:e=>z1(e)},runningTimer:{key:"timer.current",cb:e=>z1(e,!0)},elapsedTime:{key:"timer.elapsed",cb:e=>z1(e,!0)},startedAt:{key:"timer.startedAt",cb:e=>z1(e)}};function Pk(e,t){return typeof e=="boolean"?I8e(e,t):typeof e=="string"?e.toLowerCase()===t:t===""?e==null:e==t}function Ik(e,t){return typeof e=="boolean"?!1:typeof e=="string"?e.toLowerCase().includes(t):typeof e=="number"?e.toString().toLowerCase().includes(t):!1}function gz(e,t){if(typeof e!="number")return!1;let a=Number(t);return isNaN(a)?!1:e>a}function xz(e,t){if(typeof e!="number")return!1;let a=Number(t);return isNaN(a)?!1:e<a}function I8e(e,t){return t==="true"?e===!0:t==="false"?e===!1:!1}function N8e(e,t,a){for(let r=0;r<t.length;r++){let i=t[r],c=e[i];if(kr(c)&&c.triggers){for(let p of c.triggers)if(p.automationId===a)return c.id}}}function yz(e,t){for(let a in e){let r=e[a],i=N8e(r.entries,r.flatOrder,t);if(i)return[r.title,i]}}var M8e=wz.createSocket("udp4");function bz(e,t){let a=L8e(e,t);B8e(e.targetIP,e.targetPort,a)}function L8e(e,t){let a=K1(e.address,t),r=e.args?K1(e.args,t):void 0,i=vz(r);return{address:a,args:i}}function B8e(e,t,a){let r=pz(a);M8e.send(r,0,r.byteLength,t,e,i=>{i&&At.warning("TX",`Failed sending OSC: ${i}`)})}function _z(e,t){let a=U8e(e,t);j8e(a)}function U8e(e,t){return K1(e.url,t)}async function j8e(e){try{let t=await fetch(e);t.ok||(t.status>=500&&t.status<600?At.warning("TX",`HTTP Integration: Server refused message ${t.status}`):t.status>=400?At.warning("TX",`HTTP Integration: Failed sending message ${t.status}`):At.warning("TX",`HTTP Integration: Failed sending message ${t.status}`))}catch(t){if(!(t instanceof Error)){At.warning("TX",`HTTP Integration: Failed sending message ${t}`);return}At.warning("TX",`HTTP Integration: ${t.name} ${t.message}`)}}function Z1(){return Ht().getAutomation()}function Ez(){return Z1().enabledAutomations}function Y1(){return Z1().triggers}function av(){return Z1().automations}async function Sz(e){return await T0(e),Z1()}async function Az(e){let t=Y1(),a=q8e(t),r={...e,id:a};return t.push(r),await T0({triggers:t}),r}async function Tz(e,t){let a=Y1(),r=a.findIndex(c=>c.id===e);if(r===-1)throw new Error(`Automation with id ${e} not found`);a[r]={...a[r],...t,id:e},await T0({triggers:a});let i=a[r];if(!i)throw new Error(`Failed to update trigger with id ${e}`);return i}async function Fz(e){let t=Y1(),a=t.findIndex(r=>r.id===e);if(a===-1)throw new Error(`Automation with id ${e} not found`);t=uC(a,t),await T0({triggers:t})}async function Cz(e){let t=av(),a=$8e(t);return t[a]={...e,id:a},await T0({automations:t}),t[a]}async function kz(e,t){let a=av();if(!Object.hasOwn(a,e))throw new Error(`Automation with id ${e} not found`);return a[e]={...t,id:e},await T0({automations:a}),a[e]}async function Oz(e,t){let a=av();if(!Object.hasOwn(a,t))return;let r=Y1().filter(c=>c.automationId===t);if(r.length){let p=r[0]?.title??"Unknown trigger";throw new Error(`Unable to delete automation used in trigger ${p}${r.length>1?` and ${r.length-1} more`:""}`)}let i=yz(e,t);if(i)throw new Error(`Unable to delete automation used in rundown: ${i[0]}, in event with ID: ${i[1]}`);delete a[t],await T0({automations:a})}async function T0(e){let t=Ht().getAutomation();Object.keys(e).forEach(a=>{let r=a;e[r]===void 0&&delete e[r]}),await Ht().setAutomation({...t,...e})}function q8e(e){let t="";do t=Ta();while(a(t));function a(r){return e.some(i=>i.id===r)}return t}function $8e(e){let t="";do t=Ta();while(Object.hasOwn(e,t));return t}function Rz(e){let t=e.action;switch(t){case"aux1-start":return pn.start(1);case"aux1-stop":return pn.stop(1);case"aux1-pause":return pn.pause(1);case"aux1-set":{let a=p0(e.time);return pn.setTime(a,1)}case"aux2-start":return pn.start(2);case"aux2-stop":return pn.stop(2);case"aux2-pause":return pn.pause(2);case"aux2-set":{let a=p0(e.time);return pn.setTime(a,2)}case"aux3-start":return pn.start(3);case"aux3-stop":return pn.stop(3);case"aux3-pause":return pn.pause(3);case"aux3-set":{let a=p0(e.time);return pn.setTime(a,3)}case"message-set":{X4({timer:{text:e.text,visible:e.visible}});break}case"message-secondary":{X4({timer:{secondarySource:e.secondarySource}});break}default:{At.warning("TX",`Unknown action type: ${t}`);break}}}function qs(e,t){if(!Ez())return;let a=Y1();t.eventNow?.triggers&&(a=a.concat(t.eventNow.triggers));let r=a.filter(c=>c.trigger===e);if(r.length===0)return;let i=av();Object.keys(i).length!==0&&r.forEach(c=>{let p=i[c.automationId];if(!p||p.outputs.length===0)return;H8e(p.filters,p.filterRule,t)&&Pz(p.outputs,t)})}function Dz(e){Pz([e])}function H8e(e,t,a){if(e.length===0)return!0;if(t==="all")return e.every(r);return e.some(r);function r(i){let{field:c,operator:p,value:f}=i,v=f.toLowerCase(),y=L4(c,a);switch(p){case"equals":return Pk(y,v);case"not_equals":return!Pk(y,v);case"greater_than":return gz(y,f);case"less_than":return xz(y,f);case"contains":return Ik(y,v);case"not_contains":return!Ik(y,v);default:return!1}}}function Pz(e,t){let a=t??na();e.forEach(r=>{LA(r)&&!bp?bz(r,a):BA(r)?_z(r,a):UA(r)?Rz(r):At.warning("TX",`Unknown output type: ${r}`)})}var Iz={id:"default",title:"Default",order:[],flatOrder:[],entries:{},revision:0},Nk={rundowns:{default:{...Iz}},project:{title:"",description:"",url:"",info:"",logo:null,custom:[]},settings:{version:Eo,serverPort:4001,editorKey:null,operatorKey:null,timeFormat:"24",language:"en"},viewSettings:{overrideStyles:!1,normalColor:"#ffffffcc",warningColor:"#ffa528",dangerColor:"#ff7300"},urlPresets:[],customFields:{},automation:{enabledAutomations:!0,enabledOscIn:!0,oscPortIn:8888,triggers:[],automations:{}}};function Mk(e){let t=nv(e),a=structuredClone(Nk);return a.rundowns={[t.id]:t},a}function nv(e){let t=e||Ta(),a=structuredClone(Iz);return a.id=t,a}function $s(e){if(Object.hasOwn(Nk,e))return structuredClone(Nk[e]);throw new Error(`Key ${e} does not exist on DatabaseModel`)}function X1(e,t,a){if(!e.rundowns||SC(e.rundowns)){a?.("No data found to import");let c=nv();return{[c.id]:c}}let r={},i=Object.keys(e.rundowns);for(let c of i){console.log("Found rundown, importing...");let p=e.rundowns[c],f=Lk(p,t,a);r[f.id]=f}return r}function Lk(e,t,a){let r={id:e.id||Ta(),title:e.title??"",entries:{},order:[],flatOrder:[],revision:e.revision??1},i=0;for(let c=0;c<e.order.length;c++){let p=e.order[c],f=e.entries[p];if(!f){a?.("Could not find referenced event, skipping");continue}if(r.order.includes(f.id)){a?.("ID collision on event import, skipping");continue}let v=p,y,b=[];if(kr(f)){if(y=S1(f,i),y==null){a?.("Skipping event without payload");continue}q1(y.custom,t),i+=1}else if(fs(f))y=E1({duration:f.duration,id:v});else if(ms(f))y=A1({...f,id:v}),q1(y.custom,t);else if(f.type==="block"||ya(f)){for(let E=0;E<f.entries.length;E++){let T=f.entries[E],C=e.entries[T],k=null;if(kr(C)){if(k=S1(C,i),k==null){a?.("Skipping event without payload");continue}k.parent=f.id,q1(k.custom,t),i+=1}else fs(C)?(k=E1({duration:C.duration,id:T}),k.parent=f.id):ms(C)&&(k=A1({...C,id:T}),k.parent=f.id,q1(k.custom,t));k&&(b.push(T),r.entries[T]=k)}y=u0({...structuredClone(f),id:v}),f.entries?.length>0&&(y.entries=f.entries.filter(E=>Object.hasOwn(e.entries,E))),q1(y.custom,t)}else{a?.("Unknown event type, skipping");continue}y&&(r.entries[v]=y,r.order.push(v),r.flatOrder.push(v),r.flatOrder.push(...b))}return console.log(`Imported rundown ${r.title} with ${r.flatOrder.length} entries`),r}function G8e(e,t){for(let a in t.custom)a in e||delete t.custom[a];return t}function Nz(e){let t={totalDelay:0,totalDuration:0,totalDays:0,firstStart:null,lastEnd:null,assignedCustomFields:{},playableEventOrder:[],timedEventOrder:[],flatEntryOrder:[],flags:[],entries:{},order:[],previousEvent:null,latestEvent:null,previousEntry:null};function a(i,c){let p=z8e(t,e,i,c);return t=p.processedData,p}function r(){return t}return{process:a,getMetadata:r}}function z8e(e,t,a,r){let i={...e},c=structuredClone(a);if(i.flatEntryOrder.push(c.id),kr(c)){if(i.timedEventOrder.push(c.id),c.linkStart)if(i.previousEvent){let p=lC(c,i.previousEvent);c.timeStart=p.timeStart,c.timeEnd=p.timeEnd,c.duration=p.duration}else c.linkStart=!1;if(G8e(t,c),i.totalDays+=VG(c,i.previousEvent),c.dayOffset=i.totalDays,c.delay=0,c.gap=0,c.parent=r,Ns(c)){if(i.playableEventOrder.push(c.id),i.firstStart===null&&(i.firstStart=c.timeStart),c.flag&&i.flags.push(c.id),c.gap=FC(c,i.latestEvent),c.gap===0?i.totalDuration+=c.duration:c.gap>0?i.totalDuration+=c.gap+c.duration:c.gap<0&&(i.totalDuration+=Math.max(c.duration+c.gap,0)),i.totalDelay>0&&c.gap>0){let p=0;fs(i.previousEntry)&&(p=i.previousEntry.duration,i.totalDelay-=p),i.totalDelay=Math.max(i.totalDelay-c.gap,0),i.totalDelay+=p}c.delay=i.totalDelay,i.previousEvent=c,CC(c,i.latestEvent)&&(i.latestEvent=c,i.lastEnd=c.timeEnd)}}else fs(c)&&(i.totalDelay+=c.duration,c.parent=r);return r||i.order.push(c.id),i.entries[c.id]=c,i.previousEntry=c,{processedData:i,processedEntry:c}}var wa={id:"",title:"",order:[],flatOrder:[],entries:{},revision:0},mc={totalDelay:0,totalDuration:0,totalDays:0,firstStart:null,lastEnd:null,playableEventOrder:[],timedEventOrder:[],flatEntryOrder:[],flags:[]},mu={},Xr=()=>wa,Fo=()=>mc,hc=()=>mu,J1=e=>wa.entries[e];function Ji(e){let t=e.mutableRundown?structuredClone(wa):wa,a=e.mutableCustomFields?structuredClone(mu):mu;function r(i=!0){if(e.mutableRundown){if(wa.revision=wa.revision+1,wa.title=t.title,!i)wa.entries=t.entries,wa.order=t.order,wa.flatOrder=t.flatOrder;else{let c=Q1(t,mu),{previousEvent:p,latestEvent:f,previousEntry:v,entries:y,order:b,...E}=c;wa.entries=y,wa.order=b,wa.flatOrder=E.flatEntryOrder,mc=E}Ht().setRundown(wa.id,wa)}return e.mutableCustomFields&&(mu=a,Ht().setCustomFields(mu)),{rundown:wa,rundownMetadata:mc,customFields:mu,revision:wa.revision}}return{customFields:a,rundown:t,rundownMetadata:mc,commit:r}}function Mz(e,t){let a=e.entries[t.id];if(!a)throw new Error(`Entry with id ${t.id} not found`);let r=UG(a,t);e.entries[a.id]=r;let i=qG(t);return{entry:r,didInvalidate:i}}function K8e(e,t){if(ya(t))for(let r=0;r<t.entries.length;r++){let i=t.entries[r];a(i)}else if(t.parent){let r=e.entries[t.parent];if(r&&ya(r)){let i=bk(r.entries,t.id);Mz(e,{id:r.id,entries:i})}}a(t.id);function a(r){e.order=bk(e.order,r),delete e.entries[r]}}function Z8e(e){return e.order=[],e.flatOrder=[],e.entries={},e}function Y8e(e,t,a,r){let i=t?.parent??null,c=(()=>{if(ya(a)){if("parent"in t&&t.parent===a.id)return null;if(r==="insert"){if(ya(t))throw new Error("Cannot insert a group into another group");return a.id}return null}return a.parent??null})();"parent"in t&&(t.parent=c);let p=i===null?e.order:e.entries[i].entries,f=c===null?e.order:e.entries[c].entries,v=p.indexOf(t.id),y=(()=>{let b=f.indexOf(a.id);return r==="before"?b:r==="after"?p===f&&v<=b?b:b+1:f.length})();p.splice(v,1),f.splice(y,0,t.id)}function X8e(e,t){let a=mc.flatEntryOrder.indexOf(t.id);if(t.duration===0||a===mc.flatEntryOrder.length-1)return;let r=t.duration,i=null,c=!0;for(let p=a+1;p<mc.flatEntryOrder.length;p++){let f=mc.flatEntryOrder[p],v=e.entries[f];if(!kr(v))continue;let y=c;if(c=!1,i!==null&&(v.linkStart&&r<0&&i.timeStart+r<0&&(y=!0),v.gap>0&&(r=Math.max(r-v.gap,0)),r===0))break;i={...v},y&&(v.linkStart=!1,y=!1),v.timeStart=Math.max(0,v.timeStart+r),v.timeEnd=Math.max(v.duration,v.timeEnd+r),v.revision+=1}}function J8e(e,t,a){e.entries[t.id]={...a,id:t.id,timeStart:t.timeStart,timeEnd:t.timeEnd,duration:t.duration,linkStart:t.linkStart,parent:t.parent,delay:t.delay,gap:t.gap,dayOffset:t.dayOffset,revision:t.revision++},e.entries[a.id]={...t,id:a.id,timeStart:a.timeStart,timeEnd:a.timeEnd,duration:a.duration,linkStart:a.linkStart,parent:a.parent,delay:a.delay,gap:a.gap,dayOffset:a.dayOffset,revision:a.revision++}}function Q8e(e,t,a){if(ya(t)){let{newGroup:r,nestedEntries:i}=$G(t,e);e.entries[r.id]=r;for(let f=0;f<i.length;f++){let v=i[f];e.entries[v.id]=v}let c=e.order.indexOf(t.id)+1,p=a?.after??a?.before;return p&&e.entries[p]&&(a?.after?c=e.order.indexOf(p)+1:a?.before&&(c=e.order.indexOf(p))),e.order=Bs(c,r.id,e.order),r}else{let r=_k(t,j1(e)),i=null,c=a?.after??a?.before;if(c){let f=e.entries[c];if(f&&!ya(f)&&f.parent){let v=e.entries[f.parent];v&&ya(v)&&(i=v)}}else if(t.parent){let f=e.entries[t.parent];f&&ya(f)&&(i=f)}let p=P4(e,i,a?.after,a?.before);return p||(p=t.id),i5(e,r,p,i)}}function e9e(e,t){let a=u0({id:j1(e)}),r=[],i=-1;for(let p=0;p<t.length;p++){let f=t[p],v=e.entries[f];!v||ya(v)||(i===-1&&(i=e.order.indexOf(f)),r.push(f),v.parent=a.id,e.flatOrder=e.flatOrder.filter(y=>y!==f),e.order=e.order.filter(y=>y!==f))}a.entries=r;let c=Math.max(0,i);return e.order=Bs(c,a.id,e.order),e.entries[a.id]=a,a}function t9e(e,t){let a=t.entries,r=e.order.indexOf(t.id);e.order.splice(r,1,...a),delete e.entries[t.id];for(let i=0;i<a.length;i++){let c=a[i],p=e.entries[c];if(!p)throw new Error("Entry not found");p.parent=null}}var Vs={add:i5,edit:Mz,remove:K8e,removeAll:Z8e,reorder:Y8e,applyDelay:X8e,swap:J8e,clone:Q8e,group:e9e,ungroup:t9e};async function Bk(e,t){await Ht().setRundown(e,t)}function r9e(e,t,a){return e[t]={label:a.label,type:a.type,colour:a.colour},{[t]:a}}function a9e(e,t,a,r){let i=r?.label?uc(r.label??t):t;return e[i]={...a,...r},{oldKey:t,newKey:i}}function n9e(e,t){delete e[t]}function i9e(e,t,a){Object.keys(e.entries).forEach(r=>{let i=e.entries[r];"custom"in i&&i.custom[t]&&(i.custom[a]=i.custom[t],delete i.custom[t])})}function s9e(e,t){Object.keys(e.entries).forEach(a=>{let r=e.entries[a];"custom"in r&&r.custom[t]&&delete r.custom[t]})}var hu={add:r9e,edit:a9e,remove:n9e,renameUsages:i9e,removeUsages:s9e};function o9e(e,t){let a=structuredClone(e),r=structuredClone(t),i=Q1(a,r);wa.id=a.id,wa.title=a.title,mu=r;let{previousEvent:c,latestEvent:p,previousEntry:f,entries:v,order:y,...b}=i;return wa.entries=v,wa.order=y,wa.flatOrder=b.flatEntryOrder,wa.revision=a.revision,mc=b,Ht().setRundown(wa.id,wa),{rundown:a,rundownMetadata:mc,customFields:r,revision:a.revision}}var Lz={init:o9e,get:()=>({rundown:wa,metadata:mc,customFields:mu})};function Q1(e,t){let{process:a,getMetadata:r}=Nz(t);for(let i=0;i<e.order.length;i++){let c=e.order[i],p=e.entries[c];if(!p)continue;let{processedEntry:f}=a(p,null);if(ya(f)){let v=null,y=null,b=!1,E=[];f.duration=0;for(let T=0;T<f.entries.length;T++){let C=f.entries[T],k=e.entries[C];if(!k)continue;E.push(k.id);let{processedEntry:D}=a(k,f.id);!kr(D)||!Ns(D)||(v===null&&(v=D.timeStart,b=!!D.linkStart),y=D.timeEnd,T>0&&(f.duration+=D.gap),f.duration=f.duration+D.duration)}f.timeStart=v,f.timeEnd=y,f.isFirstLinked=b,f.entries=E}}return r()}var U5=class e{_interval;static _refreshInterval;endCallback=void 0;onUpdateCallback=void 0;constructor(t){e._refreshInterval=t.refresh,this._interval=setInterval(()=>{this.update()},e._refreshInterval)}setOnUpdateCallback(t){this.onUpdateCallback=t}start(){if(!XG())return!1;let a=na().timer.current-Fn.triggerAhead;return this.endCallback=setTimeout(()=>this.update(),a),!0}pause(){return JG()?(clearTimeout(this.endCallback),!0):!1}stop(){return B5()?(clearTimeout(this.endCallback),!0):!1}addTime(t){if(!QG(t))return!1;clearTimeout(this.endCallback);let a=na();return this.endCallback=setTimeout(()=>this.update(),a.timer.expectedFinish),!0}update(){let t=ez();this.onUpdateCallback?.(t)}shutdown(){clearInterval(this._interval),clearTimeout(this.endCallback)}};function Bz(e){return!(!cr.object(e)||!cr.objectWithKeys(e,["playback","selectedEventId","startedAt","addedTime","pausedAt","firstStart","startEpoch","currentDay"])||!cr.string(e.playback)&&!Object.values(Yl).includes(e.playback)||!cr.string(e.selectedEventId)&&e.selectedEventId!==null||!cr.number(e.startedAt)&&e.startedAt!==null||!cr.number(e.addedTime)||!cr.number(e.pausedAt)&&e.pausedAt!==null||!cr.number(e.firstStart)&&e.firstStart!==null||!cr.number(e.startEpoch)&&e.startEpoch!==null||!cr.number(e.currentDay)&&e.currentDay!==null)}var Uk=0,Uz=null,j5=null,iv={save:c9e,load:l9e,clear:u9e};async function c9e(e,t=qz){if(!(Uk>3)&&!fu(e,Uz))try{await t(e),Uz={...e},Uk=0}catch{Uk+=1}}async function l9e(e=p9e){try{let t=await e();if(Bz(t))return t}catch{}return null}async function u9e(e=qz){try{await e(null)}catch{}}async function jz(){return j5||(j5=new _p(kn.restoreFile),j5)}async function p9e(){return(await jz()).read()}async function qz(e){return(await jz()).write(e)}function q5(e,t,a="count-down"){return xp(t??null,a)!==xp(e??null,a)}function jk(e,t){return xp(t,"count-up")!==xp(e,"count-up")}function $z(e,t){return e===void 0?!0:q5(e.current,t.current)||q5(e.secondaryTimer,t.secondaryTimer)||e.addedTime!==t.addedTime||e.duration!==t.duration||e.phase!==t.phase||e.playback!==t.playback||e.startedAt!==t.startedAt}function Vz(e,t,a){return e===void 0||e.mode!==t.mode?!0:a&&!fu(e,t)}function Hz(e,t){if(!e.length)return;if(!t)return $5(e);let a=e.findIndex(r=>r===t);return a<1?$5(e):e.at(a-1)}function Wz(e,t){if(!e.length)return;if(!t)return $5(e);let a=e.findIndex(r=>r===t);return a===-1||a>=e.length-1?$5(e):e.at(a+1)}function qk(e,t,a,r=0,i=!1){let c=i?r:r+1;for(let p=c;p<t.length;p++){let f=t[p],v=e.entries[f];if(kr(v)&&Ns(v)&&v.cue===a)return v}for(let p=0;p<c;p++){let f=t[p],v=e.entries[f];if(kr(v)&&Ns(v)&&v.cue===a)return v}}function $5(e){return e.at(0)}function $k(e,t,a){let r=t[a];if(r)return e.entries[r]}var Fa=class Fa{eventTimer;lastIntegrationClockUpdate=-1;lastIntegrationTimerValue=-1;static previousState;constructor(t){this.eventTimer=t,Fa.previousState={}}setOffsetMode(t){tz(t)}checkTimerUpdate({hasTimerFinished:t,hasSecondaryTimerFinished:a}){let r=na();Fa.previousState.timer?.phase!==r.timer.phase&&(r.timer.phase==="warning"?process.nextTick(()=>{qs("onWarning",r)}):r.timer.phase==="danger"&&process.nextTick(()=>{qs("onDanger",r)})),r.timer.playback==="roll"&&(a?this.rollLoaded(r.offset):t?(process.nextTick(()=>{qs("onFinish",r)}),this.handleLoadNext(),this.rollLoaded(r.offset)):Fa.previousState?.clock&&LG(r,Fa.previousState.clock,Fn.skipLimit)&&(At.warning("PLAYBACK","Time skip detected, reloading roll"),this.roll(!0))),r.timer.playback==="play"&&t&&(process.nextTick(()=>{qs("onFinish",r)}),r.eventNow&&(r.eventNow.endAction==="load-next"?setTimeout(this.loadNext.bind(this),0):r.eventNow.endAction==="play-next"&&setTimeout(this.startNext.bind(this),0))),q5(this.lastIntegrationTimerValue,r.timer.current)&&(process.nextTick(()=>{qs("onUpdate",r)}),this.lastIntegrationTimerValue=r.timer.current??-1),jk(this.lastIntegrationClockUpdate,r.clock)&&(process.nextTick(()=>{qs("onClock",r)}),this.lastIntegrationClockUpdate=r.clock)}init(t){At.info("SERVER","Runtime service started"),this.eventTimer.setOnUpdateCallback(a=>this.checkTimerUpdate(a)),t&&this.resume(t)}shutdown(){this.eventTimer&&(At.info("SERVER","Runtime service shutting down"),this.eventTimer.shutdown())}notifyOfChangedEvents(t){let a=na();if(!(a.eventNow!==null||a.eventNext!==null))return;t.playableEventOrder.length===0&&B5();let i=Xr(),c=Fo();YG(i,c)}loadEvent(t,a){if(!Ns(t))return At.warning("PLAYBACK",`Refused skipped event with ID ${t.id}`),!1;let r=na(),i=Xr(),c=Fo(),p=Sk(t,i,c,a);if(p){At.info("PLAYBACK",`Loaded event with ID ${t.id}`);let f=na();process.nextTick(()=>{W1("onStop",r),qs("onLoad",f)})}return p}getRuntimeState(){return{playback:na().timer.playback}}startById(t){let a=J1(t);return!a||!kr(a)||!this.loadEvent(a)?!1:this.handleStart()}startByIndex(t){let a=Xr(),{timedEventOrder:r}=Fo(),i=$k(a,r,t);return!i||!this.loadEvent(i)?!1:this.handleStart()}startByCue(t){let a=na(),r=Xr(),{timedEventOrder:i}=Fo(),c=qk(r,i,t,a.rundown.selectedEventIndex??void 0,a.timer.playback==="armed");return!c||!this.loadEvent(c)?!1:this.handleStart()}loadById(t){let a=J1(t);return!a||!kr(a)?!1:this.loadEvent(a)}loadByIndex(t){let a=Xr(),{timedEventOrder:r}=Fo(),i=$k(a,r,t);return i?this.loadEvent(i):!1}loadByCue(t){let a=na(),r=Xr(),{playableEventOrder:i}=Fo(),c=qk(r,i,t,a.rundown.selectedEventIndex??void 0,!1);return c?this.loadEvent(c):!1}handleLoadPrevious(){let t=na(),{playableEventOrder:a}=Fo(),r=Hz(a,t.eventNow?.id);if(r){let i=J1(r);if(i&&kr(i))return this.loadEvent(i)}return!1}loadPrevious(){return this.handleLoadPrevious()}handleLoadNext(t){let a=na(),{playableEventOrder:r}=Fo(),i=Wz(r,t??a.eventNow?.id);if(i){let c=J1(i);return!c||!kr(c)?!1:a.timer.playback==="roll"?c.duration===0?this.handleLoadNext(i):this.loadEvent(c,{firstStart:a.rundown.actualStart}):this.loadEvent(c)}return At.info("PLAYBACK","No next event found! Continuing playback"),!1}loadNext(){return this.handleLoadNext()}handleStart(){let t=na();if(!w1(t.timer.playback,t.timer.phase).start)return!1;let r=this.eventTimer?.start()??!1,i=na();return At.info("PLAYBACK",`Play Mode ${i.timer.playback.toUpperCase()}`),r&&process.nextTick(()=>{W1("onStart",i),qs("onStart",i)}),r}start(){return this.handleStart()}startPrevious(){return this.handleLoadPrevious()?this.handleStart():!1}startNext(){return this.handleLoadNext()?this.handleStart():!1}pause(){let t=na();if(!w1(t.timer.playback,t.timer.phase).pause)return;this.eventTimer?.pause();let r=na();At.info("PLAYBACK",`Play Mode ${r.timer.playback.toUpperCase()}`),process.nextTick(()=>{qs("onPause",r)})}stop(){let t=na();if(!w1(t.timer.playback,t.timer.phase).stop)return!1;if(this.eventTimer?.stop()){let i=na();return At.info("PLAYBACK",`Play Mode ${i.timer.playback.toUpperCase()}`),process.nextTick(()=>{W1("onStop",t),qs("onStop",i)}),!0}return!1}reload(){let t=na();return t.eventNow?this.loadEvent(t.eventNow):!1}rollLoaded(t){let a=Xr(),r=Fo();try{Fk(a,r,t)}catch(i){At.error("SERVER",`Roll: ${i}`)}}roll(t=!1){let a=na();if(!t&&!w1(a.timer.playback,a.timer.phase).roll)return;try{let i=Xr(),c=Fo(),p=Fk(i,c),f=na();p.eventId!==a.eventNow?.id&&(At.info("PLAYBACK",`Loaded event with ID ${p.eventId}`),process.nextTick(()=>{W1("onStop",a),qs("onLoad",f)})),p.didStart&&process.nextTick(()=>{W1("onStart",f),qs("onStart",f)})}catch(i){At.error("SERVER",`Roll: ${i}`);return}let r=na();a.timer.playback!==r.timer.playback&&At.info("PLAYBACK",`Play Mode ${r.timer.playback.toUpperCase()}`)}resume(t){let{selectedEventId:a,playback:r}=t;if(r==="roll"){this.roll();return}if(!a)return;let i=J1(a);if(!kr(i)||!Ns(i))return;let c=Xr(),p=Fo();ZG(t,i,c,p),At.info("PLAYBACK","Resuming playback")}addTime(t){this.eventTimer.addTime(t)&&At.info("PLAYBACK",`${t>0?"Added":"Removed"} ${lc(t)}`)}};va([Rn],Fa.prototype,"setOffsetMode",1),va([Rn],Fa.prototype,"checkTimerUpdate",1),va([Rn],Fa.prototype,"startById",1),va([Rn],Fa.prototype,"startByIndex",1),va([Rn],Fa.prototype,"startByCue",1),va([Rn],Fa.prototype,"loadById",1),va([Rn],Fa.prototype,"loadByIndex",1),va([Rn],Fa.prototype,"loadByCue",1),va([Rn],Fa.prototype,"loadPrevious",1),va([Rn],Fa.prototype,"loadNext",1),va([Rn],Fa.prototype,"start",1),va([Rn],Fa.prototype,"startPrevious",1),va([Rn],Fa.prototype,"startNext",1),va([Rn],Fa.prototype,"pause",1),va([Rn],Fa.prototype,"stop",1),va([Rn],Fa.prototype,"reload",1),va([Rn],Fa.prototype,"roll",1),va([Rn],Fa.prototype,"resume",1),va([Rn],Fa.prototype,"addTime",1);var mi=Fa,d9e=new U5({refresh:Fn.updateRate,updateInterval:Fn.notificationRate}),ua=new mi(d9e);function Rn(e,t,a){let r=a.value;return a.value=function(...i){let c=r.apply(this,i),p=na(),f=To.createBatch(),v=!1;v||=oe("eventNow"),v||=oe("eventNext"),v||=oe("eventFlag"),v||=oe("groupNow");let y=!mi.previousState?.timer,b=mi.previousState?.offset?.mode!==p.offset.mode,E=mi.previousState.timer?.playback!==p.timer.playback,T=!y&&mi.previousState?.timer.addedTime!==p.timer.addedTime,C=v||y||E||b||T,k=$z(mi.previousState?.timer,p.timer);k&&(f.add("timer",p.timer),mi.previousState.timer={...p.timer});let D=k||jk(mi.previousState.clock,p.clock);D&&(f.add("clock",p.clock),mi.previousState.clock=p.clock),Vz(mi.previousState?.offset,p.offset,D||C)&&(f.add("offset",p.offset),mi.previousState.offset=structuredClone(p.offset)),!fu(mi.previousState.rundown,p.rundown)&&(f.add("rundown",p.rundown),mi.previousState.rundown=structuredClone(p.rundown));function oe(me){let Ae=mi.previousState[me],pe=p[me];return!Ae&&!pe||Ae?.id===pe?.id&&fu(Ae,pe)?!1:(f.add(me,pe),mi.previousState[me]=structuredClone(pe),!0)}return C&&iv.save({playback:p.timer.playback,selectedEventId:p.eventNow?.id??null,startedAt:p.timer.startedAt,addedTime:p.timer.addedTime,pausedAt:p._timer.pausedAt,firstStart:p.rundown.actualStart,startEpoch:p._startEpoch,currentDay:p.rundown.currentDay}).catch(me=>{}),f.send(),c},a}function em(e){if(e>cC||e<0)throw new Error("Times should be from 0 to 23:59:59");return e}var Vk={title:Tp,note:Tp,cue:Tp,skip:du,flag:du,countToEnd:du,colour:SG,custom:Tp,timeWarning:e=>em(_0(e)),timeDanger:e=>em(_0(e)),endAction:e=>U1(e,Qc),timerType:e=>U1(e,ho),linkStart:du,timeStrategy:e=>U1(e,sc),targetDuration:e=>em(_0(e)),duration:e=>em(_0(e)),timeStart:e=>em(_0(e)),timeEnd:e=>em(_0(e))};function Gz(e,t){if(e.startsWith("custom:")){let r=e.split(":")[1],i=Vk.custom;return{custom:{[r]:i(t)}}}if(!MA(e,Vk))throw new Error(`Property ${e} not permitted`);let a=Vk[e];return{[e]:a(t)}}function zz(e,t,a,r){if(typeof t!="string"||a===void 0)return!1;if(t.startsWith("custom:")&&Object.hasOwn(e,"custom")){let i=t.slice(7);return i?Object.hasOwn(r,i):!1}return Object.hasOwn(e,t)}var f9e=new _p(kn.appState),Co=new C1(f9e,{});async function Kz(e){return(await V5())?.projectName===e}async function V5(){if(!ul)return await Co.read(),{projectName:Co.data.projectName,rundownId:Co.data.rundownId}}async function Zz(e,t){ul||(Co.data.projectName=e,Co.data.rundownId=t,await Co.write())}async function Yz(e){ul||(Co.data.rundownId=e,await Co.write())}async function Xz(e){return ul||e?!1:(await Co.read(),Co.data.showWelcomeDialog??!0)}async function Jz(e){return Co.data.showWelcomeDialog=e,await Co.write(),e}async function Qz(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});if(e?.id&&Object.hasOwn(t.entries,e.id))throw new Error(`Event with ID ${e.id} already exists`);let r=hC(t,e),i=null;if(r){let y=t.entries[r];if(!y||!ya(y))throw new Error(`Invalid parent event with ID ${r}`);i=y}let c=P4(t,i,e?.after,e?.before),p=BG(t,e,c);Vs.add(t,p,c,i);let{rundownMetadata:f,revision:v}=a();return setImmediate(()=>{ko(f),Di(f,v,{timer:[p.id],external:!0})}),p}async function H5(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e.id];if(!r)throw new Error("Entry not found");if(e?.type&&r.type!==e.type)throw new Error("Invalid event type");if(!wk(r,e))return r;let{entry:i,didInvalidate:c}=Vs.edit(t,e),{rundownMetadata:p,revision:f}=a(c);return setImmediate(()=>{ko(p),Di(p,f,{timer:c?!0:[i.id],external:!0})}),i}async function eK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1});if("cue"in t&&t.cue==="")throw new Error("Cue value invalid");let i=!1,c=[],p=[];for(let b=0;b<e.length;b++){let E=e[b],T=a.entries[E];if(!T)continue;if(t?.type&&T.type!==t.type)throw new Error("Invalid event type");if(!wk(T,t))continue;let{entry:C,didInvalidate:k}=Vs.edit(a,{...t,id:E});c.push(E),p.push(C),k&&(i=!0)}let{rundown:f,rundownMetadata:v,revision:y}=r(i);return setImmediate(()=>{ko(v),Di(v,y,{timer:i?!0:c,external:!0})}),f}async function tK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});for(let p=0;p<e.length;p++){let f=t.entries[e[p]];f&&Vs.remove(t,f)}let{rundown:r,rundownMetadata:i,revision:c}=a();return setImmediate(()=>{ko(i),Di(i,c,{timer:e,external:!0})}),r}async function rK(){let{rundown:e,commit:t}=Ji({mutableRundown:!0,mutableCustomFields:!1});Vs.removeAll(e);let{rundown:a,rundownMetadata:r,revision:i}=t();return setImmediate(()=>{ko(r),Di(r,i,{timer:!0,external:!0})}),a}async function aK(e,t,a){let{rundown:r,commit:i}=Ji({mutableRundown:!0,mutableCustomFields:!1}),c=r.entries[e],p=r.entries[t];if(!c||!p)throw new Error("Event not found");Vs.reorder(r,c,p,a);let{rundown:f,rundownMetadata:v,revision:y}=i();return setImmediate(()=>{ko(v),Di(v,y,{timer:!0,external:!0})}),f}async function nK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e];if(!r||!fs(r))throw new Error("Given delay ID not found");Vs.applyDelay(t,r),Vs.remove(t,r);let{rundown:i,rundownMetadata:c,revision:p}=a();return setImmediate(()=>{ko(c),Di(c,p,{timer:!0,external:!0})}),i}async function iK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1}),i=a.entries[e],c=a.entries[t];if(!i||!c)throw new Error("Event not found");if(!kr(i)||!kr(c))throw new Error("Both entries must be events");Vs.swap(a,i,c);let{rundown:p,rundownMetadata:f,revision:v}=r();return setImmediate(()=>{ko(f),Di(f,v,{timer:!0,external:!0})}),p}async function sK(e,t){let{rundown:a,commit:r}=Ji({mutableRundown:!0,mutableCustomFields:!1}),i=a.entries[e];if(!i)throw new Error("Could not find entry to clone");let c=Vs.clone(a,i,t),{rundown:p,rundownMetadata:f,revision:v}=r();return setImmediate(()=>{ko(f),ya(c)?Di(f,v,{timer:c.entries,external:!0}):kr(c)?Di(f,v,{timer:[c.id],external:!0}):fs(c)&&Di(f,v,{external:!0})}),p}async function oK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1});Vs.group(t,e);let{rundown:r,rundownMetadata:i,revision:c}=a();return setImmediate(()=>{ko(i),Di(i,c,{external:!0,timer:!0})}),r}async function cK(e){let{rundown:t,commit:a}=Ji({mutableRundown:!0,mutableCustomFields:!1}),r=t.entries[e];if(!r||!ya(r))throw new Error(`Group with ID ${e} not found or is not a group`);Vs.ungroup(t,r);let{rundown:i,rundownMetadata:c,revision:p}=a();return setImmediate(()=>{ko(c),Di(c,p,{external:!0})}),i}async function lK(e){let t=uc(e.label);if(!t)throw new Error("Unable to convert label to a valid key");let{customFields:a,commit:r}=Ji({mutableRundown:!1,mutableCustomFields:!0});if(Object.hasOwn(a,t))throw new Error("Label already exists");hu.add(a,t,e);let{customFields:i}=r(!1);return setImmediate(()=>{dn("custom-fields")}),i}async function uK(e,t,a){let{customFields:r,rundown:i,commit:c}=Ji({mutableRundown:!0,mutableCustomFields:!0});if(!(e in r))throw new Error("Could not find label");let p=r[e];if(t.type&&p.type!==t.type)throw new Error("Change of field type is not allowed");let{oldKey:f,newKey:v}=hu.edit(r,e,p,t);if(f!==v){hu.renameUsages(i,f,v);for(let T of Object.keys(a))if(T!==i.id){let C=structuredClone(a[T]);hu.renameUsages(C,f,v),await Bk(T,C)}hu.remove(r,f)}let{rundownMetadata:y,revision:b,customFields:E}=c(!1);return setImmediate(()=>{dn("custom-fields"),Di(y,b,{timer:!0,external:!0})}),E}async function pK(e,t){let{customFields:a,rundown:r,commit:i}=Ji({mutableRundown:!0,mutableCustomFields:!0});if(!(e in a))return a;hu.removeUsages(r,e);for(let v of Object.keys(t))if(v!==r.id){let y=structuredClone(t[v]);hu.removeUsages(y,e),await Bk(v,y)}hu.remove(a,e);let{rundownMetadata:c,revision:p,customFields:f}=i(!1);return setImmediate(()=>{dn("custom-fields"),Di(c,p,{timer:!0,external:!0})}),f}function ko(e){let t=e.timedEventOrder.length;KG({numEvents:t,...e})}function Di(e,t,a){a.timer&&ua.notifyOfChangedEvents(e),a.reload?dn("all"):a.external&&dn("rundown",t)}async function dK(e){let t=Ht();if(e===Xr().id)return t.getProjectRundowns();let a=t.getRundown(e),r=t.getCustomFields();return await tm(a,r),t.getProjectRundowns()}async function tm(e,t,a=!1){ua.stop();let{rundownMetadata:r,revision:i}=Lz.init(e,t);At.info("SERVER",`Switch to rundown: ${e.id}`),ko(r),setImmediate(()=>{Di(r,i,{timer:!0,external:!0,reload:a}),Yz(e.id).catch(c=>{At.error("SERVER",`Failed to persist last loaded rundown: ${c}`)})})}var mK=null;function rm(e,t,a){let r=e.toLowerCase(),i=h9e[r];if(mK=new Date,i)return i(t);throw new Error(`Unhandled message ${e}`)}function hK(){return mK}var h9e={version:()=>({payload:Eo}),poll:()=>({payload:To.poll()}),change:async e=>{if(dc(e),Object.keys(e).length===0)throw new Error("Payload is empty");let t=Object.keys(e).at(0);if(!t)throw new Error("Missing Event ID");let{entries:a}=Xr(),r=hc(),i=a[t];if(!i)throw new Error("ID do not exits in rundown");let c=e[t],p={id:t},f=!1;return Object.entries(c).forEach(([v,y])=>{if(!zz(i,v,y,r))throw new Error("Invalid property or value");let b=Gz(v,y),E=Object.keys(b)[0];f=f||yk(E),p.custom&&b.custom?Object.assign(p.custom,b.custom):Object.assign(p,b)}),await H5(p),{payload:"success"}},message:e=>{dc(e);let t={timer:"timer"in e?TG(e.timer):void 0,secondary:"secondary"in e?AG(e.secondary):void 0};return{payload:X4(t)}},start:e=>{if(e===void 0)return vc(ua.start(),"Unable to start");if(e&&typeof e=="object"){if("index"in e){let t=F0(e.index);if(t<=0)throw new Error(`Event index out of range ${t}`);return vc(ua.startByIndex(t-1),`Event index not recognised or out of range ${t}`)}if("id"in e)return Xn(e.id),vc(ua.startById(e.id),`Unable to start ID: ${e.id}`);if("cue"in e){let t=fK(e.cue);return vc(ua.startByCue(t),`Unable to start CUE: ${t}`)}}if(e==="next")return vc(ua.startNext(),"Unable to start next event");if(e==="previous")return vc(ua.startPrevious(),"Unable to start previous event");throw new Error("No matching start function")},pause:()=>(ua.pause(),{payload:"success"}),stop:()=>(ua.stop(),{payload:"success"}),reload:()=>(ua.reload(),{payload:"success"}),roll:()=>(ua.roll(),{payload:"success"}),load:e=>{if(e&&typeof e=="object"){if("index"in e){let t=F0(e.index);if(t<=0)throw new Error(`Event index out of range ${t}`);return vc(ua.loadByIndex(t-1),`Event index not recognised or out of range ${t}`)}if("id"in e)return Xn(e.id),vc(ua.loadById(e.id),`Unable to load ID: ${e.id}`);if("cue"in e){let t=fK(e.cue);return vc(ua.loadByCue(t),`Unable to load CUE: ${t}`)}}if(e==="next")return vc(ua.loadNext(),"Unable to load next event");if(e==="previous")return vc(ua.loadPrevious(),"Unable to load previous event");throw new Error("No matching method provided")},addtime:e=>{let t=(()=>{if(e&&typeof e=="object"){if("add"in e)return F0(e.add);if("remove"in e)return F0(e.remove)*-1}return F0(e)})();if(M5(t),t===0)return{payload:"success"};if(Math.abs(t)>Zn)throw new Error(`Payload too large: ${t}`);return ua.addTime(t),{payload:"success"}},auxtimer:e=>{dc(e);let t=Object.keys(e).at(0);if(t!=="1"&&t!=="2"&&t!=="3")throw new Error("Invalid auxtimer index");let a=e[t],r=Number(t);if(typeof a=="string")switch(a){case"start":return{payload:pn.start(r)};case"pause":return{payload:pn.pause(r)};case"stop":return{payload:pn.stop(r)};default:throw new Error("Invalid command")}if(a&&typeof a=="object"){if("duration"in a)return{payload:pn.setTime(F0(a.duration),r)};if("addtime"in a)return{payload:pn.addTime(F0(a.addtime),r)};if("direction"in a){if(a.direction==="count-up"||a.direction==="count-down")return{payload:pn.setDirection(a.direction,r)};throw new Error("Invalid direction payload")}}throw new Error("No matching method provided")},client:e=>{if(dc(e),!("target"in e)||typeof e.target!="string")throw new Error("No or invalid client target");if("rename"in e&&typeof e.rename=="string"){let{target:t,rename:a}=e;return Ri.renameClient(t,a),{payload:"success"}}if("redirect"in e&&typeof e.redirect=="string"){let{target:t,redirect:a}=e;return Ri.redirectClient(t,a),{payload:"success"}}if("identify"in e&&typeof e.identify=="boolean"){let{target:t,identify:a}=e;return Ri.identifyClient(t,a),{payload:"success"}}throw new Error("No matching method provided")},offsetmode:e=>{let t=U1(e,Hd);return ua.setOffsetMode(t),{payload:"success"}}};function F0(e){let t=Number(e);if(isNaN(t))throw new Error("Payload is not a valid number");return t}function fK(e){if(typeof e=="number")return String(e);if(typeof e=="string")return e;throw new Error("Payload is not a valid string or number")}function vc(e,t){if(!e)throw new Error(t);return{payload:"success"}}var vK=null,Hk=class{MAX_PAYLOAD=1024*256;wss;clients;lastConnection=null;shouldShowWelcome=!0;constructor(){if(vK)throw new Error("There can be only one");vK=this,this.clients=new Map,this.wss=null}init(t,a,r){this.shouldShowWelcome=a,this.wss=new dk.default({path:`${r}/ws`,server:t,maxPayload:this.MAX_PAYLOAD}),this.wss.on("connection",(i,c)=>{gK(i,c,y=>{y&&i.close(1008,"Unauthorized")});let p=Ta(),f=P5();function v(y,b){i.send(JSON.stringify({tag:y,payload:b}))}this.clients.set(p,{type:"unknown",identify:!1,name:f,origin:"",path:""}),this.lastConnection=new Date,At.info("CLIENT",`${this.clients.size} Connections with new: ${f}`),v("client-init",{clientId:p,clientName:f}),this.sendClientList(),v("runtime-data",To.poll()),i.on("error",console.error),i.on("close",()=>{this.clients.delete(p),At.info("CLIENT",`${this.clients.size} Connections with disconnected: ${f}`),this.sendClientList()}),i.on("message",async y=>{try{let b=JSON.parse(y.toString()),{tag:E,payload:T}=b;switch(E){case"ping":{v("pong",T);break}case"client-set":{let k={...this.getOrCreateClient(p),...T};this.clients.set(p,k),this.shouldShowWelcome&&k.path?.toLowerCase().includes("editor")&&(this.shouldShowWelcome=!1,v("dialog",{dialog:"welcome"})),this.sendClientList();break}case"client-set-path":{let C=this.getOrCreateClient(p);C.path=T,this.clients.set(p,C),this.shouldShowWelcome&&T.toLowerCase().includes("editor")&&(this.shouldShowWelcome=!1,v("dialog",{dialog:"welcome"})),this.sendClientList();break}case"log":{At.emit(T.level,T.origin,T.text);break}default:{try{let C=await rm(E,T,"ws");C&&i.send(JSON.stringify({tag:E,payload:C.payload}))}catch(C){At.error("RX",`WS IN: ${C}`)}break}}}catch{}})})}getStats(){return{connectedClients:this.clients.size,lastConnection:this.lastConnection}}getOrCreateClient(t){return this.clients.has(t)||this.clients.set(t,{type:"unknown",identify:!1,name:P5(),origin:"",path:""}),this.clients.get(t)}sendClientList(){let t=Object.fromEntries(this.clients.entries());this.sendAsJson("client-list",t)}getClientList(){return Array.from(this.clients.keys())}renameClient(t,a){let r=this.clients.get(t);if(!r)throw new Error(`Client "${t}" not found`);At.info("CLIENT",`Client ${r.name} renamed to ${a}`),this.clients.set(t,{...r,name:a}),this.sendAsJson("client-rename",{name:a,target:t}),this.sendClientList()}redirectClient(t,a){if(!this.clients.get(t))throw new Error(`Client "${t}" not found`);this.sendAsJson("client-redirect",{target:t,path:a})}identifyClient(t,a){let r=this.clients.get(t);if(!r)throw new Error(`Client "${t}" not found`);this.clients.set(t,{...r,identify:a}),this.sendClientList()}sendAsJson(t,a){try{let r=JSON.stringify({tag:t,payload:a});this.wss?.clients.forEach(i=>{i.readyState===pk.default.OPEN&&i.send(r)})}catch{}}shutdown(){this.wss?.close()}},Ri=new Hk;function dn(e,t=null){Ri.sendAsJson("refetch",{target:e,revision:t})}var z5=require("fs/promises"),zk=require("path");var xK={rundowns:{default:{id:"default",title:"Demo project",order:["e2163f","7eaf99","f60403","6b0edb"],flatOrder:["e2163f","7eaf99","9bf60f","bf71a2","c2697f","fa593e","a8b0b3","f60403","0aaa7d","6b0edb","02afca","75ce86","e10ed9","07df89"],entries:{e2163f:{id:"e2163f",type:"milestone",cue:"Demo",title:"Clear all, or Create New Project to start fresh",note:`Moderator - Emma Thompson
|
|
265
265
|
|
|
266
266
|
Speakers
|
|
267
267
|
- Liam Carter + Sophia Patel
|