define(["exports","./../../layoutmanager.js"],function(_exports,_layoutmanager){function getLabel(select){for(var elem=select.parentElement.previousSibling;elem&&"LABEL"!==elem.tagName;)elem=elem.previousSibling;return elem}function onFocus(e){var label=getLabel(this);label&&label.classList.add("selectLabelFocused")}function onBlur(e){var label=getLabel(this);label&&label.classList.remove("selectLabelFocused")}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["css!modules/emby-elements/emby-multilineselect/emby-multilineselect.css","css!tv|modules/emby-elements/emby-multilineselect/emby-multilineselect_tv.css"]);var inputId=0;function onInit(){this.hasInit||(this.hasInit=!0,this.id||(this.id="emby-multilineselect"+inputId,inputId++),_layoutmanager.default.tv&&this.classList.add("emby-multilineselect-focusscale"),this.addEventListener("focus",onFocus),this.addEventListener("blur",onBlur))}var EmbyMultiLineSelect=function(_HTMLSelectElement){function EmbyMultiLineSelect(){var _this,self=_this=_HTMLSelectElement.call(this)||this;return onInit.call(self),babelHelpers.possibleConstructorReturn(_this,self)}return babelHelpers.inherits(EmbyMultiLineSelect,_HTMLSelectElement),babelHelpers.createClass(EmbyMultiLineSelect,[{key:"connectedCallback",value:function(){onInit.call(this),function(){var wrapper,container,label,insertLabel,labelText;this.classList.contains("emby-multilineselect")||(this.parentElement.classList.contains("emby-select-wrapper")?(container=(wrapper=this.parentElement).parentElement,this.classList.add("emby-multilineselect"),labelText=this.getAttribute("label")||"",(label=this.closest("label"))?(label.insertAdjacentHTML("afterbegin",'<div class="selectLabelText">'+labelText+"</div>"),label.classList.add("selectLabel")):((label=this.ownerDocument.createElement("label")).classList.add("selectLabel","selectLabelText"),label.innerHTML=labelText,label.htmlFor=this.id,insertLabel=!0),labelText="selectArrowContainer",this.classList.contains("emby-multilineselect-inline")&&(label.classList.add("selectLabel2-inline"),labelText+=" selectArrowContainer-inline"),insertLabel&&container.insertBefore(label,wrapper),this.classList.contains("emby-multilineselect-withcolor")&&this.parentNode.insertAdjacentHTML("beforeend",'<div class="'+labelText+'"><i class="selectArrow md-icon">&#xe313;</i></div>')):((insertLabel=document.createElement("div")).classList.add("emby-select-wrapper"),this.parentNode.replaceChild(insertLabel,this),insertLabel.appendChild(this)))}.call(this)}},{key:"setLabel",value:function(){!function(text){this.parentNode.parentNode.querySelector("label").innerHTML=text}.apply(this,arguments)}}])}(babelHelpers.wrapNativeSuper(HTMLSelectElement));customElements.define("emby-multilineselect",EmbyMultiLineSelect,{extends:"select"}),_exports.default=EmbyMultiLineSelect});