define(["exports","./../../dom.js","./../../layoutmanager.js","./../../actionsheet/actionsheet.js","./../../focusmanager.js"],function(_exports,_dom,_layoutmanager,_actionsheet,_focusmanager){function _superPropSet(t,e,o,r,p,f){babelHelpers.set(babelHelpers.getPrototypeOf(f?t.prototype:t),e,o,r,p)}function _superPropGet(t,o,e,r){var p=babelHelpers.get(babelHelpers.getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var ActionSheet=_actionsheet.default.constructor;function onFocus(){var _this$labelElement;document.attachIME&&document.attachIME(this),null!=(_this$labelElement=this.labelElement)&&_this$labelElement.classList.add("inputLabelFocused")}function onBlur(){var _this$labelElement2;null!=(_this$labelElement2=this.labelElement)&&_this$labelElement2.classList.remove("inputLabelFocused")}function destroyActionSheet(elem){clearInputTimer(elem);var actionsheet=elem.actionsheet;actionsheet&&(actionsheet.isShowing()&&actionsheet.close(),actionsheet.destroy(),elem.actionsheet=null)}function clearInputTimer(elem){elem.inputTimeout&&clearTimeout(elem.inputTimeout)}function onInput(){clearInputTimer(this),this.value.trim()?this.inputTimeout=setTimeout(function(){var options,refocus,elem=this,value=elem.value.trim();if(console.log("onInputTimeout: "+value),value){if(!elem.actionsheet)return value=new ActionSheet,elem.actionsheet=value,options={getItems:elem.getItems,enableVirtualScroller:!1,positionTo:elem,resolveWithSelectedItem:!0,hasItemIcon:!0,iconRight:!1,fields:["Name","Type","ParentName"],dialogClass:"emby-input-actionsheet",offsetTop:2,refocus:!1,artist:!1,enableDefaultIcon:!0,imageSize:"small",hasItemImage:!0,setCurrentFocusScope:!1},_layoutmanager.default.tv||(options.positionY="bottom",options.positionX="left",options.transformOrigin="center top",options.minWidthToElement=!0),refocus="false"!==elem.getAttribute("data-refocus"),elem.dispatchEvent(new CustomEvent("selectionopen",{bubbles:!1,cancelable:!1,detail:{}})),value.show(options).then(function(item){elem.value=item.Name,elem.dispatchEvent(new CustomEvent("itemselected",{bubbles:!1,cancelable:!1,detail:{item:item}})),refocus&&_focusmanager.default.focus(elem),elem.dispatchEvent(new CustomEvent("selectionclose",{bubbles:!1,cancelable:!1,detail:{}})),destroyActionSheet(elem)},function(){elem.dispatchEvent(new CustomEvent("selectioncancel",{bubbles:!1,cancelable:!1,detail:{}})),refocus&&_focusmanager.default.focus(elem),elem.dispatchEvent(new CustomEvent("selectionclose",{bubbles:!1,cancelable:!1,detail:{}})),destroyActionSheet(elem)});elem.actionsheet.refreshItems()}else destroyActionSheet(elem)}.bind(this),400):destroyActionSheet(this)}function isDecimal(val){return!Number.isInteger(parseFloat(val))}require(["css!modules/emby-elements/emby-input/emby-input.css"]);var inputId=0;function onInit(){var label,labelClass,parentNode=this.parentNode;parentNode&&(this.hasInit||(this.hasInit=!0,this.id||(this.id="embyinput"+inputId,inputId++),this.classList.contains("emby-input"))?this.labelElement&&(this.labelElement.htmlFor=this.id):(this.classList.add("emby-input"),_layoutmanager.default.tv?"number"===this.type&&this.classList.add("emby-input-hide-spin-button"):this.classList.add("emby-input-smaller"),(label=this.ownerDocument.createElement("label")).innerHTML=this.getAttribute("label")||"",label.classList.add("inputLabel"),(labelClass=this.getAttribute("labelclass"))&&label.classList.add(labelClass),label.htmlFor=this.id,parentNode.insertBefore(label,this),this.labelElement=label,_dom.default.addEventListener(this,"focus",onFocus,{passive:!0}),_dom.default.addEventListener(this,"blur",onBlur,{passive:!0}),"true"===this.getAttribute("data-autocompleteitems")&&_dom.default.addEventListener(this,"input",onInput,{passive:!0}),function(elem){var isDecimalInput;"number"===elem.type&&(isDecimalInput=isDecimal(elem.getAttribute("step"))||isDecimal(elem.getAttribute("min"))||isDecimal(elem.getAttribute("max")),elem.setAttribute("inputmode",isDecimalInput?"decimal":"numeric"))}(this)))}function roundMsToStep(ms,step){return step=step||1,step*=1e3,ms-ms%(step=Math.floor(step))}var supportsValueAsNumber=void 0!==document.createElement("input").valueAsNumber,supportsValueAsDate=void 0!==document.createElement("input").valueAsDate;function pad(num,size){for(var s=num+"";s.length