tweb/public/13.184423eff507467bcd0c.chunk.js.map
morethanwords 2c96983f84 (commit before) fixed changing profile (#4119)
Include source maps
2021-04-16 22:04:15 +04:00

1 line
65 KiB
Plaintext
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.

{"version":3,"sources":["webpack:///./src/components/button.ts","webpack:///./src/components/inputField.ts","webpack:///./src/components/ripple.ts","webpack:///./src/components/scrollable.ts","webpack:///./src/components/checkboxField.ts","webpack:///./src/helpers/dom/findUpTag.ts","webpack:///./src/pages/pageSignIn.ts"],"names":["className","options","button","document","createElement","icon","noRipple","rippleSquare","classList","add","onlyMobile","disabled","text","append","init","addEventListener","e","target","hasAttribute","parentElement","preventDefault","originalEvent","clipboardData","getData","entities","parseEntities","filter","_","wrapRichText","noLinks","wrappingDraft","window","execCommand","checkAndSetRTL","input","char","HTMLInputElement","value","innerText","direction","style","InputState","this","container","maxLength","showLengthOn","Math","round","placeholder","name","plainText","processInput","label","labelText","innerHTML","firstElementChild","observer","MutationObserver","inputFake","onFakeInput","observe","characterData","childList","subtree","animate","wasInputFakeClientHeight","showScrollDebounced","remove","setAttribute","undefined","setLabel","labelEl","lastElementChild","showingLength","wasError","contains","inputLength","length","diff","isError","toggle","select","textContent","labelOptions","scrollHeight","clientHeight","height","setValueSilently","event","Event","bubbles","cancelable","dispatchEvent","fireFakeInput","originalValue","silent","wrapDraftText","state","Error","Valid","setState","rippleClickId","ripple","elem","callback","Promise","resolve","onEnd","prepend","querySelector","r","handler","drawRipple","clientX","clientY","startTime","Date","now","clickId","duration","getComputedStyle","getPropertyValue","replace","elapsedTime","cb","mutate","delay","max","setTimeout","removeEventListener","touchStartFired","requestAnimationFrame","rect","getBoundingClientRect","clickX","left","clickY","top","size","sqrt","abs","width","x","y","touchEnd","settings","animationsEnabled","touches","includes","tagName","once","cancelBubble","stopPropagation","passive","dataset","ScrollableBase","el","logPrefix","onScrollMeasure","isHeavyAnimationInProgress","needCheckAfterAnimation","log","error","Array","from","children","forEach","c","onScroll","capture","cancelAnimationFrame","element","position","margin","maxDistance","forceDirection","forceDuration","axis","Scrollable","onScrollOffset","withPaddingContainer","super","onAdditionalScroll","onScrolledTop","onScrolledBottom","lastScrollTop","lastScrollDirection","loadedAll","bottom","splitUp","scrollTop","checkForTriggers","maxScrollTop","setListeners","elements","padding","offsetHeight","getDistanceToEnd","ScrollableX","splitCount","scrollHorizontally","deltaX","scrollLeft","deltaY","CheckboxField","restriction","toggleDisability","span","type","id","checked","stateKey","getState","then","setByKey","textArgs","box","checkSvg","createElementNS","setAttributeNS","use","bg","border","withRipple","withHover","disable","findUpTag","tag","closest","btnQr","btnNext","page","test","push","phoneCode","code","emoji","pattern","console","countries","sort","a","b","localeCompare","lastCountrySelected","inputWrapper","countryInputField","countryInput","autocomplete","selectWrapper","arrowDown","selectList","appendChild","hideTimeout","initedSelect","initSelect","liArr","split","li","spanEmoji","kek","outerHTML","countryName","childNodes","find","telEl","lastValue","focus","display","clearTimeout","offsetWidth","pageEl","mouseDownHandlerAttached","onMouseDown","hidePicker","ctrlKey","key","_value","toLowerCase","matches","good","indexOf","blur","pasted","telInputField","loadLottieWorkers","formatted","country","o","visibility","metaKey","shiftKey","onSubmit","signedCheckboxField","phone_number","invokeApi","api_id","api_hash","hash","m","default","mount","Object","assign","catch","err","setError","qrMounted","promise","preloaderDiv","module","removeAttribute","h4","subtitle","config","suggested_lang_code","lastRequestedLangCode","all","getStrings","getCacheLangPack","res","backup","string","backupString","strings","get","set","btnChangeLanguage","getLangPack","nearestDcResult","dcs","done","this_dc","nearest_dc","getNetworker","g","dcId","shift","fileDownload","finally","pushToState","saveState"],"mappings":"yFAAA,mBAoCe,IA3BA,CAACA,EAAmBC,EAA+H,MAChK,MAAMC,EAASC,SAASC,cAAc,UAuBtC,OAtBAF,EAAOF,UAAYA,GAAaC,EAAQI,KAAO,UAAYJ,EAAQI,KAAO,IAEtEJ,EAAQK,WACPL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n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport { i18n, LangPackKey } from \"../lib/langPack\";\nimport { ripple } from \"./ripple\";\n\nconst Button = (className: string, options: Partial<{noRipple: true, onlyMobile: true, icon: string, rippleSquare: true, text: LangPackKey, disabled: boolean}> = {}) => {\n const button = document.createElement('button');\n button.className = className + (options.icon ? ' tgico-' + options.icon : '');\n\n if(!options.noRipple) {\n if(options.rippleSquare) {\n button.classList.add('rp-square');\n }\n\n ripple(button);\n }\n\n if(options.onlyMobile) {\n button.classList.add('only-handhelds');\n }\n\n if(options.disabled) {\n button.disabled = true;\n }\n\n if(options.text) {\n button.append(i18n(options.text));\n }\n\n return button;\n};\n\nexport default Button;\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport { getRichValue, isInputEmpty } from \"../helpers/dom\";\nimport { debounce } from \"../helpers/schedulers\";\nimport { checkRTL } from \"../helpers/string\";\nimport { i18n, LangPackKey, _i18n } from \"../lib/langPack\";\nimport RichTextProcessor from \"../lib/richtextprocessor\";\n\nlet init = () => {\n document.addEventListener('paste', (e) => {\n if(!(e.target as HTMLElement).hasAttribute('contenteditable') && !(e.target as HTMLElement).parentElement.hasAttribute('contenteditable')) {\n return;\n }\n //console.log('document paste');\n\n //console.log('messageInput paste');\n\n e.preventDefault();\n // @ts-ignore\n let text = (e.originalEvent || e).clipboardData.getData('text/plain');\n\n let entities = RichTextProcessor.parseEntities(text);\n //console.log('messageInput paste', text, entities);\n entities = entities.filter(e => e._ === 'messageEntityEmoji' || e._ === 'messageEntityLinebreak');\n //text = RichTextProcessor.wrapEmojiText(text);\n text = RichTextProcessor.wrapRichText(text, {entities, noLinks: true, wrappingDraft: true});\n\n // console.log('messageInput paste after', text);\n\n // @ts-ignore\n //let html = (e.originalEvent || e).clipboardData.getData('text/html');\n\n // @ts-ignore\n //console.log('paste text', text, );\n window.document.execCommand('insertHTML', false, text);\n });\n\n init = null;\n};\n\nconst checkAndSetRTL = (input: HTMLElement) => {\n //const isEmpty = isInputEmpty(input);\n //console.log('input', isEmpty);\n\n //const char = [...getRichValue(input)][0];\n const char = (input instanceof HTMLInputElement ? input.value : input.innerText)[0];\n let direction = 'ltr';\n if(char && checkRTL(char)) {\n direction = 'rtl';\n }\n\n //console.log('RTL', direction, char);\n\n input.style.direction = direction;\n};\n\nexport enum InputState {\n Neutral = 0,\n Valid = 1,\n Error = 2\n};\n\nexport type InputFieldOptions = {\n placeholder?: LangPackKey, \n label?: LangPackKey, \n labelOptions?: any[],\n labelText?: string,\n name?: string, \n maxLength?: number, \n showLengthOn?: number,\n plainText?: true,\n animate?: true\n};\n\nclass InputField {\n public container: HTMLElement;\n public input: HTMLElement;\n public inputFake: HTMLElement;\n public label: HTMLLabelElement;\n\n public originalValue: string;\n\n //public onLengthChange: (length: number, isOverflow: boolean) => void;\n protected wasInputFakeClientHeight: number;\n protected showScrollDebounced: () => void;\n\n constructor(public options: InputFieldOptions = {}) {\n this.container = document.createElement('div');\n this.container.classList.add('input-field');\n\n if(options.maxLength) {\n options.showLengthOn = Math.round(options.maxLength / 3);\n }\n\n const {placeholder, maxLength, showLengthOn, name, plainText} = options;\n\n let label = options.label || options.labelText;\n\n let input: HTMLElement;\n if(!plainText) {\n if(init) {\n init();\n }\n\n this.container.innerHTML = `\n <div contenteditable=\"true\" class=\"input-field-input\"></div>\n `;\n\n input = this.container.firstElementChild as HTMLElement;\n const observer = new MutationObserver(() => {\n checkAndSetRTL(input);\n\n if(processInput) {\n processInput();\n }\n });\n\n // * because if delete all characters there will br left\n input.addEventListener('input', () => {\n if(isInputEmpty(input)) {\n input.innerHTML = '';\n }\n\n if(this.inputFake) {\n this.inputFake.innerHTML = input.innerHTML;\n this.onFakeInput();\n }\n });\n \n // ! childList for paste first symbol\n observer.observe(input, {characterData: true, childList: true, subtree: true});\n\n if(options.animate) {\n input.classList.add('scrollable', 'scrollable-y');\n this.wasInputFakeClientHeight = 0;\n this.showScrollDebounced = debounce(() => this.input.classList.remove('no-scrollbar'), 150, false, true);\n this.inputFake = document.createElement('div');\n this.inputFake.setAttribute('contenteditable', 'true');\n this.inputFake.className = input.className + ' input-field-input-fake';\n }\n } else {\n this.container.innerHTML = `\n <input type=\"text\" ${name ? `name=\"${name}\"` : ''} autocomplete=\"off\" ${label ? 'required=\"\"' : ''} class=\"input-field-input\">\n `;\n\n input = this.container.firstElementChild as HTMLElement;\n input.addEventListener('input', () => checkAndSetRTL(input));\n }\n\n if(placeholder) {\n _i18n(input, placeholder, undefined, 'placeholder');\n\n if(this.inputFake) {\n _i18n(this.inputFake, placeholder, undefined, 'placeholder');\n }\n }\n\n if(label) {\n this.label = document.createElement('label');\n this.setLabel();\n this.container.append(this.label);\n }\n\n let processInput: () => void;\n if(maxLength) {\n const labelEl = this.container.lastElementChild as HTMLLabelElement;\n let showingLength = false;\n\n processInput = () => {\n const wasError = input.classList.contains('error');\n // * https://stackoverflow.com/a/54369605 #2 to count emoji as 1 symbol\n const inputLength = plainText ? (input as HTMLInputElement).value.length : [...getRichValue(input)].length;\n const diff = maxLength - inputLength;\n const isError = diff < 0;\n input.classList.toggle('error', isError);\n\n //this.onLengthChange && this.onLengthChange(inputLength, isError);\n\n if(isError || diff <= showLengthOn) {\n this.setLabel();\n labelEl.append(` (${maxLength - inputLength})`);\n if(!showingLength) showingLength = true;\n } else if((wasError && !isError) || showingLength) {\n this.setLabel();\n showingLength = false;\n }\n };\n\n input.addEventListener('input', processInput);\n }\n\n this.input = input;\n }\n\n public select() {\n if((this.input as HTMLInputElement).value) { // * avoid selecting whole empty field on iOS devices\n (this.input as HTMLInputElement).select(); // * select text\n }\n }\n\n public setLabel() {\n this.label.textContent = '';\n if(this.options.labelText) {\n this.label.innerHTML = this.options.labelText;\n } else {\n this.label.append(i18n(this.options.label, this.options.labelOptions));\n }\n }\n\n public onFakeInput() {\n const {scrollHeight, clientHeight} = this.inputFake;\n if(this.wasInputFakeClientHeight && this.wasInputFakeClientHeight !== clientHeight) {\n this.input.classList.add('no-scrollbar'); // ! в сафари может вообще не появиться скролл после анимации, так как ему нужен полный reflow блока с overflow.\n this.showScrollDebounced();\n }\n\n this.wasInputFakeClientHeight = clientHeight;\n this.input.style.height = scrollHeight ? scrollHeight + 'px' : '';\n }\n\n get value() {\n return this.options.plainText ? (this.input as HTMLInputElement).value : getRichValue(this.input);\n //return getRichValue(this.input);\n }\n\n set value(value: string) {\n this.setValueSilently(value, false);\n\n const event = new Event('input', {bubbles: true, cancelable: true});\n this.input.dispatchEvent(event);\n }\n\n public setValueSilently(value: string, fireFakeInput = true) {\n if(this.options.plainText) {\n (this.input as HTMLInputElement).value = value;\n } else {\n this.input.innerHTML = value;\n \n if(this.inputFake) {\n this.inputFake.innerHTML = value;\n\n if(fireFakeInput) {\n this.onFakeInput();\n }\n }\n }\n }\n\n public isValid() {\n return !this.input.classList.contains('error') && this.value !== this.originalValue;\n }\n\n public setOriginalValue(value: InputField['originalValue'] = '', silent = false) {\n this.originalValue = value;\n\n if(!this.options.plainText) {\n value = RichTextProcessor.wrapDraftText(value);\n }\n\n if(silent) {\n this.setValueSilently(value, false); \n } else {\n this.value = value;\n }\n }\n\n public setState(state: InputState, label?: LangPackKey) {\n if(label) {\n this.label.textContent = '';\n this.label.append(i18n(label, this.options.labelOptions));\n }\n\n this.input.classList.toggle('error', !!(state & InputState.Error));\n this.input.classList.toggle('valid', !!(state & InputState.Valid));\n }\n\n public setError(label?: LangPackKey) {\n this.setState(InputState.Error, label);\n }\n}\n\nexport default InputField;\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport findUpClassName from \"../helpers/dom/findUpClassName\";\nimport sequentialDom from \"../helpers/sequentialDom\";\nimport {isTouchSupported} from \"../helpers/touchSupport\";\nimport rootScope from \"../lib/rootScope\";\n\nlet rippleClickId = 0;\nexport function ripple(elem: HTMLElement, callback: (id: number) => Promise<boolean | void> = () => Promise.resolve(), onEnd: (id: number) => void = null, prepend = false) {\n //return;\n if(elem.querySelector('.c-ripple')) return;\n elem.classList.add('rp');\n \n let r = document.createElement('div');\n r.classList.add('c-ripple');\n\n const isSquare = elem.classList.contains('rp-square');\n if(isSquare) {\n r.classList.add('is-square');\n }\n\n elem[prepend ? 'prepend' : 'append'](r);\n\n let handler: () => void;\n //let animationEndPromise: Promise<number>;\n const drawRipple = (clientX: number, clientY: number) => {\n const startTime = Date.now();\n const elem = document.createElement('div');\n\n const clickId = rippleClickId++;\n \n //console.log('ripple drawRipple');\n \n const duration = +window.getComputedStyle(r).getPropertyValue('--ripple-duration').replace('s', '') * 1000;\n //console.log('ripple duration', duration);\n\n handler = () => {\n //handler = () => animationEndPromise.then((duration) => {\n //console.log('ripple animation was:', duration);\n\n //const duration = isSquare || mediaSizes.isMobile ? 200 : 700;\n //return;\n let elapsedTime = Date.now() - startTime;\n const cb = () => {\n //console.log('ripple elapsedTime total pre-remove:', Date.now() - startTime);\n sequentialDom.mutate(() => {\n elem.remove();\n });\n \n if(onEnd) onEnd(clickId);\n };\n if(elapsedTime < duration) {\n let delay = Math.max(duration - elapsedTime, duration / 2);\n setTimeout(() => elem.classList.add('hiding'), Math.max(delay - duration / 2, 0));\n\n setTimeout(cb, delay);\n } else {\n elem.classList.add('hiding');\n setTimeout(cb, duration / 2);\n }\n\n if(!isTouchSupported) {\n window.removeEventListener('contextmenu', handler);\n }\n\n handler = null;\n touchStartFired = false;\n };\n //});\n\n callback && callback(clickId);\n\n /* callback().then((bad) => {\n if(bad) {\n span.remove();\n return;\n } */\n \n //console.log('ripple after promise', Date.now() - startTime);\n //console.log('ripple tooSlow:', tooSlow);\n /* if(tooSlow) {\n span.remove();\n return;\n } */\n\n window.requestAnimationFrame(() => {\n const rect = r.getBoundingClientRect();\n elem.classList.add('c-ripple__circle');\n\n const clickX = clientX - rect.left;\n const clickY = clientY - rect.top;\n\n const radius = Math.sqrt((Math.abs(clickY - rect.height / 2) + rect.height / 2) ** 2 + (Math.abs(clickX - rect.width / 2) + rect.width / 2) ** 2);\n const size = radius;\n\n // center of circle\n const x = clickX - size / 2;\n const y = clickY - size / 2;\n\n //console.log('ripple click', offsetFromCenter, size, clickX, clickY);\n\n elem.style.width = elem.style.height = size + 'px';\n elem.style.left = x + 'px';\n elem.style.top = y + 'px';\n\n // нижний код выполняется с задержкой\n /* animationEndPromise = new Promise((resolve) => {\n span.addEventListener('animationend', () => {\n // 713 -> 700\n resolve(((Date.now() - startTime) / 100 | 0) * 100);\n }, {once: true});\n }); */\n \n // нижний код не всегда включает анимацию ПРИ КЛИКЕ НА ТАЧПАД БЕЗ ТАПТИК ЭНЖИНА\n /* span.style.display = 'none';\n r.append(span);\n duration = +window.getComputedStyle(span).getPropertyValue('animation-duration').replace('s', '') * 1000;\n span.style.display = ''; */\n\n r.append(elem);\n\n //r.classList.add('active');\n //handler();\n });\n //});\n };\n\n // TODO: rename this variable\n let touchStartFired = false;\n if(isTouchSupported) {\n let touchEnd = () => {\n handler && handler();\n };\n \n elem.addEventListener('touchstart', (e) => {\n if(!rootScope.settings.animationsEnabled) {\n return;\n }\n\n //console.log('ripple touchstart', e);\n if(e.touches.length > 1 \n || touchStartFired \n || (['BUTTON', 'A'].includes((e.target as HTMLElement).tagName) && e.target !== elem) \n || findUpClassName(e.target as HTMLElement, 'c-ripple') !== r) {\n return;\n }\n \n //console.log('touchstart', e);\n touchStartFired = true;\n \n let {clientX, clientY} = e.touches[0];\n drawRipple(clientX, clientY);\n elem.addEventListener('touchend', touchEnd, {once: true});\n \n window.addEventListener('touchmove', (e) => {\n e.cancelBubble = true;\n e.stopPropagation();\n touchEnd();\n elem.removeEventListener('touchend', touchEnd);\n }, {once: true});\n }, {passive: true});\n } else {\n elem.addEventListener('mousedown', (e) => {\n if(![0, 2].includes(e.button)) { // only left and right buttons\n return;\n }\n\n if(!rootScope.settings.animationsEnabled) {\n return;\n }\n //console.log('ripple mousedown', e, e.target, findUpClassName(e.target as HTMLElement, 'c-ripple') === r);\n\n if(elem.dataset.ripple === '0' || findUpClassName(e.target as HTMLElement, 'c-ripple') !== r || (e.target as HTMLElement).tagName === 'A') {\n return false;\n } else if(touchStartFired) {\n touchStartFired = false;\n return false;\n }\n \n let {clientX, clientY} = e;\n drawRipple(clientX, clientY);\n window.addEventListener('mouseup', handler, {once: true});\n window.addEventListener('contextmenu', handler, {once: true});\n });\n }\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport { isTouchSupported } from \"../helpers/touchSupport\";\nimport { logger, LogLevels } from \"../lib/logger\";\nimport fastSmoothScroll, { FocusDirection } from \"../helpers/fastSmoothScroll\";\nimport useHeavyAnimationCheck from \"../hooks/useHeavyAnimationCheck\";\nimport { cancelEvent } from \"../helpers/dom\";\n/*\nvar el = $0;\nvar height = 0;\nvar checkUp = false;\n\ndo {\n height += el.scrollHeight;\n} while(el = (checkUp ? el.previousElementSibling : el.nextElementSibling));\nconsole.log(height);\n*/\n\n/*\nArray.from($0.querySelectorAll('.bubble-content')).forEach(_el => {\n\t//_el.style.display = '';\t\n\t//return;\n\n\tlet el = _el.parentElement;\n\tlet height = el.scrollHeight;\n\tlet width = el.scrollWidth;\n\tel.style.width = width + 'px';\n\tel.style.height = height + 'px';\n\t_el.style.display = 'none';\n});\n*/\n\n/* const scrollables: Map<HTMLElement, Scrollable> = new Map();\nconst scrollsIntersector = new IntersectionObserver(entries => {\n for(let entry of entries) {\n const scrollable = scrollables.get(entry.target as HTMLElement);\n\n if(entry.isIntersecting) {\n scrollable.isVisible = true;\n } else {\n scrollable.isVisible = false;\n\n if(!isInDOM(entry.target)) {\n scrollsIntersector.unobserve(scrollable.container);\n scrollables.delete(scrollable.container);\n }\n }\n }\n}); */\n\nexport class ScrollableBase {\n protected log: ReturnType<typeof logger>;\n\n public onScrollMeasure: number = 0;\n protected onScroll: () => void;\n\n public isHeavyAnimationInProgress = false;\n protected needCheckAfterAnimation = false;\n\n constructor(public el: HTMLElement, logPrefix = '', public container: HTMLElement = document.createElement('div')) {\n this.container.classList.add('scrollable');\n\n this.log = logger('SCROLL' + (logPrefix ? '-' + logPrefix : ''), LogLevels.error);\n\n if(el) {\n Array.from(el.children).forEach(c => this.container.append(c));\n\n el.append(this.container);\n }\n //this.onScroll();\n }\n\n protected setListeners() {\n window.addEventListener('resize', this.onScroll, {passive: true});\n this.container.addEventListener('scroll', this.onScroll, {passive: true, capture: true});\n\n useHeavyAnimationCheck(() => {\n this.isHeavyAnimationInProgress = true;\n\n if(this.onScrollMeasure) {\n this.needCheckAfterAnimation = true;\n window.cancelAnimationFrame(this.onScrollMeasure);\n }\n }, () => {\n this.isHeavyAnimationInProgress = false;\n\n if(this.needCheckAfterAnimation) {\n this.onScroll();\n this.needCheckAfterAnimation = false;\n }\n });\n }\n\n public append(element: HTMLElement) {\n this.container.append(element);\n }\n\n public scrollIntoViewNew(\n element: HTMLElement,\n position: ScrollLogicalPosition,\n margin?: number,\n maxDistance?: number,\n forceDirection?: FocusDirection,\n forceDuration?: number,\n axis?: 'x' | 'y'\n ) {\n //return Promise.resolve();\n return fastSmoothScroll(this.container, element, position, margin, maxDistance, forceDirection, forceDuration, axis);\n }\n}\n\nexport type SliceSides = 'top' | 'bottom';\nexport type SliceSidesContainer = {[k in SliceSides]: boolean};\n\nexport default class Scrollable extends ScrollableBase {\n public splitUp: HTMLElement;\n public padding: HTMLElement;\n \n public onAdditionalScroll: () => void = null;\n public onScrolledTop: () => void = null;\n public onScrolledBottom: () => void = null;\n \n public lastScrollTop: number = 0;\n public lastScrollDirection: number = 0;\n\n public loadedAll: SliceSidesContainer = {top: true, bottom: false};\n\n constructor(el: HTMLElement, logPrefix = '', public onScrollOffset = 300, withPaddingContainer?: boolean) {\n super(el, logPrefix);\n\n /* if(withPaddingContainer) {\n this.padding = document.createElement('div');\n this.padding.classList.add('scrollable-padding');\n Array.from(this.container.children).forEach(c => this.padding.append(c));\n this.container.append(this.padding);\n } */\n\n this.container.classList.add('scrollable-y');\n this.setListeners();\n }\n\n public setVirtualContainer(el?: HTMLElement) {\n this.splitUp = el;\n this.log('setVirtualContainer:', el, this);\n }\n\n public onScroll = () => {\n //if(this.debug) {\n //this.log('onScroll call', this.onScrollMeasure);\n //}\n\n //return;\n\n if(this.isHeavyAnimationInProgress) {\n if(this.onScrollMeasure) {\n window.cancelAnimationFrame(this.onScrollMeasure);\n }\n\n this.needCheckAfterAnimation = true;\n return;\n }\n\n //if(this.onScrollMeasure || ((this.scrollLocked || (!this.onScrolledTop && !this.onScrolledBottom)) && !this.splitUp && !this.onAdditionalScroll)) return;\n if((!this.onScrolledTop && !this.onScrolledBottom) && !this.splitUp && !this.onAdditionalScroll) return;\n if(this.onScrollMeasure) window.cancelAnimationFrame(this.onScrollMeasure);\n this.onScrollMeasure = window.requestAnimationFrame(() => {\n this.onScrollMeasure = 0;\n\n const scrollTop = this.container.scrollTop;\n this.lastScrollDirection = this.lastScrollTop === scrollTop ? 0 : (this.lastScrollTop < scrollTop ? 1 : -1); // * 1 - bottom, -1 - top\n this.lastScrollTop = scrollTop;\n\n if(this.onAdditionalScroll && this.lastScrollDirection !== 0) {\n this.onAdditionalScroll();\n }\n \n if(this.checkForTriggers) {\n this.checkForTriggers();\n }\n });\n };\n\n public checkForTriggers = () => {\n if((!this.onScrolledTop && !this.onScrolledBottom)) return;\n\n if(this.isHeavyAnimationInProgress) {\n this.onScroll();\n return;\n }\n\n const scrollHeight = this.container.scrollHeight;\n if(!scrollHeight) { // незачем вызывать триггеры если блок пустой или не виден\n return;\n }\n\n const clientHeight = this.container.clientHeight;\n const maxScrollTop = scrollHeight - clientHeight;\n const scrollTop = this.lastScrollTop;\n\n //this.log('checkForTriggers:', scrollTop, maxScrollTop);\n\n if(this.onScrolledTop && scrollTop <= this.onScrollOffset && this.lastScrollDirection <= 0/* && direction === -1 */) {\n this.onScrolledTop();\n }\n\n if(this.onScrolledBottom && (maxScrollTop - scrollTop) <= this.onScrollOffset && this.lastScrollDirection >= 0/* && direction === 1 */) {\n this.onScrolledBottom();\n }\n };\n\n public prepend(...elements: HTMLElement[]) {\n (this.splitUp || this.padding || this.container).prepend(...elements);\n }\n\n public append(...elements: HTMLElement[]) {\n (this.splitUp || this.padding || this.container).append(...elements);\n }\n\n public getDistanceToEnd() {\n return this.scrollHeight - Math.round(this.scrollTop + this.container.offsetHeight);\n }\n\n get isScrolledDown() {\n return this.getDistanceToEnd() <= 1;\n }\n\n set scrollTop(y: number) {\n this.container.scrollTop = y;\n }\n \n get scrollTop() {\n //this.log.trace('get scrollTop');\n return this.container.scrollTop;\n }\n \n get scrollHeight() {\n return this.container.scrollHeight;\n }\n}\n\nexport class ScrollableX extends ScrollableBase {\n constructor(el: HTMLElement, logPrefix = '', public onScrollOffset = 300, public splitCount = 15, public container: HTMLElement = document.createElement('div')) {\n super(el, logPrefix, container);\n\n this.container.classList.add('scrollable-x');\n\n if(!isTouchSupported) {\n const scrollHorizontally = (e: any) => {\n if(!e.deltaX) {\n this.container!.scrollLeft += e.deltaY / 4;\n cancelEvent(e);\n }\n };\n \n this.container.addEventListener('wheel', scrollHorizontally, {passive: false});\n }\n }\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport appStateManager from \"../lib/appManagers/appStateManager\";\nimport { getDeepProperty } from \"../helpers/object\";\nimport { ripple } from \"./ripple\";\nimport { LangPackKey, _i18n } from \"../lib/langPack\";\n\nexport type CheckboxFieldOptions = {\n text?: LangPackKey,\n textArgs?: any[],\n name?: string, \n round?: boolean, \n toggle?: boolean,\n stateKey?: string,\n disabled?: boolean,\n checked?: boolean,\n restriction?: boolean,\n withRipple?: boolean,\n withHover?: boolean,\n};\nexport default class CheckboxField {\n public input: HTMLInputElement;\n public label: HTMLLabelElement;\n public span: HTMLSpanElement;\n\n constructor(options: CheckboxFieldOptions = {}) {\n const label = this.label = document.createElement('label');\n label.classList.add('checkbox-field');\n\n if(options.restriction) {\n label.classList.add('checkbox-field-restriction');\n }\n\n if(options.round) {\n label.classList.add('checkbox-field-round');\n }\n\n if(options.disabled) {\n this.toggleDisability(true);\n }\n\n const input = this.input = document.createElement('input');\n input.type = 'checkbox';\n if(options.name) {\n input.id = 'input-' + options.name;\n }\n\n if(options.checked) {\n input.checked = true;\n }\n\n if(options.stateKey) {\n appStateManager.getState().then(state => {\n this.checked = getDeepProperty(state, options.stateKey);\n\n input.addEventListener('change', () => {\n appStateManager.setByKey(options.stateKey, input.checked);\n });\n });\n }\n\n let span: HTMLSpanElement;\n if(options.text) {\n span = this.span = document.createElement('span');\n span.classList.add('checkbox-caption');\n _i18n(span, options.text, options.textArgs);\n } else {\n label.classList.add('checkbox-without-caption');\n }\n\n label.append(input);\n\n if(options.toggle) {\n label.classList.add('checkbox-field-toggle');\n\n const toggle = document.createElement('div');\n toggle.classList.add('checkbox-toggle');\n label.append(toggle);\n } else {\n const box = document.createElement('div');\n box.classList.add('checkbox-box');\n \n const checkSvg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n checkSvg.classList.add('checkbox-box-check');\n checkSvg.setAttributeNS(null, 'viewBox', '0 0 24 24');\n const use = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n use.setAttributeNS(null, 'href', '#check');\n use.setAttributeNS(null, 'x', '-1');\n checkSvg.append(use);\n \n const bg = document.createElement('div');\n bg.classList.add('checkbox-box-background');\n \n const border = document.createElement('div');\n border.classList.add('checkbox-box-border');\n \n box.append(border, bg, checkSvg);\n \n label.append(box);\n }\n\n if(span) {\n label.append(span);\n }\n\n if(options.withRipple) {\n label.classList.add('checkbox-ripple', 'hover-effect');\n ripple(label, undefined, undefined, true);\n //label.prepend(input);\n } else if(options.withHover) {\n label.classList.add('hover-effect');\n }\n }\n\n get checked() {\n return this.input.checked;\n }\n\n set checked(checked: boolean) {\n this.setValueSilently(checked);\n\n const event = new Event('change', {bubbles: true, cancelable: true});\n this.input.dispatchEvent(event);\n }\n\n public setValueSilently(checked: boolean) {\n this.input.checked = checked;\n }\n\n public toggleDisability(disable: boolean) {\n this.label.classList.toggle('checkbox-disabled', disable);\n return () => this.toggleDisability(!disable);\n }\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nexport default function findUpTag(el: any, tag: string): HTMLElement {\n return el.closest(tag);\n /* if(el.tagName === tag) return el; // 03.02.2020\n\n while(el.parentElement) {\n el = el.parentElement;\n if(el.tagName === tag) \n return el;\n }\n return null; */\n}\n","/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport { formatPhoneNumber, putPreloader } from \"../components/misc\";\nimport Scrollable from '../components/scrollable';\nimport Countries, { Country as _Country } from \"../countries\";\nimport appStateManager from \"../lib/appManagers/appStateManager\";\nimport apiManager from \"../lib/mtproto/mtprotoworker\";\nimport { RichTextProcessor } from '../lib/richtextprocessor';\nimport { attachClickEvent, cancelEvent, replaceContent, toggleDisability } from \"../helpers/dom\";\nimport Page from \"./page\";\nimport InputField from \"../components/inputField\";\nimport CheckboxField from \"../components/checkboxField\";\nimport Button from \"../components/button\";\nimport { isAppleMobile } from \"../helpers/userAgent\";\nimport fastSmoothScroll from \"../helpers/fastSmoothScroll\";\nimport { isTouchSupported } from \"../helpers/touchSupport\";\nimport App from \"../config/app\";\nimport Modes from \"../config/modes\";\nimport I18n, { _i18n, i18n, LangPackKey } from \"../lib/langPack\";\nimport { LangPackString } from \"../layer\";\nimport lottieLoader from \"../lib/lottieLoader\";\nimport { ripple } from \"../components/ripple\";\nimport findUpTag from \"../helpers/dom/findUpTag\";\n\ntype Country = _Country & {\n li?: HTMLLIElement[]\n};\n\n//import _countries from '../countries_pretty.json';\nlet btnNext: HTMLButtonElement = null, btnQr: HTMLButtonElement;\n\nlet onFirstMount = () => {\n if(Modes.test) {\n Countries.push({\n name: 'Test Country',\n phoneCode: '999 66',\n code: 'TC',\n emoji: '🤔',\n pattern: '999 66 XXX XX'\n });\n \n console.log('Added test country to list!');\n }\n\n //const countries: Country[] = _countries.default.filter(c => c.emoji);\n const countries: Country[] = Countries.filter(c => c.emoji).sort((a, b) => a.name.localeCompare(b.name));\n\n let lastCountrySelected: Country = null;\n\n const inputWrapper = document.createElement('div');\n inputWrapper.classList.add('input-wrapper');\n\n const countryInputField = new InputField({\n label: 'Login.CountrySelectorLabel',\n name: 'countryCode',\n plainText: true\n });\n\n countryInputField.container.classList.add('input-select');\n\n const countryInput = countryInputField.input as HTMLInputElement;\n countryInput.autocomplete = 'rrRandomRR';\n\n const selectWrapper = document.createElement('div');\n selectWrapper.classList.add('select-wrapper', 'z-depth-3', 'hide');\n\n const arrowDown = document.createElement('span');\n arrowDown.classList.add('arrow', 'arrow-down');\n countryInputField.container.append(arrowDown);\n\n const selectList = document.createElement('ul');\n selectWrapper.appendChild(selectList);\n\n const scroll = new Scrollable(selectWrapper);\n\n let initedSelect = false;\n\n let initSelect = () => {\n initSelect = null;\n\n countries.forEach((c) => {\n initedSelect = true;\n\n /* let unified = unifiedCountryCodeEmoji(c.code);\n let emoji = unified.split('-').reduce((prev, curr) => prev + String.fromCodePoint(parseInt(curr, 16)), ''); */\n //let emoji = countryCodeEmoji(c.code);\n let emoji = c.emoji;\n\n let liArr: Array<HTMLLIElement> = [];\n c.phoneCode.split(' and ').forEach((phoneCode: string) => {\n let li = document.createElement('li');\n var spanEmoji = document.createElement('span');\n /* spanEmoji.innerHTML = countryCodeEmoji(c.code); */\n //spanEmoji.classList.add('emoji-outer', 'emoji-sizer');\n //spanEmoji.innerHTML = `<span class=\"emoji-inner\" style=\"background: url(${sheetUrl}${sheetNo}.png);background-position:${xPos}% ${yPos}%;background-size:${sizeX}% ${sizeY}%\" data-codepoints=\"${unified}\"></span>`;\n \n \n\n let kek = RichTextProcessor.wrapRichText(emoji);\n //console.log(c.name, emoji, kek, spanEmoji.innerHTML);\n\n li.appendChild(spanEmoji);\n spanEmoji.outerHTML = kek;\n \n li.append(c.name);\n\n var span = document.createElement('span');\n span.classList.add('phone-code');\n span.innerText = '+' + phoneCode;\n li.appendChild(span);\n\n liArr.push(li);\n selectList.append(li);\n });\n\n c.li = liArr;\n });\n \n selectList.addEventListener('mousedown', function(e) {\n let target = e.target as HTMLElement;\n if(target.tagName !== 'LI') target = findUpTag(target, 'LI');\n \n let countryName = target.childNodes[1].textContent;//target.innerText.split('\\n').shift();\n let phoneCode = target.querySelector<HTMLElement>('.phone-code').innerText;\n\n countryInput.value = countryName;\n lastCountrySelected = countries.find(c => c.name === countryName);\n \n telEl.value = lastValue = phoneCode;\n setTimeout(() => telEl.focus(), 0);\n //console.log('clicked', e, countryName, phoneCode);\n });\n\n countryInputField.container.appendChild(selectWrapper);\n };\n \n initSelect();\n\n let hideTimeout: number;\n\n countryInput.addEventListener('focus', function(this: typeof countryInput, e) {\n if(initSelect) {\n initSelect();\n } else {\n countries.forEach((c) => {\n c.li.forEach(li => li.style.display = '');\n });\n }\n\n clearTimeout(hideTimeout);\n\n selectWrapper.classList.remove('hide');\n void selectWrapper.offsetWidth; // reflow\n selectWrapper.classList.add('active');\n\n countryInputField.select();\n\n fastSmoothScroll(page.pageEl.parentElement.parentElement, countryInput, 'start', 4);\n\n setTimeout(() => {\n if(!mouseDownHandlerAttached) {\n document.addEventListener('mousedown', onMouseDown, {capture: true});\n mouseDownHandlerAttached = true;\n }\n }, 0);\n });\n\n let mouseDownHandlerAttached = false;\n const onMouseDown = (e: MouseEvent) => {\n /* if(findUpClassName(e.target, 'input-select')) {\n return;\n } */\n if(e.target === countryInput) {\n return;\n }\n\n hidePicker();\n document.removeEventListener('mousedown', onMouseDown, {capture: true});\n mouseDownHandlerAttached = false;\n };\n\n const hidePicker = () => {\n selectWrapper.classList.remove('active');\n hideTimeout = window.setTimeout(() => {\n selectWrapper.classList.add('hide');\n }, 200);\n };\n /* false && countryInput.addEventListener('blur', function(this: typeof countryInput, e) {\n hidePicker();\n \n e.cancelBubble = true;\n }, {capture: true}); */\n\n countryInput.addEventListener('keyup', function(this: typeof countryInput, e) {\n if(e.ctrlKey || e.key === 'Control') return false;\n\n //let i = new RegExp('^' + this.value, 'i');\n let _value = this.value.toLowerCase();\n let matches: Country[] = [];\n countries.forEach((c) => {\n let good = c.name.toLowerCase().indexOf(_value) !== -1/* === 0 */;//i.test(c.name);\n\n c.li.forEach(li => li.style.display = good ? '' : 'none');\n if(good) matches.push(c);\n });\n\n // Код ниже автоматически выберет страну если она осталась одна при поиске\n /* if(matches.length === 1 && matches[0].li.length === 1) {\n if(matches[0].name === lastCountrySelected) return false;\n //console.log('clicking', matches[0]);\n\n var clickEvent = document.createEvent('MouseEvents');\n clickEvent.initEvent('mousedown', true, true);\n matches[0].li[0].dispatchEvent(clickEvent);\n return false;\n } else */if(matches.length === 0) {\n countries.forEach((c) => {\n c.li.forEach(li => li.style.display = '');\n });\n }\n });\n\n arrowDown.addEventListener('mousedown', function(this: typeof arrowDown, e) {\n e.cancelBubble = true;\n e.preventDefault();\n if(countryInput.matches(':focus')) countryInput.blur();\n else countryInput.focus();\n });\n\n let pasted = false;\n let lastValue = '';\n \n const telInputField = new InputField({\n label: 'Login.PhoneLabel',\n plainText: true,\n name: 'phone'\n });\n let telEl = telInputField.input as HTMLInputElement;\n telEl.type = 'tel';\n telEl.autocomplete = 'rr55RandomRR55';\n telEl.addEventListener('input', function(this: typeof telEl, e) {\n //console.log('input', this.value);\n this.classList.remove('error');\n\n lottieLoader.loadLottieWorkers();\n\n const value = this.value;\n const diff = Math.abs(value.length - lastValue.length);\n if(diff > 1 && !pasted && isAppleMobile) {\n this.value = lastValue + value;\n }\n\n pasted = false;\n\n telInputField.setLabel();\n\n let formatted: string, country: Country;\n if(this.value.replace(/\\++/, '+') === '+') {\n this.value = '+';\n } else {\n const o = formatPhoneNumber(this.value);\n formatted = o.formatted;\n country = o.country;\n this.value = lastValue = formatted ? '+' + formatted : '';\n }\n\n //console.log(formatted, country);\n\n let countryName = country ? country.name : ''/* 'Unknown' */;\n if(countryName !== countryInput.value && (!lastCountrySelected || !country || lastCountrySelected.phoneCode !== country.phoneCode)) {\n countryInput.value = countryName;\n lastCountrySelected = country;\n }\n\n //if(country && (this.value.length - 1) >= (country.pattern ? country.pattern.length : 9)) {\n if(country || (this.value.length - 1) > 1) {\n btnNext.style.visibility = '';\n } else {\n btnNext.style.visibility = 'hidden';\n }\n });\n\n telEl.addEventListener('paste', (e) => {\n pasted = true;\n //console.log('paste', telEl.value);\n });\n\n /* telEl.addEventListener('change', (e) => {\n console.log('change', telEl.value);\n }); */\n\n telEl.addEventListener('keypress', function(this: typeof telEl, e) {\n //console.log('keypress', this.value);\n if(!btnNext.style.visibility &&/* this.value.length >= 9 && */ e.key === 'Enter') {\n return onSubmit();\n } else if(/\\D/.test(e.key) && !(e.metaKey || e.ctrlKey) && !(e.key === '+' && e.shiftKey/* && !this.value */)) {\n e.preventDefault();\n return false;\n }\n });\n\n /* telEl.addEventListener('focus', function(this: typeof telEl, e) {\n this.removeAttribute('readonly'); // fix autocomplete\n });*/\n\n const signedCheckboxField = new CheckboxField({\n text: 'Login.KeepSigned', \n name: 'keepSession',\n withRipple: true\n });\n signedCheckboxField.input.checked = true;\n\n btnNext = Button('btn-primary btn-color-primary', {text: 'Login.Next'});\n btnNext.style.visibility = 'hidden';\n\n const onSubmit = (e?: Event) => {\n if(e) {\n cancelEvent(e);\n }\n\n const toggle = toggleDisability([/* telEl, countryInput, */btnNext, btnQr], true);\n\n replaceContent(btnNext, i18n('PleaseWait'));\n putPreloader(btnNext);\n\n //return;\n\n let phone_number = telEl.value;\n apiManager.invokeApi('auth.sendCode', {\n phone_number: phone_number,\n api_id: App.id,\n api_hash: App.hash,\n settings: {\n _: 'codeSettings' // that's how we sending Type\n }\n //lang_code: navigator.language || 'en'\n }).then((code) => {\n //console.log('got code', code);\n\n import('./pageAuthCode').then(m => m.default.mount(Object.assign(code, {phone_number: phone_number})));\n }).catch(err => {\n toggle();\n\n switch(err.type) {\n case 'PHONE_NUMBER_INVALID':\n telInputField.setError();\n replaceContent(telInputField.label, i18n('Login.PhoneLabelInvalid'));\n telEl.classList.add('error');\n replaceContent(btnNext, i18n('Login.Next'));\n break;\n default:\n console.error('auth.sendCode error:', err);\n btnNext.innerText = err.type;\n break;\n }\n });\n };\n\n attachClickEvent(btnNext, onSubmit);\n\n btnQr = Button('btn-primary btn-secondary btn-primary-transparent primary', {text: 'Login.QR.Login'});\n\n let qrMounted = false;\n btnQr.addEventListener('click', () => {\n const promise = import('./pageSignQR');\n btnQr.disabled = true;\n\n let preloaderDiv: HTMLElement;\n if(!qrMounted) {\n preloaderDiv = putPreloader(btnQr);\n qrMounted = true;\n }\n\n promise.then(module => {\n module.default.mount();\n\n setTimeout(() => {\n btnQr.removeAttribute('disabled');\n if(preloaderDiv) {\n preloaderDiv.remove();\n }\n }, 200);\n });\n });\n\n inputWrapper.append(countryInputField.container, telInputField.container, signedCheckboxField.label, btnNext, btnQr);\n\n const h4 = document.createElement('h4');\n _i18n(h4, 'Login.Title');\n\n const subtitle = document.createElement('div');\n subtitle.classList.add('subtitle');\n _i18n(subtitle, 'Login.StartText');\n\n page.pageEl.querySelector('.container').append(h4, subtitle, inputWrapper);\n\n let tryAgain = () => {\n apiManager.invokeApi('help.getNearestDc').then((nearestDcResult) => {\n const dcs = [1, 2, 3, 4, 5];\n const done: number[] = [nearestDcResult.this_dc];\n\n let promise: Promise<any>;\n if(nearestDcResult.nearest_dc !== nearestDcResult.this_dc) {\n promise = apiManager.getNetworker(nearestDcResult.nearest_dc).then(() => {\n done.push(nearestDcResult.nearest_dc)\n });\n }\n\n (promise || Promise.resolve()).then(() => {\n const g = () => {\n const dcId = dcs.shift();\n if(!dcId) return;\n\n setTimeout(() => { // * если одновременно запросить все нетворкеры, не будет проходить запрос на код\n apiManager.getNetworker(dcId, {fileDownload: true}).finally(g);\n }, done.includes(dcId) ? 0 : 3000);\n };\n \n g();\n });\n \n return nearestDcResult;\n }).then((nearestDcResult) => {\n let country = countries.find((c) => c.code === nearestDcResult.country);\n if(country) {\n if(!countryInput.value.length && !telEl.value.length) {\n countryInput.value = country.name;\n lastCountrySelected = country;\n telEl.value = lastValue = '+' + country.phoneCode.split(' and ').shift();\n }\n }\n \n //console.log('woohoo', nearestDcResult, country);\n })//.catch(tryAgain);\n };\n\n if(!isTouchSupported) {\n setTimeout(() => {\n telEl.focus();\n }, 0);\n }\n\n apiManager.invokeApi('help.getConfig').then(config => {\n if(config.suggested_lang_code !== I18n.lastRequestedLangCode) {\n //I18n.loadLangPack(config.suggested_lang_code);\n\n Promise.all([\n I18n.getStrings(config.suggested_lang_code, ['Login.ContinueOnLanguage']),\n I18n.getCacheLangPack()\n ]).then(res => {\n const backup: LangPackString[] = [];\n res[0].forEach(string => {\n const backupString = I18n.strings.get(string.key as LangPackKey);\n if(!backupString) {\n return;\n }\n \n backup.push(backupString);\n I18n.strings.set(string.key as LangPackKey, string);\n });\n\n const btnChangeLanguage = Button('btn-primary btn-secondary btn-primary-transparent primary', {text: 'Login.ContinueOnLanguage'});\n inputWrapper.append(btnChangeLanguage);\n\n backup.forEach(string => {\n I18n.strings.set(string.key as LangPackKey, string);\n });\n \n attachClickEvent(btnChangeLanguage, (e) => {\n cancelEvent(e);\n\n btnChangeLanguage.disabled = true;\n putPreloader(btnChangeLanguage);\n\n I18n.getLangPack(config.suggested_lang_code).then(() => {\n btnChangeLanguage.remove();\n });\n });\n });\n }\n });\n\n tryAgain();\n};\n\nconst page = new Page('page-sign', true, onFirstMount, () => {\n if(btnNext) {\n replaceContent(btnNext, i18n('Login.Next'));\n ripple(btnNext, undefined, undefined, true);\n btnNext.removeAttribute('disabled');\n }\n\n if(btnQr) {\n btnQr.removeAttribute('disabled');\n }\n\n appStateManager.pushToState('authState', {_: 'authStateSignIn'});\n appStateManager.saveState();\n});\n\nexport default page;\n"],"sourceRoot":""}