define(["exports","./../modules/viewmanager/basesettingsview.js","./../modules/loading/loading.js","./../modules/emby-elements/emby-select/emby-select.js","./../modules/approuter.js"],function(_exports,_basesettingsview,_loading,_embySelect,_approuter){function onCountryChange(e){var e=e.target,country=e.value,e=e.closest("FORM").querySelector(".fldGuideProvider"),selectProvider=(country?e.classList.remove("hide"):(e.classList.add("hide"),_loading.default.hide()),e.querySelector(".selectProvider"));selectProvider.innerHTML="",country&&(_loading.default.show(),(e=this.getApiClient()).getJSON(e.getUrl("LiveTv/ListingProviders/Available",{Country:country})).then(function(options){!function(select,options){select.innerHTML='<option value=""></option>'+options.map(function(o){return'<option data-url="'+o.SetupUrl+'" value="'+o.Id+'">'+o.Name+"</option>"}).join("")}(selectProvider,options),_loading.default.hide()}))}function cancel(){_approuter.default.back()}function onSubmit(e){var selectProvider=this.querySelector(".selectProvider"),country=this.querySelector(".selectCountry").value,selectProvider=selectProvider.options[selectProvider.selectedIndex].getAttribute("data-url");selectProvider.includes("?")?selectProvider+="&":selectProvider+="?",_approuter.default.show(selectProvider+="country="+country),e.preventDefault(),e.stopPropagation()}function View(view,params){_basesettingsview.default.apply(this,arguments),view.querySelector("form").addEventListener("submit",onSubmit),view.querySelector(".btnCancel").addEventListener("click",cancel),view.querySelector(".selectCountry").addEventListener("change",onCountryChange.bind(this))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_basesettingsview.default.prototype),View.prototype.loadSettingsInternal=function(){var select,selectCountry=this.view.querySelector(".selectCountry");return select=selectCountry,this.getApiClient().getCountries().then(function(allCountries){var html="";html+="<option value=''></option>";for(var i=0,length=allCountries.length;i<length;i++){var culture=allCountries[i];html+="<option value='"+culture.ThreeLetterISORegionName+"'>"+culture.DisplayName+"</option>"}select.innerHTML=html})};_exports.default=View});