define(["exports","./../modules/viewmanager/baseview.js","./../modules/common/globalize.js","./../modules/emby-elements/emby-input/emby-input.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-checkbox/emby-checkbox.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/approuter.js","./../modules/common/servicelocator.js"],function(_exports,_baseview,_globalize,_embyInput,_embyButton,_embyCheckbox,_embyScroller,_connectionmanager,_approuter,_servicelocator){function onBackClick(){_approuter.default.back()}function showAlert(options){Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)})}function processForgotPasswordResult(result){var msg,supportsLinks;"ContactAdmin"===result.Action?showAlert({text:_globalize.default.translate("ContactAdminToResetPassword"),title:_globalize.default.translate("HeaderForgotPassword")}):"InNetworkRequired"===result.Action?showAlert({text:_globalize.default.translate("ForgotPasswordInNetworkRequired"),title:_globalize.default.translate("HeaderForgotPassword")}):"PinCode"===result.Action&&(msg=_globalize.default.translate("ForgotPasswordFileCreated"),msg+="<p>",(supportsLinks=_servicelocator.appHost.supports("targetblank")&&_servicelocator.appHost.supports("externallinks"))&&(msg+='<a href="https://emby.media/support/articles/Server-Data-Folder.html" target="_blank" is="emby-linkbutton" class="button-link">'),msg+=result.PinFile,supportsLinks&&(msg+="</a>"),showAlert({html:msg+="</p>",title:_globalize.default.translate("HeaderForgotPassword"),centerText:!1}))}function View(view,params){_baseview.default.apply(this,arguments),view.querySelector(".btnCancel").addEventListener("click",onBackClick),view.querySelector("form").addEventListener("submit",function(e){var apiClient=_connectionmanager.default.getApiClient(params.serverId);return apiClient.ajax({type:"POST",url:apiClient.getUrl("Users/ForgotPassword"),dataType:"json",data:{EnteredUsername:view.querySelector("#txtName").value}}).then(processForgotPasswordResult),e.preventDefault(),!1})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_baseview.default.prototype),_exports.default=View});