"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3989],{63989:function(e,r,t){t.r(r),t(99785);var i=t(83094),n=t(58104),s=(t(21865),t(78066),t(48085),t(53913));function a(e,r){for(var t=0;t<r.length;t++){var i=r[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(){var e=this.item;if(e){var r=e.ServerId,t=e.Id,i=e.TimerId,s=e.Status,a=e.SeriesTimerId,o=this;n.default.toggleRecording(r,t,i,s,a).then((function(){o.refresh(r,t)}))}}function c(e,r){var t=e.querySelector(".material-icons");t.classList.remove("fiber_smart_record"),t.classList.remove("fiber_manual_record"),t.classList.add(r)}var l=function(){function e(r){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=r;var t=r.button;c(t,"fiber_manual_record"),r.item?this.refreshItem(r.item):r.itemId&&r.serverId&&this.refresh(r.itemId,r.serverId);var n=o.bind(this);this.clickFn=n,i.ZP.addEventListener(t,"click",n,{passive:!0})}var r,t;return r=e,(t=[{key:"refresh",value:function(e,r){var t=s.Z.getApiClient(e),i=this;t.getItem(t.getCurrentUserId(),r).then((function(e){i.refreshItem(e)}))}},{key:"refreshItem",value:function(e){var r=this.options.button;this.item=e,c(r,function(e){var r;if("SeriesTimer"===e.Type)return"fiber_smart_record";if(e.TimerId||e.SeriesTimerId)r=e.Status||"Cancelled";else{if("Timer"!==e.Type)return"fiber_manual_record";r=e.Status}return e.SeriesTimerId&&"Cancelled"!==r?"fiber_smart_record":"fiber_manual_record"}(e)),e.TimerId&&"Cancelled"!==(e.Status||"Cancelled")?r.classList.add("recordingIcon-active"):r.classList.remove("recordingIcon-active")}},{key:"destroy",value:function(){var e=this.options;if(e){var r=e.button,t=this.clickFn;t&&i.ZP.removeEventListener(r,"click",t,{passive:!0})}this.options=null,this.item=null}}])&&a(r.prototype,t),Object.defineProperty(r,"prototype",{writable:!1}),e}();r.default=l},7547:function(e,r,t){var i=t(54933),n=t.n(i),s=t(93476),a=t.n(s)()(n());a.push([e.id,".recordingButton{margin-left:0;min-width:10em}.recordingIcon-active{color:#c33}.recordSeriesContainer{margin-bottom:.8em}",""]),r.Z=a},48085:function(e,r,t){var i=t(1892),n=t.n(i),s=t(95760),a=t.n(s),o=t(38311),c=t.n(o),l=t(58192),u=t.n(l),d=t(38060),f=t.n(d),m=t(54865),v=t.n(m),h=t(7547),b={};b.styleTagTransform=v(),b.setAttributes=u(),b.insert=c().bind(null,"head"),b.domAPI=a(),b.insertStyleElement=f(),n()(h.Z,b),h.Z&&h.Z.locals&&h.Z.locals}}]);