define(["exports","./../globalize.js","./../../actionsheet/actionsheet.js","./playbackmanager.js","./../dataformatter.js"],function(_exports,_globalize,_actionsheet,_playbackmanager,_dataformatter){function showToast(options){Emby.importModule("./modules/toast/toast.js").then(function(toast){return toast(options)})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;_exports.default={show:function(options){for(var player=options.player,menuItems=[],currentMode=_playbackmanager.default.getSleepTimerMode(player),now=(currentMode&&"None"!==currentMode&&menuItems.push({name:_globalize.default.translate("TurnOffTimer"),id:"stoptimer"}),menuItems.push({name:_globalize.default.translate("AfterCurrentItem"),id:"afteritem"}),Date.now()),increments=[3e5,6e5,9e5,12e5,18e5,27e5,36e5,72e5,108e5,144e5],i=0,length=increments.length;i<length;i++){var time=now+increments[i],date=new Date(time);menuItems.push({name:_dataformatter.default.formatRelativeTime(date,!1),id:time})}return _actionsheet.default.show({items:menuItems,positionTo:options.positionTo,positionX:options.positionX,positionY:options.positionY,transformOrigin:options.transformOrigin,noTextWrap:options.noTextWrap,title:_globalize.default.translate("HeaderStopPlayback"),hasItemSelectionState:!1}).then(function(result){switch(result){case"afteritem":_playbackmanager.default.setSleepTimer({sleepTimerMode:"AfterItem"},player),showToast({text:_globalize.default.translate("SleepTimerIsSet"),icon:"&#xe5ca;"});break;case"stoptimer":_playbackmanager.default.setSleepTimer({sleepTimerMode:"None"},player),showToast({text:_globalize.default.translate("SleepTimerIsOff"),icon:"&#xe426;"});break;default:var _time=parseInt(result);_time&&!isNaN(_time)&&(_playbackmanager.default.setSleepTimer({sleepTimerMode:"AtTime",sleepTimerEndTime:new Date(_time)},player),showToast({text:_globalize.default.translate("SleepTimerIsSet"),icon:"&#xe425;"}))}})}}});