"use strict";(this.webpackChunktweb=this.webpackChunktweb||[]).push([[813,339],{2582:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(2325);class i{constructor(e){this.element=document.body.querySelector("."+e.className),this.container=document.createElement("div"),this.container.className="container center-align",this.imageDiv=document.createElement("div"),this.imageDiv.className="auth-image",this.title=document.createElement("h4"),e.titleLangKey&&this.title.append((0,n.ag)(e.titleLangKey)),this.subtitle=document.createElement("p"),this.subtitle.className="subtitle",e.subtitleLangKey&&this.subtitle.append((0,n.ag)(e.subtitleLangKey)),this.container.append(this.imageDiv,this.title,this.subtitle),e.withInputWrapper&&(this.inputWrapper=document.createElement("div"),this.inputWrapper.className="input-wrapper",this.container.append(this.inputWrapper)),this.element.append(this.container)}}},8339:(e,t,a)=>{a.r(t),a.d(t,{default:()=>v});var n=a(2582),i=a(4874),s=a(8799),r=a(3512),c=a(503),u=a(1168),o=a(6765),l=a(5565),p=a(2325),m=a(8115),d=a(4494),h=a(279);let g=null;const v=new i.Z("page-signUp",!0,(()=>{return e=void 0,t=void 0,v=function*(){const e=new n.Z({className:"page-signUp",withInputWrapper:!0,titleLangKey:"YourName",subtitleLangKey:"Login.Register.Subtitle"});e.imageDiv.classList.add("avatar-edit"),e.title.classList.add("fullName");const t=document.createElement("canvas");t.id="canvas-avatar",t.className="avatar-edit-canvas";const i=document.createElement("span");let v;i.className="tgico tgico-cameraadd",e.imageDiv.append(t,i),e.imageDiv.addEventListener("click",(()=>{u.Z.createPopup(o.Z).open(t,(e=>{v=e}))}));const b=t=>{const a=y.value||"",n=w.value||"",i=a||n?(a+" "+n).trim():"";i?(0,l.Z)(e.title,(0,m.Z)(i)):(0,l.Z)(e.title,(0,p.ag)("YourName"))},y=new c.ZP({label:"FirstName",maxLength:70}),w=new c.ZP({label:"LastName",maxLength:64}),L=(0,d.Z)("btn-primary btn-color-primary"),f=new p.ZP.IntlElement({key:"StartMessaging"});return L.append(f.element),e.inputWrapper.append(y.container,w.container,L),y.input.addEventListener("input",b),w.input.addEventListener("input",b),L.addEventListener("click",(function(e){if(y.input.classList.contains("error")||w.input.classList.contains("error"))return!1;if(!y.value.length)return y.input.classList.add("error"),!1;this.disabled=!0;const t=y.value.trim(),n=w.value.trim(),i={phone_number:g.phone_number,phone_code_hash:g.phone_code_hash,first_name:t,last_name:n};f.update({key:"PleaseWait"});const s=(0,h.y)(this);r.Z.managers.apiManager.invokeApi("auth.signUp",i).then((e=>{"auth.authorization"===e._?(r.Z.managers.apiManager.setUser(e.user),new Promise(((e,t)=>{if(!v)return e();v().then((a=>{r.Z.managers.appProfileManager.uploadProfilePhoto(a).then(e,t)}),t)})).finally((()=>{a.e(781).then(a.bind(a,5436)).then((e=>{e.default.mount()}))}))):(f.update({key:e._}),this.removeAttribute("disabled"),s.remove())})).catch((e=>{this.removeAttribute("disabled"),s.remove(),e.type,f.update({key:e.type})}))})),(0,s.Z)(),new Promise((e=>{window.requestAnimationFrame(e)}))},new((i=void 0)||(i=Promise))((function(a,n){function s(e){try{c(v.next(e))}catch(e){n(e)}}function r(e){try{c(v.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,r)}c((v=v.apply(e,t||[])).next())}));var e,t,i,v}),(e=>{g=e,r.Z.managers.appStateManager.pushToState("authState",{_:"authStateSignUp",authCode:e})}))}}]);
//# sourceMappingURL=813.315ffd640c7d6013a536.chunk.js.map