tweb/public/392.eb2cde6a1063177ee3ad.ch...

2 lines
2.7 KiB
JavaScript

"use strict";(this.webpackChunktweb=this.webpackChunktweb||[]).push([[392],{6392:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var a=n(4755),o=n(4874),s=n(810),r=n(3083),u=n(4489),i=n(2325),l=n(144),h=n(5565),c=n(3512);let p,d=null,E=null,_=null;const b=new o.Z("page-authCode",!0,(()=>{const e=d.type.length,t=new u.Z({label:"Code",name:(0,l.a)(),length:e,onFill:e=>{E(e)}});p=t.input,b.pageEl.querySelector(".input-wrapper").append(t.container),b.pageEl.querySelector(".phone-edit").addEventListener("click",(function(){return s.default.mount()}));const o=()=>{setTimeout((()=>{m.remove()}),300)},E=e=>{p.setAttribute("disabled","true");const a={phone_number:d.phone_number,phone_code_hash:d.phone_code_hash,phone_code:e};c.Z.managers.apiManager.invokeApi("auth.signIn",a,{ignoreErrors:!0}).then((e=>{switch(e._){case"auth.authorization":c.Z.managers.apiManager.setUser(e.user),n.e(781).then(n.bind(n,5436)).then((e=>{e.default.mount()})),o();break;case"auth.authorizationSignUpRequired":n.e(813).then(n.bind(n,8339)).then((e=>{e.default.mount({phone_number:d.phone_number,phone_code_hash:d.phone_code_hash})})),o()}})).catch((e=>{return a=void 0,o=void 0,r=function*(){let a=!1;switch(e.type){case"SESSION_PASSWORD_NEEDED":a=!0,e.handled=!0,yield(yield n.e(774).then(n.bind(n,9437))).default.mount(),setTimeout((()=>{p.value=""}),300);break;case"PHONE_CODE_EXPIRED":p.classList.add("error"),(0,h.Z)(t.label,(0,i.ag)("PHONE_CODE_EXPIRED"));break;case"PHONE_CODE_EMPTY":case"PHONE_CODE_INVALID":p.classList.add("error"),(0,h.Z)(t.label,(0,i.ag)("PHONE_CODE_INVALID"));break;default:t.label.innerText=e.type}a||t.select(),p.removeAttribute("disabled")},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{i(r.next(e))}catch(e){t(e)}}function u(e){try{i(r.throw(e))}catch(e){t(e)}}function i(t){var a;t.done?e(t.value):(a=t.value,a instanceof s?a:new s((function(e){e(a)}))).then(n,u)}i((r=r.apply(a,o||[])).next())}));var a,o,s,r}))},_=b.pageEl.querySelector(".auth-image"),g=a.Z.isMobile?100:166,m=new r.Z(t,g);return _.append(m.container),m.load()}),(e=>{if(d=e,E){p.value="";const e=document.createEvent("HTMLEvents");e.initEvent("input",!1,!0),p.dispatchEvent(e)}else E=b.pageEl.getElementsByClassName("phone")[0],_=b.pageEl.getElementsByClassName("sent-type")[0];let t,n;switch(E.innerText=d.phone_number,d.type._){case"auth.sentCodeTypeSms":t="Login.Code.SentSms";break;case"auth.sentCodeTypeApp":t="Login.Code.SentInApp";break;case"auth.sentCodeTypeCall":t="Login.Code.SentCall";break;default:t="Login.Code.SentUnknown",n=[d.type._]}(0,h.Z)(_,(0,i.ag)(t,n)),c.Z.managers.appStateManager.pushToState("authState",{_:"authStateAuthCode",sentCode:e})}),(()=>{p.focus()})),g=b}}]);
//# sourceMappingURL=392.eb2cde6a1063177ee3ad.chunk.js.map