mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 18:57:12 +01:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[3041],{51133:(e,t,a)=>{a.r(t),a.d(t,{AuthCode:()=>v,AuthPassword:()=>f,AuthRegister:()=>y});var n=a(14050),r=a(33555),o=a(77361),l=a(60782),s=a(32340),i=a(46590),c=a(59107),d=a(97687),u=a(34288),m=a(83716),h=a(13365),g=a(97799);const Z=o.wB?m.qp:m.z7,p=(0,n.X$)((e=>{let{code:t,codeLength:a,trackingDirection:r,isTracking:o,isBig:l}=e;const[s,i]=(0,n.eJ)(!1),c=165/a,d=(0,n.I4)((()=>i(!0)),[]);return n.ZP.createElement("div",{id:"monkey",className:l?"big":""},!s&&n.ZP.createElement("div",{className:"monkey-preview"}),n.ZP.createElement(g.Z,{size:l?m.K2:Z,className:o?"hidden":void 0,tgsUrl:h.l.MonkeyIdle,play:!o,onLoad:d}),n.ZP.createElement(g.Z,{size:l?m.K2:Z,className:o?"shown":"hidden",tgsUrl:h.l.MonkeyTracking,playSegment:o?function(){const e=t&&t.length>1||r<0?15+c*(t.length-1):0,n=t.length===a?180:15+c*t.length;return r<1?[n,e]:[e,n]}():void 0,speed:2,noLoop:!0}))})),v=(0,n.X$)((0,r.c$)((e=>(0,l.ei)(e,["authPhoneNumber","authIsCodeViaApp","authIsLoading","authError"])))((e=>{let{authPhoneNumber:t,authIsCodeViaApp:a,authIsLoading:l,authError:m}=e;const{setAuthCode:h,returnToAuthPhoneNumber:g,clearAuthError:Z}=(0,r.Sv)(),v=(0,c.Z)(),E=(0,n.sO)(null),[P,f]=(0,n.eJ)(""),[b,N]=(0,n.eJ)(!1),[y,C]=(0,n.eJ)(1);(0,n.d4)((()=>{o.$b||E.current.focus()}),[]),(0,i.Z)({isActive:!0,onBack:g});const w=(0,n.I4)((e=>{m&&Z();const{currentTarget:t}=e;t.value=t.value.replace(/[^\d]+/,"").substr(0,5),t.value!==P&&(f(t.value),b?t.value.length||N(!1):N(!0),P&&P.length>t.value.length?C(-1):C(1),5===t.value.length&&h({code:t.value}))}),[m,Z,P,b,h]);return n.ZP.createElement("div",{id:"auth-code-form",className:"custom-scroll"},n.ZP.createElement("div",{className:"auth-form"},n.ZP.createElement(p,{code:P,codeLength:5,isTracking:b,trackingDirection:y}),n.ZP.createElement("h1",null,t,n.ZP.createElement("div",{className:"auth-number-edit",onClick:g,role:"button",tabIndex:0,title:v("WrongNumber")},n.ZP.createElement("i",{className:"icon-edit"}))),n.ZP.createElement("p",{className:"note"},(0,s.Z)(v(a?"SentAppCode":"Login.JustSentSms"),["simple_markdown"])),n.ZP.createElement(d.Z,{ref:E,id:"sign-in-code",label:v("Code"),onInput:w,value:P,error:m&&v(m),autoComplete:"off",inputMode:"numeric"}),l&&n.ZP.createElement(u.Z,null)))})));var E=a(93490),P=a(99364);const f=(0,n.X$)((0,r.c$)((e=>(0,l.ei)(e,["authIsLoading","authError","authHint"])))((e=>{let{authIsLoading:t,authError:a,authHint:o}=e;const{setAuthPassword:l,clearAuthError:s}=(0,r.Sv)(),i=(0,c.Z)(),[d,u]=(0,n.eJ)(!1),m=(0,n.I4)((e=>{u(e)}),[]),h=(0,n.I4)((e=>{l({password:e})}),[l]);return n.ZP.createElement("div",{id:"auth-password-form",className:"custom-scroll"},n.ZP.createElement("div",{className:"auth-form"},n.ZP.createElement(E.Z,{isPasswordVisible:d}),n.ZP.createElement("h1",null,i("Login.Header.Password")),n.ZP.createElement("p",{className:"note"},i("Login.EnterPasswordDescription")),n.ZP.createElement(P.Z,{clearError:s,error:a&&i(a),hint:o,isLoading:t,isPasswordVisible:d,onChangePasswordVisibility:m,onSubmit:h})))})));var b=a(231),N=a(90710);const y=(0,n.X$)((0,r.c$)((e=>(0,l.ei)(e,["authIsLoading","authError"])))((e=>{let{authIsLoading:t,authError:a}=e;const{signUp:o,clearAuthError:l,uploadProfilePhoto:s}=(0,r.Sv)(),i=(0,c.Z)(),[u,m]=(0,n.eJ)(!1),[h,g]=(0,n.eJ)(),[Z,p]=(0,n.eJ)(""),[v,E]=(0,n.eJ)(""),P=(0,n.I4)((e=>{a&&l();const{target:t}=e;p(t.value),m(t.value.length>0)}),[a,l]),f=(0,n.I4)((e=>{const{target:t}=e;E(t.value)}),[]);return n.ZP.createElement("div",{id:"auth-registration-form",className:"custom-scroll"},n.ZP.createElement("div",{className:"auth-form"},n.ZP.createElement("form",{action:"",method:"post",onSubmit:function(e){e.preventDefault(),o({firstName:Z,lastName:v}),h&&s({file:h})}},n.ZP.createElement(N.Z,{onChange:g}),n.ZP.createElement("h2",null,i("YourName")),n.ZP.createElement("p",{className:"note"},i("Login.Register.Desc")),n.ZP.createElement(d.Z,{id:"registration-first-name",label:i("Login.Register.FirstName.Placeholder"),onChange:P,value:Z,error:a&&i(a),autoComplete:"given-name"}),n.ZP.createElement(d.Z,{id:"registration-last-name",label:i("Login.Register.LastName.Placeholder"),onChange:f,value:v,autoComplete:"family-name"}),u&&n.ZP.createElement(b.Z,{type:"submit",ripple:!0,isLoading:t},i("Next")))))})))},99364:(e,t,a)=>{a.d(t,{Z:()=>u});var n=a(14050),r=a(83716),o=a(77361),l=a(46752),s=a(59107),i=a(28183),c=a(231);const d=o.wB?550:400,u=(0,n.X$)((e=>{let{isLoading:t=!1,isPasswordVisible:a,error:u,hint:m,placeholder:h="Password",submitLabel:g="Next",shouldShowSubmit:Z,shouldResetValue:p,shouldDisablePasswordManager:v=!1,noRipple:E=!1,clearError:P,onChangePasswordVisibility:f,onInputChange:b,onSubmit:N}=e;const y=(0,n.sO)(null),C=(0,s.Z)(),[w,L]=(0,n.eJ)(""),[k,I]=(0,n.eJ)(!1);return(0,n.d4)((()=>{p&&L("")}),[p]),(0,i.Z)((()=>{o.$b||y.current.focus()}),d),(0,n.d4)((()=>{u&&requestAnimationFrame((()=>{y.current.focus(),y.current.select()}))}),[u]),n.ZP.createElement("form",{action:"",onSubmit:function(e){e.preventDefault(),t||k&&N(w)},autoComplete:"off"},n.ZP.createElement("div",{className:(0,l.Z)("input-group password-input",w&&"touched",u&&"error"),dir:C.isRtl?"rtl":void 0},v&&n.ZP.createElement("input",{type:"password",id:"prevent_autofill",autoComplete:"off",className:"visually-hidden",tabIndex:-2}),n.ZP.createElement("input",{ref:y,className:"form-control",type:a?"text":"password",id:"sign-in-password",value:w||"",autoComplete:v?"one-time-code":"current-password",onChange:function(e){u&&P();const{target:t}=e;L(t.value),I(t.value.length>=r.lo),b&&b(t.value)},maxLength:256,dir:"auto"}),n.ZP.createElement("label",null,u||m||h),n.ZP.createElement("div",{className:"toggle-password",onClick:function(){f(!a)},role:"button",tabIndex:0,title:"Toggle password visibility"},n.ZP.createElement("i",{className:a?"icon-eye":"icon-eye-closed"}))),(k||Z)&&n.ZP.createElement(c.Z,{type:"submit",ripple:!E,isLoading:t,disabled:!k},g))}))},93490:(e,t,a)=>{a.d(t,{Z:()=>g});var n=a(14050),r=a(83716),o=a(77361),l=a(13365),s=a(97799),i=a(28183),c=a(60706);const d=[0,50],u=[0,20],m=[20,0],h=o.wB?r.qp:r.z7,g=(0,n.X$)((e=>{let{isPasswordVisible:t,isBig:a}=e;const[o,g]=(0,c.Z)(!1),[Z,p]=(0,c.Z)(!1);(0,i.Z)(p,2e3);const v=(0,n.I4)(g,[g]);return n.ZP.createElement("div",{id:"monkey",className:a?"big":""},!o&&n.ZP.createElement("div",{className:"monkey-preview"}),n.ZP.createElement(s.Z,{size:a?r.K2:h,className:Z?"hidden":"shown",tgsUrl:l.l.MonkeyClose,playSegment:d,noLoop:!0,onLoad:v}),n.ZP.createElement(s.Z,{size:a?r.K2:h,className:Z?"shown":"hidden",tgsUrl:l.l.MonkeyPeek,playSegment:t?u:m,noLoop:!0}))}))},90710:(e,t,a)=>{a.d(t,{Z:()=>p});var n=a(14050),r=a(46752),o=a(83716),l=a(71394),s=a(59107),i=a(231),c=a(13103),d=a(34288);const u={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let m,h,g;const Z=(0,n.X$)((e=>{let{file:t,onChange:r,onClose:Z}=e;const[p,v]=(0,n.eJ)(!1);(0,n.d4)((()=>{t&&(p?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:a,offsetHeight:n}=t;g=new m(t,{enableZoom:!0,boundary:{width:a,height:n},viewport:{width:a-16,height:n-16,type:"circle"}});const r=await(0,l.YJ)(e);await g.bind({url:r})}catch(e){o.eM&&console.error(e)}}(t):async function(){return h||(h=Promise.all([a.e(5099),a.e(3472)]).then(a.bind(a,23472)),m=(await h).default),h}().then((()=>v(!0))))}),[t,p]);const E=(0,s.Z)(),P=(0,n.I4)((async()=>{if(!g)return;const e=await g.result(u),t="string"==typeof e?e:(0,l.hl)(e,"avatar.jpg");r(t)}),[r]);return n.ZP.createElement(c.Z,{isOpen:Boolean(t),onClose:Z,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},p?n.ZP.createElement("div",{id:"avatar-crop"}):n.ZP.createElement(d.Z,null),n.ZP.createElement(i.Z,{className:"confirm-button",round:!0,color:"primary",onClick:P,ariaLabel:E("CropImage")},n.ZP.createElement("i",{className:"icon-check"})))})),p=(0,n.X$)((e=>{let{title:t="Change your profile picture",disabled:a,currentAvatarBlobUrl:o,onChange:l}=e;const[s,i]=(0,n.eJ)(),[c,d]=(0,n.eJ)(o);(0,n.d4)((()=>{d(o)}),[o]);const u=(0,n.I4)((e=>{i(void 0),l(e),c&&URL.revokeObjectURL(c),d(URL.createObjectURL(e))}),[c,l]),m=(0,n.I4)((()=>{i(void 0)}),[]),h=(0,r.Z)(c&&"filled",a&&"disabled");return n.ZP.createElement("div",{className:"AvatarEditable"},n.ZP.createElement("label",{className:h,role:"button",tabIndex:0,title:t},n.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(i(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),n.ZP.createElement("i",{className:"icon-camera-add"}),c&&n.ZP.createElement("img",{src:c,alt:"Avatar"})),n.ZP.createElement(Z,{file:s,onClose:m,onChange:u}))}))},13103:(e,t,a)=>{a.d(t,{Z:()=>h});var n=a(14050),r=a(517),o=a(46752),l=a(18674),s=a(31212),i=a(274),c=a(59107),d=a(46590),u=a(231),m=a(62898);const h=e=>{let{dialogRef:t,title:a,className:h,isOpen:g,header:Z,hasCloseButton:p,noBackdrop:v,children:E,style:P,onClose:f,onCloseAnimationEnd:b,onEnter:N,shouldSkipHistoryAnimations:y}=e;const{shouldRender:C,transitionClassNames:w}=(0,s.Z)(g,b,y,void 0,y),L=(0,n.sO)(null);(0,n.d4)((()=>g?(0,r.Z)({onEsc:f,onEnter:N}):void 0),[g,f,N]),(0,n.d4)((()=>g&&L.current?function(e){function t(t){if("Tab"!==t.key)return;t.preventDefault(),t.stopPropagation();const a=Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(!a.length)return;const n=a.findIndex((e=>e.isSameNode(document.activeElement)));let r=0;n>=0&&(r=t.shiftKey?n>0?n-1:a.length-1:n<a.length-1?n+1:0),a[r].focus()}return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}(L.current):void 0),[g]),(0,d.Z)({isActive:g,onBack:f}),(0,i.Z)((e=>{let[t]=e;return document.body.classList.toggle("has-open-dialog",Boolean(g)),(g||!g&&void 0!==t)&&(0,l.YW)(200),()=>{document.body.classList.remove("has-open-dialog")}}),[g]);const k=(0,c.Z)();if(!C)return;const I=(0,o.Z)("Modal",h,w,v&&"transparent-backdrop");return n.ZP.createElement(m.Z,null,n.ZP.createElement("div",{ref:L,className:I,tabIndex:-1,role:"dialog"},n.ZP.createElement("div",{className:"modal-container"},n.ZP.createElement("div",{className:"modal-backdrop",onClick:f}),n.ZP.createElement("div",{className:"modal-dialog",ref:t},Z||(a?n.ZP.createElement("div",{className:"modal-header"},p&&n.ZP.createElement(u.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:k("Close"),onClick:f},n.ZP.createElement("i",{className:"icon-close"})),n.ZP.createElement("div",{className:"modal-title"},a)):void 0),n.ZP.createElement("div",{className:"modal-content custom-scroll",style:P},E)))))}},62898:(e,t,a)=>{a.d(t,{Z:()=>o});var n=a(14050),r=a(31664);const o=e=>{let{containerId:t,className:a,children:o}=e;const l=(0,n.sO)();return l.current||(l.current=document.createElement("div")),(0,n.bt)((()=>{const e=document.querySelector(t||"#portals");if(!e)return;const n=l.current;return a&&n.classList.add(a),e.appendChild(n),()=>{r.Z.render(void 0,n),e.removeChild(n)}}),[a,t]),r.Z.render(o,l.current)}},28183:(e,t,a)=>{a.d(t,{Z:()=>r});var n=a(14050);const r=function(e,t){const a=(0,n.sO)(e);(0,n.bt)((()=>{a.current=e}),[e]),(0,n.d4)((()=>{if("number"!=typeof t)return;const e=setTimeout((()=>a.current()),t);return()=>clearTimeout(e)}),[t])}}}]);
|
|
//# sourceMappingURL=3041.3d585976d54df343ee75.js.map
|