define(["exports","./../common/itemmanager/itemmanager.js","./../emby-apiclient/apiclient.js"],function(_exports,_itemmanager,_apiclient){var progressBarRequired;function getProgressHtml(pct,options){progressBarRequired||(progressBarRequired=!0,Emby.importModule("./modules/emby-elements/emby-progressbar/emby-progressbar.js"));var containerClass="itemProgressBar";return options&&options.containerClass&&(containerClass+=" "+options.containerClass),'<div class="'+containerClass+'"><div class="itemProgressBarForeground" style="width:'+pct+'%;"></div></div>'}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["css!modules/indicators/indicators.css","material-icons"]);_exports.default={getProgressBarHtml:function(item,options){var itemType=item.Type;switch(itemType){case"Program":case"Timer":case"Recording":case"TvChannel":if((item=item.CurrentProgram||item).StartDate&&item.EndDate){var startDate=0,endDate=1;try{startDate=Date.parse(item.StartDate)}catch(err){}try{endDate=Date.parse(item.EndDate)}catch(err){}var pct=(Date.now()-startDate)/(endDate-startDate)*100;if(0<pct&&pct<100)return function(pct,options,isRecording,start,end){progressBarRequired||(progressBarRequired=!0,Emby.importModule("./modules/emby-elements/emby-progressbar/emby-progressbar.js"));var containerClass="itemProgressBar",foregroundClass="itemProgressBarForeground";return options&&options.containerClass&&(containerClass+=" "+options.containerClass),isRecording&&(foregroundClass+=" itemProgressBarForeground-recording"),'<div is="emby-progressbar" data-automode="time" data-starttime="'+start+'" data-endtime="'+end+'" class="'+containerClass+'"><div class="'+foregroundClass+'" style="width:'+pct+'%;"></div></div>'}(pct,options,"Timer"===itemType||"Recording"===itemType||item.TimerId,startDate,endDate)}break;case"ActiveSession":pct=item.PlayState,startDate=item.NowPlayingItem;if(pct&&startDate&&startDate.RunTimeTicks)return endDate=getProgressHtml(100*(pct.PositionTicks||0)/startDate.RunTimeTicks,{}),item.TranscodingInfo&&item.TranscodingInfo.CompletionPercentage&&(endDate+=getProgressHtml(item.TranscodingInfo.CompletionPercentage,{containerClass:"sessionTranscodingProgress"})),endDate;break;case"Chapter":return"";default:if(!item.IsFolder){pct=options&&options.userData||item.UserData;if(pct){startDate=pct.PlayedPercentage;if(startDate&&startDate<100)return getProgressHtml(startDate,options)}}}return""},getPlayedIndicatorHtml:function(item,classNamePrefix){var userData=item.UserData;if(userData){if(userData.Played)return item.IsFolder&&"MusicAlbum"!==item.Type||!_itemmanager.default.canMarkPlayed(item)?"":'<i class="'+(classNamePrefix?classNamePrefix+"PlayedIndicator ":"")+'playedIndicator md-icon">&#xe5CA;</i>';if(userData.UnplayedItemCount&&!item.TimerId)return _itemmanager.default.canMarkPlayed(item)&&!_apiclient.default.isLocalItem(item)?'<div class="'+(classNamePrefix?classNamePrefix+"CountIndicator ":"")+'CountIndicator countIndicator">'+userData.UnplayedItemCount+"</div>":""}return""},getTimerIndicator:function(item,classNamePrefix){var status,itemType=(item=item.CurrentProgram||item).Type,classNamePrefix=classNamePrefix?classNamePrefix+"TimerIndicator ":"";if("SeriesTimer"===itemType)return'<i class="'+classNamePrefix+'md-icon md-icon-fill timerIndicator seriesTimerIndicator indicatorIcon">&#xe062;</i>';if(item.TimerId||item.SeriesTimerId)status=item.Status||"Cancelled";else{if("Timer"!==itemType)return"";status=item.Status}return item.SeriesTimerId?"Cancelled"!==status?'<i class="'+classNamePrefix+'md-icon md-icon-fill timerIndicator seriesTimerIndicator indicatorIcon">&#xe062;</i>':'<i class="'+classNamePrefix+'md-icon md-icon-fill timerIndicator seriesTimerIndicator timerIndicator-inactive indicatorIcon">&#xe062;</i>':'<i class="'+classNamePrefix+'md-icon md-icon-fill timerIndicator indicatorIcon">&#xe061;</i>'}}});