define(["exports","./../dialoghelper/dialoghelper.js","./../common/globalize.js","./../emby-apiclient/events.js","./../dom.js","./../common/playback/playbackmanager.js","./../emby-elements/emby-input/emby-input.js","./../emby-elements/emby-select/emby-select.js","./../emby-elements/emby-button/emby-button.js","./../emby-elements/emby-button/paper-icon-button-light.js","./../emby-elements/emby-dialogclosebutton/emby-dialogclosebutton.js"],function(_exports,_dialoghelper,_globalize,_events,_dom,_playbackmanager,_embyInput,_embySelect,_embyButton,_paperIconButtonLight,_embyDialogclosebutton){function SubtitleOffsetDialog(options){this.options=options}function onDialogClosed(){var instance=this,player=this.options.player;return(instance=instance.localOnSubtitleOffsetChange)&&_events.default.off(player,"subtitleoffsetchange",instance),Promise.resolve()}function onIncrementButtonClick(e){_playbackmanager.default.incrementSubtitleOffset(parseInt(e.currentTarget.getAttribute("data-offset")),this.options.player)}function refreshData(instance,player){!function(instance,offsetValue){instance.dlg.querySelector(".offsetValue").innerHTML=offsetValue}(instance,_playbackmanager.default.getSubtitleOffset(player))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["material-icons","formDialogStyle"]),SubtitleOffsetDialog.prototype.show=function(){var dlg,html,instance,player;function localOnSubtitleOffsetChange(e){refreshData(instance,player)}this.dlg||((dlg=_dialoghelper.default.createDialog({removeOnClose:!1,scrollY:!1,transparentBackground:!0})).classList.add("formDialog","subtitleOffsetDialog"),_dom.default.allowBackdropFilter()&&dlg.classList.add("dialog-blur"),html="",title=_globalize.default.translate("HeaderSubtitleOffset"),html=(html=(html='<div class="formDialogHeader justify-content-center"><button type="button" is="emby-dialogclosebutton"></button>')+'<h3 class="formDialogHeaderTitle formDialogHeaderTitle-centered" style="max-width:calc(100% - '+(2*_globalize.default.translate("Done").length+4)+'ch);">'+title+"</h3></div>")+function(){var html="";return(html+='<div class="formDialogContent flex flex-direction-column align-items-center" style="padding-left:1.5em;padding-right:1.5em;padding-bottom:.25em;">')+'<div class="subtitleOverlayOffsetText" style="margin:1em 0;"><span class="offsetValue">0</span><span> ms</span></div>'+'<div class="subtitleOverlayControls flex flex-direction-row align-items-center justify-content-center padded-top padded-bottom">'+('<button is="emby-button" type="button" data-offset="-50" class="flex-shrink-zero btnDecrementSubtitleOffset raised raised-mini nobackdropfilter" title="'+_globalize.default.translate("HeaderDecreaseSubtitleOffset")+'" aria-label="'+_globalize.default.translate("HeaderDecreaseSubtitleOffset")+'">- 50 ms</button>')+('<button is="emby-button" type="button" data-offset="50" class="flex-shrink-zero btnIncrementSubtitleOffset raised raised-mini nobackdropfilter" title="'+_globalize.default.translate("HeaderIncreaseSubtitleOffset")+'" aria-label="'+_globalize.default.translate("HeaderIncreaseSubtitleOffset")+'">+ 50 ms</button>')+('<button is="emby-button" type="button" class="flex-shrink-zero btnReset raised raised-mini nobackdropfilter" title="'+_globalize.default.translate("Reset")+'" aria-label="'+_globalize.default.translate("Reset")+'">'+_globalize.default.translate("Reset")+"</button>")+"</div>"+"</div>"}(),dlg.innerHTML=html,(this.dlg=dlg).querySelector(".btnDecrementSubtitleOffset").addEventListener("click",onIncrementButtonClick.bind(this)),dlg.querySelector(".btnIncrementSubtitleOffset").addEventListener("click",onIncrementButtonClick.bind(this)),dlg.querySelector(".btnReset").addEventListener("click",function(e){_playbackmanager.default.setSubtitleOffset(0,this.options.player)}.bind(this))),player=(instance=this).options.player,instance.localOnSubtitleOffsetChange=localOnSubtitleOffsetChange,_events.default.on(player,"subtitleoffsetchange",localOnSubtitleOffsetChange),refreshData(this,this.options.player);var title=onDialogClosed.bind(this);return _dialoghelper.default.open(this.dlg).then(title,title)},SubtitleOffsetDialog.prototype.close=function(){var dlg=this.dlg;dlg&&_dialoghelper.default.close(dlg)},SubtitleOffsetDialog.prototype.destroy=function(){this.close(),this.options=null,this.dlg=null};_exports.default=SubtitleOffsetDialog});