define(["exports","./../modules/tabbedview/videostab.js","./../modules/emby-elements/emby-itemscontainer/emby-itemscontainer.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/common/globalize.js"],function(_exports,_videostab,_embyItemscontainer,_embyButton,_embyScroller,_globalize){function RecordingsTab(view,params,options){_videostab.default.call(this,view,params,options)}function initElements(instance){for(var btnCreateRecordings=instance.view.querySelectorAll(".btnCreateRecording"),boundOnAddRecordingClick=function(e){var instance=this;return require(["channelRecordingCreator"]).then(function(responses){return responses[0].createRecordingForChannel(null,{serverId:instance.getApiClient().serverId(),positionTo:e.target.closest("button")})})}.bind(instance),i=0,length=btnCreateRecordings.length;i<length;i++)btnCreateRecordings[i].addEventListener("click",boundOnAddRecordingClick)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(RecordingsTab.prototype,_videostab.default.prototype),RecordingsTab.prototype.getApiClientQueryMethodName=function(){return"getLiveTvRecordings"},RecordingsTab.prototype.getCardOptions=function(items){var options=_videostab.default.prototype.getCardOptions.apply(this,arguments);return options.fields.push("ParentName"),options.fields.push("ChannelName"),options.fields.push("AirTime"),options.preferThumb="auto",options.showAirEndTime=!0,options},RecordingsTab.prototype.getListViewOptions=function(items){var options=_videostab.default.prototype.getListViewOptions.apply(this,arguments);return options.fields.unshift("ParentName"),options},RecordingsTab.prototype.getDefaultSorting=function(){return this.getDefaultSortingForField("DateCreated")||_videostab.default.prototype.getDefaultSorting.apply(this,arguments)},RecordingsTab.prototype.getSettingsKey=function(){return"livetvrecordings"},RecordingsTab.prototype.loadTemplate=function(){return this.loadItemsTemplate()},RecordingsTab.prototype.onTemplateLoaded=function(){_videostab.default.prototype.onTemplateLoaded.apply(this,arguments);var elem=this.view.querySelector(".listTotalRecordCount"),html=(html=(html=(html="")+'<button is="emby-button" class="itemsViewSettingsContainer-button btnCreateRecording raised raised-mini listTextButton-autohide hide">'+'<i class="md-icon button-icon button-icon-left">&#xe145;</i>')+("<span>"+_globalize.default.translate("HeaderAddRecording")+"</span>")+"</button>")+('<button title="'+_globalize.default.translate("HeaderAddRecording")+'" is="paper-icon-button-light" class="itemsViewSettingsContainer-button btnCreateRecording listIconButton-autohide hide">');elem.insertAdjacentHTML("afterend",html=html+'<i class="md-icon autortl">&#xe145;</i>'+"</button>"),initElements(this),this.itemsContainer.setAttribute("data-monitor","RecordingStarted,RecordingEnded"),this.getApiClient().getCurrentUser().then(function(user){for(var btnCreateRecordings=elem.parentNode.querySelectorAll(".btnCreateRecording"),i=0,length=btnCreateRecordings.length;i<length;i++)user.Policy.EnableLiveTvManagement?btnCreateRecordings[i].classList.remove("hide"):btnCreateRecordings[i].classList.add("hide")})};_exports.default=RecordingsTab});