tweb/public/4.73d6f3573b27676bc073.chunk.js
2022-04-26 00:08:39 +03:00

2 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(this.webpackJsonp=this.webpackJsonp||[]).push([[4],{120:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var s=n(14);function i(e,t=!1){if(!s.a||t&&document.activeElement===e)if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var n=document.createRange();n.selectNodeContents(e),n.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(n)}else if(void 0!==document.body.createTextRange){var o=document.body.createTextRange();o.moveToElementText(e),o.collapse(!1),o.select()}}},121:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(7);const i=new Map;let o=0;const c=(e,t,n="")=>{n=t.country_code+n,o=Math.max(o,n.length),i.set(n,{country:e,code:t})};function a(e){e=e||"",i.size||s.c.countriesList.forEach(e=>{e.country_codes.forEach(t=>{t.prefixes?t.prefixes.forEach(n=>{c(e,t,n)}):c(e,t)})});let t,n=e.replace(/\D/g,""),a=n.slice(0,o);for(let e=a.length-1;e>=0&&(t=i.get(a.slice(0,e+1)),!t);--e);if(!t)return{formatted:n,country:void 0,code:void 0,leftPattern:""};const r=t.country,l=t.code.patterns||[],d=n.slice(t.code.country_code.length);let h="",u=0,p="";for(let e=l.length-1;e>=0;--e){h=l[e];const t=h.replace(/ /g,"");let n=0;for(let e=0,s=Math.min(d.length,t.length);e<s;++e){if(d[e]!==t[e]&&"X"!==t[e]){n=0;break}++n}n>u&&(u=n,p=h)}h=p||h,h=h.replace(/\d/g,"X"),h=t.code.country_code+" "+h,h.split("").forEach((e,t)=>{" "===e&&" "!==n[t]&&n.length>t&&(n=n.slice(0,t)+" "+n.slice(t))});let m=h&&h.length>n.length?h.slice(n.length):"";return m&&(m=m.replace(/X/g,"")),{formatted:n,country:r,code:t.code,leftPattern:m}}},154:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(120),i=n(121),o=n(2),c=n(65);class a extends c.b{constructor(e={}){super(Object.assign({label:"Contacts.PhoneNumber.Placeholder",name:"phone"},e)),this.pasted=!1,this.lastValue="",this.container.classList.add("input-field-phone");let t=this.input;if(t instanceof HTMLInputElement)t.type="tel",t.autocomplete="rr55RandomRR55";else{t.inputMode="decimal";const e=window.devicePixelRatio;if(e>1){let n;o.b?n=-.16*e:o.a&&(n=0),t.style.setProperty("--letter-spacing",n+"px")}const n=this.setValueSilently.bind(this);this.setValueSilently=e=>{n(e),Object(s.a)(this.input,!0)}}t.addEventListener("input",()=>{t.classList.remove("error");const n=this.value;let s;Math.abs(n.length-this.lastValue.length)>1&&!this.pasted&&o.c&&this.setValueSilently(this.lastValue+n),this.pasted=!1,this.setLabel();let c,a,r,l="";"+"===this.value.replace(/\++/,"+")?this.setValueSilently("+"):(s=Object(i.a)(this.value),c=s.formatted,a=s.country,l=s.leftPattern,r=s.code,this.setValueSilently(this.lastValue=c?"+"+c:"")),t.dataset.leftPattern=l,e.onInput&&e.onInput(s)}),t.addEventListener("paste",()=>{this.pasted=!0}),t.addEventListener("keypress",e=>{const t=e.key;if(/\D/.test(t)&&!e.metaKey&&!e.ctrlKey&&"Backspace"!==t&&("+"!==t||!e.shiftKey))return e.preventDefault(),!1})}}},168:function(e,t,n){"use strict";n.r(t);var s=n(61),i=n(67),o=n(35),c=n(8),a=n(27),r=n(90),l=n(65),d=n(70),h=n(58),u=n(102),p=n(14),m=n(5),g=n(7),f=n(71),b=n(77),v=n(85),L=n(34),y=n(21),S=n(12),E=n(187),w=n(165),k=n(125),x=n(33),O=n(57),j=n(59),A=n(78),T=n(6),_=n(120),P=n(28),C=n(114),N=n(11),V=n(0),H=n(154),M=n(23),D=n(66),I=function(e,t,n,s){return new(n||(n=Promise))((function(i,o){function c(e){try{r(s.next(e))}catch(e){o(e)}}function a(e){try{r(s.throw(e))}catch(e){o(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}r((s=s.apply(e,t||[])).next())}))};let R,B=null;const K=new r.a("page-sign",!0,()=>{const e=()=>{t=g.c.countriesList.filter(e=>{var t;return!(null===(t=e.pFlags)||void 0===t?void 0:t.hidden)}).sort((e,t)=>(e.name||e.default_name).localeCompare(t.name||t.default_name))};let t;e(),V.a.addEventListener("language_change",()=>{e()});const r=new Map;let b,F;const U=document.createElement("div");U.classList.add("input-wrapper");const W=new l.b({label:"Login.CountrySelectorLabel",name:Object(y.b)()});W.container.classList.add("input-select");const z=W.input,X=document.createElement("div");X.classList.add("select-wrapper","z-depth-3","hide");const q=document.createElement("span");q.classList.add("arrow","arrow-down"),W.container.append(q);const J=document.createElement("ul");X.appendChild(J);new i.b(X);let Q=()=>{Q=null,t.forEach(e=>{const t=Object(P.c)(e.iso2),n=[];e.country_codes.forEach(s=>{const i=document.createElement("li");let o=a.a.wrapEmojiText(t);if(M.a){const e=document.createElement("span");Object(D.a)(e,o),i.append(e)}else Object(D.a)(i,o);const c=Object(g.d)(e.default_name);c.dataset.defaultName=e.default_name,i.append(c);const r=document.createElement("span");r.classList.add("phone-code"),r.innerText="+"+s.country_code,i.appendChild(r),n.push(i),J.append(i)}),r.set(e.iso2,n)}),J.addEventListener("mousedown",e=>{if(0!==e.button)return;const t=Object(v.a)(e.target,"LI");Y(t)}),W.container.appendChild(X)};const Y=e=>{const n=e.childNodes[1].dataset.defaultName,s=e.querySelector(".phone-code").innerText,i=s.replace(/\D/g,"");Object(j.a)(z,Object(g.d)(n)),Object(C.a)(z,"input"),b=t.find(e=>e.default_name===n),F=b.country_codes.find(e=>e.country_code===i),te.value=te.lastValue=s,ee(),setTimeout(()=>{ne.focus(),Object(_.a)(ne,!0)},0)};let $;Q(),z.addEventListener("focus",(function(e){Q?Q():t.forEach(e=>{r.get(e.iso2).forEach(e=>e.style.display="")}),clearTimeout($),$=void 0,X.classList.remove("hide"),X.offsetWidth,X.classList.add("active"),W.select(),Object(u.b)({container:K.pageEl.parentElement.parentElement,element:z,position:"start",margin:4}),setTimeout(()=>{G||(document.addEventListener("mousedown",Z,{capture:!0}),G=!0)},0)}));let G=!1;const Z=e=>{Object(L.a)(e.target,"input-select")||e.target!==z&&(ee(),document.removeEventListener("mousedown",Z,{capture:!0}),G=!1)},ee=()=>{void 0===$&&(X.classList.remove("active"),$=window.setTimeout(()=>{X.classList.add("hide"),$=void 0},200))};z.addEventListener("keyup",e=>{const n=e.key;if(e.ctrlKey||"Control"===n)return!1;let s=W.value.toLowerCase(),i=[];t.forEach(e=>{const t=[e.name,e.default_name,e.iso2];t.filter(Boolean).forEach(e=>{const n=e.split(" ").filter(e=>/\w/.test(e)).map(e=>e[0]).join("");n.length>1&&t.push(n)});let n=!!t.filter(Boolean).find(e=>-1!==e.toLowerCase().indexOf(s));r.get(e.iso2).forEach(e=>e.style.display=n?"":"none"),n&&i.push(e)}),0===i.length?t.forEach(e=>{r.get(e.iso2).forEach(e=>e.style.display="")}):1===i.length&&"Enter"===n&&Y(r.get(i[0].iso2)[0])}),q.addEventListener("mousedown",(function(e){e.cancelBubble=!0,e.preventDefault(),z.matches(":focus")?z.blur():z.focus()}));const te=new H.a({onInput:e=>{f.a.loadLottieWorkers();const{country:t,code:n}=e||{};let s=t?t.name||t.default_name:"";s===W.value||b&&t&&n&&(b===t||F.country_code===n.country_code)||(Object(j.a)(z,t?Object(g.d)(t.default_name):s),b=t,F=n),t||te.value.length-1>1?B.style.visibility="":B.style.visibility="hidden"}}),ne=te.input;ne.addEventListener("keypress",e=>{if(!B.style.visibility&&"Enter"===e.key)return ie()});const se=new d.a({text:"Login.KeepSigned",name:"keepSession",withRipple:!0,checked:!0});se.input.addEventListener("change",()=>{const e=se.checked;o.c.pushToState("keepSigned",e),S.a.toggleStorage(e),E.a.toggleStorage(e),c.a.toggleStorage(e),T.a.toggleStorage(e)}),o.c.getState().then(e=>{o.c.storage.isAvailable()?se.checked=e.keepSigned:(se.checked=!1,se.label.classList.add("checkbox-disabled"))}),B=Object(h.a)("btn-primary btn-color-primary",{text:"Login.Next"}),B.style.visibility="hidden";const ie=e=>{e&&Object(x.a)(e);const t=Object(A.a)([B,R],!0);Object(j.a)(B,Object(g.d)("PleaseWait")),Object(s.f)(B);let i=te.value;c.a.invokeApi("auth.sendCode",{phone_number:i,api_id:m.a.id,api_hash:m.a.hash,settings:{_:"codeSettings"}}).then(e=>{n.e(18).then(n.bind(null,170)).then(t=>t.default.mount(Object.assign(e,{phone_number:i})))}).catch(e=>{switch(t(),e.type){case"PHONE_NUMBER_INVALID":te.setError(),Object(j.a)(te.label,Object(g.d)("Login.PhoneLabelInvalid")),ne.classList.add("error"),Object(j.a)(B,Object(g.d)("Login.Next"));break;default:console.error("auth.sendCode error:",e),B.innerText=e.type}})};Object(O.b)(B,ie),R=Object(h.a)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Login"});R.addEventListener("click",()=>{w.default.mount()}),U.append(W.container,te.container,se.label,B,R);const oe=document.createElement("h4");oe.classList.add("text-center"),Object(g.b)(oe,"Login.Title");const ce=document.createElement("div");ce.classList.add("subtitle","text-center"),Object(g.b)(ce,"Login.StartText"),K.pageEl.querySelector(".container").append(oe,ce,U);p.a||setTimeout(()=>{ne.focus()},0),Object(k.a)(U),c.a.invokeApi("help.getNearestDc").then(e=>{var t;const n=N.a.getFromCache("langPack");n&&!(null===(t=n.countries)||void 0===t?void 0:t.hash)&&g.c.getLangPack(n.lang_code).then(()=>{Object(C.a)(ne,"input")});const s=new Set([1,2,3,4,5]),i=[e.this_dc];let o;return e.nearest_dc!==e.this_dc&&(o=c.a.getNetworker(e.nearest_dc).then(()=>{i.push(e.nearest_dc)})),(o||Promise.resolve()).then(()=>{i.forEach(e=>{s.delete(e)});const e=[...s],t=()=>I(void 0,void 0,void 0,(function*(){const n=e.shift();if(!n)return;const s=`dc${n}_auth_key`;if(yield T.a.get(s))return t();setTimeout(()=>{c.a.getNetworker(n).finally(t)},3e3)}));t()}),e}).then(e=>{W.value.length||te.value.length||Y(r.get(e.country)[0])})},()=>{B&&(Object(j.a)(B,Object(g.d)("Login.Next")),Object(b.a)(B,void 0,void 0,!0),B.removeAttribute("disabled")),R&&R.removeAttribute("disabled"),o.c.pushToState("authState",{_:"authStateSignIn"})});t.default=K},67:function(e,t,n){"use strict";n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return d}));var s=n(14),i=n(4),o=n(102),c=n(93),a=n(33);class r{constructor(e,t="",n=document.createElement("div")){this.el=e,this.container=n,this.onScrollMeasure=0,this.lastScrollPosition=0,this.lastScrollDirection=0,this.isHeavyAnimationInProgress=!1,this.needCheckAfterAnimation=!1,this.onScroll=()=>{if(this.isHeavyAnimationInProgress)return this.cancelMeasure(),void(this.needCheckAfterAnimation=!0);(this.onScrolledTop||this.onScrolledBottom||this.splitUp||this.onAdditionalScroll)&&(this.onScrollMeasure||(this.onScrollMeasure=window.requestAnimationFrame(()=>{this.onScrollMeasure=0;const e=this.container[this.scrollProperty];this.lastScrollDirection=this.lastScrollPosition===e?0:this.lastScrollPosition<e?1:-1,this.lastScrollPosition=e,this.onAdditionalScroll&&this.onAdditionalScroll(),this.checkForTriggers&&this.checkForTriggers()})))},this.container.classList.add("scrollable"),this.log=Object(i.b)("SCROLL"+(t?"-"+t:""),i.a.Error),e&&(Array.from(e.children).forEach(e=>this.container.append(e)),e.append(this.container))}addScrollListener(){this.addedScrollListener||(this.addedScrollListener=!0,this.container.addEventListener("scroll",this.onScroll,{passive:!0,capture:!0}))}removeScrollListener(){this.addedScrollListener&&(this.addedScrollListener=!1,this.container.removeEventListener("scroll",this.onScroll,{capture:!0}))}setListeners(){this.removeHeavyAnimationListener||(window.addEventListener("resize",this.onScroll,{passive:!0}),this.addScrollListener(),this.removeHeavyAnimationListener=Object(c.a)(()=>{this.isHeavyAnimationInProgress=!0,this.onScrollMeasure&&(this.cancelMeasure(),this.needCheckAfterAnimation=!0)},()=>{this.isHeavyAnimationInProgress=!1,this.needCheckAfterAnimation&&(this.onScroll(),this.needCheckAfterAnimation=!1)}))}removeListeners(){this.removeHeavyAnimationListener&&(window.removeEventListener("resize",this.onScroll),this.removeScrollListener(),this.removeHeavyAnimationListener(),this.removeHeavyAnimationListener=void 0)}append(e){this.container.append(e)}scrollIntoViewNew(e){return Object(o.b)(Object.assign(Object.assign({},e),{container:this.container}))}cancelMeasure(){this.onScrollMeasure&&(window.cancelAnimationFrame(this.onScrollMeasure),this.onScrollMeasure=0)}}class l extends r{constructor(e,t="",n=300,s){super(e,t),this.onScrollOffset=n,this.loadedAll={top:!0,bottom:!1},this.checkForTriggers=()=>{if(!this.onScrolledTop&&!this.onScrolledBottom)return;if(this.isHeavyAnimationInProgress)return void this.onScroll();const e=this.container.scrollHeight;if(!e)return;const t=e-this.container.clientHeight,n=this.lastScrollPosition;this.onScrolledTop&&n<=this.onScrollOffset&&this.lastScrollDirection<=0&&this.onScrolledTop(),this.onScrolledBottom&&t-n<=this.onScrollOffset&&this.lastScrollDirection>=0&&this.onScrolledBottom()},this.container.classList.add("scrollable-y"),this.setListeners(),this.scrollProperty="scrollTop"}setVirtualContainer(e){this.splitUp=e,this.log("setVirtualContainer:",e,this)}prepend(...e){(this.splitUp||this.padding||this.container).prepend(...e)}append(...e){(this.splitUp||this.padding||this.container).append(...e)}getDistanceToEnd(){return this.scrollHeight-Math.round(this.scrollTop+this.container.offsetHeight)}get isScrolledDown(){return this.getDistanceToEnd()<=1}set scrollTop(e){this.container.scrollTop=e}get scrollTop(){return this.container.scrollTop}setScrollTopSilently(e){this.lastScrollPosition=e,this.ignoreNextScrollEvent(),this.scrollTop=e}ignoreNextScrollEvent(){this.removeHeavyAnimationListener&&(this.removeScrollListener(),this.container.addEventListener("scroll",e=>{Object(a.a)(e),this.addScrollListener()},{capture:!0,passive:!1,once:!0}))}get scrollHeight(){return this.container.scrollHeight}}class d extends r{constructor(e,t="",n=300,i=15,o=document.createElement("div")){if(super(e,t,o),this.onScrollOffset=n,this.splitCount=i,this.container=o,this.container.classList.add("scrollable-x"),!s.a){const e=e=>{!e.deltaX&&this.container.scrollWidth>this.container.clientWidth&&(this.container.scrollLeft+=e.deltaY/4,Object(a.a)(e))};this.container.addEventListener("wheel",e,{passive:!1})}this.scrollProperty="scrollLeft"}}},70:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(35),i=n(77),o=n(7),c=n(45);class a{constructor(e={}){const t=this.label=document.createElement("label");t.classList.add("checkbox-field"),e.restriction&&t.classList.add("checkbox-field-restriction"),e.round&&t.classList.add("checkbox-field-round"),e.disabled&&this.toggleDisability(!0);const n=this.input=document.createElement("input");let a;if(n.classList.add("checkbox-field-input"),n.type="checkbox",e.name&&(n.id="input-"+e.name),e.checked&&(n.checked=!0),e.stateKey&&s.c.getState().then(t=>{const i=Object(c.a)(t,e.stateKey);let o;o=e.stateValues?1===e.stateValues.indexOf(i):i,this.setValueSilently(o),n.addEventListener("change",()=>{let t;t=e.stateValues?e.stateValues[n.checked?1:0]:n.checked,s.c.setByKey(e.stateKey,t)})}),e.text?(a=this.span=document.createElement("span"),a.classList.add("checkbox-caption"),Object(o.b)(a,e.text,e.textArgs)):t.classList.add("checkbox-without-caption"),t.append(n),e.toggle){t.classList.add("checkbox-field-toggle");const e=document.createElement("div");e.classList.add("checkbox-toggle"),t.append(e)}else{const e=document.createElement("div");e.classList.add("checkbox-box");const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.classList.add("checkbox-box-check"),n.setAttributeNS(null,"viewBox","0 0 24 24");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttributeNS(null,"href","#check"),s.setAttributeNS(null,"x","-1"),n.append(s);const i=document.createElement("div");i.classList.add("checkbox-box-background");const o=document.createElement("div");o.classList.add("checkbox-box-border"),e.append(o,i,n),t.append(e)}a&&t.append(a),e.withRipple?(t.classList.add("checkbox-ripple","hover-effect"),Object(i.a)(t,void 0,void 0,!0)):e.withHover&&t.classList.add("hover-effect")}get checked(){return this.input.checked}set checked(e){this.setValueSilently(e);const t=new Event("change",{bubbles:!0,cancelable:!0});this.input.dispatchEvent(t)}setValueSilently(e){this.input.checked=e}toggleDisability(e){return this.label.classList.toggle("checkbox-disabled",e),()=>this.toggleDisability(!e)}}},78:function(e,t,n){"use strict";function s(e,t){return t?e.forEach(e=>e.setAttribute("disabled","true")):e.forEach(e=>e.removeAttribute("disabled")),()=>s(e,!t)}n.d(t,"a",(function(){return s}))},85:function(e,t,n){"use strict";function s(e,t){return e.closest(t)}n.d(t,"a",(function(){return s}))}}]);
//# sourceMappingURL=4.73d6f3573b27676bc073.chunk.js.map