(self.webpackChunk=self.webpackChunk||[]).push([[3989],{63989:function(e,r,t){"use strict";t.r(r);var i=t(83094),n=t(58104),s=(t(21865),t(78066),t(12086),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(e){var r=this.item;if(r){var t=r.ServerId,i=r.Id,s=r.TimerId,a=r.Status,o=r.SeriesTimerId,c=this;n.default.toggleRecording(t,i,s,a,o).then((function(){c.refresh(t,i)}))}}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 u=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.ZP.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),e}();r.default=u},40383:function(e,r,t){"use strict";var i=t(93476),n=t.n(i)()((function(e){return e[1]}));n.push([e.id,".recordingButton{margin-left:0;min-width:10em}.recordingIcon-active{color:#c33}.recordSeriesContainer{margin-bottom:.8em}",""]),r.Z=n},12086:function(e,r,t){"use strict";var i=t(1892),n=t.n(i),s=t(40383);n()(s.Z,{insert:"head",singleton:!1}),s.Z.locals}}]);