define(["exports","./../../layoutmanager.js","./../../browser.js"],function(_exports,_layoutmanager,_browser){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"]);var inputId=0;function onInit(){this.hasInit||(this.hasInit=!0,this.id||(this.id="emby-multilineselect"+inputId,inputId++),_browser.default.firefox||(this.classList.add("emby-select-withcolor"),this.classList.add("emby-multilineselect-withcolor"),_layoutmanager.default.tv&&this.classList.add("emby-multilineselect-tv-withcolor")),_layoutmanager.default.tv&&(this.classList.add("emby-multilineselect-focusscale"),this.classList.add("emby-multilineselect-tv"),this.classList.contains("emby-multilineselect-inline"))&&this.classList.add("emby-multilineselect-tv-inline"),this.addEventListener("focus",onFocus),this.addEventListener("blur",onBlur))}var EmbyMultiLineSelect=function(_HTMLSelectElement){babelHelpers.inherits(EmbyMultiLineSelect,_HTMLSelectElement);var _super=_createSuper(EmbyMultiLineSelect);function EmbyMultiLineSelect(){babelHelpers.classCallCheck(this,EmbyMultiLineSelect);var _this,self=_this=_super.call(this);return onInit.call(self),babelHelpers.possibleConstructorReturn(_this,self)}return 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)}}]),EmbyMultiLineSelect}(babelHelpers.wrapNativeSuper(HTMLSelectElement));customElements.define("emby-multilineselect",EmbyMultiLineSelect,{extends:"select"}),_exports.default=EmbyMultiLineSelect});