define(["exports","./../modules/viewmanager/baseview.js","./../modules/loading/loading.js","./../modules/emby-elements/emby-input/emby-input.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-select/emby-select.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/common/globalize.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/approuter.js"],function(_exports,_baseview,_loading,_embyInput,_embyButton,_embySelect,_embyScroller,_globalize,_connectionmanager,_approuter){function showAlert(options){return Emby.importModule("./modules/common/dialogs/alert.js").then(function(alert){return alert(options)})}function View(view,params){var greWidgetId;_baseview.default.apply(this,arguments),view.querySelector(".btnCancelSignup").addEventListener("click",function(){_approuter.default.back()}),view.querySelector("form").addEventListener("submit",function(e){_loading.default.show();var greResponse=greWidgetId?grecaptcha.getResponse(greWidgetId):null;return function(view,greResponse){view={email:view.querySelector(".txtSignupEmail",view).value,username:view.querySelector(".txtSignupUsername",view).value,password:view.querySelector(".txtSignupPassword",view).value,passwordConfirm:view.querySelector(".txtSignupPasswordConfirm",view).value},greResponse&&(view.grecaptcha=greResponse),_connectionmanager.default.signupForConnect(view).then(function(response){_loading.default.hide();function onAlertDismissed(){_approuter.default.showConnectLogin()}showAlert({text:response.Validated?_globalize.default.translate("MessageThankYouForConnectSignUpNoValidation"):_globalize.default.translate("MessageThankYouForConnectSignUp")}).then(onAlertDismissed,onAlertDismissed)},function(result){_loading.default.hide(),"passwordmatch"===result.errorCode?showAlert({text:_globalize.default.translate("ErrorMessagePasswordNotMatchConfirm")}):"USERNAME_IN_USE"===result.errorCode?showAlert({text:_globalize.default.translate("ErrorMessageUsernameInUse")}):"EMAIL_IN_USE"===result.errorCode?showAlert({text:_globalize.default.translate("ErrorMessageEmailInUse")}):showAlert({text:_globalize.default.translate("DefaultErrorMessage")})})}(view,greResponse),e.preventDefault(),e.stopPropagation(),!1}),0===window.location.href.toLowerCase().indexOf("https://")&&require(["https://www.google.com/recaptcha/api.js?render=explicit"],function(){setTimeout(function(){var recaptchaContainer=view.querySelector(".recaptchaContainer");greWidgetId=grecaptcha.render(recaptchaContainer,{sitekey:"6Le2LAgTAAAAAK06Wvttt_yUnbISTy6q3Azqp9po",theme:"dark"})},100)})}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["material-icons"]),Object.assign(View.prototype,_baseview.default.prototype);_exports.default=View});