"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[78938],{78938:function(e,n,t){t.r(n),t(78557),t(90076);var r=t(5898),i=t(59774),a=t(8566),c=t(71866),s=t(47602),o=t(48080);function l(e,n,t,i){return a.Ay.show(),e.getItem(e.getCurrentUserId(),t).then((function(s){return s.IsSeries?e.getNewLiveTvTimerDefaults({programId:t}).then((function(n){return e.createLiveTvSeriesTimer(n).then((function(){a.Ay.hide(),(0,c.A)(r.Ay.translate("SeriesRecordingScheduled"))}))})):i?u(n,e.serverId()):d(e.serverId(),n,!0)}))}function u(e,n){return new Promise((function(t,c){(0,s.A)({text:r.Ay.translate("MessageConfirmRecordingCancellation"),primary:"delete",confirmText:r.Ay.translate("HeaderCancelRecording"),cancelText:r.Ay.translate("HeaderKeepRecording")}).then((function(){a.Ay.show(),d(i.tF.getApiClient(n),e,!0).then(t,c)}),c)}))}function d(e,n,t){return a.Ay.show(),e.cancelLiveTvTimer(n).then((function(){!1!==t&&(a.Ay.hide(),(0,c.A)(r.Ay.translate("RecordingCancelled")))}))}function A(e,n,t){return a.Ay.show(),e.getNewLiveTvTimerDefaults({programId:n}).then((function(n){return(t?e.createLiveTvSeriesTimer(n):e.createLiveTvTimer(n)).then((function(){a.Ay.hide(),(0,c.A)(r.Ay.translate("RecordingScheduled"))}))}))}n.default={cancelTimer:d,createRecording:A,changeRecordingToSeries:l,toggleRecording:function(e,n,t,s,u){var h=i.tF.getApiClient(e),m=t&&"Cancelled"!==s;return u&&m?function(e,n,t,s,l){return new Promise((function(n,u){var A=[];A.push({name:r.Ay.translate("HeaderKeepRecording"),id:"cancel",type:"submit"}),"InProgress"===s?A.push({name:r.Ay.translate("HeaderStopRecording"),id:"canceltimer",type:"cancel"}):A.push({name:r.Ay.translate("HeaderCancelRecording"),id:"canceltimer",type:"cancel"}),A.push({name:r.Ay.translate("HeaderCancelSeries"),id:"cancelseriestimer",type:"cancel"}),o.A.show({text:r.Ay.translate("MessageConfirmRecordingCancellation"),buttons:A}).then((function(s){var o=i.tF.getApiClient(e);"canceltimer"===s?(a.Ay.show(),d(o,t,!0).then(n,u)):"cancelseriestimer"===s?(a.Ay.show(),o.cancelLiveTvSeriesTimer(l).then((function(){(0,c.A)(r.Ay.translate("SeriesCancelled")),a.Ay.hide(),n()}),u)):n()}),u)}))}(e,0,t,s,u):m&&n?l(h,t,n,!0):n?A(h,n):Promise.reject()},cancelTimerWithConfirmation:u,cancelSeriesTimerWithConfirmation:function(e,n){return new Promise((function(t,o){(0,s.A)({text:r.Ay.translate("MessageConfirmRecordingCancellation"),primary:"delete",confirmText:r.Ay.translate("HeaderCancelSeries"),cancelText:r.Ay.translate("HeaderKeepSeries")}).then((function(){a.Ay.show(),i.tF.getApiClient(n).cancelLiveTvSeriesTimer(e).then((function(){(0,c.A)(r.Ay.translate("SeriesCancelled")),a.Ay.hide(),t()}),o)}),o)}))}}}}]);