define(["browser","connectionManager","dom","layoutManager","shell","appRouter","apphost","css!./emby-button"],function(browser,connectionManager,dom,layoutManager,shell,appRouter,appHost){"use strict";function openPremiumInfo(){require(["registrationServices"],function(registrationServices){registrationServices.showPremiereInfo()})}function showPremiereInfoToPremiereUser(){connectionManager.currentApiClient().getCurrentUser().then(function(user){user.Policy.IsAdministrator&&self.Dashboard?Dashboard.navigate("supporterkey.html"):openPremiumInfo()})}function onAnchorClick(e){var href=this.getAttribute("href")||"";"#"===href?(e.preventDefault(),"premiereinfo"===this.getAttribute("data-preset")&&require(["registrationServices"],function(registrationServices){registrationServices.validateFeature("themes",{viewOnly:!0,showDialog:!0}).then(showPremiereInfoToPremiereUser)})):this.getAttribute("target")?-1===href.indexOf("emby.media/premiere")||appHost.supports("externalpremium")?appHost.supports("targetblank")||(e.preventDefault(),shell.openUrl(href)):(e.preventDefault(),openPremiumInfo()):appRouter.handleAnchorClick(e)}function onInit(){this.hasInit||(this.hasInit=!0,this.classList.contains("emby-button")||(this.classList.add("emby-button"),(browser.android||browser.edge)&&this.classList.add("nobackdropfilter"),layoutManager.tv&&("false"!==this.getAttribute("data-focusscale")&&this.classList.add("emby-button-focusscale"),this.classList.add("emby-button-tv"))))}function _connectedCallback(){"A"===this.tagName&&(dom.removeEventListener(this,"click",onAnchorClick,{}),dom.addEventListener(this,"click",onAnchorClick,{}),"true"===this.getAttribute("data-autohide")&&(appHost.supports("externallinks")?this.classList.remove("hide"):this.classList.add("hide")))}function _disconnectedCallback(){dom.removeEventListener(this,"click",onAnchorClick,{})}if(window.customElements){var EmbyButton=function(_HTMLButtonElement){function EmbyButton(){var _this;babelHelpers.classCallCheck(this,EmbyButton);var self=_this=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(EmbyButton).call(this));return onInit.call(self),babelHelpers.possibleConstructorReturn(_this,self)}return babelHelpers.inherits(EmbyButton,_HTMLButtonElement),babelHelpers.createClass(EmbyButton,[{key:"connectedCallback",value:function(){onInit.call(this),_connectedCallback.call(this)}},{key:"disconnectedCallback",value:function(){_disconnectedCallback.call(this)}}]),EmbyButton}(babelHelpers.wrapNativeSuper(HTMLButtonElement));customElements.define("emby-button",EmbyButton,{extends:"button"});var EmbyAnchor=function(_HTMLAnchorElement){function EmbyAnchor(){var _this2;babelHelpers.classCallCheck(this,EmbyAnchor);var self=_this2=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(EmbyAnchor).call(this));return onInit.call(self),babelHelpers.possibleConstructorReturn(_this2,self)}return babelHelpers.inherits(EmbyAnchor,_HTMLAnchorElement),babelHelpers.createClass(EmbyAnchor,[{key:"connectedCallback",value:function(){onInit.call(this),_connectedCallback.call(this)}},{key:"disconnectedCallback",value:function(){_disconnectedCallback.call(this)}}]),EmbyAnchor}(babelHelpers.wrapNativeSuper(HTMLAnchorElement));return customElements.define("emby-linkbutton",EmbyAnchor,{extends:"a"}),EmbyButton}if(document.registerElement){var EmbyButtonPrototype=Object.create(HTMLButtonElement.prototype);EmbyButtonPrototype.createdCallback=onInit,EmbyButtonPrototype.attachedCallback=_connectedCallback,EmbyButtonPrototype.detachedCallback=_disconnectedCallback,document.registerElement("emby-button",{prototype:EmbyButtonPrototype,extends:"button"});var EmbyLinkButtonPrototype=Object.create(HTMLAnchorElement.prototype);return EmbyLinkButtonPrototype.createdCallback=onInit,EmbyLinkButtonPrototype.attachedCallback=_connectedCallback,EmbyLinkButtonPrototype.detachedCallback=_disconnectedCallback,document.registerElement("emby-linkbutton",{prototype:EmbyLinkButtonPrototype,extends:"a"}),EmbyButtonPrototype}});