tweb/public/102.e314611ed72b13b03b17.ch...

2 lines
5.9 KiB
JavaScript

"use strict";(this.webpackChunktweb=this.webpackChunktweb||[]).push([[102,339],{3019:(e,t,n)=>{function i(e,t){return new Promise((n=>{const i=new FileReader;i.addEventListener("loadend",(e=>{n(e.target.result)})),i[t](e)}))}n.d(t,{Z:()=>i})},8150:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(3019);function a(e){return(0,i.Z)(e,"readAsArrayBuffer")}},7151:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(8150);function a(e){return(0,i.Z)(e).then((e=>new Uint8Array(e)))}},8576:(e,t,n)=>{n.d(t,{Z:()=>s});var i=n(1267),a=n(8975),r=n(2328);class s{constructor(e){this.dbName=e,this.useStorage=!0,i.Z.test&&(this.dbName+="_test"),s.STORAGES.length&&(this.useStorage=s.STORAGES[0].useStorage),this.openDatabase(),s.STORAGES.push(this)}openDatabase(){var e;return null!==(e=this.openDbPromise)&&void 0!==e?e:this.openDbPromise=caches.open(this.dbName)}delete(e){return this.timeoutOperation((t=>t.delete("/"+e)))}deleteAll(){return caches.delete(this.dbName)}get(e){return this.timeoutOperation((t=>t.match("/"+e)))}save(e,t){return this.timeoutOperation((n=>n.put("/"+e,t)))}getFile(e,t="blob"){return this.get(e).then((e=>{if(!e)throw"NO_ENTRY_FOUND";return e[t]()}))}saveFile(e,t){t instanceof Blob||(t=(0,a.Z)(t));const n=new Response(t,{headers:{"Content-Length":""+t.size}});return this.save(e,n).then((()=>t))}timeoutOperation(e){return this.useStorage?new Promise(((t,n)=>{return i=this,a=void 0,s=function*(){let i=!1;const a=setTimeout((()=>{n(),i=!0}),15e3);try{const n=yield this.openDatabase();if(!n)throw this.useStorage=!1,this.openDbPromise=void 0,"no cache?";const a=yield e(n);if(i)return;t(a)}catch(e){n(e)}clearTimeout(a)},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{u(s.next(e))}catch(e){t(e)}}function o(e){try{u(s.throw(e))}catch(e){t(e)}}function u(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(n,o)}u((s=s.apply(i,a||[])).next())}));var i,a,r,s})):Promise.reject("STORAGE_OFFLINE")}getFileWriter(e,t){const n=r.Z.getFakeFileWriter(t,(t=>this.saveFile(e,t).catch((()=>t))));return Promise.resolve(n)}static toggleStorage(e){return Promise.all(this.STORAGES.map((t=>{if(t.useStorage=e,!e)return t.deleteAll()})))}}s.STORAGES=[]},2328:(e,t,n)=>{n.d(t,{Z:()=>r});var i=n(8975),a=n(7151);const r=new class{constructor(){this.blobSupported=!0;try{(0,i.Z)([],"")}catch(e){this.blobSupported=!1}}isAvailable(){return this.blobSupported}write(e,t){return t instanceof Blob?(0,a.Z)(t).then((t=>e.write(t))):e.write(t)}getFakeFileWriter(e,t){const n=[];return{write:e=>{return t=this,i=void 0,r=function*(){if(!this.blobSupported)throw!1;n.push(e)},new((a=void 0)||(a=Promise))((function(e,n){function s(e){try{u(r.next(e))}catch(e){n(e)}}function o(e){try{u(r.throw(e))}catch(e){n(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(s,o)}u((r=r.apply(t,i||[])).next())}));var t,i,a,r},truncate:()=>{n.length=0},finalize:(a=!0)=>{const r=(0,i.Z)(n,e);return a&&t&&t(r),r}}}}},2582:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(4727);class a{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,i.i18n)(e.titleLangKey)),this.subtitle=document.createElement("p"),this.subtitle.className="subtitle",e.subtitleLangKey&&this.subtitle.append((0,i.i18n)(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,n)=>{n.r(t),n.d(t,{default:()=>b});var i=n(4494),a=n(503),r=n(6858),s=n(6765),o=n(4687),u=n(4727),c=n(9518),l=n(8598),h=n(2582),p=n(4874),d=n(8799),m=n(5565);let v=null;const b=new p.Z("page-signUp",!0,(()=>Promise.all([n.e(714),n.e(272)]).then(n.bind(n,8209)).then((e=>{const t=new h.Z({className:"page-signUp",withInputWrapper:!0,titleLangKey:"YourName",subtitleLangKey:"Login.Register.Subtitle"});t.imageDiv.classList.add("avatar-edit"),t.title.classList.add("fullName");const o=document.createElement("canvas");o.id="canvas-avatar",o.className="avatar-edit-canvas";const p=document.createElement("span");p.className="tgico tgico-cameraadd",t.imageDiv.append(o,p);const b=e.default;let g;t.imageDiv.addEventListener("click",(()=>{(new s.Z).open(o,(e=>{g=e}))}));const f=e=>{const n=w.value||"",i=y.value||"",a=n||i?(n+" "+i).trim():"";a?(0,m.Z)(t.title,l.Z.wrapEmojiText(a)):(0,m.Z)(t.title,(0,u.i18n)("YourName"))},w=new a.Z({label:"FirstName",maxLength:70}),y=new a.Z({label:"LastName",maxLength:64}),S=(0,i.Z)("btn-primary btn-color-primary"),Z=new u.default.IntlElement({key:"StartMessaging"});return S.append(Z.element),t.inputWrapper.append(w.container,y.container,S),w.input.addEventListener("input",f),y.input.addEventListener("input",f),S.addEventListener("click",(function(e){if(w.input.classList.contains("error")||y.input.classList.contains("error"))return!1;if(!w.value.length)return w.input.classList.add("error"),!1;this.disabled=!0;const t=w.value.trim(),i=y.value.trim(),a={phone_number:v.phone_number,phone_code_hash:v.phone_code_hash,first_name:t,last_name:i};Z.update({key:"PleaseWait"});const s=(0,r.y7)(this);c.Z.invokeApi("auth.signUp",a).then((e=>{"auth.authorization"===e._?(c.Z.setUser(e.user),new Promise(((e,t)=>{if(!g)return e();g().then((n=>{b.uploadProfilePhoto(n).then(e,t)}),t)})).finally((()=>{n.e(781).then(n.bind(n,5436)).then((e=>{e.default.mount()}))}))):(Z.update({key:e._}),this.removeAttribute("disabled"),s.remove())})).catch((e=>{this.removeAttribute("disabled"),s.remove(),e.type,Z.update({key:e.type})}))})),(0,d.Z)(),new Promise((e=>{window.requestAnimationFrame(e)}))}))),(e=>{v=e,o.default.pushToState("authState",{_:"authStateSignUp",authCode:e})}))}}]);
//# sourceMappingURL=102.e314611ed72b13b03b17.chunk.js.map