tweb/public/index.bundle.js

20 lines
580 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

!function(e){function t(t){for(var i,o,r=t[0],l=t[1],d=t[2],u=0,h=[];u<r.length;u++)o=r[u],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&h.push(n[o][0]),n[o]=0;for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(e[i]=l[i]);for(c&&c(t);h.length;)h.shift()();return a.push.apply(a,d||[]),s()}function s(){for(var e,t=0;t<a.length;t++){for(var s=a[t],i=!0,r=1;r<s.length;r++){var l=s[r];0!==n[l]&&(i=!1)}i&&(a.splice(t--,1),e=o(o.s=s[0]))}return e}var i={},n={0:0},a=[];function o(t){if(i[t])return i[t].exports;var s=i[t]={i:t,l:!1,exports:{}};return e[t].call(s.exports,s,s.exports,o),s.l=!0,s.exports}o.m=e,o.c=i,o.d=function(e,t,s){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(o.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(s,i,function(t){return e[t]}.bind(null,i));return s},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var r=window.webpackJsonp=window.webpackJsonp||[],l=r.push.bind(r);r.push=t,r=r.slice();for(var d=0;d<r.length;d++)t(r[d]);var c=l;a.push([62,1,2,4]),s()}([function(e,t,s){"use strict";s.r(t),s.d(t,"dT",(function(){return n})),s.d(t,"isInDOM",(function(){return a})),s.d(t,"checkDragEvent",(function(){return o})),s.d(t,"cancelEvent",(function(){return r})),s.d(t,"getRichValue",(function(){return l})),s.d(t,"placeCaretAtEnd",(function(){return d})),s.d(t,"getRichElementValue",(function(){return c})),s.d(t,"$rootScope",(function(){return u})),s.d(t,"generatePathData",(function(){return p})),s.d(t,"langPack",(function(){return f})),s.d(t,"_",(function(){return m})),s.d(t,"isObject",(function(){return g})),s.d(t,"tsNow",(function(){return v})),s.d(t,"safeReplaceObject",(function(){return b})),s.d(t,"numberWithCommas",(function(){return y})),s.d(t,"findUpClassName",(function(){return _})),s.d(t,"findUpTag",(function(){return w})),s.d(t,"findUpAttribute",(function(){return S})),s.d(t,"whichChild",(function(){return L})),s.d(t,"copy",(function(){return M})),s.d(t,"formatBytes",(function(){return D})),s.d(t,"formatNumber",(function(){return E})),s.d(t,"deepEqual",(function(){return I})),s.d(t,"listMergeSorted",(function(){return P})),s.d(t,"escapeRegExp",(function(){return C})),s.d(t,"encodeEntities",(function(){return T})),s.d(t,"fillPropertyValue",(function(){return k})),s.d(t,"calcImageInBox",(function(){return X})),s.d(t,"emojiUnicode",(function(){return A})),s.d(t,"getEmojiToneIndex",(function(){return x}));
/*!
* Webogram v0.7.0 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/
var i=Date.now();function n(){return"["+((Date.now()-i)/1e3).toFixed(3)+"]"}function a(e,t){return!!e&&(e==(t=t||document.body)||a(e.parentNode,t))}function o(e){if(!e||e.target&&("IMG"==e.target.tagName||"A"==e.target.tagName))return!1;if(!e.dataTransfer||!e.dataTransfer.types)return!0;for(var t=0;t<e.dataTransfer.types.length;t++)if("Files"==e.dataTransfer.types[t])return!0;return!1}function r(e){if(e=e||window.event){e=e.originalEvent||e;try{e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1,e.cancelBubble=!0}catch(e){}}return!1}function l(e){if(!e)return"";var t=[],s=[];c(e,t,s),s.length&&t.push(s.join(""));var i=t.join("\n");return i=i.replace(/\u00A0/g," ")}function d(e){if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var s=window.getSelection();s.removeAllRanges(),s.addRange(t)}else if(void 0!==document.body.createTextRange){var i=document.body.createTextRange();i.moveToElementText(e),i.collapse(!1),i.select()}}function c(e,t,s,i,n){if(3!=e.nodeType){if(1==e.nodeType){var a=i===e,o="DIV"==e.tagName||"P"==e.tagName;o&&s.length||"BR"==e.tagName?(t.push(s.join("")),s.splice(0,s.length)):"IMG"==e.tagName&&e.alt&&s.push(e.alt),a&&!n&&s.push("");for(var r=e.firstChild;r;)c(r,t,s,i,n),r=r.nextSibling;a&&n&&s.push(""),o&&s.length&&(t.push(s.join("")),s.splice(0,s.length))}}else if(i===e){var l=e.nodeValue;s.push(l.substr(0,n)+""+l.substr(n))}else s.push(e.nodeValue)}const u={$broadcast:(e,t)=>{let s=new CustomEvent(e,{detail:t});document.dispatchEvent(s)},$on:(e,t)=>{document.addEventListener(e,t)},selectedPeerID:0,myID:0,idle:{isIDLE:!1}};var h=function(e,t,s,i,n,a,o){return[e,",",t," ",s," ",i,",",n," ",a,",",o].join("")};function p(e,t,s,i,n,a,o,r){var l=[];return l.push("M"+(e+s/2)+","+t),l.push("H"+(e+s-a)),a>0&&l.push("A"+h(a,a,0,0,1,e+s,t+a)),l.push("V"+(t+i-o)),o>0&&l.push("A"+h(o,o,0,0,1,e+s-o,t+i)),l.push("H"+(e+r)),r>0&&l.push("A"+h(r,r,0,0,1,e+0,t+i-r)),l.push("V"+(t+n)),n>0&&l.push("A"+h(n,n,0,0,1,e+n,t+0)),l.push("Z"),l.join(" ")}const f={messageActionChatCreate:"created the group",messageActionChatEditTitle:"changed group name",messageActionChatEditPhoto:"changed group photo",messageActionChatDeletePhoto:"removed group photo",messageActionChatReturn:"returned to group",messageActionChatJoined:"joined the group",messageActionChatAddUser:"invited {user}",messageActionChatAddUsers:"invited {} users",messageActionChatLeave:"left the group",messageActionChatDeleteUser:"removed user",messageActionChatJoinedByLink:"joined the group",messageActionPinMessage:"pinned message",messageActionContactSignUp:"joined Telegram",messageActionChannelCreate:"Channel created",messageActionChannelEditTitle:"Channel renamed",messageActionChannelEditPhoto:"Channel photo updated",messageActionChannelDeletePhoto:"Channel photo removed",messageActionHistoryClear:"History cleared","messageActionPhoneCall.in_ok":"Incoming Call","messageActionPhoneCall.out_ok":"Outgoing Call","messageActionPhoneCall.in_missed":"Missed Call","messageActionPhoneCall.out_missed":"Cancelled Call"},m=e=>(e=e.replace("_raw",""),f[e]?f[e]:e);function g(e){return"object"==typeof e&&null!==e}function v(e){var t=+new Date;return e?Math.floor(t/1e3):t}function b(e,t){for(var s in e)t.hasOwnProperty(s)||"$"==s.charAt(0)||delete e[s];for(var s in t)e[s]=t[s]}function y(e){var t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")}function _(e,t){if(e.classList.contains(t))return e;for(;e.parentElement;)if((e=e.parentElement).classList.contains(t))return e;return null}function w(e,t){if(e.tagName==t)return e;for(;e.parentElement;)if((e=e.parentElement).tagName===t)return e;return null}function S(e,t){if(null!=e.getAttribute(t))return e;for(;e.parentElement;)if(null!=(e=e.parentElement).getAttribute(t))return e;return null}function L(e){let t=0;for(;null!=(e=e.previousElementSibling);)++t;return t}function M(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){var t=[];return e.forEach((function(e){t.push(M(e))})),t}let s=new e.constructor;for(var i in e)e.hasOwnProperty(i)&&(s[i]=M(e[i]));return s}function D(e,t=2){if(0===e)return"0 Bytes";const s=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,i)).toFixed(s))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}function E(e,t=2){if(0===e)return"0";const s=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,i)).toFixed(s))+["","K","M","B","T"][i]}function I(e,t){const s=Object.keys,i=typeof e;return e&&t&&"object"===i&&i===typeof t?s(e).length===s(t).length&&s(e).every(s=>I(e[s],t[s])):e===t}function P(e,t){t=t||[];for(var s=M(e=e||[]),i=e.length?e[e.length-1]:4294967295,n=0;n<t.length;n++)t[n]<i&&s.push(t[n]);return s}function C(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function T(e){return e.replace(/&/g,"&amp;").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,(function(e){return"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";"})).replace(/([^\#-~| |!])/g,(function(e){return"&#"+e.charCodeAt(0)+";"})).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k(e){let t=e.split(" ");if(4!=t.length){t[0]||(t[0]="0px");for(let e=t.length;e<4;++e)t[e]=t[e%2]||t[0]||"0px"}return t}function X(e,t,s,i,n){if(e<s&&t<i)return{w:e,h:t};var a=s,o=i;return e/t>s/i?o=parseInt(t*s/e):(a=parseInt(e*i/t))>s&&(o=parseInt(o*s/a),a=s),n&&a>=e&&o>=t&&(a=e,o=t),{w:a,h:o}}function A(e){let t=A.raw(e).split(" ").map(e=>parseInt(e).toString(16));return t.length&&2==t[0].length&&(t[0]="00"+t[0]),t.join("-")}function x(e){let t=e.match(/[\uDFFB-\uDFFF]/);return t?5-(57343-t[0].charCodeAt(0)):0}A.raw=function(e){if(1===e.length)return e.charCodeAt(0).toString();if(e.length>1){const s=[];for(var t=0;t<e.length;t++)e.charCodeAt(t)>=55296&&e.charCodeAt(t)<=56319?e.charCodeAt(t+1)>=56320&&e.charCodeAt(t+1)<=57343&&s.push(1024*(e.charCodeAt(t)-55296)+(e.charCodeAt(t+1)-56320)+65536):(e.charCodeAt(t)<55296||e.charCodeAt(t)>57343)&&s.push(e.charCodeAt(t));return s.join(" ")}return""}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.attachContextMenuListener=t.positionMenu=t.openBtnMenu=t.parseMenuButtonsTo=t.formatPhoneNumber=t.horizontalMenu=t.putPreloader=t.renderImageFromUrl=t.toast=t.ripple=void 0;const o=s(0),r=a(s(4));let l=0;t.ripple=function(e,t=(()=>Promise.resolve()),s=null){if(e.querySelector(".c-ripple"))return;e.classList.add("rp");let i=document.createElement("div");i.classList.add("c-ripple");const n=e.classList.contains("rp-square");n&&i.classList.add("is-square");const a=n?200:700;let o;e.append(i);let d=(e,n)=>{let r=Date.now(),d=document.createElement("span"),c=l++;o=()=>{let e=Date.now()-r;if(e<a){let t=Math.max(a-e,a/2);setTimeout(()=>d.classList.add("hiding"),Math.max(t-a/2,0)),setTimeout(()=>{d.remove(),s&&s(c)},t)}else d.classList.add("hiding"),setTimeout(()=>{d.remove(),s&&s(c)},a/2);o=null},t&&t(c),window.requestAnimationFrame(()=>{d.classList.add("c-ripple__circle");let t,s,a=i.getBoundingClientRect(),o=e-a.left,r=n-a.top;a.width>a.height?(t=a.width,s=o):(t=a.height,s=r),t-=s>t/2?t-s:s,t*=1.1;let l=o-t/2,c=r-t/2;d.style.width=d.style.height=t+"px",d.style.left=l+"px",d.style.top=c+"px",i.append(d)})},c=!1;if(r.touchSupport){let t=()=>{o&&o()};e.addEventListener("touchstart",s=>{if(s.touches.length>1||"BUTTON"==s.target.tagName&&s.target!=e)return;c=!0;let{clientX:i,clientY:n}=s.touches[0];d(i,n),window.addEventListener("touchend",t,{once:!0}),window.addEventListener("touchmove",e=>{e.cancelBubble=!0,e.stopPropagation(),o&&o(),window.removeEventListener("touchend",t)},{once:!0})},{passive:!0})}else e.addEventListener("mousedown",t=>{if("0"==e.dataset.ripple)return!1;if(c)return c=!1,!1;let{clientX:s,clientY:i}=t;d(s,i),window.addEventListener("mouseup",o,{once:!0})})};const d=document.createElement("div");d.classList.add("toast"),t.toast=function(e){d.innerHTML=e,document.body.append(d),d.dataset.timeout&&clearTimeout(+d.dataset.timeout),d.dataset.timeout=""+setTimeout(()=>{d.remove(),delete d.dataset.timeout},3e3)};let c={},u=(e,t)=>{e instanceof HTMLImageElement||e instanceof HTMLSourceElement?e.src=t:e instanceof SVGImageElement?e.setAttributeNS(null,"href",t):e.style.backgroundImage="url("+t+")"};t.renderImageFromUrl=function(e,t){return c[t]?(u(e,t),Promise.resolve(!0)):e instanceof HTMLSourceElement?(e.src=t,Promise.resolve(!1)):new Promise((s,i)=>{let n=new Image;n.src=t,n.addEventListener("load",()=>{u(e,t),c[t]=!0,s(!1)}),n.addEventListener("error",i)})},t.putPreloader=function(e,t=!1){const s='\n <svg xmlns="http://www.w3.org/2000/svg" class="preloader-circular" viewBox="25 25 50 50">\n <circle class="preloader-path" cx="50" cy="50" r="20" fill="none" stroke-miterlimit="10"/>\n </svg>';if(t){let t=document.createElement("div");return t.classList.add("preloader"),t.innerHTML=s,e&&e.appendChild(t),t}e.innerHTML+=s},t.horizontalMenu=function(e,t,s,i,n=300){const a={};let r=null,l=-1;const d=s=>{if(s==l)return!1;const o=r,d=t.children[s];if("none"==t.dataset.slider)return o&&o.classList.remove("active"),d.classList.add("active"),l=s,r=d,void(i&&i());const c=l<s;-1!=l?e||"tabs"==t.dataset.slider?function(e,t,s){s?(e.style.transform="translateX(100%)",t.style.transform="translateX(-100%)"):(e.style.transform="translateX(-100%)",t.style.transform="translateX(100%)"),e.classList.add("active"),e.offsetWidth,e.style.transform=""}(d,r,c):function(e,t,s){s?(t.style.filter="brightness(80%)",t.style.transform="translateX(-25%)",e.style.transform="translateX(100%)"):(e.style.filter="brightness(80%)",e.style.transform="translateX(-25%)",t.style.transform="translateX(100%)"),e.classList.add("active"),e.offsetWidth,e.style.transform="",e.style.filter=""}(d,r,c):d.classList.add("active");const u=l;a.hasOwnProperty(s)&&clearTimeout(a[s]),o&&(a[u]=setTimeout(()=>{o.style.transform="",o.style.filter="",o.classList.remove("active"),delete a[u],i&&i()},n)),l=s,r=d};if(e){let i;e.classList.contains("no-stripe")||(i=document.createElement("span"),i.classList.add("menu-horizontal__stripe"),e.append(i));const n="LI";e.addEventListener("click",(function(a){let r,c=a.target;if(c.tagName!=n&&(c=o.findUpTag(c,n)),!c)return!1;if(c.dataset.tab){if(r=+c.dataset.tab,-1==r)return!1}else r=o.whichChild(c);const u=t.children[r];if(s&&s(r,u),c.classList.contains("active")||r==l)return!1;const h=e.querySelector(n.toLowerCase()+".active");if(h&&h.classList.remove("active"),i){const t=e.getBoundingClientRect(),s=c.getBoundingClientRect(),n=50;i.style.cssText=`width: ${n}px; transform: translateX(${s.left-t.left+(s.width-n)/2}px);`}c.classList.add("active"),d(r)}))}return d},t.formatPhoneNumber=function(e){let t=(e=e.replace(/\D/g,"")).slice(0,6),s=r.default.Countries.slice().sort((e,t)=>t.phoneCode.length-e.phoneCode.length).find(e=>e.phoneCode.split(" and ").find(e=>0==t.indexOf(e.replace(/\D/g,"")))),i=s?s.pattern||s.phoneCode:"";return s&&i.split("").forEach((t,s)=>{" "==t&&" "!=e[s]&&e.length>s&&(e=e.slice(0,s)+" "+e.slice(s))}),{formatted:e,country:s}},t.parseMenuButtonsTo=function(e,t){Array.from(t).forEach(t=>{const s=t.className.match(/(?:^|\s)menu-(.+?)(?:$|\s)/);s&&(e[s[1]]=t)})};let h=e=>{let t=m.getBoundingClientRect(),{clientX:s,clientY:i}=e,n=s>=t.right?s-t.right:t.left-s,a=i>=t.bottom?i-t.bottom:t.top-i;(n>=100||a>=100)&&f()},p=e=>{f()},f=()=>{m&&(m.classList.remove("active"),m.parentElement.classList.remove("menu-open"),m=null),g&&(g(),g=null),r.touchSupport?window.removeEventListener("touchmove",p):window.removeEventListener("mousemove",h),window.removeEventListener("click",p),window.removeEventListener("contextmenu",p)},m=null,g=null;t.openBtnMenu=function(e,t){f(),m=e,m.classList.add("active"),m.parentElement.classList.add("menu-open"),g=t,r.touchSupport?window.addEventListener("touchmove",p,{once:!0}):window.addEventListener("mousemove",h),window.addEventListener("click",p,{once:!0}),window.addEventListener("contextmenu",p,{once:!0})},t.positionMenu=function({clientX:e,clientY:t},s,i){let{scrollWidth:n,scrollHeight:a}=s,{innerWidth:o,innerHeight:l}=window;r.mediaSizes.isMobile&&(i=void 0),void 0===i&&e+n>o&&(e-n<0?s.style.left=o-n+"px":i="right"),i||(i="left"),s.classList.remove("bottom-left","bottom-right"),void 0!==i&&(s.style.left=("right"==i?e-n:e)+"px",s.classList.add("left"==i?"bottom-right":"bottom-left")),s.style.top=t+a>l?l-a+"px":t+"px"},t.attachContextMenuListener=function(e,t){if(r.isApple&&r.touchSupport){let s;const i=()=>{clearTimeout(s),e.removeEventListener("touchmove",i),e.removeEventListener("touchend",i),e.removeEventListener("touchcancel",i)};e.addEventListener("touchstart",n=>{n.touches.length>1?clearTimeout(s):(e.addEventListener("touchmove",i,{once:!0}),e.addEventListener("touchend",i,{once:!0}),e.addEventListener("touchcancel",i,{once:!0}),s=setTimeout(()=>{t(n.touches[0]),i()},400))})}else e.addEventListener("contextmenu",t)}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(0),l=o(s(16)),d=o(s(49));class c extends d.default{constructor(){super(),this.webWorker=!1,this.taskID=0,this.awaiting={},this.pending=[],this.debug=!1,this.updatesProcessor=null,console.log(r.dT(),"ApiManagerProxy constructor"),window.Worker&&Promise.resolve().then(()=>a(s(78))).then(e=>{var t=new e.default;t.onmessage=e=>{this.webWorker||(this.webWorker=t,console.info(r.dT(),"ApiManagerProxy set webWorker"),this.releasePending()),r.isObject(e.data)&&(e.data.useLs?l.default[e.data.task](...e.data.args).then(t=>{this.webWorker.postMessage({useLs:!0,taskID:e.data.taskID,args:t})}):e.data.update?this.updatesProcessor&&this.updatesProcessor(e.data.update.obj,e.data.update.bool):this.finalizeTask(e.data.taskID,e.data.result,e.data.error))},t.onerror=e=>{console.error("ApiManagerProxy error",e),this.webWorker=!1}})}finalizeTask(e,t,s){let i=this.awaiting[e];void 0!==i&&(this.debug&&console.log(r.dT(),"ApiManagerProxy done",i.taskName,t,s),void 0===t?i.reject(s):i.resolve(t),delete this.awaiting[e])}performTaskWorker(e,...t){return this.debug&&console.log(r.dT(),"ApiManagerProxy start",e,t),new Promise((s,i)=>{this.awaiting[this.taskID]={resolve:s,reject:i,taskName:e};let n={task:e,taskID:this.taskID,args:t};this.pending.push(n),this.releasePending(),this.taskID++})}releasePending(){this.webWorker&&(this.pending.forEach(e=>{this.webWorker.postMessage(e)}),this.pending.length=0)}setUpdatesProcessor(e){this.updatesProcessor=e}invokeApi(e,t={},s={}){return this.performTaskWorker("invokeApi",e,t,s)}setBaseDcID(e){return this.performTaskWorker("setBaseDcID",e)}setUserAuth(e){return r.$rootScope.$broadcast("user_auth",e),this.performTaskWorker("setUserAuth",e)}getNetworker(e){return this.performTaskWorker("getNetworker",e)}getUserID(){return this.performTaskWorker("getUserID")}logOut(){return this.performTaskWorker("logOut")}checkPassword(e){return this.performTaskWorker("checkPassword",e)}}const u=new c;t.default=u},function(e,t,s){"use strict";s.r(t),s.d(t,"RichTextProcessor",(function(){return L}));var i,n=s(0),a=s(4),o=s.n(a),r={emojiMap:e=>e,shortcuts:[],emojis:[]},l=o.a.Emoji,d=-1!=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i),c=new RegExp("(^| )(@)([a-zA-Z\\d_]{5,32})|(((?:https?|ftp)://|mailto:)?(?:\\S{1,64}(?::\\S{0,64})?@)?(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}|[a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc0-9][a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc·0-9-]{0,64}(?:\\.[a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc0-9][a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc·0-9-]{0,64}){0,10}(?:\\.(xn--[0-9a-z]{2,16}|[a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc]{2,24})))(?::\\d{2,5})?(?:/(?:\\S{0,255}[^\\s.;,(\\[\\]{}<>\"'])?)?)|(\\n)|((?:\\ud83d\\udc68\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1|\\ud83d\\udc6b\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6c\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6d\\ud83c[\\udffb-\\udfff]|\\ud83d[\\udc6b-\\udc6d])|(?:\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1)(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf7c\\udf84\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddaf-\\uddb3\\uddbc\\uddbd])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc70\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddcd-\\uddcf\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\u26a7\\ufe0f|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc15\\u200d\\ud83e\\uddba|\\ud83d\\udc3b\\u200d\\u2744\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f|\\ud83d\\udc08\\u200d\\u2b1b)|[#*0-9]\\ufe0f?\\u20e3|(?:[©®\\u2122\\u265f]\\ufe0f*)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26a7\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd0c\\udd0f\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\udd77\\uddb5\\uddb6\\uddb8\\uddb9\\uddbb\\uddcd-\\uddcf\\uddd1-\\udddd]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\uded5-\\uded7\\udeeb\\udeec\\udef4-\\udefc\\udfe0-\\udfeb]|\\ud83e[\\udd0d\\udd0e\\udd10-\\udd17\\udd1d\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd3f-\\udd45\\udd47-\\udd76\\udd78\\udd7a-\\uddb4\\uddb7\\uddba\\uddbc-\\uddcb\\uddd0\\uddde-\\uddff\\ude70-\\ude74\\ude78-\\ude7a\\ude80-\\ude86\\ude90-\\udea8\\udeb0-\\udeb6\\udec0-\\udec2\\uded0-\\uded6]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a]))|(^|[\\s\\(\\]])(#[0-9_a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc]{2,64})|(^|\\s)\\/([a-zA-Z\\d_]{1,32})(?:@([a-zA-Z\\d_]{5,32}))?(\\b|$)","i"),u=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,h=/[`_*@]/,p=/(^|\s|\n)(````?)([\s\S]+?)(````?)([\s\n\.,:?!;]|$)|(^|\s)(`|\*\*|__)([^\n]+?)\7([\s\.,:?!;]|$)|@(\d+)\s*\((.+?)\)/m,f={Telegram:"tg://search_hashtag?hashtag={1}",Twitter:"https://twitter.com/hashtag/{1}",Instagram:"https://instagram.com/explore/tags/{1}/","Google Plus":"https://plus.google.com/explore/{1}"},m={Telegram:"#/im?p=%40{1}",Twitter:"https://twitter.com/{1}",Instagram:"https://instagram.com/{1}/",GitHub:"https://github.com/{1}"},g={"`":"messageEntityCode","**":"messageEntityBold",__:"messageEntityItalic"};function v(e){return void 0===l[e]?null:Object(n.emojiUnicode)(e).replace(/(-fe0f|fe0f)/g,"")}function b(e,t={}){for(var s,i,n=e,a=[],r=0;s=n.match(c);){if(i=r+s.index,s[3])a.push({_:"messageEntityMention",offset:i+s[1].length,length:s[2].length+s[3].length});else if(s[4])if(u.test(s[4]))a.push({_:"messageEntityEmail",offset:i,length:s[4].length});else{var l=!1,d=s[5],h=s[6];if(h){if(d||"xn--"!==h.substr(0,4)&&-1===o.a.TLD.indexOf(h.toLowerCase())||(d="http://"),d){var p=w(s[4]);p.length!==s[4].length&&(s[4].substring(p.length),s[4]=p),l=(s[5]?"":d)+s[4]}}else l=(s[5]?"":"http://")+s[4];l&&a.push({_:"messageEntityUrl",offset:i,length:s[4].length})}else if(s[7])a.push({_:"messageEntityLinebreak",offset:i,length:1});else if(s[8]){let e=v(s[8]);e&&a.push({_:"messageEntityEmoji",offset:i,length:s[8].length,unicode:e})}else s[10]?a.push({_:"messageEntityHashtag",offset:i+(s[9]?s[9].length:0),length:s[10].length}):s[12]&&a.push({_:"messageEntityBotCommand",offset:i+(s[11]?s[11].length:0),length:1+s[12].length+(s[13]?1+s[13].length:0)});n=n.substr(s.index+s[0].length),r+=s.index+s[0].length}return a}function y(e,t,s){return void 0===t?Object(n.encodeEntities)(e):(s.hasNested=!0,_(e,{entities:t,nested:!0}))}function _(e,t={}){if(!e||!e.length)return"";var s=t.entities,i=t.contextSite||"Telegram",a="Telegram"!=i;void 0===s&&(s=b(e,t));for(var o,r,l,c,u=s.length,h=[],p=0,g=0;g<u;g++){if((o=s[g]).offset>p)h.push(Object(n.encodeEntities)(e.substr(p,o.offset-p)));else if(o.offset<p)continue;switch(l=!1,r=e.substr(o.offset,o.length),o._){case"messageEntityMention":if(!(w=!t.noLinks&&m[i])){l=!0;break}var v=r.substr(1),_="";t.highlightUsername&&t.highlightUsername.toLowerCase()==v.toLowerCase()&&(_='class="im_message_mymention"'),h.push("<a ",_,a?' target="_blank" rel="noopener noreferrer" ':"",' href="',w.replace("{1}",encodeURIComponent(v)),'">',Object(n.encodeEntities)(r),"</a>");break;case"messageEntityMentionName":if(t.noLinks){l=!0;break}h.push('<a href="#/im?p=u',encodeURIComponent(o.user_id),'">',Object(n.encodeEntities)(r),"</a>");break;case"messageEntityHashtag":var w;if(!(w=!t.noLinks&&f[i])){l=!0;break}var L=r.substr(1);h.push("<a ",a?' target="_blank" rel="noopener noreferrer" ':"",'href="',w.replace("{1}",encodeURIComponent(L)),'">',Object(n.encodeEntities)(r),"</a>");break;case"messageEntityEmail":if(t.noLinks){l=!0;break}h.push('<a href="',Object(n.encodeEntities)("mailto:"+r),'" target="_blank" rel="noopener noreferrer">',Object(n.encodeEntities)(r),"</a>");break;case"messageEntityUrl":case"messageEntityTextUrl":var M;"messageEntityTextUrl"==o._?(c=S(c=o.url,!0),M=y(r,o.nested,t)):(c=S(r,!1),M=Object(n.encodeEntities)(r.replace(/(%[A-Z\d]{2})+/g,(function(e){try{return decodeURIComponent(e)}catch(t){return e}})))),t.noLinks?h.push(M):h.push('<a href="',Object(n.encodeEntities)(c),'" target="_blank" rel="noopener noreferrer">',M,"</a>");break;case"messageEntityLinebreak":h.push(t.noLinebreaks?" ":"<br/>");break;case"messageEntityEmoji":h.push(d?`<span class="emoji" contenteditable="false">${Object(n.encodeEntities)(r)}</span>`:`<img src="assets/img/emoji/${o.unicode}.png" alt="${Object(n.encodeEntities)(r)}" class="emoji">`),!0;break;case"messageEntityBotCommand":if(t.noLinks||t.noCommands||a){l=!0;break}var D,E,I=r.substr(1);-1!=(E=I.indexOf("@"))?(D=I.substr(E+1),I=I.substr(0,E)):D=t.fromBot,h.push('<a href="',Object(n.encodeEntities)("tg://bot_command?command="+encodeURIComponent(I)+(D?"&bot="+encodeURIComponent(D):"")),'">',Object(n.encodeEntities)(r),"</a>");break;case"messageEntityBold":if(t.noTextFormat){h.push(y(r,o.nested,t));break}h.push("<strong>",y(r,o.nested,t),"</strong>");break;case"messageEntityItalic":if(t.noTextFormat){h.push(y(r,o.nested,t));break}h.push("<em>",y(r,o.nested,t),"</em>");break;case"messageEntityHighlight":h.push("<i>",y(r,o.nested,t),"</i>");break;case"messageEntityCode":if(t.noTextFormat){h.push(Object(n.encodeEntities)(r));break}h.push("<code>",Object(n.encodeEntities)(r),"</code>");break;case"messageEntityPre":if(t.noTextFormat){h.push(Object(n.encodeEntities)(r));break}h.push("<pre><code",o.language?' class="language-'+Object(n.encodeEntities)(o.language)+'"':"",">",Object(n.encodeEntities)(r),"</code></pre>");break;default:l=!0}p=o.offset+(l?0:o.length)}return h.push(Object(n.encodeEntities)(e.substr(p))),e=h.join("")}function w(e){for(var t=e.length,s=e.split("(").length-1,i=e.split(")").length-1;i>s&&")"===e.charAt(t-1);)e=e.substr(0,t-1),i--,t--;return s>i&&(e=e.replace(/\)+$/,"")),e}function S(e,t){var s,i;if(e.match(/^https?:\/\//i)||(e="http://"+e),2==t)e="tg://unsafe_url?url="+encodeURIComponent(e);else if(s=e.match(/^https?:\/\/t(?:elegram)?\.me\/(.+)/)){var n=s[1].split("/");switch(n[0]){case"joinchat":e="tg://join?invite="+n[1];break;case"addstickers":e="tg://addstickers?set="+n[1];break;default:if(n[1]&&n[1].match(/^\d+$/))e="tg://resolve?domain="+n[0]+"&post="+n[1];else if(1==n.length){var a=n[0].split("?"),o=a[0],r=a[1];if("iv"==o){var l=(r||"").match(/url=([^&=]+)/);if(l){e=l[1];try{e=decodeURIComponent(e)}catch(e){}return S(e,t)}}e="tg://resolve?domain="+o+(r?"&"+r:"")}}}else(i=e.match(/^https?:\/\/telesco\.pe\/([^/?]+)\/(\d+)/))?e="tg://resolve?domain="+i[1]+"&post="+i[2]:t&&(e="tg://unsafe_url?url="+encodeURIComponent(e));return e}let L={wrapRichText:_,wrapPlainText:function(e,t={}){if(d)return e;if(!e||!e.length)return"";var s,n,a=e=e.replace(/\ufe0f/g,"",e);for(e=[];s=a.match(c);)e.push(a.substr(0,s.index)),s[8]&&(i=r.emojiMap[s[8]])&&(n=l[i][1][0])?e.push(":"+n+":"):e.push(s[0]),a=a.substr(s.index+s[0].length);return e.push(a),e.join("")},wrapDraftText:function(e,t){if(!e||!e.length)return"";var s=(t=t||{}).entities;void 0===s&&(s=b(e,t));var i,n,a,o=0,r=s.length,l=[],d=0;for(o=0;o<r;o++){if((i=s[o]).offset>d)l.push(e.substr(d,i.offset-d));else if(i.offset<d)continue;switch(a=!1,n=e.substr(i.offset,i.length),i._){case"messageEntityEmoji":l.push(":",i.title,":");break;case"messageEntityCode":l.push("`",n,"`");break;case"messageEntityBold":l.push("**",n,"**");break;case"messageEntityItalic":l.push("__",n,"__");break;case"messageEntityPre":l.push("```",n,"```");break;case"messageEntityMentionName":l.push("@",i.user_id," (",n,")");break;default:a=!0}d=i.offset+(a?0:i.length)}return l.push(e.substr(d)),l.join("")},wrapUrl:S,wrapEmojiText:function(e){return e?_(e,{entities:b(e).filter(e=>"messageEntityEmoji"==e._)}):""},parseEntities:b,parseMarkdown:function(e,t,s){if(!h.test(e))return s?e:e.trim();for(var i,n,a=e,o=[],r=0;i=a.match(p);){n=r+i.index,o.push(a.substr(0,i.index)),r-=(e=i[3]||i[8]||i[11]).length,r+=(e=e.replace(/^\s+|\s+$/g,"")).length,e.match(/^`*$/)?o.push(i[0]):i[3]?("\n"==i[5]&&(i[5]="",r-=1),o.push(i[1]+e+i[5]),t.push({_:"messageEntityPre",language:"",offset:n+i[1].length,length:e.length}),r-=i[2].length+i[4].length):i[7]?(o.push(i[6]+e+i[9]),t.push({_:g[i[7]],offset:n+i[6].length,length:e.length}),r-=2*i[7].length):i[11]&&(o.push(e),t.push({_:"messageEntityMentionName",user_id:i[10],offset:n,length:e.length}),r-=i[0].length-e.length),a=a.substr(i.index+i[0].length),r+=i.index+i[0].length}return o.push(a),(o=o.join("")).replace(/\s+/g,"").length||(o=e,t.splice(0,t.length)),t.length||s||(o=o.trim()),o},parseEmojis:function(e){return e.replace(/:([a-z0-9\-\+\*_]+?):/gi,(function(e,t){var s=r.shortcuts[t];return void 0!==s?r.emojis[s][0]:e}))},mergeEntities:function(e,t,s){var i,a,o,r,l,d,c,u,h,p=t.slice(),f=e.length,m=t.length,g=0;for(i=0;i<f;i++)if(o=e[i],!s||"messageEntityLinebreak"==o._||"messageEntityEmoji"==o._){for(d=(l=o.offset)+o.length,h=!1,a=g;a<m;a++){if(u=(c=(r=t[a]).offset)+r.length,c<=l&&(g=a),l>=c&&l<u||d>c&&d<=u){s&&l>=c&&d<=u&&(void 0===r.nested&&(r.nested=[]),o.offset-=c,r.nested.push(Object(n.copy)(o))),h=!0;break}if(c>=d)break}h||p.push(o)}return p.sort((function(e,t){return e.offset-t.offset})),p},getEmojiSpritesheetCoords:v,emojiSupported:d};window.RichTextProcessor=L},function(e,t,s){"use strict";
/*!
* Webogram v0.7.0 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/Object.defineProperty(t,"__esModule",{value:!0}),t.isSafari=t.isAndroid=t.isApple=t.touchSupport=t.mediaSizes=t.LatinizeMap=t.TLD=t.Countries=t.Emoji=void 0,t.Emoji={"#️⃣":6365,"*️⃣":6366,"0⃣":6367,"1⃣":6368,"2⃣":6369,"3⃣":6370,"4⃣":6371,"5⃣":6372,"6⃣":6373,"7⃣":6374,"8⃣":6375,"9⃣":6376,"©️":6362,"®️":6363,"🀄":573,"🃏":572,"🅰️":6383,"🅱️":6385,"🅾️":6394,"🅿️":6396,"🆎":6384,"🆑":6386,"🆒":6387,"🆓":6388,"🆔":6390,"🆕":6392,"🆖":6393,"🆗":6395,"🆘":6397,"🆙":6398,"🆚":6399,"🇦🇨":78,"🇦🇩":79,"🇦🇪":710,"🇦🇫":711,"🇦🇬":712,"🇦🇮":713,"🇦🇱":714,"🇦🇲":715,"🇦🇴":716,"🇦🇶":717,"🇦🇷":718,"🇦🇸":719,"🇦🇹":720,"🇦🇺":721,"🇦🇼":722,"🇦🇽":723,"🇦🇿":724,"🇧🇦":725,"🇧🇧":726,"🇧🇩":727,"🇧🇪":728,"🇧🇫":729,"🇧🇬":730,"🇧🇭":731,"🇧🇮":732,"🇧🇯":733,"🇧🇱":734,"🇧🇲":735,"🇧🇳":736,"🇧🇴":737,"🇧🇶":738,"🇧🇷":739,"🇧🇸":740,"🇧🇹":741,"🇧🇻":742,"🇧🇼":743,"🇧🇾":744,"🇧🇿":745,"🇨🇦":746,"🇨🇨":747,"🇨🇩":748,"🇨🇫":749,"🇨🇬":750,"🇨🇭":751,"🇨🇮":752,"🇨🇰":753,"🇨🇱":754,"🇨🇲":755,"🇨🇳":756,"🇨🇴":757,"🇨🇵":758,"🇨🇷":759,"🇨🇺":760,"🇨🇻":761,"🇨🇼":762,"🇨🇽":763,"🇨🇾":764,"🇨🇿":765,"🇩🇪":766,"🇩🇬":767,"🇩🇯":768,"🇩🇰":769,"🇩🇲":770,"🇩🇴":771,"🇩🇿":772,"🇪🇦":773,"🇪🇨":774,"🇪🇪":775,"🇪🇬":776,"🇪🇭":777,"🇪🇷":778,"🇪🇸":779,"🇪🇹":780,"🇪🇺":781,"🇫🇮":782,"🇫🇯":783,"🇫🇰":784,"🇫🇲":785,"🇫🇴":786,"🇫🇷":787,"🇬🇦":788,"🇬🇧":789,"🇬🇩":790,"🇬🇪":791,"🇬🇫":792,"🇬🇬":793,"🇬🇭":794,"🇬🇮":795,"🇬🇱":796,"🇬🇲":797,"🇬🇳":798,"🇬🇵":799,"🇬🇶":7100,"🇬🇷":7101,"🇬🇸":7102,"🇬🇹":7103,"🇬🇺":7104,"🇬🇼":7105,"🇬🇾":7106,"🇭🇰":7107,"🇭🇲":7108,"🇭🇳":7109,"🇭🇷":7110,"🇭🇹":7111,"🇭🇺":7112,"🇮🇨":7113,"🇮🇩":7114,"🇮🇪":7115,"🇮🇱":7116,"🇮🇲":7117,"🇮🇳":7118,"🇮🇴":7119,"🇮🇶":7120,"🇮🇷":7121,"🇮🇸":7122,"🇮🇹":7123,"🇯🇪":7124,"🇯🇲":7125,"🇯🇴":7126,"🇯🇵":7127,"🇰🇪":7128,"🇰🇬":7129,"🇰🇭":7130,"🇰🇮":7131,"🇰🇲":7132,"🇰🇳":7133,"🇰🇵":7134,"🇰🇷":7135,"🇰🇼":7136,"🇰🇾":7137,"🇰🇿":7138,"🇱🇦":7139,"🇱🇧":7140,"🇱🇨":7141,"🇱🇮":7142,"🇱🇰":7143,"🇱🇷":7144,"🇱🇸":7145,"🇱🇹":7146,"🇱🇺":7147,"🇱🇻":7148,"🇱🇾":7149,"🇲🇦":7150,"🇲🇨":7151,"🇲🇩":7152,"🇲🇪":7153,"🇲🇫":7154,"🇲🇬":7155,"🇲🇭":7156,"🇲🇰":7157,"🇲🇱":7158,"🇲🇲":7159,"🇲🇳":7160,"🇲🇴":7161,"🇲🇵":7162,"🇲🇶":7163,"🇲🇷":7164,"🇲🇸":7165,"🇲🇹":7166,"🇲🇺":7167,"🇲🇻":7168,"🇲🇼":7169,"🇲🇽":7170,"🇲🇾":7171,"🇲🇿":7172,"🇳🇦":7173,"🇳🇨":7174,"🇳🇪":7175,"🇳🇫":7176,"🇳🇬":7177,"🇳🇮":7178,"🇳🇱":7179,"🇳🇴":7180,"🇳🇵":7181,"🇳🇷":7182,"🇳🇺":7183,"🇳🇿":7184,"🇴🇲":7185,"🇵🇦":7186,"🇵🇪":7187,"🇵🇫":7188,"🇵🇬":7189,"🇵🇭":7190,"🇵🇰":7191,"🇵🇱":7192,"🇵🇲":7193,"🇵🇳":7194,"🇵🇷":7195,"🇵🇸":7196,"🇵🇹":7197,"🇵🇼":7198,"🇵🇾":7199,"🇶🇦":7200,"🇷🇪":7201,"🇷🇴":7202,"🇷🇸":7203,"🇷🇺":7204,"🇷🇼":7205,"🇸🇦":7206,"🇸🇧":7207,"🇸🇨":7208,"🇸🇩":7209,"🇸🇪":7210,"🇸🇬":7211,"🇸🇭":7212,"🇸🇮":7213,"🇸🇯":7214,"🇸🇰":7215,"🇸🇱":7216,"🇸🇲":7217,"🇸🇳":7218,"🇸🇴":7219,"🇸🇷":7220,"🇸🇸":7221,"🇸🇹":7222,"🇸🇻":7223,"🇸🇽":7224,"🇸🇾":7225,"🇸🇿":7226,"🇹🇦":7227,"🇹🇨":7228,"🇹🇩":7229,"🇹🇫":7230,"🇹🇬":7231,"🇹🇭":7232,"🇹🇯":7233,"🇹🇰":7234,"🇹🇱":7235,"🇹🇲":7236,"🇹🇳":7237,"🇹🇴":7238,"🇹🇷":7239,"🇹🇹":7240,"🇹🇻":7241,"🇹🇼":7242,"🇹🇿":7243,"🇺🇦":7244,"🇺🇬":7245,"🇺🇲":7246,"🇺🇳":7247,"🇺🇸":7248,"🇺🇾":7249,"🇺🇿":7250,"🇻🇦":7251,"🇻🇨":7252,"🇻🇪":7253,"🇻🇬":7254,"🇻🇮":7255,"🇻🇳":7256,"🇻🇺":7257,"🇼🇫":7258,"🇼🇸":7259,"🇽🇰":7260,"🇾🇪":7261,"🇾🇹":7262,"🇿🇦":7263,"🇿🇲":7264,"🇿🇼":7265,"🈁":6400,"🈂️":6401,"🈚":6407,"🈯":6404,"🈲":6408,"🈳":6412,"🈴":6411,"🈵":6416,"🈶":6403,"🈷️":6402,"🈸":6410,"🈹":6406,"🈺":6415,"🉐":6405,"🉑":6409,"🌀":4197,"🌁":449,"🌂":4199,"🌃":450,"🌄":452,"🌅":453,"🌆":454,"🌇":455,"🌈":4198,"🌉":456,"🌊":4210,"🌋":410,"🌌":4184,"🌍":41,"🌎":42,"🌏":43,"🌐":44,"🌑":4164,"🌒":4165,"🌓":4166,"🌔":4167,"🌕":4168,"🌖":4169,"🌗":4170,"🌘":4171,"🌙":4172,"🌚":4173,"🌛":4174,"🌜":4175,"🌝":4178,"🌞":4179,"🌟":4182,"🌠":4183,"🌡️":4176,"🌤️":4188,"🌥️":4189,"🌦️":4190,"🌧️":4191,"🌨️":4192,"🌩️":4193,"🌪️":4194,"🌫️":4195,"🌬️":4196,"🌭":347,"🌮":349,"🌯":350,"🌰":331,"🌱":2116,"🌲":2117,"🌳":2118,"🌴":2119,"🌵":2120,"🌶️":323,"🌷":2115,"🌸":2107,"🌹":2110,"🌺":2112,"🌻":2113,"🌼":2114,"🌽":322,"🌾":2121,"🌿":2122,"🍀":2124,"🍁":2125,"🍂":2126,"🍃":2127,"🍄":329,"🍅":316,"🍆":319,"🍇":31,"🍈":32,"🍉":33,"🍊":34,"🍋":35,"🍌":36,"🍍":37,"🍎":39,"🍏":310,"🍐":311,"🍑":312,"🍒":313,"🍓":314,"🍔":344,"🍕":346,"🍖":340,"🍗":341,"🍘":364,"🍙":365,"🍚":366,"🍛":367,"🍜":368,"🍝":369,"🍞":332,"🍟":345,"🍠":370,"🍡":376,"🍢":371,"🍣":372,"🍤":373,"🍥":374,"🍦":385,"🍧":386,"🍨":387,"🍩":388,"🍪":389,"🍫":394,"🍬":395,"🍭":396,"🍮":397,"🍯":398,"🍰":391,"🍱":363,"🍲":356,"🍳":354,"🍴":3118,"🍵":3102,"🍶":3103,"🍷":3105,"🍸":3106,"🍹":3107,"🍺":3108,"🍻":3109,"🍼":399,"🍽️":3117,"🍾":3104,"🍿":359,"🎀":517,"🎁":518,"🎂":390,"🎃":51,"🎄":52,"🎅":1326,"🎆":53,"🎇":54,"🎈":57,"🎉":58,"🎊":59,"🎋":510,"🎌":73,"🎍":511,"🎎":512,"🎏":513,"🎐":514,"🎑":515,"🎒":625,"🎓":637,"🎖️":522,"🎗️":519,"🎙️":656,"🎚️":657,"🎛️":658,"🎞️":689,"🎟️":520,"🎠":458,"🎡":459,"🎢":460,"🎣":549,"🎤":659,"🎥":688,"🎦":6324,"🎧":660,"🎨":577,"🎩":636,"🎪":462,"🎫":521,"🎬":691,"🎭":575,"🎮":561,"🎯":555,"🎰":563,"🎱":558,"🎲":564,"🎳":537,"🎴":574,"🎵":654,"🎶":655,"🎷":662,"🎸":663,"🎹":664,"🎺":665,"🎻":666,"🎼":653,"🎽":551,"🎾":535,"🎿":552,"🏀":531,"🏁":71,"🏂":1397,"🏃‍♀️":1381,"🏃‍♂️":1380,"🏃":1379,"🏄‍♀️":1403,"🏄‍♂️":1402,"🏄":1401,"🏅":524,"🏆":523,"🏇":1395,"🏈":533,"🏉":534,"🏊‍♀️":1409,"🏊‍♂️":1408,"🏊":1407,"🏋️‍♀️":1415,"🏋️‍♂️":1414,"🏋️":1413,"🏌️‍♀️":1400,"🏌️‍♂️":1399,"🏌️":1398,"🏍️":492,"🏎️":491,"🏏":538,"🏐":532,"🏑":539,"🏒":540,"🏓":542,"🏔️":48,"🏕️":412,"🏖️":413,"🏗️":419,"🏘️":421,"🏙️":451,"🏚️":422,"🏛️":418,"🏜️":414,"🏝️":415,"🏞️":416,"🏟️":417,"🏠":423,"🏡":424,"🏢":425,"🏣":426,"🏤":427,"🏥":428,"🏦":429,"🏧":6234,"🏨":430,"🏩":431,"🏪":432,"🏫":433,"🏬":434,"🏭":435,"🏮":6102,"🏯":436,"🏰":437,"🏳️‍🌈":76,"🏳️":75,"🏴‍☠️":77,"🏴󠁧󠁢󠁥󠁮󠁧󠁿":7266,"🏴󠁧󠁢󠁳󠁣󠁴󠁿":7267,"🏴󠁧󠁢󠁷󠁬󠁳󠁿":7268,"🏴":74,"🏵️":2109,"🏷️":6120,"🏸":543,"🏹":6189,"🏺":3121,"🏻":81,"🏼":82,"🏽":83,"🏾":84,"🏿":85,"🐀":244,"🐁":243,"🐂":225,"🐃":226,"🐄":227,"🐅":217,"🐆":218,"🐇":247,"🐈":214,"🐉":282,"🐊":277,"🐋":286,"🐌":294,"🐍":280,"🐎":220,"🐏":232,"🐐":234,"🐑":233,"🐒":22,"🐓":262,"🐔":261,"🐕‍🦺":28,"🐕":26,"🐖":229,"🐗":230,"🐘":239,"🐙":292,"🐚":293,"🐛":296,"🐜":297,"🐝":298,"🐞":299,"🐟":288,"🐠":289,"🐡":290,"🐢":278,"🐣":263,"🐤":264,"🐥":265,"🐦":266,"🐧":267,"🐨":252,"🐩":29,"🐪":235,"🐫":236,"🐬":287,"🐭":242,"🐮":224,"🐯":216,"🐰":246,"🐱":213,"🐲":281,"🐳":285,"🐴":219,"🐵":21,"🐶":25,"🐷":228,"🐸":276,"🐹":245,"🐺":210,"🐻":251,"🐼":253,"🐽":231,"🐾":259,"🐿️":248,"👀":1194,"👁️‍🗨️":1145,"👁️":1195,"👂":1188,"👃":1190,"👄":1197,"👅":1196,"👆":1164,"👇":1166,"👈":1162,"👉":1163,"👊":1171,"👋":1150,"👌":1155,"👍":1168,"👎":1169,"👏":1174,"👐":1176,"👑":634,"👒":635,"👓":61,"👔":66,"👕":67,"👖":68,"👗":613,"👘":614,"👙":619,"👚":620,"👛":621,"👜":622,"👝":623,"👞":626,"👟":627,"👠":630,"👡":631,"👢":633,"👣":1483,"👤":1481,"👥":1482,"👦":1200,"👧":1201,"👨‍🌾":1267,"👨‍🍳":1270,"👨‍🎓":1258,"👨‍🎤":1288,"👨‍🎨":1291,"👨‍🏫":1261,"👨‍🏭":1276,"👨‍👦‍👦":1471,"👨‍👦":1470,"👨‍👧‍👦":1473,"👨‍👧‍👧":1474,"👨‍👧":1472,"👨‍👨‍👦":1460,"👨‍👨‍👦‍👦":1463,"👨‍👨‍👧":1461,"👨‍👨‍👧‍👦":1462,"👨‍👨‍👧‍👧":1464,"👨‍👩‍👦":1455,"👨‍👩‍👦‍👦":1458,"👨‍👩‍👧":1456,"👨‍👩‍👧‍👦":1457,"👨‍👩‍👧‍👧":1459,"👨‍💻":1285,"👨‍💼":1279,"👨‍🔧":1273,"👨‍🔬":1282,"👨‍🚀":1297,"👨‍🚒":1300,"👨‍🦯":1371,"👨‍🦰":1206,"👨‍🦱":1207,"👨‍🦲":1209,"👨‍🦳":1208,"👨‍🦼":1374,"👨‍🦽":1377,"👨‍⚕️":1255,"👨‍⚖️":1264,"👨‍✈️":1294,"👨‍❤️‍👨":1452,"👨‍❤️‍💋‍👨":1448,"👨":1204,"👩‍🌾":1268,"👩‍🍳":1271,"👩‍🎓":1259,"👩‍🎤":1289,"👩‍🎨":1292,"👩‍🏫":1262,"👩‍🏭":1277,"👩‍👦‍👦":1476,"👩‍👦":1475,"👩‍👧‍👦":1478,"👩‍👧‍👧":1479,"👩‍👧":1477,"👩‍👩‍👦":1465,"👩‍👩‍👦‍👦":1468,"👩‍👩‍👧":1466,"👩‍👩‍👧‍👦":1467,"👩‍👩‍👧‍👧":1469,"👩‍💻":1286,"👩‍💼":1280,"👩‍🔧":1274,"👩‍🔬":1283,"👩‍🚀":1298,"👩‍🚒":1301,"👩‍🦯":1372,"👩‍🦰":1211,"👩‍🦱":1213,"👩‍🦲":1217,"👩‍🦳":1215,"👩‍🦼":1375,"👩‍🦽":1378,"👩‍⚕️":1256,"👩‍⚖️":1265,"👩‍✈️":1295,"👩‍❤️‍👨":1451,"👩‍❤️‍👩":1453,"👩‍❤️‍💋‍👨":1447,"👩‍❤️‍💋‍👩":1449,"👩":1210,"👪":1454,"👫":1444,"👬":1445,"👭":1443,"👮‍♀️":1304,"👮‍♂️":1303,"👮":1302,"👯‍♀️":1387,"👯‍♂️":1386,"👯":1385,"👰":1322,"👱‍♀️":1219,"👱‍♂️":1220,"👱":1203,"👲":1319,"👳‍♀️":1318,"👳‍♂️":1317,"👳":1316,"👴":1222,"👵":1223,"👶":1198,"👷‍♀️":1313,"👷‍♂️":1312,"👷":1311,"👸":1315,"👹":197,"👺":198,"👻":199,"👼":1325,"👽":1100,"👾":1101,"👿":192,"💀":193,"💁‍♀️":1238,"💁‍♂️":1237,"💁":1236,"💂‍♀️":1310,"💂‍♂️":1309,"💂":1308,"💃":1382,"💄":641,"💅":1181,"💆‍♀️":1357,"💆‍♂️":1356,"💆":1355,"💇‍♀️":1360,"💇‍♂️":1359,"💇":1358,"💈":461,"💉":6208,"💊":6210,"💋":1115,"💌":1116,"💍":642,"💎":643,"💏":1446,"💐":2106,"💑":1450,"💒":438,"💓":1121,"💔":1126,"💕":1123,"💖":1119,"💗":1120,"💘":1117,"💙":1131,"💚":1130,"💛":1129,"💜":1132,"💝":1118,"💞":1122,"💟":1124,"💠":6447,"💡":6100,"💢":1137,"💣":1143,"💤":1149,"💥":1138,"💦":1140,"💧":4209,"💨":1141,"💩":195,"💪":1183,"💫":1139,"💬":1144,"💭":1148,"💮":2108,"💯":1136,"💰":6121,"💱":6130,"💲":6131,"💳":6127,"💴":6122,"💵":6123,"💶":6124,"💷":6125,"💸":6126,"💹":6129,"💺":4123,"💻":677,"💼":6152,"💽":683,"💾":684,"💿":685,"📀":686,"📁":6153,"📂":6154,"📃":6113,"📄":6115,"📅":6156,"📆":6157,"📇":6160,"📈":6161,"📉":6162,"📊":6163,"📋":6164,"📌":6165,"📍":6166,"📎":6167,"📏":6169,"📐":6170,"📑":6118,"📒":6112,"📓":6111,"📔":6104,"📕":6105,"📖":6106,"📗":6107,"📘":6108,"📙":6109,"📚":6110,"📛":6337,"📜":6114,"📝":6151,"📞":672,"📟":673,"📠":674,"📡":6207,"📢":648,"📣":649,"📤":6136,"📥":6137,"📦":6138,"📧":6133,"📨":6134,"📩":6135,"📪":6140,"📫":6139,"📬":6141,"📭":6142,"📮":6143,"📯":650,"📰":6116,"📱":669,"📲":670,"📳":6328,"📴":6329,"📵":6256,"📶":6327,"📷":693,"📸":694,"📹":695,"📺":692,"📻":661,"📼":696,"📽️":690,"📿":640,"🔀":6306,"🔁":6307,"🔂":6308,"🔃":6274,"🔄":6275,"🔅":6325,"🔆":6326,"🔇":644,"🔈":645,"🔉":646,"🔊":647,"🔋":675,"🔌":676,"🔍":697,"🔎":698,"🔏":6177,"🔐":6178,"🔑":6179,"🔒":6175,"🔓":6176,"🔔":651,"🔕":652,"🔖":6119,"🔗":6197,"🔘":6448,"🔙":6276,"🔚":6277,"🔛":6278,"🔜":6279,"🔝":6280,"🔞":6257,"🔟":6377,"🔠":6378,"🔡":6379,"🔢":6380,"🔣":6381,"🔤":6382,"🔥":4208,"🔦":6101,"🔧":6191,"🔨":6181,"🔩":6192,"🔪":3120,"🔫":6188,"🔬":6205,"🔭":6206,"🔮":559,"🔯":6292,"🔰":6338,"🔱":6336,"🔲":6450,"🔳":6449,"🔴":6417,"🔵":6421,"🔶":6441,"🔷":6442,"🔸":6443,"🔹":6444,"🔺":6445,"🔻":6446,"🔼":6316,"🔽":6318,"🕉️":6283,"🕊️":268,"🕋":446,"🕌":442,"🕍":444,"🕎":6291,"🕐":4142,"🕑":4144,"🕒":4146,"🕓":4148,"🕔":4150,"🕕":4152,"🕖":4154,"🕗":4156,"🕘":4158,"🕙":4160,"🕚":4162,"🕛":4140,"🕜":4143,"🕝":4145,"🕞":4147,"🕟":4149,"🕠":4151,"🕡":4153,"🕢":4155,"🕣":4157,"🕤":4159,"🕥":4161,"🕦":4163,"🕧":4141,"🕯️":699,"🕰️":4139,"🕳️":1142,"🕴️":1384,"🕵️‍♀️":1307,"🕵️‍♂️":1306,"🕵️":1305,"🕶️":62,"🕷️":2101,"🕸️":2102,"🕹️":562,"🕺":1383,"🖇️":6168,"🖊️":6148,"🖋️":6147,"🖌️":6149,"🖍️":6150,"🖐️":1152,"🖕":1165,"🖖":1154,"🖤":1134,"🖥️":678,"🖨️":679,"🖱️":681,"🖲️":682,"🖼️":576,"🗂️":6155,"🗃️":6172,"🗄️":6173,"🗑️":6174,"🗒️":6158,"🗓️":6159,"🗜️":6194,"🗝️":6180,"🗞️":6117,"🗡️":6186,"🗣️":1480,"🗨️":1146,"🗯️":1147,"🗳️":6144,"🗺️":45,"🗻":411,"🗼":439,"🗽":440,"🗾":46,"🗿":6233,"😀":11,"😁":14,"😂":18,"😃":12,"😄":13,"😅":16,"😆":15,"😇":113,"😈":191,"😉":111,"😊":112,"😋":122,"😌":142,"😍":115,"😎":160,"😏":137,"😐":134,"😑":135,"😒":138,"😓":183,"😔":143,"😕":163,"😖":180,"😗":118,"😘":117,"😙":121,"😚":120,"😛":123,"😜":124,"😝":126,"😞":182,"😟":164,"😠":189,"😡":188,"😢":177,"😣":181,"😤":187,"😥":176,"😦":172,"😧":173,"😨":174,"😩":184,"😪":144,"😫":185,"😬":140,"😭":178,"😮":167,"😯":168,"😰":175,"😱":179,"😲":169,"😳":170,"😴":146,"😵":156,"😶":136,"😷":147,"😸":1104,"😹":1105,"😺":1103,"😻":1106,"😼":1107,"😽":1108,"😾":1111,"😿":1110,"🙀":1109,"🙁":165,"🙂":19,"🙃":110,"🙄":139,"🙅‍♀️":1232,"🙅‍♂️":1231,"🙅":1230,"🙆‍♀️":1235,"🙆‍♂️":1234,"🙆":1233,"🙇‍♀️":1247,"🙇‍♂️":1246,"🙇":1245,"🙈":1112,"🙉":1113,"🙊":1114,"🙋‍♀️":1241,"🙋‍♂️":1240,"🙋":1239,"🙌":1175,"🙍‍♀️":1226,"🙍‍♂️":1225,"🙍":1224,"🙎‍♀️":1229,"🙎‍♂️":1228,"🙎":1227,"🙏":1179,"🚀":4129,"🚁":4124,"🚂":463,"🚃":464,"🚄":465,"🚅":466,"🚆":467,"🚇":468,"🚈":469,"🚉":470,"🚊":471,"🚋":474,"🚌":475,"🚍":476,"🚎":477,"🚏":4100,"🚐":478,"🚑":479,"🚒":480,"🚓":481,"🚔":482,"🚕":483,"🚖":484,"🚗":485,"🚘":486,"🚙":487,"🚚":488,"🚛":489,"🚜":490,"🚝":472,"🚞":473,"🚟":4125,"🚠":4126,"🚡":4127,"🚢":4117,"🚣‍♀️":1406,"🚣‍♂️":1405,"🚣":1404,"🚤":4113,"🚥":4106,"🚦":4107,"🚧":4109,"🚨":4105,"🚩":72,"🚪":6213,"🚫":6250,"🚬":6230,"🚭":6252,"🚮":6235,"🚯":6253,"🚰":6236,"🚱":6254,"🚲":497,"🚳":6251,"🚴‍♀️":1418,"🚴‍♂️":1417,"🚴":1416,"🚵‍♀️":1421,"🚵‍♂️":1420,"🚵":1419,"🚶‍♀️":1363,"🚶‍♂️":1362,"🚶":1361,"🚷":6255,"🚸":6248,"🚹":6238,"🚺":6239,"🚻":6240,"🚼":6241,"🚽":6217,"🚾":6242,"🚿":6218,"🛀":1440,"🛁":6219,"🛂":6243,"🛃":6244,"🛄":6245,"🛅":6246,"🛋️":6215,"🛌":1441,"🛍️":624,"🛎️":4131,"🛏️":6214,"🛐":6281,"🛑":4108,"🛒":6229,"🛕":443,"🛠️":6185,"🛡️":6190,"🛢️":4103,"🛣️":4101,"🛤️":4102,"🛥️":4116,"🛩️":4119,"🛫":4120,"🛬":4121,"🛰️":4128,"🛳️":4114,"🛴":498,"🛵":493,"🛶":4112,"🛷":553,"🛸":4130,"🛹":499,"🛺":496,"🟠":6418,"🟡":6419,"🟢":6420,"🟣":6422,"🟤":6423,"🟥":6426,"🟦":6430,"🟧":6427,"🟨":6428,"🟩":6429,"🟪":6431,"🟫":6432,"🤍":1135,"🤎":1133,"🤏":1156,"🤐":132,"🤑":127,"🤒":148,"🤓":161,"🤔":131,"🤕":149,"🤖":1102,"🤗":128,"🤘":1160,"🤙":1161,"🤚":1151,"🤛":1172,"🤜":1173,"🤝":1178,"🤞":1158,"🤟":1159,"🤠":158,"🤡":196,"🤢":150,"🤣":17,"🤤":145,"🤥":141,"🤦‍♀️":1250,"🤦‍♂️":1249,"🤦":1248,"🤧":152,"🤨":133,"🤩":116,"🤪":125,"🤫":130,"🤬":190,"🤭":129,"🤮":151,"🤯":157,"🤰":1323,"🤱":1324,"🤲":1177,"🤳":1182,"🤴":1314,"🤵":1321,"🤶":1327,"🤷‍♀️":1253,"🤷‍♂️":1252,"🤷":1251,"🤸‍♀️":1424,"🤸‍♂️":1423,"🤸":1422,"🤹‍♀️":1436,"🤹‍♂️":1435,"🤹":1434,"🤺":1394,"🤼‍♀️":1427,"🤼‍♂️":1426,"🤼":1425,"🤽‍♀️":1430,"🤽‍♂️":1429,"🤽":1428,"🤾‍♀️":1433,"🤾‍♂️":1432,"🤾":1431,"🤿":550,"🥀":2111,"🥁":668,"🥂":3110,"🥃":3111,"🥄":3119,"🥅":546,"🥇":525,"🥈":526,"🥉":527,"🥊":544,"🥋":545,"🥌":554,"🥍":541,"🥎":530,"🥏":536,"🥐":333,"🥑":318,"🥒":324,"🥓":343,"🥔":320,"🥕":321,"🥖":334,"🥗":358,"🥘":355,"🥙":351,"🥚":353,"🥛":3100,"🥜":330,"🥝":315,"🥞":337,"🥟":377,"🥠":378,"🥡":379,"🥢":3116,"🥣":357,"🥤":3112,"🥥":317,"🥦":326,"🥧":393,"🥨":335,"🥩":342,"🥪":348,"🥫":362,"🥬":325,"🥭":38,"🥮":375,"🥯":336,"🥰":114,"🥱":186,"🥳":159,"🥴":155,"🥵":153,"🥶":154,"🥺":171,"🥻":615,"🥼":64,"🥽":63,"🥾":628,"🥿":629,"🦀":380,"🦁":215,"🦂":2103,"🦃":260,"🦄":221,"🦅":269,"🦆":270,"🦇":250,"🦈":291,"🦉":272,"🦊":211,"🦋":295,"🦌":223,"🦍":23,"🦎":279,"🦏":240,"🦐":382,"🦑":383,"🦒":238,"🦓":222,"🦔":249,"🦕":283,"🦖":284,"🦗":2100,"🦘":257,"🦙":237,"🦚":274,"🦛":241,"🦜":275,"🦝":212,"🦞":381,"🦟":2104,"🦠":2105,"🦡":258,"🦢":271,"🦥":254,"🦦":255,"🦧":24,"🦨":256,"🦩":273,"🦪":384,"🦮":27,"🦯":6196,"🦴":1193,"🦵":1186,"🦶":1187,"🦷":1192,"🦸‍♀️":1330,"🦸‍♂️":1329,"🦸":1328,"🦹‍♀️":1333,"🦹‍♂️":1332,"🦹":1331,"🦺":65,"🦻":1189,"🦼":495,"🦽":494,"🦾":1184,"🦿":1185,"🧀":339,"🧁":392,"🧂":361,"🧃":3113,"🧄":327,"🧅":328,"🧆":352,"🧇":338,"🧈":360,"🧉":3114,"🧊":3115,"🧍‍♀️":1366,"🧍‍♂️":1365,"🧍":1364,"🧎‍♀️":1369,"🧎‍♂️":1368,"🧎":1367,"🧏‍♀️":1244,"🧏‍♂️":1243,"🧏":1242,"🧐":162,"🧑‍🌾":1266,"🧑‍🍳":1269,"🧑‍🎓":1257,"🧑‍🎤":1287,"🧑‍🎨":1290,"🧑‍🏫":1260,"🧑‍🏭":1275,"🧑‍💻":1284,"🧑‍💼":1278,"🧑‍🔧":1272,"🧑‍🔬":1281,"🧑‍🚀":1296,"🧑‍🚒":1299,"🧑‍🤝‍🧑":1442,"🧑‍🦯":1370,"🧑‍🦰":1212,"🧑‍🦱":1214,"🧑‍🦲":1218,"🧑‍🦳":1216,"🧑‍🦼":1373,"🧑‍🦽":1376,"🧑‍⚕️":1254,"🧑‍⚖️":1263,"🧑‍✈️":1293,"🧑":1202,"🧒":1199,"🧓":1221,"🧔":1205,"🧕":1320,"🧖‍♀️":1390,"🧖‍♂️":1389,"🧖":1388,"🧗‍♀️":1393,"🧗‍♂️":1392,"🧗":1391,"🧘‍♀️":1439,"🧘‍♂️":1438,"🧘":1437,"🧙‍♀️":1336,"🧙‍♂️":1335,"🧙":1334,"🧚‍♀️":1339,"🧚‍♂️":1338,"🧚":1337,"🧛‍♀️":1342,"🧛‍♂️":1341,"🧛":1340,"🧜‍♀️":1345,"🧜‍♂️":1344,"🧜":1343,"🧝‍♀️":1348,"🧝‍♂️":1347,"🧝":1346,"🧞‍♀️":1351,"🧞‍♂️":1350,"🧞":1349,"🧟‍♀️":1354,"🧟‍♂️":1353,"🧟":1352,"🧠":1191,"🧡":1128,"🧢":638,"🧣":69,"🧤":610,"🧥":611,"🧦":612,"🧧":516,"🧨":55,"🧩":565,"🧪":6202,"🧫":6203,"🧬":6204,"🧭":47,"🧮":687,"🧯":6228,"🧰":6199,"🧱":420,"🧲":6200,"🧳":4132,"🧴":6221,"🧵":578,"🧶":579,"🧷":6222,"🧸":566,"🧹":6223,"🧺":6224,"🧻":6225,"🧼":6226,"🧽":6227,"🧾":6128,"🧿":560,"🩰":632,"🩱":616,"🩲":617,"🩳":618,"🩸":6209,"🩹":6211,"🩺":6212,"🪀":556,"🪁":557,"🪂":4122,"🪐":4180,"🪑":6216,"🪒":6220,"🪓":6182,"🪔":6103,"🪕":667,"‼️":6355,"⁉️":6356,"™️":6364,"":6389,"↔️":6269,"↕️":6268,"↖️":6267,"↗️":6261,"↘️":6263,"↙️":6265,"↩️":6270,"↪️":6271,"⌚":4135,"⌛":4133,"⌨️":680,"⏏️":6323,"⏩":6310,"⏪":6314,"⏫":6317,"⏬":6319,"⏭️":6311,"⏮️":6315,"⏯️":6312,"⏰":4136,"⏱️":4137,"⏲️":4138,"⏳":4134,"⏸️":6320,"⏹️":6321,"⏺️":6322,"Ⓜ️":6391,"▪️":6439,"▫️":6440,"▶️":6309,"◀️":6313,"◻️":6436,"◼️":6435,"◽":6438,"◾":6437,"☀️":4177,"☁️":4185,"☂️":4200,"☃️":4205,"☄️":4207,"☎️":671,"☑️":6341,"☔":4201,"☕":3101,"☘️":2123,"☝️":1167,"☠️":194,"☢️":6258,"☣️":6259,"☦️":6288,"☪️":6289,"☮️":6290,"☯️":6286,"☸️":6285,"☹️":166,"☺️":119,"♈":6293,"♉":6294,"♊":6295,"♋":6296,"♌":6297,"♍":6298,"♎":6299,"♏":6300,"♐":6301,"♑":6302,"♒":6303,"♓":6304,"♟️":571,"♠️":567,"♣️":570,"♥️":568,"♦️":569,"♨️":457,"♻️":6334,"♾️":6333,"♿":6237,"⚒️":6184,"⚓":4110,"⚔️":6187,"⚖️":6195,"⚗️":6201,"⚙️":6193,"⚛️":6282,"⚜️":6335,"⚠️":6247,"⚡":4203,"⚪":6425,"⚫":6424,"⚰️":6231,"⚱️":6232,"⚽":528,"⚾":529,"⛄":4206,"⛅":4186,"⛈️":4187,"⛎":6305,"⛏️":6183,"⛑️":639,"⛓️":6198,"⛔":6249,"⛩️":445,"⛪":441,"⛰️":49,"⛱️":4202,"⛲":447,"⛳":547,"⛴️":4115,"⛵":4111,"⛷️":1396,"⛸️":548,"⛹️‍♀️":1412,"⛹️‍♂️":1411,"⛹️":1410,"⛺":448,"⛽":4104,"✂️":6171,"✅":6340,"✈️":4118,"✉️":6132,"✊":1170,"✋":1153,"✌️":1157,"✍️":1180,"✏️":6145,"✒️":6146,"✔️":6342,"✖️":6343,"✝️":6287,"✡️":6284,"✨":56,"✳️":6352,"✴️":6353,"❄️":4204,"❇️":6354,"❌":6344,"❎":6345,"❓":6357,"❔":6358,"❕":6359,"❗":6360,"❣️":1125,"❤️":1127,"":6346,"":6347,"➗":6348,"➡️":6262,"➰":6349,"➿":6350,"⤴️":6272,"⤵️":6273,"⬅️":6266,"⬆️":6260,"⬇️":6264,"⬛":6433,"⬜":6434,"⭐":4181,"⭕":6339,"〰️":6361,"〽️":6351,"㊗️":6413,"㊙️":6414,"🎅🏻":0,"🎅🏼":0,"🎅🏽":0,"🎅🏾":0,"🎅🏿":0,"🏂🏻":0,"🏂🏼":0,"🏂🏽":0,"🏂🏾":0,"🏂🏿":0,"🏃🏻‍♀️":0,"🏃🏼‍♀️":0,"🏃🏽‍♀️":0,"🏃🏾‍♀️":0,"🏃🏿‍♀️":0,"🏃🏻‍♂️":0,"🏃🏼‍♂️":0,"🏃🏽‍♂️":0,"🏃🏾‍♂️":0,"🏃🏿‍♂️":0,"🏃🏻":0,"🏃🏼":0,"🏃🏽":0,"🏃🏾":0,"🏃🏿":0,"🏄🏻‍♀️":0,"🏄🏼‍♀️":0,"🏄🏽‍♀️":0,"🏄🏾‍♀️":0,"🏄🏿‍♀️":0,"🏄🏻‍♂️":0,"🏄🏼‍♂️":0,"🏄🏽‍♂️":0,"🏄🏾‍♂️":0,"🏄🏿‍♂️":0,"🏄🏻":0,"🏄🏼":0,"🏄🏽":0,"🏄🏾":0,"🏄🏿":0,"🏇🏻":0,"🏇🏼":0,"🏇🏽":0,"🏇🏾":0,"🏇🏿":0,"🏊🏻‍♀️":0,"🏊🏼‍♀️":0,"🏊🏽‍♀️":0,"🏊🏾‍♀️":0,"🏊🏿‍♀️":0,"🏊🏻‍♂️":0,"🏊🏼‍♂️":0,"🏊🏽‍♂️":0,"🏊🏾‍♂️":0,"🏊🏿‍♂️":0,"🏊🏻":0,"🏊🏼":0,"🏊🏽":0,"🏊🏾":0,"🏊🏿":0,"🏋🏻‍♀️":0,"🏋🏼‍♀️":0,"🏋🏽‍♀️":0,"🏋🏾‍♀️":0,"🏋🏿‍♀️":0,"🏋🏻‍♂️":0,"🏋🏼‍♂️":0,"🏋🏽‍♂️":0,"🏋🏾‍♂️":0,"🏋🏿‍♂️":0,"🏋🏻":0,"🏋🏼":0,"🏋🏽":0,"🏋🏾":0,"🏋🏿":0,"🏌🏻‍♀️":0,"🏌🏼‍♀️":0,"🏌🏽‍♀️":0,"🏌🏾‍♀️":0,"🏌🏿‍♀️":0,"🏌🏻‍♂️":0,"🏌🏼‍♂️":0,"🏌🏽‍♂️":0,"🏌🏾‍♂️":0,"🏌🏿‍♂️":0,"🏌🏻":0,"🏌🏼":0,"🏌🏽":0,"🏌🏾":0,"🏌🏿":0,"👂🏻":0,"👂🏼":0,"👂🏽":0,"👂🏾":0,"👂🏿":0,"👃🏻":0,"👃🏼":0,"👃🏽":0,"👃🏾":0,"👃🏿":0,"👆🏻":0,"👆🏼":0,"👆🏽":0,"👆🏾":0,"👆🏿":0,"👇🏻":0,"👇🏼":0,"👇🏽":0,"👇🏾":0,"👇🏿":0,"👈🏻":0,"👈🏼":0,"👈🏽":0,"👈🏾":0,"👈🏿":0,"👉🏻":0,"👉🏼":0,"👉🏽":0,"👉🏾":0,"👉🏿":0,"👊🏻":0,"👊🏼":0,"👊🏽":0,"👊🏾":0,"👊🏿":0,"👋🏻":0,"👋🏼":0,"👋🏽":0,"👋🏾":0,"👋🏿":0,"👌🏻":0,"👌🏼":0,"👌🏽":0,"👌🏾":0,"👌🏿":0,"👍🏻":0,"👍🏼":0,"👍🏽":0,"👍🏾":0,"👍🏿":0,"👎🏻":0,"👎🏼":0,"👎🏽":0,"👎🏾":0,"👎🏿":0,"👏🏻":0,"👏🏼":0,"👏🏽":0,"👏🏾":0,"👏🏿":0,"👐🏻":0,"👐🏼":0,"👐🏽":0,"👐🏾":0,"👐🏿":0,"👦🏻":0,"👦🏼":0,"👦🏽":0,"👦🏾":0,"👦🏿":0,"👧🏻":0,"👧🏼":0,"👧🏽":0,"👧🏾":0,"👧🏿":0,"👨🏻‍🌾":0,"👨🏼‍🌾":0,"👨🏽‍🌾":0,"👨🏾‍🌾":0,"👨🏿‍🌾":0,"👨🏻‍🍳":0,"👨🏼‍🍳":0,"👨🏽‍🍳":0,"👨🏾‍🍳":0,"👨🏿‍🍳":0,"👨🏻‍🎓":0,"👨🏼‍🎓":0,"👨🏽‍🎓":0,"👨🏾‍🎓":0,"👨🏿‍🎓":0,"👨🏻‍🎤":0,"👨🏼‍🎤":0,"👨🏽‍🎤":0,"👨🏾‍🎤":0,"👨🏿‍🎤":0,"👨🏻‍🎨":0,"👨🏼‍🎨":0,"👨🏽‍🎨":0,"👨🏾‍🎨":0,"👨🏿‍🎨":0,"👨🏻‍🏫":0,"👨🏼‍🏫":0,"👨🏽‍🏫":0,"👨🏾‍🏫":0,"👨🏿‍🏫":0,"👨🏻‍🏭":0,"👨🏼‍🏭":0,"👨🏽‍🏭":0,"👨🏾‍🏭":0,"👨🏿‍🏭":0,"👨🏻‍💻":0,"👨🏼‍💻":0,"👨🏽‍💻":0,"👨🏾‍💻":0,"👨🏿‍💻":0,"👨🏻‍💼":0,"👨🏼‍💼":0,"👨🏽‍💼":0,"👨🏾‍💼":0,"👨🏿‍💼":0,"👨🏻‍🔧":0,"👨🏼‍🔧":0,"👨🏽‍🔧":0,"👨🏾‍🔧":0,"👨🏿‍🔧":0,"👨🏻‍🔬":0,"👨🏼‍🔬":0,"👨🏽‍🔬":0,"👨🏾‍🔬":0,"👨🏿‍🔬":0,"👨🏻‍🚀":0,"👨🏼‍🚀":0,"👨🏽‍🚀":0,"👨🏾‍🚀":0,"👨🏿‍🚀":0,"👨🏻‍🚒":0,"👨🏼‍🚒":0,"👨🏽‍🚒":0,"👨🏾‍🚒":0,"👨🏿‍🚒":0,"👨🏻‍🦯":0,"👨🏼‍🦯":0,"👨🏽‍🦯":0,"👨🏾‍🦯":0,"👨🏿‍🦯":0,"👨🏻‍🦰":0,"👨🏼‍🦰":0,"👨🏽‍🦰":0,"👨🏾‍🦰":0,"👨🏿‍🦰":0,"👨🏻‍🦱":0,"👨🏼‍🦱":0,"👨🏽‍🦱":0,"👨🏾‍🦱":0,"👨🏿‍🦱":0,"👨🏻‍🦲":0,"👨🏼‍🦲":0,"👨🏽‍🦲":0,"👨🏾‍🦲":0,"👨🏿‍🦲":0,"👨🏻‍🦳":0,"👨🏼‍🦳":0,"👨🏽‍🦳":0,"👨🏾‍🦳":0,"👨🏿‍🦳":0,"👨🏻‍🦼":0,"👨🏼‍🦼":0,"👨🏽‍🦼":0,"👨🏾‍🦼":0,"👨🏿‍🦼":0,"👨🏻‍🦽":0,"👨🏼‍🦽":0,"👨🏽‍🦽":0,"👨🏾‍🦽":0,"👨🏿‍🦽":0,"👨🏻‍⚕️":0,"👨🏼‍⚕️":0,"👨🏽‍⚕️":0,"👨🏾‍⚕️":0,"👨🏿‍⚕️":0,"👨🏻‍⚖️":0,"👨🏼‍⚖️":0,"👨🏽‍⚖️":0,"👨🏾‍⚖️":0,"👨🏿‍⚖️":0,"👨🏻‍✈️":0,"👨🏼‍✈️":0,"👨🏽‍✈️":0,"👨🏾‍✈️":0,"👨🏿‍✈️":0,"👨🏻":0,"👨🏼":0,"👨🏽":0,"👨🏾":0,"👨🏿":0,"👩🏻‍🌾":0,"👩🏼‍🌾":0,"👩🏽‍🌾":0,"👩🏾‍🌾":0,"👩🏿‍🌾":0,"👩🏻‍🍳":0,"👩🏼‍🍳":0,"👩🏽‍🍳":0,"👩🏾‍🍳":0,"👩🏿‍🍳":0,"👩🏻‍🎓":0,"👩🏼‍🎓":0,"👩🏽‍🎓":0,"👩🏾‍🎓":0,"👩🏿‍🎓":0,"👩🏻‍🎤":0,"👩🏼‍🎤":0,"👩🏽‍🎤":0,"👩🏾‍🎤":0,"👩🏿‍🎤":0,"👩🏻‍🎨":0,"👩🏼‍🎨":0,"👩🏽‍🎨":0,"👩🏾‍🎨":0,"👩🏿‍🎨":0,"👩🏻‍🏫":0,"👩🏼‍🏫":0,"👩🏽‍🏫":0,"👩🏾‍🏫":0,"👩🏿‍🏫":0,"👩🏻‍🏭":0,"👩🏼‍🏭":0,"👩🏽‍🏭":0,"👩🏾‍🏭":0,"👩🏿‍🏭":0,"👩🏻‍💻":0,"👩🏼‍💻":0,"👩🏽‍💻":0,"👩🏾‍💻":0,"👩🏿‍💻":0,"👩🏻‍💼":0,"👩🏼‍💼":0,"👩🏽‍💼":0,"👩🏾‍💼":0,"👩🏿‍💼":0,"👩🏻‍🔧":0,"👩🏼‍🔧":0,"👩🏽‍🔧":0,"👩🏾‍🔧":0,"👩🏿‍🔧":0,"👩🏻‍🔬":0,"👩🏼‍🔬":0,"👩🏽‍🔬":0,"👩🏾‍🔬":0,"👩🏿‍🔬":0,"👩🏻‍🚀":0,"👩🏼‍🚀":0,"👩🏽‍🚀":0,"👩🏾‍🚀":0,"👩🏿‍🚀":0,"👩🏻‍🚒":0,"👩🏼‍🚒":0,"👩🏽‍🚒":0,"👩🏾‍🚒":0,"👩🏿‍🚒":0,"👩🏻‍🦯":0,"👩🏼‍🦯":0,"👩🏽‍🦯":0,"👩🏾‍🦯":0,"👩🏿‍🦯":0,"👩🏻‍🦰":0,"👩🏼‍🦰":0,"👩🏽‍🦰":0,"👩🏾‍🦰":0,"👩🏿‍🦰":0,"👩🏻‍🦱":0,"👩🏼‍🦱":0,"👩🏽‍🦱":0,"👩🏾‍🦱":0,"👩🏿‍🦱":0,"👩🏻‍🦲":0,"👩🏼‍🦲":0,"👩🏽‍🦲":0,"👩🏾‍🦲":0,"👩🏿‍🦲":0,"👩🏻‍🦳":0,"👩🏼‍🦳":0,"👩🏽‍🦳":0,"👩🏾‍🦳":0,"👩🏿‍🦳":0,"👩🏻‍🦼":0,"👩🏼‍🦼":0,"👩🏽‍🦼":0,"👩🏾‍🦼":0,"👩🏿‍🦼":0,"👩🏻‍🦽":0,"👩🏼‍🦽":0,"👩🏽‍🦽":0,"👩🏾‍🦽":0,"👩🏿‍🦽":0,"👩🏻‍⚕️":0,"👩🏼‍⚕️":0,"👩🏽‍⚕️":0,"👩🏾‍⚕️":0,"👩🏿‍⚕️":0,"👩🏻‍⚖️":0,"👩🏼‍⚖️":0,"👩🏽‍⚖️":0,"👩🏾‍⚖️":0,"👩🏿‍⚖️":0,"👩🏻‍✈️":0,"👩🏼‍✈️":0,"👩🏽‍✈️":0,"👩🏾‍✈️":0,"👩🏿‍✈️":0,"👩🏻":0,"👩🏼":0,"👩🏽":0,"👩🏾":0,"👩🏿":0,"👫🏻":0,"👫🏼":0,"👫🏽":0,"👫🏾":0,"👫🏿":0,"👩🏻‍🤝‍👨🏼":0,"👩🏻‍🤝‍👨🏽":0,"👩🏻‍🤝‍👨🏾":0,"👩🏻‍🤝‍👨🏿":0,"👩🏼‍🤝‍👨🏻":0,"👩🏼‍🤝‍👨🏽":0,"👩🏼‍🤝‍👨🏾":0,"👩🏼‍🤝‍👨🏿":0,"👩🏽‍🤝‍👨🏻":0,"👩🏽‍🤝‍👨🏼":0,"👩🏽‍🤝‍👨🏾":0,"👩🏽‍🤝‍👨🏿":0,"👩🏾‍🤝‍👨🏻":0,"👩🏾‍🤝‍👨🏼":0,"👩🏾‍🤝‍👨🏽":0,"👩🏾‍🤝‍👨🏿":0,"👩🏿‍🤝‍👨🏻":0,"👩🏿‍🤝‍👨🏼":0,"👩🏿‍🤝‍👨🏽":0,"👩🏿‍🤝‍👨🏾":0,"👬🏻":0,"👬🏼":0,"👬🏽":0,"👬🏾":0,"👬🏿":0,"👨🏻‍🤝‍👨🏼":0,"👨🏻‍🤝‍👨🏽":0,"👨🏻‍🤝‍👨🏾":0,"👨🏻‍🤝‍👨🏿":0,"👨🏼‍🤝‍👨🏻":0,"👨🏼‍🤝‍👨🏽":0,"👨🏼‍🤝‍👨🏾":0,"👨🏼‍🤝‍👨🏿":0,"👨🏽‍🤝‍👨🏻":0,"👨🏽‍🤝‍👨🏼":0,"👨🏽‍🤝‍👨🏾":0,"👨🏽‍🤝‍👨🏿":0,"👨🏾‍🤝‍👨🏻":0,"👨🏾‍🤝‍👨🏼":0,"👨🏾‍🤝‍👨🏽":0,"👨🏾‍🤝‍👨🏿":0,"👨🏿‍🤝‍👨🏻":0,"👨🏿‍🤝‍👨🏼":0,"👨🏿‍🤝‍👨🏽":0,"👨🏿‍🤝‍👨🏾":0,"👭🏻":0,"👭🏼":0,"👭🏽":0,"👭🏾":0,"👭🏿":0,"👩🏻‍🤝‍👩🏼":0,"👩🏻‍🤝‍👩🏽":0,"👩🏻‍🤝‍👩🏾":0,"👩🏻‍🤝‍👩🏿":0,"👩🏼‍🤝‍👩🏻":0,"👩🏼‍🤝‍👩🏽":0,"👩🏼‍🤝‍👩🏾":0,"👩🏼‍🤝‍👩🏿":0,"👩🏽‍🤝‍👩🏻":0,"👩🏽‍🤝‍👩🏼":0,"👩🏽‍🤝‍👩🏾":0,"👩🏽‍🤝‍👩🏿":0,"👩🏾‍🤝‍👩🏻":0,"👩🏾‍🤝‍👩🏼":0,"👩🏾‍🤝‍👩🏽":0,"👩🏾‍🤝‍👩🏿":0,"👩🏿‍🤝‍👩🏻":0,"👩🏿‍🤝‍👩🏼":0,"👩🏿‍🤝‍👩🏽":0,"👩🏿‍🤝‍👩🏾":0,"👮🏻‍♀️":0,"👮🏼‍♀️":0,"👮🏽‍♀️":0,"👮🏾‍♀️":0,"👮🏿‍♀️":0,"👮🏻‍♂️":0,"👮🏼‍♂️":0,"👮🏽‍♂️":0,"👮🏾‍♂️":0,"👮🏿‍♂️":0,"👮🏻":0,"👮🏼":0,"👮🏽":0,"👮🏾":0,"👮🏿":0,"👰🏻":0,"👰🏼":0,"👰🏽":0,"👰🏾":0,"👰🏿":0,"👱🏻‍♀️":0,"👱🏼‍♀️":0,"👱🏽‍♀️":0,"👱🏾‍♀️":0,"👱🏿‍♀️":0,"👱🏻‍♂️":0,"👱🏼‍♂️":0,"👱🏽‍♂️":0,"👱🏾‍♂️":0,"👱🏿‍♂️":0,"👱🏻":0,"👱🏼":0,"👱🏽":0,"👱🏾":0,"👱🏿":0,"👲🏻":0,"👲🏼":0,"👲🏽":0,"👲🏾":0,"👲🏿":0,"👳🏻‍♀️":0,"👳🏼‍♀️":0,"👳🏽‍♀️":0,"👳🏾‍♀️":0,"👳🏿‍♀️":0,"👳🏻‍♂️":0,"👳🏼‍♂️":0,"👳🏽‍♂️":0,"👳🏾‍♂️":0,"👳🏿‍♂️":0,"👳🏻":0,"👳🏼":0,"👳🏽":0,"👳🏾":0,"👳🏿":0,"👴🏻":0,"👴🏼":0,"👴🏽":0,"👴🏾":0,"👴🏿":0,"👵🏻":0,"👵🏼":0,"👵🏽":0,"👵🏾":0,"👵🏿":0,"👶🏻":0,"👶🏼":0,"👶🏽":0,"👶🏾":0,"👶🏿":0,"👷🏻‍♀️":0,"👷🏼‍♀️":0,"👷🏽‍♀️":0,"👷🏾‍♀️":0,"👷🏿‍♀️":0,"👷🏻‍♂️":0,"👷🏼‍♂️":0,"👷🏽‍♂️":0,"👷🏾‍♂️":0,"👷🏿‍♂️":0,"👷🏻":0,"👷🏼":0,"👷🏽":0,"👷🏾":0,"👷🏿":0,"👸🏻":0,"👸🏼":0,"👸🏽":0,"👸🏾":0,"👸🏿":0,"👼🏻":0,"👼🏼":0,"👼🏽":0,"👼🏾":0,"👼🏿":0,"💁🏻‍♀️":0,"💁🏼‍♀️":0,"💁🏽‍♀️":0,"💁🏾‍♀️":0,"💁🏿‍♀️":0,"💁🏻‍♂️":0,"💁🏼‍♂️":0,"💁🏽‍♂️":0,"💁🏾‍♂️":0,"💁🏿‍♂️":0,"💁🏻":0,"💁🏼":0,"💁🏽":0,"💁🏾":0,"💁🏿":0,"💂🏻‍♀️":0,"💂🏼‍♀️":0,"💂🏽‍♀️":0,"💂🏾‍♀️":0,"💂🏿‍♀️":0,"💂🏻‍♂️":0,"💂🏼‍♂️":0,"💂🏽‍♂️":0,"💂🏾‍♂️":0,"💂🏿‍♂️":0,"💂🏻":0,"💂🏼":0,"💂🏽":0,"💂🏾":0,"💂🏿":0,"💃🏻":0,"💃🏼":0,"💃🏽":0,"💃🏾":0,"💃🏿":0,"💅🏻":0,"💅🏼":0,"💅🏽":0,"💅🏾":0,"💅🏿":0,"💆🏻‍♀️":0,"💆🏼‍♀️":0,"💆🏽‍♀️":0,"💆🏾‍♀️":0,"💆🏿‍♀️":0,"💆🏻‍♂️":0,"💆🏼‍♂️":0,"💆🏽‍♂️":0,"💆🏾‍♂️":0,"💆🏿‍♂️":0,"💆🏻":0,"💆🏼":0,"💆🏽":0,"💆🏾":0,"💆🏿":0,"💇🏻‍♀️":0,"💇🏼‍♀️":0,"💇🏽‍♀️":0,"💇🏾‍♀️":0,"💇🏿‍♀️":0,"💇🏻‍♂️":0,"💇🏼‍♂️":0,"💇🏽‍♂️":0,"💇🏾‍♂️":0,"💇🏿‍♂️":0,"💇🏻":0,"💇🏼":0,"💇🏽":0,"💇🏾":0,"💇🏿":0,"💪🏻":0,"💪🏼":0,"💪🏽":0,"💪🏾":0,"💪🏿":0,"🕴🏻":0,"🕴🏼":0,"🕴🏽":0,"🕴🏾":0,"🕴🏿":0,"🕵🏻‍♀️":0,"🕵🏼‍♀️":0,"🕵🏽‍♀️":0,"🕵🏾‍♀️":0,"🕵🏿‍♀️":0,"🕵🏻‍♂️":0,"🕵🏼‍♂️":0,"🕵🏽‍♂️":0,"🕵🏾‍♂️":0,"🕵🏿‍♂️":0,"🕵🏻":0,"🕵🏼":0,"🕵🏽":0,"🕵🏾":0,"🕵🏿":0,"🕺🏻":0,"🕺🏼":0,"🕺🏽":0,"🕺🏾":0,"🕺🏿":0,"🖐🏻":0,"🖐🏼":0,"🖐🏽":0,"🖐🏾":0,"🖐🏿":0,"🖕🏻":0,"🖕🏼":0,"🖕🏽":0,"🖕🏾":0,"🖕🏿":0,"🖖🏻":0,"🖖🏼":0,"🖖🏽":0,"🖖🏾":0,"🖖🏿":0,"🙅🏻‍♀️":0,"🙅🏼‍♀️":0,"🙅🏽‍♀️":0,"🙅🏾‍♀️":0,"🙅🏿‍♀️":0,"🙅🏻‍♂️":0,"🙅🏼‍♂️":0,"🙅🏽‍♂️":0,"🙅🏾‍♂️":0,"🙅🏿‍♂️":0,"🙅🏻":0,"🙅🏼":0,"🙅🏽":0,"🙅🏾":0,"🙅🏿":0,"🙆🏻‍♀️":0,"🙆🏼‍♀️":0,"🙆🏽‍♀️":0,"🙆🏾‍♀️":0,"🙆🏿‍♀️":0,"🙆🏻‍♂️":0,"🙆🏼‍♂️":0,"🙆🏽‍♂️":0,"🙆🏾‍♂️":0,"🙆🏿‍♂️":0,"🙆🏻":0,"🙆🏼":0,"🙆🏽":0,"🙆🏾":0,"🙆🏿":0,"🙇🏻‍♀️":0,"🙇🏼‍♀️":0,"🙇🏽‍♀️":0,"🙇🏾‍♀️":0,"🙇🏿‍♀️":0,"🙇🏻‍♂️":0,"🙇🏼‍♂️":0,"🙇🏽‍♂️":0,"🙇🏾‍♂️":0,"🙇🏿‍♂️":0,"🙇🏻":0,"🙇🏼":0,"🙇🏽":0,"🙇🏾":0,"🙇🏿":0,"🙋🏻‍♀️":0,"🙋🏼‍♀️":0,"🙋🏽‍♀️":0,"🙋🏾‍♀️":0,"🙋🏿‍♀️":0,"🙋🏻‍♂️":0,"🙋🏼‍♂️":0,"🙋🏽‍♂️":0,"🙋🏾‍♂️":0,"🙋🏿‍♂️":0,"🙋🏻":0,"🙋🏼":0,"🙋🏽":0,"🙋🏾":0,"🙋🏿":0,"🙌🏻":0,"🙌🏼":0,"🙌🏽":0,"🙌🏾":0,"🙌🏿":0,"🙍🏻‍♀️":0,"🙍🏼‍♀️":0,"🙍🏽‍♀️":0,"🙍🏾‍♀️":0,"🙍🏿‍♀️":0,"🙍🏻‍♂️":0,"🙍🏼‍♂️":0,"🙍🏽‍♂️":0,"🙍🏾‍♂️":0,"🙍🏿‍♂️":0,"🙍🏻":0,"🙍🏼":0,"🙍🏽":0,"🙍🏾":0,"🙍🏿":0,"🙎🏻‍♀️":0,"🙎🏼‍♀️":0,"🙎🏽‍♀️":0,"🙎🏾‍♀️":0,"🙎🏿‍♀️":0,"🙎🏻‍♂️":0,"🙎🏼‍♂️":0,"🙎🏽‍♂️":0,"🙎🏾‍♂️":0,"🙎🏿‍♂️":0,"🙎🏻":0,"🙎🏼":0,"🙎🏽":0,"🙎🏾":0,"🙎🏿":0,"🙏🏻":0,"🙏🏼":0,"🙏🏽":0,"🙏🏾":0,"🙏🏿":0,"🚣🏻‍♀️":0,"🚣🏼‍♀️":0,"🚣🏽‍♀️":0,"🚣🏾‍♀️":0,"🚣🏿‍♀️":0,"🚣🏻‍♂️":0,"🚣🏼‍♂️":0,"🚣🏽‍♂️":0,"🚣🏾‍♂️":0,"🚣🏿‍♂️":0,"🚣🏻":0,"🚣🏼":0,"🚣🏽":0,"🚣🏾":0,"🚣🏿":0,"🚴🏻‍♀️":0,"🚴🏼‍♀️":0,"🚴🏽‍♀️":0,"🚴🏾‍♀️":0,"🚴🏿‍♀️":0,"🚴🏻‍♂️":0,"🚴🏼‍♂️":0,"🚴🏽‍♂️":0,"🚴🏾‍♂️":0,"🚴🏿‍♂️":0,"🚴🏻":0,"🚴🏼":0,"🚴🏽":0,"🚴🏾":0,"🚴🏿":0,"🚵🏻‍♀️":0,"🚵🏼‍♀️":0,"🚵🏽‍♀️":0,"🚵🏾‍♀️":0,"🚵🏿‍♀️":0,"🚵🏻‍♂️":0,"🚵🏼‍♂️":0,"🚵🏽‍♂️":0,"🚵🏾‍♂️":0,"🚵🏿‍♂️":0,"🚵🏻":0,"🚵🏼":0,"🚵🏽":0,"🚵🏾":0,"🚵🏿":0,"🚶🏻‍♀️":0,"🚶🏼‍♀️":0,"🚶🏽‍♀️":0,"🚶🏾‍♀️":0,"🚶🏿‍♀️":0,"🚶🏻‍♂️":0,"🚶🏼‍♂️":0,"🚶🏽‍♂️":0,"🚶🏾‍♂️":0,"🚶🏿‍♂️":0,"🚶🏻":0,"🚶🏼":0,"🚶🏽":0,"🚶🏾":0,"🚶🏿":0,"🛀🏻":0,"🛀🏼":0,"🛀🏽":0,"🛀🏾":0,"🛀🏿":0,"🛌🏻":0,"🛌🏼":0,"🛌🏽":0,"🛌🏾":0,"🛌🏿":0,"🤏🏻":0,"🤏🏼":0,"🤏🏽":0,"🤏🏾":0,"🤏🏿":0,"🤘🏻":0,"🤘🏼":0,"🤘🏽":0,"🤘🏾":0,"🤘🏿":0,"🤙🏻":0,"🤙🏼":0,"🤙🏽":0,"🤙🏾":0,"🤙🏿":0,"🤚🏻":0,"🤚🏼":0,"🤚🏽":0,"🤚🏾":0,"🤚🏿":0,"🤛🏻":0,"🤛🏼":0,"🤛🏽":0,"🤛🏾":0,"🤛🏿":0,"🤜🏻":0,"🤜🏼":0,"🤜🏽":0,"🤜🏾":0,"🤜🏿":0,"🤞🏻":0,"🤞🏼":0,"🤞🏽":0,"🤞🏾":0,"🤞🏿":0,"🤟🏻":0,"🤟🏼":0,"🤟🏽":0,"🤟🏾":0,"🤟🏿":0,"🤦🏻‍♀️":0,"🤦🏼‍♀️":0,"🤦🏽‍♀️":0,"🤦🏾‍♀️":0,"🤦🏿‍♀️":0,"🤦🏻‍♂️":0,"🤦🏼‍♂️":0,"🤦🏽‍♂️":0,"🤦🏾‍♂️":0,"🤦🏿‍♂️":0,"🤦🏻":0,"🤦🏼":0,"🤦🏽":0,"🤦🏾":0,"🤦🏿":0,"🤰🏻":0,"🤰🏼":0,"🤰🏽":0,"🤰🏾":0,"🤰🏿":0,"🤱🏻":0,"🤱🏼":0,"🤱🏽":0,"🤱🏾":0,"🤱🏿":0,"🤲🏻":0,"🤲🏼":0,"🤲🏽":0,"🤲🏾":0,"🤲🏿":0,"🤳🏻":0,"🤳🏼":0,"🤳🏽":0,"🤳🏾":0,"🤳🏿":0,"🤴🏻":0,"🤴🏼":0,"🤴🏽":0,"🤴🏾":0,"🤴🏿":0,"🤵🏻":0,"🤵🏼":0,"🤵🏽":0,"🤵🏾":0,"🤵🏿":0,"🤶🏻":0,"🤶🏼":0,"🤶🏽":0,"🤶🏾":0,"🤶🏿":0,"🤷🏻‍♀️":0,"🤷🏼‍♀️":0,"🤷🏽‍♀️":0,"🤷🏾‍♀️":0,"🤷🏿‍♀️":0,"🤷🏻‍♂️":0,"🤷🏼‍♂️":0,"🤷🏽‍♂️":0,"🤷🏾‍♂️":0,"🤷🏿‍♂️":0,"🤷🏻":0,"🤷🏼":0,"🤷🏽":0,"🤷🏾":0,"🤷🏿":0,"🤸🏻‍♀️":0,"🤸🏼‍♀️":0,"🤸🏽‍♀️":0,"🤸🏾‍♀️":0,"🤸🏿‍♀️":0,"🤸🏻‍♂️":0,"🤸🏼‍♂️":0,"🤸🏽‍♂️":0,"🤸🏾‍♂️":0,"🤸🏿‍♂️":0,"🤸🏻":0,"🤸🏼":0,"🤸🏽":0,"🤸🏾":0,"🤸🏿":0,"🤹🏻‍♀️":0,"🤹🏼‍♀️":0,"🤹🏽‍♀️":0,"🤹🏾‍♀️":0,"🤹🏿‍♀️":0,"🤹🏻‍♂️":0,"🤹🏼‍♂️":0,"🤹🏽‍♂️":0,"🤹🏾‍♂️":0,"🤹🏿‍♂️":0,"🤹🏻":0,"🤹🏼":0,"🤹🏽":0,"🤹🏾":0,"🤹🏿":0,"🤽🏻‍♀️":0,"🤽🏼‍♀️":0,"🤽🏽‍♀️":0,"🤽🏾‍♀️":0,"🤽🏿‍♀️":0,"🤽🏻‍♂️":0,"🤽🏼‍♂️":0,"🤽🏽‍♂️":0,"🤽🏾‍♂️":0,"🤽🏿‍♂️":0,"🤽🏻":0,"🤽🏼":0,"🤽🏽":0,"🤽🏾":0,"🤽🏿":0,"🤾🏻‍♀️":0,"🤾🏼‍♀️":0,"🤾🏽‍♀️":0,"🤾🏾‍♀️":0,"🤾🏿‍♀️":0,"🤾🏻‍♂️":0,"🤾🏼‍♂️":0,"🤾🏽‍♂️":0,"🤾🏾‍♂️":0,"🤾🏿‍♂️":0,"🤾🏻":0,"🤾🏼":0,"🤾🏽":0,"🤾🏾":0,"🤾🏿":0,"🦵🏻":0,"🦵🏼":0,"🦵🏽":0,"🦵🏾":0,"🦵🏿":0,"🦶🏻":0,"🦶🏼":0,"🦶🏽":0,"🦶🏾":0,"🦶🏿":0,"🦸🏻‍♀️":0,"🦸🏼‍♀️":0,"🦸🏽‍♀️":0,"🦸🏾‍♀️":0,"🦸🏿‍♀️":0,"🦸🏻‍♂️":0,"🦸🏼‍♂️":0,"🦸🏽‍♂️":0,"🦸🏾‍♂️":0,"🦸🏿‍♂️":0,"🦸🏻":0,"🦸🏼":0,"🦸🏽":0,"🦸🏾":0,"🦸🏿":0,"🦹🏻‍♀️":0,"🦹🏼‍♀️":0,"🦹🏽‍♀️":0,"🦹🏾‍♀️":0,"🦹🏿‍♀️":0,"🦹🏻‍♂️":0,"🦹🏼‍♂️":0,"🦹🏽‍♂️":0,"🦹🏾‍♂️":0,"🦹🏿‍♂️":0,"🦹🏻":0,"🦹🏼":0,"🦹🏽":0,"🦹🏾":0,"🦹🏿":0,"🦻🏻":0,"🦻🏼":0,"🦻🏽":0,"🦻🏾":0,"🦻🏿":0,"🧍🏻‍♀️":0,"🧍🏼‍♀️":0,"🧍🏽‍♀️":0,"🧍🏾‍♀️":0,"🧍🏿‍♀️":0,"🧍🏻‍♂️":0,"🧍🏼‍♂️":0,"🧍🏽‍♂️":0,"🧍🏾‍♂️":0,"🧍🏿‍♂️":0,"🧍🏻":0,"🧍🏼":0,"🧍🏽":0,"🧍🏾":0,"🧍🏿":0,"🧎🏻‍♀️":0,"🧎🏼‍♀️":0,"🧎🏽‍♀️":0,"🧎🏾‍♀️":0,"🧎🏿‍♀️":0,"🧎🏻‍♂️":0,"🧎🏼‍♂️":0,"🧎🏽‍♂️":0,"🧎🏾‍♂️":0,"🧎🏿‍♂️":0,"🧎🏻":0,"🧎🏼":0,"🧎🏽":0,"🧎🏾":0,"🧎🏿":0,"🧏🏻‍♀️":0,"🧏🏼‍♀️":0,"🧏🏽‍♀️":0,"🧏🏾‍♀️":0,"🧏🏿‍♀️":0,"🧏🏻‍♂️":0,"🧏🏼‍♂️":0,"🧏🏽‍♂️":0,"🧏🏾‍♂️":0,"🧏🏿‍♂️":0,"🧏🏻":0,"🧏🏼":0,"🧏🏽":0,"🧏🏾":0,"🧏🏿":0,"🧑🏻‍🌾":0,"🧑🏼‍🌾":0,"🧑🏽‍🌾":0,"🧑🏾‍🌾":0,"🧑🏿‍🌾":0,"🧑🏻‍🍳":0,"🧑🏼‍🍳":0,"🧑🏽‍🍳":0,"🧑🏾‍🍳":0,"🧑🏿‍🍳":0,"🧑🏻‍🎓":0,"🧑🏼‍🎓":0,"🧑🏽‍🎓":0,"🧑🏾‍🎓":0,"🧑🏿‍🎓":0,"🧑🏻‍🎤":0,"🧑🏼‍🎤":0,"🧑🏽‍🎤":0,"🧑🏾‍🎤":0,"🧑🏿‍🎤":0,"🧑🏻‍🎨":0,"🧑🏼‍🎨":0,"🧑🏽‍🎨":0,"🧑🏾‍🎨":0,"🧑🏿‍🎨":0,"🧑🏻‍🏫":0,"🧑🏼‍🏫":0,"🧑🏽‍🏫":0,"🧑🏾‍🏫":0,"🧑🏿‍🏫":0,"🧑🏻‍🏭":0,"🧑🏼‍🏭":0,"🧑🏽‍🏭":0,"🧑🏾‍🏭":0,"🧑🏿‍🏭":0,"🧑🏻‍💻":0,"🧑🏼‍💻":0,"🧑🏽‍💻":0,"🧑🏾‍💻":0,"🧑🏿‍💻":0,"🧑🏻‍💼":0,"🧑🏼‍💼":0,"🧑🏽‍💼":0,"🧑🏾‍💼":0,"🧑🏿‍💼":0,"🧑🏻‍🔧":0,"🧑🏼‍🔧":0,"🧑🏽‍🔧":0,"🧑🏾‍🔧":0,"🧑🏿‍🔧":0,"🧑🏻‍🔬":0,"🧑🏼‍🔬":0,"🧑🏽‍🔬":0,"🧑🏾‍🔬":0,"🧑🏿‍🔬":0,"🧑🏻‍🚀":0,"🧑🏼‍🚀":0,"🧑🏽‍🚀":0,"🧑🏾‍🚀":0,"🧑🏿‍🚀":0,"🧑🏻‍🚒":0,"🧑🏼‍🚒":0,"🧑🏽‍🚒":0,"🧑🏾‍🚒":0,"🧑🏿‍🚒":0,"🧑🏻‍🤝‍🧑🏻":0,"🧑🏻‍🤝‍🧑🏼":0,"🧑🏻‍🤝‍🧑🏽":0,"🧑🏻‍🤝‍🧑🏾":0,"🧑🏻‍🤝‍🧑🏿":0,"🧑🏼‍🤝‍🧑🏻":0,"🧑🏼‍🤝‍🧑🏼":0,"🧑🏼‍🤝‍🧑🏽":0,"🧑🏼‍🤝‍🧑🏾":0,"🧑🏼‍🤝‍🧑🏿":0,"🧑🏽‍🤝‍🧑🏻":0,"🧑🏽‍🤝‍🧑🏼":0,"🧑🏽‍🤝‍🧑🏽":0,"🧑🏽‍🤝‍🧑🏾":0,"🧑🏽‍🤝‍🧑🏿":0,"🧑🏾‍🤝‍🧑🏻":0,"🧑🏾‍🤝‍🧑🏼":0,"🧑🏾‍🤝‍🧑🏽":0,"🧑🏾‍🤝‍🧑🏾":0,"🧑🏾‍🤝‍🧑🏿":0,"🧑🏿‍🤝‍🧑🏻":0,"🧑🏿‍🤝‍🧑🏼":0,"🧑🏿‍🤝‍🧑🏽":0,"🧑🏿‍🤝‍🧑🏾":0,"🧑🏿‍🤝‍🧑🏿":0,"🧑🏻‍🦯":0,"🧑🏼‍🦯":0,"🧑🏽‍🦯":0,"🧑🏾‍🦯":0,"🧑🏿‍🦯":0,"🧑🏻‍🦰":0,"🧑🏼‍🦰":0,"🧑🏽‍🦰":0,"🧑🏾‍🦰":0,"🧑🏿‍🦰":0,"🧑🏻‍🦱":0,"🧑🏼‍🦱":0,"🧑🏽‍🦱":0,"🧑🏾‍🦱":0,"🧑🏿‍🦱":0,"🧑🏻‍🦲":0,"🧑🏼‍🦲":0,"🧑🏽‍🦲":0,"🧑🏾‍🦲":0,"🧑🏿‍🦲":0,"🧑🏻‍🦳":0,"🧑🏼‍🦳":0,"🧑🏽‍🦳":0,"🧑🏾‍🦳":0,"🧑🏿‍🦳":0,"🧑🏻‍🦼":0,"🧑🏼‍🦼":0,"🧑🏽‍🦼":0,"🧑🏾‍🦼":0,"🧑🏿‍🦼":0,"🧑🏻‍🦽":0,"🧑🏼‍🦽":0,"🧑🏽‍🦽":0,"🧑🏾‍🦽":0,"🧑🏿‍🦽":0,"🧑🏻‍⚕️":0,"🧑🏼‍⚕️":0,"🧑🏽‍⚕️":0,"🧑🏾‍⚕️":0,"🧑🏿‍⚕️":0,"🧑🏻‍⚖️":0,"🧑🏼‍⚖️":0,"🧑🏽‍⚖️":0,"🧑🏾‍⚖️":0,"🧑🏿‍⚖️":0,"🧑🏻‍✈️":0,"🧑🏼‍✈️":0,"🧑🏽‍✈️":0,"🧑🏾‍✈️":0,"🧑🏿‍✈️":0,"🧑🏻":0,"🧑🏼":0,"🧑🏽":0,"🧑🏾":0,"🧑🏿":0,"🧒🏻":0,"🧒🏼":0,"🧒🏽":0,"🧒🏾":0,"🧒🏿":0,"🧓🏻":0,"🧓🏼":0,"🧓🏽":0,"🧓🏾":0,"🧓🏿":0,"🧔🏻":0,"🧔🏼":0,"🧔🏽":0,"🧔🏾":0,"🧔🏿":0,"🧕🏻":0,"🧕🏼":0,"🧕🏽":0,"🧕🏾":0,"🧕🏿":0,"🧖🏻‍♀️":0,"🧖🏼‍♀️":0,"🧖🏽‍♀️":0,"🧖🏾‍♀️":0,"🧖🏿‍♀️":0,"🧖🏻‍♂️":0,"🧖🏼‍♂️":0,"🧖🏽‍♂️":0,"🧖🏾‍♂️":0,"🧖🏿‍♂️":0,"🧖🏻":0,"🧖🏼":0,"🧖🏽":0,"🧖🏾":0,"🧖🏿":0,"🧗🏻‍♀️":0,"🧗🏼‍♀️":0,"🧗🏽‍♀️":0,"🧗🏾‍♀️":0,"🧗🏿‍♀️":0,"🧗🏻‍♂️":0,"🧗🏼‍♂️":0,"🧗🏽‍♂️":0,"🧗🏾‍♂️":0,"🧗🏿‍♂️":0,"🧗🏻":0,"🧗🏼":0,"🧗🏽":0,"🧗🏾":0,"🧗🏿":0,"🧘🏻‍♀️":0,"🧘🏼‍♀️":0,"🧘🏽‍♀️":0,"🧘🏾‍♀️":0,"🧘🏿‍♀️":0,"🧘🏻‍♂️":0,"🧘🏼‍♂️":0,"🧘🏽‍♂️":0,"🧘🏾‍♂️":0,"🧘🏿‍♂️":0,"🧘🏻":0,"🧘🏼":0,"🧘🏽":0,"🧘🏾":0,"🧘🏿":0,"🧙🏻‍♀️":0,"🧙🏼‍♀️":0,"🧙🏽‍♀️":0,"🧙🏾‍♀️":0,"🧙🏿‍♀️":0,"🧙🏻‍♂️":0,"🧙🏼‍♂️":0,"🧙🏽‍♂️":0,"🧙🏾‍♂️":0,"🧙🏿‍♂️":0,"🧙🏻":0,"🧙🏼":0,"🧙🏽":0,"🧙🏾":0,"🧙🏿":0,"🧚🏻‍♀️":0,"🧚🏼‍♀️":0,"🧚🏽‍♀️":0,"🧚🏾‍♀️":0,"🧚🏿‍♀️":0,"🧚🏻‍♂️":0,"🧚🏼‍♂️":0,"🧚🏽‍♂️":0,"🧚🏾‍♂️":0,"🧚🏿‍♂️":0,"🧚🏻":0,"🧚🏼":0,"🧚🏽":0,"🧚🏾":0,"🧚🏿":0,"🧛🏻‍♀️":0,"🧛🏼‍♀️":0,"🧛🏽‍♀️":0,"🧛🏾‍♀️":0,"🧛🏿‍♀️":0,"🧛🏻‍♂️":0,"🧛🏼‍♂️":0,"🧛🏽‍♂️":0,"🧛🏾‍♂️":0,"🧛🏿‍♂️":0,"🧛🏻":0,"🧛🏼":0,"🧛🏽":0,"🧛🏾":0,"🧛🏿":0,"🧜🏻‍♀️":0,"🧜🏼‍♀️":0,"🧜🏽‍♀️":0,"🧜🏾‍♀️":0,"🧜🏿‍♀️":0,"🧜🏻‍♂️":0,"🧜🏼‍♂️":0,"🧜🏽‍♂️":0,"🧜🏾‍♂️":0,"🧜🏿‍♂️":0,"🧜🏻":0,"🧜🏼":0,"🧜🏽":0,"🧜🏾":0,"🧜🏿":0,"🧝🏻‍♀️":0,"🧝🏼‍♀️":0,"🧝🏽‍♀️":0,"🧝🏾‍♀️":0,"🧝🏿‍♀️":0,"🧝🏻‍♂️":0,"🧝🏼‍♂️":0,"🧝🏽‍♂️":0,"🧝🏾‍♂️":0,"🧝🏿‍♂️":0,"🧝🏻":0,"🧝🏼":0,"🧝🏽":0,"🧝🏾":0,"🧝🏿":0,"☝🏻":0,"☝🏼":0,"☝🏽":0,"☝🏾":0,"☝🏿":0,"⛹🏻‍♀️":0,"⛹🏼‍♀️":0,"⛹🏽‍♀️":0,"⛹🏾‍♀️":0,"⛹🏿‍♀️":0,"⛹🏻‍♂️":0,"⛹🏼‍♂️":0,"⛹🏽‍♂️":0,"⛹🏾‍♂️":0,"⛹🏿‍♂️":0,"⛹🏻":0,"⛹🏼":0,"⛹🏽":0,"⛹🏾":0,"⛹🏿":0,"✊🏻":0,"✊🏼":0,"✊🏽":0,"✊🏾":0,"✊🏿":0,"✋🏻":0,"✋🏼":0,"✋🏽":0,"✋🏾":0,"✋🏿":0,"✌🏻":0,"✌🏼":0,"✌🏽":0,"✌🏾":0,"✌🏿":0,"✍🏻":0,"✍🏼":0,"✍🏽":0,"✍🏾":0,"✍🏿":0},t.Countries=[{phoneCode:"7 840",code:"AB",name:"Abkhazia",pattern:"",emoji:""},{phoneCode:"93",code:"AF",name:"Afghanistan",pattern:"93 XXX XXX XXX",emoji:"🇦🇫"},{phoneCode:"358 18",code:"AX",name:"Aland Islands",pattern:"",emoji:"🇦🇽"},{phoneCode:"355",code:"AL",name:"Albania",pattern:"355 XX XXX XXXX",emoji:"🇦🇱"},{phoneCode:"213",code:"DZ",name:"Algeria",pattern:"213 XXX XX XX XX",emoji:"🇩🇿"},{phoneCode:"1 684",code:"AS",name:"American Samoa",pattern:"1684 XXX XXXX",emoji:"🇦🇸"},{phoneCode:"376",code:"AD",name:"Andorra",pattern:"376 XX XX XX",emoji:"🇦🇩"},{phoneCode:"244",code:"AO",name:"Angola",pattern:"244 XXX XXX XXX",emoji:"🇦🇴"},{phoneCode:"1 264",code:"AI",name:"Anguilla",pattern:"1264 XXX XXXX",emoji:"🇦🇮"},{phoneCode:"1 268",code:"AG",name:"Antigua & Barbuda",pattern:"1268 XXX XXXX",emoji:"🇦🇬"},{phoneCode:"54",code:"AR",name:"Argentina",pattern:"",emoji:"🇦🇷"},{phoneCode:"374",code:"AM",name:"Armenia",pattern:"374 XX XXX XXX",emoji:"🇦🇲"},{phoneCode:"297",code:"AW",name:"Aruba",pattern:"297 XXX XXXX",emoji:"🇦🇼"},{phoneCode:"247",code:"SH",name:"Ascension",pattern:"290 XX XXX",emoji:"🇸🇭"},{phoneCode:"61",code:"AU",name:"Australia",pattern:"61 XXX XXX XXX",emoji:"🇦🇺"},{phoneCode:"672",code:"AU",name:"Australian External Territories",pattern:"61 XXX XXX XXX",emoji:"🇦🇺"},{phoneCode:"43",code:"AT",name:"Austria",pattern:"",emoji:"🇦🇹"},{phoneCode:"994",code:"AZ",name:"Azerbaijan",pattern:"994 XX XXX XX XX",emoji:"🇦🇿"},{phoneCode:"1 242",code:"BS",name:"Bahamas",pattern:"1242 XXX XXXX",emoji:"🇧🇸"},{phoneCode:"973",code:"BH",name:"Bahrain",pattern:"973 XXXX XXXX",emoji:"🇧🇭"},{phoneCode:"880",code:"BD",name:"Bangladesh",pattern:"",emoji:"🇧🇩"},{phoneCode:"1 246",code:"BB",name:"Barbados",pattern:"1246 XXX XXXX",emoji:"🇧🇧"},{phoneCode:"1 268",code:"AG",name:"Barbuda",pattern:"1268 XXX XXXX",emoji:"🇦🇬"},{phoneCode:"375",code:"BY",name:"Belarus",pattern:"375 XX XXX XXXX",emoji:"🇧🇾"},{phoneCode:"32",code:"BE",name:"Belgium",pattern:"32 XXX XX XX XX",emoji:"🇧🇪"},{phoneCode:"501",code:"BZ",name:"Belize",pattern:"",emoji:"🇧🇿"},{phoneCode:"229",code:"BJ",name:"Benin",pattern:"229 XX XXX XXX",emoji:"🇧🇯"},{phoneCode:"1 441",code:"BM",name:"Bermuda",pattern:"1441 XXX XXXX",emoji:"🇧🇲"},{phoneCode:"975",code:"BT",name:"Bhutan",pattern:"",emoji:"🇧🇹"},{phoneCode:"591",code:"BO",name:"Bolivia",pattern:"591 X XXX XXXX",emoji:"🇧🇴"},{phoneCode:"599 7",code:"BQ",name:"Caribbean Netherlands",pattern:"",emoji:"🇧🇶"},{phoneCode:"387",code:"BA",name:"Bosnia & Herzegovina",pattern:"",emoji:"🇧🇦"},{phoneCode:"267",code:"BW",name:"Botswana",pattern:"267 XX XXX XXX",emoji:"🇧🇼"},{phoneCode:"55",code:"BR",name:"Brazil",pattern:"55 XX XXXXX XXXX",emoji:"🇧🇷"},{phoneCode:"246",code:"IO",name:"British Indian Ocean Territory",pattern:"246 XXX XXXX",emoji:"🇮🇴"},{phoneCode:"1 284",code:"VG",name:"British Virgin Islands",pattern:"1284 XXX XXXX",emoji:"🇻🇬"},{phoneCode:"673",code:"BN",name:"Brunei",pattern:"673 XXX XXXX",emoji:"🇧🇳"},{phoneCode:"359",code:"BG",name:"Bulgaria",pattern:"",emoji:"🇧🇬"},{phoneCode:"226",code:"BF",name:"Burkina Faso",pattern:"226 XX XX XX XX",emoji:"🇧🇫"},{phoneCode:"95",code:"MM",name:"Myanmar (Burma)",pattern:"",emoji:"🇲🇲"},{phoneCode:"257",code:"BI",name:"Burundi",pattern:"257 XX XX XXXX",emoji:"🇧🇮"},{phoneCode:"855",code:"KH",name:"Cambodia",pattern:"",emoji:"🇰🇭"},{phoneCode:"237",code:"CM",name:"Cameroon",pattern:"237 XXXX XXXX",emoji:"🇨🇲"},{phoneCode:"1",code:"CA",name:"Canada",pattern:"1 XXX XXX XXXX",emoji:"🇨🇦"},{phoneCode:"238",code:"CV",name:"Cape Verde",pattern:"238 XXX XXXX",emoji:"🇨🇻"},{phoneCode:"1 345",code:"KY",name:"Cayman Islands",pattern:"1345 XXX XXXX",emoji:"🇰🇾"},{phoneCode:"236",code:"CF",name:"Central African Republic",pattern:"236 XX XX XX XX",emoji:"🇨🇫"},{phoneCode:"235",code:"TD",name:"Chad",pattern:"235 XX XX XX XX",emoji:"🇹🇩"},{phoneCode:"56",code:"CL",name:"Chile",pattern:"56 X XXXX XXXX",emoji:"🇨🇱"},{phoneCode:"86",code:"CN",name:"China",pattern:"86 XXX XXXX XXXX",emoji:"🇨🇳"},{phoneCode:"61",code:"CX",name:"Christmas Island",pattern:"",emoji:"🇨🇽"},{phoneCode:"61",code:"CC",name:"Cocos (Keeling) Islands",pattern:"",emoji:"🇨🇨"},{phoneCode:"57",code:"CO",name:"Colombia",pattern:"57 XXX XXX XXXX",emoji:"🇨🇴"},{phoneCode:"269",code:"KM",name:"Comoros",pattern:"269 XXX XXXX",emoji:"🇰🇲"},{phoneCode:"242",code:"CG",name:"Congo - Brazzaville",pattern:"242 XX XXX XXXX",emoji:"🇨🇬"},{phoneCode:"243",code:"CD",name:"Congo - Kinshasa",pattern:"243 XX XXX XXXX",emoji:"🇨🇩"},{phoneCode:"682",code:"CK",name:"Cook Islands",pattern:"",emoji:"🇨🇰"},{phoneCode:"506",code:"CR",name:"Costa Rica",pattern:"",emoji:"🇨🇷"},{phoneCode:"225",code:"CI",name:"Cote dIvoire",pattern:"225 XX XXX XXX",emoji:"🇨🇮"},{phoneCode:"385",code:"HR",name:"Croatia",pattern:"",emoji:"🇭🇷"},{phoneCode:"53",code:"CU",name:"Cuba",pattern:"53 XXXX XXXX",emoji:"🇨🇺"},{phoneCode:"599 9",code:"CW",name:"Curacao",pattern:"",emoji:"🇨🇼"},{phoneCode:"357",code:"CY",name:"Cyprus",pattern:"357 XXXX XXXX",emoji:"🇨🇾"},{phoneCode:"420",code:"CZ",name:"Czech Republic",pattern:"",emoji:"🇨🇿"},{phoneCode:"45",code:"DK",name:"Denmark",pattern:"45 XXXX XXXX",emoji:"🇩🇰"},{phoneCode:"246",code:"DG",name:"Diego Garcia",pattern:"",emoji:"🇩🇬"},{phoneCode:"253",code:"DJ",name:"Djibouti",pattern:"253 XX XX XX XX",emoji:"🇩🇯"},{phoneCode:"1 767",code:"DM",name:"Dominica",pattern:"1767 XXX XXXX",emoji:"🇩🇲"},{phoneCode:"1 809 and 1 829",code:"DO",name:"Dominican Republic",pattern:"1 XXX XXX XXXX",emoji:"🇩🇴"},{phoneCode:"670",code:"TL",name:"Timor-Leste",pattern:"",emoji:"🇹🇱"},{phoneCode:"593",code:"EC",name:"Ecuador",pattern:"",emoji:"🇪🇨"},{phoneCode:"20",code:"EG",name:"Egypt",pattern:"20 XX XXX XXXX",emoji:"🇪🇬"},{phoneCode:"503",code:"SV",name:"El Salvador",pattern:"503 XXXX XXXX",emoji:"🇸🇻"},{phoneCode:"240",code:"GQ",name:"Equatorial Guinea",pattern:"240 XXX XXX XXX",emoji:"🇬🇶"},{phoneCode:"291",code:"ER",name:"Eritrea",pattern:"291 X XXX XXX",emoji:"🇪🇷"},{phoneCode:"372",code:"EE",name:"Estonia",pattern:"",emoji:"🇪🇪"},{phoneCode:"251",code:"ET",name:"Ethiopia",pattern:"251 XX XXX XXXX",emoji:"🇪🇹"},{phoneCode:"500",code:"FK",name:"Falkland Islands",pattern:"",emoji:"🇫🇰"},{phoneCode:"298",code:"FO",name:"Faroe Islands",pattern:"298 XXX XXX",emoji:"🇫🇴"},{phoneCode:"679",code:"FJ",name:"Fiji",pattern:"",emoji:"🇫🇯"},{phoneCode:"358",code:"FI",name:"Finland",pattern:"",emoji:"🇫🇮"},{phoneCode:"33",code:"FR",name:"France",pattern:"33 X XX XX XX XX",emoji:"🇫🇷"},{phoneCode:"594",code:"GF",name:"French Guiana",pattern:"",emoji:"🇬🇫"},{phoneCode:"689",code:"PF",name:"French Polynesia",pattern:"",emoji:"🇵🇫"},{phoneCode:"241",code:"GA",name:"Gabon",pattern:"241 X XX XX XX",emoji:"🇬🇦"},{phoneCode:"220",code:"GM",name:"Gambia",pattern:"220 XXX XXXX",emoji:"🇬🇲"},{phoneCode:"995",code:"GE",name:"Georgia",pattern:"",emoji:"🇬🇪"},{phoneCode:"49",code:"DE",name:"Germany",pattern:"49 XXX XXXXXXXX",emoji:"🇩🇪"},{phoneCode:"233",code:"GH",name:"Ghana",pattern:"",emoji:"🇬🇭"},{phoneCode:"350",code:"GI",name:"Gibraltar",pattern:"350 XXXX XXXX",emoji:"🇬🇮"},{phoneCode:"30",code:"GR",name:"Greece",pattern:"30 XX XXXX XXXX",emoji:"🇬🇷"},{phoneCode:"299",code:"GL",name:"Greenland",pattern:"299 XXX XXX",emoji:"🇬🇱"},{phoneCode:"1 473",code:"GD",name:"Grenada",pattern:"1473 XXX XXXX",emoji:"🇬🇩"},{phoneCode:"590",code:"GP",name:"Guadeloupe",pattern:"",emoji:"🇬🇵"},{phoneCode:"1 671",code:"GU",name:"Guam",pattern:"1671 XXX XXXX",emoji:"🇬🇺"},{phoneCode:"502",code:"GT",name:"Guatemala",pattern:"502 X XXX XXXX",emoji:"🇬🇹"},{phoneCode:"44",code:"GG",name:"Guernsey",pattern:"",emoji:"🇬🇬"},{phoneCode:"224",code:"GN",name:"Guinea",pattern:"224 XXX XXX XXX",emoji:"🇬🇳"},{phoneCode:"245",code:"GW",name:"Guinea-Bissau",pattern:"245 XXX XXXX",emoji:"🇬🇼"},{phoneCode:"592",code:"GY",name:"Guyana",pattern:"",emoji:"🇬🇾"},{phoneCode:"509",code:"HT",name:"Haiti",pattern:"",emoji:"🇭🇹"},{phoneCode:"504",code:"HN",name:"Honduras",pattern:"504 XXXX XXXX",emoji:"🇭🇳"},{phoneCode:"852",code:"HK",name:"Hong Kong SAR China",pattern:"",emoji:"🇭🇰"},{phoneCode:"36",code:"HU",name:"Hungary",pattern:"36 XX XXX XXXX",emoji:"🇭🇺"},{phoneCode:"354",code:"IS",name:"Iceland",pattern:"354 XXX XXXX",emoji:"🇮🇸"},{phoneCode:"91",code:"IN",name:"India",pattern:"91 XXXXX XXXXX",emoji:"🇮🇳"},{phoneCode:"62",code:"ID",name:"Indonesia",pattern:"",emoji:"🇮🇩"},{phoneCode:"98",code:"IR",name:"Iran",pattern:"98 XXX XXX XXXX",emoji:"🇮🇷"},{phoneCode:"964",code:"IQ",name:"Iraq",pattern:"964 XXX XXX XXXX",emoji:"🇮🇶"},{phoneCode:"353",code:"IE",name:"Ireland",pattern:"353 XX XXX XXXX",emoji:"🇮🇪"},{phoneCode:"972",code:"IL",name:"Israel",pattern:"972 XX XXX XXXX",emoji:"🇮🇱"},{phoneCode:"39",code:"IT",name:"Italy",pattern:"39 XXX XXX XXXX",emoji:"🇮🇹"},{phoneCode:"1 876",code:"JM",name:"Jamaica",pattern:"1876 XXX XXXX",emoji:"🇯🇲"},{phoneCode:"47 79",code:"SJ",name:"Svalbard & Jan Mayen",pattern:"",emoji:"🇸🇯"},{phoneCode:"81",code:"JP",name:"Japan",pattern:"81 XX XXXX XXXX",emoji:"🇯🇵"},{phoneCode:"44",code:"JE",name:"Jersey",pattern:"",emoji:"🇯🇪"},{phoneCode:"962",code:"JO",name:"Jordan",pattern:"962 X XXXX XXXX",emoji:"🇯🇴"},{phoneCode:"7 7",code:"KZ",name:"Kazakhstan",pattern:"7 XXX XXX XX XX",emoji:"🇰🇿"},{phoneCode:"254",code:"KE",name:"Kenya",pattern:"254 XXX XXX XXX",emoji:"🇰🇪"},{phoneCode:"686",code:"KI",name:"Kiribati",pattern:"",emoji:"🇰🇮"},{phoneCode:"850",code:"KP",name:"North Korea",pattern:"",emoji:"🇰🇵"},{phoneCode:"82",code:"KR",name:"South Korea",pattern:"",emoji:"🇰🇷"},{phoneCode:"965",code:"KW",name:"Kuwait",pattern:"965 XXXX XXXX",emoji:"🇰🇼"},{phoneCode:"996",code:"KG",name:"Kyrgyzstan",pattern:"",emoji:"🇰🇬"},{phoneCode:"856",code:"LA",name:"Laos",pattern:"",emoji:"🇱🇦"},{phoneCode:"371",code:"LV",name:"Latvia",pattern:"371 XXX XXXXX",emoji:"🇱🇻"},{phoneCode:"961",code:"LB",name:"Lebanon",pattern:"",emoji:"🇱🇧"},{phoneCode:"266",code:"LS",name:"Lesotho",pattern:"266 XX XXX XXX",emoji:"🇱🇸"},{phoneCode:"231",code:"LR",name:"Liberia",pattern:"",emoji:"🇱🇷"},{phoneCode:"218",code:"LY",name:"Libya",pattern:"218 XX XXX XXXX",emoji:"🇱🇾"},{phoneCode:"423",code:"LI",name:"Liechtenstein",pattern:"",emoji:"🇱🇮"},{phoneCode:"370",code:"LT",name:"Lithuania",pattern:"370 XXX XXXXX",emoji:"🇱🇹"},{phoneCode:"352",code:"LU",name:"Luxembourg",pattern:"",emoji:"🇱🇺"},{phoneCode:"853",code:"MO",name:"Macau SAR China",pattern:"",emoji:"🇲🇴"},{phoneCode:"389",code:"MK",name:"Macedonia",pattern:"",emoji:"🇲🇰"},{phoneCode:"261",code:"MG",name:"Madagascar",pattern:"261 XX XX XXX XX",emoji:"🇲🇬"},{phoneCode:"265",code:"MW",name:"Malawi",pattern:"",emoji:"🇲🇼"},{phoneCode:"60",code:"MM",name:"Malaysia",pattern:"",emoji:"🇲🇲"},{phoneCode:"960",code:"MV",name:"Maldives",pattern:"",emoji:"🇲🇻"},{phoneCode:"223",code:"ML",name:"Mali",pattern:"223 XXXX XXXX",emoji:"🇲🇱"},{phoneCode:"356",code:"MT",name:"Malta",pattern:"356 XX XX XX XX",emoji:"🇲🇹"},{phoneCode:"692",code:"MH",name:"Marshall Islands",pattern:"",emoji:"🇲🇭"},{phoneCode:"596",code:"MQ",name:"Martinique",pattern:"",emoji:"🇲🇶"},{phoneCode:"222",code:"MR",name:"Mauritania",pattern:"222 XXXX XXXX",emoji:"🇲🇷"},{phoneCode:"230",code:"MU",name:"Mauritius",pattern:"",emoji:"🇲🇺"},{phoneCode:"262",code:"YT",name:"Mayotte",pattern:"",emoji:"🇾🇹"},{phoneCode:"52",code:"MX",name:"Mexico",pattern:"",emoji:"🇲🇽"},{phoneCode:"691",code:"FM",name:"Micronesia",pattern:"",emoji:"🇫🇲"},{phoneCode:"373",code:"MD",name:"Moldova",pattern:"373 XX XXX XXX",emoji:"🇲🇩"},{phoneCode:"377",code:"MC",name:"Monaco",pattern:"377 XXXX XXXX",emoji:"🇲🇨"},{phoneCode:"976",code:"MN",name:"Mongolia",pattern:"",emoji:"🇲🇳"},{phoneCode:"382",code:"ME",name:"Montenegro",pattern:"",emoji:"🇲🇪"},{phoneCode:"1 664",code:"MS",name:"Montserrat",pattern:"1664 XXX XXXX",emoji:"🇲🇸"},{phoneCode:"212",code:"MA",name:"Morocco",pattern:"212 XX XXX XXXX",emoji:"🇲🇦"},{phoneCode:"258",code:"MZ",name:"Mozambique",pattern:"258 XX XXX XXXX",emoji:"🇲🇿"},{phoneCode:"264",code:"NA",name:"Namibia",pattern:"264 XX XXX XXXX",emoji:"🇳🇦"},{phoneCode:"674",code:"NR",name:"Nauru",pattern:"",emoji:"🇳🇷"},{phoneCode:"977",code:"NP",name:"Nepal",pattern:"",emoji:"🇳🇵"},{phoneCode:"31",code:"NL",name:"Netherlands",pattern:"31 X XX XX XX XX",emoji:"🇳🇱"},{phoneCode:"687",code:"NC",name:"New Caledonia",pattern:"",emoji:"🇳🇨"},{phoneCode:"64",code:"NZ",name:"New Zealand",pattern:"",emoji:"🇳🇿"},{phoneCode:"505",code:"NI",name:"Nicaragua",pattern:"505 XXXX XXXX",emoji:"🇳🇮"},{phoneCode:"227",code:"NE",name:"Niger",pattern:"227 XX XX XX XX",emoji:"🇳🇪"},{phoneCode:"234",code:"NG",name:"Nigeria",pattern:"",emoji:"🇳🇬"},{phoneCode:"683",code:"NU",name:"Niue",pattern:"",emoji:"🇳🇺"},{phoneCode:"672",code:"NF",name:"Norfolk Island",pattern:"",emoji:"🇳🇫"},{phoneCode:"1 670",code:"MP",name:"Northern Mariana Islands",pattern:"1670 XXX XXXX",emoji:"🇲🇵"},{phoneCode:"47",code:"NO",name:"Norway",pattern:"47 XXXX XXXX",emoji:"🇳🇴"},{phoneCode:"968",code:"OM",name:"Oman",pattern:"968 XXXX XXXX",emoji:"🇴🇲"},{phoneCode:"92",code:"PK",name:"Pakistan",pattern:"92 XXX XXX XXXX",emoji:"🇵🇰"},{phoneCode:"680",code:"PW",name:"Palau",pattern:"",emoji:"🇵🇼"},{phoneCode:"970",code:"PS",name:"Palestinian Territories",pattern:"970 XXX XX XXXX",emoji:"🇵🇸"},{phoneCode:"507",code:"PA",name:"Panama",pattern:"507 XXXX XXXX",emoji:"🇵🇦"},{phoneCode:"675",code:"PG",name:"Papua New Guinea",pattern:"",emoji:"🇵🇬"},{phoneCode:"595",code:"PY",name:"Paraguay",pattern:"595 XXX XXX XXX",emoji:"🇵🇾"},{phoneCode:"51",code:"PE",name:"Peru",pattern:"51 XXX XXX XXX",emoji:"🇵🇪"},{phoneCode:"63",code:"PH",name:"Philippines",pattern:"63 XXX XXX XXXX",emoji:"🇵🇭"},{phoneCode:"64",code:"PN",name:"Pitcairn Islands",pattern:"",emoji:"🇵🇳"},{phoneCode:"48",code:"PL",name:"Poland",pattern:"48 XXX XXX XXX",emoji:"🇵🇱"},{phoneCode:"351",code:"PT",name:"Portugal",pattern:"351 X XXXX XXXX",emoji:"🇵🇹"},{phoneCode:"1 787 and 1 939",code:"PR",name:"Puerto Rico",pattern:"1 XXX XXX XXXX",emoji:"🇵🇷"},{phoneCode:"974",code:"QA",name:"Qatar",pattern:"",emoji:"🇶🇦"},{phoneCode:"262",code:"RE",name:"Reunion",pattern:"262 XXX XXX XXX",emoji:"🇷🇪"},{phoneCode:"40",code:"RO",name:"Romania",pattern:"40 XXX XXX XXX",emoji:"🇷🇴"},{phoneCode:"7",code:"RU",name:"Russia",pattern:"7 XXX XXX XX XX",emoji:"🇷🇺"},{phoneCode:"250",code:"RW",name:"Rwanda",pattern:"250 XXX XXX XXX",emoji:"🇷🇼"},{phoneCode:"590",code:"BL",name:"St. Barthelemy",pattern:"",emoji:"🇧🇱"},{phoneCode:"290",code:"SH",name:"St. Helena",pattern:"290 XX XXX",emoji:"🇸🇭"},{phoneCode:"1 869",code:"KN",name:"St. Kitts & Nevis",pattern:"1869 XXX XXXX",emoji:"🇰🇳"},{phoneCode:"1 758",code:"LC",name:"St. Lucia",pattern:"1758 XXX XXXX",emoji:"🇱🇨"},{phoneCode:"590",code:"MF",name:"St. Martin (France)",pattern:"",emoji:"🇲🇫"},{phoneCode:"508",code:"PM",name:"St. Pierre and Miquelon",pattern:"",emoji:"🇵🇲"},{phoneCode:"1 784",code:"VC",name:"St. Vincent and the Grenadines",pattern:"1784 XXX XXXX",emoji:"🇻🇨"},{phoneCode:"685",code:"WS",name:"Samoa",pattern:"",emoji:"🇼🇸"},{phoneCode:"378",code:"SM",name:"San Marino",pattern:"378 XXX XXX XXXX",emoji:"🇸🇲"},{phoneCode:"239",code:"ST",name:"São Tome & Principe",pattern:"239 XX XXXXX",emoji:"🇸🇹"},{phoneCode:"966",code:"SA",name:"Saudi Arabia",pattern:"",emoji:"🇸🇦"},{phoneCode:"221",code:"SN",name:"Senegal",pattern:"221 XX XXX XXXX",emoji:"🇸🇳"},{phoneCode:"381",code:"RS",name:"Serbia",pattern:"381 XX XXX XXXX",emoji:"🇷🇸"},{phoneCode:"248",code:"SC",name:"Seychelles",pattern:"248 X XX XX XX",emoji:"🇸🇨"},{phoneCode:"232",code:"SL",name:"Sierra Leone",pattern:"232 XX XXX XXX",emoji:"🇸🇱"},{phoneCode:"65",code:"SG",name:"Singapore",pattern:"65 XXXX XXXX",emoji:"🇸🇬"},{phoneCode:"599 3",code:"BQ",name:"Sint Eustatius",pattern:"",emoji:"🇧🇶"},{phoneCode:"1 721",code:"SX",name:"Sint Maarten",pattern:"1721 XXX XXXX",emoji:"🇸🇽"},{phoneCode:"421",code:"SK",name:"Slovakia",pattern:"",emoji:"🇸🇰"},{phoneCode:"386",code:"SI",name:"Slovenia",pattern:"",emoji:"🇸🇮"},{phoneCode:"677",code:"SB",name:"Solomon Islands",pattern:"",emoji:"🇸🇧"},{phoneCode:"252",code:"SO",name:"Somalia",pattern:"252 XX XXX XXX",emoji:"🇸🇴"},{phoneCode:"27",code:"ZA",name:"South Africa",pattern:"27 XX XXX XXXX",emoji:"🇿🇦"},{phoneCode:"500",code:"GS",name:"South Georgia & South Sandwich Islands",pattern:"",emoji:"🇬🇸"},{phoneCode:"995 34",code:"",name:"South Ossetia",pattern:"",emoji:""},{phoneCode:"211",code:"SS",name:"South Sudan",pattern:"211 XX XXX XXXX",emoji:"🇸🇸"},{phoneCode:"34",code:"ES",name:"Spain",pattern:"34 XXX XXX XXX",emoji:"🇪🇸"},{phoneCode:"94",code:"LK",name:"Sri Lanka",pattern:"94 XX XXX XXXX",emoji:"🇱🇰"},{phoneCode:"249",code:"SD",name:"Sudan",pattern:"249 XX XXX XXXX",emoji:"🇸🇩"},{phoneCode:"597",code:"SR",name:"Suriname",pattern:"597 XXX XXXX",emoji:"🇸🇷"},{phoneCode:"47 79",code:"SJ",name:"Svalbard",pattern:"",emoji:"🇸🇯"},{phoneCode:"268",code:"SZ",name:"Swaziland",pattern:"268 XXXX XXXX",emoji:"🇸🇿"},{phoneCode:"46",code:"SE",name:"Sweden",pattern:"46 XX XXX XXXX",emoji:"🇸🇪"},{phoneCode:"41",code:"CH",name:"Switzerland",pattern:"41 XX XXX XXXX",emoji:"🇨🇭"},{phoneCode:"963",code:"SY",name:"Syria",pattern:"",emoji:"🇸🇾"},{phoneCode:"886",code:"TW",name:"Taiwan",pattern:"",emoji:"🇹🇼"},{phoneCode:"992",code:"TJ",name:"Tajikistan",pattern:"",emoji:"🇹🇯"},{phoneCode:"255",code:"TZ",name:"Tanzania",pattern:"255 XX XXX XXXX",emoji:"🇹🇿"},{phoneCode:"66",code:"TH",name:"Thailand",pattern:"66 X XXXX XXXX",emoji:"🇹🇭"},{phoneCode:"228",code:"TG",name:"Togo",pattern:"228 XX XXX XXX",emoji:"🇹🇬"},{phoneCode:"690",code:"TK",name:"Tokelau",pattern:"",emoji:"🇹🇰"},{phoneCode:"676",code:"TO",name:"Tonga",pattern:"",emoji:"🇹🇴"},{phoneCode:"1 868",code:"TT",name:"Trinidad & Tobago",pattern:"1868 XXX XXXX",emoji:"🇹🇹"},{phoneCode:"216",code:"TN",name:"Tunisia",pattern:"216 XX XXX XXX",emoji:"🇹🇳"},{phoneCode:"90",code:"TR",name:"Turkey",pattern:"90 XXX XXX XXXX",emoji:"🇹🇷"},{phoneCode:"993",code:"TM",name:"Turkmenistan",pattern:"993 XX XXXXXX",emoji:"🇹🇲"},{phoneCode:"1 649",code:"TC",name:"Turks & Caicos Islands",pattern:"1649 XXX XXXX",emoji:"🇹🇨"},{phoneCode:"688",code:"TV",name:"Tuvalu",pattern:"",emoji:"🇹🇻"},{phoneCode:"256",code:"UG",name:"Uganda",pattern:"256 XX XXX XXXX",emoji:"🇺🇬"},{phoneCode:"380",code:"UA",name:"Ukraine",pattern:"380 XX XXX XX XX",emoji:"🇺🇦"},{phoneCode:"971",code:"AE",name:"United Arab Emirates",pattern:"971 XX XXX XXXX",emoji:"🇦🇪"},{phoneCode:"44",code:"GB",name:"United Kingdom",pattern:"44 XXXX XXXXXX",emoji:"🇬🇧"},{phoneCode:"1",code:"US",name:"United States",pattern:"1 XXX XXX XXXX",emoji:"🇺🇸"},{phoneCode:"598",code:"UY",name:"Uruguay",pattern:"598 XXXX XXXX",emoji:"🇺🇾"},{phoneCode:"1 340",code:"VI",name:"U.S. Virgin Islands",pattern:"1340 XXX XXXX",emoji:"🇻🇮"},{phoneCode:"998",code:"UZ",name:"Uzbekistan",pattern:"998 XX XXXXXXX",emoji:"🇺🇿"},{phoneCode:"678",code:"VU",name:"Vanuatu",pattern:"",emoji:"🇻🇺"},{phoneCode:"58",code:"VE",name:"Venezuela",pattern:"58 XXX XXX XXXX",emoji:"🇻🇪"},{phoneCode:"39 06 698",code:"VA",name:"Vatican City",pattern:"",emoji:"🇻🇦"},{phoneCode:"84",code:"VN",name:"Vietnam",pattern:"",emoji:"🇻🇳"},{phoneCode:"681",code:"WF",name:"Wallis & Futuna",pattern:"",emoji:"🇼🇫"},{phoneCode:"967",code:"YE",name:"Yemen",pattern:"967 XXX XXX XXX",emoji:"🇾🇪"},{phoneCode:"260",code:"ZM",name:"Zambia",pattern:"260 XX XXX XXXX",emoji:"🇿🇲"},{phoneCode:"255",code:"",name:"Zanzibar",pattern:"",emoji:""},{phoneCode:"263",code:"ZW",name:"Zimbabwe",pattern:"263 XX XXX XXXX",emoji:"🇿🇼"}],t.TLD=["abogado","ac","academy","accountants","active","actor","ad","adult","ae","aero","af","ag","agency","ai","airforce","al","allfinanz","alsace","am","amsterdam","an","android","ao","apartments","aq","aquarelle","ar","archi","army","arpa","as","asia","associates","at","attorney","au","auction","audio","autos","aw","ax","axa","az","ba","band","bank","bar","barclaycard","barclays","bargains","bayern","bb","bd","be","beer","berlin","best","bf","bg","bh","bi","bid","bike","bingo","bio","biz","bj","black","blackfriday","bloomberg","blue","bm","bmw","bn","bnpparibas","bo","boo","boutique","br","brussels","bs","bt","budapest","build","builders","business","buzz","bv","bw","by","bz","bzh","ca","cab","cal","camera","camp","cancerresearch","canon","capetown","capital","caravan","cards","care","career","careers","cartier","casa","cash","cat","catering","cc","cd","center","ceo","cern","cf","cg","ch","channel","chat","cheap","christmas","chrome","church","ci","citic","city","ck","cl","claims","cleaning","click","clinic","clothing","club","cm","cn","co","coach","codes","coffee","college","cologne","com","community","company","computer","condos","construction","consulting","contractors","cooking","cool","coop","country","cr","credit","creditcard","cricket","crs","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cz","dabur","dad","dance","dating","day","dclk","de","deals","degree","delivery","democrat","dental","dentist","desi","design","dev","diamonds","diet","digital","direct","directory","discount","dj","dk","dm","dnp","do","docs","domains","doosan","durban","dvag","dz","eat","ec","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","equipment","er","es","esq","estate","et","eu","eurovision","eus","events","everbank","exchange","expert","exposed","fail","farm","fashion","feedback","fi","finance","financial","firmdale","fish","fishing","fit","fitness","fj","fk","flights","florist","flowers","flsmidth","fly","fm","fo","foo","forsale","foundation","fr","frl","frogans","fund","furniture","futbol","ga","gal","gallery","garden","gb","gbiz","gd","ge","gent","gf","gg","ggee","gh","gi","gift","gifts","gives","gl","glass","gle","global","globo","gm","gmail","gmo","gmx","gn","goog","google","gop","gov","gp","gq","gr","graphics","gratis","green","gripe","gs","gt","gu","guide","guitars","guru","gw","gy","hamburg","hangout","haus","healthcare","help","here","hermes","hiphop","hiv","hk","hm","hn","holdings","holiday","homes","horse","host","hosting","house","how","hr","ht","hu","ibm","id","ie","ifm","il","im","immo","immobilien","in","industries","info","ing","ink","institute","insure","int","international","investments","io","iq","ir","irish","is","it","iwc","jcb","je","jetzt","jm","jo","jobs","joburg","jp","juegos","kaufen","kddi","ke","kg","kh","ki","kim","kitchen","kiwi","km","kn","koeln","kp","kr","krd","kred","kw","ky","kyoto","kz","la","lacaixa","land","lat","latrobe","lawyer","lb","lc","lds","lease","legal","lgbt","li","lidl","life","lighting","limited","limo","link","lk","loans","london","lotte","lotto","lr","ls","lt","ltda","lu","luxe","luxury","lv","ly","ma","madrid","maison","management","mango","market","marketing","marriott","mc","md","me","media","meet","melbourne","meme","memorial","menu","mg","mh","miami","mil","mini","mk","ml","mm","mn","mo","mobi","moda","moe","monash","money","mormon","mortgage","moscow","motorcycles","mov","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","nagoya","name","navy","nc","ne","net","network","neustar","new","nexus","nf","ng","ngo","nhk","ni","nico","ninja","nl","no","np","nr","nra","nrw","ntt","nu","nyc","nz","okinawa","om","one","ong","onl","ooo","org","organic","osaka","otsuka","ovh","pa","paris","partners","parts","party","pe","pf","pg","ph","pharmacy","photo","photography","photos","physio","pics","pictures","pink","pizza","pk","pl","place","plumbing","pm","pn","pohl","poker","porn","post","pr","praxi","press","pro","prod","productions","prof","properties","property","ps","pt","pub","pw","py","qa","qpon","quebec","re","realtor","recipes","red","rehab","reise","reisen","reit","ren","rentals","repair","report","republican","rest","restaurant","reviews","rich","rio","rip","ro","rocks","rodeo","rs","rsvp","ru","ruhr","rw","ryukyu","sa","saarland","sale","samsung","sarl","saxo","sb","sc","sca","scb","schmidt","schule","schwarz","science","scot","sd","se","services","sew","sexy","sg","sh","shiksha","shoes","shriram","si","singles","sj","sk","sky","sl","sm","sn","so","social","software","sohu","solar","solutions","soy","space","spiegel","sr","st","style","su","supplies","supply","support","surf","surgery","suzuki","sv","sx","sy","sydney","systems","sz","taipei","tatar","tattoo","tax","tc","td","technology","tel","temasek","tennis","tf","tg","th","tienda","tips","tires","tirol","tj","tk","tl","tm","tn","to","today","tokyo","tools","top","toshiba","town","toys","tp","tr","trade","training","travel","trust","tt","tui","tv","tw","tz","ua","ug","uk","university","uno","uol","us","uy","uz","va","vacations","vc","ve","vegas","ventures","versicherung","vet","vg","vi","viajes","video","villas","vision","vlaanderen","vn","vodka","vote","voting","voto","voyage","vu","wales","wang","watch","webcam","website","wed","wedding","wf","whoswho","wien","wiki","williamhill","wme","work","works","world","ws","wtc","wtf","佛山","集团","在线","한국","ভারত","八卦","موقع","公益","公司","移动","我爱你","москва","қаз","онлайн","сайт","срб","淡马锡","орг","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","中文网","中信","中国","中國","谷歌","భారత్","ලංකා","ભારત","भारत","网店","संगठन","网络","укр","香港","台湾","台灣","手机","мон","الجزائر","عمان","ایران","امارات","بازار","الاردن","بھارت","المغرب","السعودية","مليسيا","شبكة","გე","机构","组织机构","ไทย","سورية","рус","рф","تونس","みんな","グーグル","世界","ਭਾਰਤ","网址","游戏","vermögensberater","vermögensberatung","企业","مصر","قطر","广东","இலங்கை","இந்தியா","新加坡","فلسطين","政务","xxx","xyz","yachts","yandex","ye","yoga","yokohama","youtube","yt","za","zip","zm","zone","zuerich","zw"],t.LatinizeMap={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","Ꞇ":"T","Ꝭ":"IS","Ĵ":"J","Ɉ":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","Ꝃ":"K","Ḳ":"K","Ƙ":"K","Ḵ":"K","Ꝁ":"K","Ꝅ":"K","Ĺ":"L","Ƚ":"L","Ľ":"L","Ļ":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","Ⱡ":"L","Ꝉ":"L","Ḻ":"L","Ŀ":"L","Ɫ":"L","Lj":"L","Ł":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ń":"N","Ň":"N","Ņ":"N","Ṋ":"N","Ṅ":"N","Ṇ":"N","Ǹ":"N","Ɲ":"N","Ṉ":"N","Ƞ":"N","Nj":"N","Ñ":"N","NJ":"NJ","Ó":"O","Ŏ":"O","Ǒ":"O","Ô":"O","Ố":"O","Ộ":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ö":"O","Ȫ":"O","Ȯ":"O","Ȱ":"O","Ọ":"O","Ő":"O","Ȍ":"O","Ò":"O","Ỏ":"O","Ơ":"O","Ớ":"O","Ợ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ȏ":"O","Ꝋ":"O","Ꝍ":"O","Ō":"O","Ṓ":"O","Ṑ":"O","Ɵ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Õ":"O","Ṍ":"O","Ṏ":"O","Ȭ":"O","Ƣ":"OI","Ꝏ":"OO","Ɛ":"E","Ɔ":"O","Ȣ":"OU","Ṕ":"P","Ṗ":"P","Ꝓ":"P","Ƥ":"P","Ꝕ":"P","Ᵽ":"P","Ꝑ":"P","Ꝙ":"Q","Ꝗ":"Q","Ŕ":"R","Ř":"R","Ŗ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ȑ":"R","Ȓ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꜿ":"C","Ǝ":"E","Ś":"S","Ṥ":"S","Š":"S","Ṧ":"S","Ş":"S","Ŝ":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṩ":"S","ẞ":"SS","Ť":"T","Ţ":"T","Ṱ":"T","Ț":"T","Ⱦ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","Ṯ":"T","Ʈ":"T","Ŧ":"T","Ɐ":"A","Ꞁ":"L","Ɯ":"M","Ʌ":"V","Ꜩ":"TZ","Ú":"U","Ŭ":"U","Ǔ":"U","Û":"U","Ṷ":"U","Ü":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ǖ":"U","Ṳ":"U","Ụ":"U","Ű":"U","Ȕ":"U","Ù":"U","Ủ":"U","Ư":"U","Ứ":"U","Ự":"U","Ừ":"U","Ử":"U","Ữ":"U","Ȗ":"U","Ū":"U","Ṻ":"U","Ų":"U","Ů":"U","Ũ":"U","Ṹ":"U","Ṵ":"U","Ꝟ":"V","Ṿ":"V","Ʋ":"V","Ṽ":"V","Ꝡ":"VY","Ẃ":"W","Ŵ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẁ":"W","Ⱳ":"W","Ẍ":"X","Ẋ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ẏ":"Y","Ỵ":"Y","Ỳ":"Y","Ƴ":"Y","Ỷ":"Y","Ỿ":"Y","Ȳ":"Y","Ɏ":"Y","Ỹ":"Y","Ź":"Z","Ž":"Z","Ẑ":"Z","Ⱬ":"Z","Ż":"Z","Ẓ":"Z","Ȥ":"Z","Ẕ":"Z","Ƶ":"Z","IJ":"IJ","Œ":"OE","ᴀ":"A","ᴁ":"AE","ʙ":"B","ᴃ":"B","":"C","ᴅ":"D","ᴇ":"E","ꜰ":"F","ɢ":"G","ʛ":"G","ʜ":"H","ɪ":"I","ʁ":"R","ᴊ":"J","ᴋ":"K","ʟ":"L","ᴌ":"L","ᴍ":"M","ɴ":"N","":"O","ɶ":"OE","ᴐ":"O","ᴕ":"OU","ᴘ":"P","ʀ":"R","ᴎ":"N","ᴙ":"R","":"S","ᴛ":"T","ⱻ":"E","ᴚ":"R","":"U","":"V","":"W","ʏ":"Y","":"Z","á":"a","ă":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj",ſ:"s","ẜ":"s","ẛ":"s","":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ß":"ss","":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x","Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"","Ф":"F","Ы":"I","В":"V","А":"A","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"","б":"b","ю":"yu"};t.mediaSizes=new class{constructor(){this.sizes={handhelds:{regular:{width:293,height:293},webpage:{width:293,height:213},album:{width:293,height:0}},desktop:{regular:{width:480,height:480},webpage:{width:480,height:400},album:{width:451,height:0}}},this.isMobile=!1,window.addEventListener("resize",()=>this.handleResize()),this.handleResize()}handleResize(){const e=window.innerWidth;this.isMobile=e<=720,this.active=this.isMobile?this.sizes.handhelds:this.sizes.desktop}},t.touchSupport="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;const i=navigator?navigator.userAgent:null;t.isApple=-1!=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i),t.isAndroid=-1!=navigator.userAgent.toLowerCase().indexOf("android"),t.isSafari=!!("safari"in window)||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")));const n={Emoji:t.Emoji,LatinizeMap:t.LatinizeMap,TLD:t.TLD,Countries:t.Countries,MediaSizes:t.mediaSizes,touchSupport:t.touchSupport,isApple:t.isApple,isSafari:t.isSafari,isAndroid:t.isAndroid};window.Config=n,t.default=n},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppUsersManager=void 0;const n=s(0),a=s(3),o=i(s(10)),r=i(s(2)),l=i(s(29)),d=s(1),c=i(s(34)),u=i(s(8)),h=i(s(36));class p{constructor(){this.users={},this.usernames={},this.userAccess={},this.cachedPhotoLocations={},this.contactsIndex=c.default.createIndex(),this.contactsList=new Set,r.default.getUserID().then(e=>{this.myID=e}),n.$rootScope.$on("user_auth",e=>{let t=e.detail;this.myID=t?t.id:0}),setInterval(this.updateUsersStatuses.bind(this),6e4),n.$rootScope.$on("stateSynchronized",this.updateUsersStatuses.bind(this)),n.$rootScope.$on("apiUpdate",e=>{let t=e.detail;switch(t._){case"updateUserStatus":var s=t.user_id;(i=this.users[s])&&(i.status=t.status,i.status&&(i.status.expires&&(i.status.expires-=l.default.serverTimeOffset),i.status.was_online&&(i.status.was_online-=l.default.serverTimeOffset)),i.sortStatus=this.getUserStatusForSort(i.status),n.$rootScope.$broadcast("user_update",s));break;case"updateUserPhoto":var i;s=t.user_id;(i=this.users[s])?(this.forceUserOnline(s),i.photo?n.safeReplaceObject(i.photo,t.photo):i.photo=t.photo,void 0!==this.cachedPhotoLocations[s]&&n.safeReplaceObject(this.cachedPhotoLocations[s],t.photo?t.photo:{empty:!0}),n.$rootScope.$broadcast("user_update",s),n.$rootScope.$broadcast("avatar_update",s)):console.warn("No user by id:",s);break;case"updateContactLink":this.onContactUpdated(t.user_id,"contactLinkContact"==t.my_link._)}})}fillContacts(){return this.contactsFillPromise?this.contactsFillPromise:this.contactsFillPromise=r.default.invokeApi("contacts.getContacts",{hash:0}).then(e=>(this.saveApiUsers(e.users),e.contacts.forEach(e=>{this.pushContact(e.user_id)}),this.contactsList))}pushContact(e){this.contactsList.add(e),c.default.indexObject(e,this.getUserSearchText(e),this.contactsIndex)}getUserSearchText(e){const t=this.users[e];if(!t)return"";const s=t.pFlags.self?"user_name_saved_msgs_raw":"";return(t.first_name||"")+" "+(t.last_name||"")+" "+(t.phone||"")+" "+(t.username||"")+" "+s}getContacts(e){return this.fillContacts().then(t=>{let s=[...t];if(e){const t=c.default.search(e,this.contactsIndex);s=[...s].filter(e=>!!t[e])}return s.sort((e,t)=>{const s=(this.users[e]||{}).sortName||"",i=(this.users[t]||{}).sortName||"";return s.localeCompare(i)}),s})}resolveUsername(e){return this.usernames[e]||0}saveApiUsers(e){e.forEach(e=>this.saveApiUser(e))}saveApiUser(e,t){if(n.isObject(e)&&!(t&&n.isObject(this.users[e.id])&&this.users[e.id].first_name)){var s=e.id,i=this.users[s];if(void 0===e.pFlags&&(e.pFlags={}),!e.pFlags.min||void 0===i){if(e.phone&&(e.rPhone="+"+d.formatPhoneNumber(e.phone).formatted),e.first_name?(e.rFirstName=a.RichTextProcessor.wrapRichText(e.first_name,{noLinks:!0,noLinebreaks:!0}),e.rFullName=e.last_name?a.RichTextProcessor.wrapRichText(e.first_name+" "+(e.last_name||""),{noLinks:!0,noLinebreaks:!0}):e.rFirstName):(e.rFirstName=a.RichTextProcessor.wrapRichText(e.last_name,{noLinks:!0,noLinebreaks:!0})||e.rPhone||"user_first_name_deleted",e.rFullName=a.RichTextProcessor.wrapRichText(e.last_name,{noLinks:!0,noLinebreaks:!0})||e.rPhone||"user_name_deleted"),e.username){var o=c.default.cleanUsername(e.username);this.usernames[o]=s}e.sortName=e.pFlags.deleted?"":c.default.cleanSearchText(e.first_name+" "+(e.last_name||""),!1);var r=e.sortName.split(" "),u=r.shift(),h=r.pop();e.initials=u.charAt(0)+(h?h.charAt(0):""),e.status&&(e.status.expires&&(e.status.expires-=l.default.serverTimeOffset),e.status.was_online&&(e.status.was_online-=l.default.serverTimeOffset)),e.pFlags.bot?e.sortStatus=-1:e.sortStatus=this.getUserStatusForSort(e.status),void 0===(i=this.users[s])?i=this.users[s]=e:n.safeReplaceObject(i,e),n.$rootScope.$broadcast("user_update",s),void 0!==this.cachedPhotoLocations[s]&&n.safeReplaceObject(this.cachedPhotoLocations[s],e&&e.photo?e.photo:{empty:!0})}}}saveUserAccess(e,t){this.userAccess[e]=t}getUserStatusForSort(e){if(e){var t=e.expires||e.was_online;if(t)return t;var s=n.tsNow(!0);switch(e._){case"userStatusRecently":return s-259200;case"userStatusLastWeek":return s-604800;case"userStatusLastMonth":return s-2592e3}}return 0}getUser(e){return n.isObject(e)?e:this.users[e]||{id:e,pFlags:{deleted:!0},access_hash:this.userAccess[e]}}getSelf(){return this.getUser(this.myID)}getUserStatusString(e){var t;if(this.isBot(e))return"bot";const s=this.getUser(e);if(!s)return"";let i="";switch(null===(t=s.status)||void 0===t?void 0:t._){case"userStatusRecently":i="last seen recently";break;case"userStatusLastWeek":i="last seen last week";break;case"userStatusLastMonth":i="last seen last month";break;case"userStatusOffline":{i="last seen ";const e=s.status.was_online,t=Date.now()/1e3;if(t-e<60)i+=" just now";else if(t-e<3600){const s=(t-e)/60|0;i+=s+" "+(1==s?"minute":"minutes")+" ago"}else if(t-e<86400){const s=(t-e)/3600|0;i+=s+" "+(1==s?"hour":"hours")+" ago"}else{const t=new Date(1e3*e);i+=("0"+t.getDate()).slice(-2)+"."+("0"+(t.getMonth()+1)).slice(-2)+" at "+("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)}break}case"userStatusOnline":i="online";break;default:i="last seen a long time ago"}return i}isBot(e){return this.users[e]&&this.users[e].pFlags.bot}hasUser(e,t){var s=this.users[e];return n.isObject(s)&&(t||!s.pFlags.min)}getUserPhoto(e){var t=this.getUser(e);return void 0===this.cachedPhotoLocations[e]&&(this.cachedPhotoLocations[e]=t&&t.photo?t.photo:{empty:!0}),this.cachedPhotoLocations[e]}getUserString(e){var t=this.getUser(e);return"u"+e+(t.access_hash?"_"+t.access_hash:"")}getUserInput(e){var t=this.getUser(e);return t.pFlags&&t.pFlags.self?{_:"inputUserSelf"}:{_:"inputUser",user_id:e,access_hash:t.access_hash||0}}updateUsersStatuses(){var e=n.tsNow(!0);for(let t in this.users){let s=this.users[t];s.status&&"userStatusOnline"==s.status._&&s.status.expires<e&&(s.status=s.status.wasStatus||{_:"userStatusOffline",was_online:s.status.expires},delete s.status.wasStatus,n.$rootScope.$broadcast("user_update",s.id))}}forceUserOnline(e){if(!this.isBot(e)){var t,s=this.getUser(e);if(s&&s.status&&"userStatusOnline"!=s.status._&&"userStatusEmpty"!=s.status._)"userStatusOffline"!=s.status._&&(delete s.status.wasStatus,t=n.copy(s.status)),s.status={_:"userStatusOnline",expires:n.tsNow(!0)+60,wasStatus:t},s.sortStatus=this.getUserStatusForSort(s.status),n.$rootScope.$broadcast("user_update",e)}}deleteContacts(e){var t=[];return e.forEach(e=>{t.push(this.getUserInput(e))}),r.default.invokeApi("contacts.deleteContacts",{id:t}).then(()=>{e.forEach(e=>{this.onContactUpdated(e,!1)})})}getTopPeers(){return this.getPeersPromise?this.getPeersPromise:this.getPeersPromise=h.default.getState().then(e=>{var t;return(null===(t=null==e?void 0:e.topPeers)||void 0===t?void 0:t.length)?e.topPeers:r.default.invokeApi("contacts.getTopPeers",{flags:1,correspondents:!0,offset:0,limit:30,hash:0}).then(e=>{this.saveApiUsers(e.users),o.default.saveApiChats(e.chats);const t=e.categories[0].peers.map(e=>{const t=u.default.getPeerID(e.peer);return h.default.pushPeer(t),t});return h.default.pushToState("topPeers",t),t})})}searchContacts(e,t=20){return r.default.invokeApi("contacts.search",{q:e,limit:t}).then(e=>(this.saveApiUsers(e.users),o.default.saveApiChats(e.chats),e))}onContactUpdated(e,t){if(e=parseInt(""+e),Array.isArray(this.contactsList)){var s=this.contactsList.indexOf(e);t!=(-1!=s)&&(t?(this.contactsList.push(e),c.default.indexObject(e,this.getUserSearchText(e),this.contactsIndex)):this.contactsList.splice(s,1),n.$rootScope.$broadcast("contacts_update",e))}}setUserStatus(e,t){if(!this.isBot(e)){var s=this.users[e];if(s){var i=t?{_:"userStatusOffline",was_online:n.tsNow(!0)}:{_:"userStatusOnline",expires:n.tsNow(!0)+500};s.status=i,s.sortStatus=this.getUserStatusForSort(s.status),n.$rootScope.$broadcast("user_update",e)}}}}t.AppUsersManager=p,t.default=new p},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppMessagesManager=t.FiltersStorage=t.DialogsStorage=void 0;const a=s(0),o=n(s(28)),r=n(s(10)),l=n(s(5)),d=s(3),c=s(11),u=s(80),h=n(s(27)),p=n(s(14)),f=n(s(16)),m=n(s(8)),g=n(s(29)),v=n(s(22)),b=n(s(12)),y=n(s(23)),_=n(s(29)),w=n(s(2)),S=n(s(52)),L=s(32),M=n(s(35)),D=n(s(34)),E=s(7);class I{constructor(){this.dialogs={},this.byFolders={},this.allDialogsLoaded={},this.dialogsOffsetDate={},this.pinnedOrders={0:[],1:[]},this.dialogsNum=0}getFolder(e){var t,s;if(e<=1)return null!==(t=this.byFolders[e])&&void 0!==t?t:this.byFolders[e]=[];const i=[],n=T.filtersStorage.filters[e];for(const e in this.dialogs){const t=this.dialogs[e];if(T.filtersStorage.testDialogForFilter(t,n)){let e;const a=n.pinned_peers.indexOf(t.peerID);e=-1!==a?this.generateDialogIndex(this.generateDialogPinnedDateByIndex(n.pinned_peers.length-1-a)):(null===(s=t.pFlags)||void 0===s?void 0:s.pinned)?this.generateIndexForDialog(t,!0):t.index,i.push({dialog:t,index:e})}}return i.sort((e,t)=>t.index-e.index),i.map(e=>e.dialog)}getDialog(e,t){const s=[];if(void 0===t){const e=this.byFolders;for(const t in e)s.push(e[t])}else s.push(this.getFolder(t));for(let t of s){const s=t.findIndex(t=>t.peerID==e);if(-1!==s)return[t[s],s]}return[]}generateDialogIndex(e){return void 0===e&&(e=a.tsNow(!0)+_.default.serverTimeOffset),65536*e+(65535&++this.dialogsNum)}generateIndexForDialog(e,t=!1){const s=m.default.isChannel(e.peerID)?-e.peerID:0,i=o.default.getFullMessageID(e.top_message,s);let n=T.getMessage(i).date;if(s){const e=r.default.getChat(s);(!n||e.date&&e.date>n)&&(n=e.date)}const a={};a&&a.date>n&&(n=a.date),e.pFlags.pinned&&!t&&(n=this.generateDialogPinnedDate(e));const l=this.generateDialogIndex(n);if(t)return l;e.index=l}generateDialogPinnedDateByIndex(e){return 2147418112+(65535&e)}generateDialogPinnedDate(e){const t=this.pinnedOrders[e.folder_id],s=t.indexOf(e.peerID),i=-1===s?t.push(e.peerID)-1:s;return this.generateDialogPinnedDateByIndex(i)}pushDialog(e,t){const s=this.getFolder(e.folder_id),i=s.findIndex(t=>t.peerID==e.peerID);if(-1!==i&&s.splice(i,1),this.dialogs[e.peerID]=e,t&&!e.pFlags.pinned&&(!this.dialogsOffsetDate[e.folder_id]||t<this.dialogsOffsetDate[e.folder_id])){if(-1!==i)return!1;this.dialogsOffsetDate[e.folder_id]=t}const n=e.index,a=s.length;if(!a||n<s[a-1].index)s.push(e);else if(n>=s[0].index)s.unshift(e);else for(let t=0;t<a;t++)if(n>s[t].index){s.splice(t,0,e);break}}dropDialog(e){const t=this.getDialog(e);return t[0]&&(this.byFolders[t[0].folder_id].splice(t[1],1),delete this.dialogs[e]),t}}t.DialogsStorage=I;class P{constructor(){this.filters={},a.$rootScope.$on("apiUpdate",e=>{this.handleUpdate(e.detail)})}handleUpdate(e){switch(e._){case"updateDialogFilter":console.log("updateDialogFilter",e),e.filter?this.saveDialogFilter(e.filter):this.filters[e.id]&&(a.$rootScope.$broadcast("filter_delete",this.filters[e.id]),delete this.filters[e.id])}}testDialogForFilter(e,t){var s;for(const s of t.exclude_peers)if(s==e.peerID)return!1;for(const s of t.include_peers)if(s==e.peerID)return!0;const i=t.pFlags;if(i.exclude_archived&&1==e.folder_id)return!1;if(i.exclude_read&&!e.unread_count)return!1;if(i.exclude_muted){if(1e3*(null===(s=e.notify_settings)||void 0===s?void 0:s.mute_until)>Date.now())return!1}const n=e.peerID;if(n<0){if(i.broadcasts&&m.default.isBroadcast(n))return!0;if(i.groups&&m.default.isAnyGroup(n))return!0}else{if(m.default.isBot(n))return!!i.bots;if(i.non_contacts&&!l.default.contactsList.has(n))return!0;if(i.contacts&&l.default.contactsList.has(n))return!0}return!1}toggleDialogPin(e,t){const s=this.filters[t];return s.pinned_peers.findAndSplice(t=>t==e)||s.pinned_peers.unshift(e),this.updateDialogFilter(s)}createDialogFilter(e){let t=Math.max(1,...Object.keys(this.filters).map(e=>+e));return(e=a.copy(e)).id=t+1,this.updateDialogFilter(e)}updateDialogFilter(e,t=!1){const s=t?0:1;if(!t){e.flags=0;const t={contacts:0,non_contacts:1,groups:2,broadcasts:3,bots:4,exclude_muted:11,exclude_read:12,exclude_archived:13};for(const s in t)e.pFlags[s]&&(e.flags|=1<<t[s]);e.emoticon&&(e.flags|=1<<25)}return w.default.invokeApi("messages.updateDialogFilter",{flags:s,id:e.id,filter:t?void 0:this.getOutputDialogFilter(e)}).then(s=>(console.log("updateDialogFilter bool:",s),s&&this.handleUpdate({_:"updateDialogFilter",id:e.id,filter:t?void 0:e}),s))}getOutputDialogFilter(e){const t=a.copy(e);return["pinned_peers","exclude_peers","include_peers"].forEach(e=>{t[e]=t[e].map(e=>m.default.getInputPeerByID(e))}),t.include_peers.forEachReverse((e,s)=>{t.pinned_peers.includes(e)&&t.include_peers.splice(s,1)}),t}getDialogFilters(e=!1){return i(this,void 0,void 0,(function*(){if(Object.keys(this.filters).length&&!e)return this.filters;const t=yield w.default.invokeApi("messages.getDialogFilters");for(const e of t)this.saveDialogFilter(e,!1);return this.filters}))}saveDialogFilter(e,t=!0){["pinned_peers","exclude_peers","include_peers"].forEach(t=>{e[t]=e[t].map(e=>m.default.getPeerID(e))}),e.include_peers.forEachReverse((t,s)=>{e.pinned_peers.includes(t)&&e.include_peers.splice(s,1)}),e.include_peers=e.pinned_peers.concat(e.include_peers),this.filters[e.id]?Object.assign(this.filters[e.id],e):this.filters[e.id]=e,t&&a.$rootScope.$broadcast("filter_update",e)}}t.FiltersStorage=P;class C{constructor(){this.messagesStorage={},this.groupedMessagesStorage={},this.historiesStorage={},this.pinnedMessages={},this.pendingByRandomID={},this.pendingByMessageID={},this.pendingAfterMsgs={},this.pendingTopMsgs={},this.sendFilePromise=Promise.resolve(),this.tempID=-1,this.tempFinalizeCallbacks={},this.lastSearchFilter={},this.lastSearchResults=[],this.needSingleMessages=[],this.fetchSingleMessagesTimeout=0,this.fetchSingleMessagesPromise=null,this.maxSeenID=0,this.migratedFromTo={},this.migratedToFrom={},this.newMessagesHandlePromise=0,this.newMessagesToHandle={},this.newDialogsHandlePromise=0,this.newDialogsToHandle={},this.newUpdatesAfterReloadToHandle={},this.reloadConversationsPeers=[],this.dialogsIndex=D.default.createIndex(),this.cachedResults={query:"",count:0,dialogs:[]},this.log=E.logger("MESSAGES"),this.dialogsStorage=new I,this.filtersStorage=new P,this.handleNewMessages=()=>{clearTimeout(this.newMessagesHandlePromise),this.newMessagesHandlePromise=0,a.$rootScope.$broadcast("history_multiappend",this.newMessagesToHandle),this.newMessagesToHandle={}},this.handleNewDialogs=()=>{clearTimeout(this.newDialogsHandlePromise),this.newDialogsHandlePromise=0;let e=0;for(const t in this.newDialogsToHandle){const s=this.newDialogsToHandle[t];"reload"in s?(this.reloadConversation(+t),delete this.newDialogsToHandle[t]):(this.dialogsStorage.pushDialog(s),m.default.isChannel(+t)||(e=Math.max(e,s.top_message||0)))}0!=e&&this.incrementMaxSeenID(e),a.$rootScope.$broadcast("dialogs_multiupdate",this.newDialogsToHandle),this.newDialogsToHandle={}},a.$rootScope.$on("apiUpdate",e=>{this.handleUpdate(e.detail)}),a.$rootScope.$on("webpage_updated",e=>{let t=e.detail;t.msgs.forEach(e=>{let s=this.getMessage(e);s.webpage=S.default.getWebPage(t.id),a.$rootScope.$broadcast("message_edit",{peerID:this.getMessagePeer(s),id:s.id,mid:e,justMedia:!0})})}),a.$rootScope.$on("draft_updated",e=>{let t=e.detail;var s=t.peerID,i=t.draft,n=this.getDialogByPeerID(s)[0];if(n){if(i&&i.date)l=i.date;else{var o=m.default.isChannel(s)?-s:0,l=this.getMessage(n.top_message).date;if(o){var d=r.default.getChat(o);(!l||d.date&&d.date>l)&&(l=d.date)}}n.pFlags.pinned||(n.index=this.dialogsStorage.generateDialogIndex(l)),this.dialogsStorage.pushDialog(n),a.$rootScope.$broadcast("dialog_draft",{peerID:s,draft:i,index:n.index})}})}getInputEntities(e){var t=a.copy(e);return t.forEach(e=>{"messageEntityMentionName"==e._&&(e._="inputMessageEntityMentionName",e.user_id=l.default.getUserInput(e.user_id))}),t}editMessage(e,t,s={}){if("string"!=typeof t||!this.canEditMessage(e))return Promise.reject();if(e<0){return void 0===this.tempFinalizeCallbacks[e]&&(this.tempFinalizeCallbacks[e]={}),new Promise((s,i)=>{this.tempFinalizeCallbacks[e].edit=e=>{this.log("invoke callback",e),this.editMessage(e,t).then(s,i)}})}var i=[];t=d.RichTextProcessor.parseMarkdown(t,i);var n=this.getMessage(e),a=this.getMessagePeer(n),r=0;let l=s.noWebPage||!1;return l&&(r|=2),t&&(r|=2056),w.default.invokeApi("messages.editMessage",{flags:r,peer:m.default.getInputPeerByID(a),id:o.default.getMessageLocalID(e),message:t,media:n.media,entities:this.getInputEntities(i),no_webpage:l}).then(e=>{h.default.processUpdateMessage(e)},e=>{if(!e||"MESSAGE_NOT_MODIFIED"!=e.type)return e&&"MESSAGE_EMPTY"==e.type&&(e.handled=!0),Promise.reject(e);e.handled=!0})}sendText(e,t,s={}){if("string"!=typeof t)return;e=m.default.getPeerMigratedTo(e)||e;var i=s.entities||[];if(s.viaBotID||(t=d.RichTextProcessor.parseMarkdown(t,i)),!t.length)return;var n,r=this.getInputEntities(i),u=this.tempID--,p=[c.nextRandomInt(4294967295),c.nextRandomInt(4294967295)],f=c.bigint(p[0]).shiftLeft(32).add(c.bigint(p[1])).toString(),g=this.historiesStorage[e],v=0,b={},y=s.replyToMsgID,S=m.default.isChannel(e),L=S&&m.default.isMegagroup(e),M=!(!S||L);let D=s.noWebPage||!1;void 0===g&&(g=this.historiesStorage[e]={count:null,history:[],pending:[]});var E=l.default.getSelf().id;e!=E&&(v|=2,b.out=!0,S||l.default.isBot(e)||(v|=1,b.unread=!0)),y&&(v|=8),M?(E=0,b.post=!0):v|=256,n={_:"message",id:u,from_id:E,to_id:m.default.getOutputPeer(e),flags:v,pFlags:b,date:a.tsNow(!0)+_.default.serverTimeOffset,message:t,random_id:f,reply_to_msg_id:y,via_bot_id:s.viaBotID,reply_markup:s.reply_markup,entities:i,views:M&&1,pending:!0},s.webPage&&(n.media={_:"messageMediaWebPage",webpage:s.webPage});var I=e=>{e?n.error=!0:delete n.error,a.$rootScope.$broadcast("messages_pending")};n.send=()=>{I(!1);var i={};this.pendingAfterMsgs[e]&&(i.afterMessageID=this.pendingAfterMsgs[e].messageID);var a,l=0;y&&(l|=1),M&&(l|=16),s.clearDraft&&(l|=128),D&&(l|=2),s.viaBotID?a=w.default.invokeApi("messages.sendInlineBotResult",{flags:l,peer:m.default.getInputPeerByID(e),random_id:p,reply_to_msg_id:o.default.getMessageLocalID(y),query_id:s.queryID,id:s.resultID},i):(r.length&&(l|=8),a=w.default.invokeApi("messages.sendMessage",{flags:l,no_webpage:D,peer:m.default.getInputPeerByID(e),message:t,random_id:p,reply_to_msg_id:o.default.getMessageLocalID(y),entities:r},i)),a.then(e=>{"updateShortSentMessage"==e._?(n.flags=e.flags,n.date=e.date,n.id=e.id,n.media=e.media,n.entities=e.entities,e={_:"updates",users:[],chats:[],seq:0,updates:[{_:"updateMessageID",random_id:f,id:e.id},{_:S?"updateNewChannelMessage":"updateNewMessage",message:n,pts:e.pts,pts_count:e.pts_count}]}):e.updates&&e.updates.forEach(e=>{"updateDraftMessage"==e._&&(e.local=!0)}),h.default.processUpdateMessage(e)},()=>{I(!0)}).finally(()=>{this.pendingAfterMsgs[e]===i&&delete this.pendingAfterMsgs[e]}),this.pendingAfterMsgs[e]=i},this.saveMessages([n]),g.pending.unshift(u),a.$rootScope.$broadcast("history_append",{peerID:e,messageID:u,my:!0}),setTimeout(()=>n.send(),0),this.pendingByRandomID[f]=[e,u]}sendFile(e,t,s={}){var i;e=m.default.getPeerMigratedTo(e)||e;var n,r,u=this.tempID--,f=[c.nextRandomInt(4294967295),c.nextRandomInt(4294967295)],_=c.bigint(f[0]).shiftLeft(32).add(c.bigint(f[1])).toString(),S=null!==(i=this.historiesStorage[e])&&void 0!==i?i:this.historiesStorage[e]={count:null,history:[],pending:[]},M=0,D={},E=s.replyToMsgID,I=m.default.isChannel(e),P=I&&m.default.isMegagroup(e),C=!(!I||P);const T="mime_type"in t?t.mime_type:t.type,k=t instanceof File?t.name:"",X=!(t instanceof File||t instanceof Blob);let A=s.caption||"";const x=a.tsNow(!0)+g.default.serverTimeOffset;if(this.log("sendFile",t,T),A){let e=s.entities||[];A=d.RichTextProcessor.parseMarkdown(A,e)}const F=[];let B="";if(s.isMedia)if(X)n="document",r="";else if(["image/jpeg","image/png","image/bmp"].indexOf(T)>=0){n="photo",r="photo."+T.split("/")[1],B="sendMessageUploadPhotoAction";let e={_:"photo",id:""+u,sizes:[{_:"photoSize",w:s.width,h:s.height,type:"m",size:t.size}],w:s.width,h:s.height,downloaded:t.size,url:s.objectURL||""};p.default.savePhoto(e)}else if(0===T.indexOf("audio/")||["video/ogg"].indexOf(T)>=0){n="audio",r="audio."+("ogg"==T.split("/")[1]?"ogg":"mp3"),B="sendMessageUploadAudioAction";let e=0;s.isVoiceMessage&&(e|=1024,e|=4,n="voice");let t={_:"documentAttributeAudio",flags:e,pFlags:{voice:s.isVoiceMessage},waveform:s.waveform,voice:s.isVoiceMessage,duration:s.duration||0};F.push(t)}else if(0===T.indexOf("video/")){n="video",r="video.mp4",B="sendMessageUploadVideoAction";let e=1;s.isRoundMessage&&(e|=2);let t={_:"documentAttributeVideo",flags:e,pFlags:{supports_streaming:!0,round_message:s.isRoundMessage},round_message:s.isRoundMessage,supports_streaming:!0,duration:s.duration,w:s.width,h:s.height};F.push(t)}else n="document",r="document."+T.split("/")[1],B="sendMessageUploadDocumentAction";else n="document",r="document."+T.split("/")[1],B="sendMessageUploadDocumentAction";if(F.push({_:"documentAttributeFilename",file_name:k||r}),-1!==["document","video","audio","voice"].indexOf(n)&&!X){let e={_:"document",id:""+u,duration:s.duration,attributes:F,w:s.width,h:s.height,downloaded:t.size,thumbs:[],mime_type:T,url:s.objectURL||"",size:t.size};b.default.saveDoc(e)}this.log("AMM: sendFile",n,r,t.type,s);var R=l.default.getSelf().id;e!=R&&(M|=2,D.out=!0,I||l.default.isBot(e)||(M|=1,D.unread=!0)),E&&(M|=8),C?(R=0,D.post=!0):M|=256;let O=new y.default(null,!0);var j={_:"messageMediaPending",type:n,file_name:k||r,size:t.size,file:t,preloader:O,w:s.width,h:s.height,url:s.objectURL,progress:{percent:1,total:t.size,done:0,cancel:()=>{}}};O.preloader.onclick=()=>{this.log("cancelling upload",j),this.setTyping("sendMessageCancelAction"),j.progress.cancel()};var U={_:"message",id:u,from_id:R,to_id:m.default.getOutputPeer(e),flags:M,pFlags:D,date:x,message:A,media:X?{_:"messageMediaDocument",pFlags:{},flags:1,document:t}:j,random_id:_,reply_to_msg_id:E,views:C&&1,pending:!0},H=e=>{e?U.error=!0:delete U.error,a.$rootScope.$broadcast("messages_pending")},N=!1,$=null;let q=(t,i)=>(this.setTyping("sendMessageCancelAction"),w.default.invokeApi("messages.sendMedia",{flags:t,background:s.background,clear_draft:!0,peer:m.default.getInputPeerByID(e),media:i,message:A,random_id:f,reply_to_msg_id:o.default.getMessageLocalID(E)}).then(e=>{h.default.processUpdateMessage(e)},e=>{if("photo"==n&&400==e.code&&("PHOTO_INVALID_DIMENSIONS"==e.type||"PHOTO_SAVE_FILE_INVALID"==e.type))return e.handled=!0,n="document",void U.send();H(!0)}));U.send=()=>{let i=0;if(E&&(i|=1),s.background&&(i|=64),i|=128,X){let{id:e,access_hash:s,file_reference:n}=t;q(i,{_:"inputMediaDocument",flags:0,id:{_:"inputDocument",id:e,access_hash:s,file_reference:n}})}else if(t instanceof File||t instanceof Blob){let s=L.deferredPromise();this.sendFilePromise.then(()=>{N&&!U.error||(N=!1,$=v.default.uploadFile(t)),$&&$.then(e=>{var t;switch(this.log("appMessagesManager: sendFile uploaded:",e),e.name=r,N=!0,n){case"photo":t={_:"inputMediaUploadedPhoto",flags:0,file:e};break;default:t={_:"inputMediaUploadedDocument",file:e,mime_type:T,attributes:F}}q(i,t)},()=>{H(!0)}),$.notify=t=>{this.log("upload progress",t),j.progress.done=t.done,j.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),this.setTyping({_:B,progress:0|j.progress.percent}),O.setProgress(j.progress.percent),a.$rootScope.$broadcast("history_update",{peerID:e})},j.progress.cancel=()=>{N||(s.resolve(),$.cancel(),this.cancelPendingMessage(_))},$.finally(()=>{s.resolve(),O.detach()})}),this.sendFilePromise=s}},this.saveMessages([U]),S.pending.unshift(u),a.$rootScope.$broadcast("history_append",{peerID:e,messageID:u,my:!0}),setTimeout(U.send.bind(this),0),this.pendingByRandomID[_]=[e,u]}sendAlbum(e,t,s={}){var n;return i(this,void 0,void 0,(function*(){let i;e=m.default.getPeerMigratedTo(e)||e;let r=null!==(n=this.historiesStorage[e])&&void 0!==n?n:this.historiesStorage[e]={count:null,history:[],pending:[]},u=0,f={},_=s.replyToMsgID,S=m.default.isChannel(e),M=S&&m.default.isMegagroup(e),D=!(!S||M),E=s.caption||"",I=a.tsNow(!0)+g.default.serverTimeOffset;if(E){let e=s.entities||[];E=d.RichTextProcessor.parseMarkdown(E,e)}this.log("AMM: sendAlbum",t,s);let P=l.default.getSelf().id;e!=P&&(f.out=!0,S||l.default.isBot(e)||(f.unread=!0)),_&&(u|=1),D?(P=0,f.post=!0):u|=128;let C=t.map(()=>this.tempID--).reverse();i=C[C.length-1];let T=t.map((t,n)=>{let a=C[n],o=[c.nextRandomInt(4294967295),c.nextRandomInt(4294967295)],l=c.bigint(o[0]).shiftLeft(32).add(c.bigint(o[1])).toString(),d=new y.default(null,!0),h=s.sendFileDetails[n],g={_:"messageMediaPending",type:"album",preloader:d,progress:{percent:1,total:t.size,done:0,cancel:()=>{}},document:void 0,photo:void 0};if(0===t.type.indexOf("video/")){let e={_:"document",id:""+a,attributes:[{_:"documentAttributeVideo",flags:1,pFlags:{supports_streaming:!0,round_message:!1},round_message:!1,supports_streaming:!0,duration:h.duration,w:h.width,h:h.height}],downloaded:t.size,thumbs:[],mime_type:t.type,url:h.objectURL||"",size:t.size};b.default.saveDoc(e),g.document=e}else{let e={_:"photo",id:""+a,sizes:[{_:"photoSize",w:h.width,h:h.height,type:"m",size:t.size}],w:h.width,h:h.height,downloaded:t.size,url:h.objectURL||""};p.default.savePhoto(e),g.photo=e}d.preloader.onclick=()=>{this.log("cancelling upload",g),this.setTyping("sendMessageCancelAction"),g.progress.cancel()};let v={_:"message",id:a,from_id:P,grouped_id:i,to_id:m.default.getOutputPeer(e),flags:u,pFlags:f,date:I,message:E,media:g,random_id:l,randomID:o,reply_to_msg_id:_,views:D&&1,pending:!0,error:!1};return this.saveMessages([v]),r.pending.unshift(a),this.pendingByRandomID[l]=[e,a],v});a.$rootScope.$broadcast("history_append",{peerID:e,messageID:T[T.length-1].id,my:!0});let k=(e,t)=>{t?e.error=!0:delete e.error,a.$rootScope.$broadcast("messages_pending")},X=!1,A=null,x=m.default.getInputPeerByID(e),F=[];for(let i=0,n=t.length;i<n;++i){let n=t[i],o=T[i],r=o.media,l=r.preloader,d=0===n.type.indexOf("video/")?"sendMessageUploadVideoAction":"sendMessageUploadPhotoAction",c=L.deferredPromise();yield this.sendFilePromise,this.sendFilePromise=c,X&&!o.error||(X=!1,A=v.default.uploadFile(n)),A.notify=t=>{this.log("upload progress",t),r.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),this.setTyping({_:d,progress:0|r.progress.percent}),l.setProgress(r.progress.percent),a.$rootScope.$broadcast("history_update",{peerID:e})},yield A.then(e=>{let t;this.log("appMessagesManager: sendAlbum file uploaded:",e);let a=s.sendFileDetails[i];return t=a.duration?{_:"inputMediaUploadedDocument",flags:0,file:e,mime_type:n.type,attributes:[{_:"documentAttributeVideo",flags:2,supports_streaming:!0,duration:a.duration,w:a.width,h:a.height}]}:{_:"inputMediaUploadedPhoto",flags:0,file:e},w.default.invokeApi("messages.uploadMedia",{peer:x,media:t}).then(e=>{let t;if(e.photo){let s=e.photo;p.default.savePhoto(s),t=p.default.getInputByID(s.id)}else{let s=e.document;b.default.saveDoc(s),t=b.default.getMediaInputByID(s.id)}F.push({_:"inputSingleMedia",flags:0,media:t,random_id:o.randomID,message:E,entities:[]}),E=""},()=>{k(o,!0)})},()=>{k(o,!0)}),this.log("appMessagesManager: sendAlbum uploadPromise.finally!"),c.resolve(),l.detach()}X=!0,(e=>{this.setTyping("sendMessageCancelAction"),w.default.invokeApi("messages.sendMultiMedia",{flags:u,peer:x,multi_media:e,reply_to_msg_id:o.default.getMessageLocalID(_)}).then(e=>{h.default.processUpdateMessage(e)},e=>{T.forEach(e=>k(e,!0))})})(F)}))}sendOther(e,t,s={}){var i;e=m.default.getPeerMigratedTo(e)||e;const n=this.tempID--,r=[c.nextRandomInt(4294967295),c.nextRandomInt(4294967295)],d=c.bigint(r[0]).shiftLeft(32).add(c.bigint(r[1])).toString(),u=null!==(i=this.historiesStorage[e])&&void 0!==i?i:this.historiesStorage[e]={count:null,history:[],pending:[]},p=s.replyToMsgID,f=m.default.isChannel(e),v=f&&m.default.isMegagroup(e),b=!(!f||v);let y,_=l.default.getSelf().id;switch(t._){case"inputMediaPoll":{t.poll.id=n,M.default.savePoll(t.poll,{_:"pollResults",flags:4,total_voters:0,pFlags:{}});const{poll:e,results:s}=M.default.getPoll(""+n);y={_:"messageMediaPoll",poll:e,results:s};break}}let S=0,L={};e!=_&&(S|=2,L.out=!0,l.default.isBot(e)||(S|=1,L.unread=!0)),p&&(S|=8),b?(_=0,L.post=!0):S|=256;const D={_:"message",id:n,from_id:_,to_id:m.default.getOutputPeer(e),flags:S,pFlags:L,date:a.tsNow(!0)+g.default.serverTimeOffset,message:"",media:y,random_id:d,reply_to_msg_id:p,via_bot_id:s.viaBotID,reply_markup:s.reply_markup,views:b&&1,pending:!0};D.send=()=>{let i=0;p&&(i|=1),b&&(i|=16),s.clearDraft&&(i|=128);const n={};let l;this.pendingAfterMsgs[e]&&(n.afterMessageID=this.pendingAfterMsgs[e].messageID),l=s.viaBotID?w.default.invokeApi("messages.sendInlineBotResult",{flags:i,peer:m.default.getInputPeerByID(e),random_id:r,reply_to_msg_id:o.default.getMessageLocalID(p),query_id:s.queryID,id:s.resultID},n):w.default.invokeApi("messages.sendMedia",{flags:i,peer:m.default.getInputPeerByID(e),media:t,random_id:r,reply_to_msg_id:o.default.getMessageLocalID(p)},n),l.then(e=>{e.updates&&e.updates.forEach(e=>{"updateDraftMessage"==e._&&(e.local=!0)}),h.default.processUpdateMessage(e)},e=>{a.$rootScope.$broadcast("messages_pending")}).finally(()=>{this.pendingAfterMsgs[e]===n&&delete this.pendingAfterMsgs[e]}),this.pendingAfterMsgs[e]=n},this.saveMessages([D]),u.pending.unshift(n),a.$rootScope.$broadcast("history_append",{peerID:e,messageID:n,my:!0}),setTimeout(D.send,0),this.pendingByRandomID[d]=[e,n]}cancelPendingMessage(e){var t=this.pendingByRandomID[e];if(this.log("cancelPendingMessage",e,t),t){var s=t[0],i=t[1],n=this.historiesStorage[s],a=n.pending.indexOf(i);return h.default.processUpdateMessage({_:"updateShort",update:{_:"updateDeleteMessages",messages:[i]}}),-1!=a&&n.pending.splice(a,1),delete this.messagesStorage[i],!0}return!1}getConversations(e="",t,s=20,i=0){const n=i>1?0:i;let a=this.dialogsStorage.getFolder(i);if(e){if(!s||this.cachedResults.query!==e){this.cachedResults.query=e;const t=D.default.search(e,this.dialogsIndex);this.cachedResults.dialogs=[];for(const e in this.dialogsStorage.dialogs){const s=this.dialogsStorage.dialogs[e];t[s.peerID]&&this.cachedResults.dialogs.push(s)}this.cachedResults.count=this.cachedResults.dialogs.length}a=this.cachedResults.dialogs}else this.cachedResults.query="";let o=0;if(t>0)for(;o<a.length&&!(t>a[o].index);o++);return e||this.dialogsStorage.allDialogsLoaded[n]||a.length>=o+s?Promise.resolve({dialogs:a.slice(o,o+s),count:this.dialogsStorage.allDialogsLoaded[n]?a.length:null}):this.getTopMessages(s,n).then(e=>{if(o=0,t>0)for(;o<a.length&&!(t>a[o].index);o++);return{dialogs:a.slice(o,o+s),count:e}})}getTopMessages(e,t){const s=this.dialogsStorage.getFolder(t);let i=0,n=0,d=0;return this.dialogsStorage.dialogsOffsetDate[t]&&(i=this.dialogsStorage.dialogsOffsetDate[t]+_.default.serverTimeOffset,n=65536*this.dialogsStorage.dialogsOffsetDate[t]),d|=2,w.default.invokeApi("messages.getDialogs",{flags:2,folder_id:t,offset_date:i,offset_id:o.default.getMessageLocalID(0),offset_peer:m.default.getInputPeerByID(0),limit:e,hash:0},{timeout:0}).then(e=>{i||u.telegramMeWebService.setAuthorized(!0),l.default.saveApiUsers(e.users),r.default.saveApiChats(e.chats),this.saveMessages(e.messages);var o=!!i,d=!1;let c=e.dialogs.length,h={};for(let t=c-1;t>=0;--t){let s=e.dialogs[t];this.saveConversation(s),n&&s.index>n&&(this.newDialogsToHandle[s.peerID]=s,d=!0),s.read_inbox_max_id||s.read_outbox_max_id||(h[s.peerID]=s),o||m.default.isChannel(m.default.getPeerID(s.peer))||(this.incrementMaxSeenID(s.top_message),o=!0)}return Object.keys(h).length&&this.reloadConversation(Object.keys(h).map(e=>+e)).then(()=>{a.$rootScope.$broadcast("dialogs_multiupdate",h);for(let e in h)a.$rootScope.$broadcast("dialog_unread",{peerID:+e})}),(!e.dialogs.length||!e.count||s.length>=e.count)&&(this.dialogsStorage.allDialogsLoaded[t]=!0),d?this.scheduleHandleNewDialogs():a.$rootScope.$broadcast("dialogs_multiupdate",{}),e.count})}forwardMessages(e,t,s={}){e=m.default.getPeerMigratedTo(e)||e,t=t.sort((e,t)=>e-t);var i=0;s.withMyScore&&(i|=256);let n=o.default.splitMessageIDsByChannels(t),a=[];for(let t in n.msgIDs){let s=n.msgIDs[t],o=s.length,r=[];for(let e=0;e<o;e++)r.push([c.nextRandomInt(4294967295),c.nextRandomInt(4294967295)]);let l={};this.pendingAfterMsgs[e]&&(l.afterMessageID=this.pendingAfterMsgs[e].messageID);let d=w.default.invokeApi("messages.forwardMessages",{flags:i,from_peer:m.default.getInputPeerByID(-t),id:s,random_id:r,to_peer:m.default.getInputPeerByID(e)},l).then(e=>{h.default.processUpdateMessage(e)},()=>{}).then(()=>{this.pendingAfterMsgs[e]===l&&delete this.pendingAfterMsgs[e]});this.pendingAfterMsgs[e]=l,a.push(d)}return Promise.all(a)}getMessage(e){return this.messagesStorage[e]||{_:"messageEmpty",deleted:!0,pFlags:{out:!1,unread:!1}}}getMessagePeer(e){var t=e.to_id&&m.default.getPeerID(e.to_id)||0;return t<0||e.pFlags&&e.pFlags.out||2&e.flags?t:e.from_id}getDialogByPeerID(e){return this.dialogsStorage.getDialog(e)}reloadConversation(e){return[].concat(e).forEach(e=>{this.reloadConversationsPeers.includes(e)||(this.reloadConversationsPeers.push(e),this.log("will reloadConversation",e))}),this.reloadConversationsPromise?this.reloadConversationsPromise:this.reloadConversationsPromise=new Promise((e,t)=>{setTimeout(()=>{let s=this.reloadConversationsPeers.map(e=>m.default.getInputPeerByID(e));this.reloadConversationsPeers.length=0,w.default.invokeApi("messages.getPeerDialogs",{peers:s}).then(t=>{this.applyConversations(t),e()},t).finally(()=>{this.reloadConversationsPromise=null})},0)})}doFlushHistory(e,t){let s=0;return t&&(s|=1),w.default.invokeApi("messages.deleteHistory",{flags:s,peer:e,max_id:0}).then(s=>(h.default.processUpdateMessage({_:"updateShort",update:{_:"updatePts",pts:s.pts,pts_count:s.pts_count}}),!s.offset||this.doFlushHistory(e,t)))}flushHistory(e,t){return i(this,void 0,void 0,(function*(){if(m.default.isChannel(e)){let t=this.getHistory(e,0,1),s=t instanceof Promise?yield t:t,i=-e,n=o.default.getMessageLocalID(s.history[0]||0);return w.default.invokeApi("channels.deleteHistory",{channel:r.default.getChannelInput(i),max_id:n}).then(()=>(h.default.processUpdateMessage({_:"updateShort",update:{_:"updateChannelAvailableMessages",channel_id:i,available_min_id:n}}),!0))}return this.doFlushHistory(m.default.getInputPeerByID(e),t).then(()=>{delete this.historiesStorage[e];for(let t in this.messagesStorage){this.messagesStorage[t].peerID==e&&delete this.messagesStorage[t]}t?a.$rootScope.$broadcast("dialog_flush",{peerID:e}):(this.dialogsStorage.dropDialog(e),a.$rootScope.$broadcast("dialog_drop",{peerID:e}))})}))}savePinnedMessage(e,t){t?(this.pinnedMessages[e]=t,this.wrapSingleMessage(t)):delete this.pinnedMessages[e]}getPinnedMessage(e){return this.getMessage(this.pinnedMessages[e]||0)}updatePinnedMessage(e,t){w.default.invokeApi("messages.updatePinnedMessage",{flags:0,peer:m.default.getInputPeerByID(e),id:t}).then(e=>{h.default.processUpdateMessage(e)})}saveMessages(e,t={}){e.forEach(e=>{var s;if(void 0===e.pFlags&&(e.pFlags={}),e.pFlags.out||(e.pFlags.out=!1),e.pFlags.unread||(e.pFlags.unread=!1),"messageEmpty"==e._)return;const i=this.getMessagePeer(e),n="peerChannel"==e.to_id._,a=n?-i:0,c=n&&r.default.isBroadcast(a),u=o.default.getFullMessageID(e.id,a);if(e.mid=u,e.grouped_id){(null!==(s=this.groupedMessagesStorage[e.grouped_id])&&void 0!==s?s:this.groupedMessagesStorage[e.grouped_id]={})[u]=e}const h=this.getDialogByPeerID(i)[0];h&&u>0?e.pFlags.unread=u>h[e.pFlags.out?"read_outbox_max_id":"read_inbox_max_id"]:t.isNew&&(e.pFlags.unread=!0),e.reply_to_msg_id&&(e.reply_to_mid=o.default.getFullMessageID(e.reply_to_msg_id,a)),e.date-=_.default.serverTimeOffset,e.peerID=i,e.fromID=e.pFlags.post?i:e.from_id;const f=e.fwd_from;if(f){if(i==l.default.getSelf().id){if(f.saved_from_peer&&f.saved_from_msg_id){const t=m.default.getPeerID(f.saved_from_peer),s=o.default.getFullMessageID(f.saved_from_msg_id,m.default.isChannel(t)?-t:0);e.savedFrom=t+"_"+s}e.fromID=f.channel_id?-f.channel_id:f.from_id}else e.fwdPostID=f.channel_post;e.fwdFromID=f.channel_id?-f.channel_id:f.from_id,f.date-=_.default.serverTimeOffset}e.via_bot_id>0&&(e.viaBotID=e.via_bot_id);const g={user_id:e.fromID,date:e.date};if(e.media)switch(e.media._){case"messageMediaEmpty":delete e.media;break;case"messageMediaPhoto":e.media.ttl_seconds?e.media={_:"messageMediaUnsupportedWeb"}:e.media.photo=p.default.savePhoto(e.media.photo,g);break;case"messageMediaPoll":e.media.poll=M.default.savePoll(e.media.poll,e.media.results);break;case"messageMediaDocument":e.media.ttl_seconds?e.media={_:"messageMediaUnsupportedWeb"}:e.media.document=b.default.saveDoc(e.media.document,g);break;case"messageMediaWebPage":S.default.saveWebPage(e.media.webpage,e.mid,g);break;case"messageMediaInvoice":e.media={_:"messageMediaUnsupportedWeb"};break;case"messageMediaGeoLive":e.media._="messageMediaGeo"}if(e.action){let t,s;switch(e.action._){case"messageActionChatEditPhoto":e.action.photo=p.default.savePhoto(e.action.photo,g),c&&(e.action._="messageActionChannelEditPhoto");break;case"messageActionChatEditTitle":c&&(e.action._="messageActionChannelEditTitle");break;case"messageActionChatDeletePhoto":c&&(e.action._="messageActionChannelDeletePhoto");break;case"messageActionChatAddUser":1==e.action.users.length?(e.action.user_id=e.action.users[0],e.fromID==e.action.user_id&&(e.action._=n?"messageActionChatJoined":"messageActionChatReturn")):e.action.users.length>1&&(e.action._="messageActionChatAddUsers");break;case"messageActionChatDeleteUser":e.fromID==e.action.user_id&&(e.action._="messageActionChatLeave");break;case"messageActionChannelMigrateFrom":t=-e.action.chat_id,s=-a;break;case"messageActionChatMigrateTo":t=-a,s=-e.action.channel_id;break;case"messageActionHistoryClear":e.deleted=!0,e.clear_history=!0,e.pFlags.out=!1,e.pFlags.unread=!1;break;case"messageActionPhoneCall":delete e.fromID,e.action.type=(e.pFlags.out?"out_":"in_")+("phoneCallDiscardReasonMissed"==e.action.reason._||"phoneCallDiscardReasonBusy"==e.action.reason._?"missed":"ok")}t&&s&&!this.migratedFromTo[t]&&!this.migratedToFrom[s]&&this.migrateChecks(t,s)}if(e.rReply=this.getRichReplyText(e),e.message&&e.message.length){const t=d.RichTextProcessor.parseEntities(e.message),s=e.entities||[];e.totalEntities=d.RichTextProcessor.mergeEntities(t,s,!e.pending)}e.canBeEdited=this.canMessageBeEdited(e),t.isEdited||(this.messagesStorage[u]=e)})}getRichReplyText(e,t=e.message){let s="";if(e.media)if(e.grouped_id)s+="<i>Album"+(e.message?", ":"")+"</i>";else switch(e.media._){case"messageMediaPhoto":s+="<i>Photo"+(e.message?", ":"")+"</i>";break;case"messageMediaGeo":s+="<i>Geolocation</i>";break;case"messageMediaPoll":s+="<i>"+e.media.poll.rReply+"</i>";break;case"messageMediaContact":s+="<i>Contact</i>";break;case"messageMediaDocument":let t=e.media.document;s="video"==t.type?"<i>Video"+(e.message?", ":"")+"</i>":"voice"==t.type?"<i>Voice message</i>":"gif"==t.type?"<i>GIF"+(e.message?", ":"")+"</i>":"round"==t.type?"<i>Video message"+(e.message?", ":"")+"</i>":"sticker"==t.type?(t.stickerEmoji||"")+"<i>Sticker</i>":"<i>"+t.file_name+"</i>"}if(e.action){let t=e.action,i="";if(t.message)i=d.RichTextProcessor.wrapRichText(t.message,{noLinebreaks:!0});else{let e="",s=t._;if("messageActionPhoneCall"==s){s+="."+t.type;let i=t.duration;if(i){let t=[];t.push(i%60+" s"),i>=60&&t.push((i/60|0)+" min"),e=" ("+t.reverse().join(" ")+")"}}i=a.langPack[s]+e}s="<i>"+i+"</i>"}let i="";if(t){let e=d.RichTextProcessor.parseEntities(t.replace(/\n/g," "),{noLinebreakers:!0});i=d.RichTextProcessor.wrapRichText(t,{noLinebreakers:!0,entities:e,noTextFormat:!0})}return s+i}editPeerFolders(e,t){w.default.invokeApi("folders.editPeerFolders",{folder_peers:e.map(e=>({_:"inputFolderPeer",peer:m.default.getInputPeerByID(e),folder_id:t}))}).then(e=>{this.log("editPeerFolders updates:",e),h.default.processUpdateMessage(e)})}toggleDialogPin(e,t){var s;if(t>1)return void this.filtersStorage.toggleDialogPin(e,t);const i=this.getDialogByPeerID(e)[0];if(!i)return Promise.reject();const n={_:"inputDialogPeer",peer:m.default.getInputPeerByID(e)},a=(null===(s=i.pFlags)||void 0===s?void 0:s.pinned)?0:1;return w.default.invokeApi("messages.toggleDialogPin",{flags:a,peer:n}).then(e=>{e&&this.handleUpdate({_:"updateDialogPinned",peer:n,pFlags:{pinned:a}})})}markDialogUnread(e,t){var s;let i=this.getDialogByPeerID(e)[0];if(!i)return Promise.reject();let n={_:"inputDialogPeer",peer:m.default.getInputPeerByID(e)},a=t||(null===(s=i.pFlags)||void 0===s?void 0:s.unread_mark)?0:1;return w.default.invokeApi("messages.markDialogUnread",{flags:a,peer:n}).then(e=>{e&&this.handleUpdate({_:"updateDialogUnreadMark",peer:n,pFlags:{unread:a}})})}migrateChecks(e,t){if(!this.migratedFromTo[e]&&!this.migratedToFrom[t]&&r.default.hasChat(-t)){const s=r.default.getChat(-e);s&&s.migrated_to&&s.migrated_to.channel_id==-t&&(this.migratedFromTo[e]=t,this.migratedToFrom[t]=e,setTimeout(()=>{const s=this.dialogsStorage.dropDialog(e);s.length&&a.$rootScope.$broadcast("dialog_drop",{peerID:e,dialog:s[0]}),a.$rootScope.$broadcast("dialog_migrate",{migrateFrom:e,migrateTo:t})},100))}}canMessageBeEdited(e){return!("message"!=e._||e.deleted||e.fwd_from||e.via_bot_id||e.media&&-1==["messageMediaPhoto","messageMediaDocument","messageMediaWebPage","messageMediaPending"].indexOf(e.media._)||e.fromID&&l.default.isBot(e.fromID))&&(!e.media||"messageMediaDocument"!=e.media._||!e.media.document.sticker)}canEditMessage(e){if(!this.messagesStorage[e])return!1;const t=this.messagesStorage[e];return!(!t||!t.canBeEdited)&&(this.getMessagePeer(t)==l.default.getSelf().id||!(t.date<a.tsNow(!0)-172800||!t.pFlags.out))}applyConversations(e){l.default.saveApiUsers(e.users),r.default.saveApiChats(e.chats),this.saveMessages(e.messages);const t={};let s=!1;e.dialogs.forEach(e=>{const i=m.default.getPeerID(e.peer);let n=e.top_message;const o=this.pendingTopMsgs[i];if(o&&(!n||this.getMessage(o).date>this.getMessage(n).date)&&(e.top_message=n=o),n){const n=this.getDialogByPeerID(i)[0];n&&n.pFlags&&n.pFlags.pinned&&(e.pFlags||(e.pFlags={}),e.pFlags.pinned=!0),this.saveConversation(e),n?a.$rootScope.$broadcast("dialog_top",e):(t[i]=e,s=!0)}else{const e=this.dialogsStorage.dropDialog(i);e.length&&a.$rootScope.$broadcast("dialog_drop",{peerID:i,dialog:e[0]})}if(void 0!==this.newUpdatesAfterReloadToHandle[i]){for(const e in this.newUpdatesAfterReloadToHandle[i]){const t=this.newUpdatesAfterReloadToHandle[i][e];this.handleUpdate(t)}delete this.newUpdatesAfterReloadToHandle[i]}}),s&&a.$rootScope.$broadcast("dialogs_multiupdate",t)}saveConversation(e){const t=m.default.getPeerID(e.peer);if(!t)return!1;const s=m.default.isChannel(t)?-t:0,i=m.default.getPeerSearchText(t);let n,d;if(D.default.indexObject(t,i,this.dialogsIndex),e.top_message?(n=o.default.getFullMessageID(e.top_message,s),d=this.getMessage(n)):(n=this.tempID--,d={_:"message",id:n,mid:n,from_id:l.default.getSelf().id,to_id:m.default.getOutputPeer(t),deleted:!0,flags:0,pFlags:{unread:!1,out:!0},date:0,message:""},this.saveMessages([d])),!s&&t<0){const e=r.default.getChat(-t);if(e&&e.migrated_to&&e.pFlags.deactivated){const s=m.default.getPeerID(e.migrated_to);return this.migratedFromTo[t]=s,void(this.migratedToFrom[s]=t)}}if(e.top_message=n,e.read_inbox_max_id=o.default.getFullMessageID(e.read_inbox_max_id,s),e.read_outbox_max_id=o.default.getFullMessageID(e.read_outbox_max_id,s),e.hasOwnProperty("folder_id")||(e.folder_id=0),e.peerID=t,this.dialogsStorage.generateIndexForDialog(e),this.dialogsStorage.pushDialog(e,d.date),d.mid>0&&(d.mid>e[d.pFlags.out?"read_outbox_max_id":"read_inbox_max_id"]?d.pFlags.unread=!0:d.pFlags.unread=!1),void 0===this.historiesStorage[t]){const s={count:null,history:[],pending:[]};s[n>0?"history":"pending"].push(n),n<0&&d.pFlags.unread&&e.unread_count++,this.historiesStorage[t]=s,this.mergeReplyKeyboard(s,d)&&a.$rootScope.$broadcast("history_reply_markup",{peerID:t})}s&&e.pts&&h.default.addChannelState(s,e.pts)}mergeReplyKeyboard(e,t){if(!t.reply_markup&&!t.pFlags.out&&!t.action)return!1;if(t.reply_markup&&"replyInlineMarkup"==t.reply_markup._)return!1;var s=t.reply_markup,i=e.reply_markup;if(s)return!(i&&i.mid>=t.mid)&&(!(s.pFlags.selective&&!(16&t.flags))&&(e.maxOutID&&t.mid<e.maxOutID&&s.pFlags.single_use&&(s.pFlags.hidden=!0),"replyKeyboardHide"!=(s=Object.assign({mid:t.mid},s))._&&(s.fromID=t.from_id),e.reply_markup=s,!0));if(t.pFlags.out)if(i){if(i.pFlags.single_use&&!i.pFlags.hidden&&(t.mid>i.mid||t.mid<0)&&t.message)return i.pFlags.hidden=!0,!0}else(!e.maxOutID||t.mid>e.maxOutID)&&(e.maxOutID=t.mid);return!(!t.action||"messageActionChatDeleteUser"!=t.action._||!(i?t.action.user_id==i.fromID:l.default.isBot(t.action.user_id)))&&(e.reply_markup={_:"replyKeyboardHide",mid:t.mid,flags:0,pFlags:{}},!0)}getSearch(e=0,t="",s={_:"inputMessagesFilterEmpty"},i,n,d=0,c=0){var u=[],h=!t,p={peer:e,filter:s},f=h&&a.deepEqual(this.lastSearchFilter,p);if(h&&!f&&(this.lastSearchFilter=p,this.lastSearchResults=[]),e&&!i&&!t){var v=this.historiesStorage[e];if(void 0!==v&&v.history.length){var b,y,_={},S=n||20;switch(s._){case"inputMessagesFilterPhotos":_.messageMediaPhoto=!0;break;case"inputMessagesFilterPhotoVideo":_.messageMediaPhoto=!0,_.messageMediaDocument=!0,b="video";break;case"inputMessagesFilterVideo":_.messageMediaDocument=!0,b="video";break;case"inputMessagesFilterDocument":_.messageMediaDocument=!0,b=!1;break;case"inputMessagesFilterVoice":_.messageMediaDocument=!0,b="voice";break;case"inputMessagesFilterRoundVideo":_.messageMediaDocument=!0,b="round";break;case"inputMessagesFilterMusic":_.messageMediaDocument=!0,b="audio";break;case"inputMessagesFilterUrl":_.url=!0;break;case"inputMessagesFilterMyMentions":_.mentioned=!0;break;default:return Promise.resolve({count:0,next_rate:0,history:[]})}for(let e=0;e<v.history.length;e++)if((y=this.messagesStorage[v.history[e]]).media&&_[y.media._]){if(void 0!==b&&"messageMediaDocument"==y.media._&&y.media.document.type!=b)continue;if(u.push(y.mid),u.length>=S)break}}if(u.length<S&&this.lastSearchResults.length&&f){var L=!!u.length&&u[u.length-1];for(let e=0;e<this.lastSearchResults.length&&!((!1===L||this.lastSearchResults[e]<L)&&(u.push(this.lastSearchResults[e]),u.length>=S));e++);}}if(u.length||1e3==n)return h&&(this.lastSearchResults=a.listMergeSorted(this.lastSearchResults,u)),Promise.resolve({count:0,next_rate:0,history:u});let M;if(e||!t)M=w.default.invokeApi("messages.search",{flags:0,peer:m.default.getInputPeerByID(e),q:t||"",filter:s||{_:"inputMessagesFilterEmpty"},min_date:0,max_date:0,limit:n,offset_id:o.default.getMessageLocalID(i)||0,add_offset:c?-c:0,max_id:0,min_id:0},{timeout:0,noErrorBox:!0});else{var D=0,E=0,I=i&&this.getMessage(i);I&&I.date&&(I.date+g.default.serverTimeOffset,E=I.id,D=this.getMessagePeer(I)),M=w.default.invokeApi("messages.searchGlobal",{q:t,offset_rate:d,offset_peer:m.default.getInputPeerByID(D),offset_id:o.default.getMessageLocalID(E),limit:n||20},{timeout:0,noErrorBox:!0})}return M.then(e=>{l.default.saveApiUsers(e.users),r.default.saveApiChats(e.chats),this.saveMessages(e.messages);var t=e.count||e.messages.length;return u=[],e.messages.forEach(e=>{var t=this.getMessagePeer(e);if(t<0){var s=r.default.getChat(-t);s.migrated_to&&this.migrateChecks(t,-s.migrated_to.channel_id)}u.push(e.mid)}),h&&(!i||f&&this.lastSearchResults.indexOf(i)>=0)&&(this.lastSearchResults=a.listMergeSorted(this.lastSearchResults,u)),{count:t,next_rate:e.next_rate,history:u}},e=>(400==e.code&&(e.handled=!0),Promise.reject(e)))}scheduleHandleNewDialogs(){this.newDialogsHandlePromise||(this.newDialogsHandlePromise=window.setTimeout(this.handleNewDialogs,0))}deleteMessages(e,t){const s=o.default.splitMessageIDsByChannels(e),i=[];for(const e in s.msgIDs){const n=+e;let a,o=s.msgIDs[n];if(n>0){const e=r.default.getChat(n);if(!(e.pFlags.creator||e.pFlags.editor&&e.pFlags.megagroup)){const t=[];if((e.pFlags.editor||e.pFlags.megagroup)&&o.forEach((e,i)=>{this.getMessage(s.mids[n][i]).pFlags.out&&t.push(e)}),!t.length)return;o=t}a=w.default.invokeApi("channels.deleteMessages",{channel:r.default.getChannelInput(n),id:o}).then(e=>{h.default.processUpdateMessage({_:"updateShort",update:{_:"updateDeleteChannelMessages",channel_id:n,messages:o,pts:e.pts,pts_count:e.pts_count}})})}else{let e=0;t&&(e|=1),a=w.default.invokeApi("messages.deleteMessages",{flags:e,id:o}).then(e=>{h.default.processUpdateMessage({_:"updateShort",update:{_:"updateDeleteMessages",messages:o,pts:e.pts,pts_count:e.pts_count}})})}i.push(a)}return Promise.all(i)}readHistory(e,t=0,s=0){const i=m.default.isChannel(e),n=this.historiesStorage[e],o=this.getDialogByPeerID(e)[0];if(!o||!o.unread_count){if(!n||!n.history.length)return Promise.resolve(!1);if(!!!n.history.find(e=>{const t=this.messagesStorage[e];return t&&!t.pFlags.out&&t.pFlags.unread}))return Promise.resolve(!1)}if(n.readPromise)return n.readPromise;let l;return l=i?w.default.invokeApi("channels.readHistory",{channel:r.default.getChannelInput(-e),max_id:t}):w.default.invokeApi("messages.readHistory",{peer:m.default.getInputPeerByID(e),max_id:t}).then(e=>{h.default.processUpdateMessage({_:"updateShort",update:{_:"updatePts",pts:e.pts,pts_count:e.pts_count}})}),n.readPromise=l.then(()=>{let i=-1;0!=t&&n.history.length&&(i=n.history.indexOf(t));let r=1;if(n.history.length&&t)for(let e=-1==i?0:i,s=n.history.length;e<s;e++){const s=n.history[e];if(s>t)continue;const i=this.messagesStorage[s];i&&!i.pFlags.out&&(i.pFlags.unread=!1,r++)}return!!o&&(n.history.length&&(o.read_inbox_max_id=t),o.read_inbox_max_id==o.top_message||o.read_inbox_max_id==o.read_outbox_max_id?o.unread_count=0:o.unread_count=Math.max(o.unread_count-(s||r),0),this.log("readHistory set unread_count to:",o.unread_count,o),a.$rootScope.$broadcast("dialog_unread",{peerID:e,count:o.unread_count}),a.$rootScope.$broadcast("messages_read"),!0)}).finally(()=>{delete n.readPromise}),n.readPromise}readMessages(e){var t=o.default.splitMessageIDsByChannels(e);Object.keys(t.msgIDs).forEach(e=>{e=+e;let s=t.msgIDs[e];e>0?w.default.invokeApi("channels.readMessageContents",{channel:r.default.getChannelInput(e),id:s}).then(()=>{h.default.processUpdateMessage({_:"updateShort",update:{_:"updateChannelReadMessagesContents",channel_id:e,messages:s}})}):w.default.invokeApi("messages.readMessageContents",{id:s}).then(e=>{h.default.processUpdateMessage({_:"updateShort",update:{_:"updateReadMessagesContents",messages:s,pts:e.pts,pts_count:e.pts_count}})})})}handleUpdate(e){var t,s;switch(this.log("AMM: handleUpdate:",e._),e._){case"updateMessageID":var i=e.random_id,n=this.pendingByRandomID[i];if(n){var d=n[0],c=n[1],u=m.default.isChannel(d)?-d:0,h=o.default.getFullMessageID(e.id,u);if(f=this.messagesStorage[h]){var p=(g=this.historiesStorage[d]).pending.indexOf(c);-1!=p&&g.pending.splice(p,1),delete this.messagesStorage[c],this.finalizePendingMessageCallbacks(c,h)}else this.pendingByMessageID[h]=i}break;case"updateNewMessage":case"updateNewChannelMessage":var f=e.message,g=(d=this.getMessagePeer(f),this.historiesStorage[d]);if(!(P=this.getDialogByPeerID(d)).length){this.newDialogsToHandle[d]={reload:!0},this.scheduleHandleNewDialogs(),void 0===this.newUpdatesAfterReloadToHandle[d]&&(this.newUpdatesAfterReloadToHandle[d]=[]),this.newUpdatesAfterReloadToHandle[d].push(e);break}if("updateNewChannelMessage"==e._){var v=r.default.getChat(-d);if(v.pFlags&&(v.pFlags.left||v.pFlags.kicked))break}if(this.saveMessages([f],{isNew:!0}),void 0===g&&(g=this.historiesStorage[d]={count:null,history:[],pending:[]}),-1!=(F=f.mid>0?g.history:g.pending).indexOf(f.mid))return!1;var b,y=F[0];F.unshift(f.mid),f.mid>0&&f.mid<y&&F.sort((e,t)=>t-e),f.mid>0&&null!==g.count&&g.count++,this.mergeReplyKeyboard(g,f)&&a.$rootScope.$broadcast("history_reply_markup",{peerID:d}),!f.pFlags.out&&f.from_id&&l.default.forceUserOnline(f.from_id),(i=this.pendingByMessageID[f.mid])&&((b=this.finalizePendingMessage(i,f))&&a.$rootScope.$broadcast("history_update",{peerID:d,mid:f.mid}),delete this.pendingByMessageID[f.mid]),b||(void 0===this.newMessagesToHandle[d]&&(this.newMessagesToHandle[d]=[]),this.newMessagesToHandle[d].push(f.mid),this.newMessagesHandlePromise||(this.newMessagesHandlePromise=window.setTimeout(this.handleNewMessages,0)));var S=!f.pFlags.out&&f.pFlags.unread;(L=P[0]).top_message=f.mid,S&&L.unread_count++,L.pFlags.pinned&&L.index||(L.index=this.dialogsStorage.generateDialogIndex(f.date)),this.newDialogsToHandle[d]=L,this.scheduleHandleNewDialogs();break;case"updateDialogUnreadMark":{this.log("updateDialogUnreadMark",e);let t=m.default.getPeerID(e.peer.peer),s=this.getDialogByPeerID(t);if(s.length){let t=s[0];e.pFlags.unread?t.pFlags.unread_mark=!0:delete t.pFlags.unread_mark,a.$rootScope.$broadcast("dialogs_multiupdate",{peerID:t})}else this.newDialogsToHandle[t]={reload:!0},this.scheduleHandleNewDialogs();break}case"updateFolderPeers":{this.log("updateFolderPeers",e);const t=e.folder_peers;this.scheduleHandleNewDialogs(),t.forEach(e=>{var t;const{folder_id:s,peer:i}=e,n=m.default.getPeerID(i),a=this.dialogsStorage.dropDialog(n);if(a.length){const e=a[0];this.newDialogsToHandle[n]=e,(null===(t=e.pFlags)||void 0===t?void 0:t.pinned)&&(delete e.pFlags.pinned,this.dialogsStorage.pinnedOrders[s].findAndSplice(t=>t==e.peerID)),e.folder_id=s,this.dialogsStorage.generateIndexForDialog(e),this.dialogsStorage.pushDialog(e)}else this.newDialogsToHandle[n]={reload:!0}});break}case"updateDialogPinned":{const s=null!==(t=e.folder_id)&&void 0!==t?t:0;this.log("updateDialogPinned",e);const i=m.default.getPeerID(e.peer.peer),n=this.getDialogByPeerID(i);if(this.scheduleHandleNewDialogs(),n.length){const t=n[0];this.newDialogsToHandle[i]=t,e.pFlags.pinned?t.pFlags.pinned=!0:(delete t.pFlags.pinned,this.dialogsStorage.pinnedOrders[s].findAndSplice(e=>e==t.peerID)),this.dialogsStorage.generateIndexForDialog(t)}else this.newDialogsToHandle[i]={reload:!0};break}case"updatePinnedDialogs":{const t=null!==(s=e.folder_id)&&void 0!==s?s:0;this.log("updatePinnedDialogs",e);const i={};if(!e.order){w.default.invokeApi("messages.getPinnedDialogs",{folder_id:t}).then(e=>{e.dialogs.reverse(),this.applyConversations(e),e.dialogs.forEach(e=>{i[e.peerID]=!0}),this.dialogsStorage.getFolder(t).forEach(e=>{const t=e.peerID;e.pFlags.pinned&&!i[t]&&(this.newDialogsToHandle[t]={reload:!0},this.scheduleHandleNewDialogs())})});break}this.dialogsStorage.pinnedOrders[t].length=0;let n=!1;e.order.reverse(),e.order.forEach(e=>{const t=m.default.getPeerID(e.peer);i[t]=!0;const s=this.getDialogByPeerID(t);if(!s.length)return this.newDialogsToHandle[t]={reload:!0},void(n=!0);const a=s[0];a.pFlags.pinned=!0,this.dialogsStorage.generateIndexForDialog(a),this.newDialogsToHandle[t]=a,n=!0}),this.dialogsStorage.getFolder(t).forEach(e=>{const t=e.peerID;e.pFlags.pinned&&!i[t]&&(this.newDialogsToHandle[t]={reload:!0},n=!0)}),n&&this.scheduleHandleNewDialogs();break}case"updateEditMessage":case"updateEditChannelMessage":f=e.message,d=this.getMessagePeer(f),u="peerChannel"==f.to_id._?-d:0,h=o.default.getFullMessageID(f.id,u);if(void 0===this.messagesStorage[h])break;this.saveMessages([f],{isEdited:!0}),a.safeReplaceObject(this.messagesStorage[h],f);var L,M=(L=this.getDialogByPeerID(d)[0])&&L.top_message==h;if(f.clear_history)M&&a.$rootScope.$broadcast("dialog_flush",{peerID:d});else if(a.$rootScope.$broadcast("message_edit",{peerID:d,id:f.id,mid:h,justMedia:!1}),M){var D={};D[d]=L,a.$rootScope.$broadcast("dialogs_multiupdate",D)}break;case"updateReadHistoryInbox":case"updateReadHistoryOutbox":case"updateReadChannelInbox":case"updateReadChannelOutbox":var E="updateReadHistoryOutbox"==e._||"updateReadChannelOutbox"==e._,I=(u=e.channel_id,o.default.getFullMessageID(e.max_id,u)),P=(d=u?-u:m.default.getPeerID(e.peer),this.getDialogByPeerID(d)),C=0,T=(F=(this.historiesStorage[d]||{}).history||[]).length,k=!1;for(d>0&&E&&l.default.forceUserOnline(d),A=0;A<T;A++)if(!((R=F[A])>I)&&(f=this.messagesStorage[R])&&f.pFlags.out==E){if(!f.pFlags.unread)break;f&&f.pFlags.unread&&(f.pFlags.unread=!1,k||(k=!0),f.pFlags.out||P[0]&&(C=--P[0].unread_count))}P[0]&&(!E&&C&&P[0].top_message<=I&&(C=P[0].unread_count=0),P[0][E?"read_outbox_max_id":"read_inbox_max_id"]=I),a.$rootScope.$broadcast("dialog_unread",{peerID:d,count:C}),k&&a.$rootScope.$broadcast("messages_read");break;case"updateChannelReadMessagesContents":u=e.channel_id;var X=[];e.messages.forEach(e=>{X.push(o.default.getFullMessageID(e,u))}),e.messages=X;case"updateReadMessagesContents":var A,x=(B=e.messages).length;for(A=0;A<x;A++)R=B[A],(f=this.messagesStorage[R])&&delete f.pFlags.media_unread;break;case"updateChannelAvailableMessages":u=e.channel_id;var F,B=[];d=-u;(F=(this.historiesStorage[d]||{}).history||[]).length&&F.forEach(t=>{(!e.available_min_id||o.default.getMessageLocalID(t)<=e.available_min_id)&&B.push(t)}),e.messages=B;case"updateDeleteMessages":case"updateDeleteChannelMessages":{let t={},s=e.channel_id;for(let i=0;i<e.messages.length;i++){let n=o.default.getFullMessageID(e.messages[i],s),a=this.messagesStorage[n];if(a){let e=this.getMessagePeer(a),s=t[e]||(t[e]={count:0,unread:0,msgs:{}});!a.pFlags.out&&a.pFlags.unread&&s.unread++,s.count++,s.msgs[n]=!0,a.deleted=!0,this.messagesStorage[n]={deleted:!0,id:n,from_id:a.from_id,to_id:a.to_id,flags:a.flags,pFlags:a.pFlags,date:a.date};let i=this.newMessagesToHandle[e];if(i&&i.length){let e=i.indexOf(n);-1!=e&&i.splice(e)}}}Object.keys(t).forEach(e=>{let s=t[+e],i=this.historiesStorage[e];if(void 0!==i){let t=[],n=[];for(let e=0;e<i.history.length;e++)s.msgs[i.history[e]]||t.push(i.history[e]);i.history=t,s.count&&null!==i.count&&i.count>0&&(i.count-=s.count,i.count<0&&(i.count=0));for(let e=0;e<i.pending.length;e++)s.msgs[i.pending[e]]||n.push(i.pending[e]);i.pending=n,a.$rootScope.$broadcast("history_delete",{peerID:e,msgs:s.msgs})}let n=this.getDialogByPeerID(+e)[0];n&&(s.unread&&(n.unread_count-=s.unread,a.$rootScope.$broadcast("dialog_unread",{peerID:e,count:n.unread_count})),s.msgs[n.top_message]&&this.reloadConversation(+e))});break}case"updateChannel":{const t=e.channel_id,s=-t,i=r.default.getChat(t),n="channel"==i._&&!i.pFlags.left&&!i.pFlags.kicked,o=this.getDialogByPeerID(s),l=o.length>0;!("channel"!=i._||!i.username&&(i.pFlags.left||i.pFlags.kicked))!=(void 0!==this.historiesStorage[s])&&(delete this.historiesStorage[s],a.$rootScope.$broadcast("history_forbidden",s)),l!=n&&(n?this.reloadConversation(-t):o[0]&&(this.dialogsStorage.dropDialog(s),a.$rootScope.$broadcast("dialog_drop",{peerID:s,dialog:o[0]})));break}case"updateChannelReload":{const t=e.channel_id,s=-t;this.dialogsStorage.dropDialog(s),delete this.historiesStorage[s],this.reloadConversation(-t).then(()=>{a.$rootScope.$broadcast("history_reload",s)});break}case"updateChannelMessageViews":{let t=e.views,s=o.default.getFullMessageID(e.id,e.channel_id),i=this.getMessage(s);i&&i.views&&i.views<t&&(i.views=t,a.$rootScope.$broadcast("message_views",{mid:s,views:t}));break}case"updateServiceNotification":this.log("updateServiceNotification",e);var R;d=777e3,f={_:"message",id:R=this.tempID--,from_id:777e3,to_id:m.default.getOutputPeer(d),flags:0,pFlags:{unread:!0},date:(e.inbox_date||a.tsNow(!0))+_.default.serverTimeOffset,message:e.message,media:e.media,entities:e.entities};l.default.hasUser(777e3)||l.default.saveApiUsers([{_:"user",id:777e3,pFlags:{verified:!0},access_hash:0,first_name:"Telegram",phone:"42777"}]),this.saveMessages([f]),e.inbox_date&&(this.pendingTopMsgs[d]=R,this.handleUpdate({_:"updateNewMessage",message:f}));break;case"updateChatPinnedMessage":case"updateUserPinnedMessage":{let{id:t}=e,s=e.user_id||-e.chat_id||-e.channel_id;this.savePinnedMessage(s,t);break}}}finalizePendingMessage(e,t){var s=this.pendingByRandomID[e];if(s){var i,n=s[0],o=s[1],r=this.historiesStorage[n],l=r.pending.indexOf(o);return-1!=l&&r.pending.splice(l,1),(i=this.messagesStorage[o])&&(delete i.pending,delete i.error,delete i.random_id,delete i.send,a.$rootScope.$broadcast("messages_pending")),delete this.messagesStorage[o],this.finalizePendingMessageCallbacks(o,t.mid),i}return!1}finalizePendingMessageCallbacks(e,t){var s=this.tempFinalizeCallbacks[e];this.log.warn(a.dT(),s,e),void 0!==s&&(s.forEach(e=>{e(t)}),delete this.tempFinalizeCallbacks[e]),a.$rootScope.$broadcast("message_sent",{tempID:e,mid:t})}incrementMaxSeenID(e){if(!e||this.maxSeenID&&!(e>this.maxSeenID))return!1;f.default.set({max_seen_msg:e}),w.default.invokeApi("messages.receivedMessages",{max_id:e})}getHistory(e,t=0,s,i){var n;this.migratedFromTo[e]&&(e=this.migratedFromTo[e]);const a=null!==(n=this.historiesStorage[e])&&void 0!==n?n:this.historiesStorage[e]={count:null,history:[],pending:[]};let r=0,l=!1,d=!1,c=e;if(this.migratedToFrom[e]&&(d=!0,t&&t<o.default.fullMsgIDModulus&&(c=this.migratedToFrom[e])),t>0)for(l=!0;r<a.history.length;r++)if(t>a.history[r]){l=!1;break}if(!l&&(null!==a.count&&a.history.length==a.count||a.history.length>=r+s)){i?(i=Math.min(r,i),r=Math.max(0,r-i),s+=i):s=s;let e=a.history.slice(r,r+s);return!t&&a.pending.length&&(e=a.pending.slice().concat(e)),this.wrapHistoryResult({count:a.count,history:e,unreadOffset:0,unreadSkip:!1})}return l&&(r=0),(i||t)&&-1==a.history.indexOf(t)?(i&&(r=-i,s+=i),this.requestHistory(c,t,s,r).then(e=>{a.count=e.count||e.messages.length,d&&a.count++;let s=[];return e.messages.forEach(e=>{s.push(e.mid)}),!t&&a.pending.length&&(s=a.pending.slice().concat(s)),this.wrapHistoryResult({count:a.count,history:s,unreadOffset:0,unreadSkip:!1})})):this.fillHistoryStorage(e,t,s,a).then(()=>{if(r=0,t>0)for(r=0;r<a.history.length&&!(t>a.history[r]);r++);var e=a.history.slice(r,r+s);return!t&&a.pending.length&&(e=a.pending.slice().concat(e)),this.wrapHistoryResult({count:a.count,history:e,unreadOffset:0,unreadSkip:!1})})}fillHistoryStorage(e,t,s,i){const n=this.migratedFromTo[e]&&!t?1:0;return this.requestHistory(e,t,s,n).then(n=>{i.count=n.count||n.messages.length,!t&&n.messages.length&&(t=n.messages[0].mid+1);let o=0;if(t>0)for(;o<i.history.length&&!(t>i.history[o]);o++);const r=i.history.length;i.history.splice(o,i.history.length-o),n.messages.forEach(t=>{this.mergeReplyKeyboard(i,t)&&a.$rootScope.$broadcast("history_reply_markup",{peerID:e}),i.history.push(t.mid)});const l=i.history.length;s-=l-r;const d=this.migratedFromTo[e],c=this.migratedToFrom[e],u=void 0!==d||void 0!==c;if(u&&(i.count=Math.max(i.count,l)+1),s>0){if(t=i.history[l-1],u){if(!n.messages.length){if(!c)return i.count=l,!0;t=0,e=c}return this.fillHistoryStorage(e,t,s,i)}if(l<i.count)return this.fillHistoryStorage(e,t,s,i)}return!0})}wrapHistoryResult(e){if(e.unreadOffset)for(let t=e.history.length-1;t>=0;t--){const s=this.messagesStorage[e.history[t]];if(s&&!s.pFlags.out&&s.pFlags.unread){e.unreadOffset=t+1;break}}return e}requestHistory(e,t,s=0,i=0,n=0){const d=m.default.isChannel(e);return a.$rootScope.$broadcast("history_request"),w.default.invokeApi("messages.getHistory",{peer:m.default.getInputPeerByID(e),offset_id:t?o.default.getMessageLocalID(t):0,offset_date:n,add_offset:i,limit:s,max_id:0,min_id:0,hash:0},{timeout:0,noErrorBox:!0}).then(n=>{this.log("requestHistory result:",n,t,s,i),l.default.saveApiUsers(n.users),r.default.saveApiChats(n.chats),this.saveMessages(n.messages),d&&h.default.addChannelState(-e,n.pts);let a=n.messages.length;a&&n.messages[a-1].deleted&&(n.messages.splice(a-1,1),a--,n.count--);const o=this.historiesStorage[e];return a&&n.messages[a-1].grouped_id&&o.history.length+n.messages.length<n.count?this.requestHistory(e,n.messages[a-1].mid,10,0).then(e=>n):n},t=>{switch(t.type){case"CHANNEL_PRIVATE":let t=r.default.getChat(-e);t={_:"channelForbidden",access_hash:t.access_hash,title:t.title},h.default.processUpdateMessage({_:"updates",updates:[{_:"updateChannel",channel_id:-e}],chats:[t],users:[]})}throw t})}fetchSingleMessages(){if(this.fetchSingleMessagesPromise)return this.fetchSingleMessagesPromise;const e=this.needSingleMessages.slice();this.needSingleMessages.length=0;const t=o.default.splitMessageIDsByChannels(e);let s=[];Object.keys(t.msgIDs).forEach(e=>{e=+e;let i=t.msgIDs[e].map(e=>({_:"inputMessageID",id:e}));var n;n=e>0?w.default.invokeApi("channels.getMessages",{channel:r.default.getChannelInput(e),id:i}):w.default.invokeApi("messages.getMessages",{id:i}),s.push(n.then(s=>{l.default.saveApiUsers(s.users),r.default.saveApiChats(s.chats),this.saveMessages(s.messages),a.$rootScope.$broadcast("messages_downloaded",t.mids[+e])}))}),this.fetchSingleMessagesPromise=Promise.all(s).finally(()=>{this.fetchSingleMessagesTimeout=0,this.fetchSingleMessagesPromise=null,this.needSingleMessages.length&&this.fetchSingleMessages()})}wrapSingleMessage(e,t=!1){this.messagesStorage[e]&&!t?a.$rootScope.$broadcast("messages_downloaded",[e]):-1==this.needSingleMessages.indexOf(e)&&(this.needSingleMessages.push(e),0==this.fetchSingleMessagesTimeout&&(this.fetchSingleMessagesTimeout=window.setTimeout(this.fetchSingleMessages.bind(this),10)))}setTyping(e){if(!a.$rootScope.myID)return Promise.resolve(!1);"string"==typeof e&&(e={_:e});let t=m.default.getInputPeerByID(a.$rootScope.myID);return w.default.invokeApi("messages.setTyping",{peer:t,action:e})}}t.AppMessagesManager=C;const T=new C;t.default=T},function(e,t,s){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.logger=t.LogLevels=void 0,function(e){e[e.log=1]="log",e[e.warn=2]="warn",e[e.error=4]="error",e[e.debug=8]="debug"}(i=t.LogLevels||(t.LogLevels={}));var n=Date.now();function a(){return"["+((Date.now()-n)/1e3).toFixed(3)+"]"}t.logger=function(e,t=i.log|i.warn|i.error){function s(...s){return t&i.log&&console.log(a(),"["+e+"]:",...s)}return t=i.error,s.warn=function(...s){return t&i.warn&&console.warn(a(),"["+e+"]:",...s)},s.info=function(...s){return t&i.log&&console.info(a(),"["+e+"]:",...s)},s.error=function(...s){return t&i.error&&console.error(a(),"["+e+"]:",...s)},s.trace=function(...s){return t&i.log&&console.trace(a(),"["+e+"]:",...s)},s.debug=function(...s){return t&i.debug&&console.debug(a(),"["+e+"]:",...s)},s}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(5)),a=i(s(10)),o=s(0),r=s(3),l=["#c03d33","#4fad2d","#d09306","#168acd","#8544d6","#cd4073","#2996ad","#ce671b"],d=["#e17076","#7bc862","#e5ca77","#65AADD","#a695e7","#ee7aae","#6ec9cb","#faa774"],c=[0,7,4,1,6,3,5],u={getPeerPhoto:e=>e>0?n.default.getUserPhoto(e):a.default.getChatPhoto(-e),getPeerMigratedTo:e=>{if(e>=0)return!1;let t=a.default.getChat(-e);return!!(t&&t.migrated_to&&t.pFlags.deactivated)&&u.getPeerID(t.migrated_to)},getPeerTitle:(e,t=!1,s=!1)=>{let i={};i=o.isObject(e)?e:u.getPeer(e);let n="";return e>0?(i.first_name&&(n+=i.first_name),i.last_name&&(n+=" "+i.last_name),n=n?n.trim():i.pFlags.deleted?"Deleted account":i.username):n=i.title,s&&(n=n.split(" ")[0]),t?n:r.RichTextProcessor.wrapEmojiText(n)},getOutputPeer:e=>{if(e>0)return{_:"peerUser",user_id:e};let t=-e;return a.default.isChannel(t)?{_:"peerChannel",channel_id:t}:{_:"peerChat",chat_id:t}},getPeerString:e=>e>0?n.default.getUserString(e):a.default.getChatString(-e),getPeerUsername:e=>e>0?n.default.getUser(e).username||"":a.default.getChat(-e).username||"",getPeer:e=>e>0?n.default.getUser(e):a.default.getChat(-e),getPeerID:e=>{if("number"==typeof e)return e;if(o.isObject(e))return e.user_id?e.user_id:-(e.channel_id||e.chat_id);if(!e)return 0;const t="u"==e.charAt(0),s=e.substr(1).split("_");return t?s[0]:-s[0]||0},isChannel:e=>e<0&&a.default.isChannel(-e),isMegagroup:e=>e<0&&a.default.isMegagroup(-e),isAnyGroup:e=>e<0&&!a.default.isBroadcast(-e),isBroadcast:e=>u.isChannel(e)&&!u.isMegagroup(e),isBot:e=>e>0&&n.default.isBot(e),getInputPeer:e=>{var t=e.charAt(0),s=e.substr(1).split("_");let i=+s[0];return"u"==t?(n.default.saveUserAccess(i,s[1]),{_:"inputPeerUser",user_id:i,access_hash:s[1]}):"c"==t||"s"==t?(a.default.saveChannelAccess(i,s[1]),"s"==t&&a.default.saveIsMegagroup(i),{_:"inputPeerChannel",channel_id:i,access_hash:s[1]||0}):{_:"inputPeerChat",chat_id:i}},getInputPeerByID:e=>{if(!e)return{_:"inputPeerEmpty"};if(e<0){let t=-e;return a.default.isChannel(t)?a.default.getChannelInputPeer(t):a.default.getChatInputPeer(t)}return{_:"inputPeerUser",user_id:e,access_hash:n.default.getUser(e).access_hash||0}},getPeerColorByID:(e,t=!0)=>(t?d:l)[c[(e<0?-e:e)%7]],getPeerSearchText:e=>{let t;if(e>0)t="%pu "+n.default.getUserSearchText(e);else if(e<0){t="%pg "+(a.default.getChat(-e).title||"")}return t}};t.default=u},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(7),a=i(s(74)),o=s(4);window.__forceSmoothScrollPolyfill__=!0,a.default.polyfill();t.default=class{constructor(e,t="y",s="",i=e,a=300,r=15,l=document.createElement("div")){if(this.el=e,this.appendTo=i,this.onScrollOffset=a,this.splitCount=r,this.container=l,this.onScrolledTop=null,this.onScrolledBottom=null,this.onScrollMeasure=null,this.lastScrollTop=0,this.disableHoverTimeout=0,this.virtualTempIDTop=0,this.virtualTempIDBottom=0,this.lastTopID=0,this.lastBottomID=0,this.lastScrollDirection=0,this.scrollLocked=0,this.isVisible=!1,this.container.classList.add("scrollable"),this.visible=new Set,this.observer=new IntersectionObserver(e=>{const t=e.filter(e=>e.isIntersecting);if(e.forEach(e=>{const t=e.target;if(e.isIntersecting)this.setVisible(t),this.log.debug("intersection entry:",e,this.lastTopID,this.lastBottomID);else{const s=+t.dataset.virtual;e.boundingClientRect.top<0?this.lastTopID=s+1:this.lastBottomID=s-1}}),!t.length||0===this.lastScrollDirection)return;if(1===this.lastScrollDirection){let e=t[t.length-1].target;this.lastBottomID=+e.dataset.virtual;for(let t=0;t<this.splitCount&&(e=e.nextElementSibling,e);++t)this.setVisible(e)}else{let e=t[0].target;this.lastTopID=+e.dataset.virtual;for(let t=0;t<this.splitCount&&(e=e.previousElementSibling,e);++t)this.setVisible(e)}this.log.debug("entries:",e,t,this.lastScrollDirection,this.lastTopID,this.lastBottomID);const s=this.lastTopID-this.splitCount,i=this.lastBottomID+this.splitCount;for(const e of this.visible){const t=+e.dataset.virtual;(t<s||t>i)&&this.setHidden(e)}}),i||(this.appendTo=this.container),this.log=n.logger("SCROLL"+(s?"-"+s:""),n.LogLevels.error),"x"==t){if(this.container.classList.add("scrollable-x"),!o.touchSupport){const e=e=>{e=window.event||e;const t=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));this.container.scrollLeft-=20*t,e.preventDefault()};this.container.addEventListener?(this.container.addEventListener("mousewheel",e,!1),this.container.addEventListener("DOMMouseScroll",e,!1)):this.container.attachEvent("onmousewheel",e)}}else{if("y"!=t)throw new Error("no side for scroll");this.container.classList.add("scrollable-y")}const d=this.onScroll.bind(this);window.addEventListener("resize",()=>{this.overflowContainer=(window.innerWidth,this.container),this.onScroll()}),this.container.addEventListener("scroll",d,{passive:!0,capture:!0}),e&&(Array.from(e.children).forEach(e=>this.container.append(e)),e.append(this.container)),this.overflowContainer=(window.innerWidth,this.container)}setVisible(e){this.visible.has(e)||(this.log.debug("setVisible id:",e.dataset.virtual),e.firstElementChild.style.display="",this.visible.add(e))}setHidden(e){this.visible.has(e)&&(this.log.debug("setHidden id:",e.dataset.virtual),e.firstElementChild.style.display="none",this.visible.delete(e))}setVirtualContainer(e){this.splitUp=e,this.lastScrollTop=0,this.log("setVirtualContainer:",e,this)}onScroll(){this.splitUp&&(clearTimeout(this.disableHoverTimeout),this.disableHoverTimeout=setTimeout(()=>{this.lastScrollDirection=0},100)),this.onScrollMeasure||(this.scrollLocked||!this.onScrolledTop&&!this.onScrolledBottom)&&!this.splitUp||(this.onScrollMeasure=window.requestAnimationFrame(()=>{if(this.checkForTriggers(this.overflowContainer),this.onScrollMeasure=0,!this.splitUp)return;const e=this.overflowContainer.scrollTop;this.lastScrollTop!=e?(this.lastScrollDirection=this.lastScrollTop<e?1:-1,this.lastScrollTop=e):this.lastScrollDirection=0}))}checkForTriggers(e){if(this.scrollLocked||!this.onScrolledTop&&!this.onScrolledBottom)return;const t=e.scrollTop,s=e.scrollHeight-e.clientHeight;this.onScrolledTop&&t<=this.onScrollOffset&&this.onScrolledTop(),this.onScrolledBottom&&s-t<=this.onScrollOffset&&this.onScrolledBottom()}reorder(){this.splitUp&&!this.reorderTimeout&&(this.reorderTimeout=setTimeout(()=>{this.reorderTimeout=0,Array.from(this.splitUp.children).forEach((e,t)=>{e.dataset.virtual=""+t})},0))}updateElement(e){e.style.minHeight="",window.requestAnimationFrame(()=>{const t=e.scrollHeight;window.requestAnimationFrame(()=>{e.style.minHeight=t+"px"})})}prepareElement(e,t=!0){this.splitUp&&(e.dataset.virtual=""+(t?this.virtualTempIDBottom++:this.virtualTempIDTop--),this.log.debug("prepareElement: prepared"),window.requestAnimationFrame(()=>{const{scrollHeight:t}=e;this.log.debug("prepareElement: first rAF"),window.requestAnimationFrame(()=>{e.style.minHeight=t+"px"}),this.visible.add(e),this.observer.observe(e)}))}prepend(e,t=!0){t&&this.prepareElement(e,!1),this.splitUp?this.splitUp.prepend(e):this.appendTo.prepend(e)}append(e,t=!0){t&&this.prepareElement(e),this.splitUp?this.splitUp.append(e):this.appendTo.append(e)}contains(e){return this.splitUp?!!e.parentElement:this.appendTo.contains(e)}scrollIntoView(e,t=!0){if(e.parentElement&&!this.scrollLocked){const s=e.classList.contains("is-first-unread");let i=e.getBoundingClientRect().top-this.container.getBoundingClientRect().top;if(i=this.container.scrollTop+i,!t&&s)return void this.scrollTo(i,!1);i-=(this.container.clientHeight-e.scrollHeight)/2,this.scrollTo(i,t)}}scrollTo(e,t=!0,s=!1){if(this.scrollLocked&&!s)return;this.scrollTop!=Math.floor(e)&&(this.scrollLocked&&clearTimeout(this.scrollLocked),this.scrollLocked=setTimeout(()=>{this.scrollLocked=0,this.onScroll()},468),this.container.scrollTo({behavior:t?"smooth":"auto",top:e}))}removeElement(e){e.remove()}set scrollTop(e){this.container.scrollTop=e}get scrollTop(){return this.container.scrollTop}get scrollHeight(){return this.container.scrollHeight}get length(){return this.appendTo.childElementCount}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppChatsManager=void 0;const a=s(0),o=s(3),r=n(s(5)),l=n(s(2)),d=n(s(27)),c=n(s(21)),u=n(s(34));class h{constructor(){this.chats={},this.usernames={},this.channelAccess={},this.megagroups={},this.cachedPhotoLocations={},this.megagroupOnlines={},a.$rootScope.$on("apiUpdate",e=>{let t=e.detail;switch(t._){case"updateChannel":var s=t.channel_id;a.$rootScope.$broadcast("channel_settings",{channelID:s})}})}saveApiChats(e){e.forEach(e=>this.saveApiChat(e))}saveApiChat(e){if(!a.isObject(e))return;e.rTitle=e.title||"chat_title_deleted",e.rTitle=o.RichTextProcessor.wrapRichText(e.title,{noLinks:!0,noLinebreaks:!0})||"chat_title_deleted";let t=this.chats[e.id],s=u.default.cleanSearchText(e.title||"",!1).split(" "),i=s.shift(),n=s.pop();if(e.initials=i.charAt(0)+(n?n.charAt(0):""),void 0===e.pFlags&&(e.pFlags={}),e.pFlags.min&&void 0!==t)return;if("channel"==e._&&void 0===e.participants_count&&void 0!==t&&t.participants_count&&(e.participants_count=t.participants_count),e.username){let t=u.default.cleanUsername(e.username);this.usernames[t]=e.id}let r=!1;if(void 0===t)t=this.chats[e.id]=e;else{let s=t.photo&&t.photo.photo_small,i=e.photo&&e.photo.photo_small;JSON.stringify(s)!==JSON.stringify(i)&&(r=!0),a.safeReplaceObject(t,e),a.$rootScope.$broadcast("chat_update",e.id)}void 0!==this.cachedPhotoLocations[e.id]&&a.safeReplaceObject(this.cachedPhotoLocations[e.id],e&&e.photo?e.photo:{empty:!0}),r&&a.$rootScope.$broadcast("avatar_update",-e.id)}getChat(e){return e<0&&(e=-e),this.chats[e]||{id:e,deleted:!0,access_hash:this.channelAccess[e]}}hasRights(e,t){var s,i;const n=this.getChat(e);if(!n)return!1;if("chatForbidden"==n._||"channelForbidden"==n._||n.pFlags.kicked||n.pFlags.left)return!1;if(n.pFlags.creator)return!0;let a=null!==(i=null===(s=n.admin_rights||n.banned_rights||n.default_banned_rights)||void 0===s?void 0:s.pFlags)&&void 0!==i?i:{};switch(t){case"send":if("channel"==n._&&!n.pFlags.megagroup&&!a.post_messages)return!1;break;case"deleteRevoke":if("channel"==n._)return!!a.delete_messages;if(!n.pFlags.admin)return!1;break;case"pin":if("channel"==n._)return n.admin_rights?!!a.pin_messages||!!a.post_messages:!a.pin_messages;if(a.pin_messages&&!n.pFlags.admin)return!1;break;case"edit_title":case"edit_photo":case"invite":if("channel"==n._){if(!n.pFlags.megagroup)return!1;if("invite"!=t||!n.pFlags.democracy)return!1}else if(n.pFlags.admins_enabled&&!n.pFlags.admin)return!1}return!0}resolveUsername(e){return this.usernames[e]||0}saveChannelAccess(e,t){this.channelAccess[e]=t}saveIsMegagroup(e){this.megagroups[e]=!0}isChannel(e){let t=this.chats[e];return!((!t||"channel"!=t._&&"channelForbidden"!=t._)&&!this.channelAccess[e])}isMegagroup(e){if(this.megagroups[e])return!0;let t=this.chats[e];return!(!t||"channel"!=t._||!t.pFlags.megagroup)}isBroadcast(e){return this.isChannel(e)&&!this.isMegagroup(e)}getChannelInput(e){return e?{_:"inputChannel",channel_id:e,access_hash:this.getChat(e).access_hash||this.channelAccess[e]||0}:{_:"inputChannelEmpty"}}getChatInputPeer(e){return{_:"inputPeerChat",chat_id:e}}getChannelInputPeer(e){return e?{_:"inputPeerChannel",channel_id:e,access_hash:this.getChat(e).access_hash||this.channelAccess[e]||0}:{_:"inputPeerEmpty"}}hasChat(e,t){let s=this.chats[e];return a.isObject(s)&&(t||!s.pFlags.min)}getChatPhoto(e){let t=this.getChat(e);return void 0===this.cachedPhotoLocations[e]&&(this.cachedPhotoLocations[e]=t&&t.photo?t.photo:{empty:!0}),this.cachedPhotoLocations[e]}getChatString(e){let t=this.getChat(e);return this.isChannel(e)?(this.isMegagroup(e)?"s":"c")+e+"_"+t.access_hash:"g"+e}getChatMembersString(e){var t;const s=this.getChat(e),i=this.isBroadcast(e),n=s.participants_count||(null===(t=s.participants)||void 0===t?void 0:t.participants.length)||0;return a.numberWithCommas(n)+" "+(i?"followers":"members")}wrapForFull(e,t){let s=a.copy(t),i=this.getChat(e);return s.participants_count||(s.participants_count=i.participants_count),s.participants&&"chatParticipants"==s.participants._&&(s.participants.participants=this.wrapParticipants(e,s.participants.participants)),s.about&&(s.rAbout=o.RichTextProcessor.wrapRichText(s.about,{noLinebreaks:!0})),s.peerString=this.getChatString(e),s.chat=i,s}wrapParticipants(e,t){let s=this.getChat(e),i=r.default.getSelf().id;if(this.isChannel(e)){let e=s.pFlags.creator;t.forEach(t=>{t.canLeave=i==t.user_id,t.canKick=e&&"channelParticipant"==t._,t.user=r.default.getUser(t.user_id)})}else{let e=s.pFlags.creator||s.pFlags.admins_enabled&&s.pFlags.admin;t.forEach(t=>{t.canLeave=i==t.user_id,t.canKick=!t.canLeave&&(s.pFlags.creator||"chatParticipant"==t._&&(e||i==t.inviter_id)),t.user=r.default.getUser(t.user_id)})}return t}createChannel(e,t){return l.default.invokeApi("channels.createChannel",{flags:1,broadcast:!0,title:e,about:t}).then(e=>(d.default.processUpdateMessage(e),e.chats[0].id))}inviteToChannel(e,t){let s=this.getChannelInput(e),i=t.map(e=>r.default.getUserInput(e));return l.default.invokeApi("channels.inviteToChannel",{channel:s,users:i}).then(e=>{d.default.processUpdateMessage(e)})}createChat(e,t){return l.default.invokeApi("messages.createChat",{users:t.map(e=>r.default.getUserInput(e)),title:e}).then(e=>(d.default.processUpdateMessage(e),e.chats[0].id))}editPhoto(e,t){let s={_:"inputChatUploadedPhoto",file:t};return this.isChannel(e)?l.default.invokeApi("channels.editPhoto",{channel:this.getChannelInputPeer(e),photo:s}).then(e=>{d.default.processUpdateMessage(e)}):l.default.invokeApi("messages.editChatPhoto",{chat_id:e,photo:s}).then(e=>{d.default.processUpdateMessage(e)})}getOnlines(e){var t,s;return i(this,void 0,void 0,(function*(){if(this.isMegagroup(e)){let i=Date.now()/1e3|0,n=null!==(t=this.megagroupOnlines[e])&&void 0!==t?t:this.megagroupOnlines[e]={timestamp:0,onlines:1};if(i-n.timestamp<60)return n.onlines;let a=yield l.default.invokeApi("messages.getOnlines",{peer:this.getChannelInputPeer(e)}),o=null!==(s=a.onlines)&&void 0!==s?s:1;return n.timestamp=i,n.onlines=o,o}if(this.isBroadcast(e))return 1;let i=c.default.getChatFull(e);if("chatFull"==i._&&i.participants&&i.participants.participants){return i.participants.participants.reduce((e,t)=>{let s=r.default.getUser(t.user_id);return s&&s.status&&"userStatusOnline"==s.status._?e+1:e},0)}return 1}))}}t.AppChatsManager=h,t.default=new h},function(e,t,s){"use strict";
/*!
* Webogram v0.7.0 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/Object.defineProperty(t,"__esModule",{value:!0}),t.nextRandomInt=t.addPadding=t.longFromInts=t.longToBytes=t.bytesToWordss=t.bytesFromWordss=t.bytesFromWords=t.longToInts=t.bufferConcats=t.bufferConcat=t.bytesFromArrayBuffer=t.convertToByteArray=t.convertToUint8Array=t.convertToArrayBuffer=t.bytesToArrayBuffer=t.bytesFromBigInt=t.bytesXor=t.bytesCmp=t.blobSafeMimeType=t.blobConstruct=t.dataUrlToBlob=t.base64ToBlob=t.uint6ToBase64=t.bytesToBase64=t.bytesFromHex=t.bytesToHex=t.bigStringInt=t.bigint=t.isObject=t.dT=void 0;const i=s(43);var n=Date.now();function a(e){return new i.BigInteger(e.toString(16),16)}function o(e){return new i.BigInteger(e,10)}function r(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}function l(e,t){for(var s=atob(e),i=s.length,n=Math.ceil(i/1024),a=new Array(n),o=0;o<n;++o){for(var r=1024*o,l=Math.min(r+1024,i),c=new Array(l-r),u=r,h=0;u<l;++h,++u)c[h]=s[u].charCodeAt(0);a[o]=new Uint8Array(c)}return d(a,t)}function d(e,t=""){var s,i=c(t);try{s=new Blob(e,{type:i})}catch(t){var n=new BlobBuilder;e.forEach((function(e){n.append(e)})),s=n.getBlob(i)}return s}function c(e){return-1===["image/jpeg","image/png","image/gif","image/webp","image/bmp","video/mp4","video/webm","video/quicktime","audio/ogg","audio/mpeg","audio/mp4"].indexOf(e)?"application/octet-stream":e}function u(e){return new Uint8Array(e).buffer}function h(e){return void 0!==e.buffer?e:new Uint8Array(e)}function p(e,t){var s=e.byteLength||e.length,i=t.byteLength||t.length,n=new Uint8Array(s+i);return n.set(e instanceof ArrayBuffer?new Uint8Array(e):e,0),n.set(t instanceof ArrayBuffer?new Uint8Array(t):t,s),n.buffer}function f(e){var t=o(e).divideAndRemainder(a(4294967296));return[t[0].intValue(),t[1].intValue()]}function m(e){for(var t=e.words,s=e.sigBytes,i=[],n=0;n<s;n++)i.push(t[n>>>2]>>>24-n%4*8&255);return i}t.dT=function(){return"["+((Date.now()-n)/1e3).toFixed(3)+"]"},t.isObject=function(e){return"object"==typeof e&&null!==e},t.bigint=a,t.bigStringInt=o,t.bytesToHex=function(e){e=e||[];for(var t=[],s=0;s<e.length;s++)t.push((e[s]<16?"0":"")+(e[s]||0).toString(16));return t.join("")},t.bytesFromHex=function(e){var t,s=e.length,i=0,n=[];for(e.length%2&&(n.push(parseInt(e.charAt(0),16)),i++),t=i;t<s;t+=2)n.push(parseInt(e.substr(t,2),16));return n},t.bytesToBase64=function(e){for(var t,s="",i=e.length,n=0,a=0;a<i;a++)t=a%3,n|=e[a]<<(16>>>t&24),2!==t&&i-a!=1||(s+=String.fromCharCode(r(n>>>18&63),r(n>>>12&63),r(n>>>6&63),r(63&n)),n=0);return s.replace(/A(?=A$|$)/g,"=")},t.uint6ToBase64=r,t.base64ToBlob=l,t.dataUrlToBlob=function(e){var t=e.split(",");return l(t[1],t[0].split(":")[1].split(";")[0])},t.blobConstruct=d,t.blobSafeMimeType=c,t.bytesCmp=function(e,t){var s=e.length;if(s!=t.length)return!1;for(var i=0;i<s;i++)if(e[i]!=t[i])return!1;return!0},t.bytesXor=function(e,t){for(var s=e.length,i=[],n=0;n<s;++n)i[n]=e[n]^t[n];return i},t.bytesFromBigInt=function(e,t){var s=e.toByteArray();if(t&&s.length<t){for(var i=[],n=0,a=t-s.length;n<a;n++)i[n]=0;s=s instanceof ArrayBuffer?p(i,s):i.concat(s)}else for(;!s[0]&&(!t||s.length>t);)s=s.slice(1);return s},t.bytesToArrayBuffer=u,t.convertToArrayBuffer=function(e){return e instanceof ArrayBuffer?e:void 0!==e.buffer&&e.buffer.byteLength==e.length*e.BYTES_PER_ELEMENT?e.buffer:u(e)},t.convertToUint8Array=h,t.convertToByteArray=function(e){if(Array.isArray(e))return e;for(var t=[],s=0,i=(e=h(e)).length;s<i;s++)t.push(e[s]);return t},t.bytesFromArrayBuffer=function(e){for(var t=e.byteLength,s=new Uint8Array(e),i=[],n=0;n<t;++n)i[n]=s[n];return i},t.bufferConcat=p,t.bufferConcats=function(...e){let t=0;e.forEach(e=>t+=e.byteLength||e.length);var s=new Uint8Array(t);let i=0;return e.forEach(e=>{s.set(e instanceof ArrayBuffer?new Uint8Array(e):e,i),i+=e.byteLength||e.length}),s},t.longToInts=f,t.bytesFromWords=m,t.bytesFromWordss=function(e){for(var t=[],s=0;s<4*e.length;s++)t.push(e[s>>>2]>>>24-s%4*8&255);return t},t.bytesToWordss=function(e){let t;t=e instanceof ArrayBuffer?new Uint8Array(e):e;var s,i=t.length,n=[];for(s=0;s<i;s++)n[s>>>2]|=t[s]<<24-s%4*8;return new Uint32Array(n)},t.longToBytes=function(e){return m({words:f(e),sigBytes:8}).reverse()},t.longFromInts=function(e,t){return a(e).shiftLeft(32).add(a(t)).toString(10)},t.addPadding=function(e,t=16,s,n=!1,a=!1){let o=t-(e.byteLength||e.length)%t;if(o>0&&(o<t||n)){let t=new Array(o);if(s)for(let e=0;e<o;e++)t[e]=0;else(new i.SecureRandom).nextBytes(t);if(e instanceof ArrayBuffer)e=a?p(t,e):p(e,t);else if(e instanceof Uint8Array){let s=new Uint8Array(e.length+t.length);a?(s.set(t),s.set(e,t.length)):(s.set(e),s.set(t,e.length)),e=s}else e=a?t.concat(e):e.concat(t)}return e},t.nextRandomInt=function(e){return Math.floor(Math.random()*e)}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=n(s(22)),o=n(s(33)),r=s(3),l=s(32),d=s(0),c=n(s(45)),u=s(11);const h=new class{constructor(){this.docs={},this.thumbs={},this.downloadPromises={},this.videoChunks={},this.videoChunksQueue={}}saveDoc(e,t){if(this.docs[e.id]){let s=this.docs[e.id];return e.thumbs&&(s.thumbs?e.thumbs[0].bytes&&!s.thumbs[0].bytes&&s.thumbs.unshift(e.thumbs[0]):s.thumbs=e.thumbs),Object.assign(s,e,t)}if(t&&Object.assign(e,t),this.docs[e.id]=e,e.thumb&&"photoCachedSize"==e.thumb._&&(console.warn("this will happen!!!"),a.default.saveSmallFile(e.thumb.location,e.thumb.bytes),e.thumb.size=e.thumb.bytes.length,delete e.thumb.bytes,e.thumb._="photoSize"),e.thumb&&"photoSizeEmpty"==e.thumb._&&delete e.thumb,e.attributes.forEach(t=>{var s;switch(t._){case"documentAttributeFilename":e.file_name=r.RichTextProcessor.wrapPlainText(t.file_name);break;case"documentAttributeAudio":e.duration=t.duration,e.audioTitle=t.title,e.audioPerformer=t.performer,e.type=t.pFlags.voice&&"audio/ogg"==e.mime_type?"voice":"audio";break;case"documentAttributeVideo":e.duration=t.duration,e.w=t.w,e.h=t.h,e.supportsStreaming=(null===(s=t.pFlags)||void 0===s?void 0:s.supports_streaming)&&e.size>524288&&"undefined"!=typeof MediaSource,e.thumbs&&t.pFlags.round_message?e.type="round":e.type="video";break;case"documentAttributeSticker":void 0!==t.alt&&(e.stickerEmojiRaw=t.alt,e.stickerEmoji=r.RichTextProcessor.wrapRichText(e.stickerEmojiRaw,{noLinks:!0,noLinebreaks:!0})),t.stickerset&&("inputStickerSetEmpty"==t.stickerset._?delete t.stickerset:"inputStickerSetID"==t.stickerset._&&(e.stickerSetInput=t.stickerset)),"image/webp"==e.mime_type&&(e.type="sticker",e.sticker=1);break;case"documentAttributeImageSize":e.w=t.w,e.h=t.h;break;case"documentAttributeAnimated":"image/gif"!=e.mime_type&&"video/mp4"!=e.mime_type||!e.thumbs||(e.type="gif"),e.animated=!0}}),!e.mime_type)switch(e.type){case"gif":e.mime_type="video/mp4";break;case"video":case"round":e.mime_type="video/mp4";break;case"sticker":e.mime_type="image/webp";break;case"audio":e.mime_type="audio/mpeg";break;case"voice":e.mime_type="audio/ogg";break;default:e.mime_type="application/octet-stream"}return e.file_name||(e.file_name=""),"application/x-tgsticker"==e.mime_type&&"AnimatedSticker.tgs"==e.file_name&&(e.type="sticker",e.animated=!0,e.sticker=2),"documentEmpty"==e._&&(e.size=0),e}getDoc(e){return d.isObject(e)?e:this.docs[e]}getMediaInputByID(e){let t=this.getDoc(e);return{_:"inputMediaDocument",flags:0,id:{_:"inputDocument",id:t.id,access_hash:t.access_hash,file_reference:t.file_reference},ttl_seconds:0}}getInputByID(e,t){let s=this.getDoc(e);return{_:"inputDocumentFileLocation",id:s.id,access_hash:s.access_hash,file_reference:s.file_reference,thumb_size:t}}getFileName(e){if(e.file_name)return e.file_name;var t="."+e.mime_type.split("/")[1];return".octet-stream"==t&&(t=""),"t_"+(e.type||"file")+e.id+t}loadMP4Box(){return this.loadedMP4Box?this.loadedMP4Box:this.loadedMP4Box=new Promise((e,t)=>{window.mp4BoxLoaded=()=>{this.mp4Source=window.MP4Source,e()};let s=document.createElement("script");s.src="mp4box.all.min.js",s.async=!0,s.onload=window.mp4BoxLoaded,document.body.appendChild(s)})}createMP4Stream(e){const t=this.videoChunks[e.id],s=this.videoChunksQueue[e.id];return new this.mp4Source({duration:e.duration,video:{expected_size:e.size}},(e,i)=>{const n=e-e%524288,a=[],o=[];for(let e=0;e<s.length;++e)s[e].offset>=n?a.push(s[e]):o.push(s[e]);a.sort((e,t)=>e.offset-t.offset).concat(o).forEach((e,t)=>{s[t]=e});const r=e/524288|0,l=i/524288|0,d=t.slice(r,l+1);return e%524288==0?d[0]:Promise.all(d).then(t=>{const s=t.length>1?u.bufferConcat(t[0],t[1]):t[0],n=e%524288,a=n+(i-e);return s.slice(n,a)})})}mp4Stream(e,t){var s;const n=null!==(s=this.videoChunks[e.id])&&void 0!==s?s:this.videoChunks[e.id]=[];if(!n.length)for(let t=0;t<e.size;t+=524288){const e=l.deferredPromise();n.push(e)}let a=!1;return(s,o,r)=>i(this,void 0,void 0,(function*(){if(t.isFulfilled||t.isRejected){if(!a)return void(n.length=0)}else this.videoChunksQueue[e.id]=r,console.log("stream:",e,e.url,t),t.resolve(),a=!0;const i=o%524288==0?o/524288:n.length-1;n[i].resolve(s.slice().buffer)}))}downloadVideo(e){const t=this.getDoc(e);if(!t.supportsStreaming||t.url)return this.downloadDoc(e);const s=l.deferredPromise();let i=!1;return s.cancel=()=>{i=!0},this.loadMP4Box().then(()=>{if(i)throw"canceled";const n=this.downloadDoc(e);s.cancel=()=>{n.cancel()},n.notify=(...e)=>{s.notify&&s.notify(...e)},n.then(()=>{t.url?s.resolve():s.resolve(this.createMP4Stream(t))})},s.reject),s}downloadDoc(e,t){const s=this.getDoc(e);if("documentEmpty"==s._)return Promise.reject();const i=this.getInputByID(s);if(s.downloaded&&!t){if(s.url)return Promise.resolve(null);const e=a.default.getCachedFile(i);if(e)return Promise.resolve(e)}if(this.downloadPromises[s.id])return this.downloadPromises[s.id];const n=l.deferredPromise();n.cancel=()=>{r.cancel()};const o=s.supportsStreaming?this.mp4Stream(s,n):void 0,r=a.default.downloadFile(s.dc_id,i,s.size,{mimeType:s.mime_type||"application/octet-stream",toFileEntry:t,stickerType:s.sticker,processPart:o});return r.notify=(...e)=>{n.notify&&n.notify(...e)},r.then(e=>{if(e){if(s.downloaded=!0,"voice"==s.type&&!c.default.isPlaySupported()){let t=new FileReader;return t.onloadend=t=>{let i=new Uint8Array(t.target.result);c.default.decode(i).then(t=>{s.url=t.url,n.resolve(e)},e=>{delete s.downloaded,n.reject(e)})},void t.readAsArrayBuffer(e)}s.type&&2!=s.sticker&&(s.url=URL.createObjectURL(e))}n.resolve(e)},e=>{console.log("document download failed",e),n.reject(e)}).finally(()=>{n.notify=r.notify=n.cancel=r.cancel=null}),this.downloadPromises[s.id]=n}downloadDocThumb(e,t){let s=this.getDoc(e),i=s.id+"-"+t;if(this.thumbs[i])return this.thumbs[i];let n=this.getInputByID(s,t);if("documentEmpty"==s._)return Promise.reject();let o=s.sticker?"image/webp":s.mime_type,r=a.default.downloadSmallFile(n,{dcID:s.dc_id,stickerType:s.sticker?1:void 0,mimeType:o});return this.thumbs[i]=r.then(e=>URL.createObjectURL(e))}hasDownloadedThumb(e,t){return!!this.thumbs[e+"-"+t]}saveDocFile(e){return i(this,void 0,void 0,(function*(){var t=this.docs[e],s=this.getFileName(t),i=(s.split(".",2)||[])[1]||"";try{let n=o.default.chooseSaveFile(s,i,t.mime_type,t.size);yield n.ready;let a=this.downloadDoc(e,n);return a.then(()=>{n.close(),console.log("saved doc",t)}),{promise:a}}catch(i){let n=this.downloadDoc(e);return n.then(e=>{o.default.download(e,t.mime_type,s)}),{promise:n}}}))}};t.default=h},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppSidebarLeft=void 0;const r=a(s(15)),l=s(0),d=o(s(18)),c=a(s(39)),u=s(1),h=o(s(5)),p=o(s(9)),f=o(s(37)),m=o(s(82)),g=o(s(84)),v=o(s(85)),b=o(s(86)),y=o(s(87)),_=o(s(88)),w=o(s(89)),S=o(s(90)),L=o(s(91)),M=o(s(58)),D=o(s(41)),E=o(s(36)),I=o(s(10));f.default;const P=new m.default,C=new g.default,T=new v.default,k=new b.default,X=new y.default,A=new _.default,x=new w.default,F=new S.default,B=new L.default;let R=(()=>{class e extends M.default{constructor(){super(document.getElementById("column-left"),{[e.SLIDERITEMSIDS.archived]:r.archivedTab,[e.SLIDERITEMSIDS.newChannel]:P,[e.SLIDERITEMSIDS.contacts]:T,[e.SLIDERITEMSIDS.addMembers]:C,[e.SLIDERITEMSIDS.newGroup]:k,[e.SLIDERITEMSIDS.settings]:X,[e.SLIDERITEMSIDS.editProfile]:A,[e.SLIDERITEMSIDS.chatFolders]:x,[e.SLIDERITEMSIDS.editFolder]:F,[e.SLIDERITEMSIDS.includedChats]:B}),this.buttons={},this.newButtons={},this.searchGroups={contacts:new c.SearchGroup("Chats","contacts"),globalContacts:new c.SearchGroup("Global Search","contacts"),messages:new c.SearchGroup("Global Search","messages"),people:new c.SearchGroup("People","contacts",!1,"search-group-people"),recent:new c.SearchGroup("Recent","contacts",!1,"search-group-recent")},this.recentSearch=[],this.recentSearchLoaded=!1,this.searchInput=new D.default("Telegram Search"),this.sidebarEl.querySelector(".item-main .sidebar-header").append(this.searchInput.container),this.toolsBtn=this.sidebarEl.querySelector(".sidebar-tools-button"),this.backBtn=this.sidebarEl.querySelector(".sidebar-back-button"),this.searchContainer=this.sidebarEl.querySelector("#search-container"),this.archivedTab=r.archivedTab,this.newChannelTab=P,this.addMembersTab=C,this.contactsTab=T,this.newGroupTab=k,this.settingsTab=X,this.editProfileTab=A,this.chatFoldersTab=x,this.editFolderTab=F,this.includedChatsTab=B,this.menuEl=this.toolsBtn.querySelector(".btn-menu"),this.newBtnMenu=this.sidebarEl.querySelector("#new-menu"),this.globalSearch=new c.default(this.searchContainer,this.searchInput,this.searchGroups,e=>{e||this.searchInput.value.trim()||(this.globalSearch.reset(),this.searchGroups.people.setActive(),this.renderRecentSearch())}),this.searchContainer.addEventListener("click",e=>{const t=l.findUpTag(e.target,"LI");if(!t)return;const s=l.findUpClassName(t,"search-group");if(!s||s.classList.contains("search-group-recent")||s.classList.contains("search-group-people"))return;const n=+t.getAttribute("data-peerID");if(this.recentSearch[0]!=n){this.recentSearch.findAndSplice(e=>e==n),this.recentSearch.unshift(n),this.recentSearch.length>20&&(this.recentSearch.length=20),this.renderRecentSearch(),E.default.pushToState("recentSearch",this.recentSearch);for(const e of this.recentSearch)E.default.pushPeer(e);i.style.display=""}},{capture:!0});let t=document.createElement("div");t.classList.add("search-group-scrollable"),t.append(this.searchGroups.people.list),this.searchGroups.people.container.append(t);new p.default(t,"x");u.parseMenuButtonsTo(this.buttons,this.menuEl.children),u.parseMenuButtonsTo(this.newButtons,this.newBtnMenu.firstElementChild.children),this.archivedCount=this.buttons.archived.querySelector(".archived-count"),this.buttons.saved.addEventListener("click",e=>{setTimeout(()=>{d.default.setPeer(d.default.myID)},0)}),this.buttons.archived.addEventListener("click",t=>{this.selectTab(e.SLIDERITEMSIDS.archived)}),this.buttons.contacts.addEventListener("click",e=>{this.contactsTab.openContacts()}),this.buttons.settings.addEventListener("click",t=>{this.settingsTab.fillElements(),this.selectTab(e.SLIDERITEMSIDS.settings)});let s=!0;this.searchInput.input.addEventListener("focus",e=>{this.toolsBtn.classList.remove("active"),this.backBtn.classList.add("active"),this.searchContainer.classList.remove("hide"),this.searchContainer.offsetWidth,this.searchContainer.classList.add("active"),s&&(this.searchGroups.people.setActive(),this.renderRecentSearch(),s=!1)}),this.backBtn.addEventListener("click",e=>{this.toolsBtn.classList.add("active"),this.backBtn.classList.remove("active"),this.searchContainer.classList.remove("active"),s=!0,setTimeout(()=>{this.searchContainer.classList.add("hide"),this.globalSearch.reset()},150)}),this.newButtons.channel.addEventListener("click",t=>{this.selectTab(e.SLIDERITEMSIDS.newChannel)}),[this.newButtons.group,this.buttons.newGroup].forEach(e=>{e.addEventListener("click",e=>{this.addMembersTab.init(0,"chat",!1,e=>{this.newGroupTab.init(e)})})}),l.$rootScope.$on("dialogs_archived_unread",e=>{this.archivedCount.innerText=""+e.detail.count}),h.default.getTopPeers().then(e=>{e.forEach(e=>{let{dialog:t,dom:s}=r.default.addDialog(e,this.searchGroups.people.list,!1,!0,!0);this.searchGroups.people.setActive()})}),this.renderRecentSearch();const i=this.recentSearchClearBtn=document.createElement("button");i.classList.add("btn-icon","tgico-close"),this.searchGroups.recent.nameEl.append(i),i.addEventListener("click",()=>{this.recentSearch=[],E.default.pushToState("recentSearch",this.recentSearch),this.renderRecentSearch(!1),i.style.display="none"})}renderRecentSearch(e=!0){E.default.getState().then(t=>{t&&!this.recentSearchLoaded&&Array.isArray(t.recentSearch)&&(this.recentSearch=t.recentSearch,this.recentSearchLoaded=!0),this.searchGroups.recent.list.innerHTML="",this.recentSearchClearBtn.style.display=this.recentSearch.length?"":"none",this.recentSearch.slice(0,20).forEach(e=>{let{dialog:t,dom:s}=r.default.addDialog(e,this.searchGroups.recent.list,!1,!0,!1,!0);s.lastMessageSpan.innerText=e>0?h.default.getUserStatusString(e):I.default.getChatMembersString(e)}),e&&this.searchGroups.recent.setActive()})}}return e.SLIDERITEMSIDS={archived:1,contacts:2,newChannel:3,addMembers:4,newGroup:5,settings:6,editProfile:7,chatFolders:8,editFolder:9,includedChats:10},e})();t.AppSidebarLeft=R;const O=new R;t.default=O},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppPhotosManager=void 0;const n=i(s(5)),a=s(0),o=i(s(33)),r=s(11),l=i(s(22)),d=i(s(2));let c=(()=>{class e{constructor(){this.photos={},this.documentThumbsCache={},this.windowW=0,this.windowH=0,window.addEventListener("resize",e=>{this.windowW=document.body.scrollWidth,this.windowH=document.body.scrollHeight}),this.windowW=document.body.scrollWidth,this.windowH=document.body.scrollHeight}savePhoto(e,t){return this.photos[e.id]?Object.assign(this.photos[e.id],e):(e.id?this.photos[e.id]=e:console.warn("no apiPhoto.id",e),e)}choosePhotoSize(e,t=0,s=0){window.devicePixelRatio>1&&(t*=2,s*=2);let i={_:"photoSizeEmpty"},n=e.sizes||e.thumbs;if(n)for(let e of n){if(!e.w||!e.h)continue;i=e;let{w:n,h:o}=a.calcImageInBox(e.w,e.h,t,s);if(n==t||o==s)break}return i}getUserPhotos(e,t,s){var i=n.default.getUserInput(e);return d.default.invokeApi("photos.getUserPhotos",{user_id:i,offset:0,limit:s||20,max_id:t||0}).then(t=>{n.default.saveApiUsers(t.users);for(var s=[],i={user_id:e},a=0;a<t.photos.length;a++)t.photos[a]=this.savePhoto(t.photos[a],i),s.push(t.photos[a].id);return{count:t.count||t.photos.length,photos:s}})}getPreviewURLFromBytes(t,s=!1){let i;s?i=t instanceof Uint8Array?t:new Uint8Array(t):(i=e.jf.concat(t.slice(3),e.Df),i[164]=t[1],i[166]=t[2]);let n=new Blob([i],{type:"image/jpeg"});return URL.createObjectURL(n)}getPreviewURLFromThumb(e,t=!1){var s;return null!==(s=e.url)&&void 0!==s?s:e.url=this.getPreviewURLFromBytes(e.bytes,t)}setAttachmentPreview(e,t,s=!1,i=!1){let n=this.getPreviewURLFromBytes(e,s);if(i){let e=new Image;return e.src=n,e.addEventListener("load",()=>{t.style.backgroundImage="url("+n+")"}),t}if(t instanceof HTMLImageElement)return t.src=n,t;{let e=new Image;return e.src=n,t.append(e),e}}setAttachmentSize(e,t,s,i,n=!1){let o=null;if("string"==typeof e){if(o=this.photos[e],!o)return{_:"photoEmpty"}}else o=e;let r,l,d=this.choosePhotoSize(o,s,i),c=o.sizes||o.thumbs;!o.downloaded&&!n&&c&&c[0].bytes&&this.setAttachmentPreview(c[0].bytes,t,n),"document"==o._?(r=o.w||512,l=o.h||512):(r=d.w||100,l=d.h||100);let{w:u,h:h}=a.calcImageInBox(r,l,s,i);return t instanceof SVGForeignObjectElement?(t.setAttributeNS(null,"width",""+u),t.setAttributeNS(null,"height",""+h)):(t.style.width=u+"px",t.style.height=h+"px"),d}preloadPhoto(e,t){var s;let i=this.getPhoto(e);if(!t){let e=this.windowW,s=this.windowH;t=this.choosePhotoSize(i,e,s)}let n="document"==i._,a=n?null!==(s=this.documentThumbsCache[i.id])&&void 0!==s?s:this.documentThumbsCache[i.id]={downloaded:-1,url:""}:i;if(a.downloaded>=t.size&&a.url)return Promise.resolve();if(!t||"photoSizeEmpty"==t._)return Promise.reject("no photoSize");let o,r=t.size&&i.access_hash&&i.file_reference,d=r?{_:n?"inputDocumentFileLocation":"inputPhotoFileLocation",id:i.id,access_hash:i.access_hash,file_reference:i.file_reference,thumb_size:t.type}:t.location;return o=r?l.default.downloadFile(i.dc_id,d,t.size):l.default.downloadSmallFile(d),o.then(e=>{(!a.downloaded||a.downloaded<e.size)&&(a.downloaded=e.size,a.url=URL.createObjectURL(e))}),o}getDocumentCachedThumb(e){return this.documentThumbsCache[e]}getPhoto(e){return a.isObject(e)?e:this.photos[e]}getInputByID(e){let t=this.getPhoto(e);return{_:"inputMediaPhoto",flags:0,id:{_:"inputPhoto",id:t.id,access_hash:t.access_hash,file_reference:t.file_reference},ttl_seconds:0}}downloadPhoto(e){var t=this.photos[e],s="image/jpeg",i="photo"+e+".jpg",n=this.windowW,a=this.windowH,r=this.choosePhotoSize(t,n,a),d={_:"document"==t._?"inputDocumentFileLocation":"inputPhotoFileLocation",id:t.id,access_hash:t.access_hash,file_reference:t.file_reference,thumb_size:r.type};try{let e=o.default.chooseSaveFile(i,"jpg",s,r.size);e.ready.then(()=>{console.log("ready"),l.default.downloadFile(t.dc_id,d,r.size,{mimeType:s,toFileEntry:e}).then(()=>{e.close(),console.log("file save done",i,"jpg",s,e)},e=>{console.log("photo download failed",e)})})}catch(e){console.error("err",e);var c=l.default.getCachedFile(d);if(c)return o.default.download(c,s,i);l.default.downloadFile(t.dc_id,d,r.size,{mimeType:s}).then(e=>{o.default.download(e,s,i)},e=>{console.log("photo download failed",e)})}}}return e.jf=new Uint8Array(r.bytesFromHex("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00")),e.Df=r.bytesFromHex("ffd9"),e})();t.AppPhotosManager=c,t.default=new c},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppDialogsManager=t.archivedTab=t.AppArchivedTab=void 0;const a=s(0),o=n(s(18)),r=n(s(8)),l=n(s(6)),d=n(s(5)),c=s(3),u=s(1),h=n(s(9)),p=s(7),f=n(s(10)),m=n(s(37)),g=s(30),v=n(s(36)),b=s(4);class y{constructor(){this.element=document.getElementById("dialogs-contextmenu"),this.buttons={},this.onContextMenu=e=>{var t,s;let i=null;try{i=a.findUpTag(e.target,"LI")}catch(e){}if(!i)return;if(e instanceof MouseEvent&&e.preventDefault(),this.element.classList.contains("active"))return!1;e instanceof MouseEvent&&(e.cancelBubble=!0),this.filterID=S.filterID,this.selectedID=+i.getAttribute("data-peerID");const n=l.default.getDialogByPeerID(this.selectedID)[0],o=n.peerID!=a.$rootScope.myID;if(o){const e=this.buttons.archive,t=1==n.folder_id;e.classList.toggle("flip-icon",t),e.innerText=t?"Unarchive":"Archive",this.buttons.archive.style.display=""}else this.buttons.archive.style.display="none";{const e=this.buttons.pin,s=this.filterID>1?l.default.filtersStorage.filters[this.filterID].pinned_peers.includes(n.peerID):!!(null===(t=n.pFlags)||void 0===t?void 0:t.pinned);e.classList.toggle("flip-icon",s),e.innerText=s?"Unpin":"Pin"}if(o){const e=this.buttons.mute,t=n.notify_settings&&n.notify_settings.mute_until>(Date.now()/1e3|0);e.classList.toggle("flip-icon",t),e.innerText=t?"Unmute":"Mute",this.buttons.mute.style.display=""}else this.buttons.mute.style.display="none";{const e=this.buttons.unread,t=!(!(null===(s=n.pFlags)||void 0===s?void 0:s.unread_mark)&&!n.unread_count);e.classList.toggle("flip-icon",t),e.innerText=t?"Mark as Read":"Mark as Unread"}let d="";r.default.isMegagroup(this.selectedID)?(d="Leave",this.peerType="megagroup"):r.default.isChannel(this.selectedID)?(d="Leave",this.peerType="channel"):this.selectedID<0?(d="Delete",this.peerType="group"):(d="Delete",this.peerType=this.selectedID==a.$rootScope.myID?"saved":"chat"),this.buttons.delete.innerText=d,i.classList.add("menu-open"),u.positionMenu(e,this.element),u.openBtnMenu(this.element,()=>{i.classList.remove("menu-open")})},u.parseMenuButtonsTo(this.buttons,this.element.children),this.buttons.archive.addEventListener("click",()=>{let e=l.default.getDialogByPeerID(this.selectedID)[0];e&&l.default.editPeerFolders([e.peerID],+!e.folder_id)}),this.buttons.pin.addEventListener("click",()=>{l.default.toggleDialogPin(this.selectedID,this.filterID)}),this.buttons.mute.addEventListener("click",()=>{o.default.mutePeer(this.selectedID)}),this.buttons.unread.addEventListener("click",()=>{const e=l.default.getDialogByPeerID(this.selectedID)[0];e&&(e.unread_count?(l.default.readHistory(this.selectedID,e.top_message),l.default.markDialogUnread(this.selectedID,!0)):l.default.markDialogUnread(this.selectedID))}),this.buttons.delete.addEventListener("click",()=>{let e,t,s,i=r.default.getPeerTitle(this.selectedID,!1,!0),n=e=>{l.default.flushHistory(this.selectedID,e)};switch(this.peerType){case"channel":e="Leave Channel?",t="Are you sure you want to leave this channel?",s=[{text:"LEAVE "+i,isDanger:!0,callback:()=>n(!0)}];break;case"megagroup":e="Leave Group?",t="Are you sure you want to leave this group?",s=[{text:"LEAVE "+i,isDanger:!0,callback:()=>n(!0)}];break;case"chat":e="Delete Chat?",t=`Are you sure you want to delete chat with <b>${i}</b>?`,s=[{text:"DELETE FOR ME AND "+i,isDanger:!0,callback:()=>n(!1)},{text:"DELETE JUST FOR ME",isDanger:!0,callback:()=>n(!0)}];break;case"saved":e="Delete Saved Messages?",t="Are you sure you want to delete all your saved messages?",s=[{text:"DELETE SAVED MESSAGES",isDanger:!0,callback:()=>n(!1)}];break;case"group":e="Delete and leave Group?",t=`Are you sure you want to delete all message history and leave <b>${i}</b>?`,s=[{text:"DELETE AND LEAVE "+i,isDanger:!0,callback:()=>n(!0)}]}s.push({text:"CANCEL",isCancel:!0}),new g.PopupPeer("popup-delete-chat",{peerID:this.selectedID,title:e,description:t,buttons:s}).show()})}attachListener(e){u.attachContextMenuListener(e,this.onContextMenu)}}class _{constructor(){this.container=document.getElementById("chats-archived-container"),this.chatList=document.getElementById("dialogs-archived"),this.scroll=null}init(){this.scroll=new h.default(this.container,"y","CLA",this.chatList,500),this.scroll.setVirtualContainer(this.chatList),this.scroll.onScrolledBottom=S.onChatsScroll,S.setListClickListener(this.chatList),this.chatList.addEventListener("contextmenu",S.contextMenu.onContextMenu),window.addEventListener("resize",()=>{setTimeout(S.onChatsScroll,0)})}onOpen(){this.init&&(this.init(),this.init=null),this.wasFilterID=S.filterID,S.scroll=this.scroll,S.filterID=1,S.onTabChange()}onOpenAfterTimeout(){S.chatLists[this.wasFilterID].innerHTML=""}onClose(){S.scroll=S._scroll,S.filterID=this.wasFilterID,S.onTabChange()}onCloseAfterTimeout(){this.chatList.innerHTML=""}}t.AppArchivedTab=_,t.archivedTab=new _;class w{constructor(){if(this._chatList=document.getElementById("dialogs"),this.chatList=this._chatList,this.doms={},this.lastActiveListElement=null,this.chatsContainer=document.getElementById("chats-container"),this.loadedAll=!1,this.scroll=null,this._scroll=null,this.log=p.logger("DIALOGS",p.LogLevels.log|p.LogLevels.error|p.LogLevels.warn|p.LogLevels.debug),this.contextMenu=new y,this.chatLists={0:this.chatList,1:t.archivedTab.chatList},this.filterID=0,this.folders={menu:document.getElementById("folders-tabs"),menuScrollContainer:null,container:document.getElementById("folders-container")},this.filtersRendered={},this.onTabChange=()=>{this.doms={},this.loadedAll=!1,this.lastActiveListElement=null,this.chatList=this.chatLists[this.filterID],this.loadDialogs(this.filterID)},this.onChatsScroll=()=>{this.loadedAll||this.loadDialogsPromise||(this.log("onChatsScroll"),this.loadDialogs(this.filterID))},this.contextMenu.attachListener(this.chatList),this.chatsPreloader=u.putPreloader(null,!0),this.allUnreadCount=this.folders.menu.querySelector(".unread-count"),this.folders.menuScrollContainer=this.folders.menu.parentElement,this.scroll=this._scroll=new h.default(this.chatsContainer,"y","CL",this.chatList,500),this.scroll.onScrolledBottom=this.onChatsScroll,this.scroll.setVirtualContainer(this.chatList),b.touchSupport&&b.isSafari){let e,t,s;const i=this.scroll.container;i.addEventListener("touchstart",n=>{e=i.scrollTop>0,t=i.scrollTop<i.scrollHeight-i.clientHeight,s=n.pageY}),i.addEventListener("touchmove",i=>{var n=i.pageY>s,a=i.pageY<s;s=i.pageY,n&&e||a&&t?i.stopPropagation():(n||a)&&i.preventDefault()})}this.setListClickListener(this.chatList),a.$rootScope.$on("user_update",e=>{let t=e.detail,s=d.default.getUser(t),i=l.default.getDialogByPeerID(s.id)[0];if(i&&!d.default.isBot(i.peerID)&&i.peerID!=a.$rootScope.myID){let e=s.status&&"userStatusOnline"==s.status._,t=this.getDialogDom(i.peerID);t&&(e?t.avatarEl.classList.add("is-online"):t.avatarEl.classList.remove("is-online"))}a.$rootScope.selectedPeerID==s.id&&o.default.setPeerStatus()}),a.$rootScope.$on("dialog_top",e=>{let t=e.detail;this.setLastMessage(t),this.setDialogPosition(t),this.setPinnedDelimiter(),this.setFiltersUnreadCount()}),a.$rootScope.$on("dialog_flush",e=>{let t=e.detail.peerID,s=l.default.getDialogByPeerID(t)[0];s&&(this.setLastMessage(s),this.validateForFilter(),this.setFiltersUnreadCount())}),a.$rootScope.$on("dialogs_multiupdate",e=>{const t=e.detail;for(const e in t){const s=t[e];this.updateDialog(s)}this.setPinnedDelimiter(),this.validateForFilter(),this.setFiltersUnreadCount()}),a.$rootScope.$on("dialog_drop",e=>{let{peerID:t,dialog:s}=e.detail,i=this.getDialogDom(t);i&&(i.listEl.remove(),delete this.doms[t],this.scroll.reorder()),this.setFiltersUnreadCount()}),a.$rootScope.$on("dialog_unread",e=>{let t=e.detail,s=l.default.getDialogByPeerID(t.peerID)[0];s&&(this.setUnreadMessages(s),s.peerID==a.$rootScope.selectedPeerID&&o.default.updateUnreadByDialog(s),this.validateForFilter(),this.setFiltersUnreadCount())}),a.$rootScope.$on("peer_changed",e=>{let t=e.detail,s=this.lastActiveListElement&&+this.lastActiveListElement.getAttribute("data-peerID");if(this.lastActiveListElement&&s!=t&&(this.lastActiveListElement.classList.remove("active"),this.lastActiveListElement=null),s!=t){let e=this.getDialogDom(t);e&&(this.lastActiveListElement=e.listEl,e.listEl.classList.add("active"))}}),a.$rootScope.$on("filter_update",e=>{const t=e.detail;if(this.filtersRendered[t.id]){if(t.id==this.filterID){const e=l.default.dialogsStorage.getFolder(t.id);this.validateForFilter();for(let t=0,s=e.length;t<s;++t){const s=e[t];this.updateDialog(s)}this.setFiltersUnreadCount()}}else this.addFilter(t)}),a.$rootScope.$on("filter_delete",e=>{const t=e.detail,s=this.filtersRendered[t.id];s&&(this.folders.menu.firstElementChild.children[0].click(),s.container.remove(),s.menu.remove(),delete this.chatLists[t.id],delete this.filtersRendered[t.id],Object.keys(this.filtersRendered).length||this.folders.menuScrollContainer.classList.add("hide"))}),new h.default(this.folders.menuScrollContainer,"x"),this.chatsContainer.prepend(this.folders.menuScrollContainer);u.horizontalMenu(this.folders.menu,this.folders.container,(e,t)=>{e=+t.dataset.filterID||0,this.filterID!=e&&(this.chatLists[e].innerHTML="",this.scroll.setVirtualContainer(this.chatLists[e]),this.filterID=e,this.onTabChange())},()=>{for(const e in this.chatLists)+e!=this.filterID&&(this.chatLists[e].innerHTML="")});this.folders.menu.firstElementChild.firstElementChild.click(),v.default.loadSavedState().then(()=>l.default.filtersStorage.getDialogFilters()).then(e=>{for(const t in e)this.addFilter(e[t]);return this.loadDialogs(this.filterID)}).then(e=>{this.setPinnedDelimiter(),this.loadDialogs(1)})}updateDialog(e){e&&(this.doms.hasOwnProperty(e.peerID)||this.addDialog(e),this.getDialogDom(e.peerID)&&(this.setLastMessage(e),this.setDialogPosition(e)))}setFilterUnreadCount(e,t){var s;const i=0==e?this.allUnreadCount:null===(s=this.filtersRendered[e])||void 0===s?void 0:s.unread;if(!i)return;const n=(t=t||l.default.dialogsStorage.getFolder(e)).reduce((e,t)=>e+ +!!t.unread_count,0);i.innerText=n?""+n:""}setFiltersUnreadCount(){for(const e in this.filtersRendered)this.setFilterUnreadCount(+e);this.setFilterUnreadCount(0)}validateForFilter(){if(0==this.filterID)return;const e=l.default.dialogsStorage.getFolder(this.filterID);let t=!1;for(const s in this.doms){const i=+s;if(-1===e.findIndex(e=>e.peerID==i)){const e=this.doms[i].listEl;e.remove(),t=!0,this.lastActiveListElement==e&&(this.lastActiveListElement=null)}}t&&this.scroll.reorder()}addFilter(e){if(this.filtersRendered[e.id])return;const t=document.createElement("li"),s=document.createElement("span");s.innerHTML=c.RichTextProcessor.wrapEmojiText(e.title);const i=document.createElement("span");i.classList.add("unread-count"),t.append(s,i),u.ripple(t),this.folders.menu.firstElementChild.append(t);const n=document.createElement("ul"),a=document.createElement("div");a.append(n),a.dataset.filterID=""+e.id,this.folders.container.append(a),this.chatLists[e.id]=n,this.setListClickListener(n),n.addEventListener("contextmenu",this.contextMenu.onContextMenu),this.showFiltersTimeout||(this.showFiltersTimeout=setTimeout(()=>{this.showFiltersTimeout=0,this.folders.menuScrollContainer.classList.remove("hide"),this.setFiltersUnreadCount()},0)),this.filtersRendered[e.id]={menu:t,container:a,unread:i}}loadDialogs(e){return i(this,void 0,void 0,(function*(){if(this.loadDialogsPromise)return this.loadDialogsPromise;if(!this.chatList.childElementCount){this.chatList.parentElement.append(this.chatsPreloader)}const t=l.default.dialogsStorage.getFolder(e);let s=0;for(let e=t.length-1;e>=0;--e){const i=t[e];if(this.getDialogDom(i.peerID)){s=i.index;break}}try{const t=50,i=(this.filterID>1?d.default.getContacts():Promise.resolve()).then(()=>l.default.getConversations("",s,t,e));this.loadDialogsPromise=i;const n=yield i;n&&n.dialogs&&n.dialogs.length&&n.dialogs.forEach(e=>{this.addDialog(e)}),n.dialogs.length&&this.chatList.childElementCount!=n.count||(this.loadedAll=!0),this.log.debug("getDialogs "+t+" dialogs by offset:",s,n,this.chatList.childElementCount),this.scroll.onScroll()}catch(e){this.log.error(e)}this.chatsPreloader.remove(),this.loadDialogsPromise=void 0}))}setListClickListener(e,t){e.addEventListener("click",e=>{a.cancelEvent(e),this.log("dialogs click list");let s=e.target,i=s.classList.contains("rp")?s:a.findUpClassName(s,"rp");if(!i)return;i=i.parentElement;let n,r=this.lastActiveListElement==i;if(this.lastActiveListElement&&!r&&this.lastActiveListElement.classList.remove("active"),i){t&&t();let e=+i.getAttribute("data-peerID"),s=+i.dataset.mid||void 0;r||(i.classList.add("active"),this.lastActiveListElement=i),n=o.default.setPeer(e,s)}else n=o.default.setPeer(0)},{capture:!0})}setDialogPosition(e,t){const s=this.getDialogDom(e.peerID);if(!s)return;void 0===t&&(t=l.default.dialogsStorage.getDialog(e.peerID,this.filterID)[1]);let i=a.whichChild(s.listEl);if(i==t)return;i<t&&(t+=1);const n=this.chatList;n.childElementCount>t?n.insertBefore(s.listEl,n.children[t]):n.append(s.listEl),this.scroll.reorder(),this.log.debug("setDialogPosition:",e,s,t)}setPinnedDelimiter(){}setLastMessage(e,t,s,i){if(t||(t=l.default.getMessage(e.top_message)),!s&&!(s=this.getDialogDom(e.peerID)))return void this.log.error("no dom for dialog:",e,t,s,i);if("messageEmpty"==t._)return s.lastMessageSpan.innerHTML="",s.lastTimeSpan.innerHTML="",void delete s.listEl.dataset.mid;let n=e.peer,o=e.peerID;if(i&&t.message){let e,n=l.default.getRichReplyText(t,""),o=t.message,r=c.RichTextProcessor.parseEntities(o.replace(/\n/g," "),{noLinebreakers:!0}),d=new RegExp(a.escapeRegExp(i),"gi");r||(r=[]);let u=!1;for(;null!==(e=d.exec(o));)r.push({_:"messageEntityHighlight",length:i.length,offset:e.index}),u=!0;u&&r.sort((e,t)=>e.offset-t.offset);let h=c.RichTextProcessor.wrapRichText(o,{noLinebreakers:!0,entities:r,noTextFormat:!0});s.lastMessageSpan.innerHTML=n+h}else t.deleted?s.lastMessageSpan.innerHTML="":s.lastMessageSpan.innerHTML=t.rReply;if("peerUser"!=n._&&o!=-t.from_id){let e=d.default.getUser(t.from_id);if(e&&e.id){let t=document.createElement("b"),i="";i=e.id==a.$rootScope.myID?"You":e.first_name||e.last_name||e.username,t.innerHTML=c.RichTextProcessor.wrapRichText(i,{noLinebreakers:!0})+": ",s.lastMessageSpan.prepend(t)}}if(t.deleted)s.lastTimeSpan.innerHTML="";else{let e="",i=t.date,n=Date.now()/1e3,a=new Date(1e3*t.date);if(n-i<86400)e=("0"+a.getHours()).slice(-2)+":"+("0"+a.getMinutes()).slice(-2);else if(n-i<604800){e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][new Date(1e3*i).getDay()]}else{e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getMonth()]+" "+("0"+a.getDate()).slice(-2)}s.lastTimeSpan.innerHTML=e}this.doms[o]==s?this.setUnreadMessages(e):s.listEl.dataset.mid=t.mid}setUnreadMessages(e){var t;const s=this.getDialogDom(e.peerID);if(1==e.folder_id&&this.accumulateArchivedUnread(),!s)return void this.log.error("setUnreadMessages no dom!",e);const i=l.default.getMessage(e.top_message);if("messageEmpty"!=i._&&!i.deleted&&i.from_id==a.$rootScope.myID&&i.peerID!=a.$rootScope.myID&&e.read_outbox_max_id){i.pFlags&&i.pFlags.unread?(s.statusSpan.classList.remove("tgico-checks"),s.statusSpan.classList.add("tgico-check")):(s.statusSpan.classList.remove("tgico-check"),s.statusSpan.classList.add("tgico-checks"))}else s.statusSpan.classList.remove("tgico-check","tgico-checks");s.unreadMessagesSpan.innerText="",s.unreadMessagesSpan.classList.remove("tgico-pinnedchat");const n=l.default.filtersStorage.filters[this.filterID];let o;o=n?-1!==n.pinned_peers.findIndex(t=>t==e.peerID):!!e.pFlags.pinned,e.unread_count||e.pFlags.unread_mark?(s.unreadMessagesSpan.innerText=""+(e.unread_count||" "),s.unreadMessagesSpan.classList.add(1e3*(null===(t=e.notify_settings)||void 0===t?void 0:t.mute_until)>Date.now()?"unread-muted":"unread")):o&&(s.unreadMessagesSpan.classList.remove("unread","unread-muted"),s.unreadMessagesSpan.classList.add("tgico-pinnedchat"))}accumulateArchivedUnread(){this.accumulateArchivedTimeout||(this.accumulateArchivedTimeout=setTimeout(()=>{this.accumulateArchivedTimeout=0;const e=l.default.dialogsStorage.getFolder(1).reduce((e,t)=>e+t.unread_count,0);a.$rootScope.$broadcast("dialogs_archived_unread",{count:e})},0))}getDialogDom(e){return this.doms[e]}addDialog(e,t,s=!0,i=!0,n=!1,o=!0){let c;if("number"==typeof e){let t=l.default.getDialogByPeerID(e)[0];t||(t={peerID:e,pFlags:{}}),c=t}else c=e;let h=c.peerID;if(!t){if(this.doms[h])return;const e=l.default.filtersStorage.filters[this.filterID];if(e&&!l.default.filtersStorage.testDialogForFilter(c,e)||!e&&this.filterID!=c.folder_id)return}let p=r.default.getPeerTitle(h,!1,n),g=new m.default;if(g.setAttribute("dialog",o?"1":"0"),g.setAttribute("peer",""+h),g.classList.add("dialog-avatar"),s&&h!=a.$rootScope.myID&&c.peer){switch(c.peer._){case"peerUser":let e=d.default.getUser(h);e.status&&"userStatusOnline"==e.status._&&g.classList.add("is-online")}}let v=document.createElement("div");v.classList.add("user-caption");let b=document.createElement("span");if(b.classList.add("user-title"),!t)if(h<0){let e=f.default.getChat(-h);e&&e.pFlags&&e.pFlags.verified&&b.classList.add("is-verified")}else{let e=d.default.getUser(h);e&&e.pFlags&&e.pFlags.verified&&b.classList.add("is-verified")}h==a.$rootScope.myID&&o&&(p=n?"Saved":"Saved Messages"),b.innerHTML=p;let y=document.createElement("span");y.classList.add("user-last-message");let _=document.createElement("div");_.classList.add("rp"),_.append(g,v),i&&u.ripple(_);let w=document.createElement("li");w.append(_),w.setAttribute("data-peerID",""+h);let S=document.createElement("span");S.classList.add("message-status");let L=document.createElement("span");L.classList.add("message-time");let M=document.createElement("span"),D=document.createElement("p"),E=document.createElement("span");E.append(S,L),D.append(b,E);let I=document.createElement("p");I.append(y,M),v.append(D,I);let P={avatarEl:g,captionDiv:v,titleSpan:b,statusSpan:S,lastTimeSpan:L,unreadMessagesSpan:M,lastMessageSpan:y,containerEl:_,listEl:w};return t?t.append(w):(this.scroll.append(w),this.doms[c.peerID]=P,a.$rootScope.selectedPeerID==h&&(w.classList.add("active"),this.lastActiveListElement=w),this.setLastMessage(c)),{dom:P,dialog:c}}setTyping(e,t){const s=this.getDialogDom(e.peerID);if(!s)return;let i="";if(e.peerID<0){let e=t.rFirstName||t.username;if(!e)return;i=e+" "}const n=document.createElement("i");i+="typing...",n.innerHTML=i,s.lastMessageSpan.innerHTML="",s.lastMessageSpan.append(n),s.lastMessageSpan.classList.add("user-typing")}unsetTyping(e){const t=this.getDialogDom(e.peerID);t&&(t.lastMessageSpan.classList.remove("user-typing"),this.setLastMessage(e,null,t))}}t.AppDialogsManager=w;const S=new w;t.default=S},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(25);const n=new class{constructor(){this.keyPrefix="",this.noPrefix=!1,this.cache={},this.useLs=!0}storageGetPrefix(){return this.noPrefix?(this.noPrefix=!1,""):this.keyPrefix}get(e,t){var s=!1;Array.isArray(e)||(t=(e=Array.prototype.slice.call(arguments)).pop(),s=1==e.length);var i,n,a,o=[],r=!0,l=this.storageGetPrefix();for(n=0;n<e.length;n++)if("xt_"!=(a=e[n]=l+e[n]).substr(0,3)&&void 0!==this.cache[a])o.push(this.cache[a]);else if(this.useLs){try{i=localStorage.getItem(a)}catch(e){this.useLs=!1}try{i=null!=i&&JSON.parse(i)}catch(e){i=!1}o.push(this.cache[a]=i)}else r=!1;if(r)return t(s?o[0]:o)}set(e,t){var s,i,n={},a=this.storageGetPrefix();for(s in e)if(e.hasOwnProperty(s))if(i=e[s],s=a+s,this.cache[s]=i,i=JSON.stringify(i,(e,t)=>{if("downloaded"!=e&&("url"!=e||0!==t.indexOf("blob:")))return t}),this.useLs)try{localStorage.setItem(s,i)}catch(e){this.useLs=!1}else n[s]=i;this.useLs&&t&&t()}remove(e,t){Array.isArray(e)||"function"==typeof(e=Array.prototype.slice.call(arguments))[e.length-1]&&(t=e.pop());var s,i,n=this.storageGetPrefix();for(s=0;s<e.length;s++)if(i=e[s]=n+e[s],delete this.cache[i],this.useLs)try{localStorage.removeItem(i)}catch(e){this.useLs=!1}t&&t()}clear(e){if(this.useLs)try{localStorage.clear()}catch(e){this.useLs=!1}this.cache={},e()}};t.default=new class{constructor(){this.taskID=0,this.tasks={},i.Modes.test&&this.setPrefix("t_"),this.isWebWorker="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}setPrefix(e){n.keyPrefix=e}noPrefix(){n.noPrefix=!0}finishTask(e,t){this.tasks[e](t),delete this.tasks[e]}proxy(e,...t){return new Promise((s,i)=>{if(this.isWebWorker)this.tasks[this.taskID]=s,self.postMessage({useLs:!0,task:e,taskID:this.taskID,args:t}),this.taskID++;else{let i=Array.prototype.slice.call(t);i.push(e=>{s(e)}),n[e].apply(n,i)}})}get(...e){return this.proxy("get",...e)}set(...e){return this.proxy("set",...e)}remove(...e){return this.proxy("remove",...e)}clear(...e){return this.proxy("clear",...e)}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RLottiePlayer=void 0;const a=s(4),o=s(7),r=n(s(20)),l=n(s(2));let d=e=>Math.round(255*Math.min(Math.max(e,0),1)),c=(()=>{class e{constructor({el:t,worker:s,options:i}){this.reqId=0,this.width=0,this.height=0,this.listeners={},this.listenerResults={},this.paused=!0,this.direction=1,this.speed=1,this.autoplay=!0,this.loop=!0,this.group="",this.frames={},this.cachingDelta=0,this.reqId=++e.reqId,this.el=t,this.worker=s;for(let e in i)this.hasOwnProperty(e)&&(this[e]=i[e]);window.devicePixelRatio>1&&this.width>100&&this.height>100&&(a.isApple||!a.mediaSizes.isMobile?(this.width=Math.round(this.width*window.devicePixelRatio),this.height=Math.round(this.height*window.devicePixelRatio)):window.devicePixelRatio>2.5&&(this.width=Math.round(this.width*(window.devicePixelRatio-1.5)),this.height=Math.round(this.height*(window.devicePixelRatio-1.5)))),i.noCache||(a.isApple&&this.width>100&&this.height>100?this.cachingDelta=2:this.width<100&&this.height<100?this.cachingDelta=1/0:this.cachingDelta=4),this.canvas=document.createElement("canvas"),this.canvas.classList.add("rlottie"),this.canvas.width=this.width,this.canvas.height=this.height,this.context=this.canvas.getContext("2d"),this.clamped=new Uint8ClampedArray(this.width*this.height*4),this.imageData=new ImageData(this.width,this.height)}clearCache(){this.frames={}}addListener(e,t,s){var i;(null!==(i=this.listeners[e])&&void 0!==i?i:this.listeners[e]=[]).push({callback:t,once:s}),this.listenerResults.hasOwnProperty(e)&&(t(this.listenerResults[e]),s&&this.removeListener(e,t))}removeListener(e,t){this.listeners[e]&&this.listeners[e].findAndSplice(e=>e.callback==t)}setListenerResult(e,t){this.listenerResults[e]=t,this.listeners[e]&&this.listeners[e].forEach(s=>{s.callback(t),s.once&&this.removeListener(e,s.callback)})}sendQuery(e,...t){this.worker.sendQuery(e,this.reqId,...t)}loadFromData(e){this.sendQuery("loadFromData",e,this.width,this.height,{paused:this.paused,direction:this.direction,speed:this.speed})}play(){this.paused&&(this.paused=!1,this.setMainLoop())}pause(){this.paused||(this.paused=!0,clearTimeout(this.rafId))}stop(e=!0){this.pause(),this.curFrame=1==this.direction?0:this.frameCount,e&&this.requestFrame(this.curFrame)}restart(){this.stop(!1),this.play()}setSpeed(e){this.speed=e,this.paused||this.setMainLoop()}setDirection(e){this.direction=e,this.paused||this.setMainLoop()}remove(){h.onDestroy(this.reqId),this.pause(),this.sendQuery("destroy")}renderFrame2(e,t){try{this.imageData.data.set(e),this.context.putImageData(this.imageData,0,0)}catch(e){return console.error("RLottiePlayer renderFrame error:",e,this.width,this.height),this.autoplay=!1,void this.pause()}this.setListenerResult("enterFrame",t)}renderFrame(e,t){if(this.cachingDelta&&(t%this.cachingDelta||!t)&&!this.frames[t]&&(this.frames[t]=new Uint8ClampedArray(e)),this.frInterval){const s=Date.now()-this.frThen;if(s<0)return this.rafId&&clearTimeout(this.rafId),this.rafId=setTimeout(()=>{this.renderFrame2(e,t)},this.frInterval>-s?-s%this.frInterval:this.frInterval)}this.renderFrame2(e,t)}requestFrame(e){this.frames[e]?this.renderFrame(this.frames[e],e):a.isSafari?this.sendQuery("renderFrame",e):(this.clamped.length||(this.clamped=new Uint8ClampedArray(this.width*this.height*4)),this.sendQuery("renderFrame",e,this.clamped))}mainLoopForwards(){if(this.requestFrame(this.curFrame++),this.curFrame>=this.frameCount){if(!this.loop)return this.pause(),!1;this.curFrame=0}return!0}mainLoopBackwards(){if(this.requestFrame(this.curFrame--),this.curFrame<0){if(!this.loop)return this.pause(),!1;this.curFrame=this.frameCount-1}return!0}setMainLoop(){clearTimeout(this.rafId),this.frInterval=1e3/this.fps/this.speed,this.frThen=Date.now()-this.frInterval;const e=(1==this.direction?this.mainLoopForwards:this.mainLoopBackwards).bind(this);this.currentMethod=e,this.frameListener&&this.listenerResults.hasOwnProperty("enterFrame")&&this.frameListener()}onLoad(e,t){return i(this,void 0,void 0,(function*(){this.curFrame=1==this.direction?0:e-1,this.frameCount=e,this.fps=t,this.frInterval=1e3/this.fps/this.speed,this.frThen=Date.now()-this.frInterval,this.requestFrame(0),this.setListenerResult("ready"),this.addListener("enterFrame",()=>{this.setListenerResult("firstFrame"),this.el.appendChild(this.canvas),this.frameListener=()=>{if(this.paused)return;const e=Date.now();this.frThen=e+this.frInterval;this.currentMethod()||this.loop||!this.autoplay||(this.autoplay=!1)},this.addListener("enterFrame",this.frameListener)},!0)}))}}return e.reqId=0,e})();t.RLottiePlayer=c;class u{constructor(e,t=(()=>{}),s){this.defaultListener=t,this.listeners={},this.worker=new Worker(e),s&&(this.worker.onerror=s),this.worker.onmessage=e=>{e.data instanceof Object&&e.data.hasOwnProperty("queryMethodListener")&&e.data.hasOwnProperty("queryMethodArguments")?this.listeners[e.data.queryMethodListener](...e.data.queryMethodArguments):this.defaultListener.call(this,e.data)}}postMessage(e){this.worker.postMessage(e)}terminate(){this.worker.terminate()}addListener(e,t){this.listeners[e]=t}removeListener(e){delete this.listeners[e]}sendQuery(e,...t){t=Array.prototype.slice.call(arguments,1);if(a.isSafari)this.worker.postMessage({queryMethod:e,queryMethodArguments:t});else{for(var s=[],i=0;i<t.length;i++)t[i]instanceof ArrayBuffer&&s.push(t[i]),t[i].buffer&&t[i].buffer instanceof ArrayBuffer&&s.push(t[i].buffer);this.worker.postMessage({queryMethod:e,queryMethodArguments:t},s)}}}const h=new((()=>{class e{constructor(){this.loaded=!1,this.workersLimit=4,this.players={},this.workers=[],this.curWorkerNum=0,this.log=o.logger("LOTTIE",o.LogLevels.error)}getAnimation(e){for(let t in this.players)if(this.players[t].el==e)return this.players[t];return null}loadLottieWorkers(){if("undefined"==typeof WebAssembly)return Promise.reject();if(this.loadPromise)return this.loadPromise;const e=this.onFrame.bind(this),t=this.onPlayerLoaded.bind(this);return this.loadPromise=new Promise((s,i)=>{let n=this.workersLimit;for(let i=0;i<this.workersLimit;++i){const a=this.workers[i]=new u("rlottie.worker.js");a.addListener("ready",()=>{this.log("worker #"+i+" ready"),a.addListener("frame",e),a.addListener("loaded",t),--n,n||(this.log("workers ready"),s(),this.loaded=!0)})}})}applyReplacements(t,s){const i=e.COLORREPLACEMENTS[Math.max(s-1,0)],n=e=>{for(let t of e){switch(t.ty){case"st":case"fl":let e=t.c.k,s=d(e[2])|d(e[1])<<8|d(e[0])<<16,n=i.find(e=>e[0]==s);n&&(e[0]=(n[1]>>16&255)/255,e[1]=(n[1]>>8&255)/255,e[2]=(255&n[1])/255)}t.hasOwnProperty("it")&&n(t.it)}};for(let e of t.layers)if(e.shapes)for(let t of e.shapes)n(t.it)}loadAnimationFromURL(e,t){return this.loaded||this.loadLottieWorkers(),fetch(t).then(e=>e.arrayBuffer()).then(e=>l.default.gzipUncompress(e,!0)).then(t=>this.loadAnimationWorker(Object.assign(e,{animationData:JSON.parse(t)})))}loadAnimationWorker(e,t="",s=-1){return i(this,void 0,void 0,(function*(){if(s>=1&&s<=5&&this.applyReplacements(e.animationData,s),this.loaded||(yield this.loadLottieWorkers()),e.width&&e.height||(e.width=parseInt(e.container.style.width),e.height=parseInt(e.container.style.height)),!e.width||!e.height)throw new Error("No size for sticker!");e.group=t;const i=this.initPlayer(e.container,e);return r.default.addAnimation(i,t),i}))}onPlayerLoaded(e,t,s){const i=this.players[e];i?(this.log.debug("onPlayerLoaded"),i.onLoad(t,s)):this.log.warn("onPlayerLoaded on destroyed player:",e,t)}onFrame(e,t,s){const i=this.players[e];i?(i.clamped=s,i.renderFrame(s,t)):this.log.warn("onFrame on destroyed player:",e,t)}onDestroy(e){delete this.players[e]}destroyWorkers(){this.workers.forEach((e,t)=>{e.terminate(),this.log("worker #"+t+" terminated")}),this.log("workers destroyed"),this.workers.length=0}initPlayer(e,t){const s=new c({el:e,worker:this.workers[this.curWorkerNum++],options:t});return this.players[s.reqId]=s,this.curWorkerNum>=this.workers.length&&(this.curWorkerNum=0),s.loadFromData(t.animationData),s}}return e.COLORREPLACEMENTS=[[[16219713,13275258],[16757049,15582629],[16765248,16245699],[16768889,16510934]],[[16219713,11172960],[16757049,13150599],[16765248,14534815],[16768889,15128242]],[[16219713,9199944],[16757049,11371874],[16765248,12885622],[16768889,13939080]],[[16219713,7224364],[16757049,9591348],[16765248,10579526],[16768889,11303506]],[[16219713,2694162],[16757049,4663842],[16765248,5716784],[16768889,6834492]]],e})());t.default=h},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppImManager=void 0;const r=o(s(2)),l=s(0),d=o(s(5)),c=o(s(6)),u=o(s(8)),h=o(s(21)),p=o(s(15)),f=s(3),m=o(s(14)),g=o(s(38)),v=s(7),b=o(s(53)),y=o(s(13)),_=o(s(10)),w=s(24),S=o(s(23)),L=s(1),M=s(92),D=o(s(9)),E=o(s(96)),I=o(s(31)),P=o(s(12)),C=o(s(47)),T=o(s(40)),k=o(s(37)),X=o(s(97)),A=o(s(98)),x=s(30),F=s(4),B=o(s(20)),R=o(s(59)),O=o(s(41)),j=a(s(39)),U=o(s(99)),H=o(s(57)),N=o(s(35));y.default;const $=["messageActionChannelMigrateFrom"];class q{constructor(e){this.attachTo=e,this.element=document.getElementById("bubble-contextmenu"),this.buttons={},L.parseMenuButtonsTo(this.buttons,this.element.children),L.attachContextMenuListener(e,e=>{let t=null;try{t=l.findUpClassName(e.target,"bubble__container")}catch(e){}if(!t)return;if(e instanceof MouseEvent&&e.preventDefault(),this.element.classList.contains("active"))return!1;e instanceof MouseEvent&&(e.cancelBubble=!0),t=t.parentElement;let s=+t.dataset.mid;if(!s)return;let i=l.$rootScope.selectedPeerID;this.msgID=s;const n=c.default.getMessage(s);this.buttons.copy.style.display=n.message?"":"none",l.$rootScope.myID==i||i<0&&_.default.hasRights(-i,"pin")?this.buttons.pin.style.display="":this.buttons.pin.style.display="none",this.buttons.edit.style.display=c.default.canEditMessage(s)?"":"none";let a=t.classList.contains("is-in")?"left":"right";L.positionMenu(e,this.element,a),L.openBtnMenu(this.element)}),this.buttons.copy.addEventListener("click",()=>{let e=c.default.getMessage(this.msgID),t=e?e.message:"";var s=document.createElement("textarea");s.value=t,s.style.position="fixed",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(s)}),this.buttons.delete.addEventListener("click",()=>{let e,t,s,i=l.$rootScope.selectedPeerID,n=u.default.getPeerTitle(i,!1,!0),a=e=>{c.default.deleteMessages([this.msgID],e)};e="Delete Message?",t="Are you sure you want to delete this message?",i==l.$rootScope.myID?s=[{text:"DELETE",isDanger:!0,callback:()=>a(!1)}]:(s=[{text:"DELETE JUST FOR ME",isDanger:!0,callback:()=>a(!1)}],i>0?s.push({text:"DELETE FOR ME AND "+n,isDanger:!0,callback:()=>a(!0)}):_.default.hasRights(-i,"deleteRevoke")&&s.push({text:"DELETE FOR ALL",isDanger:!0,callback:()=>a(!0)})),s.push({text:"CANCEL",isCancel:!0}),new x.PopupPeer("popup-delete-chat",{peerID:i,title:"Delete Message?",description:"Are you sure you want to delete this message?",buttons:s}).show()}),this.buttons.reply.addEventListener("click",()=>{const e=c.default.getMessage(this.msgID),t=V.chatInputC;t.setTopInfo(u.default.getPeerTitle(e.fromID,!0),e.message,void 0,e),t.replyToMsgID=this.msgID,t.editMsgID=0}),this.buttons.forward.addEventListener("click",()=>{C.default.init([this.msgID])}),this.buttons.edit.addEventListener("click",()=>{const e=c.default.getMessage(this.msgID),t=V.chatInputC;t.setTopInfo("Editing",e.message,e.message,e),t.replyToMsgID=0,t.editMsgID=this.msgID}),this.buttons.pin.addEventListener("click",()=>{c.default.updatePinnedMessage(l.$rootScope.selectedPeerID,this.msgID)})}}class z{constructor(){this.foundCount=0,this.selectedIndex=0,this.onDateClick=e=>{l.cancelEvent(e),new U.default(new Date,V.onDatePick).show()},this.selectResult=e=>{if(this.setPeerPromise)return this.setPeerPromise;const t=+e.getAttribute("data-peerID"),s=+e.dataset.mid||void 0,i=l.whichChild(e);i==this.foundCount-1?this.upBtn.setAttribute("disabled","true"):this.upBtn.removeAttribute("disabled"),i?this.downBtn.removeAttribute("disabled"):this.downBtn.setAttribute("disabled","true"),this.results.classList.remove("active"),V.bubblesContainer.classList.remove("search-results-active");const n=V.setPeer(t,s);this.setPeerPromise=(n instanceof Promise?n:Promise.resolve(n)).then(()=>{this.selectedIndex=i,this.foundCountEl.innerText=`${i+1} of ${this.foundCount}`;const e=this.searchGroup.list.childElementCount;this.selectedIndex>=e-6&&this.appSearch.searchMore()}).finally(()=>{this.setPeerPromise=null})},this.onResultsClick=e=>{const t=l.findUpTag(e.target,"LI");t&&this.selectResult(t)},this.onFooterClick=e=>{this.foundCount&&(V.bubblesContainer.classList.toggle("search-results-active"),this.results.classList.toggle("active"))},this.onUpClick=e=>{l.cancelEvent(e),this.selectResult(this.searchGroup.list.children[this.selectedIndex+1])},this.onDownClick=e=>{l.cancelEvent(e),this.selectResult(this.searchGroup.list.children[this.selectedIndex-1])},this.element=document.createElement("div"),this.element.classList.add("sidebar-header","chat-search","chats-container"),this.backBtn=document.createElement("button"),this.backBtn.classList.add("btn-icon","tgico-back","sidebar-close-button"),L.ripple(this.backBtn),this.backBtn.addEventListener("click",()=>{V.topbar.classList.remove("hide-pinned"),this.element.remove(),this.searchInput.remove(),this.results.remove(),this.footer.remove(),this.footer.removeEventListener("click",this.onFooterClick),this.dateBtn.removeEventListener("click",this.onDateClick),this.upBtn.removeEventListener("click",this.onUpClick),this.downBtn.removeEventListener("click",this.onDownClick),this.searchGroup.list.removeEventListener("click",this.onResultsClick),V.bubblesContainer.classList.remove("search-results-active")},{once:!0}),this.searchInput=new O.default("Search"),this.results=document.createElement("div"),this.results.classList.add("chat-search-results","chats-container"),this.searchGroup=new j.SearchGroup("","messages",void 0,"",!1),this.searchGroup.list.addEventListener("click",this.onResultsClick),this.appSearch=new j.default(this.results,this.searchInput,{messages:this.searchGroup},e=>{this.foundCount=e,this.foundCount?this.selectResult(this.searchGroup.list.children[0]):(this.foundCountEl.innerText=this.searchInput.value?"No results":"",this.results.classList.remove("active"),V.bubblesContainer.classList.remove("search-results-active"),this.upBtn.setAttribute("disabled","true"),this.downBtn.setAttribute("disabled","true"))}),this.appSearch.beginSearch(l.$rootScope.selectedPeerID),V.bubblesContainer.append(this.results),this.footer=document.createElement("div"),this.footer.classList.add("chat-search-footer"),this.footer.addEventListener("click",this.onFooterClick),L.ripple(this.footer),this.foundCountEl=document.createElement("span"),this.foundCountEl.classList.add("chat-search-count"),this.dateBtn=document.createElement("button"),this.dateBtn.classList.add("btn-icon","tgico-calendar"),this.controls=document.createElement("div"),this.controls.classList.add("chat-search-controls"),this.upBtn=document.createElement("button"),this.upBtn.classList.add("btn-icon","tgico-up"),this.downBtn=document.createElement("button"),this.downBtn.classList.add("btn-icon","tgico-down"),this.upBtn.setAttribute("disabled","true"),this.downBtn.setAttribute("disabled","true"),this.dateBtn.addEventListener("click",this.onDateClick),this.upBtn.addEventListener("click",this.onUpClick),this.downBtn.addEventListener("click",this.onDownClick),this.controls.append(this.upBtn,this.downBtn),this.footer.append(this.foundCountEl,this.dateBtn,this.controls),V.topbar.parentElement.insertBefore(this.footer,V.chatInput),this.element.append(this.backBtn,this.searchInput.container),V.topbar.classList.add("hide-pinned"),V.topbar.parentElement.append(this.element),this.searchInput.input.focus()}}class W{constructor(){this.container=document.createElement("div"),this.container.classList.add("pinned-audio","pinned-container"),this.container.style.display="none",this.toggle=document.createElement("div"),this.toggle.classList.add("pinned-audio-ico","tgico"),this.title=document.createElement("div"),this.title.classList.add("pinned-audio-title"),this.subtitle=document.createElement("div"),this.subtitle.classList.add("pinned-audio-subtitle"),this.close=document.createElement("button"),this.close.classList.add("pinned-audio-close","btn-icon","tgico-close"),this.container.append(this.toggle,this.title,this.subtitle,this.close),this.close.addEventListener("click",e=>{l.cancelEvent(e),this.container.style.display="none",this.container.parentElement.classList.remove("is-audio-shown"),this.toggle.classList.contains("flip-icon")&&H.default.toggle()}),this.toggle.addEventListener("click",e=>{l.cancelEvent(e),H.default.toggle()}),l.$rootScope.$on("audio_play",e=>{const{doc:t,mid:s}=e.detail;let i,n;if("voice"==t.type){const e=c.default.getMessage(s);i=u.default.getPeerTitle(e.fromID,!1,!0),n=w.formatDate(e.date,!1,!1)}else i=t.audioTitle||t.file_name,n=t.audioPerformer?f.RichTextProcessor.wrapPlainText(t.audioPerformer):"Unknown Artist";if(this.title.innerHTML=i,this.subtitle.innerHTML=n,this.toggle.classList.add("flip-icon"),this.container.dataset.mid=""+s,this.container.style.display){const e=V.scrollable.scrollTop;this.container.style.display="",this.container.parentElement.classList.add("is-audio-shown"),V.scrollable.scrollTop=e}}),l.$rootScope.$on("audio_pause",()=>{this.toggle.classList.remove("flip-icon")})}}class G{constructor(){this.columnEl=document.getElementById("column-center"),this.btnMute=this.columnEl.querySelector(".chat-mute-button"),this.avatarEl=document.getElementById("im-avatar"),this.titleEl=document.getElementById("im-title"),this.subtitleEl=document.getElementById("im-subtitle"),this.bubblesContainer=document.getElementById("bubbles"),this.chatInner=document.getElementById("bubbles-inner"),this.searchBtn=this.columnEl.querySelector(".chat-search-button"),this.goDownBtn=this.columnEl.querySelector("#bubbles-go-down"),this.menuButtons={},this.myID=0,this.peerID=0,this.bubbles={},this.dateMessages={},this.unreadOut=new Set,this.needUpdate=[],this.offline=!1,this.updateStatusInterval=0,this.pinnedMsgID=0,this.pinnedMessageContainer=null,this.lazyLoadQueue=new I.default,this.scroll=null,this.scrollable=null,this.preloader=null,this.typingTimeouts={},this.typingUsers={},this.topbar=document.getElementById("topbar"),this.chatInput=document.getElementById("chat-input"),this.chatInfo=this.columnEl.querySelector(".chat-info"),this.contextMenu=new q(this.bubblesContainer),this.setPeerPromise=null,this.bubbleGroups=new E.default,this.scrolledDown=!0,this.onScrollRAF=0,this.isScrollingTimeout=0,this.unreadedObserver=null,this.unreaded=[],this.loadedTopTimes=0,this.loadedBottomTimes=0,this.messagesQueuePromise=null,this.messagesQueue=[],this.messagesQueueOnRender=null,this.firstUnreadBubble=null,this.stickyIntersector=null,this.cleanupID=0,this.selectTab=L.horizontalMenu(null,document.getElementById("main-columns")),this.closeBtn=this.topbar.querySelector(".sidebar-close-button"),this.onDatePick=e=>{const t=this.peerID;c.default.requestHistory(t,0,2,-1,e).then(e=>{var s;(null===(s=null==e?void 0:e.messages)||void 0===s?void 0:s.length)?this.peerID==t&&V.setPeer(this.peerID,e.messages[0].mid):this.log.error("no history!")})},this.log=v.logger("IM",v.LogLevels.log|v.LogLevels.error|v.LogLevels.warn|v.LogLevels.debug),this.chatInputC=new M.ChatInput,this.preloader=new S.default(null,!1),this.selectTab(0),L.parseMenuButtonsTo(this.menuButtons,this.columnEl.querySelector(".chat-more-button").firstElementChild.children),this.chatAudio=new W,this.topbar.insertBefore(this.chatAudio.container,this.chatInfo.nextElementSibling),r.default.getUserID().then(e=>{this.myID=l.$rootScope.myID=e}),l.$rootScope.$on("user_auth",e=>{let t=e.detail;this.myID=l.$rootScope.myID=t?t.id:0}),l.$rootScope.$on("history_append",e=>{let t=e.detail;this.scrolledAllDown?this.renderNewMessagesByIDs([t.messageID],!0):this.setPeer(this.peerID,0)}),l.$rootScope.$on("history_update",e=>{let t=e.detail;if(t.mid&&t.peerID==this.peerID){let e=t.mid,s=this.bubbles[e];if(!s)return;let i=c.default.getMessage(e);this.getDateContainerByMessage(i,!1).container.append(s),this.bubbleGroups.addBubble(s,i,!1)}}),l.$rootScope.$on("history_multiappend",e=>{let t=e.detail;if(!(this.peerID in t))return;let s=t[this.peerID];this.renderNewMessagesByIDs(s)}),l.$rootScope.$on("history_delete",e=>{let t=e.detail;this.deleteMessagesByIDs(Object.keys(t.msgs).map(e=>+e))}),l.$rootScope.$on("dialog_flush",e=>{let t=e.detail.peerID;this.peerID==t&&this.deleteMessagesByIDs(Object.keys(this.bubbles).map(e=>+e))}),l.$rootScope.$on("message_sent",e=>{var t,s,i;const{tempID:n,mid:a}=e.detail;this.log("message_sent",e.detail);const o=c.default.getMessage(a);if(o.media)if(o.media.photo){const e=m.default.getPhoto(n);if(e){const t=o.media.photo;t.downloaded=e.downloaded,t.url=e.url}}else if(o.media.document){const e=P.default.getDoc(n);if(e&&e.type&&"sticker"!=e.type){const t=o.media.document;t.downloaded=e.downloaded,t.url=e.url}}let r=this.bubbles[n];if(r){if(this.bubbles[a]=r,o.grouped_id){let e=r.querySelectorAll(".album-item"),t=Object.keys(c.default.groupedMessagesStorage[o.grouped_id]).map(e=>+e).sort((e,t)=>e-t);Array.from(e).forEach((e,s)=>{e.dataset.mid=""+t[s]})}if(null===(t=o.media)||void 0===t?void 0:t.poll){const e=o.media.poll,t=r.querySelector("poll-element");t&&(t.setAttribute("poll-id",e.id),t.setAttribute("message-id",a),delete N.default.polls[n],delete N.default.results[n])}if(["audio","voice"].includes(null===(i=null===(s=o.media)||void 0===s?void 0:s.document)||void 0===i?void 0:i.type)){const e=r.querySelector("audio-element");e.setAttribute("doc-id",o.media.document.id),e.setAttribute("message-id",""+a)}r.classList.remove("is-sending"),r.classList.add("is-sent"),r.dataset.mid=a,this.bubbleGroups.removeBubble(r,n),delete this.bubbles[n]}else this.log.warn("message_sent there is no bubble",e.detail);this.unreadOut.has(n)&&(this.unreadOut.delete(n),this.unreadOut.add(a))}),l.$rootScope.$on("message_edit",e=>{let{peerID:t,mid:s,id:i,justMedia:n}=e.detail;if(t!=this.peerID)return;let a=c.default.getMessage(s),o=this.bubbles[s];if(!o&&a.grouped_id){let e=this.getAlbumBubble(a.grouped_id);o=e.bubble,a=e.message}o&&this.renderMessage(a,!0,!1,o,!1)}),l.$rootScope.$on("messages_downloaded",e=>{const t=e.detail,s=c.default.getPinnedMessage(this.peerID);t.forEach(e=>{s.mid==e&&(this.messagesQueuePromise||Promise.resolve()).then(()=>{this.setPinnedMessage(s)}),this.needUpdate.forEachReverse((t,s)=>{if(t.replyMid==e){let{mid:e,replyMid:t}=this.needUpdate.splice(s,1)[0],i=this.bubbles[e];if(!i)return;let n=c.default.getMessage(e);c.default.getMessage(t).deleted&&delete n.reply_to_mid,this.renderMessage(n,!0,!1,i,!1)}})})}),l.$rootScope.$on("apiUpdate",e=>{let t=e.detail;this.handleUpdate(t)}),window.addEventListener("blur",()=>{B.default.checkAnimations(!0),this.offline=!0,this.updateStatus(),clearInterval(this.updateStatusInterval),window.addEventListener("focus",()=>{B.default.checkAnimations(!1),this.offline=!1,this.updateStatus(),this.updateStatusInterval=window.setInterval(()=>this.updateStatus(),5e4)},{once:!0})}),this.topbar.addEventListener("click",e=>{const t=l.findUpClassName(e.target,"pinned-container");if(t){l.cancelEvent(e);const s=+t.dataset.mid,i=c.default.getMessage(s);this.setPeer(i.peerID,s)}else g.default.toggleSidebar(!0)}),this.bubblesContainer.addEventListener("click",e=>{var t,s;let i=e.target,n=null;try{n=l.findUpClassName(i,"bubble")}catch(e){}if(!n)return;if(n.classList.contains("is-date")&&l.findUpClassName(i,"bubble__container")){if(n.classList.contains("is-sticky")&&!this.chatInner.classList.contains("is-scrolling"))return;for(let e in this.dateMessages){if(this.dateMessages[e].div==n){new U.default(new Date(+e),this.onDatePick).show();break}}return}let a=l.findUpClassName(i,"contact");if(a)this.setPeer(+a.dataset.peerID);else if("SPAN"!=i.tagName)if(n.classList.contains("sticker")&&i.parentElement.classList.contains("attachment")){const e=+n.dataset.mid,s=null===(t=c.default.getMessage(e).media)||void 0===t?void 0:t.document;(null==s?void 0:s.stickerSetInput)&&new R.default(s.stickerSetInput).show()}else{if("IMG"==i.tagName&&!i.classList.contains("emoji")&&"AVATAR-ELEMENT"!=i.parentElement.tagName||i.classList.contains("album-item")||"VIDEO"==i.tagName&&!n.classList.contains("round")){let e=+(null===(s=l.findUpClassName(i,"album-item"))||void 0===s?void 0:s.dataset.mid)||+n.dataset.mid,t=c.default.getMessage(e);if(!t)return void this.log.warn("no message by messageID:",e);let a=[],o=Object.keys(this.bubbles).map(e=>+e).filter(e=>{let t=c.default.getMessage(e);return t.media&&(t.media.photo||t.media.document&&("video"==t.media.document.type||"gif"==t.media.document.type)||t.media.webpage&&(t.media.webpage.document||t.media.webpage.photo))}).sort((e,t)=>e-t);o.forEach(e=>{let t=".album-item img, .album-item video, .preview img, .preview video, ";t+=this.bubbles[e].classList.contains("with-media-tail")?".bubble__media-container":".attachment img, .attachment video";let s=this.bubbles[e].querySelectorAll(t);Array.from(s).forEach(t=>{let s=l.findUpClassName(t,"album-item");a.push({element:t,mid:+(null==s?void 0:s.dataset.mid)||e})})});let r=a.findIndex(t=>t.mid==e);this.log("open mediaViewer single with ids:",o,r,a),b.default.openMedia(t,a[r].element,!0,this.scroll.parentElement,a.slice(0,r),a.slice(r+1))}if(-1===["IMG","DIV","AVATAR-ELEMENT"].indexOf(i.tagName)&&(i=l.findUpTag(i,"DIV")),"DIV"==i.tagName||"AVATAR-ELEMENT"==i.tagName){if(i.classList.contains("goto-original")){let e=n.dataset.savedFrom.split("_"),t=+e[0],s=+e[1];return void this.setPeer(t,s)}if(i.classList.contains("forward")){const e=+n.dataset.mid;return void C.default.init([e])}if(i.classList.contains("name")){let e=+i.dataset.peerID;return void(isNaN(e)||this.setPeer(e))}if("AVATAR-ELEMENT"==i.tagName){let e=+i.getAttribute("peer");return void(isNaN(e)||this.setPeer(e))}let t=!1;try{t=!!l.findUpClassName(e.target,"reply")}catch(e){}if(t&&n.classList.contains("is-reply")){let e=+n.getAttribute("data-original-mid");this.setPeer(this.peerID,e)}}else if("IMG"==i.tagName&&"AVATAR-ELEMENT"==i.parentElement.tagName){let e=+i.parentElement.getAttribute("peer");isNaN(e)||this.setPeer(e)}}else{let e=i.parentElement.querySelector("video");e&&e.click()}}),this.closeBtn.addEventListener("click",e=>{l.cancelEvent(e),this.setPeer(0)}),this.searchBtn.addEventListener("click",e=>{l.cancelEvent(e),this.peerID&&g.default.beginSearch()}),this.btnMute.addEventListener("click",e=>{l.cancelEvent(e),this.mutePeer(this.peerID)}),this.menuButtons.mute.addEventListener("click",e=>{this.mutePeer(this.peerID)}),this.menuButtons.search.addEventListener("click",e=>{new z});document.body.addEventListener("keydown",e=>{let t=e.target;if(this.chatInputC.attachMediaPopUp.container.classList.contains("active"))return"INPUT"!=t.tagName&&this.chatInputC.attachMediaPopUp.captionInput.focus(),void("Enter"!=e.key||F.touchSupport?"Escape"==e.key&&this.chatInputC.attachMediaPopUp.container.classList.remove("active"):this.chatInputC.attachMediaPopUp.sendBtn.click());if("Escape"==e.key)b.default.wholeDiv.classList.contains("active")?b.default.buttons.close.click():C.default.container.classList.contains("active")?C.default.close():this.chatInputC.replyElements.container.classList.contains("active")?this.chatInputC.replyElements.cancelBtn.click():0!=this.peerID&&this.setPeer(0);else{if("Meta"==e.key||"Control"==e.key)return;if("KeyC"==e.code&&(e.ctrlKey||e.metaKey)&&"INPUT"!=t.tagName)return}e.target!=this.chatInputC.messageInput&&"INPUT"!=t.tagName&&(this.chatInputC.messageInput.focus(),l.placeCaretAtEnd(this.chatInputC.messageInput))}),this.goDownBtn.addEventListener("click",()=>{c.default.getDialogByPeerID(this.peerID)[0]?this.setPeer(this.peerID):(this.log("will scroll down 3"),this.scroll.scrollTop=this.scroll.scrollHeight)}),this.updateStatusInterval=window.setInterval(()=>this.updateStatus(),5e4),this.updateStatus(),setInterval(()=>this.setPeerStatus(),6e4),this.setScroll(),this.stickyIntersector=new A.default(this.scrollable.container,(e,t)=>{for(let s in this.dateMessages){let i=this.dateMessages[s];if(i.container==t){i.div.classList.toggle("is-sticky",e);break}}}),this.unreadedObserver=new IntersectionObserver(e=>{let t=[];if(e.forEach(e=>{if(e.isIntersecting){let s=e.target,i=+s.dataset.mid;t.push(i),this.unreadedObserver.unobserve(s),this.unreaded.findAndSplice(e=>e==i)}}),t.length){let e=Math.max(...t),s=t.length;for(let t=this.unreaded.length-1;t>=0;--t){this.unreaded[t]<e&&(s++,this.unreaded.splice(t,1))}this.log("will readHistory by ids:",e,s),c.default.readHistory(this.peerID,e,s).catch(t=>{this.log.error("readHistory err:",t),c.default.readHistory(this.peerID,e,s)})}})}setPinnedMessage(e){const t=this.scrollable.container.scrollTop,s=w.wrapReply("Pinned Message",e.message,e,!0);s.dataset.mid=""+e.mid,s.classList.add("pinned-container");const i=document.createElement("button");i.classList.add("pinned-message-close","btn-icon","tgico-close"),i.addEventListener("click",e=>{l.cancelEvent(e);const t=this.scrollable.scrollTop;s.remove(),this.topbar.classList.remove("is-pinned-shown"),this.pinnedMessageContainer=null,this.scrollable.scrollTop=t-52},{once:!0}),s.append(i),this.topbar.insertBefore(s,this.btnMute),this.topbar.classList.add("is-pinned-shown"),this.pinnedMessageContainer&&this.pinnedMessageContainer.remove(),this.pinnedMessageContainer=s,this.scrollable.scrollTop=t+52}updateStatus(){return this.myID?(d.default.setUserStatus(this.myID,this.offline),r.default.invokeApi("account.updateStatus",{offline:this.offline})):Promise.resolve()}getAlbumBubble(e){let t=c.default.groupedMessagesStorage[e];for(let e in t){let t=+e;if(this.bubbles[t])return{bubble:this.bubbles[t],message:c.default.getMessage(t)}}return null}loadMoreHistory(e,t=!1){if(!this.peerID||this.setPeerPromise||e&&this.getHistoryTopPromise||!e&&this.getHistoryBottomPromise)return;let s=Object.keys(this.bubbles).map(e=>+e).filter(e=>e>0).sort((e,t)=>e-t);if(!s.length)return;if(e&&!this.scrolledAll&&(this.log("Will load more (up) history by id:",s[0],"maxID:",s[s.length-1],s),this.getHistory(s[0],!0,void 0,void 0,t)),this.scrolledAllDown)return;let i=c.default.getDialogByPeerID(this.peerID)[0];e||i&&-1!==s.indexOf(i.top_message)||(this.log("Will load more (down) history by maxID:",s[s.length-1],s),this.getHistory(s[s.length-1],!1,!0,void 0,t))}onScroll(e){this.onScrollRAF&&window.cancelAnimationFrame(this.onScrollRAF),this.onScrollRAF=window.requestAnimationFrame(()=>{F.touchSupport||(this.isScrollingTimeout?clearTimeout(this.isScrollingTimeout):this.chatInner.classList.contains("is-scrolling")||this.chatInner.classList.add("is-scrolling"),this.isScrollingTimeout=setTimeout(()=>{this.chatInner.classList.remove("is-scrolling"),this.isScrollingTimeout=0},1350)),this.scroll.scrollHeight-Math.round(this.scroll.scrollTop+this.scroll.offsetHeight)<=1?(this.scroll.parentElement.classList.add("scrolled-down"),this.scrolledDown=!0):this.scroll.parentElement.classList.contains("scrolled-down")&&(this.scroll.parentElement.classList.remove("scrolled-down"),this.scrolledDown=!1),this.onScrollRAF=0})}setScroll(){this.scrollable=new D.default(this.bubblesContainer,"y","IM",this.chatInner,300),this.scroll=this.scrollable.container,this.bubblesContainer.append(this.goDownBtn),this.scrollable.onScrolledTop=()=>this.loadMoreHistory(!0),this.scrollable.onScrolledBottom=()=>this.loadMoreHistory(!1),this.scroll.addEventListener("scroll",this.onScroll.bind(this)),this.scroll.parentElement.classList.add("scrolled-down"),F.touchSupport&&(this.scroll.addEventListener("touchmove",()=>{this.isScrollingTimeout?clearTimeout(this.isScrollingTimeout):this.chatInner.classList.contains("is-scrolling")||this.chatInner.classList.add("is-scrolling")},{passive:!0}),this.scroll.addEventListener("touchend",()=>{this.chatInner.classList.contains("is-scrolling")&&(this.isScrollingTimeout&&clearTimeout(this.isScrollingTimeout),this.isScrollingTimeout=setTimeout(()=>{this.chatInner.classList.remove("is-scrolling"),this.isScrollingTimeout=0},1350))},{passive:!0}))}setPeerStatus(e=!1){if(this.myID)if(this.peerID<0){let t=u.default.getPeer(this.peerID),s=u.default.isChannel(this.peerID)&&!u.default.isMegagroup(this.peerID);this.subtitleEl.classList.remove("online"),g.default.profileElements.subtitle.classList.remove("online"),e&&(this.subtitleEl.innerText=g.default.profileElements.subtitle.innerText=""),h.default.getChatFull(t.id).then(e=>{this.log("chatInfo res:",e);let i=e.participants_count||e.participants&&e.participants.participants&&e.participants.participants.length;if(i){let e=l.numberWithCommas(i)+" "+(s?"followers":"members");if(this.subtitleEl.innerText=g.default.profileElements.subtitle.innerText=e,i<2)return;_.default.getOnlines(t.id).then(t=>{t>1&&(e+=", "+l.numberWithCommas(t)+" online"),this.subtitleEl.innerText=g.default.profileElements.subtitle.innerText=e})}})}else if(d.default.isBot(this.peerID))this.subtitleEl.innerText="bot",g.default.profileElements.subtitle.innerText="bot";else{let e=d.default.getUser(this.peerID);if(this.myID==this.peerID)this.subtitleEl.innerText=g.default.profileElements.subtitle.innerText="";else if(e&&e.status){let t=d.default.getUserStatusString(e.id);"online"==t&&(this.subtitleEl.classList.add("online"),g.default.profileElements.subtitle.classList.add("online")),g.default.profileElements.subtitle.innerText=t,this.typingUsers[this.peerID]==this.peerID?(this.subtitleEl.innerText="typing...",this.subtitleEl.classList.add("online")):(this.subtitleEl.innerText=t,"online"!=t&&(this.subtitleEl.classList.remove("online"),g.default.profileElements.subtitle.classList.remove("online")))}}}cleanup(e=!1){this.scrolledAll=!1,this.scrolledAllDown=!1,this.bubbles={},this.dateMessages={},this.bubbleGroups.cleanup(),this.unreadOut.clear(),this.needUpdate.length=0,this.chatInputC.messageInput.innerHTML="",this.chatInputC.replyElements.cancelBtn.click(),e&&(this.scrollable.container.innerHTML=""),this.peerChanged=!1,this.firstUnreadBubble=null,this.attachedUnreadBubble=!1,this.messagesQueue.length=0,this.messagesQueuePromise=null,this.getHistoryTopPromise=this.getHistoryBottomPromise=void 0,this.stickyIntersector.disconnect(),this.unreadedObserver.disconnect(),this.unreaded.length=0,this.loadedTopTimes=this.loadedBottomTimes=0,this.cleanupID++}setPeer(e,t){var s;if(0==e)return g.default.toggleSidebar(!1),this.topbar.style.display=this.chatInput.style.display=this.goDownBtn.style.display="none",this.cleanup(!0),this.peerID=l.$rootScope.selectedPeerID=0,l.$rootScope.$broadcast("peer_changed",this.peerID),F.mediaSizes.isMobile&&this.selectTab(0),!1;const i=this.peerID==e;if(this.setPeerPromise&&i)return this.setPeerPromise;const n=c.default.getDialogByPeerID(e)[0]||null;let a=t<=0?t:null!==(s=null==n?void 0:n.top_message)&&void 0!==s?s:0;const o=void 0!==t;if(!o&&n&&(t=n.unread_count&&!i?n.read_inbox_max_id:n.top_message),i){if(this.bubbles[t])return o?(this.scrollable.scrollIntoView(this.bubbles[t]),this.highlightBubble(this.bubbles[t])):n&&t==a&&(this.log("will scroll down",this.scroll.scrollTop,this.scroll.scrollHeight),this.scroll.scrollTop=this.scroll.scrollHeight),!0}else g.default.searchCloseBtn.click();this.peerID=l.$rootScope.selectedPeerID=e,this.log("setPeer peerID:",this.peerID,n,t,a);const r=t!=a,d=r?0:a,u=i&&Math.max(...Object.keys(this.bubbles).map(e=>+e)),h=this.chatInner;this.cleanup(),this.chatInner=document.createElement("div"),this.chatInner.id="bubbles-inner",this.scrollable.appendTo=this.chatInner,this.chatInner.className=h.className,this.chatInner.classList.add("disable-hover","is-scrolling"),i||this.lazyLoadQueue.clear(),this.lazyLoadQueue.lock();const{promise:p,cached:f}=this.getHistory(t,!0,r,d);return i?this.peerChanged=!0:g.default.setPeer(this.peerID),f||(this.scrollable.container.innerHTML="",i||this.finishPeerChange(),this.preloader.attach(this.bubblesContainer),F.mediaSizes.isMobile&&this.selectTab(1)),B.default.lockGroup("chat"),this.setPeerPromise=Promise.all([p.then(()=>{var s;if(f?(this.scrollable.container.innerHTML="",i||this.finishPeerChange(),F.mediaSizes.isMobile&&this.selectTab(1)):this.preloader.detach(),this.scrollable.container.append(this.chatInner),B.default.unlockGroup("chat"),B.default.checkAnimations(!1,"chat"),this.lazyLoadQueue.unlock(),n&&(o||t!=a)&&(this.bubbles[t]||this.firstUnreadBubble)){this.scrollable.scrollLocked&&(clearTimeout(this.scrollable.scrollLocked),this.scrollable.scrollLocked=0);const e=u>0&&(u<t||t<0),s=n.read_inbox_max_id==t&&!o;e||!i&&!s||(this.scrollable.scrollTop=this.scrollable.scrollHeight);const a=s&&this.firstUnreadBubble||this.bubbles[t];this.scrollable.scrollIntoView(a,i),s||this.highlightBubble(a)}else this.scrollable.scrollTop=this.scrollable.scrollHeight;return t&&!this.bubbles[a]&&t!=a||(this.scrolledAllDown=!0),this.log("scrolledAllDown:",this.scrolledAllDown),this.scrolledAllDown&&n&&c.default.readHistory(e,n.top_message),(null===(s=null==n?void 0:n.pFlags)||void 0===s?void 0:s.unread_mark)&&c.default.markDialogUnread(e,!0),this.chatInner.classList.remove("disable-hover","is-scrolling"),!0}).catch(e=>{throw this.log.error("getHistory promise error:",e),e})]).catch(e=>(this.log.error("setPeer promises error:",e),this.preloader.detach(),!1)).then(t=>(this.peerID==e&&(this.setPeerPromise=null),!!t)),g.default.setLoadMutex(this.setPeerPromise),g.default.loadSidebarMedia(!0),this.setPeerPromise}finishPeerChange(){if(this.peerChanged)return;let e=this.peerID;this.peerChanged=!0,this.avatarEl.setAttribute("peer",""+this.peerID);const t=u.default.isChannel(e),s=t&&_.default.hasRights(-e,"send");this.chatInner.classList.toggle("has-rights",s),this.chatInput.style.display=!t||s?"":"none",this.topbar.classList.remove("is-pinned-shown"),this.topbar.style.display="",this.chatInner.classList.toggle("is-chat",u.default.isAnyGroup(e)||e==this.myID),this.chatInner.classList.toggle("is-channel",t),this.btnMute.style.display=u.default.isBroadcast(e)?"":"none",this.menuButtons.mute.style.display=this.myID==this.peerID?"none":"";const i=c.default.getPinnedMessage(e);i&&!i.deleted?this.setPinnedMessage(i):this.pinnedMessageContainer&&(this.pinnedMessageContainer.remove(),this.pinnedMessageContainer=null),window.requestAnimationFrame(()=>{let e="";e=this.peerID==this.myID?"Saved Messages":u.default.getPeerTitle(this.peerID),this.titleEl.innerHTML=g.default.profileElements.name.innerHTML=e,this.goDownBtn.style.display="",this.setPeerStatus(!0)}),g.default.fillProfileElements(),l.$rootScope.$broadcast("peer_changed",this.peerID)}updateUnreadByDialog(e){let t=this.peerID==this.myID?e.read_inbox_max_id:e.read_outbox_max_id;for(let e of this.unreadOut)if(e>0&&e<=t){let t=this.bubbles[e];t&&(t.classList.remove("is-sent"),t.classList.add("is-read")),this.unreadOut.delete(e)}}deleteMessagesByIDs(e){e.forEach(e=>{if(!(e in this.bubbles))return;let t=this.bubbles[e];delete this.bubbles[e],this.firstUnreadBubble==t&&(this.firstUnreadBubble=null),this.bubbleGroups.removeBubble(t,e),this.unreadedObserver.unobserve(t),this.scrollable.removeElement(t)}),B.default.checkAnimations(!1,"chat"),this.deleteEmptyDateGroups()}renderNewMessagesByIDs(e,t=this.scrolledDown){this.scrolledAllDown?(e.forEach(e=>{let t=c.default.getMessage(e);this.renderMessage(t)}),this.messagesQueuePromise&&t&&(this.scrollable.scrollTo(this.scrollable.scrollHeight-1,!1,!0),this.messagesQueuePromise.then(()=>{this.log("messagesQueuePromise after:",this.chatInner.childElementCount,this.scrollable.scrollHeight),this.scrollable.scrollTo(this.scrollable.scrollHeight,!0,!0),setTimeout(()=>{this.log("messagesQueuePromise afterafter:",this.chatInner.childElementCount,this.scrollable.scrollHeight)},10)}))):this.log("seems search is active, skipping render:",e)}highlightBubble(e){e.dataset.timeout&&(clearTimeout(+e.dataset.timeout),e.classList.remove("is-selected"),e.offsetWidth),e.classList.add("is-selected"),e.dataset.timeout=""+setTimeout(()=>{e.classList.remove("is-selected"),delete e.dataset.timeout},2e3)}getDateContainerByMessage(e,t){const s=new Date(1e3*e.date);s.setHours(0,0,0);const i=s.getTime();if(!(i in this.dateMessages)){let e="";const n=new Date;if(n.setHours(0,0,0,0),n.getTime()==s.getTime())e="Today";else{e=["January","February","March","April","May","June","July","August","September","October","November","December"][s.getMonth()]+" "+s.getDate(),s.getFullYear()!=n.getFullYear()&&(e+=", "+s.getFullYear())}const a=document.createElement("div");a.className="bubble service is-date",a.innerHTML=`<div class="bubble__container"><div class="service-msg">${e}</div></div>`;const o=document.createElement("div");o.className="bubbles-date-group",this.dateMessages[i]={div:a,container:o,firstTimestamp:s.getTime()},o.append(a),t?this.scrollable.prepend(o,!1):this.scrollable.append(o,!1),this.stickyIntersector.observeStickyHeaderChanges(o)}return this.dateMessages[i]}renderMessagesQueue(e,t,s){let i=[];Array.from(t.querySelectorAll("img, video")).forEach(e=>{if(e instanceof HTMLVideoElement){let t=e.firstElementChild;if(!t||!t.src)return;if(e.readyState>=4)return}else if(e.complete||!e.src)return;e.src;let t=new Promise((t,s)=>{let i,n=()=>{clearTimeout(o),t(),e.removeEventListener("canplay",n),e.removeEventListener("load",n)};e instanceof HTMLVideoElement?(e.addEventListener("canplay",n),i=()=>e.readyState>=1):(e.addEventListener("load",n),i=()=>e.complete);let a=()=>i()?n():window.requestAnimationFrame(a);window.requestAnimationFrame(a);let o=setTimeout(()=>{t()},1500)});i.push(t)}),this.messagesQueue.push({message:e,bubble:t,reverse:s,promises:i}),this.messagesQueuePromise||(this.messagesQueuePromise=new Promise((e,t)=>{setTimeout(()=>{let s=this.chatInner,i=this.messagesQueue.slice();this.messagesQueue.length=0;let n=i.reduce((e,{promises:t})=>e.concat(t),[]);Promise.all(n).then(()=>{if(this.chatInner!=s)return t("chatInner changed!");this.messagesQueueOnRender&&this.messagesQueueOnRender(),i.forEach(({message:e,bubble:t,reverse:s})=>{let i=this.getDateContainerByMessage(e,s);s?i.container.insertBefore(t,i.div.nextSibling):i.container.append(t)}),e(),this.messagesQueuePromise=null},t)},0)}))}getMiddleware(){let e=this.cleanupID;return()=>this.cleanupID==e}renderMessage(e,t=!1,s=!1,i=null,n=!0){if(this.log.debug("message to render:",e),e.deleted)return;if(e.grouped_id){let t=c.default.groupedMessagesStorage[e.grouped_id],s=Math.max(...Object.keys(t).map(e=>+e));if(e.mid<s)return}let a,o=this.peerID,r=e.fromID==this.myID,h=document.createElement("div");if(h.classList.add("message"),i?(i.className="bubble",a=i.firstElementChild,a.innerHTML="",a.style.marginBottom="",i==this.firstUnreadBubble&&i.classList.add("is-first-unread")):(a=document.createElement("div"),a.classList.add("bubble__container"),(i=document.createElement("div")).classList.add("bubble"),i.appendChild(a),this.bubbles[+e.mid]=i),i.dataset.mid=e.mid,"messageService"==e._){let s=e.action,o=s._;if(-1!==$.indexOf(o))return i;i.className="bubble service";let r=u.default.getPeerTitle(e.fromID),d=document.createElement("div");d.classList.add("name"),d.dataset.peerID=e.fromID,d.innerHTML=r;let c="";if(s.message)c=f.RichTextProcessor.wrapRichText(s.message,{noLinebreaks:!0});else{"messageActionPhoneCall"==o&&(o+="."+s.type);let e=l.langPack[o];e||(e="["+o+"]"),c=e[0].toUpperCase()==e[0]?e:(d.innerText?d.outerHTML+" ":"")+e}return a.innerHTML=`<div class="service-msg">${c}</div>`,n&&this.renderMessagesQueue(e,i,t),i}let p=new Date(1e3*e.date),g=("0"+p.getHours()).slice(-2)+":"+("0"+p.getMinutes()).slice(-2);if(e.views&&(i.classList.add("channel-post"),g=l.formatNumber(e.views,1)+' <i class="tgico-channelviews"></i> '+g,!e.savedFrom)){let e=document.createElement("div");e.classList.add("bubble-beside-button","forward"),e.innerHTML='\n <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">\n <defs>\n <path d="M13.55 3.24L13.64 3.25L13.73 3.27L13.81 3.29L13.9 3.32L13.98 3.35L14.06 3.39L14.14 3.43L14.22 3.48L14.29 3.53L14.36 3.59L14.43 3.64L22.23 10.85L22.36 10.99L22.48 11.15L22.57 11.31L22.64 11.48L22.69 11.66L22.72 11.85L22.73 12.04L22.71 12.22L22.67 12.41L22.61 12.59L22.53 12.76L22.42 12.93L22.29 13.09L22.23 13.15L14.43 20.36L14.28 20.48L14.12 20.58L13.95 20.66L13.77 20.72L13.58 20.76L13.4 20.77L13.22 20.76L13.03 20.73L12.85 20.68L12.68 20.61L12.52 20.52L12.36 20.4L12.22 20.27L12.16 20.2L12.1 20.13L12.05 20.05L12.01 19.98L11.96 19.9L11.93 19.82L11.89 19.73L11.87 19.65L11.84 19.56L11.83 19.47L11.81 19.39L11.81 19.3L11.8 19.2L11.8 16.42L11 16.49L10.23 16.58L9.51 16.71L8.82 16.88L8.18 17.09L7.57 17.33L7.01 17.6L6.48 17.91L5.99 18.26L5.55 18.64L5.14 19.05L4.77 19.51L4.43 19.99L4.29 20.23L4.21 20.35L4.11 20.47L4 20.57L3.88 20.65L3.75 20.72L3.62 20.78L3.48 20.82L3.33 20.84L3.19 20.84L3.04 20.83L2.9 20.79L2.75 20.74L2.62 20.68L2.53 20.62L2.45 20.56L2.38 20.5L2.31 20.43L2.25 20.36L2.2 20.28L2.15 20.19L2.11 20.11L2.07 20.02L2.04 19.92L2.02 19.83L2.01 19.73L2 19.63L2.04 17.99L2.19 16.46L2.46 15.05L2.85 13.75L3.35 12.58L3.97 11.53L4.7 10.6L5.55 9.8L6.51 9.12L7.59 8.56L8.77 8.13L10.07 7.83L11.48 7.65L11.8 7.63L11.8 4.8L11.91 4.56L12.02 4.35L12.14 4.16L12.25 3.98L12.37 3.82L12.48 3.68L12.61 3.56L12.73 3.46L12.85 3.38L12.98 3.31L13.11 3.27L13.24 3.24L13.37 3.23L13.46 3.23L13.55 3.24Z" id="b13RmHDQtl"></path>\n </defs>\n <use xlink:href="#b13RmHDQtl" opacity="1" fill="#fff" fill-opacity="1"></use>\n </svg>',a.append(e)}e.edit_date&&(i.classList.add("is-edited"),g='<i class="edited">edited</i> '+g);let v=document.createElement("span");v.classList.add("time");let b,y,_=document.createElement("div");if(_.classList.add("inner","tgico"),_.innerHTML=g,e.grouped_id){let t=c.default.groupedMessagesStorage[e.grouped_id],s=0;for(let e in t){let i=t[e];if(i.message){if(++s>1)break;b=i.message,y=i.totalEntities}}s>1&&(b=void 0,y=void 0)}b||y||(b=e.message,y=e.totalEntities);let S=f.RichTextProcessor.wrapRichText(b,{entities:y}),M=e.media;if(y){let e=y.filter(e=>"messageEntityEmoji"==e._),t=b.length;if(e.reduce((e,t)=>e+t.length,0)==t&&e.length<=3){let t=T.default.getAnimatedEmojiSticker(b);if(1==e.length&&!M&&t)M={_:"messageMediaDocument",document:t};else{let t=document.createElement("div");t.classList.add("attachment"),t.innerHTML=S,i.classList.add("emoji-"+e.length+"x"),a.append(t)}i.classList.add("is-message-empty","emoji-big")}else h.innerHTML=S}else h.innerHTML=S;if(v.appendChild(_),h.append(v),a.prepend(h),e.reply_markup&&"replyInlineMarkup"==e.reply_markup._&&e.reply_markup.rows&&e.reply_markup.rows.length){const t=e.reply_markup.rows,s=document.createElement("div");s.classList.add("reply-markup"),t.forEach(t=>{const i=t.buttons;if(!i||!i.length)return;const n=document.createElement("div");n.classList.add("reply-markup-row"),i.forEach(t=>{const s=f.RichTextProcessor.wrapRichText(t.text,{noLinks:!0,noLinebreaks:!0});let i;switch(t._){case"keyboardButtonUrl":{const s=d.default.getUser(e.fromID),n=!(s&&s.pFlags&&s.pFlags.verified),a=f.RichTextProcessor.wrapUrl(t.url,n);i=document.createElement("a"),i.href=a,i.rel="noopener noreferrer",i.target="_blank",i.classList.add("is-link","tgico");break}default:i=document.createElement("button")}i.classList.add("reply-markup-button","rp"),i.innerHTML=s,L.ripple(i),n.append(i)}),s.append(n)}),s.addEventListener("click",s=>{let i=s.target;if(i.classList.contains("reply-markup-button")||(i=l.findUpClassName(i,"reply-markup-button")),!i)return;const n=l.whichChild(i),a=t[l.whichChild(i.parentElement)];if(!a.buttons||!a.buttons[n])return void this.log.warn("no such button",a,n,e);const o=a.buttons[n];X.default.callbackButtonClick(e.mid,o)});const i=45*t.length+"px";a.style.marginBottom=i,s.style.bottom="-"+i,a.prepend(s)}if(r){(e.pFlags.unread||e.mid<0)&&this.unreadOut.add(e.mid);let t="";t=e.mid<0?"is-sending":e.pFlags.unread?"is-sent":"is-read",i.classList.add(t)}else e.pFlags.unread&&(this.unreadedObserver.observe(i),this.unreaded.indexOf(e.mid)||this.unreaded.push(e.mid));const D=r&&(!e.fwd_from||this.peerID!=this.myID);if(M){let t=document.createElement("div");t.classList.add("attachment"),b||i.classList.add("is-message-empty");let s=!1;switch(M._){case"messageMediaPending":{let n=M,a=n.preloader;switch(n.type){case"album":this.log("will wrap pending album"),i.classList.add("hide-name","photo","is-album"),w.wrapAlbum({groupID:""+e.id,attachmentDiv:t,uploading:!0,isOut:!0});break;case"photo":{this.log("will wrap pending photo:",n,e,m.default.getPhoto(e.id));const s=!F.isAndroid;s&&i.classList.add("with-media-tail"),w.wrapPhoto(e.id,e,t,void 0,void 0,s,!0,this.lazyLoadQueue,null),i.classList.add("hide-name","photo");break}case"video":{let s=P.default.getDoc(e.id);this.log("will wrap pending video:",n,e,s);const o=!F.isAndroid&&!F.isApple&&"round"!=s.type;o&&i.classList.add("with-media-tail"),w.wrapVideo({doc:s,container:t,message:e,boxWidth:F.mediaSizes.active.regular.width,boxHeight:F.mediaSizes.active.regular.height,withTail:o,isOut:D,lazyLoadQueue:this.lazyLoadQueue,middleware:null}),a.attach(t,!1),i.classList.add("hide-name","video");break}case"audio":case"voice":case"document":{let t=P.default.getDoc(e.id);this.log("will wrap pending doc:",t);let o=w.wrapDocument(t,!1,!0,e.id);if("audio"==t.type||"voice"==t.type)o.preloader=a;else{let e=o.querySelector(".audio-download, .document-ico");a.attach(e,!1)}"voice"==n.type&&i.classList.add("bubble-audio"),i.classList.remove("is-message-empty"),h.classList.add((n.type||"document")+"-message"),h.append(o),s=!0;break}}break}case"messageMediaPhoto":{let s=M.photo;i.classList.add("hide-name","photo");const n=!F.isAndroid;n&&i.classList.add("with-media-tail"),e.grouped_id?(i.classList.add("is-album"),w.wrapAlbum({groupID:e.grouped_id,attachmentDiv:t,middleware:this.getMiddleware(),isOut:r,lazyLoadQueue:this.lazyLoadQueue})):w.wrapPhoto(s.id,e,t,void 0,void 0,n,D,this.lazyLoadQueue,this.getMiddleware());break}case"messageMediaWebPage":{s=!0;let t=M.webpage;if("webPageEmpty"==t._)break;i.classList.add("webpage");let n=document.createElement("div");n.classList.add("box","web");let o,r,l=document.createElement("div");l.classList.add("quote"),(t.photo||t.document)&&(o=document.createElement("div"),o.classList.add("preview-resizer"),r=document.createElement("div"),r.classList.add("preview"),o.append(r));let d=null;t.document&&(d=t.document,"gif"==d.type||"video"==d.type?(i.classList.add("video"),w.wrapVideo({doc:d,container:r,message:e,boxWidth:F.mediaSizes.active.webpage.width,boxHeight:F.mediaSizes.active.webpage.height,lazyLoadQueue:this.lazyLoadQueue,middleware:this.getMiddleware(),isOut:D})):d=null),o&&l.append(o);let c=document.createElement("div");if(c.classList.add("quote-text"),t.site_name){let e=document.createElement("a");e.classList.add("name"),e.setAttribute("target","_blank"),e.href=t.url||"#",e.innerHTML=f.RichTextProcessor.wrapEmojiText(t.site_name),c.append(e)}if(t.title){let e=document.createElement("div");e.classList.add("title"),e.innerHTML=f.RichTextProcessor.wrapRichText(t.title),c.append(e)}if(t.description){let e=document.createElement("div");e.classList.add("text"),e.innerHTML=f.RichTextProcessor.wrapRichText(t.description),c.append(e)}if(l.append(c),t.photo&&!d){i.classList.add("photo");const s=t.photo.sizes[t.photo.sizes.length-1];s.w==s.h&&c.childElementCount?i.classList.add("is-square-photo"):s.h>s.w&&i.classList.add("is-vertical-photo"),w.wrapPhoto(t.photo.id,e,r,F.mediaSizes.active.webpage.width,F.mediaSizes.active.webpage.height,!1,null,this.lazyLoadQueue,this.getMiddleware())}n.append(l),a.prepend(v,n);break}case"messageMediaDocument":{let n=M.document;if(n.sticker){i.classList.add("sticker"),n.animated&&i.classList.add("sticker-animated");let e=i.classList.contains("emoji-big")?140:200;m.default.setAttachmentSize(n,t,e,e,!0),a.style.height=t.style.height,a.style.width=t.style.width,w.wrapSticker({doc:n,div:t,middleware:this.getMiddleware(),lazyLoadQueue:this.lazyLoadQueue,group:"chat",play:!0,loop:!0,emoji:i.classList.contains("emoji-big")?b:void 0,withThumb:!0});break}if("video"==n.type||"gif"==n.type||"round"==n.type){if(i.classList.add("hide-name","round"==n.type?"round":"video"),e.grouped_id)i.classList.add("is-album"),w.wrapAlbum({groupID:e.grouped_id,attachmentDiv:t,middleware:this.getMiddleware(),isOut:r,lazyLoadQueue:this.lazyLoadQueue});else{const s=!F.isAndroid&&!F.isApple&&"round"!=n.type;s&&i.classList.add("with-media-tail"),w.wrapVideo({doc:n,container:t,message:e,boxWidth:F.mediaSizes.active.regular.width,boxHeight:F.mediaSizes.active.regular.height,withTail:s,isOut:D,lazyLoadQueue:this.lazyLoadQueue,middleware:this.getMiddleware()})}break}if("audio/ogg"==n.mime_type){let t=w.wrapDocument(n,!1,!1,e.mid);i.classList.remove("is-message-empty"),i.classList.add("bubble-audio"),h.append(t),s=!0;break}{let t=w.wrapDocument(n,!1,!1,e.mid);i.classList.remove("is-message-empty"),h.append(t),h.classList.add((n.type||"document")+"-message"),s=!0;break}}case"messageMediaContact":{let t=document.createElement("div");t.classList.add("contact"),t.dataset.peerID=""+M.user_id,h.classList.add("contact-message"),s=!0;let n=[];e.media.first_name&&n.push(f.RichTextProcessor.wrapEmojiText(e.media.first_name)),e.media.last_name&&n.push(f.RichTextProcessor.wrapEmojiText(e.media.last_name)),t.innerHTML=`\n <div class="contact-details">\n <div class="contact-name">${n.join(" ")}</div>\n <div class="contact-number">${e.media.phone_number?"+"+L.formatPhoneNumber(e.media.phone_number).formatted:"Unknown phone number"}</div>\n </div>`;let a=new k.default;a.setAttribute("peer",""+e.media.user_id),a.classList.add("contact-avatar"),t.prepend(a),i.classList.remove("is-message-empty"),h.append(t);break}case"messageMediaPoll":{i.classList.remove("is-message-empty");let t=w.wrapPoll(e.media.poll.id,e.mid);h.prepend(t);break}default:i.classList.remove("is-message-empty"),h.innerHTML="unrecognized media type: "+e.media._,h.append(v),this.log.warn("unrecognized media type:",e.media._,e)}s||a.append(t)}if(this.peerID<0&&!r||e.fwd_from||e.reply_to_mid){let t=u.default.getPeerTitle(e.fwdFromID||e.fromID);if(e.fwd_from&&!e.fwd_from.from_id&&!e.fwd_from.channel_id&&(t=f.RichTextProcessor.wrapEmojiText(e.fwd_from.from_name),i.classList.add("hidden-profile")),e.fwdFromID||e.fwd_from){if(this.peerID!=this.myID&&i.classList.add("forwarded"),e.savedFrom){let t=document.createElement("div");t.classList.add("bubble-beside-button","goto-original","tgico-next"),a.append(t),i.dataset.savedFrom=e.savedFrom}if(!i.classList.contains("sticker")){let s=document.createElement("div");s.classList.add("name"),s.dataset.peerID=e.fwdFromID,this.peerID==this.myID?(s.style.color=u.default.getPeerColorByID(e.fwdFromID,!1),s.innerHTML=t):s.innerHTML="Forwarded from "+t,a.append(s)}}else{if(e.reply_to_mid){let t=c.default.getMessage(e.reply_to_mid),s=u.default.getPeerTitle(t.fromID,!0)||"";"messageEmpty"==t._&&(c.default.wrapSingleMessage(e.reply_to_mid),this.needUpdate.push({replyMid:e.reply_to_mid,mid:e.mid}),s="Loading..."),t.mid?i.setAttribute("data-original-mid",t.mid):i.setAttribute("data-original-mid",e.reply_to_mid),a.append(w.wrapReply(s,t.message||"",t)),i.classList.add("is-reply")}if(!i.classList.contains("sticker")&&o<0&&o!=e.fromID){let s=document.createElement("div");s.classList.add("name"),s.innerHTML=t,s.style.color=u.default.getPeerColorByID(e.fromID,!1),s.dataset.peerID=e.fromID,a.append(s)}else i.classList.add("hide-name")}if(!r&&this.peerID<0&&(!u.default.isChannel(this.peerID)||u.default.isMegagroup(this.peerID))||this.peerID==this.myID&&!e.reply_to_mid){let t=new k.default;t.classList.add("user-avatar"),!e.fromID&&e.fwd_from&&e.fwd_from.from_name&&t.setAttribute("peer-title",e.fwd_from.from_name),t.setAttribute("peer",""+((e.fwd_from&&this.peerID==this.myID?e.fwdFromID:e.fromID)||0)),this.log("exec loadDialogPhoto",e),a.append(t)}}else i.classList.add("hide-name");return i.classList.add(D?"is-out":"is-in"),n?(this.bubbleGroups.addBubble(i,e,t),this.renderMessagesQueue(e,i,t)):this.bubbleGroups.updateGroupByMessageID(e.mid),i}performHistoryResult(e,t,s,i){e.length||(s?this.scrolledAllDown=!0:this.scrolledAll=!0),e=e.slice(),i&&e.unshift(i);let n=c.default.getDialogByPeerID(this.peerID)[0];if(n&&n.top_message)for(let t of e)if(t==n.top_message){this.scrolledAllDown=!0;break}return new Promise((s,i)=>{let n,a=(t?e.shift:e.pop).bind(e);for(this.scrollable.length>0&&t&&(this.messagesQueueOnRender=()=>{let e=this.scrollable.scrollTop;n=this.scrollable.scrollHeight-e,this.log("performHistoryResult: messagesQueueOnRender, scrollTop:",e,n),this.messagesQueueOnRender=void 0});e.length;){let e=c.default.getMessage(a());this.renderMessage(e,t,!0)}(this.messagesQueuePromise||Promise.resolve()).then(()=>{if(void 0!==n){const e=t?this.scrollable.scrollHeight-n:n;this.log("performHistoryResult: will set scrollTop",this.scrollable.scrollHeight,e,this.scrollable.container.clientHeight),F.touchSupport&&F.isApple&&(this.scrollable.container.style.overflow="hidden"),this.scrollable.scrollTop=e,F.touchSupport&&F.isApple&&(this.scrollable.container.style.overflow="")}s(!0)},i)}).then(()=>!0)}getHistory(e=0,t=!1,s=!1,i=0,n=!1){const a=this.peerID,o=m.default.windowH/38|0,r=Object.keys(this.bubbles).length>0?Math.max(40,o):o;let l=r;let d=0;s&&(d=l,t||(l=0,e+=1));const u=c.default.getHistory(this.peerID,e,l,d);let h,p;if(u instanceof Promise)p=!1,h=u.then(o=>(this.log("getHistory not cached result by maxID:",e,t,s,o,a),n?(this.scrollable.onScroll(),!0):this.peerID!=a?(this.log.warn("peer changed"),Promise.reject()):this.performHistoryResult(o.history||[],t,s,i)),e=>(this.log.error("getHistory error:",e),!1));else{if(n)return null;p=!0,this.log("getHistory cached result by maxID:",e,t,s,u,a),h=this.performHistoryResult(u.history||[],t,s,i)}return t?this.getHistoryTopPromise=h:this.getHistoryBottomPromise=h,h.finally(()=>{t?this.getHistoryTopPromise=void 0:this.getHistoryBottomPromise=void 0}),n?null:(h.then(()=>{let e;t?(this.loadedTopTimes++,this.loadedBottomTimes=Math.max(0,--this.loadedBottomTimes)):(this.loadedBottomTimes++,this.loadedTopTimes=Math.max(0,--this.loadedTopTimes)),(t&&this.loadedTopTimes>2||!t&&this.loadedBottomTimes>2)&&(e=Object.keys(this.bubbles).map(e=>+e).sort((e,t)=>e-t));const s=2*r;this.log("getHistory: slice loadedTimes:",t,o,this.loadedTopTimes,this.loadedBottomTimes,e&&e.length,s),e&&e.length>s&&(t?(e=e.slice(s),this.scrolledAllDown=!1):(e=e.slice(0,e.length-s),this.scrolledAll=!1,this.log("getHistory: slice bottom: to:",e.length,l)),this.log("getHistory: will slice ids:",e,t),this.deleteMessagesByIDs(e)),this.setUnreadDelimiter(),setTimeout(()=>{this.loadMoreHistory(!0,!0),this.loadMoreHistory(!1,!0)},0)}),{cached:p,promise:h})}setUnreadDelimiter(){if(this.attachedUnreadBubble)return;let e=c.default.getDialogByPeerID(this.peerID)[0];if(!(null==e?void 0:e.unread_count))return;let t=e.read_inbox_max_id;if(t=Object.keys(this.bubbles).filter(e=>!this.bubbles[e].classList.contains("is-out")).map(e=>+e).sort((e,t)=>e-t).find(e=>e>t),t&&this.bubbles[t]){let s=this.bubbles[t];this.firstUnreadBubble&&this.firstUnreadBubble!=s&&(this.firstUnreadBubble.classList.remove("is-first-unread"),this.firstUnreadBubble=null),t!=e.top_message&&s.classList.add("is-first-unread"),this.firstUnreadBubble=s,this.attachedUnreadBubble=!0}}deleteEmptyDateGroups(){for(let e in this.dateMessages){let t=this.dateMessages[e];2==t.container.childElementCount&&(t.container.remove(),this.stickyIntersector.unobserve(t.container,t.div),delete this.dateMessages[e])}}setMutedState(e=!1){g.default.profileElements.notificationsCheckbox.checked=!e,g.default.profileElements.notificationsStatus.innerText=e?"Disabled":"Enabled",u.default.isBroadcast(this.peerID)?(this.btnMute.classList.remove("tgico-mute","tgico-unmute"),this.btnMute.classList.add(e?"tgico-unmute":"tgico-mute"),this.btnMute.style.display=""):this.btnMute.style.display="none";const t=this.menuButtons.mute;t.classList.remove("tgico-mute","tgico-unmute"),t.classList.add(e?"tgico-unmute":"tgico-mute");let s=t.firstElementChild;t.innerText=e?"Unmute":"Mute",s&&t.appendChild(s)}mutePeer(e){let t={_:"inputNotifyPeer",peer:u.default.getInputPeerByID(e)},s={_:"inputPeerNotifySettings",flags:0,mute_until:0},i=c.default.getDialogByPeerID(e)[0],n=!0;i&&i.notify_settings&&(n=i.notify_settings.mute_until>(Date.now()/1e3|0)),n?s.flags|=2:(s.flags|=4,s.mute_until=2147483647),r.default.invokeApi("account.updateNotifySettings",{peer:t,settings:s}).then(e=>{this.handleUpdate({_:"updateNotifySettings",peer:t,notify_settings:s})})}handleUpdate(e){switch(e._){case"updateUserTyping":case"updateChatUserTyping":{if(this.myID==e.user_id)return;var t="updateUserTyping"==e._?e.user_id:-e.chat_id;this.typingUsers[e.user_id]=t,d.default.hasUser(e.user_id)||e.chat_id&&_.default.hasChat(e.chat_id)&&!_.default.isChannel(e.chat_id)&&h.default.getChatFull(e.chat_id),d.default.forceUserOnline(e.user_id);let s=c.default.getDialogByPeerID(t)[0],i=this.peerID==t;this.typingTimeouts[t]?clearTimeout(this.typingTimeouts[t]):s&&(p.default.setTyping(s,d.default.getUser(e.user_id)),i&&this.setPeerStatus()),this.typingTimeouts[t]=setTimeout(()=>{this.typingTimeouts[t]=0,delete this.typingUsers[e.user_id],s&&p.default.unsetTyping(s),this.setPeerStatus()},6e3);break}case"updateNotifySettings":{let{peer:t,notify_settings:s}=e;t=t.peer;let i=u.default.getPeerID(t),n=c.default.getDialogByPeerID(i)[0];if(n&&(n.notify_settings=s),i==this.peerID){let e=!!s.mute_until&&new Date(1e3*s.mute_until)>new Date;this.setMutedState(e)}break}}}}t.AppImManager=G;const V=new G;t.default=V},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=n(s(77));t.default=class{constructor(e,t,s,i){this.isAuthPage=t,this.onFirstMount=s,this.onMount=i,this.installed=!1,this.pageEl=document.body.getElementsByClassName(e)[0]}mount(...e){return i(this,void 0,void 0,(function*(){if(this.onMount&&this.onMount(...e),!this.installed){if(this.onFirstMount)try{const t=this.onFirstMount(...e);t instanceof Promise&&(yield t)}catch(e){console.error("PAGE MOUNT ERROR:",e)}this.installed=!0}a.default.setPage(this)}))}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationIntersector=void 0;const i=s(0),n=s(17);class a{constructor(){this.visible=new Set,this.byGroups={},this.lockedGroups={},this.intersectionLockedGroups={},this.observer=new IntersectionObserver(e=>{for(const t of e){const e=t.target;for(const s in this.byGroups){if(this.intersectionLockedGroups[s])continue;const i=this.byGroups[s].find(t=>t.el==e);if(i){t.isIntersecting?(this.visible.add(i),this.checkAnimation(i,!1)):(this.visible.delete(i),this.checkAnimation(i,!0),i.animation instanceof n.RLottiePlayer&&i.animation.clearCache());break}}}})}getAnimation(e){for(let t in this.byGroups)for(let s of this.byGroups[t])if(s.el==e)return s;return null}addAnimation(e,t=""){var s;const i={el:e instanceof n.RLottiePlayer?e.el:e,animation:e,group:t};(null!==(s=this.byGroups[t])&&void 0!==s?s:this.byGroups[t]=[]).push(i),this.observer.observe(i.el)}checkAnimations(e,t,s=!1){const i=t?[t]:Object.keys(this.byGroups);t&&!this.byGroups[t]&&(this.byGroups[t]=[]);for(const t of i){this.byGroups[t].forEach(t=>{this.checkAnimation(t,e,s)})}}checkAnimation(e,t=!1,s=!1){const{el:n,animation:a,group:o}=e;if(s||!i.isInDOM(n)&&!this.lockedGroups[o]){a.remove();for(const t in this.byGroups)this.byGroups[t].findAndSplice(t=>t==e);return this.observer.unobserve(n),void this.visible.delete(e)}t?a.paused||a.pause():a.paused&&this.visible.has(e)&&a.autoplay&&a.play()}lockGroup(e){this.lockedGroups[e]=!0}unlockGroup(e){delete this.lockedGroups[e],this.checkAnimations(void 0,e)}refreshGroup(e){const t=this.byGroups[e];t&&t.length&&(t.forEach(e=>{this.observer.unobserve(e.el)}),window.requestAnimationFrame(()=>{t.forEach(e=>{this.observer.observe(e.el)})}))}lockIntersectionGroup(e){this.intersectionLockedGroups[e]=!0}unlockIntersectionGroup(e){delete this.intersectionLockedGroups[e],this.refreshGroup(e)}}t.AnimationIntersector=a;const o=new a;t.default=o},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppProfileManager=void 0;const a=s(0),o=n(s(28)),r=n(s(10)),l=n(s(14)),d=n(s(5)),c=s(3),u=n(s(8)),h=n(s(27)),p=n(s(16)),f=n(s(2)),m=n(s(22)),g=s(1),v=n(s(34)),b=n(s(6));class y{constructor(){this.botInfos={},this.usersFull={},this.chatsFull={},this.chatFullPromises={},this.chatParticipantsPromises={},this.savedAvatarURLs={},a.$rootScope.$on("apiUpdate",e=>{let t=e.detail;switch(t._){case"updateChatParticipants":var s=t.participants;void 0!==(r=this.chatsFull[s.id])&&(r.participants=t.participants,a.$rootScope.$broadcast("chat_full_update",t.chat_id));break;case"updateChatParticipantAdd":if(void 0!==(r=this.chatsFull[t.chat_id])){for(var i=0,n=(s=r.participants.participants||[]).length;i<n;i++)if(s[i].user_id==t.user_id)return;s.push({_:"chatParticipant",user_id:t.user_id,inviter_id:t.inviter_id,date:a.tsNow(!0)}),r.participants.version=t.version,a.$rootScope.$broadcast("chat_full_update",t.chat_id)}break;case"updateChatParticipantDelete":var r;if(void 0!==(r=this.chatsFull[t.chat_id]))for(i=0,n=(s=r.participants.participants||[]).length;i<n;i++)if(s[i].user_id==t.user_id)return s.splice(i,1),r.participants.version=t.version,void a.$rootScope.$broadcast("chat_full_update",t.chat_id);break;case"updateChannelPinnedMessage":var l=t.channel_id,d=this.chatsFull[l];void 0!==d&&(d.pinned_msg_id=o.default.getFullMessageID(t.id,l),a.$rootScope.$broadcast("peer_pinned_message",-l))}}),a.$rootScope.$on("chat_update",e=>{let t=e.detail,s=this.chatsFull[t],i=r.default.getChat(t);if(!i.photo||!s)return;let n="chatPhotoEmpty"==i.photo._;if(s.chat_photo&&n!=("photoEmpty"==s.chat_photo._))return delete this.chatsFull[t],void a.$rootScope.$broadcast("chat_full_update",t);if(n)return;let o=i.photo.photo_small,d=l.default.choosePhotoSize(s.chat_photo,0,0);JSON.stringify(o)!==JSON.stringify(d.location)&&(delete this.chatsFull[t],a.$rootScope.$broadcast("chat_full_update",t))})}saveBotInfo(e){let t=e&&e.user_id;if(!t)return!1;let s={};return e.commands.forEach(e=>{s[e.command]=e.description}),this.botInfos[t]={id:t,version:e.version,shareText:e.share_text,description:e.description,commands:s}}getProfile(e,t){return this.usersFull[e]?Promise.resolve(this.usersFull[e]):f.default.invokeApi("users.getFullUser",{id:d.default.getUserInput(e)}).then(s=>(t&&t.phone_number?(s.user.phone=t.phone_number,(t.first_name||t.last_name)&&(s.user.first_name=t.first_name,s.user.last_name=t.last_name),d.default.saveApiUser(s.user)):d.default.saveApiUser(s.user,!0),s.profile_photo&&(s.profile_photo=l.default.savePhoto(s.profile_photo,{user_id:e})),void 0!==s.about&&(s.rAbout=c.RichTextProcessor.wrapRichText(s.about,{noLinebreaks:!0})),s.bot_info&&(s.bot_info=this.saveBotInfo(s.bot_info)),b.default.savePinnedMessage(e,s.pinned_msg_id),this.usersFull[e]=s))}getPeerBots(e){var t=[];return e>=0&&!d.default.isBot(e)||u.default.isChannel(e)&&!u.default.isMegagroup(e)?Promise.resolve(t):e>=0?this.getProfile(e).then(e=>{var s=e.bot_info;return s&&"botInfoEmpty"!=s._&&t.push(s),t}):this.getChatFull(-e).then(e=>(e.bot_info.forEach(e=>{t.push(this.saveBotInfo(e))}),t))}getChatFull(e){if(r.default.isChannel(e))return this.getChannelFull(e);if(void 0!==this.chatsFull[e]){var t=r.default.getChat(e);if(t.version==this.chatsFull[e].participants.version||t.pFlags.left)return Promise.resolve(this.chatsFull[e])}return void 0!==this.chatFullPromises[e]?this.chatFullPromises[e]:this.chatFullPromises[e]=f.default.invokeApi("messages.getFullChat",{chat_id:e}).then(t=>{r.default.saveApiChats(t.chats),d.default.saveApiUsers(t.users);const s=t.full_chat;return s&&s.chat_photo&&s.chat_photo.id&&(s.chat_photo=l.default.savePhoto(s.chat_photo)),b.default.savePinnedMessage(-e,s.pinned_msg_id),delete this.chatFullPromises[e],this.chatsFull[e]=s,a.$rootScope.$broadcast("chat_full_update",e),s})}getChatInviteLink(e,t){return this.getChatFull(e).then(s=>{if(!t&&s.exported_invite&&"chatInviteExported"==s.exported_invite._)return s.exported_invite.link;let i;return i=r.default.isChannel(e)?f.default.invokeApi("channels.exportInvite",{channel:r.default.getChannelInput(e)}):f.default.invokeApi("messages.exportChatInvite",{chat_id:e}),i.then(t=>(void 0!==this.chatsFull[e]&&(this.chatsFull[e].exported_invite=t),t.link))})}getChannelParticipants(e,t,s,i){s=s||200,i=i||0;let n=[e,(t=t||{_:"channelParticipantsRecent"})._,i,s].join("_"),o=this.chatParticipantsPromises[n];if("channelParticipantsRecent"==t._){let t=r.default.getChat(e);if(t&&t.pFlags&&(t.pFlags.kicked||t.pFlags.broadcast&&!t.pFlags.creator&&!t.admin_rights))return Promise.reject()}let l=n=>{let a=0;if(n){let e=[];n.forEach(t=>{e.push(t.user_id)}),e.sort((e,t)=>e-t),e.forEach(e=>{a=(20261*a+2147483648+e)%2147483648})}return f.default.invokeApi("channels.getParticipants",{channel:r.default.getChannelInput(e),filter:t,offset:i,limit:s,hash:a}).then(e=>"channels.channelParticipantsNotModified"==e._?n:(d.default.saveApiUsers(e.users),e.participants))},c=s=>{let n=r.default.getChat(e);if("channelParticipantsRecent"==t._&&!i&&!n.pFlags.kicked&&!n.pFlags.left){s=a.copy(s);let e,t=d.default.getSelf().id,i=s.findIndex(e=>e.user_id==t);-1!==i?(e=s[i],s.splice(i,1)):e={_:"channelParticipantSelf",user_id:t},s.unshift(e)}return s},u=a.tsNow();if(void 0!==o){let e=o[1];if(o[0]>u-6e4)return e;let t=e.then(e=>l(e).then(c));return this.chatParticipantsPromises[n]=[u,t],t}let h=l().then(c);return this.chatParticipantsPromises[n]=[u,h],h}getChannelFull(e,t){return void 0===this.chatsFull[e]||t?void 0!==this.chatFullPromises[e]?this.chatFullPromises[e]:this.chatFullPromises[e]=f.default.invokeApi("channels.getFullChannel",{channel:r.default.getChannelInput(e)}).then(t=>{r.default.saveApiChats(t.chats),d.default.saveApiUsers(t.users);let s=t.full_chat;return s&&s.chat_photo.id&&(s.chat_photo=l.default.savePhoto(s.chat_photo)),s.pinned_msg_id&&(s.pinned_msg_id=o.default.getFullMessageID(s.pinned_msg_id,e)),b.default.savePinnedMessage(-e,s.pinned_msg_id),delete this.chatFullPromises[e],this.chatsFull[e]=s,a.$rootScope.$broadcast("chat_full_update",e),s},t=>{switch(t.type){case"CHANNEL_PRIVATE":let t=r.default.getChat(e);t={_:"channelForbidden",access_hash:t.access_hash,title:t.title},h.default.processUpdateMessage({_:"updates",updates:[{_:"updateChannel",channel_id:e}],chats:[t],users:[]})}return Promise.reject(t)}):Promise.resolve(this.chatsFull[e])}invalidateChannelParticipants(e){delete this.chatsFull[e],delete this.chatFullPromises[e];for(let t in this.chatParticipantsPromises)+t.split("_")[0]==e&&delete this.chatParticipantsPromises[t];a.$rootScope.$broadcast("chat_full_update",e)}getChannelPinnedMessage(e){return this.getChannelFull(e).then(t=>{let s=t&&t.pinned_msg_id;return!!s&&p.default.get("pinned_hidden"+e).then(e=>o.default.getMessageLocalID(s)!=e&&s)})}hideChannelPinnedMessage(e,t){let s={};s["pinned_hidden"+e]=o.default.getMessageLocalID(t),p.default.set(s),a.$rootScope.$broadcast("peer_pinned_message",-e)}updateProfile(e,t,s){return f.default.invokeApi("account.updateProfile",{flags:7,first_name:e,last_name:t,about:s}).then(e=>{d.default.saveApiUser(e)})}uploadProfilePhoto(e){return f.default.invokeApi("photos.uploadProfilePhoto",{file:e}).then(e=>{d.default.saveApiUsers(e.users),f.default.getUserID().then(t=>{l.default.savePhoto(e.photo,{user_id:t}),h.default.processUpdateMessage({_:"updateShort",update:{_:"updateUserPhoto",user_id:t,date:a.tsNow(!0),photo:d.default.getUser(t).photo,previous:!0}})})})}updateUsername(e){return f.default.invokeApi("account.updateUsername",{username:e}).then(e=>{d.default.saveApiUser(e)})}removeFromAvatarsCache(e){this.savedAvatarURLs[e]&&delete this.savedAvatarURLs[e]}putPhoto(e,t,s=!1,n=""){var o;return i(this,void 0,void 0,(function*(){let i,r;t&&(i=u.default.getInputPeerByID(t),r=u.default.getPeerPhoto(t));let l=a.$rootScope.myID;if(t==l&&s)return e.firstChild&&e.firstChild.remove(),e.style.backgroundColor="",e.classList.add("tgico-savedmessages"),e.classList.remove("tgico-avatar_deletedaccount"),!0;if(t>0){let s=d.default.getUser(t);if(s&&s.pFlags&&s.pFlags.deleted)return e.firstChild&&e.firstChild.remove(),e.style.backgroundColor="",e.classList.add("tgico-avatar_deletedaccount"),!0}e.firstChild&&e.firstChild.remove();let c,h="";if(t&&t!=l&&(h=u.default.getPeerColorByID(t)),e.classList.remove("tgico-savedmessages","tgico-avatar_deletedaccount"),e.style.backgroundColor=h,n){const e=v.default.cleanSearchText(n,!1).split(" "),t=e.shift(),s=e.pop();c=t.charAt(0)+(s?s.charAt(0):"")}else c=null!==(o=u.default.getPeer(t).initials)&&void 0!==o?o:"";if(e.innerText=c.toUpperCase(),!r||r.empty||!r.photo_small)return!0;if(!this.savedAvatarURLs[t]){let e=yield m.default.downloadSmallFile({_:"inputPeerPhotoFileLocation",dc_id:r.dc_id,flags:0,peer:i,volume_id:r.photo_small.volume_id,local_id:r.photo_small.local_id});this.savedAvatarURLs[t]=URL.createObjectURL(e)}let p=new Image;return(yield g.renderImageFromUrl(p,this.savedAvatarURLs[t]))?(e.innerHTML="",e.append(p)):(p.classList.add("fade-in"),p.addEventListener("load",()=>{e.innerHTML="",e.append(p)})),!0}))}}t.AppProfileManager=y,t.default=new y},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApiFileManager=void 0;const a=s(11),o=n(s(79)),r=n(s(33)),l=n(s(2)),d=s(32),c=n(s(51)),u=s(7);class h{constructor(){this.cachedSavePromises={},this.cachedDownloadPromises={},this.cachedDownloads={},this.downloadPulls={},this.downloadActives={},this.log=u.logger("AFM")}downloadRequest(e,t,s){void 0===this.downloadPulls[e]&&(this.downloadPulls[e]=[],this.downloadActives[e]=0);const i=this.downloadPulls[e],n=new Promise((e,n)=>{i.push({cb:t,deferred:{resolve:e,reject:n},activeDelta:s})});return setTimeout(()=>{this.downloadCheck(e)},0),n}downloadCheck(e){const t=this.downloadPulls[e],s="upload"==e?11:24;if(this.downloadActives[e]>=s||!t||!t.length)return!1;const i=t.shift(),n=i.activeDelta||1;this.downloadActives[e]+=n,i.cb().then(t=>{this.downloadActives[e]-=n,this.downloadCheck(e),i.deferred.resolve(t)},t=>{t&&this.log.error("downloadCheck error:",t),this.downloadActives[e]-=n,this.downloadCheck(e),i.deferred.reject(t)})}getFileName(e,t){switch(e._){case"inputDocumentFileLocation":{let s=(e.file_name||"").split("."),i=s[s.length-1]||"";1!=(null==t?void 0:t.stickerType)||c.default.isSupported()||(i+=".png");let n=e.thumb_size?"_"+e.thumb_size:"";return(s[0]?s[0]+"_":"")+e.id+n+(i?"."+i:i)}default:{e.volume_id||e.file_reference||this.log.trace("Empty location",e);let s="jpg";return 1!=(null==t?void 0:t.stickerType)||c.default.isSupported()||(s+=".png"),e.volume_id?e.volume_id+"_"+e.local_id+"."+s:e.id+"_"+e.access_hash+"."+s}}}getTempFileName(e){const t=e.size||-1;return"_temp"+a.nextRandomInt(4294967295)+"_"+t}getCachedFile(e){if(!e)return!1;const t=this.getFileName(e);return this.cachedDownloads[t]||!1}getFileStorage(){return o.default}saveSmallFile(e,t){var s=this.getFileName(e);return this.cachedSavePromises[s]||(this.cachedSavePromises[s]=this.getFileStorage().saveFile(s,t).then(e=>this.cachedDownloads[s]=e,e=>{delete this.cachedSavePromises[s]})),this.cachedSavePromises[s]}downloadSmallFile(e,t={}){if(!r.default.isAvailable())return Promise.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});let s=!1;1!=t.stickerType||c.default.isSupported()||(s=!0,t.mimeType="image/png");let i=t.dcID||e.dc_id,n=t.mimeType||"image/jpeg",a=this.getFileName(e,t),o=this.cachedSavePromises[a]||this.cachedDownloadPromises[a];if(o)return o;let d=this.getFileStorage();return this.cachedDownloadPromises[a]=d.getFile(a).then(e=>this.cachedDownloads[a]=e).catch(()=>{let t=this.downloadRequest(i,()=>{let t=e;t._&&"fileLocation"!=t._||(t=Object.assign({},e,{_:"inputFileLocation"}));let s={flags:0,location:t,offset:0,limit:1048576};return l.default.invokeApi("upload.getFile",s,{dcID:i,fileDownload:!0,noErrorBox:!0})},i);return d.getFileWriter(a,n).then(e=>t.then(t=>{return(i=t.bytes,s?c.default.convertToPng(i):Promise.resolve(i)).then(t=>r.default.write(e,t).then(()=>this.cachedDownloads[a]=e.finalize()));var i}))})}getDownloadedFile(e){var t=this.getFileStorage(),s="string"!=typeof e?this.getFileName(e):e;return t.getFile(s)}downloadFile(e,t,s,n={}){if(!r.default.isAvailable())return Promise.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});let a=!1;1!=n.stickerType||c.default.isSupported()||(n.toFileEntry||s>524288?delete n.stickerType:(a=!0,n.mimeType="image/png"));const o=this.getFileName(t,n),u=n.toFileEntry||null,h=this.cachedSavePromises[o]||this.cachedDownloadPromises[o],p=this.getFileStorage();if(h)return u?h.then(e=>r.default.copy(e,u)):s?h.then(i=>i.size<s?(this.log("downloadFile need to deleteFile, wrong size:",i.size,s),this.deleteFile(o).then(()=>this.downloadFile(e,t,s,n)).catch(()=>this.downloadFile(e,t,s,n))):i):h;const f=d.deferredPromise(),m=n.mimeType||"image/jpeg";let g,v=!1,b=!1,y=e=>{f.reject(e),y=()=>{},!g||e&&"DOWNLOAD_CANCELED"==e.type||g.truncate(0)};return p.getFile(o).then(e=>i(this,void 0,void 0,(function*(){if(e.size<s)throw yield this.deleteFile(o),!1;u?r.default.copy(e,u).then(f.resolve,y):f.resolve(this.cachedDownloads[o]=e)}))).catch(()=>{(u?Promise.resolve(u):p.getFileWriter(o,m)).then(h=>{g=h;const p=n.limitPart||524288;let m,_,w=0,S=Promise.resolve();const L=(n.processPart,5);if(h.length){if(w=h.length,w>=s)return void(u?f.resolve():f.resolve(this.cachedDownloads[o]=h.finalize()));h.seek(w),f.notify({done:w,total:s})}const M=(e,t)=>i(this,void 0,void 0,(function*(){return n.processPart&&(yield n.processPart(e,t,D)),a?c.default.convertToPng(e):e})),D=[];for(m=w;m<s;m+=p)_=d.deferredPromise(),D.push({offset:m,writeFilePromise:S,writeFileDeferred:_}),S=_;if(n.processPart&&D.length>2){const e=D.splice(D.length-1,1)[0];D.splice(1,0,e)}let E=0;const I=()=>i(this,void 0,void 0,(function*(){const{offset:i,writeFilePromise:n,writeFileDeferred:a}=D.shift();try{const d=yield this.downloadRequest(e,()=>v?Promise.resolve():l.default.invokeApi("upload.getFile",{location:t,offset:i,limit:p},{dcID:e,fileDownload:!0}),2);D.length&&I();const c=yield M(d.bytes,i);if(v)return Promise.resolve();E+=p;const m=i+p>=s;if(f.notify({done:E,offset:i,total:s}),yield n,v)return Promise.resolve();yield r.default.write(h,c),a.resolve(),m&&(b=!0,u?f.resolve():f.resolve(this.cachedDownloads[o]=h.finalize()))}catch(e){y(e)}}));for(let e=0,t=Math.min(L,D.length);e<t;++e)I()})}),f.cancel=()=>{v||b||(v=!0,delete this.cachedDownloadPromises[o],y({type:"DOWNLOAD_CANCELED"}),u&&u.abort())},u||(this.cachedDownloadPromises[o]=f),f}deleteFile(e){return delete this.cachedDownloadPromises[e],delete this.cachedDownloads[e],delete this.cachedSavePromises[e],this.getFileStorage().deleteFile(e)}uploadFile(e){var t=e.size,s=t>=10485760,i=!1,n=!1,o=0,r=262144,d=2;t>67108864?(r=524288,d=4):t<102400&&(r=32768,d=1);var c=Math.ceil(t/r),u=[a.nextRandomInt(4294967295),a.nextRandomInt(4294967295)],h=0,p={_:s?"inputFileBig":"inputFile",id:u,parts:c,name:e instanceof File?e.name:"",md5_checksum:""};let f={notify:e=>{}},m=new Promise((e,t)=>{if(c>3e3)return t({type:"FILE_TOO_BIG"});f.resolve=e,f.reject=t});if(Object.assign(m,f),c>3e3)return m;let g=e=>{this.log.error("Up Error",e),m.reject(e),i=!0,g=()=>{}},v=s?"upload.saveBigFilePart":"upload.saveFilePart";for(let s=0;s<t;s+=r){let a=h++;this.downloadRequest("upload",()=>new Promise((d,h)=>{var f=new FileReader,b=e.slice(s,s+r);f.onloadend=e=>{i?h():e.target.readyState==FileReader.DONE?l.default.invokeApi(v,{file_id:u,file_part:a,file_total_parts:c,bytes:e.target.result},{startMaxLength:r+256,fileUpload:!0,singleInRequest:!0}).then(e=>{o++,d(),o>=c?(m.resolve(p),n=!0):m.notify({done:o*r,total:t})},g):this.log.error("wrong readyState!")},f.readAsArrayBuffer(b)}),d)}return m.cancel=()=>{this.log("cancel upload",i,n),i||n||(i=!0,g({type:"UPLOAD_CANCELED"}))},m}}t.ApiFileManager=h,t.default=new h},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0);t.default=class{constructor(e,t=!0){this.cancelable=t,this.preloader=null,this.circle=null,this.promise=null,this.tempID=0,this.detached=!0,this.preloader=document.createElement("div"),this.preloader.classList.add("preloader-container"),this.preloader.innerHTML='\n <div class="you-spin-me-round">\n <svg xmlns="http://www.w3.org/2000/svg" class="preloader-circular" viewBox="25 25 50 50">\n <circle class="preloader-path-new" cx="50" cy="50" r="23" fill="none" stroke-miterlimit="10"/>\n </svg>\n </div>',t?this.preloader.innerHTML+='\n <svg xmlns="http://www.w3.org/2000/svg" class="preloader-close" viewBox="0 0 20 20">\n <line x1="0" y1="20" x2="20" y2="0" stroke-width="2" stroke-linecap="round"></line>\n <line x1="0" y1="0" x2="20" y2="20" stroke-width="2" stroke-linecap="round"></line>\n </svg>':this.preloader.classList.add("preloader-swing"),this.circle=this.preloader.firstElementChild.firstElementChild.firstElementChild,e&&this.attach(e),this.cancelable&&this.preloader.addEventListener("click",()=>{this.promise&&this.promise.cancel&&(this.promise.cancel(),this.detach())})}attach(e,t=!0,s,i=!0){if(s){this.promise=s;let e=--this.tempID,t=()=>{s.notify=null,e==this.tempID&&(this.detach(),this.promise=s=null)};s.finally(t),s.notify=t=>{if(e!=this.tempID)return;let s=t.done/t.total*100;this.setProgress(s)}}this.cancelable&&t&&this.setProgress(0),this.detached=!1,window.requestAnimationFrame(()=>{this.detached||(this.detached=!1,e[i?"append":"prepend"](this.preloader))})}detach(){this.detached=!0,this.preloader.parentElement&&window.requestAnimationFrame(()=>{this.detached&&(this.detached=!0,this.preloader.parentElement&&this.preloader.parentElement.removeChild(this.preloader))})}setProgress(e){if(i.isInDOM(this.circle))if(0!=e)try{let t=this.circle.getTotalLength();this.circle.style.strokeDasharray=Math.max(5,e/100*t)+", 200"}catch(e){}else this.circle.style.strokeDasharray=""}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.wrapPoll=t.wrapAlbum=t.wrapReply=t.wrapSticker=t.wrapPhoto=t.wrapAudio=t.wrapDocument=t.formatDate=t.wrapVideo=void 0;const a=n(s(14)),o=n(s(2)),r=n(s(17)),l=n(s(12)),d=s(0),c=n(s(23)),u=n(s(46)),h=s(3),p=s(1),f=n(s(6)),m=s(55),g=n(s(56)),v=n(s(51)),b=s(4),y=n(s(20)),_=n(s(81)),w=n(s(54));function S({doc:e,container:t,message:s,boxWidth:n,boxHeight:o,withTail:r,isOut:d,middleware:h,lazyLoadQueue:f}){let m,g,v;if("round"!=e.type&&(m=document.createElement("span"),m.classList.add("video-time"),t.append(m),"gif"!=e.type?(m.innerText=(e.duration+"").toHHMMSS(!1),g=document.createElement("span"),g.classList.add("video-play","tgico-largeplay","btn-circle","position-center"),t.append(g)):m.innerText="GIF"),"video"==e.type)return D(e,s,t,n,o,r,d,f,h);if(r)v=M(e,s,t,n,o,d);else{if(n||o)(!t.firstElementChild||"IMG"!=t.firstElementChild.tagName&&"VIDEO"!=t.firstElementChild.tagName)&&a.default.setAttachmentSize(e,t,n,o);else{let s=e.thumbs;!e.downloaded&&s&&s[0].bytes&&a.default.setAttachmentPreview(s[0].bytes,t,!1)}v=t.lastElementChild,v&&"IMG"==v.tagName||t.append(v=new Image)}v&&v.classList.add("thumbnail");const b=document.createElement("video"),_=document.createElement("source");if(b.append(_),r){const e=v.parentElement;b.width=+e.getAttributeNS(null,"width"),b.height=+e.getAttributeNS(null,"height"),e.append(b)}else t.append(b);let S=()=>i(this,void 0,void 0,(function*(){let i;if(s.media.preloader)s.media.preloader.attach(t,void 0,void 0,!1);else if(!e.downloaded){const s=l.default.downloadVideo(e.id);new c.default(t,!0).attach(t,!0,s,!1);const n=yield s;n instanceof w.default&&(i=n.getURL())}if(i||(i=e.url),!h||h())if("gif"==e.type&&b.addEventListener("canplay",()=>{v&&v.parentElement&&v.remove(),y.default.addAnimation(b,"chat")},{once:!0}),p.renderImageFromUrl(_,i),_.type=e.mime_type,b.append(_),b.setAttribute("playsinline",""),"gif"==e.type)b.muted=!0,b.loop=!0,b.autoplay=!0;else if("round"==e.type){b.dataset.ckin="circle",b.dataset.overlay="1";new u.default(b)}}));return e.downloaded?S():f.push({div:t,load:S})}function L(e,t=!1,s){let i=new _.default;return i.setAttribute("doc-id",e.id),i.setAttribute("with-time",""+ +t),i.setAttribute("message-id",""+s),i}function M(e,t,s,i,n,o){let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.classList.add("bubble__media-container",o?"is-out":"is-in");let l=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");a.default.setAttachmentSize("document"==e._?e:e.id,l,i,n);let d=+l.getAttributeNS(null,"width"),c=+l.getAttributeNS(null,"height");r.setAttributeNS(null,"width",""+d),r.setAttributeNS(null,"height",""+c),r.setAttributeNS(null,"viewBox","0 0 "+d+" "+c),r.setAttributeNS(null,"preserveAspectRatio","none");let u="clip"+t.mid;r.dataset.clipID=u;let h=document.createElementNS("http://www.w3.org/2000/svg","defs"),p="";t.message||(p+=o?`\n <use href="#message-tail" transform="translate(${d-2}, ${c}) scale(-1, -1)"></use>\n <path />\n `:`\n <use href="#message-tail" transform="translate(2, ${c}) scale(1, -1)"></use>\n <path />\n `),h.innerHTML=`<clipPath id="${u}">${p}</clipPath>`,s.style.width=parseInt(s.style.width)-9+"px",s.classList.add("with-tail"),r.append(h,l),s.append(r);let f=l.firstElementChild;return f||l.append(f=new Image),f}function D(e,t,s,i=b.mediaSizes.active.regular.width,n=b.mediaSizes.active.regular.height,o=!0,r=!1,l,d,u=null){let h,f,m=a.default.getPhoto(e);if(o)h=M(m,t,s,i,n,r);else{if(u){let e=m.sizes;!m.downloaded&&e&&e[0].bytes&&a.default.setAttachmentPreview(e[0].bytes,s,!1)}else i&&n&&(u=a.default.setAttachmentSize(m,s,i,n,!1));h=s.lastElementChild,h&&"IMG"==h.tagName||s.append(h=new Image)}t.media.preloader?t.media.preloader.attach(s):m.downloaded||(f=new c.default(s,!1));let g=()=>{let t=a.default.preloadPhoto(e,u);return f&&f.attach(s,!0,t),t.then(()=>{d&&!d()||p.renderImageFromUrl(h||s,"photo"==m._?m.url:a.default.getDocumentCachedThumb(m.id).url)})};return m.downloaded?g():l.push({div:s,load:g,wasSeen:!0})}t.wrapVideo=S,t.formatDate=(e,t=!1,s=!0)=>{const i=new Date(1e3*e);let n=["January","February","March","April","May","June","July","August","September","Octomber","November","December"][i.getMonth()];t&&(n=n.slice(0,3));let a=n+" "+i.getDate();return s&&(a+=", "+i.getFullYear()),a+" at "+i.getHours()+":"+("0"+i.getMinutes()).slice(-2)},t.wrapDocument=function(e,s=!1,i=!1,n){if("audio"==e.type||"voice"==e.type)return L(e,s,n);let a=e.file_name?e.file_name.split("."):"",o="";o=a.length>1&&Array.isArray(a)?a.pop().toLowerCase():"file";let r=document.createElement("div");r.classList.add("document","ext-"+o);let u=o;"photo"==e.type&&(r.classList.add("photo"),u=`<img src="${URL.createObjectURL(e.file)}">`);let h=e.file_name||"Unknown.file",p=d.formatBytes(e.size);if(s&&(p+=" · "+t.formatDate(e.date)),r.innerHTML=`\n <div class="document-ico">${u}</div>\n ${i?"":'<div class="document-download"><div class="tgico-download"></div></div>'}\n <div class="document-name">${h}</div>\n <div class="document-size">${p}</div>\n `,!i){let t,s,i=r.querySelector(".document-download");r.addEventListener("click",()=>{if(s)i.classList.remove("downloading"),s=null;else{if(i.classList.contains("downloading"))return;t||(t=new c.default(null,!0)),l.default.saveDocFile(e.id).then(e=>{s=e.promise,t.attach(i,!0,s),s.then(()=>{i.classList.remove("downloading"),i.remove()})}),i.classList.add("downloading")}})}return r},t.wrapAudio=L,t.wrapPhoto=D,t.wrapSticker=function({doc:e,div:t,middleware:s,lazyLoadQueue:n,group:c,play:u,onlyThumb:h,emoji:f,width:m,height:g,withThumb:b,loop:y}){let _=e.sticker;if(m||(m=f?void 0:200),g||(g=f?void 0:200),2!=_||r.default.loaded||r.default.loadLottieWorkers(),!_)throw console.error("wrong doc for wrapSticker!",e),new Error("wrong doc for wrapSticker!");t.dataset.docID=e.id;const w=f?d.getEmojiToneIndex(f):-1;if(e.thumbs&&!t.firstElementChild&&(!e.downloaded||2==_)){let i=e.thumbs[0];if(i.bytes){let n=new Image;if(v.default.isSupported()||e.stickerThumbConverted?(p.renderImageFromUrl(n,a.default.getPreviewURLFromThumb(i,!0)),t.append(n)):v.default.convertToPng(i.bytes).then(o=>{s&&!s()||(i.bytes=o,e.stickerThumbConverted=!0,t.childElementCount||p.renderImageFromUrl(n,a.default.getPreviewURLFromThumb(i,!0)).then(()=>{t.childElementCount||t.append(n)}))}),h)return Promise.resolve()}else if(!h&&2==_&&b&&w<=0){let a=new Image,o=()=>l.default.downloadDocThumb(e,i.type).then(e=>{if(t.childElementCount||s&&!s())return;let i=p.renderImageFromUrl(a,e);r||i.then(()=>{t.childElementCount||t.append(a)})}),r=l.default.hasDownloadedThumb(e.id,i.type);r&&t.append(a),n&&!r?n.push({div:t,load:o,wasSeen:"chat"==c}):o()}}if(h&&e.thumbs){let i=e.thumbs[0],a=()=>l.default.downloadDocThumb(e,i.type).then(e=>{let i=new Image;p.renderImageFromUrl(i,e).then(()=>{s&&!s()||t.append(i)})});return n?(n.push({div:t,load:a}),Promise.resolve()):a()}let S=e.downloaded,L=()=>l.default.downloadDoc(e.id).then(n=>{if(!s||s())if(2==_){const e=new FileReader;e.addEventListener("loadend",e=>i(this,void 0,void 0,(function*(){const s=e.srcElement.result;let i=yield o.default.gzipUncompress(s,!0),n=yield r.default.loadAnimationWorker({container:t,loop:y&&!f,autoplay:u,animationData:JSON.parse(i),width:m,height:g},c,w);n.addListener("firstFrame",()=>{t.firstElementChild&&"IMG"==t.firstElementChild.tagName?t.firstElementChild.remove():n.canvas.classList.add("fade-in")},!0),f&&t.addEventListener("click",()=>{let e=r.default.getAnimation(t);e.paused&&e.restart()})}))),e.readAsArrayBuffer(n)}else if(1==_){let s=new Image;S||t.firstElementChild&&"IMG"==t.firstElementChild.tagName||(s.classList.add("fade-in-transition"),s.style.opacity="0",s.addEventListener("load",()=>{window.requestAnimationFrame(()=>{s.style.opacity=""})})),p.renderImageFromUrl(s,e.url).then(()=>{t.firstElementChild&&t.firstElementChild!=s&&t.firstElementChild.remove(),t.append(s)})}});return!n||e.downloaded&&2!=_?L():(n.push({div:t,load:L,wasSeen:"chat"==c&&2!=_}),Promise.resolve())},t.wrapReply=function(e,t,s,i){const n=i?"pinned-message":"reply",o=document.createElement("div");o.classList.add(n);const r=document.createElement("div");r.classList.add(n+"-border");const l=document.createElement("div");l.classList.add(n+"-content");const d=document.createElement("div");d.classList.add(n+"-title");const c=document.createElement("div");c.classList.add(n+"-subtitle"),d.innerHTML=e?h.RichTextProcessor.wrapEmojiText(e):"";const u=s&&s.media;if(u){if(c.innerHTML=s.rReply,u.photo||u.document&&-1!==["video"].indexOf(u.document.type)){let e=document.createElement("div");e.classList.add(n+"-media");let t=u.photo||u.document,s=t.sizes||t.thumbs;s&&s[0].bytes&&a.default.setAttachmentPreview(s[0].bytes,e,!1,!0),a.default.preloadPhoto(t,a.default.choosePhotoSize(t,32,32)).then(()=>{p.renderImageFromUrl(e,"photo"==t._?t.url:a.default.getDocumentCachedThumb(t.id).url)}),l.append(e),o.classList.add("is-media")}}else c.innerHTML=t?h.RichTextProcessor.wrapEmojiText(t):"";return l.append(d,c),o.append(r,l),o},t.wrapAlbum=function({groupID:e,attachmentDiv:t,middleware:s,uploading:i,lazyLoadQueue:n,isOut:o}){let r=[],l=f.default.groupedMessagesStorage[e];for(let e in l){let t=f.default.getMessage(+e),s=t.media.photo||t.media.document,i="photo"==s._?a.default.choosePhotoSize(s,480,480):{w:s.w,h:s.h};r.push({size:i,media:s,message:t})}let d=new m.Layouter(r.map(e=>({w:e.size.w,h:e.size.h})),b.mediaSizes.active.album.width,100,2).layout();for(let{geometry:e,sides:i}of d){let a=r.shift();if(!a){console.error("no item for layout!");continue}let{size:l,media:d,message:c}=a,u=document.createElement("div");u.classList.add("album-item"),u.dataset.mid=c.mid,u.style.width=e.width+"px",u.style.height=e.height+"px",u.style.top=e.y+"px",u.style.left=e.x+"px",i&m.RectPart.Right&&(t.style.width=e.width+e.x+"px"),i&m.RectPart.Bottom&&(t.style.height=e.height+e.y+"px"),i&m.RectPart.Left&&i&m.RectPart.Top&&(u.style.borderTopLeftRadius="inherit"),i&m.RectPart.Left&&i&m.RectPart.Bottom&&(u.style.borderBottomLeftRadius="inherit"),i&m.RectPart.Right&&i&m.RectPart.Top&&(u.style.borderTopRightRadius="inherit"),i&m.RectPart.Right&&i&m.RectPart.Bottom&&(u.style.borderBottomRightRadius="inherit"),"photo"==d._?D(d.id,c,u,0,0,!1,o,n,s,l):S({doc:c.media.document,container:u,message:c,boxWidth:0,boxHeight:0,withTail:!1,isOut:o,lazyLoadQueue:n,middleware:s}),t.append(u)}},t.wrapPoll=function(e,t){const s=new g.default;return s.setAttribute("poll-id",e),s.setAttribute("message-id",""+t),s}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Modes=t.App=void 0,t.App={id:1025907,hash:"452b0359b988148995f22ff0f4229750",version:"0.3.0",domains:[],baseDcID:2},t.Modes={test:location.search.indexOf("test=1")>0,debug:location.search.indexOf("debug=1")>0,http:!1,ssl:!0,multipleConnections:!0}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(1);const l=new(o(s(19)).default)("page-chats",!1,()=>{const e=Promise.resolve().then(()=>a(s(18)));return e.finally(()=>{Array.from(document.getElementsByClassName("btn-menu-toggle")).forEach(e=>{e.addEventListener("click",t=>{if(!e.classList.contains("btn-menu-toggle"))return!1;let s=e.querySelector(".btn-menu");t.cancelBubble=!0,e.classList.contains("menu-open")?(e.classList.remove("menu-open"),s.classList.remove("active")):r.openBtnMenu(s)})})}),e});t.default=l},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApiUpdatesManager=void 0;const n=i(s(2)),a=s(0),o=i(s(8)),r=i(s(5)),l=i(s(10)),d=s(7);class c{constructor(){this.updatesState={pendingPtsUpdates:[],pendingSeqUpdates:{},syncPending:!1,syncLoading:!0},this.channelStates={},this.attached=!1,this.log=d.logger("UPDATES",d.LogLevels.error)}popPendingSeqUpdate(){var e=this.updatesState.seq+1,t=this.updatesState.pendingSeqUpdates[e];if(!t)return!1;for(var s=t.updates,i=0,n=s.length;i<n;i++)this.saveUpdate(s[i]);return this.updatesState.seq=t.seq,t.date&&this.updatesState.date<t.date&&(this.updatesState.date=t.date),delete this.updatesState.pendingSeqUpdates[e],!this.popPendingSeqUpdate()&&this.updatesState.syncPending&&this.updatesState.syncPending.seqAwaiting&&this.updatesState.seq>=this.updatesState.syncPending.seqAwaiting&&(this.updatesState.syncPending.ptsAwaiting?delete this.updatesState.syncPending.seqAwaiting:(clearTimeout(this.updatesState.syncPending.timeout),this.updatesState.syncPending=!1)),!0}popPendingPtsUpdate(e){var t=e?this.getChannelState(e):this.updatesState;if(!t.pendingPtsUpdates.length)return!1;t.pendingPtsUpdates.sort((e,t)=>e.pts-t.pts);for(var s,i=t.pts,n=!1,a=0,o=0,r=t.pendingPtsUpdates.length;o<r;o++)(i+=(s=t.pendingPtsUpdates[o]).pts_count)>=s.pts&&(n=s.pts,a=o);if(!n)return!1;for(this.log("pop pending pts updates",n,t.pendingPtsUpdates.slice(0,a+1)),t.pts=n,o=0;o<=a;o++)s=t.pendingPtsUpdates[o],this.saveUpdate(s);return t.pendingPtsUpdates.splice(0,a+1),!t.pendingPtsUpdates.length&&t.syncPending&&(t.syncPending.seqAwaiting?delete t.syncPending.ptsAwaiting:(clearTimeout(t.syncPending.timeout),t.syncPending=!1)),!0}forceGetDifference(){this.updatesState.syncLoading||this.getDifference()}processUpdateMessage(e){var t={date:e.date,seq:e.seq,seqStart:e.seq_start};switch(e._){case"updatesTooLong":case"new_session_created":this.forceGetDifference();break;case"updateShort":this.processUpdate(e.update,t);break;case"updateShortMessage":case"updateShortChatMessage":var s=2&e.flags,i=e.from_id||(s?a.$rootScope.myID:e.user_id),n=e.chat_id?-e.chat_id:s?e.user_id:a.$rootScope.myID;this.processUpdate({_:"updateNewMessage",message:{_:"message",flags:e.flags,pFlags:e.pFlags,id:e.id,from_id:i,to_id:o.default.getOutputPeer(n),date:e.date,message:e.message,fwd_from:e.fwd_from,reply_to_msg_id:e.reply_to_msg_id,entities:e.entities},pts:e.pts,pts_count:e.pts_count},t);break;case"updatesCombined":case"updates":r.default.saveApiUsers(e.users),l.default.saveApiChats(e.chats),e.updates.forEach(e=>{this.processUpdate(e,t)});break;default:this.log.warn("Unknown update message",e)}}getDifference(){const e=this.updatesState;return e.syncLoading||(e.syncLoading=!0,e.pendingSeqUpdates={},e.pendingPtsUpdates=[]),e.syncPending&&(clearTimeout(e.syncPending.timeout),e.syncPending=!1),n.default.invokeApi("updates.getDifference",{pts:e.pts,date:e.date,qts:-1},{timeout:2147483647}).then(t=>{if("updates.differenceEmpty"==t._)return this.log("apply empty diff",t.seq),e.date=t.date,e.seq=t.seq,e.syncLoading=!1,a.$rootScope.$broadcast("stateSynchronized"),!1;r.default.saveApiUsers(t.users),l.default.saveApiChats(t.chats),t.other_updates.forEach(e=>{switch(e._){case"updateChannelTooLong":case"updateNewChannelMessage":case"updateEditChannelMessage":return void this.processUpdate(e)}this.saveUpdate(e)}),t.new_messages.forEach(t=>{this.saveUpdate({_:"updateNewMessage",message:t,pts:e.pts,pts_count:0})});const s=t.intermediate_state||t.state;e.seq=s.seq,e.pts=s.pts,e.date=s.date,"updates.differenceSlice"==t._?this.getDifference():(a.$rootScope.$broadcast("stateSynchronized"),e.syncLoading=!1)},()=>{e.syncLoading=!1})}getChannelDifference(e){var t=this.getChannelState(e);t.syncLoading||(t.syncLoading=!0,t.pendingPtsUpdates=[]),t.syncPending&&(clearTimeout(t.syncPending.timeout),t.syncPending=!1),n.default.invokeApi("updates.getChannelDifference",{channel:l.default.getChannelInput(e),filter:{_:"channelMessagesFilterEmpty"},pts:t.pts,limit:30},{timeout:2147483647}).then(s=>(t.pts=s.pts,"updates.channelDifferenceEmpty"==s._?(this.log("apply channel empty diff",s),t.syncLoading=!1,a.$rootScope.$broadcast("stateSynchronized"),!1):"updates.channelDifferenceTooLong"==s._?(this.log("channel diff too long",s),t.syncLoading=!1,delete this.channelStates[e],this.saveUpdate({_:"updateChannelReload",channel_id:e}),!1):(r.default.saveApiUsers(s.users),l.default.saveApiChats(s.chats),this.log("applying",s.other_updates.length,"channel other updates"),s.other_updates.forEach(e=>{this.saveUpdate(e)}),this.log("applying",s.new_messages.length,"channel new messages"),s.new_messages.forEach(e=>{this.saveUpdate({_:"updateNewChannelMessage",message:e,pts:t.pts,pts_count:0})}),this.log("apply channel diff",t.pts),void("updates.channelDifference"!=s._||s.pFlags.final?(this.log("finished channel get diff"),a.$rootScope.$broadcast("stateSynchronized"),t.syncLoading=!1):this.getChannelDifference(e)))),()=>{t.syncLoading=!1})}addChannelState(e,t){if(!t)throw new Error("Add channel state without pts "+e);return!(e in this.channelStates)&&(this.channelStates[e]={pts:t,pendingPtsUpdates:[],syncPending:!1,syncLoading:!1},!0)}getChannelState(e,t){return void 0===this.channelStates[e]&&this.addChannelState(e,t),this.channelStates[e]}processUpdate(e,t={}){var s=!1;switch(e._){case"updateNewChannelMessage":case"updateEditChannelMessage":s=-o.default.getPeerID(e.message.to_id);break;case"updateDeleteChannelMessages":s=e.channel_id;break;case"updateChannelTooLong":if(!((s=e.channel_id)in this.channelStates))return!1}var i,n,d=s?this.getChannelState(s,e.pts):this.updatesState;if(d.syncLoading)return!1;if("updateChannelTooLong"==e._)return(!d.lastPtsUpdateTime||d.lastPtsUpdateTime<a.tsNow()-1e4)&&this.getChannelDifference(s),!1;if("updateNewMessage"==e._||"updateEditMessage"==e._||"updateNewChannelMessage"==e._||"updateEditChannelMessage"==e._){var c=e.message,u=o.default.getPeerID(c.to_id),h=c.fwd_from||{},p=!1;if(c.from_id&&!r.default.hasUser(c.from_id,c.pFlags.post)&&(p="author")||h.from_id&&!r.default.hasUser(h.from_id,!!h.channel_id)&&(p="fwdAuthor")||h.channel_id&&!l.default.hasChat(h.channel_id,!0)&&(p="fwdChannel")||u>0&&!r.default.hasUser(u)&&(p="toPeer User")||u<0&&!l.default.hasChat(-u)&&(p="toPeer Chat"))return this.log.warn("Not enough data for message update",u,p,c),s&&l.default.hasChat(s)?this.getChannelDifference(s):this.forceGetDifference(),!1}else if(s&&!l.default.hasChat(s))return!1;if(e.pts){if(d.pts+(e.pts_count||0)<e.pts)return this.log.warn("Pts hole",d,e,s&&l.default.getChat(s)),d.pendingPtsUpdates.push(e),d.syncPending||(d.syncPending={timeout:setTimeout(()=>{s?this.getChannelDifference(s):this.getDifference()},5e3)}),d.syncPending.ptsAwaiting=!0,!1;if(e.pts>d.pts)d.pts=e.pts,i=!0,d.lastPtsUpdateTime=a.tsNow();else if(e.pts_count)return!1;s&&t.date&&this.updatesState.date<t.date&&(this.updatesState.date=t.date)}else if(!s&&t.seq>0){var f=t.seq,m=t.seqStart||f;if(m!=d.seq+1&&m>d.seq)return this.log.warn("Seq hole",d,d.syncPending&&d.syncPending.seqAwaiting),void 0===d.pendingSeqUpdates[m]&&(d.pendingSeqUpdates[m]={seq:f,date:t.date,updates:[]}),d.pendingSeqUpdates[m].updates.push(e),d.syncPending||(d.syncPending={timeout:setTimeout(()=>{this.getDifference()},5e3)}),(!d.syncPending.seqAwaiting||d.syncPending.seqAwaiting<m)&&(d.syncPending.seqAwaiting=m),!1;d.seq!=f&&(d.seq=f,t.date&&d.date<t.date&&(d.date=t.date),n=!0)}this.saveUpdate(e),i?this.popPendingPtsUpdate(s):n&&this.popPendingSeqUpdate()}saveUpdate(e){a.$rootScope.$broadcast("apiUpdate",e)}attach(e){this.attached||(this.attached=!0,n.default.setUpdatesProcessor(this.processUpdateMessage.bind(this)),e&&e.pts&&e.date&&e.seq?(Object.assign(this.updatesState,e),this.getDifference()):n.default.invokeApi("updates.getState",{},{noErrorBox:!0}).then(e=>{this.updatesState.seq=e.seq,this.updatesState.pts=e.pts,this.updatesState.date=e.date,setTimeout(()=>{this.updatesState.syncLoading=!1},1e3)}))}}t.ApiUpdatesManager=c,t.default=new c},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppMessagesIDsManager=void 0;class i{constructor(){this.channelLocals={},this.channelsByLocals={},this.channelCurLocal=0,this.fullMsgIDModulus=4294967296}getFullMessageID(e,t){if(!t||e<=0)return e;e=this.getMessageLocalID(e);var s=this.channelLocals[t];return s||(s=++this.channelCurLocal*this.fullMsgIDModulus,this.channelsByLocals[s]=t,this.channelLocals[t]=s),s+e}getMessageIDInfo(e){if(e<this.fullMsgIDModulus)return[e,0];var t=e%this.fullMsgIDModulus;return[t,this.channelsByLocals[e-t]]}getMessageLocalID(e){return e?e%this.fullMsgIDModulus:0}splitMessageIDsByChannels(e){var t,s,i,n,a={},o={};for(t=0;t<e.length;t++)s=e[t],void 0===a[n=(i=this.getMessageIDInfo(s))[1]]&&(a[n]=[],o[n]=[]),a[n].push(i[0]),o[n].push(s);return{msgIDs:a,mids:o}}}t.AppMessagesIDsManager=i,t.default=new i},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ServerTimeManager=void 0;const n=i(s(16)),a=s(0);class o{constructor(){this.timestampNow=a.tsNow(!0),this.midnightNoOffset=this.timestampNow-this.timestampNow%86400,this.midnightOffseted=new Date,this.midnightOffset=this.midnightNoOffset-Math.floor(+this.midnightOffseted/1e3),this.serverTimeOffset=0,this.timeParams={midnightOffset:this.midnightOffset,serverTimeOffset:this.serverTimeOffset},this.midnightOffseted.setHours(0,0,0,0),n.default.get("server_time_offset").then(e=>{e&&(this.serverTimeOffset=e,this.timeParams.serverTimeOffset=e)})}}t.ServerTimeManager=o,t.default=new o},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PopupPeer=t.PopupElement=void 0;const n=i(s(37)),a=s(1);class o{constructor(e,t,s={}){if(this.element=document.createElement("div"),this.container=document.createElement("div"),this.header=document.createElement("div"),this.title=document.createElement("div"),this.element.classList.add("popup"),this.element.className="popup"+(e?" "+e:""),this.container.classList.add("popup-container","z-depth-1"),this.header.classList.add("popup-header"),this.title.classList.add("popup-title"),this.header.append(this.title),s.closable&&(this.closeBtn=document.createElement("span"),this.closeBtn.classList.add("btn-icon","popup-close","tgico-close"),a.ripple(this.closeBtn),this.header.prepend(this.closeBtn),this.closeBtn.addEventListener("click",()=>{this.destroy()},{once:!0})),s.withConfirm&&(this.confirmBtn=document.createElement("button"),this.confirmBtn.classList.add("btn-primary"),this.confirmBtn.innerText=s.withConfirm,this.header.append(this.confirmBtn),a.ripple(this.confirmBtn)),this.container.append(this.header),s.body&&(this.body=document.createElement("div"),this.body.classList.add("popup-body"),this.container.append(this.body)),t&&t.length){const e=document.createElement("div");e.classList.add("popup-buttons");const s=t.map(e=>{const t=document.createElement("button");return t.className="btn"+(e.isDanger?" danger":""),t.innerHTML=e.text,a.ripple(t),e.callback?t.addEventListener("click",()=>{e.callback(),this.destroy()},{once:!0}):e.isCancel&&t.addEventListener("click",()=>{this.destroy()},{once:!0}),t});e.append(...s),this.container.append(e)}this.element.append(this.container)}show(){document.body.append(this.element),this.element.offsetWidth,this.element.classList.add("active")}destroy(){this.onClose&&this.onClose(),this.element.classList.remove("active"),setTimeout(()=>{this.element.remove(),this.onCloseAfterTimeout&&this.onCloseAfterTimeout()},1e3)}}t.PopupElement=o;t.PopupPeer=class extends o{constructor(e,t={}){super("popup-peer"+(e?" "+e:""),t.buttons),this.className=e;let s=new n.default;s.setAttribute("dialog","1"),s.setAttribute("peer",""+t.peerID),s.classList.add("peer-avatar"),this.title.innerText=t.title||"",this.header.prepend(s);let i=document.createElement("p");i.classList.add("popup-description"),i.innerHTML=t.description,this.container.insertBefore(i,this.header.nextElementSibling)}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=s(7);t.default=class{constructor(e=5,t=!1){this.parallelLimit=e,this.noObserver=t,this.lazyLoadMedia=[],this.inProcess=[],this.lockPromise=null,this.unlockResolve=null,this.log=n.logger("LL",n.LogLevels.error),this.intersectionLocked=!1,t||(this.observer=new IntersectionObserver(e=>{if(this.lockPromise)return;const t=e.filter(e=>e.isIntersecting);t.forEachReverse(e=>{const t=e.target;this.log("isIntersecting",t);const s=this.lazyLoadMedia.findAndSplice(e=>e.div==t);s&&(s.wasSeen=!0,this.lazyLoadMedia.unshift(s))}),t.length&&this.processQueue()}))}clear(){this.inProcess.length=0,this.lazyLoadMedia.length=0;for(let e of this.inProcess)this.lazyLoadMedia.push(e);this.observer&&this.observer.disconnect()}length(){return this.lazyLoadMedia.length+this.inProcess.length}lock(){this.lockPromise||(this.lockPromise=new Promise((e,t)=>{this.unlockResolve=e}))}unlock(){this.unlockResolve&&(this.lockPromise=null,this.unlockResolve(),this.unlockResolve=null)}processQueue(e){return i(this,void 0,void 0,(function*(){if(!(this.parallelLimit>0&&this.inProcess.length>=this.parallelLimit)&&(e?this.lazyLoadMedia.findAndSplice(t=>t==e):e=this.lazyLoadMedia.findAndSplice(e=>e.wasSeen),e)){this.inProcess.push(e),this.log("will load media",this.lockPromise,e);try{if(this.lockPromise){let e=performance.now();yield this.lockPromise,this.log("waited lock:",performance.now()-e)}yield e.load()}catch(e){this.log.error("loadMediaQueue error:",e)}this.noObserver||this.observer.unobserve(e.div),this.inProcess.findAndSplice(t=>t==e),this.log("loaded media",e),this.lazyLoadMedia.length&&this.processQueue()}}))}addElement(e){e.wasSeen?this.processQueue(e):(e.wasSeen=!1,this.observer&&this.observer.observe(e.div))}push(e){this.lazyLoadMedia.push(e),this.addElement(e)}unshift(e){this.lazyLoadMedia.unshift(e),this.addElement(e)}refresh(){const e=this.lazyLoadMedia;e&&e.length&&(e.forEach(e=>{this.observer.unobserve(e.div)}),window.requestAnimationFrame(()=>{e.forEach(e=>{this.observer.observe(e.div)})}))}lockIntersection(){this.intersectionLocked=!0}unlockIntersection(){this.intersectionLocked=!1,this.refresh()}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deferredPromise=t.secureRandom=void 0;const i=s(11),n=s(43);t.secureRandom=new n.SecureRandom,t.deferredPromise=function(){let e={notify:()=>{},isFulfilled:!1,isRejected:!1},t=new Promise((s,i)=>{e.resolve=e=>{t.isFulfilled||(t.isFulfilled=!0,s(e))},e.reject=(...e)=>{t.isRejected||(t.isRejected=!0,i(...e))}});return Object.assign(t,e),t},Object.defineProperty(Uint8Array.prototype,"hex",{get:function(){return i.bytesToHex([...this])},set:function(e){this.set(i.bytesFromHex(e))},enumerable:!0,configurable:!0}),Uint8Array.prototype.randomize=function(){return t.secureRandom.nextBytes(this),this},Uint8Array.prototype.concat=function(...e){return i.bufferConcats(this,...e)},Uint8Array.prototype.toString=function(){return String.fromCharCode.apply(null,[...this])},Uint8Array.prototype.toJSON=function(){return[...this]},Array.prototype.forEachReverse=function(e){for(var t=this.length-1;t>=0;--t)e(this[t],t,this)},Array.prototype.findAndSplice=function(e){let t=this.findIndex(e);return-1!==t?this.splice(t,1)[0]:void 0},String.prototype.toHHMMSS=function(e=!1){let t=parseInt(this+"",10),s=Math.floor(t/3600),i=Math.floor((t-3600*s)/60),n=t-3600*s-60*i;return s<10&&(s="0"+s),i<10&&(i=e?"0"+i:i),n<10&&(n="0"+n),i+":"+n}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=s(11);t.default=new class{constructor(){this.blobSupported=!0;try{n.blobConstruct([],"")}catch(e){this.blobSupported=!1}}isAvailable(){return this.blobSupported}copy(e,t){return this.write(t,e).then(()=>(console.log("copy success"),t),e=>{console.error("copy error 1:",e);try{t.truncate(0)}catch(e){console.error("copy error",e)}return Promise.reject(e)})}write(e,t){return"file"in t?t.file(t=>e.write(t)):t instanceof Blob?new Promise((s,i)=>{let n=new FileReader;n.onload=function(t){let n=t.target.result,a=new Uint8Array(n);e.write(a).then(s,i)},n.readAsArrayBuffer(t)}):e.write(t)}chooseSaveFile(e,t,s,i){throw new Error("no writer")}getFakeFileWriter(e,t){let s=[];return{write:e=>i(this,void 0,void 0,(function*(){if(!this.blobSupported)throw!1;s.push(e)})),truncate:()=>{s=[]},finalize:()=>{const i=n.blobConstruct(s,e);return t&&t(i),i}}}download(e,t,s){if(window.navigator&&void 0!==navigator.msSaveBlob)return window.navigator.msSaveBlob(e,s),!1;if(window.navigator&&"getDeviceStorage"in navigator){var i="sdcard";switch(t.split("/")[0]){case"video":i="videos";break;case"audio":i="music";break;case"image":i="pictures"}var n=navigator.getDeviceStorage(i).addNamed(e,"telegram/"+s);return n.onsuccess=function(){console.log("Device storage save result",this.result)},void(n.onerror=()=>{})}let a=URL.createObjectURL(e);var o=document.createElementNS("http://www.w3.org/1999/xhtml","a");o.href=a,o.download=s,o.dataset&&(o.dataset.downloadurl=["video/quicktime",s,a].join(":")),o.style.position="absolute",o.style.top="1px",o.style.left="1px",document.body.append(o);try{var r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(r)}catch(e){console.error("Download click error",e);try{o.click()}catch(e){window.open(a,"_blank")}}setTimeout(()=>{o.remove()},100)}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(4));let a=(()=>{class e{createIndex(){return{shortIndexes:{},fullTexts:{}}}cleanSearchText(t,s=!0){const i="%"==t.charAt(0);return t=t.replace(e.badCharsRe,"").replace(e.trimRe,""),s&&(t=t.replace(/[^A-Za-z0-9]/g,e=>{const t=n.default.LatinizeMap[e];return void 0!==t?t:e})),t=t.toLowerCase(),i&&(t="%"+t),t}cleanUsername(e){return e&&e.toLowerCase()||""}indexObject(e,t,s){if(void 0!==s.fullTexts[e])return!1;if(!(t=this.cleanSearchText(t)).length)return!1;const i=s.shortIndexes;s.fullTexts[e]=t,t.split(" ").forEach(t=>{let s,n,a=Math.min(t.length,3);for(n=1;n<=a;n++)s=t.substr(0,n),void 0===i[s]?i[s]=[e]:i[s].push(e)})}search(e,t){const s=t.shortIndexes,i=t.fullTexts,n=(e=this.cleanSearchText(e)).split(" ");let a,o,r,l,d,c=!1;for(o=0;o<n.length;o++){if(a=s[n[o].substr(0,3)],!a){c=[];break}(!1===c||c.length>a.length)&&(c=a)}for(a={},r=0;r<c.length;r++){for(d=!0,l=i[c[r]],o=0;o<n.length;o++)if(-1==l.indexOf(n[o])){d=!1;break}d&&(a[c[r]]=!0)}return a}}return e.badCharsRe=/[`~!@#$%^&*()\-_=+\[\]\\|{}'";:\/?.>,<]+/g,e.trimRe=/^\s+|\s$/g,e})();t.default=new a},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(3),a=i(s(6)),o=i(s(8)),r=i(s(2)),l=i(s(27)),d=s(0),c=s(7),u=i(s(5));const h=new class{constructor(){this.polls={},this.results={},this.log=c.logger("POLLS",c.LogLevels.error),d.$rootScope.$on("apiUpdate",e=>{let t=e.detail;this.handleUpdate(t)})}handleUpdate(e){switch(e._){case"updateMessagePoll":{this.log("updateMessagePoll:",e);let t=e.poll;if(!t)break;t=this.savePoll(t,e.results),d.$rootScope.$broadcast("poll_update",{poll:t,results:e.results});break}}}savePoll(e,t){const s=e.id;return this.polls[s]?(e=Object.assign(this.polls[s],e),this.saveResults(e,t),e):(this.polls[s]=e,e.rQuestion=n.RichTextProcessor.wrapEmojiText(e.question),e.rReply=n.RichTextProcessor.wrapEmojiText("📊")+" "+(e.rQuestion||"poll"),e.chosenIndexes=[],this.saveResults(e,t),e)}saveResults(e,t){var s;this.results[e.id]=t,e.chosenIndexes.length=0,(null===(s=null==t?void 0:t.results)||void 0===s?void 0:s.length)&&t.results.forEach((t,s)=>{var i;(null===(i=t.pFlags)||void 0===i?void 0:i.chosen)&&e.chosenIndexes.push(s)})}getPoll(e){return{poll:this.polls[e],results:this.results[e]}}sendVote(e,t){const s=a.default.getMessage(e),i=s.media.poll,n=t.map(e=>i.answers[e].option),d=o.default.getInputPeerByID(s.peerID),c=s.id;return r.default.invokeApi("messages.sendVote",{peer:d,msg_id:c,options:n}).then(e=>{this.log("sendVote updates:",e),l.default.processUpdateMessage(e)})}getResults(e){const t=a.default.getMessage(e),s=o.default.getInputPeerByID(t.peerID),i=t.id;return r.default.invokeApi("messages.getPollResults",{peer:s,msg_id:i}).then(e=>{l.default.processUpdateMessage(e),this.log("getResults updates:",e)})}getVotes(e,t,s,i=20){const n=a.default.getMessage(e),l=o.default.getInputPeerByID(n.peerID),d=n.id;let c=0;return t&&(c|=1),s&&(c|=2),r.default.invokeApi("messages.getPollVotes",{flags:c,peer:l,id:d,option:t,offset:s,limit:i}).then(e=>(this.log("getPollVotes messages:",e),u.default.saveApiUsers(e.users),e))}};t.default=h},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppStateManager=void 0;const n=i(s(16)),a=i(s(6)),o=i(s(28)),r=i(s(8)),l=i(s(10)),d=i(s(5)),c=i(s(27)),u=s(0),h=s(7);class p{constructor(){this.log=h.logger("STATE"),this.state={},this.peers={},this.loadSavedState()}loadSavedState(){return this.loaded?this.loaded:this.loaded=new Promise((e,t)=>{n.default.get("state").then(t=>{const{dialogs:s,allDialogsLoaded:i,peers:n,messages:r,contactsList:u,maxSeenMsgID:h,updates:p,filters:f}=t;if(this.state=t||{},this.state.peers=n||{},this.log("state res",s,r),h&&!o.default.getMessageIDInfo(h)[1]&&(a.default.maxSeenID=h),n)for(let e in n){let t=n[e];+e<0?l.default.saveApiChat(t):d.default.saveApiUser(t)}if(u&&Array.isArray(u)&&u.length&&(u.forEach(e=>{d.default.pushContact(e)}),d.default.contactsFillPromise=Promise.resolve(d.default.contactsList)),r){a.default.saveMessages(r);for(let e of r)e.media&&a.default.wrapSingleMessage(e.mid,!0)}if(i&&(a.default.dialogsStorage.allDialogsLoaded=i),f)for(const e in f)a.default.filtersStorage.saveDialogFilter(f[e],!1);s&&s.forEachReverse(e=>{a.default.saveConversation(e)}),c.default.attach(null!=p?p:null),e(t)}).catch(e).finally(()=>{setInterval(()=>this.saveState(),1e4)})})}getState(){return this.loadSavedState()}saveState(){var e,t;const s=[],i=[],o=this.peers;for(const n in a.default.dialogsStorage.byFolders){const l=a.default.dialogsStorage.getFolder(+n);for(let n of l){const l=a.default.historiesStorage[n.peerID],d=[].concat(null!==(e=null==l?void 0:l.pending)&&void 0!==e?e:[],null!==(t=null==l?void 0:l.history)&&void 0!==t?t:[]);n=u.copy(n);let c=0;for(const e of d){const t=a.default.getMessage(e);if(t.id>0){s.push(t),t.fromID!=n.peerID&&(o[t.fromID]=r.default.getPeer(t.fromID)),n.top_message=t.mid;break}t.pFlags&&t.pFlags.unread&&++c}c&&n.unread_count&&(n.unread_count-=c),i.push(n),o[n.peerID]=r.default.getPeer(n.peerID)}}const l=c.default.updatesState,h={seq:l.seq,pts:l.pts,date:l.date},p=[...d.default.contactsList];for(const e of p)o[e]||(o[e]=d.default.getUser(e));const f=a.default.filtersStorage.filters;n.default.set({state:Object.assign({},this.state,{dialogs:i,messages:s,allDialogsLoaded:a.default.dialogsStorage.allDialogsLoaded,peers:o,contactsList:p,filters:f,updates:h,maxSeenMsgID:a.default.maxSeenID})})}pushToState(e,t){this.state[e]=t}pushPeer(e){this.peers[e]=r.default.getPeer(e)}}t.AppStateManager=p;const f=new p;t.default=f},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(21));s(0).$rootScope.$on("avatar_update",e=>{let t=e.detail;n.default.removeFromAvatarsCache(t),Array.from(document.querySelectorAll('avatar-element[peer="'+t+'"]')).forEach(e=>{console.log("updating avatar:",e),e.update()})});class a extends HTMLElement{constructor(){super(),this.isDialog=!1}connectedCallback(){this.isDialog=!!this.getAttribute("dialog")}disconnectedCallback(){}static get observedAttributes(){return["peer","dialog","peer-title"]}attributeChangedCallback(e,t,s){"peer"==e?(this.peerID=+s,this.update()):"peer-title"==e?this.peerTitle=s:"dialog"==e&&(this.isDialog=!!+s)}update(){n.default.putPhoto(this,this.peerID,this.isDialog,this.peerTitle)}adoptedCallback(){}}t.default=a,customElements.define("avatar-element",a)},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppSidebarRight=void 0;const l=s(1),d=r(s(9)),c=s(0),u=r(s(6)),h=r(s(14)),p=r(s(8)),f=r(s(5)),m=r(s(21)),g=s(3),v=s(7),b=r(s(18)),y=r(s(53)),_=r(s(31)),w=s(24),S=a(s(39)),L=r(s(47)),M=s(4),D=r(s(58)),E=r(s(40)),I=r(s(20)),P=r(s(59)),C=r(s(41)),T=r(s(35)),k=s(56),X=r(s(15));let A=(e,t)=>{window.requestAnimationFrame(()=>{t.childElementCount>1&&t.firstElementChild.remove();let s=document.createElement("p");s.innerHTML=e,t.prepend(s),t.style.display=""})};const x=new class{constructor(){this.container=document.getElementById("stickers-container"),this.contentDiv=this.container.querySelector(".sidebar-content"),this.backBtn=this.container.querySelector(".sidebar-close-button"),this.setsDiv=this.contentDiv.firstElementChild,this.scrollable=new d.default(this.contentDiv,"y","STICKERS-SEARCH",void 0,void 0,2),this.scrollable.setVirtualContainer(this.setsDiv),this.lazyLoadQueue=new _.default,this.searchInput=new C.default("Search Stickers",e=>{this.search(e)}),this.backBtn.parentElement.append(this.searchInput.container),this.setsDiv.addEventListener("click",e=>{const t=c.findUpClassName(e.target,"sticker-set-sticker");if(t){const e=t.dataset.docID;return void b.default.chatInputC.sendMessageWithDocument(e)}const s=c.findUpClassName(e.target,"sticker-set");if(!s)return;const i=s.dataset.stickerSet,n=s.dataset.stickerSet,a=c.findUpClassName(e.target,"sticker-set-button");a?(e.preventDefault(),e.cancelBubble=!0,a.setAttribute("disabled","true"),E.default.getStickerSet({id:i,access_hash:n}).then(e=>{E.default.toggleStickerSet(e.set).then(t=>{t&&(a.innerText=e.set.installed_date?"Added":"Add",a.classList.toggle("gray",!!e.set.installed_date))}).finally(()=>{a.removeAttribute("disabled")})})):E.default.getStickerSet({id:i,access_hash:n}).then(e=>{new P.default(e.set).show()})})}onCloseAfterTimeout(){this.setsDiv.innerHTML="",this.searchInput.value="",I.default.checkAnimations(void 0,"STICKERS-SEARCH")}renderSet(e){const t=document.createElement("div");t.classList.add("sticker-set");const s=document.createElement("div");s.classList.add("sticker-set-header");const i=document.createElement("div");i.classList.add("sticker-set-details"),i.innerHTML=`\n <div class="sticker-set-name">${g.RichTextProcessor.wrapEmojiText(e.title)}</div>\n <div class="sticker-set-count">${e.count} stickers</div>\n `;const n=document.createElement("button");n.classList.add("btn-primary","sticker-set-button"),n.innerText=e.installed_date?"Added":"Add",e.installed_date&&n.classList.add("gray"),s.append(i,n);const a=document.createElement("div");a.classList.add("sticker-set-stickers");const o=Math.min(5,e.count);for(let e=0;e<o;++e){const e=document.createElement("div");e.classList.add("sticker-set-sticker"),a.append(e)}E.default.getStickerSet(e).then(e=>{for(let t=0;t<o;++t){const s=a.children[t];w.wrapSticker({doc:e.documents[t],div:s,lazyLoadQueue:this.lazyLoadQueue,group:"STICKERS-SEARCH",play:!0,loop:!0,width:68,height:68})}}),t.dataset.stickerSet=e.id,t.dataset.access_hash=e.access_hash,t.dataset.title=e.title,t.append(s,a),this.scrollable.append(t)}init(){R.selectTab(B.SLIDERITEMSIDS.stickers),R.toggleSidebar(!0).then(()=>{this.renderFeatured()})}renderFeatured(){return E.default.getFeaturedStickers().then(e=>{this.searchInput.value||(e=this.filterRendered("",e)).forEach(e=>{this.renderSet(e.set)})})}filterRendered(e,t){t=t.slice();return Array.from(this.setsDiv.children).forEachReverse(s=>{const i=s.dataset.stickerSet,n=t.findIndex(e=>e.set.id==i);-1!==n?t.splice(n,1):e&&s.dataset.title.toLowerCase().includes(e.toLowerCase())||s.remove()}),I.default.checkAnimations(void 0,"STICKERS-SEARCH"),t}search(e){return e?E.default.searchStickerSets(e,!1).then(t=>{this.searchInput.value==e&&(t=this.filterRendered(e,t)).forEach(e=>{this.renderSet(e.set)})}):this.renderFeatured()}},F=new class{constructor(){this.container=document.getElementById("poll-results-container"),this.contentDiv=this.container.querySelector(".sidebar-content"),this.resultsDiv=this.contentDiv.firstElementChild,this.scrollable=new d.default(this.contentDiv,"y","POLL-RESULTS",void 0,void 0,2)}cleanup(){this.resultsDiv.innerHTML="",this.pollID="",this.mid=0}onCloseAfterTimeout(){this.cleanup()}init(e,t){if(this.pollID==e&&this.mid==t)return;this.cleanup(),this.pollID=e,this.mid=t,R.selectTab(B.SLIDERITEMSIDS.pollResults);const s=T.default.getPoll(e),i=document.createElement("h3");i.innerHTML=s.poll.rQuestion;const n=s.results.results.map(e=>e.voters/s.results.total_voters*100);k.roundPercents(n);const a=document.createDocumentFragment();s.results.results.forEach((e,i)=>{if(!e.voters)return;const o=document.createElement("hr"),r=s.poll.answers[i],d=document.createElement("div");d.classList.add("poll-results-answer");const c=document.createElement("div");c.innerHTML=g.RichTextProcessor.wrapEmojiText(r.text);const u=document.createElement("div");u.innerText=Math.round(n[i])+"%",d.append(c,u);const h=document.createElement("ul");h.classList.add("poll-results-voters"),X.default.setListClickListener(h),h.style.minHeight=50*Math.min(e.voters,4)+"px",a.append(o,d,h);let p,f=4,m=!1,v=e.voters-4;const b=()=>{m||(m=!0,T.default.getVotes(t,r.option,p,f).then(e=>{e.votes.forEach(e=>{const{dom:t}=X.default.addDialog(e.user_id,h,!1,!1,void 0,!1);t.lastMessageSpan.parentElement.remove()}),p&&(v-=e.votes.length,y.lastElementChild.innerText=`Show ${Math.min(20,v)} more voter${v>1?"s":""}`),p=e.next_offset,f=20,v&&e.votes.length||y.remove()}).finally(()=>{m=!1}))};if(b(),v<=0)return;const y=document.createElement("div");y.classList.add("poll-results-more","show-more"),y.addEventListener("click",b),y.innerHTML=`<div class="tgico-down"></div><div>Show ${Math.min(20,v)} more voter${v>1?"s":""}</div>`,l.ripple(y),a.append(y)}),this.resultsDiv.append(i,a),R.toggleSidebar(!0).then(()=>{})}};let B=(()=>{class e extends D.default{constructor(){super(document.getElementById("column-right"),{[e.SLIDERITEMSIDS.stickers]:x,[e.SLIDERITEMSIDS.pollResults]:F}),this.profileElements={},this.sharedMedia={},this.loadSidebarMediaPromises={},this.loadedAllMedia={},this.sharedMediaTypes=["inputMessagesFilterContacts","inputMessagesFilterPhotoVideo","inputMessagesFilterDocument","inputMessagesFilterUrl","inputMessagesFilterMusic"],this.sharedMediaType="",this.sharedMediaSelected=null,this.lazyLoadQueue=new _.default,this.historiesStorage={},this.usedFromHistory={},this.log=v.logger("SR",v.LogLevels.error),this.peerID=0,this.scroll=null,this.prevTabID=-1,this.mediaDivsByIDs={},this.urlsToRevoke=[],this.loadMutex=Promise.resolve(),this.stickersTab=x,this.pollResultsTab=F,this.profileContainer=this.sidebarEl.querySelector(".profile-container"),this.profileContentEl=this.sidebarEl.querySelector(".profile-content"),this.contentContainer=this.sidebarEl.querySelector(".content-container"),this.profileElements={avatar:this.profileContentEl.querySelector(".profile-avatar"),name:this.profileContentEl.querySelector(".profile-name"),subtitle:this.profileContentEl.querySelector(".profile-subtitle"),bio:this.profileContentEl.querySelector(".profile-row-bio"),username:this.profileContentEl.querySelector(".profile-row-username"),phone:this.profileContentEl.querySelector(".profile-row-phone"),notificationsRow:this.profileContentEl.querySelector(".profile-row-notifications"),notificationsCheckbox:this.profileContentEl.querySelector("#profile-notifications"),notificationsStatus:this.profileContentEl.querySelector(".profile-row-notifications > p")},this.sharedMedia={contentMembers:this.profileContentEl.querySelector("#content-members"),contentMedia:this.profileContentEl.querySelector("#content-media"),contentDocuments:this.profileContentEl.querySelector("#content-docs"),contentLinks:this.profileContentEl.querySelector("#content-links"),contentAudio:this.profileContentEl.querySelector("#content-audio")},this.searchContainer=this.sidebarEl.querySelector("#search-private-container"),this.searchCloseBtn=this.searchContainer.querySelector(".sidebar-close-button"),this.searchInput=new C.default("Search"),this.searchCloseBtn.parentElement.append(this.searchInput.container),this.privateSearch=new S.default(this.searchContainer.querySelector(".chats-container"),this.searchInput,{messages:new S.SearchGroup("Private Search","messages")});let t=this.profileContentEl.querySelector(".content-container .tabs-container");this.profileTabs=this.profileContentEl.querySelector(".profile-tabs"),this.scroll=new d.default(this.profileContainer,"y","SR",void 0,400),this.scroll.onScrolledBottom=()=>{this.sharedMediaSelected&&this.sharedMediaSelected.childElementCount&&(this.log("onScrolledBottom will load media"),this.loadSidebarMedia(!0))},l.horizontalMenu(this.profileTabs,t,(e,t)=>{this.prevTabID!=e&&(this.sharedMediaType=this.sharedMediaTypes[e],this.sharedMediaSelected=t.firstElementChild,-1!=this.prevTabID&&this.profileTabs.offsetTop&&(this.scroll.scrollTop-=this.profileTabs.offsetTop),-1==this.prevTabID||this.sharedMediaSelected.childElementCount||this.loadSidebarMedia(!0),this.prevTabID=e)}),this.sidebarEl.querySelector(".sidebar-close-button").addEventListener("click",()=>{this.toggleSidebar(!1)}),this.searchCloseBtn.addEventListener("click",()=>{this.searchContainer.classList.remove("active"),this.privateSearch.reset()}),this.sharedMedia.contentMedia.addEventListener("click",e=>{let t=e.target,s=+t.dataset.mid;if(!s)return void this.log.warn("no messageID by click on target:",t);let i=u.default.getMessage(s),n=Object.keys(this.mediaDivsByIDs).map(e=>+e).sort((e,t)=>e-t),a=n.findIndex(e=>e==s),o=n.map(e=>({element:this.mediaDivsByIDs[e].firstElementChild,mid:e}));y.default.openMedia(i,t,!1,this.sidebarEl,o.slice(a+1).reverse(),o.slice(0,a).reverse(),!0)}),this.profileElements.notificationsCheckbox.addEventListener("change",()=>{b.default.mutePeer(this.peerID)})}beginSearch(){this.toggleSidebar(!0),this.searchContainer.classList.add("active"),this.privateSearch.beginSearch(this.peerID)}toggleSidebar(e){const t=this.sidebarEl.classList.contains("active");let s;if(void 0!==e?e?t||(s=!0):t&&(s=!0):s=!0,!s)return Promise.resolve();if(M.mediaSizes.isMobile)return b.default.selectTab(t?1:2),Promise.resolve();const i=()=>{this.sidebarEl.classList.toggle("active",e)};return new Promise((e,s)=>{const n=[],a=new IntersectionObserver(s=>{for(const e of s){const t=e.target;e.isIntersecting||n.push({element:t,height:t.scrollHeight})}for(const e of n)e.element.style.minHeight=e.height+"px",e.element.firstElementChild.style.display="none",e.element.style.width="1px";a.disconnect(),i(),setTimeout(()=>{for(const e of n)e.element.style.minHeight="",e.element.style.width="",e.element.firstElementChild.style.display="";t&&(L.default.close(),this.searchCloseBtn.click()),e()},200)});if(Object.keys(b.default.bubbles).length)for(const e in b.default.bubbles)a.observe(b.default.bubbles[e]);else i(),setTimeout(e,200)})}filterMessagesByType(e,t){let s=[];for(let t of e){let e=u.default.getMessage(t);e.media&&s.push(e)}let i=[];switch(t){case"inputMessagesFilterPhotoVideo":for(let e of s){let t=e.media.photo||e.media.document||e.media.webpage&&e.media.webpage.document;t&&("document"==t._&&"video"!=t.type||i.push(e))}break;case"inputMessagesFilterDocument":for(let e of s){if(!e.media.document||"voice"==e.media.document.type||"audio"==e.media.document.type)continue;let t=e.media.document;t.attributes&&t.attributes.find(e=>"documentAttributeSticker"==e._)||i.push(e)}break;case"inputMessagesFilterUrl":for(let e of s)e.media.webpage&&"webPageEmpty"!=e.media.webpage._&&i.push(e);break;case"inputMessagesFilterMusic":for(let e of s)e.media.document&&"audio"==e.media.document.type&&i.push(e)}return i}performSearchResult(e,t){return o(this,void 0,void 0,(function*(){const s=this.peerID,i=[],n=[];let a;switch(t){case"inputMessagesFilterPhotoVideo":a=this.sharedMedia.contentMedia;for(const t of e){const e=t.media.photo||t.media.document||t.media.webpage&&t.media.webpage.document,a=document.createElement("div");a.classList.add("media-item");const o="photo"==e._,r=o?h.default.getPhoto(e.id):null;let d;if(r)d=r.downloaded>0;else{const t=h.default.getDocumentCachedThumb(e.id);d=(null==t?void 0:t.downloaded)>0}if(!o){const t=document.createElement("span");t.classList.add("video-time"),a.append(t),"gif"!=e.type?t.innerText=(e.duration+"").toHHMMSS(!1):t.innerText="GIF"}const u=()=>h.default.preloadPhoto(o?e.id:e,h.default.choosePhotoSize(e,200,200)).then(()=>{if(c.$rootScope.selectedPeerID!=s)return void this.log.warn("peer changed");const t=r&&r.url||h.default.getDocumentCachedThumb(e.id).url;if(t){const e=l.renderImageFromUrl(v,t);g&&e.then(()=>{v.style.opacity=""})}});let p;const f=e.sizes||e.thumbs,m=!d&&f&&f[0].bytes;m&&(p=new Image,p.classList.add("media-image","thumbnail"),p.dataset.mid=""+t.mid,h.default.setAttachmentPreview(f[0].bytes,p,!1,!1),a.append(p));const g=!d||!m,v=new Image;if(v.dataset.mid=""+t.mid,v.classList.add("media-image"),g&&(v.style.opacity="0"),a.append(v),d||m){const t=new Promise((t,s)=>{(p||v).addEventListener("load",()=>{clearTimeout(i),t()});const i=setTimeout(()=>{this.log("did not loaded",p,e,d,f),s()},1e3)});n.push(t)}d?u():this.lazyLoadQueue.push({div:a,load:u}),i.push(a),this.mediaDivsByIDs[t.mid]=a}break;case"inputMessagesFilterDocument":a=this.sharedMedia.contentDocuments;for(let t of e){let e=w.wrapDocument(t.media.document,!0,!1,t.mid);i.push(e)}break;case"inputMessagesFilterUrl":a=this.sharedMedia.contentLinks;for(let t of e){let e=t.media.webpage,n=document.createElement("div"),a=document.createElement("div");if(a.classList.add("preview"),a.innerText=(e.title||e.description||e.url||e.display_url).slice(0,1),a.classList.add("empty"),e.photo){let t=()=>h.default.preloadPhoto(e.photo.id,h.default.choosePhotoSize(e.photo,60,60)).then(()=>{c.$rootScope.selectedPeerID==s?(a.classList.remove("empty"),a.innerText="",l.renderImageFromUrl(a,e.photo.url)):this.log.warn("peer changed")});this.lazyLoadQueue.push({div:a,load:t})}let o=e.rTitle||"",r=e.rDescription||"",d=g.RichTextProcessor.wrapRichText(e.url||"");o||(o=e.display_url.split("/",1)[0]),n.append(a),n.insertAdjacentHTML("beforeend",`\n <div class="title">${o}</button>\n <div class="subtitle">${r}</div>\n <div class="url">${d}</div>\n `),n.innerText.trim().length&&i.push(n)}break;case"inputMessagesFilterMusic":a=this.sharedMedia.contentAudio;for(let t of e){let e=w.wrapAudio(t.media.document,!0,t.mid);i.push(e)}break;default:console.warn("death is my friend",e)}if(this.loadMutex&&n.push(this.loadMutex),i.length){if(n.length&&(yield Promise.all(n),this.peerID!=s))return void this.log.warn("peer changed");a.append(...i)}if(a){let e=a.parentElement;e.lastElementChild.classList.contains("preloader")&&e.lastElementChild.remove()}}))}loadSidebarMedia(e=!1){var t;this.log("loadSidebarMedia",e,this.peerID,this.loadSidebarMediaPromises);let s=this.peerID,i=e?[this.sharedMediaType]:this.sharedMediaTypes;if(i=i.filter(e=>!this.loadedAllMedia[e]),!i.length)return;let n=3*(h.default.windowH/130|0),a=null!==(t=this.historiesStorage[s])&&void 0!==t?t:this.historiesStorage[s]={},o=i.map(e=>{var t;if(this.loadSidebarMediaPromises[e])return this.loadSidebarMediaPromises[e];let i=null!==(t=a[e])&&void 0!==t?t:a[e]=[];if(i.length&&this.usedFromHistory[e]<i.length){let t=[],s=this.usedFromHistory[e];do{let a=i.slice(s,s+n);this.log("loadSidebarMedia: will render from cache",s,i,a,n),s+=a.length,t.push(...this.filterMessagesByType(a,e))}while(t.length<n&&s<i.length);if(t.length>n){let e=t.length-n;t=t.slice(0,t.length-e),s-=e}return this.usedFromHistory[e]=s,t.length?this.performSearchResult(t,e):Promise.resolve()}let o=i[i.length-1]||0,r=!o&&u.default.historiesStorage[s]?u.default.historiesStorage[s].history.slice():[];return o=!o&&r.length?r[r.length-1]:o,this.log("loadSidebarMedia: search house of glass pre",e,r,o),this.loadSidebarMediaPromises[e]=u.default.getSearch(s,"",{_:e},o,n).then(t=>{if(r=r.concat(t.history),i.push(...r),this.log("loadSidebarMedia: search house of glass",e,t,r),c.$rootScope.selectedPeerID==s)return t.history.length<n&&(this.loadedAllMedia[e]=!0),this.usedFromHistory[e]=i.length,r.length?this.performSearchResult(this.filterMessagesByType(r,e),e):void 0;this.log.warn("peer changed")},e=>{this.log.error("load error:",e)}).then(()=>{this.loadSidebarMediaPromises[e]=null})});return Promise.all(o)}cleanup(){this.loadSidebarMediaPromises={},this.loadedAllMedia={},this.prevTabID=-1,this.mediaDivsByIDs={},this.lazyLoadQueue.clear(),this.sharedMediaTypes.forEach(e=>{this.usedFromHistory[e]=0}),this.sharedMediaType="inputMessagesFilterPhotoVideo"}cleanupHTML(){this.profileElements.bio.style.display="none",this.profileElements.phone.style.display="none",this.profileElements.username.style.display="none",this.profileElements.notificationsRow.style.display="",this.profileElements.notificationsCheckbox.checked=!0,this.profileElements.notificationsStatus.innerText="Enabled",this.urlsToRevoke.length&&(this.urlsToRevoke.forEach(e=>{URL.revokeObjectURL(e)}),this.urlsToRevoke.length=0),Object.keys(this.sharedMedia).forEach(e=>{if(this.sharedMedia[e].innerHTML="",!this.historiesStorage[this.peerID]||!this.historiesStorage[this.peerID][e]){let t=this.sharedMedia[e].parentElement;t.querySelector(".preloader")||l.putPreloader(t,!0)}}),this.profileTabs.firstElementChild.children[1].click()}setLoadMutex(e){this.loadMutex=e}setPeer(e){this.peerID=e,this.cleanup()}fillProfileElements(){let e=this.peerID=c.$rootScope.selectedPeerID;if(this.cleanupHTML(),this.profileElements.avatar.setAttribute("peer",""+e),e!=c.$rootScope.myID){p.default.getPeerUsername(e)&&A(p.default.getPeerUsername(e),this.profileElements.username);let t=u.default.getDialogByPeerID(e)[0];if(t){let e=!1;t.notify_settings&&t.notify_settings.mute_until&&(e=new Date(1e3*t.notify_settings.mute_until)>new Date),b.default.setMutedState(e)}}else window.requestAnimationFrame(()=>{this.profileElements.notificationsRow.style.display="none"});if(e>0){let t=f.default.getUser(e);t.phone&&e!=c.$rootScope.myID&&A(t.rPhone,this.profileElements.phone),m.default.getProfile(e,!0).then(t=>{this.peerID==e?t.rAbout&&e!=c.$rootScope.myID&&A(t.rAbout,this.profileElements.bio):this.log.warn("peer changed")})}else{let t=p.default.getPeer(e);m.default.getChatFull(t.id).then(t=>{this.peerID==e?t.about&&A(g.RichTextProcessor.wrapRichText(t.about),this.profileElements.bio):this.log.warn("peer changed")})}}}return e.SLIDERITEMSIDS={search:1,forward:2,stickers:3,pollResults:4},e})();t.AppSidebarRight=B;const R=new B;t.default=R},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SearchGroup=void 0;const n=i(s(15)),a=i(s(9)),o=i(s(28)),r=i(s(5)),l=i(s(8)),d=i(s(6)),c=s(0),u=s(1),h=i(s(10));t.SearchGroup=class{constructor(e,t,s=!0,i,a=!0){this.name=e,this.type=t,this.clearable=s,this.list=document.createElement("ul"),this.container=document.createElement("div"),i&&(this.container.className=i),e&&(this.nameEl=document.createElement("div"),this.nameEl.classList.add("search-group__name"),this.nameEl.innerText=e,this.container.append(this.nameEl)),this.container.classList.add("search-group","search-group-"+t),this.container.append(this.list),this.container.style.display="none",a&&n.default.setListClickListener(this.list)}clear(){this.container.style.display="none",this.clearable&&(this.list.innerHTML="")}setActive(){this.container.style.display=""}};t.default=class{constructor(e,t,s,i){this.container=e,this.searchInput=t,this.searchGroups=s,this.onSearch=i,this.minMsgID=0,this.loadedCount=-1,this.foundCount=-1,this.offsetRate=0,this.loadedContacts=!1,this.searchPromise=null,this.searchTimeout=0,this.query="",this.listsContainer=null,this.peerID=0,this.scrollable=new a.default(this.container),this.listsContainer=this.scrollable.container;for(let e in this.searchGroups)this.listsContainer.append(this.searchGroups[e].container);this.searchGroups.messages&&this.scrollable.setVirtualContainer(this.searchGroups.messages.list),this.searchInput.onChange=e=>{this.query=e,this.reset(!1),this.searchMore()},this.scrollable.onScrolledBottom=()=>{this.query.trim()&&(this.searchTimeout||(this.searchTimeout=setTimeout(()=>{this.searchMore(),this.searchTimeout=0},0)))}}reset(e=!0){e&&(this.searchInput.value="",this.query="",this.peerID=0),this.minMsgID=0,this.loadedCount=-1,this.foundCount=-1,this.offsetRate=0,this.loadedContacts=!1;for(let e in this.searchGroups)this.searchGroups[e].clear();this.searchPromise=null}beginSearch(e){e&&(this.peerID=e),this.searchInput.input.focus()}searchMore(){if(this.searchPromise)return this.searchPromise;const e=this.query;if(!e.trim())return void(this.onSearch&&this.onSearch(0));if(-1!=this.foundCount&&this.loadedCount>=this.foundCount)return Promise.resolve();const t=o.default.getMessageIDInfo(this.minMsgID)[0]||0;return this.peerID||t||this.loadedContacts||r.default.searchContacts(e,20).then(t=>{if(this.searchInput.value!=e)return;this.loadedContacts=!0;let s=(t,s,i=!1)=>{t.forEach(t=>{let a=l.default.getPeerID(t),o=l.default.getPeer(a),p=d.default.getDialogByPeerID(a)[0];p||(p={peerID:a,pFlags:{},peer:o});let{dialog:f,dom:m}=n.default.addDialog(p,s.list,!1);if(i&&(o.participants_count||o.participants)){let t=new RegExp(`(${c.escapeRegExp(e)})`,"gi");m.titleSpan.innerHTML=m.titleSpan.innerHTML.replace(t,"<i>$1</i>"),m.lastMessageSpan.innerText=h.default.getChatMembersString(-a)}else{let e=l.default.getPeerUsername(a);if(e)e="@"+e;else{let t=r.default.getUser(a);t&&t.phone&&(e="+"+u.formatPhoneNumber(t.phone).formatted)}m.lastMessageSpan.innerHTML="<i>"+e+"</i>"}}),t.length?s.setActive():s.clear()};s(t.my_results,this.searchGroups.contacts,!0),s(t.results,this.searchGroups.globalContacts)}),this.searchPromise=d.default.getSearch(this.peerID,e,null,t,20,this.offsetRate).then(s=>{if(this.searchPromise=null,this.searchInput.value!=e)return;console.log("input search result:",this.peerID,e,null,t,20,s);const{count:i,history:a,next_rate:o}=s;a[0]==this.minMsgID&&a.shift();this.searchGroups.messages.setActive(),a.forEach(t=>{const s=d.default.getMessage(t);let i=d.default.getDialogByPeerID(s.peerID)[0];i||(i={peerID:s.peerID,pFlags:{},peer:s.to_id});const{dialog:a,dom:o}=n.default.addDialog(i,this.scrollable,!1);n.default.setLastMessage(a,s,o,e)}),this.minMsgID=a[a.length-1],this.offsetRate=o,this.loadedCount+=a.length,-1==this.loadedCount&&(this.loadedCount=0),-1==this.foundCount&&(this.foundCount=i,this.onSearch&&this.onSearch(this.foundCount))}).catch(e=>{console.error("search error",e),this.searchPromise=null})}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=n(s(16)),o=n(s(2)),r=n(s(22)),l=n(s(12)),d=s(0);const c=new class{constructor(){this.documents={},this.stickerSets={},this.hashes={featured:{},search:{}},a.default.get("stickerSets").then(e=>{if(e){for(let t in e){let s=e[t];this.saveStickers(s.documents)}this.stickerSets=e}this.getStickerSet({id:"emoji",access_hash:""},{overwrite:!0})}),d.$rootScope.$on("apiUpdate",e=>{const t=e.detail;switch(t._){case"updateNewStickerSet":this.saveStickerSet(t.stickerset,t.stickerset.set.id),d.$rootScope.$broadcast("stickers_installed",t.stickerset.set)}})}saveSticker(e){return this.documents[e.id]?this.documents[e.id]:(e=l.default.saveDoc(e),this.documents[e.id]=e,e)}saveStickers(e){e.forEach((t,s)=>{e[s]=this.saveSticker(t)})}getSticker(e){return this.documents[e]}getStickerSet(e,t={}){var s;return i(this,void 0,void 0,(function*(){if(this.stickerSets[e.id]&&!t.overwrite&&(null===(s=this.stickerSets[e.id].documents)||void 0===s?void 0:s.length))return this.stickerSets[e.id];let i=o.default.invokeApi("messages.getStickerSet",{stickerset:this.getStickerSetInput(e)}),n=yield i;return this.saveStickerSet(n,e.id),n}))}getRecentStickers(){return i(this,void 0,void 0,(function*(){let e=yield o.default.invokeApi("messages.getRecentStickers",{flags:0,hash:0});return this.saveStickers(e.stickers),e}))}getAnimatedEmojiSticker(e){let t=this.stickerSets.emoji;if(t&&t.documents)return e=e.replace(/\ufe0f/g,"").replace(/🏻|🏼|🏽|🏾|🏿/g,""),t.documents.find(t=>t.stickerEmojiRaw==e)}saveStickerSet(e,t){const s={set:e.set,packs:e.packs,documents:e.documents};this.stickerSets[t]?Object.assign(this.stickerSets[t],s):this.stickerSets[t]=s,this.saveStickers(e.documents),this.saveSetsTimeout||(this.saveSetsTimeout=setTimeout(()=>{const e={};for(const t in this.stickerSets){const s=this.stickerSets[t];(s.set.installed_date||"emoji"==t)&&(e[t]=s)}a.default.set({stickerSets:e}),this.saveSetsTimeout=0},100))}getStickerSetThumb(e){var t;const s=e.thumb,i=e.thumb_dc_id,n=null===(t=e.pFlags)||void 0===t?void 0:t.animated;return r.default.downloadFile(i,{_:"inputStickerSetThumb",stickerset:this.getStickerSetInput(e),volume_id:s.location.volume_id,local_id:s.location.local_id},s.size,{stickerType:n?2:1,mimeType:n?"application/x-tgsticker":"image/webp"})}getStickerSetInput(e){return"emoji"==e.id?{_:"inputStickerSetAnimatedEmoji"}:{_:"inputStickerSetID",id:e.id,access_hash:e.access_hash}}getFeaturedStickers(){var e,t;return i(this,void 0,void 0,(function*(){const s=yield o.default.invokeApi("messages.getFeaturedStickers",{hash:(null===(e=this.hashes.featured)||void 0===e?void 0:e.hash)||0}),i=null!==(t=this.hashes.featured)&&void 0!==t?t:this.hashes.featured={};return"messages.featuredStickersNotModified"!=s._&&(i.hash=s.hash,i.result=s.sets),i.result.forEach(e=>{this.saveStickerSet({set:e.set,documents:[],packs:[]},e.set.id)}),i.result}))}toggleStickerSet(e){return i(this,void 0,void 0,(function*(){if(e.installed_date){if(yield o.default.invokeApi("messages.uninstallStickerSet",{stickerset:this.getStickerSetInput(e)}))return delete e.installed_date,d.$rootScope.$broadcast("stickers_deleted",e),!0}else{if(yield o.default.invokeApi("messages.installStickerSet",{stickerset:this.getStickerSetInput(e),archived:!1}))return e.installed_date=Date.now()/1e3|0,d.$rootScope.$broadcast("stickers_installed",e),!0}return!1}))}searchStickerSets(e,t=!0){var s,n;return i(this,void 0,void 0,(function*(){const i=t?1:0,a=yield o.default.invokeApi("messages.searchStickerSets",{flags:i,exclude_featured:t,q:e,hash:(null===(s=this.hashes.search[e])||void 0===s?void 0:s.hash)||0}),r=null!==(n=this.hashes.search[e])&&void 0!==n?n:this.hashes.search[e]={};"messages.foundStickerSetsNotModified"!=a._&&(r.hash=a.hash,r.result=a.sets),r.result.forEach(e=>{this.saveStickerSet({set:e.set,documents:[],packs:[]},e.set.id)});const l=[];for(let t in this.stickerSets){const{set:s}=this.stickerSets[t];s.title.toLowerCase().includes(e.toLowerCase())&&!r.result.find(e=>e.set.id==s.id)&&l.push({_:"stickerSetCovered",set:s,cover:null})}return r.result.concat(l)}))}cleanup(){return i(this,void 0,void 0,(function*(){yield a.default.remove("stickerSets")}))}};t.default=c},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t){this.prevValue="",this.timeout=0,this.onInput=()=>{if(!this.onChange)return;let e=this.input.value;e!=this.prevValue&&(this.prevValue=e,clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.onChange(e)},200))},this.onClearClick=()=>{this.value="",this.onChange&&this.onChange("")},this.container=document.createElement("div"),this.container.classList.add("input-search"),this.onChange=t,this.input=document.createElement("input"),this.input.type="text",this.input.placeholder=e,this.input.autocomplete=Math.random().toString(36).substring(7);const s=document.createElement("span");s.classList.add("tgico","tgico-search"),this.clearBtn=document.createElement("span"),this.clearBtn.classList.add("tgico","btn-icon","tgico-close"),this.input.addEventListener("input",this.onInput),this.clearBtn.addEventListener("click",this.onClearClick),this.container.append(this.input,s,this.clearBtn)}get value(){return this.input.value}set value(e){this.input.value=e,this.prevValue=e,clearTimeout(this.timeout)}remove(){clearTimeout(this.timeout),this.input.removeEventListener("input",this.onInput),this.clearBtn.removeEventListener("click",this.onClearClick)}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PopupAvatar=void 0;const n=i(s(83)),a=i(s(22));class o{constructor(){this.container=document.getElementById("popup-avatar"),this.input=this.container.querySelector("input"),this.cropContainer=this.container.querySelector(".crop"),this.closeBtn=this.container.querySelector(".popup-close"),this.image=new Image,this.cropper={crop:()=>{},removeHandlers:()=>{}},this.container.style.display="",this.cropContainer.append(this.image),this.input.addEventListener("change",e=>{var t=e.target.files[0];if(t){var s=new FileReader;s.onload=e=>{var t=e.target.result;this.image=new Image,this.cropContainer.append(this.image),this.image.src=t,this.image.onload=()=>{this.container.classList.remove("hide"),this.container.offsetWidth,this.container.classList.add("active"),this.cropper=n.default(this.image,this.canvas),this.input.value=""}},s.readAsDataURL(t)}},!1),this.container.querySelector(".btn-crop").addEventListener("click",()=>{this.cropper.crop(),this.closeBtn.click(),this.canvas.toBlob(e=>{this.blob=e,this.darkenCanvas(),this.resolve()},"image/jpeg",1)}),this.closeBtn.addEventListener("click",()=>{setTimeout(()=>{this.cropper.removeHandlers(),this.image&&this.image.remove(),this.container.classList.add("hide")},200)})}resolve(){this.onCrop(()=>a.default.uploadFile(this.blob))}open(e,t){this.canvas=e,this.onCrop=t,this.input.click()}darkenCanvas(){let e=this.canvas.getContext("2d");e.fillStyle="rgba(0, 0, 0, 0.3)",e.fillRect(0,0,this.canvas.width,this.canvas.height)}}t.PopupAvatar=o,t.default=new o},,function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(1),a=i(s(9)),o=s(3),r=i(s(4)),l=s(0),d=i(s(75)),c=i(s(100)),u=i(s(2)),h=i(s(19)),p=s(25);let f=null;const m=new h.default("page-sign",!0,()=>{p.Modes.test&&(r.default.Countries.push({name:"Test Country",phoneCode:"999 66",code:"TC",emoji:"🤔",pattern:"999 66 XXX XX"}),console.log("Added test country to list!"));const e=r.default.Countries.filter(e=>e.emoji).sort((e,t)=>e.name.localeCompare(t.name));let t=null;var s=m.pageEl.querySelector('input[name="countryCode"]'),i=s.parentElement,h=document.createElement("div");h.classList.add("select-wrapper","z-depth-3");var g=document.createElement("ul");h.appendChild(g);new a.default(h);let v=!1;m.pageEl.querySelector(".a-qr").addEventListener("click",()=>{c.default.mount()}),s.addEventListener("focus",(function(n){v?e.forEach(e=>{e.li.forEach(e=>e.style.display="")}):(e.forEach(e=>{v=!0;let t=e.emoji,s=[];e.phoneCode.split(" and ").forEach(i=>{let n=document.createElement("li");var a=document.createElement("span");let r=o.RichTextProcessor.wrapRichText(t);n.appendChild(a),a.outerHTML=r,n.append(e.name);var l=document.createElement("span");l.classList.add("phone-code"),l.innerText="+"+i,n.appendChild(l),s.push(n),g.append(n)}),e.li=s}),g.addEventListener("mousedown",(function(i){let n=i.target;"LI"!=n.tagName&&(n=l.findUpTag(n,"LI"));let a=n.childNodes[1].textContent,o=n.querySelector(".phone-code").innerText;s.value=a,t=e.find(e=>e.name==a),b.value=o,setTimeout(()=>b.focus(),0)}))),i.appendChild(h)})),s.addEventListener("blur",(function(e){i.removeChild(h),e.cancelBubble=!0}),{capture:!0}),s.addEventListener("keyup",(function(t){if(t.ctrlKey||"Control"==t.key)return!1;let s=this.value.toLowerCase(),i=[];e.forEach(e=>{let t=-1!==e.name.toLowerCase().indexOf(s);e.li.forEach(e=>e.style.display=t?"":"none"),t&&i.push(e)}),0==i.length&&e.forEach(e=>{e.li.forEach(e=>e.style.display="")})})),m.pageEl.querySelector(".arrow-down").addEventListener("mousedown",(function(e){e.cancelBubble=!0,e.preventDefault(),s.matches(":focus")?s.blur():s.focus()}));e.slice().sort((e,t)=>t.phoneCode.length-e.phoneCode.length);let b=m.pageEl.querySelector('input[name="phone"]');const y=b.nextElementSibling;b.addEventListener("input",(function(e){this.classList.remove("error"),y.innerText="Phone Number";let{formatted:i,country:a}=n.formatPhoneNumber(this.value);this.value=i?"+"+i:"";let o=a?a.name:"";o==s.value||t&&a&&t.phoneCode==a.phoneCode||(s.value=o,t=a),a||this.value.length-1>1?f.style.visibility="":f.style.visibility="hidden"})),b.addEventListener("keypress",(function(e){return f.style.visibility||"Enter"!=e.key?/\D/.test(e.key)?(e.preventDefault(),!1):void 0:f.click()})),f.addEventListener("click",(function(e){this.setAttribute("disabled","true"),this.textContent="PLEASE WAIT...",n.putPreloader(this);let t=b.value;u.default.invokeApi("auth.sendCode",{phone_number:t,api_id:p.App.id,api_hash:p.App.hash,settings:{_:"codeSettings",flags:0}}).then(e=>{console.log("got code",e),d.default.mount(Object.assign(e,{phone_number:t}))}).catch(e=>{switch(this.removeAttribute("disabled"),this.innerText="NEXT",e.type){case"PHONE_NUMBER_INVALID":y.innerText="Phone Number Invalid",b.classList.add("error");break;default:console.error("auth.sendCode error:",e),this.innerText=e.type}})}));u.default.invokeApi("help.getNearestDc").then(e=>(e.nearest_dc!=e.this_dc&&u.default.getNetworker(e.nearest_dc),e)).then(i=>{let n=e.find(e=>e.code==i.country);n&&(s.value.length||b.value.length||(s.value=n.name,t=n,b.value="+"+n.phoneCode.split(" and ").shift()))})},()=>{f||(f=m.pageEl.querySelector("button")),f.textContent="NEXT",f.removeAttribute("disabled")});t.default=m},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OpusDecodeController=void 0;const n=s(4),a=s(7);class o{constructor(){this.sampleRate=48e3,this.tasks=[],this.keepAlive=!1,this.log=a.logger("OPUS",a.LogLevels.error)}isPlaySupported(){if(void 0!==this.isPlaySupportedResult)return this.isPlaySupportedResult;const e=document.createElement("audio");return this.isPlaySupportedResult=!(!e.canPlayType||!e.canPlayType("audio/ogg;").replace(/no/,""))}loadWavWorker(){this.wavWorker||(this.wavWorker=new Worker("waveWorker.min.js"),this.wavWorker.addEventListener("message",e=>{const t=e.data;if(this.log("[WAV] got message:",t),t&&t.page){const e=t.page;this.onTaskEnd(this.tasks.shift(),e)}}))}loadWorker(){this.worker||(this.worker=new Worker("decoderWorker.min.js"),this.worker.addEventListener("message",e=>{const t=e.data;this.log("[DECODER] got message",t),"done"==t.type?(this.wavWorker.postMessage({command:"done"}),t.waveform&&(this.tasks[0].waveform=t.waveform)):this.wavWorker.postMessage({command:"encode",buffers:e.data},n.isSafari?void 0:t.map(e=>e.buffer))}))}setKeepAlive(e){this.keepAlive=e,this.keepAlive?(this.loadWorker(),this.loadWavWorker()):this.tasks.length||this.terminateWorkers()}onTaskEnd(e,t){t?(clearTimeout(e.timeout),e.callback.resolve({bytes:t,waveform:e.waveform})):e.callback.reject("timeout"),this.tasks.length&&this.executeNewTask(this.tasks[0]),this.terminateWorkers()}terminateWorkers(e=!1){(!this.keepAlive&&!this.tasks.length||e)&&(this.worker&&(this.worker.terminate(),this.worker=null),this.wavWorker&&(this.wavWorker.terminate(),this.wavWorker=null))}executeNewTask(e){this.worker.postMessage({command:"init",decoderSampleRate:this.sampleRate,outputBufferSampleRate:this.sampleRate}),this.wavWorker.postMessage({command:"init",wavBitDepth:16,wavSampleRate:this.sampleRate}),this.log("[DECODER] send decode"),this.worker.postMessage({command:"decode",pages:e.pages,waveform:e.withWaveform},n.isSafari?void 0:[e.pages.buffer]),e.timeout=setTimeout(()=>{this.log.error("decode timeout"),this.terminateWorkers(!0),this.tasks.length&&(this.loadWorker(),this.loadWavWorker()),this.onTaskEnd(this.tasks.shift())},1e4)}pushDecodeTask(e,t){return new Promise((s,i)=>{const n={pages:e,withWaveform:t,callback:{resolve:s,reject:i},timeout:0};this.loadWorker(),this.loadWavWorker(),1==this.tasks.push(n)&&this.executeNewTask(n)})}decode(e,t=!1){return i(this,void 0,void 0,(function*(){return this.pushDecodeTask(e,t).then(e=>{const t=new Blob([e.bytes],{type:"audio/wav"});return{url:URL.createObjectURL(t),waveform:e.waveform}})}))}}t.OpusDecodeController=o;const r=new o;t.default=r},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaProgressLine=void 0;class i{constructor(e,t=!1){this.media=e,this.duration=0,this.mousedown=!1,this.stopAndScrubTimeout=0,this.progressRAF=0,this.onLoadedData=()=>{this.duration=this.media.duration,this.seek.setAttribute("max",""+1e3*this.duration)},this.onEnded=()=>{this.setProgress()},this.onPlay=()=>{let e=()=>{this.setProgress(),this.progressRAF=this.media.paused?0:window.requestAnimationFrame(e)};this.progressRAF&&window.cancelAnimationFrame(this.progressRAF),this.progressRAF=window.requestAnimationFrame(e)},this.onMouseMove=e=>{this.mousedown&&this.scrub(e)},this.onMouseDown=e=>{this.media.pause(),this.scrub(e),this.stopAndScrubTimeout&&clearTimeout(this.stopAndScrubTimeout),this.stopAndScrubTimeout=setTimeout(()=>{!this.media.paused&&this.media.pause(),this.stopAndScrubTimeout=0},150),this.mousedown=!0},this.onMouseUp=e=>{this.stopAndScrubTimeout&&(clearTimeout(this.stopAndScrubTimeout),this.stopAndScrubTimeout=0),this.media.paused&&this.media.play(),this.mousedown=!1},this.container=document.createElement("div"),this.container.classList.add("media-progress"),this.filled=document.createElement("div"),this.filled.classList.add("media-progress__filled"),t&&(this.filledLoad=document.createElement("div"),this.filledLoad.classList.add("media-progress__filled","media-progress__loaded"),this.container.append(this.filledLoad));let s=this.seek=document.createElement("input");s.classList.add("media-progress__seek"),s.value="0",s.setAttribute("min","0"),s.setAttribute("max","0"),s.type="range",s.step="0.1",this.setSeekMax(),this.setListeners(),(!e.paused||e.currentTime>0)&&this.onPlay(),this.container.append(this.filled,s)}setLoadProgress(e){this.filledLoad.style.transform="scaleX("+e+")"}setSeekMax(){this.duration=this.media.duration,this.duration>0?this.onLoadedData():this.media.addEventListener("loadeddata",this.onLoadedData)}setProgress(){const e=this.media.currentTime,t=e/this.duration;this.filled.style.transform="scaleX("+t+")",this.seek.value=""+1e3*e}setListeners(){this.media.addEventListener("ended",this.onEnded),this.media.addEventListener("play",this.onPlay),this.container.addEventListener("mousemove",this.onMouseMove),this.container.addEventListener("mousedown",this.onMouseDown),this.container.addEventListener("mouseup",this.onMouseUp)}scrub(e){const t=e.offsetX/this.container.offsetWidth*this.duration;this.media.currentTime=t,this.onSeek&&this.onSeek(t);let s=t/this.duration;s=Math.max(0,Math.min(1,s)),this.filled.style.transform="scaleX("+s+")"}removeListeners(){this.media.removeEventListener("loadeddata",this.onLoadedData),this.media.removeEventListener("ended",this.onEnded),this.media.removeEventListener("play",this.onPlay),this.container.removeEventListener("mousemove",this.onMouseMove),this.container.removeEventListener("mousedown",this.onMouseDown),this.container.removeEventListener("mouseup",this.onMouseUp),this.onSeek=null,this.stopAndScrubTimeout&&clearTimeout(this.stopAndScrubTimeout),this.progressRAF&&window.cancelAnimationFrame(this.progressRAF)}}t.MediaProgressLine=i;t.default=class{constructor(e,t=!1,s=!1){var n;if(this.video=e,this.wrapper=document.createElement("div"),this.wrapper.classList.add("ckin__player"),e.parentNode.insertBefore(this.wrapper,e),this.wrapper.appendChild(e),this.skin=null!==(n=e.dataset.ckin)&&void 0!==n?n:"default",this.stylePlayer(),"default"==this.skin){let t=this.wrapper.querySelector(".default__controls.ckin__controls");this.progress=new i(e,s),t.prepend(this.progress.container)}t&&this.wrapper.querySelector(".toggle").click()}stylePlayer(){let e=this.wrapper,t=this.video,s=this.skin;e.classList.add(s);let i=this.buildControls();e.insertAdjacentHTML("beforeend",i);let n=0,a=0,o=0;if("default"===s){var r=e.querySelectorAll(".toggle"),l=e.querySelector(".fullscreen"),d=e.querySelector("#time-elapsed");(p=e.querySelector("#time-duration")).innerHTML=String(0|t.duration).toHHMMSS(),Array.from(r).forEach(e=>e.addEventListener("click",()=>{this.togglePlay()})),t.addEventListener("click",()=>{this.togglePlay()}),t.addEventListener("play",()=>{this.updateButton(r)}),t.addEventListener("pause",()=>{this.updateButton(r),clearInterval(n)}),t.addEventListener("dblclick",()=>this.toggleFullScreen(l)),l.addEventListener("click",e=>this.toggleFullScreen(l));let s=()=>this.onFullScreen();"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange".split(" ").forEach(t=>{e.addEventListener(t,s,!1)})}if("circle"===s){let s=document.createElement("div");s.classList.add("circle-time-left"),t.parentNode.insertBefore(s,t),s.innerHTML='<div class="circle-time"></div><div class="iconVolume tgico-nosound"></div>';var c=e.querySelector(".progress-ring__circle"),u=c.r.baseVal.value,h=2*Math.PI*u,p=e.querySelector(".circle-time"),f=e.querySelector(".iconVolume");c.style.strokeDasharray=h+" "+h,c.style.strokeDashoffset=""+h,c.addEventListener("click",()=>{this.togglePlay()}),t.addEventListener("play",()=>{f.style.display="none",n=setInterval(()=>{t.currentTime!=o&&(a=t.currentTime,o=t.currentTime);let e=h-a/t.duration*h;c.style.strokeDashoffset=""+e,t.paused&&clearInterval(n)},20)}),t.addEventListener("pause",()=>{f.style.display=""})}t.duration>0?p.innerHTML=String(Math.round(t.duration)).toHHMMSS():t.addEventListener("loadeddata",()=>{p.innerHTML=String(Math.round(t.duration)).toHHMMSS()}),t.addEventListener("timeupdate",()=>{"default"==s&&(d.innerHTML=String(0|t.currentTime).toHHMMSS()),n=this.handleProgress(p,h,c,n)})}togglePlay(e){return e?(this.video.pause(),void this.wrapper.classList.remove("is-playing")):!1===e?(this.video.play(),void this.wrapper.classList.add("is-playing")):(this.video[this.video.paused?"play":"pause"](),void(this.video.paused?this.wrapper.classList.remove("is-playing"):this.wrapper.classList.add("is-playing")))}handleProgress(e,t,s,i){let n=this.video,a=this.skin;clearInterval(i);let o=0,r=0;if("circle"===a){i=setInterval(()=>{n.currentTime!=r&&(o=n.currentTime,r=n.currentTime);let e=t-o/n.duration*t;s.style.strokeDashoffset=""+e,n.paused&&clearInterval(i)},20);let a=String(n.duration-n.currentTime|0).toHHMMSS();return"0"!=a&&(e.innerHTML=a),i}}buildControls(){let e=this.skin,t=[];return"default"===e?(t.push('<button class="'+e+'__button--big toggle tgico-largeplay" title="Toggle Play"></button>'),t.push('<div class="'+e+'__gradient-bottom ckin__controls"></div>'),t.push('<div class="'+e+'__controls ckin__controls">'),t.push('<div class="bottom-controls">','<div class="left-controls"><button class="'+e+'__button toggle tgico-play" title="Toggle Video"></button>','<div class="time">','<time id="time-elapsed">0:00</time>',"<span> / </span>",'<time id="time-duration">0:00</time>',"</div>","</div>",'<div class="right-controls"><button class="'+e+'__button fullscreen tgico-fullscreen" title="Full Screen"></button></div></div>'),t.push("</div>")):"circle"===e&&t.push('<svg class="progress-ring" width="200px" height="200px">','<circle class="progress-ring__circle" stroke="white" stroke-opacity="0.3" stroke-width="3.5" cx="100" cy="100" r="93" fill="transparent" transform="rotate(-90, 100, 100)"/>',"</svg>"),t.join("")}updateButton(e){let t=this.video.paused?"tgico-play":"tgico-pause";Array.from(e).forEach(e=>{e.classList.remove("tgico-play","tgico-pause"),e.classList.add(t)})}toggleFullScreen(e){let t=this.wrapper;document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?(t.classList.remove("ckin__fullscreen"),document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen(),e.classList.remove("tgico-smallscreen"),e.classList.add("tgico-fullscreen"),e.setAttribute("title","Full Screen")):(t.classList.add("ckin__fullscreen"),t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen(),e.classList.remove("tgico-fullscreen"),e.classList.add("tgico-smallscreen"),e.setAttribute("title","Exit Full Screen"))}onFullScreen(){null!==document.webkitFullscreenElement||this.wrapper.classList.remove("ckin__fullscreen")}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(38)),a=i(s(6)),o=s(1),r=s(48);t.default=new class{constructor(){this.container=document.getElementById("forward-container"),this.closeBtn=this.container.querySelector(".sidebar-close-button"),this.sendBtn=this.container.querySelector(".btn-circle"),this.msgIDs=[],this.closeBtn.addEventListener("click",this.close.bind(this)),this.sendBtn.addEventListener("click",()=>{let e=this.selector.getSelected();if(this.msgIDs.length&&e.length){this.sendBtn.classList.remove("tgico-send"),this.sendBtn.disabled=!0,o.putPreloader(this.sendBtn),this.selector.freezed=!0;let t=()=>{let s=e.splice(0,3).map(e=>a.default.forwardMessages(e,this.msgIDs));Promise.all(s).then(()=>{if(e.length)return t();this.closeBtn.click()})};t()}})}close(){(this.sidebarWasActive?Promise.resolve():n.default.toggleSidebar(!1)).then(()=>{this.cleanup(),this.container.classList.remove("active")})}cleanup(){this.selector&&(this.selector.container.remove(),this.selector=null)}init(e){this.cleanup(),this.msgIDs=e,this.container.classList.add("active"),this.sendBtn.innerHTML="",this.sendBtn.classList.add("tgico-send"),this.sendBtn.disabled=!1,this.selector=new r.AppSelectPeers(this.container,e=>{e?this.sendBtn.classList.add("is-visible"):this.sendBtn.classList.remove("is-visible")},"dialogs",()=>{this.sidebarWasActive=n.default.sidebarEl.classList.contains("active"),n.default.toggleSidebar(!0)})}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppSelectPeers=void 0;const a=n(s(9)),o=n(s(6)),r=s(0),l=n(s(15)),d=n(s(10)),c=n(s(5)),u=n(s(8)),h=n(s(14));t.AppSelectPeers=class{constructor(e,t,s="dialogs",i,n){this.appendTo=e,this.onChange=t,this.peerType=s,this.renderResultsFunc=n,this.container=document.createElement("div"),this.list=document.createElement("ul"),this.chatsContainer=document.createElement("div"),this.selectedContainer=document.createElement("div"),this.input=document.createElement("input"),this.selected=new Set,this.freezed=!1,this.myID=r.$rootScope.myID,this.offsetIndex=0,this.query="",this.container.classList.add("selector"),this.renderResultsFunc||(this.renderResultsFunc=this.renderResults);let o=document.createElement("div");o.classList.add("selector-search-container"),this.selectedContainer.classList.add("selector-search"),this.input.placeholder="contacts"==s?"Add People...":"Select chat",this.input.type="text",this.selectedContainer.append(this.input),o.append(this.selectedContainer),this.selectedScrollable=new a.default(o);let l=document.createElement("hr");this.chatsContainer.classList.add("chats-container"),this.chatsContainer.append(this.list),this.scrollable=new a.default(this.chatsContainer),this.scrollable.setVirtualContainer(this.list),this.chatsContainer.addEventListener("click",e=>{const t=r.findUpAttribute(e.target,"data-peerID");if(r.cancelEvent(e),!t)return;if(this.freezed)return;let s=t.getAttribute("data-peerID");s=+s||s,t.classList.toggle("active"),this.selected.has(s)?this.remove(s):this.add(s);const i=t.querySelector("input");i.checked=!i.checked}),this.selectedContainer.addEventListener("click",e=>{if(this.freezed)return;let t=e.target;if(t=r.findUpClassName(t,"selector-user"),!t)return;const s=t.dataset.key,i=this.chatsContainer.querySelector('[data-peerid="'+s+'"]');i?i.click():this.remove(+s||s)}),this.input.addEventListener("input",()=>{let e=this.input.value;this.query!=e&&("contacts"==this.peerType?this.cachedContacts=null:this.offsetIndex=0,this.promise=null,this.list.innerHTML="",this.query=e,this.getMoreResults())}),this.scrollable.onScrolledBottom=()=>{this.getMoreResults()},this.container.append(o,l,this.chatsContainer),e.append(this.container),setTimeout(()=>{let e=this.getMoreResults();i&&e.then(()=>{i()})},0)}getMoreDialogs(){return i(this,void 0,void 0,(function*(){if(this.promise)return this.promise;const e=h.default.windowH/72*1.25|0;this.promise=o.default.getConversations(this.query,this.offsetIndex,e,0);let t=(yield this.promise).dialogs;if(!t.length)return;const s=t[t.length-1].index||0;t=t.filter(e=>e.peerID!=this.myID),this.offsetIndex||this.query||t.unshift({peerID:this.myID,pFlags:{}}),this.offsetIndex=s,this.renderResultsFunc(t.map(e=>e.peerID)),this.promise=null}))}getMoreContacts(){return i(this,void 0,void 0,(function*(){if(this.promise)return this.promise;if(this.cachedContacts||(this.promise=c.default.getContacts(this.query),this.cachedContacts=(yield this.promise).slice(),this.cachedContacts.findAndSplice(e=>e==this.myID),this.promise=null),this.cachedContacts.length){const e=h.default.windowH/72*1.25|0,t=this.cachedContacts.splice(0,e);this.renderResultsFunc(t)}}))}getMoreResults(){return"dialogs"==this.peerType?this.getMoreDialogs():this.getMoreContacts()}renderResults(e){e.forEach(e=>{const{dom:t}=l.default.addDialog(e,this.scrollable,!1,!1),s=this.selected.has(e);t.containerEl.insertAdjacentHTML("afterbegin",`<div class="checkbox"><label><input type="checkbox" ${s?"checked":""}><span></span></label></div>`),s&&t.listEl.classList.add("active");let i="";e<0?i=d.default.getChatMembersString(-e):e==this.myID?i="chat with yourself":(i=c.default.getUserStatusString(e),"online"==i&&(i=`<i>${i}</i>`)),t.lastMessageSpan.innerHTML=i})}add(e,t){const s=document.createElement("div");s.classList.add("selector-user","scale-in");const i=document.createElement("avatar-element");return i.classList.add("selector-user-avatar","tgico"),i.setAttribute("dialog","1"),s.dataset.key=""+e,this.selected.add(e),"number"==typeof e&&(void 0===t&&(t=e==r.$rootScope.myID?"Saved":u.default.getPeerTitle(e,!1,!0)),i.setAttribute("peer",""+e)),t&&(s.innerHTML=t),s.insertAdjacentElement("afterbegin",i),this.selectedContainer.insertBefore(s,this.input),this.selectedScrollable.scrollTo(this.selectedScrollable.scrollHeight,!0,!0),this.onChange&&this.onChange(this.selected.size),s}remove(e){const t=this.selectedContainer.querySelector(`[data-key="${e}"]`);t.classList.remove("scale-in"),t.offsetWidth,t.classList.add("scale-out"),t.addEventListener("animationend",()=>{this.selected.delete(e),t.remove(),this.onChange&&this.onChange(this.selected.size)},{once:!0})}getSelected(){return[...this.selected]}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(11);t.default=class{sha1Hash(e){return this.performTaskWorker("sha1-hash",e)}sha256Hash(e){return this.performTaskWorker("sha256-hash",e)}pbkdf2(e,t,s){return this.performTaskWorker("pbkdf2",e,t,s)}aesEncrypt(e,t,s){return this.performTaskWorker("aes-encrypt",i.convertToArrayBuffer(e),i.convertToArrayBuffer(t),i.convertToArrayBuffer(s))}aesDecrypt(e,t,s){return this.performTaskWorker("aes-decrypt",e,t,s).then(e=>i.convertToArrayBuffer(e))}rsaEncrypt(e,t){return this.performTaskWorker("rsa-encrypt",e,t)}factorize(e){return e=i.convertToByteArray(e),this.performTaskWorker("factorize",e)}modPow(e,t,s){return this.performTaskWorker("mod-pow",e,t,s)}gzipUncompress(e,t){return this.performTaskWorker("unzip",e,t)}}},,function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=new class{constructor(){this.webpMachine=null,this.queue=[],this.testPromise=null,this.webpSupport=!1,this.testWebpSupport()}loadWebpHero(){if(this.loaded)return this.loaded;this.loaded=new Promise((e,t)=>i(this,void 0,void 0,(function*(){if(yield this.testWebpSupport())e();else{window.webpLoaded=()=>{this.webpMachine=new window.WebpMachine,e()};let t=document.createElement("script");t.src="npm.webp-hero.chunk.js",t.async=!0,t.onload=window.webpLoaded,document.body.appendChild(t)}})))}convert(e){return this.webpMachine.decode(e)}processQueue(){return i(this,void 0,void 0,(function*(){if(this.busyPromise)return;this.busyPromise=Promise.resolve();let{bytes:e,callback:t}=this.queue.pop();this.loaded||this.loadWebpHero(),yield this.loaded,this.busyPromise=this.convert(e),t(yield this.busyPromise),this.busyPromise=null,this.queue.length&&this.processQueue()}))}testWebpSupport(){return this.testPromise?this.testPromise:this.testPromise=new Promise((e,t)=>{let s=new Image;s.src="data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA",s.onload=s.onerror=()=>{e(this.webpSupport=2===s.height)}})}isSupported(){return this.webpSupport}convertToPng(e){return new Promise((t,s)=>{this.queue.push({bytes:e,callback:t}),this.processQueue()})}};t.default=n},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(0),a=i(s(14)),o=i(s(12)),r=s(3);t.default=new class{constructor(){this.webpages={},this.pendingWebPages={},n.$rootScope.$on("apiUpdate",e=>{let t=e.detail;switch(t._){case"updateWebPage":this.saveWebPage(t.webpage)}})}saveWebPage(e,t,s){e.photo&&"photo"===e.photo._?e.photo=a.default.savePhoto(e.photo,s):delete e.photo,e.document&&"document"===e.document._?e.document=o.default.saveDoc(e.document,s):("document"==e.type&&delete e.type,delete e.document);var i=e.site_name,l=e.title||e.author||i||"";i&&l==i&&delete e.site_name,l.length>100&&(l=l.substr(0,80)+"..."),e.rTitle=r.RichTextProcessor.wrapRichText(l,{noLinks:!0,noLinebreaks:!0});var d="";if("GitHub"==i){var c=e.url.match(/(https?:\/\/github\.com\/[^\/]+\/[^\/]+)/);c&&(d=c[0]+"/issues/{1}")}var u=e.description||"";if(u.length>180&&(u=u.substr(0,150).replace(/(\n|\s)+$/,"")+"..."),e.rDescription=r.RichTextProcessor.wrapRichText(u,{contextSite:i||"external",contextHashtag:d}),"photo"!=e.type&&"video"!=e.type&&"gif"!=e.type&&"document"!=e.type&&!e.description&&e.photo&&(e.type="photo"),t&&(void 0===this.pendingWebPages[e.id]&&(this.pendingWebPages[e.id]={}),this.pendingWebPages[e.id][t]=!0,this.webpages[e.id]=e),void 0===this.webpages[e.id]?this.webpages[e.id]=e:n.safeReplaceObject(this.webpages[e.id],e),!t&&void 0!==this.pendingWebPages[e.id]){var h=[];for(let t in this.pendingWebPages[e.id])h.push(t);n.$rootScope.$broadcast("webpage_updated",{id:e.id,msgs:h})}}getWebPage(e){return this.webpages[e]}}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppMediaViewer=void 0;const a=n(s(8)),o=n(s(14)),r=n(s(6)),l=s(3),d=s(7),c=n(s(23)),u=s(0),h=n(s(12)),p=n(s(46)),f=s(1),m=n(s(31)),g=n(s(47)),v=s(4),b=n(s(54));class y{constructor(){this.wholeDiv=document.querySelector(".media-viewer-whole"),this.overlaysDiv=this.wholeDiv.firstElementChild,this.author={avatarEl:this.overlaysDiv.querySelector(".media-viewer-userpic"),nameEl:this.overlaysDiv.querySelector(".media-viewer-name"),date:this.overlaysDiv.querySelector(".media-viewer-date")},this.buttons={},this.content={container:this.overlaysDiv.querySelector(".media-viewer-media"),caption:this.overlaysDiv.querySelector(".media-viewer-caption"),mover:null},this.currentMessageID=0,this.preloader=null,this.lastTarget=null,this.prevTargets=[],this.nextTargets=[],this.peerID=0,this.loadMediaPromiseUp=null,this.loadMediaPromiseDown=null,this.loadedAllMediaUp=!1,this.loadedAllMediaDown=!1,this.reverse=!1,this.needLoadMore=!0,this.pageEl=document.getElementById("page-chats"),this.log=d.logger("AMV"),this.preloader=new c.default,this.lazyLoadQueue=new m.default(void 0,!0),f.parseMenuButtonsTo(this.buttons,this.wholeDiv.querySelectorAll("[class*='menu']")),this.onKeyDownBinded=this.onKeyDown.bind(this);const e=e=>{u.cancelEvent(e),this.content.container.innerHTML="",this.peerID=0,this.currentMessageID=0,this.lazyLoadQueue.clear(),this.setMoverToTarget(this.lastTarget,!0),this.lastTarget=null,this.prevTargets=[],this.nextTargets=[],this.loadedAllMediaUp=this.loadedAllMediaDown=!1,this.loadMediaPromiseUp=this.loadMediaPromiseDown=null,this.setMoverPromise=null,g.default.container.classList.contains("active")&&setTimeout(()=>{g.default.close()},200),window.removeEventListener("keydown",this.onKeyDownBinded)};[this.buttons.close,this.buttons["mobile-close"]].forEach(t=>{t.addEventListener("click",e)}),this.buttons.prev.addEventListener("click",e=>{if(u.cancelEvent(e),this.setMoverPromise)return;let t=this.prevTargets.pop();t?(this.nextTargets.unshift({element:this.lastTarget,mid:this.currentMessageID}),this.openMedia(r.default.getMessage(t.mid),t.element)):this.buttons.prev.style.display="none"}),this.buttons.next.addEventListener("click",e=>{if(u.cancelEvent(e),this.setMoverPromise)return;let t=this.nextTargets.shift();t?(this.prevTargets.push({element:this.lastTarget,mid:this.currentMessageID}),this.openMedia(r.default.getMessage(t.mid),t.element)):this.buttons.next.style.display="none"});const t=e=>{let t=r.default.getMessage(this.currentMessageID);if(t.media.photo)o.default.downloadPhoto(t.media.photo.id);else{let e=null;e=t.media.webpage?t.media.webpage.document:t.media.document,e&&(console.log("will save document:",e),h.default.saveDocFile(e.id))}};[this.buttons.download,this.buttons["menu-download"]].forEach(e=>{e.addEventListener("click",t)});const s=e=>{g.default.init([this.currentMessageID])};[this.buttons.forward,this.buttons["menu-forward"]].forEach(e=>{e.addEventListener("click",s)}),this.onClickBinded=e=>{u.cancelEvent(e);let t=e.target,s=null;["media-viewer-mover","media-viewer-buttons","media-viewer-author"].find(e=>{try{if(s=u.findUpClassName(t,e),s)return!0}catch(e){return!1}}),s&&"IMG"!=t.tagName&&"image"!=t.tagName||this.buttons.close.click()},this.wholeDiv.addEventListener("click",this.onClickBinded),this.setNewMover()}onKeyDown(e){"ArrowRight"==e.key?this.buttons.next.click():"ArrowLeft"==e.key&&this.buttons.prev.click()}setMoverToTarget(e,t=!1,s=0){var n;return i(this,void 0,void 0,(function*(){let i=this.content.mover;t||(i.innerHTML="");let a,r,l=0!==s,d=l?350:200;this.log("setMoverToTarget",e,t,l,s),e&&(e instanceof SVGImageElement||e.parentElement instanceof SVGForeignObjectElement?(a=u.findUpClassName(e,"attachment"),r=a.getBoundingClientRect()):(a=e.parentElement,r=e.getBoundingClientRect()));let c,h,p,f=this.content.container.getBoundingClientRect(),m="";if(l?(c=1===s?o.default.windowW:-f.width,h=f.top):(c=r.left,h=r.top),e instanceof HTMLImageElement||e instanceof HTMLVideoElement){if(i.firstElementChild&&i.firstElementChild.classList.contains("media-viewer-aspecter")){p=i.firstElementChild;let e=p.querySelector(".ckin__player");if(e){let t=e.firstElementChild;p.append(t),e.remove()}p.style.cssText||(i.classList.remove("active"),this.setFullAspect(p,f,r),i.offsetLeft,i.classList.add("active"))}else p=document.createElement("div"),p.classList.add("media-viewer-aspecter","disable-hover"),i.prepend(p);p.style.cssText=`width: ${r.width}px; height: ${r.height}px; transform: scale(${f.width/r.width}, ${f.height/r.height});`}m+=`translate(${c}px,${h}px) `,i.style.width=f.width+"px",i.style.height=f.height+"px";let g=r.width/f.width,v=r.height/f.height;l||(m+=`scale(${g},${v}) `);let b,y=window.getComputedStyle(a).getPropertyValue("border-radius"),_=u.fillPropertyValue(y);y=_.map(e=>parseInt(e)/g+"px").join(" "),l||(i.style.borderRadius=y),i.style.transform=m;let w=e.classList.contains("is-out");if(t)return e instanceof SVGSVGElement&&(b=i.querySelector("path"),b&&this.sizeTailPath(b,f,g,d,!1,w,y)),e.classList.contains("media-viewer-media")&&i.classList.add("hiding"),setTimeout(()=>{this.wholeDiv.classList.remove("active")},0),setTimeout(()=>{i.style.borderRadius=y,i.firstElementChild&&(i.firstElementChild.style.borderRadius=y)},d/2),void setTimeout(()=>{i.innerHTML="",i.classList.remove("moving","active","hiding"),i.style.display="none"},d);{let t,s;if("DIV"==e.tagName)e.firstElementChild&&(t=new Image,s=e.firstElementChild.src,i.append(t));else if(e instanceof HTMLImageElement)t=new Image,s=e.src;else if(e instanceof HTMLVideoElement){let i=t=document.createElement("video"),a=document.createElement("source");s=null===(n=e.querySelector("source"))||void 0===n?void 0:n.src,i.append(a)}else if(e instanceof SVGSVGElement){let t=e.dataset.clipID,s=t+"-mv",{width:n,height:a}=f,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"width",""+n),o.setAttributeNS(null,"height",""+a),o.insertAdjacentHTML("beforeend",e.firstElementChild.outerHTML.replace(t,s)),o.insertAdjacentHTML("beforeend",e.lastElementChild.outerHTML.replace(t,s));let r=o.querySelector("source");r&&r.removeAttribute("src");let l=o.firstElementChild,d=l.firstElementChild.firstElementChild;if(d instanceof SVGUseElement){let e,t=d.getAttributeNS(null,"transform");t=t.replace(/translate\((.+?), (.+?)\) scale\((.+?), (.+?)\)/,(e,t,s,i,o)=>`translate(${t=2!=(t=+t)?n-2/g:2/g}, ${a}) scale(${+i/g}, ${+o/v})`),d.setAttributeNS(null,"transform",t),b=l.firstElementChild.lastElementChild;let s=y.split(" ").map(e=>parseInt(e));e=w?u.generatePathData(0,0,n-9/g,a,...s):u.generatePathData(9/g,0,n-9/g,a,...s),b.setAttributeNS(null,"d",e)}let c=o.lastElementChild;c.setAttributeNS(null,"width",""+f.width),c.setAttributeNS(null,"height",""+f.height),i.prepend(o)}p&&(p.style.borderRadius=y,p.append(t)),t=i.querySelector("video, img"),t instanceof HTMLImageElement&&s&&(yield new Promise((e,i)=>{t.addEventListener("load",e),s&&(t.src=s)})),i.style.display="",window.requestAnimationFrame(()=>{i.classList.add(l?"moving":"active")})}yield new Promise(e=>window.requestAnimationFrame(e)),i.style.transform=`translate(${f.left}px,${f.top}px) scale(1,1)`,p&&this.setFullAspect(p,f,r),setTimeout(()=>{i.style.borderRadius="",i.firstElementChild&&(i.firstElementChild.style.borderRadius="")},d/2),i.dataset.timeout=""+setTimeout(()=>{i.classList.remove("moving"),p&&(i.querySelector("video")&&(i.classList.remove("active"),p.style.cssText="",i.offsetLeft),p.classList.remove("disable-hover")),i.classList.add("active"),delete i.dataset.timeout},d),b&&this.sizeTailPath(b,f,g,d,!0,w,y)}))}setFullAspect(e,t,s){const i=t.width/t.height;let{width:n,height:a}=s;i>0?n=a*i:a=n*i,e.style.cssText=`width: ${n}px; height: ${a}px; transform: scale(${t.width/n}, ${t.height/a});`}sizeTailPath(e,t,s,i,n,a,o){let r=Date.now(),{width:l,height:d}=t;i/=2;let c=o.split(" ").map(e=>parseInt(e)),h=()=>{let t=Date.now()-r,o=t/i;o>1&&(o=1),n&&(o=1-o);let p,f=c.map(e=>e*o);p=a?u.generatePathData(0,0,l-9/s*o,d,...f):u.generatePathData(9/s*o,0,l,d,...f),e.setAttributeNS(null,"d",p),t<i&&window.requestAnimationFrame(h)};h()}moveTheMover(e,t=!0){let s=o.default.windowW;e.classList.add("moving"),e.dataset.timeout&&clearTimeout(+e.dataset.timeout);let i=e.getBoundingClientRect(),n=e.style.transform.replace(/translate\((.+?),/,(e,n)=>{let a=+n.slice(0,-2);return a=t?-i.width:s,e.replace(n,a+"px")});e.style.transform=n,setTimeout(()=>{e.remove()},350)}setNewMover(){let e=document.createElement("div");if(e.classList.add("media-viewer-mover"),this.content.mover){this.content.mover.parentElement.append(e)}else this.wholeDiv.append(e);return e.addEventListener("click",this.onClickBinded),this.content.mover=e}isElementVisible(e,t){let s=e.getBoundingClientRect(),i=t.getBoundingClientRect();return i.bottom>s.top&&i.top<s.bottom}loadMoreMedia(e=!0){if(e&&this.loadedAllMediaDown)return;if(!e&&this.loadedAllMediaUp)return;if(e&&this.loadMediaPromiseDown)return this.loadMediaPromiseDown;if(!e&&this.loadMediaPromiseUp)return this.loadMediaPromiseUp;let t,s=e?0:50,i=this.currentMessageID;t=e?this.reverse?this.prevTargets[0]:this.nextTargets[this.nextTargets.length-1]:this.reverse?this.nextTargets[this.nextTargets.length-1]:this.prevTargets[0],t&&(i=t.mid),e||(i+=1);let n=this.peerID,a=r.default.getSearch(n,"",{_:"inputMessagesFilterPhotoVideo"},i,50,0,s).then(t=>{if(this.peerID!=n)return void this.log.warn("peer changed");this.log("loaded more media by maxID:",i,t,e,this.reverse),t.history.length<50&&(e?this.loadedAllMediaDown=!0:this.loadedAllMediaUp=!0),(e?t.history.forEach:t.history.forEachReverse).call(t.history,t=>{let s=r.default.getMessage(t).media;if(!s||!(s.photo||s.document||s.webpage&&s.webpage.document))return;if("document"==s._&&"video"!=s.type)return;let i={element:null,mid:t};e?this.reverse?this.prevTargets.unshift(i):this.nextTargets.push(i):this.reverse?this.nextTargets.push(i):this.prevTargets.unshift(i)}),this.buttons.prev.style.display=this.prevTargets.length?"":"none",this.buttons.next.style.display=this.nextTargets.length?"":"none"},()=>{}).then(()=>{e?this.loadMediaPromiseDown=null:this.loadMediaPromiseUp=null});return e?this.loadMediaPromiseDown=a:this.loadMediaPromiseUp=a,a}updateMediaSource(e,t,s){let i=e.querySelector(s);f.renderImageFromUrl(i,t)}openMedia(e,t,s=!1,n,r=[],d=[],c=!0){return i(this,void 0,void 0,(function*(){if(this.setMoverPromise)return this.setMoverPromise;this.log("openMedia doc:",e);const n=e.media.photo||e.media.document||e.media.webpage.document||e.media.webpage.photo,m="video/mp4"==n.mime_type,y=!this.peerID;y&&(this.peerID=u.$rootScope.selectedPeerID,this.prevTargets=r,this.nextTargets=d,this.reverse=s,this.needLoadMore=c,g.default.container.classList.contains("active")&&(g.default.close(),yield new Promise(e=>setTimeout(e,200))));let _=0;y||(_=this.reverse?this.currentMessageID<e.mid?1:-1:this.currentMessageID>e.mid?1:-1),this.buttons.prev.style.display=this.prevTargets.length?"":"none",this.buttons.next.style.display=this.nextTargets.length?"":"none";const w=this.content.container;!t&&(t=w),this.currentMessageID=e.mid,this.lastTarget=t,this.needLoadMore&&(this.nextTargets.length<20&&this.loadMoreMedia(!this.reverse),this.prevTargets.length<20&&this.loadMoreMedia(this.reverse)),w.firstElementChild&&(w.innerHTML="");const S=new Date(1e3*n.date),L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][S.getMonth()]+" "+S.getDate()+" at "+S.getHours()+":"+("0"+S.getMinutes()).slice(-2);this.author.date.innerText=L;const M=a.default.getPeerTitle(e.fromID);this.author.nameEl.innerHTML=M,e.message?this.content.caption.innerHTML=l.RichTextProcessor.wrapRichText(e.message,{entities:e.totalEntities}):this.content.caption.innerHTML="";let D=this.author.avatarEl;this.author.avatarEl=this.author.avatarEl.cloneNode(),this.author.avatarEl.setAttribute("peer",""+e.fromID),D.parentElement.replaceChild(this.author.avatarEl,D);0!==_?(this.moveTheMover(this.content.mover,1===_),this.setNewMover()):(window.addEventListener("keydown",this.onKeyDownBinded),this.wholeDiv.classList.add("active"));const E=this.content.mover,I=v.mediaSizes.isMobile?this.pageEl.scrollWidth:this.pageEl.scrollWidth-16,P=o.default.windowH-100,C=o.default.setAttachmentSize(m?n:n.id,w,I,P);let T;return T=m?this.setMoverToTarget(t,!1,_).then(()=>{const s=E.firstElementChild&&E.firstElementChild.classList.contains("media-viewer-aspecter")?E.firstElementChild:E,a=E.querySelector("video")||document.createElement("video"),o=a.firstElementChild||document.createElement("source");o.removeAttribute("src"),a.setAttribute("playsinline",""),"gif"==n.type&&(a.muted=!0,a.autoplay=!0,a.loop=!0),o.parentElement||a.append(o);const r=(e=!1)=>{if("gif"!=n.type){a.dataset.ckin="default",a.dataset.overlay="1",a.parentElement||s.append(a);return new p.default(a,!0,e)}};if(!o.src||n.url&&n.url!=o.src){const l=()=>{const l=h.default.downloadVideo(n.id),d=n.supportsStreaming&&!n.url;let c;this.preloader.attach(E,!0,l);let u=0,p={},m=l.notify,g=e=>{c&&y(),p[e.offset]=!0,m(e)};d&&(l.notify=g);let y=()=>{let e=u-u%524288,t=0;for(let s in p){+s>=e&&(t+=524288)}u>e&&(t-=u%524288),c.progress.setLoadProgress(Math.min(1,t/n.size+e/n.size))};return l.then(h=>i(this,void 0,void 0,(function*(){if(this.currentMessageID!=e.mid)return void this.log.warn("media viewer changed video");const i=h instanceof b.default;i&&(l.notify=g);const p=i?h.getURL():n.url;if(t instanceof SVGSVGElement&&(a.parentElement||!v.isSafari))a.parentElement||s.firstElementChild.lastElementChild.append(a),this.updateMediaSource(E,p,"source");else{f.renderImageFromUrl(o,p),o.type=n.mime_type;const e=s.firstElementChild;e instanceof HTMLVideoElement||!e||e.remove(),a.parentElement||s.prepend(a)}o.remove(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{a.append(o)})}),c=r(d),c&&h instanceof b.default&&(c.progress.onSeek=e=>{u=h.seek(e),y()},this.log("lol"))}))),l};this.lazyLoadQueue.unshift({div:null,load:l,wasSeen:!0})}else r()}):this.setMoverToTarget(t,!1,_).then(()=>{this.lazyLoadQueue.unshift({div:null,load:()=>{let s=o.default.preloadPhoto(n.id,C);return this.preloader.attach(E,!0,s),s.then(()=>{if(this.currentMessageID!=e.mid)return void this.log.warn("media viewer changed photo");let s=n.url;if(t instanceof SVGSVGElement)this.updateMediaSource(t,s,"img"),this.updateMediaSource(E,s,"img");else{let e=E.firstElementChild&&E.firstElementChild.classList.contains("media-viewer-aspecter")?E.firstElementChild:E,t=e.firstElementChild;t&&"IMG"==t.tagName||(t=new Image),f.renderImageFromUrl(t,s).then(()=>{e.append(t)})}this.preloader.detach()}).catch(e=>{this.log.error(e)}),s},wasSeen:!0})}),this.setMoverPromise=T.then(()=>{this.setMoverPromise=null})}))}}t.AppMediaViewer=y,t.default=new y},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=s(7);class a{constructor(e,t){this.video=e,this.getBufferAsync=t,this.nextBufferStart=0,this.mediaSource=null,this.ready=!1,this.bufferedTime=40,this.beforeMoovBufferSize=32768,this.moovBufferSize=524288,this.bufferSize=524288,this.seekBufferSize=262144,this.currentBufferSize=this.beforeMoovBufferSize,this.nbSamples=10,this.seeking=!1,this.loading=!1,this.log=n.logger("MP4"),this.expectedSize=this.video.video.expected_size,this.init(e.duration)}init(e){const t=new MediaSource;t.addEventListener("sourceopen",()=>{if(this.log("[MediaSource] sourceopen start",this.mediaSource,this),this.mediaSource.sourceBuffers.length>0)return;const s=window.MP4Box.createFile();s.onMoovStart=()=>{this.log("[MP4Box] onMoovStart"),this.currentBufferSize=this.moovBufferSize},s.onError=e=>{this.log("[MP4Box] onError",e)},s.onReady=t=>{this.log("[MP4Box] onReady",t),this.ready=!0,this.currentBufferSize=this.bufferSize;const{isFragmented:s,timescale:i,fragment_duration:n,duration:a}=t;n||a?this.mediaSource.duration=s?n/i:a/i:(this.mediaSource.duration=e,this.bufferedTime=e),this.initializeAllSourceBuffers(t)},s.onSegment=(e,s,i,n,a)=>{const o=n+this.nbSamples>s.nb_samples;this.log("[MP4Box] onSegment",e,i,`${n}/${s.nb_samples}`,o,s.timestampOffset,t,a),s.segmentIndex++,s.pendingAppends.push({id:e,buffer:i,sampleNum:n,is_last:o}),this.onUpdateEnd(s,!0,!1)},this.mp4file=s,this.log("[MediaSource] sourceopen end",this,this.mp4file),this.loadNextBuffer()}),t.addEventListener("sourceended",()=>{this.log("[MediaSource] sourceended",t.readyState)}),t.addEventListener("sourceclose",()=>{this.log("[MediaSource] sourceclose",t.readyState)}),this.mediaSource=t}onInitAppended(e){if(e.sampleNum=0,e.addEventListener("updateend",()=>this.onUpdateEnd(e,!0,!0)),this.onUpdateEnd(e,!1,!0),this.mediaSource.pendingInits--,0===this.mediaSource.pendingInits){if(this.log("onInitAppended start!"),this.mp4file.start(),!(this.expectedSize>this.bufferSize))return;this.nextBufferStart=this.bufferSize,this.loadNextBuffer()}}onUpdateEnd(e,t,s){if(!0===s&&(e.sampleNum&&(this.mp4file.releaseUsedSamples(e.id,e.sampleNum),delete e.sampleNum),e.is_last&&(this.log("onUpdateEnd",e,t,s,e.sampleNum,e.is_last),this.mediaSource.endOfStream())),"open"===this.mediaSource.readyState&&!1===e.updating&&e.pendingAppends.length>0){const t=e.pendingAppends.shift();this.log("MSE - SourceBuffer #"+e.id,"Appending new buffer, pending: "+e.pendingAppends.length),e.sampleNum=t.sampleNum,e.is_last=t.is_last,e.appendBuffer(t.buffer)}}initializeAllSourceBuffers(e){for(let t=0;t<e.tracks.length;t++)this.addSourceBuffer(e.tracks[t]);this.initializeSourceBuffers()}initializeSourceBuffers(){const e=this.mp4file.initializeSegmentation();this.log("[MP4Box] initializeSegmentation",e);for(let t=0;t<e.length;t++){const s=e[t].user;0===t&&(this.mediaSource.pendingInits=0);let i=()=>{"open"===this.mediaSource.readyState&&(s.removeEventListener("updateend",i),this.onInitAppended(s))};s.addEventListener("updateend",i),s.appendBuffer(e[t].buffer),s.segmentIndex=0,this.mediaSource.pendingInits++}}addSourceBuffer(e){const t=this.mp4file,s=this.mediaSource;if(!e)return;const{id:i,codec:n,type:a,nb_samples:o}=e,r=`video/mp4; codecs="${n}"`;if(this.log("mimetype:",r),!MediaSource.isTypeSupported(r))return void this.log("[addSourceBuffer] not supported",r);const l=s.addSourceBuffer(r);l.id=i,l.pendingAppends=[],l.nb_samples=o,t.setSegmentOptions(i,l,{nbSamples:this.nbSamples}),this.log("[addSourceBuffer] add",i,n,a,l),l.addEventListener("error",e=>{this.log("MSE SourceBuffer #"+i,e)})}stop(){this.mp4file.stop(),this.mp4file=null,this.getBufferAsync=null}getURL(){var e;return null!==(e=this.url)&&void 0!==e?e:this.url=URL.createObjectURL(this.mediaSource)}seek(e){const t=this.mp4file.seek(e,!0);this.nextBufferStart=t.offset;return this.log("[player] onSeeked",!0,e,t,this.nextBufferStart),this.loadNextBuffer(!0),t.offset}timeUpdate(e,t,s){const i=[];for(let e=0;e<s.length;e++)i.push({start:s.start(e),end:s.end(e)});let n=0===s.length,a=!1;for(let i=0;i<s.length;i++){const o=s.start(i),r=s.end(i);if(o<=e&&e<=r&&(a=!0,r<t&&e+this.bufferedTime>r)){n=!0;break}}a||(n=!0),this.log("[player] timeUpdate",n,e,t,JSON.stringify(i)),n&&this.loadNextBuffer()}loadNextBuffer(e=!1){return i(this,void 0,void 0,(function*(){const{nextBufferStart:t,loading:s,currentBufferSize:i,mp4file:n}=this;if(this.log("[player] loadNextBuffer",void 0===t,s,!n),!n)return;if(void 0===t)return;if(s)return;this.loading=!0;let a=e?this.seekBufferSize:this.bufferSize;t+a>this.expectedSize&&(a=this.expectedSize-t);const o=yield this.getBufferAsync(t,t+a);o.fileStart=t;const r=o.byteLength!==a;this.log("[player] loadNextBuffer start",o.byteLength,t,r),o.byteLength?this.nextBufferStart=n.appendBuffer(o):this.nextBufferStart=void 0,r&&(this.log("[player] loadNextBuffer flush"),this.mp4file.flush()),this.log("[player] loadNextBuffer stop",o.byteLength,t,this.nextBufferStart),this.loading=!1,this.ready&&r||(this.log("[player] loadNextBuffer next"),this.loadNextBuffer())}))}}t.default=a,window.MP4Source=a},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Layouter=t.RectPart=void 0,t.RectPart={None:0,Top:1,Right:2,Bottom:4,Left:8};let i=(e,t)=>e.reduce((e,t)=>e+t,t);function n(e,t,s){return e<t?t:e>s?s:e}class a{constructor(e,t,s,n,o=t){this.sizes=e,this.maxWidth=t,this.minWidth=s,this.spacing=n,this.maxHeight=o,this.count=e.length,this.ratios=a.countRatios(e),this.proportions=a.countProportions(this.ratios),this.averageRatio=i(this.ratios,1)/this.count,this.maxSizeRatio=t/this.maxHeight}layout(){return this.count?this.count>=5||this.ratios.find(e=>e>2)?new o(this.ratios,this.averageRatio,this.maxWidth,this.minWidth,this.spacing).layout():2==this.count?this.layoutTwo():3==this.count?this.layoutThree():this.layoutFour():[]}layoutTwo(){return"ww"==this.proportions&&this.averageRatio>1.4*this.maxSizeRatio&&this.ratios[1]-this.ratios[0]<.2?this.layoutTwoTopBottom():"ww"==this.proportions||"qq"==this.proportions?this.layoutTwoLeftRightEqual():this.layoutTwoLeftRight()}layoutThree(){return console.log("layoutThree:",this),"n"==this.proportions[0]?this.layoutThreeLeftAndOther():this.layoutThreeTopAndOther()}layoutFour(){return"w"==this.proportions[0]?this.layoutFourTopAndOther():this.layoutFourLeftAndOther()}layoutTwoTopBottom(){const e=this.maxWidth,s=Math.round(Math.min(e/this.ratios[0],Math.min(e/this.ratios[1],(this.maxHeight-this.spacing)/2)));return[{geometry:{x:0,y:0,width:e,height:s},sides:t.RectPart.Left|t.RectPart.Top|t.RectPart.Right},{geometry:{x:0,y:s+this.spacing,width:e,height:s},sides:t.RectPart.Left|t.RectPart.Bottom|t.RectPart.Right}]}layoutTwoLeftRightEqual(){const e=(this.maxWidth-this.spacing)/2,s=Math.round(Math.min(e/this.ratios[0],Math.min(e/this.ratios[1],1*this.maxHeight)));return[{geometry:{x:0,y:0,width:e,height:s},sides:t.RectPart.Top|t.RectPart.Left|t.RectPart.Bottom},{geometry:{x:e+this.spacing,y:0,width:e,height:s},sides:t.RectPart.Top|t.RectPart.Right|t.RectPart.Bottom}]}layoutTwoLeftRight(){const e=Math.round(1.5*this.minWidth),s=Math.min(Math.round(Math.max(.4*(this.maxWidth-this.spacing),(this.maxWidth-this.spacing)/this.ratios[0]/(1/this.ratios[0]+1/this.ratios[1]))),this.maxWidth-this.spacing-e),i=this.maxWidth-s-this.spacing,n=Math.min(this.maxHeight,Math.round(Math.min(i/this.ratios[0],s/this.ratios[1])));return[{geometry:{x:0,y:0,width:i,height:n},sides:t.RectPart.Top|t.RectPart.Left|t.RectPart.Bottom},{geometry:{x:i+this.spacing,y:0,width:s,height:n},sides:t.RectPart.Top|t.RectPart.Right|t.RectPart.Bottom}]}layoutThreeLeftAndOther(){const e=this.maxHeight,s=Math.round(Math.min((this.maxHeight-this.spacing)/2,this.ratios[1]*(this.maxWidth-this.spacing)/(this.ratios[2]+this.ratios[1]))),i=e-s-this.spacing,n=Math.max(this.minWidth,Math.round(Math.min((this.maxWidth-this.spacing)/2,Math.min(s*this.ratios[2],i*this.ratios[1])))),a=Math.min(Math.round(e*this.ratios[0]),this.maxWidth-this.spacing-n);return[{geometry:{x:0,y:0,width:a,height:e},sides:t.RectPart.Top|t.RectPart.Left|t.RectPart.Bottom},{geometry:{x:a+this.spacing,y:0,width:n,height:i},sides:t.RectPart.Top|t.RectPart.Right},{geometry:{x:a+this.spacing,y:i+this.spacing,width:n,height:s},sides:t.RectPart.Bottom|t.RectPart.Right}]}layoutThreeTopAndOther(){const e=this.maxWidth,s=Math.round(Math.min(e/this.ratios[0],.66*(this.maxHeight-this.spacing))),i=(this.maxWidth-this.spacing)/2,n=Math.min(this.maxHeight-s-this.spacing,Math.round(Math.min(i/this.ratios[1],i/this.ratios[2]))),a=e-i-this.spacing;return[{geometry:{x:0,y:0,width:e,height:s},sides:t.RectPart.Left|t.RectPart.Top|t.RectPart.Right},{geometry:{x:0,y:s+this.spacing,width:i,height:n},sides:t.RectPart.Bottom|t.RectPart.Left},{geometry:{x:i+this.spacing,y:s+this.spacing,width:a,height:n},sides:t.RectPart.Bottom|t.RectPart.Right}]}layoutFourTopAndOther(){const e=this.maxWidth,s=Math.round(Math.min(e/this.ratios[0],.66*(this.maxHeight-this.spacing))),i=Math.round((this.maxWidth-2*this.spacing)/(this.ratios[1]+this.ratios[2]+this.ratios[3])),n=Math.max(this.minWidth,Math.round(Math.min(.4*(this.maxWidth-2*this.spacing),i*this.ratios[1]))),a=Math.round(Math.max(Math.max(1*this.minWidth,.33*(this.maxWidth-2*this.spacing)),i*this.ratios[3])),o=e-n-a-2*this.spacing,r=Math.min(this.maxHeight-s-this.spacing,i);return[{geometry:{x:0,y:0,width:e,height:s},sides:t.RectPart.Left|t.RectPart.Top|t.RectPart.Right},{geometry:{x:0,y:s+this.spacing,width:n,height:r},sides:t.RectPart.Bottom|t.RectPart.Left},{geometry:{x:n+this.spacing,y:s+this.spacing,width:o,height:r},sides:t.RectPart.Bottom},{geometry:{x:n+this.spacing+o+this.spacing,y:s+this.spacing,width:a,height:r},sides:t.RectPart.Right|t.RectPart.Bottom}]}layoutFourLeftAndOther(){const e=this.maxHeight,s=Math.round(Math.min(e*this.ratios[0],.6*(this.maxWidth-this.spacing))),i=Math.round((this.maxHeight-2*this.spacing)/(1/this.ratios[1]+1/this.ratios[2]+1/this.ratios[3])),n=Math.round(i/this.ratios[1]),a=Math.round(i/this.ratios[2]),o=e-n-a-2*this.spacing,r=Math.max(this.minWidth,Math.min(this.maxWidth-s-this.spacing,i));return[{geometry:{x:0,y:0,width:s,height:e},sides:t.RectPart.Top|t.RectPart.Left|t.RectPart.Bottom},{geometry:{x:s+this.spacing,y:0,width:r,height:n},sides:t.RectPart.Top|t.RectPart.Right},{geometry:{x:s+this.spacing,y:n+this.spacing,width:r,height:a},sides:t.RectPart.Right},{geometry:{x:s+this.spacing,y:n+a+2*this.spacing,width:r,height:o},sides:t.RectPart.Bottom|t.RectPart.Right}]}static countRatios(e){return e.map(e=>e.w/e.h)}static countProportions(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}}t.Layouter=a;class o{constructor(e,t,s,i,n,a=4*s/3){this.averageRatio=t,this.maxWidth=s,this.minWidth=i,this.spacing=n,this.maxHeight=a,this.ratios=o.cropRatios(e,t),this.count=e.length}static cropRatios(e,t){return e.map(e=>t>1.1?n(e,1,2.75):n(e,.6667,1))}layout(){let e=new Array(this.count),s=[];const n=(e,t)=>{const s=this.ratios.slice(e,e+t),n=i(s,0);return(this.maxWidth-(t-1)*this.spacing)/n},a=e=>{let t=[],i=0;for(let s of e)t.push(n(i,s)),i+=s;s.push({lineCounts:e,heights:t})};for(let e=1;e!=this.count;++e){const t=this.count-e;e>3||t>3||a([e,t])}for(let e=1;e!=this.count-1;++e)for(let t=1;t!=this.count-e;++t){const s=this.count-e-t;e>3||t>(this.averageRatio<.85?4:3)||s>3||a([e,t,s])}for(let e=1;e!=this.count-1;++e)for(let t=1;t!=this.count-e;++t)for(let s=1;s!=this.count-e-t;++s){const i=this.count-e-t-s;e>3||t>3||s>3||i>3||a([e,t,s,i])}let o=null,r=0;for(const e of s){const{heights:t,lineCounts:s}=e,n=s.length,a=i(t,0)+this.spacing*(n-1),l=Math.min(...t),d=(Math.max(...t),l<this.minWidth?1.5:1),c=(()=>{for(let e=1;e!=n;++e)if(s[e-1]>s[e])return 1.5;return 1})(),u=Math.abs(a-this.maxHeight)*d*c;(!o||u<r)&&(o=e,r=u)}const l=o.lineCounts,d=o.heights,c=l.length;let u=0,h=0;for(let s=0;s!=c;++s){const i=l[s],n=d[s],a=Math.round(n);let o=0;for(let r=0;r!=i;++r){const l=t.RectPart.None|(0==s?t.RectPart.Top:t.RectPart.None)|(s==c-1?t.RectPart.Bottom:t.RectPart.None)|(0==r?t.RectPart.Left:t.RectPart.None)|(r==i-1?t.RectPart.Right:t.RectPart.None),d=this.ratios[u],p=r==i-1?this.maxWidth-o:Math.round(d*n);e[u]={geometry:{x:o,y:h,width:p,height:a},sides:l},o+=p+this.spacing,++u}h+=a+this.spacing}return e}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.roundPercents=void 0;const n=i(s(35)),a=s(3),o=s(0),r=s(4),l=s(1),d=i(s(38)),c=i(s(18)),u=i(s(29));let h=0;t.roundPercents=e=>{const t=e.reduce((e,t)=>e+Math.round(t),0);if(t>100){const s=t-100,i=e.length;for(let t=0;t<s;++t){let t=-1,s=1;for(let n=0;n<i;++n){let i=e[n]%1;i>=.5&&i<s&&(s=i,t=n)}if(-1==t)return;e[t]-=s}}else if(t<100){const s=100-t,i=e.length;for(let t=0;t<s;++t){let t=-1,s=0;for(let n=0;n<i;++n){let i=e[n]%1;i<.5&&i>s&&(s=i,t=n)}if(-1==t)return;e[t]+=1-s}}};const p=[];o.$rootScope.$on("poll_update",e=>{const{poll:t,results:s}=e.detail;for(const e of p)if(e.id==t.id){const i=e.element;i.isClosed=!!t.pFlags.closed,i.performResults(s,t.chosenIndexes)}}),o.$rootScope.$on("peer_changed",()=>{m&&f(m,g,v)});const f=(e,t,s)=>{e.classList.remove("active"),clearTimeout(s),setTimeout(()=>{t(),e.remove(),m==e&&g==t&&v==s&&(m=g=null,v=0)},200)};let m,g,v;class b extends HTMLElement{constructor(){super(),this.maxOffset=-46.5,this.isClosed=!1,this.isQuiz=!1,this.isRetracted=!1,this.isPublic=!1,this.isMultiple=!1,this.chosenIndexes=[],this.chosingIndexes=[]}connectedCallback(){h||(h=document.getElementById("poll-line").getTotalLength(),console.log("line total length:",h)),this.pollID=this.getAttribute("poll-id"),this.mid=+this.getAttribute("message-id");const{poll:e,results:t}=n.default.getPoll(this.pollID);p.push({id:this.pollID,element:this}),console.log("pollElement poll:",e,t);let s="";if(e.pFlags)if(this.isPublic=!!e.pFlags.public_voters,this.isQuiz=!!e.pFlags.quiz,this.isClosed=!!e.pFlags.closed,this.isMultiple=!!e.pFlags.multiple_choice,this.isClosed)s="Final results",this.classList.add("is-closed");else{let e=this.isQuiz?"Quiz":"Poll";s=(this.isPublic?"":"Anonymous ")+e}const i=this.isMultiple?'<span class="poll-answer-selected tgico-check"></span>':"",c=e.answers.map((e,t)=>`\n <div class="poll-answer" data-index="${t}">\n <div class="circle-hover">\n <div class="animation-ring"></div>\n <svg class="progress-ring">\n <circle class="progress-ring__circle" cx="13" cy="13" r="9"></circle>\n </svg>\n ${i}\n </div>\n <div class="poll-answer-percents"></div>\n <div class="poll-answer-text">${a.RichTextProcessor.wrapEmojiText(e.text)}</div>\n <svg version="1.1" class="poll-line" style="display: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 ${r.mediaSizes.active.regular.width} 35" xml:space="preserve">\n <use href="#poll-line"></use>\n </svg>\n <span class="poll-answer-selected tgico"></span>\n </div>\n `).join("");if(this.innerHTML=`\n <div class="poll-title">${e.rQuestion}</div>\n <div class="poll-desc">\n <div class="poll-type">${s}</div>\n <div class="poll-avatars"></div>\n </div>\n ${c}\n <div class="poll-footer">\n <div class="poll-footer-button poll-view-results hide">View Results</div>\n <div class="poll-votes-count"></div>\n </div>\n `,this.descDiv=this.firstElementChild.nextElementSibling,this.typeDiv=this.descDiv.firstElementChild,this.avatarsDiv=this.descDiv.lastElementChild,this.isQuiz&&(this.classList.add("is-quiz"),e.close_period&&e.close_date)){const t=document.createElement("div");t.classList.add("poll-time"),this.descDiv.append(t);const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.classList.add("poll-quiz-timer"),this.quizTimer=s;const i=2,a=7,o=2*Math.PI*a,r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.classList.add("poll-quiz-timer-circle"),r.setAttributeNS(null,"cx","16"),r.setAttributeNS(null,"cy","16"),r.setAttributeNS(null,"r",""+a),r.setAttributeNS(null,"stroke-width",""+i),s.append(r),this.descDiv.append(s);const l=1e3*e.close_period,d=1e3*(e.close_date-u.default.serverTimeOffset);this.quizInterval=setInterval(()=>{const e=Date.now(),s=(d-e)/l,i=(d-e)/1e3+1|0;t.innerHTML=String(i).toHHMMSS(),i<=5&&(t.style.color="#ee545c",r.style.stroke="#ee545c"),r.style.strokeDashoffset=o+s*o,r.style.strokeDasharray=`${o} ${o}`,e>=d&&(clearInterval(this.quizInterval),t.innerHTML="",r.style.strokeDashoffset=o,this.quizInterval=0,setTimeout(()=>{n.default.getResults(this.mid)},3e3))},1e3)}this.answerDivs=Array.from(this.querySelectorAll(".poll-answer")),this.svgLines=Array.from(this.querySelectorAll(".poll-line")),this.numberDivs=Array.from(this.querySelectorAll(".poll-answer-percents"));const f=this.lastElementChild;this.viewResults=f.firstElementChild,this.votersCountDiv=f.lastElementChild,this.viewResults.addEventListener("click",e=>{o.cancelEvent(e),d.default.pollResultsTab.init(this.pollID,this.mid)}),l.ripple(this.viewResults),this.isMultiple&&(this.sendVoteBtn=document.createElement("div"),this.sendVoteBtn.classList.add("poll-footer-button","poll-send-vote"),this.sendVoteBtn.innerText="Vote",l.ripple(this.sendVoteBtn),e.chosenIndexes.length||this.votersCountDiv.classList.add("hide"),this.sendVoteBtn.addEventListener("click",()=>{this.chosingIndexes.length&&this.sendVotes(this.chosingIndexes).then(()=>{this.chosingIndexes.length=0,this.answerDivs.forEach(e=>{e.classList.remove("is-chosing")})})}),f.append(this.sendVoteBtn));const m=this.getBoundingClientRect().width;this.maxLength=m+9+this.maxOffset+-13.7,e.chosenIndexes.length||this.isClosed?this.performResults(t,e.chosenIndexes):this.isClosed||(this.setVotersCount(t),this.addEventListener("click",this.clickHandler))}disconnectedCallback(){p.findAndSplice(e=>e.element==this)}static get observedAttributes(){return["poll-id","message-id"]}attributeChangedCallback(e,t,s){"poll-id"==e?this.pollID=s:"message-id"==e&&(this.mid=+s)}adoptedCallback(){}initQuizHint(e){if(e.solution&&e.solution_entities){const t=document.createElement("div");t.classList.add("tgico-tip","poll-hint"),this.descDiv.append(t),t.addEventListener("click",s=>{o.cancelEvent(s),t.classList.add("active"),((e,t,s)=>{m&&f(m,g,v);const i=document.createElement("div");i.classList.add("quiz-hint");const n=document.createElement("div");n.classList.add("container","tgico");const o=document.createElement("div");o.classList.add("text"),n.append(o),i.append(n),o.innerHTML=a.RichTextProcessor.wrapRichText(e,{entities:t}),c.default.bubblesContainer.append(i),i.offsetLeft,i.classList.add("active"),m=i,g=s,v=setTimeout(()=>{f(i,s,v)},r.touchSupport?5e3:7e3)})(e.solution,e.solution_entities,()=>{t.classList.remove("active")})})}}clickHandler(e){const t=o.findUpClassName(e.target,"poll-answer");if(!t)return;const s=+t.dataset.index;if(this.isMultiple){t.classList.toggle("is-chosing");const e=this.chosingIndexes.indexOf(s);-1!==e?this.chosingIndexes.splice(e,1):this.chosingIndexes.push(s)}else this.sendVotes([s])}sendVotes(e){if(this.sendVotePromise)return this.sendVotePromise;const t=this.answerDivs.filter((t,s)=>e.includes(s));return t.forEach(e=>{e.classList.add("is-voting")}),this.classList.add("disable-hover"),this.sendVotePromise=n.default.sendVote(this.mid,e).then(()=>{t.forEach(e=>{e.classList.remove("is-voting")}),this.classList.remove("disable-hover")}).finally(()=>{this.sendVotePromise=null})}performResults(e,t){var s,i;if(this.isQuiz&&((null===(s=e.results)||void 0===s?void 0:s.length)||this.isClosed)){this.answerDivs.forEach((t,s)=>{t.classList.toggle("is-correct",!!e.results[s].pFlags.correct)}),this.initQuizHint&&(this.initQuizHint(e),this.initQuizHint=null),this.quizInterval&&(clearInterval(this.quizInterval),this.quizInterval=0),(null===(i=this.quizTimer)||void 0===i?void 0:i.parentElement)&&this.quizTimer.remove();const t=this.descDiv.querySelector(".poll-time");t&&t.remove()}if(this.isClosed&&(this.classList.add("is-closed"),this.typeDiv.innerText="Final results"),(this.chosenIndexes.length!=t.length||this.isClosed)&&(this.isRetracted=this.chosenIndexes.length&&!t.length,this.chosenIndexes=t.slice(),this.isRetracted?this.addEventListener("click",this.clickHandler):this.removeEventListener("click",this.clickHandler)),this.chosenIndexes.length||this.isRetracted||this.isClosed){const t=e.results.map(t=>e.total_voters?t.voters/e.total_voters*100:0);this.setResults(this.isRetracted?this.percents:t,this.chosenIndexes),this.percents=t,this.isRetracted=!1}if(this.setVotersCount(e),this.isPublic){this.isMultiple||(this.viewResults.classList.toggle("hide",!e.total_voters||!this.chosenIndexes.length),this.votersCountDiv.classList.toggle("hide",!!this.chosenIndexes.length));let t="";e.recent_voters.forEach((e,s)=>{t+=`<avatar-element dialog="0" peer="${e}" ${0==s?"":`style="transform: translateX(-${3*s}px);"`}></avatar-element>`}),this.avatarsDiv.innerHTML=t}this.isMultiple&&(this.sendVoteBtn.classList.toggle("hide",!!this.chosenIndexes.length),this.chosenIndexes.length?this.isPublic?(this.viewResults.classList.toggle("hide",!e.total_voters||!this.chosenIndexes.length),this.votersCountDiv.classList.toggle("hide",!!this.chosenIndexes.length)):this.votersCountDiv.classList.toggle("hide",!this.chosenIndexes.length):(this.votersCountDiv.classList.add("hide"),this.viewResults.classList.add("hide")))}setResults(e,s){this.svgLines.forEach(e=>e.style.display=""),this.answerDivs.forEach((e,t)=>{e.classList.toggle("is-chosen",s.includes(t))});const i=Math.max(...e);if(this.maxLengths=e.map(e=>e/i*this.maxLength),this.isRetracted?this.svgLines.forEach((e,t)=>{this.setLineProgress(t,-1)}):this.svgLines.forEach((e,t)=>{e.getBoundingClientRect(),this.setLineProgress(t,1)}),e=e.slice(),t.roundPercents(e),this.isRetracted)for(let t=9,s=0;t>=0;--t,++s)setTimeout(()=>{e.forEach((e,s)=>{const i=Math.round(e/10*t);this.numberDivs[s].innerText=i+"%"})},34*s);else for(let t=0;t<10;++t)setTimeout(()=>{e.forEach((e,s)=>{const i=Math.round(e/10*(t+1));this.numberDivs[s].innerText=i+"%"})},34*t);this.isRetracted?(this.classList.add("is-retracting"),this.classList.remove("is-voted"),setTimeout(()=>{this.classList.remove("is-retracting"),this.svgLines.forEach(e=>e.style.display="none")},340)):this.classList.add("is-voted")}setVotersCount(e){const t=e.total_voters||0,s=this.isQuiz?t>1||!t?"answers":"answer":t>1||!t?"votes":"vote";this.votersCountDiv.innerText=""+(e.total_voters?e.total_voters+" "+s:"No "+s)}setLineProgress(e,t){const s=this.svgLines[e];-1==t?(s.style.strokeDasharray="",s.style.strokeDashoffset=""):(s.style.strokeDasharray=t*this.maxLengths[e]+", 485.9",s.style.strokeDashoffset=""+t*this.maxOffset)}}t.default=b,customElements.define("poll-element",b)},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(0),a=i(s(6)),o=i(s(12)),r=i(s(45));const l=new class{constructor(){this.audios={},this.onPause=e=>{n.$rootScope.$broadcast("audio_pause")},this.onEnded=e=>{this.onPause(e),this.nextMid&&this.audios[this.nextMid].play()},this.container=document.createElement("div"),this.container.style.cssText="display: none;",document.body.append(this.container)}addAudio(e,t){if(this.audios[t])return this.audios[t];const s=document.createElement("audio"),i=document.createElement("source");return i.type="voice"!=e.type||r.default.isPlaySupported()?e.mime_type:"audio/wav",s.autoplay=!1,s.volume=1,s.append(i),s.addEventListener("playing",i=>{this.playingAudio!=s&&(this.playingAudio&&!this.playingAudio.paused&&this.playingAudio.pause(),this.playingAudio=s,this.loadSiblingsAudio(e.type,t)),setTimeout(()=>{n.$rootScope.$broadcast("audio_play",{doc:e,mid:t})},0)}),s.addEventListener("pause",this.onPause),s.addEventListener("ended",this.onEnded),o.default.downloadDoc(e.id).then(()=>{this.container.append(s),i.src=e.url},()=>{this.nextMid==t&&this.loadSiblingsAudio(e.type,t).then(()=>{this.nextMid&&this.audios[this.nextMid]&&this.audios[this.nextMid].play()})}),this.audios[t]=s}loadSiblingsAudio(e,t){const s=this.playingAudio,i=a.default.getMessage(t);return this.prevMid=this.nextMid=0,a.default.getSearch(i.peerID,"",{_:"audio"==e?"inputMessagesFilterMusic":"inputMessagesFilterVoice"},t,3,0,2).then(i=>{if(this.playingAudio==s){for(let e of i.history)if(e>t)this.nextMid=e;else if(e<t){this.prevMid=e;break}[this.prevMid,this.nextMid].filter(Boolean).forEach(e=>{const t=a.default.getMessage(e);this.addAudio(t.media.document,e)}),console.log("loadSiblingsAudio",s,e,t,i,this.prevMid,this.nextMid)}})}toggle(){this.playingAudio&&(this.playingAudio.paused?this.playingAudio.play():this.playingAudio.pause())}};t.default=l},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(1);t.default=class{constructor(e,t){this.sidebarEl=e,this.tabs=t,this.historyTabIDs=[],this._selectTab=i.horizontalMenu(null,this.sidebarEl.querySelector(".sidebar-slider"),null,null,420),this._selectTab(0);let s=()=>{let e=this.historyTabIDs.pop();this.onCloseTab(e),this._selectTab(this.historyTabIDs[this.historyTabIDs.length-1]||0)};Array.from(this.sidebarEl.querySelectorAll(".sidebar-close-button")).forEach(e=>{e.addEventListener("click",s)})}selectTab(e){if(this.historyTabIDs[this.historyTabIDs.length-1]==e)return;const t=this.tabs[e];t&&(t.onOpen&&t.onOpen(),t.onOpenAfterTimeout&&setTimeout(()=>{t.onOpenAfterTimeout()},420)),this.historyTabIDs.push(e),this._selectTab(e)}removeTabFromHistory(e){this.historyTabIDs.findAndSplice(t=>t==e),this.onCloseTab(e)}onCloseTab(e){let t=this.tabs[e];t&&(t.onClose&&t.onClose(),t.onCloseAfterTimeout&&setTimeout(()=>{t.onCloseAfterTimeout()},420))}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(30),a=i(s(40)),o=s(3),r=i(s(9)),l=s(24),d=i(s(31)),c=s(1),u=i(s(20)),h=s(0),p=i(s(18));class f extends n.PopupElement{constructor(e){super("popup-stickers",null,{closable:!0,body:!0}),this.stickerSetInput=e,this.onFooterClick=()=>{this.stickersFooter.setAttribute("disabled","true"),a.default.toggleStickerSet(this.set).then(()=>{this.closeBtn.click()}).catch(()=>{this.stickersFooter.removeAttribute("disabled")})},this.onStickersClick=e=>{const t=h.findUpClassName(e.target,"sticker-set-sticker");if(!t)return;const s=t.dataset.docID;p.default.chatInputC.sendMessageWithDocument(s)?this.closeBtn.click():console.warn("got no doc by id:",s)},this.h6=document.createElement("h6"),this.h6.innerText="Loading...",this.header.append(this.h6),this.onClose=()=>{u.default.checkAnimations(!1),this.stickersFooter.removeEventListener("click",this.onFooterClick),this.stickersDiv.removeEventListener("click",this.onStickersClick),this.element.removeEventListener("click",t)},this.onCloseAfterTimeout=()=>{u.default.checkAnimations(void 0,"STICKERS-POPUP")};const t=e=>{h.findUpClassName(e.target,"popup-container")||this.closeBtn.click()};this.element.addEventListener("click",t);const s=document.createElement("div");s.classList.add("sticker-set"),this.stickersDiv=document.createElement("div"),this.stickersDiv.classList.add("sticker-set-stickers"),c.putPreloader(this.stickersDiv),this.stickersFooter=document.createElement("div"),this.stickersFooter.classList.add("sticker-set-footer"),s.append(this.stickersDiv),this.stickersFooter.innerText="Loading...",this.body.append(s);new r.default(this.body,"y",void 0);this.body.append(this.stickersFooter),this.loadStickerSet()}loadStickerSet(){return a.default.getStickerSet(this.stickerSetInput).then(e=>{this.set=e.set,u.default.checkAnimations(!0),this.h6.innerHTML=o.RichTextProcessor.wrapEmojiText(e.set.title),e.set.installed_date?this.stickersFooter.classList.remove("add"):this.stickersFooter.classList.add("add"),this.stickersFooter.innerHTML=e.set.hasOwnProperty("installed_date")?'<div style="cursor: pointer; margin: 0 auto; width: 150px;">Remove stickers</div>':`<button class="btn-primary">ADD ${e.set.count} STICKERS</button>`,this.stickersFooter.addEventListener("click",this.onFooterClick),e.documents.length&&this.stickersDiv.addEventListener("click",this.onStickersClick);const t=new d.default;this.stickersDiv.innerHTML="";for(let s of e.documents){const e=document.createElement("div");e.classList.add("sticker-set-sticker"),l.wrapSticker({doc:s,div:e,lazyLoadQueue:t,group:"STICKERS-POPUP",play:!0,loop:!0,width:80,height:80}),this.stickersDiv.append(e)}})}}t.default=f},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(26)),a=s(1),o=i(s(17)),r=i(s(2)),l=i(s(19)),d=s(4);const c=new l.default("page-password",!0,()=>{let e,t=0,s=!1;const i=c.pageEl.querySelector("button"),l=document.getElementById("password"),u=c.pageEl.querySelector(".toggle-visible");let h=e=>{i.removeAttribute("disabled"),e.type,i.innerText=e.type};u.addEventListener("click",(function(i){s=!s,s?(this.classList.add("tgico-eye2"),l.setAttribute("type","text"),e.setDirection(1),e.curFrame=0,t=16,e.play()):(this.classList.remove("tgico-eye2"),l.setAttribute("type","password"),e.setDirection(-1),e.curFrame=16,t=0,e.play())})),i.addEventListener("click",(function(t){if(!l.value.length)return void l.classList.add("error");this.setAttribute("disabled","true");let s=l.value;this.textContent="PLEASE WAIT...",a.putPreloader(this),r.default.checkPassword(s).then(t=>{switch(t._){case"auth.authorization":r.default.setUserAuth({id:t.user.id}),n.default.mount(),e&&e.remove();break;default:i.removeAttribute("disabled"),i.innerText=t._}}).catch(h)})),l.addEventListener("keypress",(function(e){if(this.classList.remove("error"),"Enter"==e.key)return i.click()}));const p=d.mediaSizes.isMobile?100:166;return Promise.all([o.default.loadAnimationFromURL({container:c.pageEl.querySelector(".auth-image"),loop:!1,autoplay:!1,width:p,height:p,noCache:!0},"assets/img/TwoFactorSetupMonkeyPeek.tgs").then(s=>{e=s,e.addListener("enterFrame",s=>{(1==e.direction&&s>=t||-1==e.direction&&s<=t)&&(e.setSpeed(1),e.pause())}),t=49})])});t.default=c},,function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),s(63),s(64),s(65);const r=s(66),l=s(73);document.addEventListener("DOMContentLoaded",()=>o(void 0,void 0,void 0,(function*(){let e=()=>{let e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",e+"px")};window.addEventListener("resize",e),e();let t=(yield Promise.resolve().then(()=>a(s(16)))).default;yield Promise.resolve().then(()=>a(s(32)));let i=yield t.get("user_auth");-1!=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)?document.documentElement.classList.add("is-mac","emoji-supported"):-1!=navigator.userAgent.toLowerCase().indexOf("android")&&document.documentElement.classList.add("is-android"),"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch||document.documentElement.classList.add("no-touch");let n=i.id||0;n?(yield Promise.resolve().then(()=>a(s(26)))).default.mount():((yield Promise.resolve().then(()=>a(s(44)))).default.mount(),r.computeCheck(l.password,{current_algo:{salt1:l.salt1,salt2:l.salt2,p:l.p,g:l.g},srp_id:l.srp_id,srp_B:l.srp_B,secure_random:l.secure_random}).then(e=>{console.log(e)}));let o=yield Promise.resolve().then(()=>a(s(0)));o.$rootScope.myID=n;let d=o.findUpClassName;Array.from(document.body.getElementsByClassName("popup-close")).forEach(e=>{let t=d(e,"popup");e.addEventListener("click",()=>{t.classList.remove("active")})});let c=(yield Promise.resolve().then(()=>a(s(1)))).ripple;Array.from(document.getElementsByClassName("rp")).forEach(e=>c(e))})))},function(e,t,s){},function(e,t,s){},function(e,t,s){},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.computeCheck=t.makePasswordHash=void 0;const a=s(11),o=n(s(67)),r=s(50),l=s(7).logger("SRP");function d(e,t,s){return i(this,void 0,void 0,(function*(){let i="";for(let e=0;e<t.length;e++)i+=String.fromCharCode(t[e]);let n=yield o.default.sha256Hash(i+e+i);n=a.bufferConcats(s,n,s),n=yield o.default.sha256Hash(n);let r=yield o.default.pbkdf2(new Uint8Array(n),t,1e5);return r=a.bufferConcats(s,r,s),n=yield o.default.sha256Hash(r),n}))}t.makePasswordHash=d,t.computeCheck=function(e,t){return i(this,void 0,void 0,(function*(){console.log("computeCheck:",e,t);let s=t.current_algo,n=r.str2bigInt(a.bytesToHex(s.p),16),c=r.str2bigInt(a.bytesToHex(t.srp_B),16),u=r.int2bigInt(s.g,32,256);l("p",r.bigInt2str(n,16)),l("B",r.bigInt2str(c,16));let h=yield d(e,new Uint8Array(s.salt1),new Uint8Array(s.salt2)),p=r.str2bigInt(a.bytesToHex(new Uint8Array(h)),16);l("computed pw_hash:",h,p,a.bytesToHex(new Uint8Array(h)));var f=function(e,t,s=0){return Array(t).fill(s).concat(e).slice(-t)};let m=f(a.bytesFromHex(r.bigInt2str(n,16)),256),g=f(a.bytesFromHex(r.bigInt2str(u,16)),256),v=f(a.bytesFromHex(r.bigInt2str(c,16)),256);l(a.bytesToHex(m)),l(a.bytesToHex(g)),l(a.bytesToHex(v));let b=r.powMod(u,p,n);l("g_x",r.bigInt2str(b,16));let y=yield o.default.sha256Hash(a.bufferConcat(m,g));y=r.str2bigInt(a.bytesToHex(new Uint8Array(y)),16),l("k",r.bigInt2str(y,16));let _=r.mod(r.mult(y,b),n);l("kg_x",r.bigInt2str(_,16));let w=(e,t)=>{let s=r.sub(t,e);return!(r.negative(s)||r.bitSize(s)<1984||r.bitSize(e)<1984||Math.floor((r.bitSize(e)+7)/8)>256)},{a:S,a_for_hash:L,u:M}=yield(()=>i(this,void 0,void 0,(function*(){for(;;){const e=r.str2bigInt(a.bytesToHex(t.secure_random),16);console.log("ITERATION"),l("g a p",r.bigInt2str(u,16),r.bigInt2str(e,16),r.bigInt2str(n,16));const s=r.powMod(u,e,n);if(l("A MODPOW",r.bigInt2str(s,16)),w(s,n)){const t=a.bytesFromHex(r.bigInt2str(s,16)),i=yield o.default.sha256Hash(a.bufferConcat(new Uint8Array(t),new Uint8Array(v))),n=r.str2bigInt(a.bytesToHex(new Uint8Array(i)),16);if(!r.isZero(n)&&!r.negative(n))return{a:e,a_for_hash:t,u:n}}}})))();l("a",r.bigInt2str(S,16)),l("a_for_hash",a.bytesToHex(L)),l("u",r.bigInt2str(M,16));let D=r.sub(c,_);r.negative(D)&&(D=r.add(D,n)),l("g_b",r.bigInt2str(D,16));let E=r.mult(M,p);l("u and x multiply",r.bigInt2str(M,16),r.bigInt2str(p,16),r.bigInt2str(E,16));let I=r.add(S,E),P=r.powMod(D,I,n),C=yield o.default.sha256Hash(f(a.bytesFromHex(r.bigInt2str(P,16)),256));l("K",a.bytesToHex(C),new Uint32Array(new Uint8Array(C).buffer));let T=yield o.default.sha256Hash(m),k=yield o.default.sha256Hash(g);T=a.bytesXor(new Uint8Array(T),new Uint8Array(k));let X=a.bufferConcats(T,yield o.default.sha256Hash(s.salt1),yield o.default.sha256Hash(s.salt2),L,v,C),A=yield o.default.sha256Hash(X),x={_:"inputCheckPasswordSRP",srp_id:t.srp_id,A:new Uint8Array(L),M1:new Uint8Array(A)};return l("out",a.bytesToHex(x.A),a.bytesToHex(x.M1)),x}))}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(11),l=o(s(49));class d extends l.default{constructor(){super(),this.webWorker=!1,this.taskID=0,this.awaiting={},this.pending=[],this.debug=!1,this.utils={},console.log(r.dT(),"CW constructor"),Promise.all([Promise.resolve().then(()=>a(s(68))).then(e=>{Object.assign(this.utils,{"sha1-hash":e.sha1HashSync,"sha256-hash":e.sha256HashSync,pbkdf2:e.hash_pbkdf2,"aes-encrypt":e.aesEncryptSync,"aes-decrypt":e.aesDecryptSync,"rsa-encrypt":e.rsaEncrypt,factorize:e.pqPrimeFactorization,"mod-pow":e.bytesModPow,unzip:e.gzipUncompress})})])}finalizeTask(e,t){let s=this.awaiting[e];void 0!==s&&(this.debug&&console.log(r.dT(),"CW done",s.taskName,t),s.resolve(t),delete this.awaiting[e])}performTaskWorker(e,...t){return this.debug&&console.log(r.dT(),"CW start",e,t),Promise.resolve(this.utils[e](...t))}releasePending(){this.webWorker&&(this.pending.forEach(e=>{this.webWorker.postMessage(e)}),this.pending.length=0)}}const c=new d;t.default=c},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.gzipUncompress=t.bytesModPow=t.pqPrimeLeemon=t.pqPrimeFactorization=t.hash_pbkdf2=t.rsaEncrypt=t.aesDecryptSync=t.aesEncryptSync=t.sha256HashSync=t.sha1HashSync=t.bytesFromLeemonBigInt=void 0;const a=n(s(69)),o=n(s(70)),r=s(71),l=n(s(72)),d=s(50),c=s(43),u=s(11);function h(e){var t=d.bigInt2str(e,16);return u.bytesFromHex(t)}function p(e){var t,s,i,n,a,o,r=Math.ceil(64/d.bpe)+1,l=0,c=new Array(r),p=new Array(r),f=new Array(r),m=new Array(r),g=new Array(r),v=new Array(r),b=new Array(r);for(t=0;t<3;t++){for(s=17+(15&u.nextRandomInt(128)),d.copyInt_(v,u.nextRandomInt(1e9)+1),d.copy_(b,v),n=1<<t+18,i=1;i<n;i++){for(++l,d.copy_(c,v),d.copy_(p,v),d.copyInt_(f,s);!d.isZero(p);)1&p[0]&&(d.add_(f,c),d.greater(f,e)&&d.sub_(f,e)),d.add_(c,c),d.greater(c,e)&&d.sub_(c,e),d.rightShift_(p,1);if(d.copy_(v,f),d.greater(v,b)?(d.copy_(g,v),d.sub_(g,b)):(d.copy_(g,b),d.sub_(g,v)),d.eGCD_(g,e,m,c,p),!d.equalsInt(m,1))break;0==(i&i-1)&&d.copy_(b,v)}if(d.greater(m,d.one))break}return d.divide_(e,m,v,b),d.greater(m,v)?(a=v,o=m):(a=m,o=v),[h(a),h(o),l]}t.bytesFromLeemonBigInt=h,t.sha1HashSync=function(e){const t=[];let s=a.default(String.fromCharCode.apply(null,e instanceof Uint8Array?[...e]:[...new Uint8Array(e)]));for(let e=0;e<s.length;++e)t.push(s.charCodeAt(e));return new Uint8Array(t)},t.sha256HashSync=function(e){let t="string"==typeof e?e:u.bytesToWordss(e),s=o.default(t);return console.log(u.dT(),"SHA-256 hash finish",s),u.bytesFromWordss(s)},t.aesEncryptSync=function(e,t,s){e=u.addPadding(e);const i=new r.IGE(u.bytesToWordss(t),u.bytesToWordss(s)).encrypt(u.bytesToWordss(e));return u.bytesFromWordss(i)},t.aesDecryptSync=function(e,t,s){const i=new r.IGE(u.bytesToWordss(t),u.bytesToWordss(s)).decrypt(u.bytesToWordss(e));return u.bytesFromWordss(i)},t.rsaEncrypt=function(e,t){t=u.addPadding(t,255);var s=d.str2bigInt(e.modulus,16),i=d.str2bigInt(e.exponent,16),n=d.str2bigInt(u.bytesToHex(t),16),a=d.powMod(n,i,s);return u.bytesFromHex(d.bigInt2str(a,16))},t.hash_pbkdf2=function(e,t,s){return i(this,void 0,void 0,(function*(){console.log("hash_pbkdf2",window.crypto);let i="undefined"!=typeof window&&"crypto"in window?window.crypto.subtle:self.crypto.subtle,n=yield i.importKey("raw",e,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);return yield i.deriveKey({name:"PBKDF2",salt:t,iterations:s,hash:{name:"SHA-512"}},n,{name:"AES-CTR",length:256},!1,["encrypt","decrypt"]),i.deriveBits({name:"PBKDF2",salt:t,iterations:s,hash:{name:"SHA-512"}},n,512)}))},t.pqPrimeFactorization=function(e){var t=new c.BigInteger(e),s=!1;try{s=p(d.str2bigInt(t.toString(16),16,Math.ceil(64/d.bpe)+1))}catch(e){console.error("Pq leemon Exception",e)}return s},t.pqPrimeLeemon=p,t.bytesModPow=function(e,t,s){try{var i=d.str2bigInt(u.bytesToHex(e),16),n=d.str2bigInt(u.bytesToHex(t),16),a=d.str2bigInt(u.bytesToHex(s),16),o=d.powMod(i,n,a);return u.bytesFromHex(d.bigInt2str(o,16))}catch(e){console.error("mod pow error",e)}return u.bytesFromBigInt(new c.BigInteger(e).modPow(new c.BigInteger(t),new c.BigInteger(s)),256)},t.gzipUncompress=function(e,t){return l.default.inflate(e,t?{to:"string"}:void 0)}},,,,,function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.M1=t.A=t.password=t.secure_random=t.srp_B=t.srp_id=t.p=t.g=t.salt2=t.salt1=void 0,t.salt1=new Uint8Array([108,23,241,155,79,48,253,215,92,212,151,60,77,72,210,230,217,172,216,186,78,155,74,222,218,215,244,86,184,216,114,55,240,72,115,137,140,44,150,189]),t.salt2=new Uint8Array([214,196,182,227,178,250,251,153,117,215,110,15,218,23,7,32]),t.g=3,t.p=new Uint8Array([199,28,174,185,198,177,201,4,142,108,82,47,112,241,63,115,152,13,64,35,142,62,33,193,73,52,208,55,86,61,147,15,72,25,138,10,167,193,64,88,34,148,147,210,37,48,244,219,250,51,111,110,10,201,37,19,149,67,174,212,76,206,124,55,32,253,81,246,148,88,112,90,198,140,212,254,107,107,19,171,220,151,70,81,41,105,50,132,84,241,143,175,140,89,95,100,36,119,254,150,187,42,148,29,91,205,29,74,200,204,73,136,7,8,250,155,55,142,60,79,58,144,96,190,230,124,249,164,164,166,149,129,16,81,144,126,22,39,83,181,107,15,107,65,13,186,116,216,168,75,42,20,179,20,78,14,241,40,71,84,253,23,237,149,13,89,101,180,185,221,70,88,45,177,23,141,22,156,107,196,101,176,214,255,156,163,146,143,239,91,154,228,228,24,252,21,232,62,190,160,248,127,169,255,94,237,112,5,13,237,40,73,244,123,249,89,217,86,133,12,233,41,133,31,13,129,21,246,53,177,5,238,46,78,21,208,75,36,84,191,111,79,173,240,52,177,4,3,17,156,216,227,185,47,204,91]),t.srp_id="10228843227482754785",t.srp_B=new Uint8Array([78,181,141,110,62,210,0,137,233,2,94,204,134,191,23,80,208,122,105,215,135,10,9,200,220,234,209,243,78,252,250,238,153,82,10,33,56,31,250,226,103,21,177,58,6,222,103,77,68,170,103,49,29,122,18,49,235,225,133,16,103,184,108,226,61,190,176,18,182,108,140,132,177,94,79,162,173,16,68,26,254,44,146,24,139,75,25,138,1,102,213,23,242,234,105,105,54,242,108,64,212,99,244,26,125,51,138,160,254,198,183,217,225,181,116,98,167,231,138,132,39,95,139,188,48,178,198,145,165,185,53,8,123,167,28,250,128,255,216,252,171,242,81,34,146,215,103,69,79,17,247,125,1,209,90,105,45,25,25,147,37,94,239,221,91,245,56,129,83,197,43,83,50,86,50,109,58,49,237,223,115,98,246,23,73,32,248,5,243,176,65,84,35,65,200,166,4,104,54,211,154,15,197,103,99,155,81,54,168,212,136,192,117,227,27,131,76,28,175,123,1,84,162,225,80,62,23,218,57,176,235,255,167,2,128,191,101,197,240,127,34,46,163,77,211,76,87,22,178,166,56,72,178,121,97,5]),t.secure_random=new Uint8Array([29,20,102,17,209,122,75,93,15,179,65,62,251,67,239,207,176,59,143,163,111,179,51,235,107,151,95,116,120,97,47,41,154,165,6,121,197,14,115,72,66,146,1,157,19,29,165,176,137,156,39,218,86,134,160,3,90,240,162,68,24,43,100,125,178,242,16,199,197,163,247,233,147,194,177,11,188,242,13,13,59,14,70,166,26,3,172,89,223,254,211,43,128,140,176,176,86,239,101,94,121,157,24,159,51,142,205,83,219,138,21,133,74,212,200,4,145,36,245,103,218,145,248,235,72,24,199,72,24,86,221,87,134,254,6,60,187,69,189,197,147,73,31,217,17,4,13,48,96,186,151,67,155,68,212,247,92,99,236,32,10,75,166,171,8,37,245,48,231,161,100,191,24,177,16,67,16,176,184,164,252,1,158,116,70,151,103,226,229,12,229,32,193,1,55,114,150,3,208,60,105,191,47,49,87,75,50,60,88,32,6,66,4,196,113,248,148,82,23,164,222,148,204,138,115,173,9,79,92,223,19,156,113,186,9,65,147,185,85,76,132,149,135,132,191,131,132,88,138,126,2,186,63,49,237,237]),t.password="Hasmik8532",t.A=new Uint8Array([83,39,191,14,107,40,208,117,127,162,171,35,156,175,116,44,114,104,144,149,197,220,239,15,84,41,229,26,60,164,41,153,170,155,72,46,114,15,217,162,75,233,147,26,165,65,6,13,242,240,128,6,217,196,236,88,122,67,77,135,171,42,94,246,29,69,233,121,57,87,230,208,222,175,12,121,30,186,239,85,217,249,193,244,236,252,141,87,38,108,69,151,4,128,94,169,36,55,205,131,157,200,32,140,233,250,181,43,249,189,97,64,232,39,131,181,44,201,182,50,204,60,122,95,53,107,37,40,17,20,252,203,207,244,59,183,153,166,205,214,246,104,117,60,38,163,95,148,85,24,104,117,173,70,176,69,228,137,5,160,160,201,200,245,100,250,153,128,96,216,243,219,73,118,146,19,176,73,224,74,216,48,117,14,80,93,30,203,218,205,91,211,32,145,246,89,25,184,160,133,227,49,94,252,162,225,165,235,65,164,29,239,187,99,237,57,196,108,153,25,127,68,197,59,1,18,75,221,171,241,246,152,36,87,245,61,201,211,71,122,110,183,69,4,108,112,149,32,130,92,87,26,99,183,223,161]),t.M1=new Uint8Array([134,71,240,195,129,77,203,169,252,229,59,164,13,135,146,8,128,164,19,237,220,204,89,149,162,137,246,224,140,33,81,44])},function(e,t,s){!function(){"use strict";e.exports={polyfill:function(){var e=window,t=document;if(!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var s,i=e.HTMLElement||e.Element,n=468,a={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:i.prototype.scroll||l,scrollIntoView:i.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,r=(s=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(s)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==d(arguments[0])?p.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):a.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(d(arguments[0])?a.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):p.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},i.prototype.scroll=i.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==d(arguments[0])){var e=arguments[0].left,t=arguments[0].top;p.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");a.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},i.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==d(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):a.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},i.prototype.scrollIntoView=function(){if(!0!==d(arguments[0])){var s=function(e){for(;e!==t.body&&!1===(i=c(s=e,"Y")&&u(s,"Y"),n=c(s,"X")&&u(s,"X"),i||n);)e=e.parentNode||e.host;var s,i,n;return e}(this),i=s.getBoundingClientRect(),n=this.getBoundingClientRect();s!==t.body?(p.call(this,s,s.scrollLeft+n.left-i.left,s.scrollTop+n.top-i.top),"fixed"!==e.getComputedStyle(s).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:n.left,top:n.top,behavior:"smooth"})}else a.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function l(e,t){this.scrollLeft=e,this.scrollTop=t}function d(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+r<e.scrollHeight:"X"===t?e.clientWidth+r<e.scrollWidth:void 0}function u(t,s){var i=e.getComputedStyle(t,null)["overflow"+s];return"auto"===i||"scroll"===i}function h(t){var s,i,a,r,l=(o()-t.startTime)/n;r=l=l>1?1:l,s=.5*(1-Math.cos(Math.PI*r)),i=t.startX+(t.x-t.startX)*s,a=t.startY+(t.y-t.startY)*s,t.method.call(t.scrollable,i,a),i===t.x&&a===t.y||e.requestAnimationFrame(h.bind(e,t))}function p(s,i,n){var r,d,c,u,p=o();s===t.body?(r=e,d=e.scrollX||e.pageXOffset,c=e.scrollY||e.pageYOffset,u=a.scroll):(r=s,d=s.scrollLeft,c=s.scrollTop,u=l),h({scrollable:r,method:u,startTime:p,startX:d,startY:c,x:i,y:n})}}}}()},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(44)),a=i(s(76)),o=i(s(26)),r=i(s(60)),l=i(s(17)),d=i(s(2)),c=i(s(19)),u=(s(25),s(4));let h=null;let p=null,f=null;const m=new c.default("page-authCode",!0,()=>{let e,t,s=0,i=0;const c=h.type.length,p=m.pageEl.querySelector("#code"),f=p.nextElementSibling,g=m.pageEl.querySelector(".phone-edit");p.focus(),g.addEventListener("click",(function(){return n.default.mount()}));let v=()=>{setTimeout(()=>{e&&e.remove(),t&&t.remove()},300)};p.addEventListener("input",(function(n){this.classList.remove("error"),this.value=this.value.replace(/\D/g,""),this.value.length>c&&(this.value=this.value.slice(0,c));let l,u=this.value.length;if(u==c)(e=>{p.setAttribute("disabled","true");let t={phone_number:h.phone_number,phone_code_hash:h.phone_code_hash,phone_code:e};d.default.invokeApi("auth.signIn",t,{ignoreErrors:!0}).then(e=>{switch(e._){case"auth.authorization":d.default.setUserAuth({id:e.user.id}),o.default.mount(),v();break;case"auth.authorizationSignUpRequired":a.default.mount({phone_number:h.phone_number,phone_code_hash:h.phone_code_hash}),v();break;default:p.innerText=e._}}).catch(e=>{switch(p.removeAttribute("disabled"),e.type){case"SESSION_PASSWORD_NEEDED":e.handled=!0,v(),r.default.mount();break;case"PHONE_CODE_EMPTY":case"PHONE_CODE_INVALID":p.classList.add("error"),f.innerText="Invalid Code";break;default:f.innerText=e.type}})})(this.value);else if(u==i)return;if(i=u,!e)return;u?(l=Math.round(Math.min(45,u)*(165/45)+11.33),t.canvas.style.display="none",e.canvas.style.display=""):l=0;let m=s>l?-1:1;e.setDirection(m),0!=s&&0==l&&e.setSpeed(7),s=l,e.play()}));let b=m.pageEl.querySelector(".auth-image");const y=u.mediaSizes.isMobile?100:166;return Promise.all([l.default.loadAnimationFromURL({container:b,loop:!0,autoplay:!0,width:y,height:y},"assets/img/TwoFactorSetupMonkeyIdle.tgs").then(e=>{t=e}),l.default.loadAnimationFromURL({container:b,loop:!1,autoplay:!1,width:y,height:y},"assets/img/TwoFactorSetupMonkeyTracking.tgs").then(i=>{e=i,p.value.length||(e.canvas.style.display="none"),e.addListener("enterFrame",i=>{(1==e.direction&&i>=s||-1==e.direction&&i<=s)&&(e.setSpeed(1),e.pause()),0==i&&0==s&&(e.curFrame=0,t&&(e.canvas.style.display="none",t.canvas.style.display="",t.restart()))})})])},e=>{switch(h=e,p||(p=m.pageEl.getElementsByClassName("phone")[0],f=m.pageEl.getElementsByClassName("sent-type")[0]),p.innerText=h.phone_number,h.type._){case"auth.sentCodeTypeSms":f.innerHTML="We have sent you an SMS<br>with the code.";break;case"auth.sentCodeTypeApp":f.innerHTML="We have sent you a message in Telegram<br>with the code.";break;case"auth.sentCodeTypeCall":f.innerHTML="We will call you and voice<br>the code.";break;default:f.innerHTML=`Please check everything<br>for a code (type: ${h.type._})`}});t.default=m},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(1),l=o(s(26)),d=o(s(2)),c=o(s(19)),u=o(s(42));let h=null;const p=new c.default("page-signUp",!0,()=>Promise.resolve().then(()=>a(s(21))).then(e=>{const t=p.pageEl,s=t.querySelector("#canvas-avatar"),i=e.default;let n;t.querySelector(".auth-image").addEventListener("click",()=>{u.default.open(s,e=>{n=e})});const a=t.getElementsByClassName("fullName")[0];let o=function(e){let t=c.value||"",s=f.value||"",i=t||s?(t+" "+s).trim():"Your Name";a.innerText!=i&&(a.innerText=i),this.classList.remove("error")};const c=document.getElementById("name");c.addEventListener("input",o);const f=document.getElementById("lastName");f.addEventListener("input",o);document.getElementById("signUp").addEventListener("click",(function(e){if(this.setAttribute("disabled","true"),!c.value.length)return c.classList.add("error"),!1;let t=c.value,s=f.value,a={phone_number:h.phone_number,phone_code_hash:h.phone_code_hash,first_name:t,last_name:s};console.log("invoking auth.signUp with params:",a),this.textContent="PLEASE WAIT...",r.putPreloader(this),d.default.invokeApi("auth.signUp",a).then(e=>{switch(console.log("auth.signUp response:",e),e._){case"auth.authorization":d.default.setUserAuth({id:e.user.id}),new Promise((e,t)=>{if(!n)return console.log("User has not selected avatar"),e();console.log("invoking uploadFile..."),n().then(s=>{console.log("uploaded smthn",s),i.uploadProfilePhoto(s).then(e,t)},t)}).then(()=>{l.default.mount()},()=>{l.default.mount()});break;default:this.innerText=e._}}).catch(e=>{this.removeAttribute("disabled"),e.type,this.innerText=e.type})}))}),e=>{h=e});t.default=p},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(0),a=s(1),o=i(s(17));const r=new class{constructor(){this.pageID=-1,this.pagesDiv=document.getElementById("auth-pages"),this.selectTab=a.horizontalMenu(null,this.pagesDiv.firstElementChild,null,null,420)}setPage(e){if(e.isAuthPage){this.pagesDiv.style.display="";let t=n.whichChild(e.pageEl);if(this.pageID==t)return;this.selectTab(t),-1!=this.pageID&&t>1&&o.default.loadLottieWorkers(),this.pageID=t}else this.pagesDiv.style.display="none",e.pageEl.style.display="",this.pageID=-1}};t.default=r},function(e,t,s){e.exports=function(){return new Worker(s.p+"033d698464b3de4b08fa.worker.js")}},function(e,t,s){"use strict";var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=s(11),o=n(s(33));const r=new class{constructor(){this.dbName="cachedFiles",this.openDatabase()}openDatabase(){return this.openDbPromise?this.openDbPromise:this.openDbPromise=caches.open(this.dbName)}deleteFile(e){return this.timeoutOperation(t=>i(this,void 0,void 0,(function*(){yield t.delete("/"+e)})))}saveFile(e,t){return t instanceof Blob||(t=a.blobConstruct(t)),this.timeoutOperation(s=>i(this,void 0,void 0,(function*(){return yield s.put("/"+e,new Response(t)),t})))}getBlobSize(e){return e.size||e.byteLength||e.length}getFile(e){return this.timeoutOperation(t=>i(this,void 0,void 0,(function*(){const s=yield t.match("/"+e);if(!s||!t)throw"No response???";return s.blob()})))}timeoutOperation(e){return new Promise((t,s)=>i(this,void 0,void 0,(function*(){let i=!1;const n=setTimeout(()=>{s(),i=!0},5e3);try{const s=yield this.openDatabase();if(!s)throw"no cache?";const n=yield e(s);if(i)return;t(n)}catch(e){s(e)}clearTimeout(n)})))}getFileWriter(e,t){const s=o.default.getFakeFileWriter(t,t=>this.saveFile(e,t));return Promise.resolve(s)}};t.default=r},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.telegramMeWebService=t.TelegramMeWebService=void 0;const n=i(s(16)),a=s(25);class o{constructor(){this.disabled=a.Modes.test||-1==a.App.domains.indexOf(location.hostname)||"http:"!=location.protocol&&"https:"!=location.protocol||"https:"==location.protocol&&"web.telegram.org"!=location.hostname}setAuthorized(e){if(this.disabled)return!1;n.default.get("tgme_sync").then(t=>{var s=Date.now()/1e3;if(e&&t&&t.canRedirect==e&&t.ts+86400>s)return!1;n.default.set({tgme_sync:{canRedirect:e,ts:s}}),["//telegram.me/_websync_?authed="+(e?"1":"0"),"//t.me/_websync_?authed="+(e?"1":"0")].forEach(e=>{let t=document.createElement("script");t.onload=t.onerror=function(){t.remove()},t.src=e,document.body.appendChild(t)})})}}t.TelegramMeWebService=o,t.telegramMeWebService=new o},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeWaveform=void 0;const n=i(s(12)),a=s(3),o=s(24),r=i(s(23)),l=s(46),d=i(s(57)),c=s(4);function u(e){e instanceof Uint8Array||(e=new Uint8Array(e));var t=8*e.length/5|0;if(!t)return new Uint8Array([]);for(var s=new DataView(e.buffer),i=new Uint8Array(t),n=0;n<t;n++){var a=5*n/8|0,o=5*n%8,r=s.getUint16(a,!0);i[n]=r>>o&31}return i}t.decodeWaveform=u;class h extends HTMLElement{constructor(){super(),this.attachedHandlers={}}connectedCallback(){this.classList.add("audio");const e=+this.getAttribute("message-id"),t=this.getAttribute("doc-id"),s=n.default.getDoc(t),i=+s.id<0,h=String(0|s.duration).toHHMMSS(!0);this.innerHTML=`\n <div class="audio-toggle audio-ico tgico-largeplay"></div>\n <div class="audio-download">${i?"":'<div class="tgico-download"></div>'}</div>`;const p="voice"==s.type?function(e,t){t.classList.add("is-voice");const s=c.mediaSizes.isMobile?2:1,i=c.mediaSizes.isMobile?3:2,n=c.mediaSizes.isMobile?16:23,a=c.mediaSizes.isMobile?152:190,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add("audio-waveform"),o.setAttributeNS(null,"width",""+a),o.setAttributeNS(null,"height",""+n),o.setAttributeNS(null,"viewBox",`0 0 ${a} ${n}`);const r=document.createElement("div");r.classList.add("audio-time"),t.append(o,r);let l=e.attributes[0].waveform||[];l=u(l.slice());const d=Math.max(...l),h=l.length?l.length:100,p=Math.min(a/(2+s)|0,h);let f=0;const m=n-i;let g="";for(let e=0,t=0,a=0;e<h;++e){const o=l[e]||0;if(a+p>=h){a=a+p-h,a<(p+1)/2&&f<o&&(f=o);const e=Math.max((f*m+(d+1)/2)/(d+1),i);g+=`\n <rect x="${t}" y="${n-e}" width="2" height="${e}" rx="1" ry="1"></rect>\n `,t+=2+s,f=a<(p+1)/2?0:o}else f<o&&(f=o),a+=p}o.insertAdjacentHTML("beforeend",g);const v=Array.from(o.children);let b=t.querySelector(".audio-waveform");return()=>{let e=0,s=0,i=t.audio;(!i.paused||i.currentTime>0&&i.currentTime!=i.duration)&&(s=Math.round(i.currentTime/i.duration*p),v.slice(0,s+1).forEach(e=>e.classList.add("active")));let n=()=>{clearInterval(e),e=setInterval(()=>{s>o.childElementCount||isNaN(i.duration)||i.paused?clearInterval(e):(s=Math.round(i.currentTime/i.duration*p),v.slice(0,s+1).forEach(e=>e.classList.add("active")))},20)};i.paused||n(),t.addAudioListener("playing",()=>{n()}),t.addAudioListener("pause",()=>{clearInterval(e)}),t.addAudioListener("ended",()=>{clearInterval(e),v.forEach(e=>e.classList.remove("active"))});let r=!1,l=!1;function d(e){const t=e.offsetX/a*i.duration;s=Math.round(t/i.duration*p),v.slice(0,s+1).forEach(e=>e.classList.add("active"));for(let e=s+1;e<v.length;++e)v[e].classList.remove("active");i.currentTime=t}return b.addEventListener("mouseleave",e=>{r&&(i.play(),r=!1),l=!1}),b.addEventListener("mousemove",e=>{l=!0,r&&d(e)}),b.addEventListener("mousedown",e=>{e.preventDefault(),i.paused||(i.pause(),d(e),r=!0)}),b.addEventListener("mouseup",e=>{l&&r&&(i.play(),r=!1)}),b.addEventListener("click",e=>{i.paused||d(e)}),()=>{clearInterval(e),b.remove(),b=null,i=null}}}(s,this):function(e,t){const s=!!+t.getAttribute("with-time"),i=e.audioTitle||e.file_name;let n=e.audioPerformer?a.RichTextProcessor.wrapPlainText(e.audioPerformer):"";s?n+=(n?" · ":"")+o.formatDate(e.date):n||(n="Unknown Artist");const r=`\n <div class="audio-details">\n <div class="audio-title">${i}</div>\n <div class="audio-subtitle">${n}</div>\n <div class="audio-time"></div>\n </div>`;return t.insertAdjacentHTML("beforeend",r),()=>{const e=t.querySelector(".audio-subtitle");let s=!1,i=new l.MediaProgressLine(t.audio);t.addAudioListener("ended",()=>{t.classList.remove("audio-show-progress"),e.innerHTML=n,s=!1});const a=()=>{s||(t.classList.add("audio-show-progress"),s=!0,e.innerHTML="",i&&e.append(i.container))};return t.addAudioListener("playing",a),(!t.audio.paused||t.audio.currentTime>0)&&a(),()=>{i.removeListeners(),i.container.remove(),i=null}}}(s,this),f=this.querySelector(".audio-download"),m=this.querySelector(".audio-time");m.innerHTML=h;let g,v=this.preloader;const b=()=>{const t=this.audio=d.default.addAudio(s,e);this.onTypeDisconnect=p();const i=this.querySelector(".audio-toggle"),n=()=>{m.innerText=String(0|t.currentTime).toHHMMSS(!0)+" / "+h,t.paused||(i.classList.remove("tgico-largeplay"),i.classList.add("tgico-largepause"))};(!t.paused||t.currentTime>0&&t.currentTime!=t.duration)&&(n(),m.innerText=String(0|t.currentTime).toHHMMSS(!0)+" / "+h),i.addEventListener("click",()=>{t.paused?t.play():t.pause()}),this.addAudioListener("ended",()=>{i.classList.add("tgico-largeplay"),i.classList.remove("tgico-largepause")}),this.addAudioListener("timeupdate",()=>{m.innerText=String(0|t.currentTime).toHHMMSS(!0)+" / "+h}),this.addAudioListener("pause",()=>{i.classList.add("tgico-largeplay"),i.classList.remove("tgico-largepause")}),this.addAudioListener("playing",n)};if(i)this.preloader.attach(this.querySelector(".audio-download"),!1);else{const e=()=>{g?(f.classList.remove("downloading"),g.cancel(),g=null):(v||(v=new r.default(null,!0)),g=n.default.downloadDoc(s.id),v.attach(f,!0,g),g.then(()=>{v=null,f.classList.remove("downloading"),f.remove(),this.removeEventListener("click",e),b()}),f.classList.add("downloading"))};this.addEventListener("click",e),this.click()}}addAudioListener(e,t){this.attachedHandlers[e]||(this.attachedHandlers[e]=[]),this.attachedHandlers[e].push(t),this.audio.addEventListener(e,t)}disconnectedCallback(){this.onTypeDisconnect&&(this.onTypeDisconnect(),this.onTypeDisconnect=null);for(let e in this.attachedHandlers){for(let t of this.attachedHandlers[e])this.audio.removeEventListener(e,t);delete this.attachedHandlers[e]}this.preloader=null}static get observedAttributes(){return[]}attributeChangedCallback(e,t,s){}adoptedCallback(){}}t.default=h,customElements.define("audio-element",h)},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=o(s(42)),l=o(s(10)),d=a(s(13));t.default=class{constructor(){this.container=document.querySelector(".new-channel-container"),this.canvas=this.container.querySelector(".avatar-edit-canvas"),this.channelNameInput=this.container.querySelector(".new-channel-name"),this.channelDescriptionInput=this.container.querySelector(".new-channel-description"),this.nextBtn=this.container.querySelector(".btn-corner"),this.backBtn=this.container.querySelector(".sidebar-close-button"),this.uploadAvatar=null,this.container.querySelector(".avatar-edit").addEventListener("click",()=>{r.default.open(this.canvas,e=>{this.uploadAvatar=e})}),this.channelNameInput.addEventListener("input",()=>{this.channelNameInput.value.length?this.nextBtn.classList.add("is-visible"):this.nextBtn.classList.remove("is-visible")}),this.nextBtn.addEventListener("click",()=>{let e=this.channelNameInput.value,t=this.channelDescriptionInput.value;this.nextBtn.disabled=!0,l.default.createChannel(e,t).then(e=>{this.uploadAvatar&&this.uploadAvatar().then(t=>{l.default.editPhoto(e,t)}),d.default.removeTabFromHistory(d.AppSidebarLeft.SLIDERITEMSIDS.newChannel),d.default.addMembersTab.init(e,"channel",!0)})})}onCloseAfterTimeout(){this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.uploadAvatar=null,this.channelNameInput.value="",this.channelDescriptionInput.value="",this.nextBtn.disabled=!1}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var s,i,n,a={},o=1,r=0,l=0,d=0,c=0;function u(){if(e.dataset.isCrop)throw"image is already crop";e.dataset.isCrop="true",e.classList.add("crop-blur"),e.draggable=!1,(n=new Image).crossOrigin=e.crossOrigin,n.src=e.src,n.draggable=!1,t||(t=document.createElement("canvas")),(s=document.createElement("div")).classList.add("crop-component"),(i=document.createElement("div")).classList.add("overlay");let a=document.createElement("div");a.classList.add("crop-overlay-color"),s.appendChild(i),e.parentNode.appendChild(s),s.appendChild(n),s.appendChild(e),s.appendChild(a),i.appendChild(n),n.style.maxWidth=e.width+"px",h(e.offsetWidth/2-100,e.offsetHeight/2-100),i.addEventListener("mousedown",v,!1),i.addEventListener("touchstart",v,!1),i.addEventListener("wheel",g,!1),document.addEventListener("keypress",m,!1)}function h(e,t){r=-e*o,l=-t*o,n.style.top=-t+"px",n.style.left=-e+"px"}function p(e,t){let s=t+100+"px",n=e+100+"px";i.style.top=s,i.style.left=n}function f(e){e=e*Math.PI*2;var t,s,a,r,l,d,c=Math.floor(i.clientWidth+e),u=Math.floor(i.clientHeight+e),f=n.clientWidth,m=n.clientHeight;c<50||(c>f||(a=(t=i.offsetLeft-e/2)+c,r=(s=i.offsetTop-e/2)+u,t<0&&(t=0),s<0&&(s=0),a>f||r>m||(o=200/c,l=c,d=c,i.style.width=l+"px",i.style.height=d+"px",h(t,s),p(t,s))))}function m(e){switch(e.preventDefault(),String.fromCharCode(e.charCode)){case"+":f(4);break;case"-":f(-4)}}function g(e){e.preventDefault(),f(e.deltaY>0?1:-1)}function v(e){e.preventDefault(),e.stopPropagation(),function(e){a.container_width=i.offsetWidth,a.container_height=i.offsetHeight,a.container_left=i.offsetLeft,a.container_top=i.offsetTop,a.mouse_x=(e.clientX||e.pageX||e.touches&&e.touches[0].clientX)+window.scrollX,a.mouse_y=(e.clientY||e.pageY||e.touches&&e.touches[0].clientY)+window.scrollY}(e),document.addEventListener("mousemove",y),document.addEventListener("touchmove",y),document.addEventListener("mouseup",b),document.addEventListener("touchend",b)}function b(e){e.preventDefault(),document.removeEventListener("mouseup",b),document.removeEventListener("touchend",b),document.removeEventListener("mousemove",y),document.removeEventListener("touchmove",y)}function y(e){var t,s,o,r,l={x:0,y:0};e.preventDefault(),e.stopPropagation(),l.x=e.pageX||e.touches&&e.touches[0].pageX,l.y=e.pageY||e.touches&&e.touches[0].pageY,t=l.x-(a.mouse_x-a.container_left),s=l.y-(a.mouse_y-a.container_top),o=i.offsetWidth,r=i.offsetHeight,t<0?t=0:t>n.offsetWidth-o&&(t=n.offsetWidth-o),s<0?s=0:s>n.offsetHeight-r&&(s=n.offsetHeight-r),h(t,s),p(t,s)}return e.complete?u():e.onload=u,{crop:function(){d=n.width*o,c=n.height*o,t.width=200,t.height=200,t.getContext("2d").drawImage(n,r,l,d,c)},removeHandlers:function(){i.removeEventListener("mousedown",v),i.removeEventListener("touchstart",v),i.removeEventListener("wheel",g),document.removeEventListener("mouseup",b),document.removeEventListener("touchend",b),document.removeEventListener("mousemove",y),document.removeEventListener("touchmove",y),document.removeEventListener("keypress",m),s.remove(),i.remove(),n.remove()}}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(48),l=s(1),d=o(s(10)),c=a(s(13));t.default=class{constructor(){this.container=document.querySelector(".addmembers-container"),this.contentDiv=this.container.querySelector(".sidebar-content"),this.backBtn=this.container.querySelector(".sidebar-close-button"),this.nextBtn=this.contentDiv.querySelector(".btn-corner"),this.nextBtn.addEventListener("click",()=>{if(this.skippable)return void this.backBtn.click();const e=this.selector.getSelected();if(e.length){if(this.takeOut)return void this.takeOut(e);this.nextBtn.classList.remove("tgico-next"),this.nextBtn.disabled=!0,l.putPreloader(this.nextBtn),this.selector.freezed=!0,d.default.inviteToChannel(this.peerID,e).then(()=>{this.backBtn.click()})}})}onCloseAfterTimeout(){this.selector&&(this.selector.container.remove(),this.selector=null)}init(e,t,s,i){this.peerID=Math.abs(e),this.peerType=t,this.takeOut=i,this.skippable=s,this.onCloseAfterTimeout(),this.selector=new r.AppSelectPeers(this.contentDiv,s?null:e=>{e?this.nextBtn.classList.add("is-visible"):this.nextBtn.classList.remove("is-visible")},"contacts"),this.nextBtn.innerHTML="",this.nextBtn.disabled=!1,this.nextBtn.classList.add("tgico-next"),s?this.nextBtn.classList.add("is-visible"):this.nextBtn.classList.remove("is-visible"),c.default.selectTab(c.AppSidebarLeft.SLIDERITEMSIDS.addMembers)}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=o(s(9)),l=o(s(15)),d=o(s(5)),c=o(s(14)),u=a(s(13)),h=s(0),p=o(s(41));t.default=class{constructor(){this.container=document.getElementById("contacts-container"),this.list=this.container.querySelector("#contacts"),l.default.setListClickListener(this.list),this.scrollable=new r.default(this.list.parentElement),this.searchInput=new p.default("Search",e=>{this.list.innerHTML="",this.openContacts(e)}),this.container.firstElementChild.append(this.searchInput.container)}onClose(){let e=c.default.windowH/72*1.25|0;Array.from(this.list.children).slice(e).forEach(e=>e.remove())}onCloseAfterTimeout(){this.list.innerHTML="",this.searchInput.value=""}openContacts(e){if(-1===u.default.historyTabIDs.indexOf(u.AppSidebarLeft.SLIDERITEMSIDS.contacts)&&u.default.selectTab(u.AppSidebarLeft.SLIDERITEMSIDS.contacts),this.promise)return this.promise;this.scrollable.onScrolledBottom=null,this.promise=d.default.getContacts(e).then(e=>{if(this.promise=null,u.default.historyTabIDs[u.default.historyTabIDs.length-1]!=u.AppSidebarLeft.SLIDERITEMSIDS.contacts)return void console.warn("user closed contacts before it's loaded");const t=[...e];t.findAndSplice(e=>e==h.$rootScope.myID);let s=t.map(e=>{let t=d.default.getUser(e);return{user:t,status:d.default.getUserStatusForSort(t.status)}}).sort((e,t)=>t.status-e.status),i=()=>{let e=c.default.windowH/72*1.25|0;s.splice(0,e).forEach(({user:e})=>{let{dialog:t,dom:s}=l.default.addDialog(e.id,this.list,!1),i=d.default.getUserStatusString(e.id);s.lastMessageSpan.innerHTML="online"==i?`<i>${i}</i>`:i}),s.length||(i=void 0)};i(),this.scrollable.onScrolledBottom=()=>{i?i():this.scrollable.onScrolledBottom=null}})}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(39),l=o(s(42)),d=o(s(10)),c=a(s(13)),u=o(s(9)),h=o(s(15)),p=o(s(5));t.default=class{constructor(){this.container=document.querySelector(".new-group-container"),this.contentDiv=this.container.querySelector(".sidebar-content"),this.canvas=this.container.querySelector(".avatar-edit-canvas"),this.groupNameInput=this.container.querySelector(".new-group-name"),this.nextBtn=this.container.querySelector(".btn-corner"),this.searchGroup=new r.SearchGroup(" ","contacts",!0,"new-group-members disable-hover",!1),this.uploadAvatar=null,this.container.querySelector(".avatar-edit").addEventListener("click",()=>{l.default.open(this.canvas,e=>{this.uploadAvatar=e})}),this.groupNameInput.addEventListener("input",()=>{const e=this.groupNameInput.value;this.nextBtn.classList.toggle("is-visible",!!e.length)}),this.nextBtn.addEventListener("click",()=>{const e=this.groupNameInput.value;this.nextBtn.disabled=!0,d.default.createChat(e,this.userIDs).then(e=>{this.uploadAvatar&&this.uploadAvatar().then(t=>{d.default.editPhoto(e,t)}),c.default.selectTab(0)})});const e=document.createElement("div");e.classList.add("chats-container"),e.append(this.searchGroup.container);new u.default(e);this.contentDiv.append(e)}onClose(){}onCloseAfterTimeout(){this.searchGroup.clear();this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.uploadAvatar=null,this.groupNameInput.value="",this.nextBtn.disabled=!1,this.searchGroup.clear()}init(e){this.userIDs=e,c.default.selectTab(c.AppSidebarLeft.SLIDERITEMSIDS.newGroup),this.userIDs.forEach(e=>{let{dom:t}=h.default.addDialog(e,this.searchGroup.list,!1,!1),s="";s=p.default.getUserStatusString(e),"online"==s&&(s=`<i>${s}</i>`),s&&(t.lastMessageSpan.innerHTML=s)}),this.searchGroup.nameEl.innerText=this.userIDs.length+" members",this.searchGroup.setActive()}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(1),l=s(0),d=o(s(2)),c=a(s(13)),u=o(s(5));t.default=class{constructor(){this.container=document.querySelector(".settings-container"),this.avatarElem=this.container.querySelector(".profile-avatar"),this.nameDiv=this.container.querySelector(".profile-name"),this.phoneDiv=this.container.querySelector(".profile-subtitle"),this.logOutBtn=this.container.querySelector(".menu-logout"),this.buttons={},r.parseMenuButtonsTo(this.buttons,this.container.querySelector(".profile-buttons").children),l.$rootScope.$on("user_auth",e=>{this.fillElements()}),this.logOutBtn.addEventListener("click",e=>{d.default.logOut().finally(()=>{localStorage.clear(),location.reload()})}),this.buttons.edit.addEventListener("click",()=>{c.default.editProfileTab.fillElements(),c.default.selectTab(c.AppSidebarLeft.SLIDERITEMSIDS.editProfile)}),this.buttons.folders.addEventListener("click",()=>{c.default.selectTab(c.AppSidebarLeft.SLIDERITEMSIDS.chatFolders)})}fillElements(){let e=u.default.getSelf();this.avatarElem.setAttribute("peer",""+e.id),this.nameDiv.innerHTML=e.rFullName||"",this.phoneDiv.innerHTML=e.rPhone||""}onClose(){}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(42)),a=i(s(2)),o=i(s(21)),r=i(s(13)),l=i(s(9)),d=i(s(5)),c=s(0);t.default=class{constructor(){this.container=document.querySelector(".edit-profile-container"),this.scrollWrapper=this.container.querySelector(".scroll-wrapper"),this.nextBtn=this.container.querySelector(".btn-corner"),this.canvas=this.container.querySelector(".avatar-edit-canvas"),this.uploadAvatar=null,this.firstNameInput=this.container.querySelector(".firstname"),this.lastNameInput=this.container.querySelector(".lastname"),this.bioInput=this.container.querySelector(".bio"),this.userNameInput=this.container.querySelector(".username"),this.avatarElem=document.createElement("avatar-element"),this.profileUrlContainer=this.container.querySelector(".profile-url-container"),this.profileUrlAnchor=this.profileUrlContainer.lastElementChild,this.originalValues={firstName:"",lastName:"",userName:"",bio:""},this.container.querySelector(".avatar-edit").addEventListener("click",()=>{n.default.open(this.canvas,e=>{this.uploadAvatar=e,this.handleChange(),this.avatarElem.remove()})}),this.avatarElem.classList.add("avatar-placeholder");let e=this.userNameInput.nextElementSibling;this.firstNameInput.addEventListener("input",()=>this.handleChange()),this.lastNameInput.addEventListener("input",()=>this.handleChange()),this.bioInput.addEventListener("input",()=>this.handleChange()),this.userNameInput.addEventListener("input",()=>{let t=this.userNameInput.value;return console.log("userNameInput:",t),t!=this.originalValues.userName&&t.length?(this.isUsernameValid(t)?this.userNameInput.classList.remove("valid","error"):(this.userNameInput.classList.add("error"),this.userNameInput.classList.remove("valid"),e.innerText="Username is invalid"),this.userNameInput.classList.contains("error")?(this.setProfileUrl(),void this.handleChange()):void a.default.invokeApi("account.checkUsername",{username:t}).then(s=>{this.userNameInput.value==t&&(s?(this.userNameInput.classList.add("valid"),this.userNameInput.classList.remove("error"),e.innerText="Username is available"):(this.userNameInput.classList.add("error"),this.userNameInput.classList.remove("valid"),e.innerText="Username is already taken"))},s=>{if(this.userNameInput.value==t)switch(s.type){case"USERNAME_INVALID":this.userNameInput.classList.add("error"),this.userNameInput.classList.remove("valid"),e.innerText="Username is invalid"}}).then(()=>{this.handleChange(),this.setProfileUrl()})):(this.userNameInput.classList.remove("valid","error"),e.innerText="Username (optional)",this.setProfileUrl(),void this.handleChange())}),this.nextBtn.addEventListener("click",()=>{this.nextBtn.disabled=!0;let e=[];e.push(o.default.updateProfile(this.firstNameInput.value,this.lastNameInput.value,this.bioInput.value).then(()=>{r.default.selectTab(0)},e=>{console.error("updateProfile error:",e)})),this.uploadAvatar&&e.push(this.uploadAvatar().then(e=>{o.default.uploadProfilePhoto(e)})),this.userNameInput.value!=this.originalValues.userName&&this.userNameInput.classList.contains("valid")&&e.push(o.default.updateUsername(this.userNameInput.value)),Promise.race(e).then(()=>{this.nextBtn.disabled=!1},()=>{this.nextBtn.disabled=!1})});new l.default(this.scrollWrapper,"y")}fillElements(){var e,t,s;let i=d.default.getSelf();this.firstNameInput.value=this.originalValues.firstName=null!==(e=i.first_name)&&void 0!==e?e:"",this.lastNameInput.value=this.originalValues.lastName=null!==(t=i.last_name)&&void 0!==t?t:"",this.userNameInput.value=this.originalValues.userName=null!==(s=i.username)&&void 0!==s?s:"",this.userNameInput.classList.remove("valid","error"),this.userNameInput.nextElementSibling.innerHTML="Username (optional)",o.default.getProfile(i.id).then(e=>{e.rAbout&&(this.bioInput.value=this.originalValues.bio=e.rAbout)}),this.avatarElem.setAttribute("peer",""+c.$rootScope.myID),this.avatarElem.parentElement||this.canvas.parentElement.append(this.avatarElem),this.uploadAvatar=null,this.setProfileUrl()}isUsernameValid(e){return(e.length>=5&&e.length<=32||!e.length)&&/^[a-zA-Z0-9_]*$/.test(e)}isChanged(){return!!this.uploadAvatar||this.firstNameInput.value!=this.originalValues.firstName||this.lastNameInput.value!=this.originalValues.lastName||this.userNameInput.value!=this.originalValues.userName&&!this.userNameInput.classList.contains("error")||this.bioInput.value!=this.originalValues.bio}setProfileUrl(){if(this.userNameInput.classList.contains("error")||!this.userNameInput.value.length)this.profileUrlContainer.style.display="none";else{this.profileUrlContainer.style.display="";let e="https://t.me/"+this.userNameInput.value;this.profileUrlAnchor.innerText=e,this.profileUrlAnchor.href=e}}handleChange(){this.isChanged()?this.nextBtn.classList.add("is-visible"):this.nextBtn.classList.remove("is-visible")}onCloseAfterTimeout(){this.nextBtn.classList.remove("is-visible")}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(s(17)),a=i(s(2)),o=i(s(6)),r=s(3),l=i(s(8)),d=s(1),c=s(0),u=i(s(13));t.default=class{constructor(){this.filtersRendered={}}renderFolder(e,t,s=document.createElement("div")){let i,n="",a=[];if("dialogFilterSuggested"==e._)i=e.filter,n=e.description;else{i=e,n="";const t=i.id;if(this.filtersRendered.hasOwnProperty(i.id)||s.addEventListener("click",()=>{u.default.editFolderTab.open(o.default.filtersStorage.filters[t])}),this.filtersRendered[i.id]=s,1==Object.keys(i.pFlags).length){n="All ";const e=i.pFlags;e.contacts?n+="Contacts":e.non_contacts?n+="Non-Contacts":e.groups?n+="Groups":e.broadcasts?n+="Channels":e.bots?n+="Bots":e.exclude_muted?n+="Unmuted":e.exclude_read?n+="Unread":e.exclude_archived&&(n+="Unarchived"),a.push(n)}else{const e=o.default.dialogsStorage.getFolder(i.id);let t=0,s=0,n=0;for(const i of e)l.default.isAnyGroup(i.peerID)?n++:l.default.isBroadcast(i.peerID)?s++:t++;t&&a.push(t+" chats"),s&&a.push(s+" channels"),n&&a.push(n+" groups")}}return s.classList.add("category","rp-square"),s.innerHTML=`\n <div>\n <p>${r.RichTextProcessor.wrapEmojiText(i.title)}</p>\n <p>${a.length?a.join(", "):n}</p>\n </div>\n `,d.ripple(s),t&&t.append(s),s}init(){this.container=document.querySelector(".chat-folders-container"),this.stickerContainer=this.container.querySelector(".sticker-container"),this.foldersContainer=this.container.querySelector(".folders-my"),this.suggestedContainer=this.container.querySelector(".folders-suggested"),this.createFolderBtn=this.container.querySelector(".btn-create-folder"),this.createFolderBtn.addEventListener("click",()=>{u.default.editFolderTab.open()}),n.default.loadAnimationFromURL({container:this.stickerContainer,loop:!1,autoplay:!0,width:86,height:86},"assets/img/Folders_1.tgs").then(e=>{this.animation=e}),o.default.filtersStorage.getDialogFilters().then(e=>{for(const t in e){const s=e[t];this.renderFolder(s,this.foldersContainer)}}),c.$rootScope.$on("filter_update",e=>{const t=e.detail;this.filtersRendered.hasOwnProperty(t.id)?this.renderFolder(t,null,this.filtersRendered[t.id]):this.renderFolder(t,this.foldersContainer),this.getSuggestedFilters()}),c.$rootScope.$on("filter_delete",e=>{const t=e.detail;this.filtersRendered.hasOwnProperty(t.id)&&(this.getSuggestedFilters(),this.filtersRendered[t.id].remove(),delete this.filtersRendered[t.id])}),this.getSuggestedFilters()}getSuggestedFilters(){a.default.invokeApi("messages.getSuggestedDialogFilters").then(e=>{this.suggestedContainer.style.display=e.length?"":"none",Array.from(this.suggestedContainer.children).slice(1).forEach(e=>e.remove()),e.forEach(e=>{const t=this.renderFolder(e),s=document.createElement("button");s.classList.add("btn-primary"),s.innerText="Add",t.append(s),this.suggestedContainer.append(t),s.addEventListener("click",i=>{c.cancelEvent(i),s.setAttribute("disabled","true"),o.default.filtersStorage.createDialogFilter(e.filter).then(e=>{e&&t.remove()}).finally(()=>{s.removeAttribute("disabled")})})})})}onOpen(){this.init?(this.init(),this.init=null):this.animation&&this.animation.restart()}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=a(s(13)),l=o(s(17)),d=o(s(6)),c=s(1),u=o(s(15)),h=s(0);t.default=class{constructor(){this.flags={}}init(){this.container=document.querySelector(".edit-folder-container"),this.closeBtn=this.container.querySelector(".sidebar-close-button"),this.title=this.container.querySelector(".sidebar-header__title"),this.caption=this.container.querySelector(".caption"),this.stickerContainer=this.container.querySelector(".sticker-container"),this.confirmBtn=this.container.querySelector(".btn-confirm"),this.menuBtn=this.container.querySelector(".btn-menu-toggle"),this.deleteFolderBtn=this.menuBtn.querySelector(".menu-delete"),this.nameInput=this.container.querySelector("#folder-name"),this.include_peers=this.container.querySelector(".folder-list-included"),this.exclude_peers=this.container.querySelector(".folder-list-excluded");const e=this.include_peers.querySelector(".folder-categories"),t=this.exclude_peers.querySelector(".folder-categories");c.parseMenuButtonsTo(this.flags,e.children),c.parseMenuButtonsTo(this.flags,t.children),e.firstElementChild.addEventListener("click",()=>{r.default.includedChatsTab.open(this.filter,"included")}),t.firstElementChild.addEventListener("click",()=>{r.default.includedChatsTab.open(this.filter,"excluded")}),l.default.loadAnimationFromURL({container:this.stickerContainer,loop:!0,autoplay:!0,width:86,height:86},"assets/img/Folders_2.tgs").then(e=>{this.animation=e}),this.deleteFolderBtn.addEventListener("click",()=>{this.deleteFolderBtn.setAttribute("disabled","true"),d.default.filtersStorage.updateDialogFilter(this.filter,!0).then(e=>{e&&this.closeBtn.click()}).finally(()=>{this.deleteFolderBtn.removeAttribute("disabled")})}),this.confirmBtn.addEventListener("click",()=>{if(!this.nameInput.value.trim())return void this.nameInput.classList.add("error");let t,s=Array.from(e.children).slice(1).reduce((e,t)=>e+ +!t.style.display,0);"UL"==this.include_peers.lastElementChild.tagName&&(s+=this.include_peers.lastElementChild.childElementCount),s?(this.confirmBtn.setAttribute("disabled","true"),t=this.filter.id?d.default.filtersStorage.updateDialogFilter(this.filter):d.default.filtersStorage.createDialogFilter(this.filter),t.then(e=>{e&&this.closeBtn.click()}).finally(()=>{this.confirmBtn.removeAttribute("disabled")})):c.toast("Please choose at least one chat for this folder.")}),this.nameInput.addEventListener("input",()=>{this.filter.title=this.nameInput.value,this.nameInput.classList.remove("error"),this.editCheckForChange()})}onOpen(){this.init?(this.init(),this.init=null):this.animation&&this.animation.restart()}onCloseAfterTimeout(){Array.from(this.container.querySelectorAll("ul, .show-more")).forEach(e=>e.remove())}onCreateOpen(){this.caption.style.display="",this.title.innerText="New Folder",this.menuBtn.classList.add("hide"),this.confirmBtn.classList.remove("hide"),this.nameInput.value="";for(const e in this.flags)this.flags[e].style.display="none"}onEditOpen(){this.caption.style.display="none",this.title.innerText="create"==this.type?"New Folder":"Edit Folder","edit"==this.type&&(this.menuBtn.classList.remove("hide"),this.confirmBtn.classList.add("hide"));const e=this.filter;this.nameInput.value=e.title;for(const t in this.flags)this.flags[t].style.display=e.pFlags[t]?"":"none";["include_peers","exclude_peers"].forEach(t=>{const s=this[t],i=document.createElement("ul"),n=e[t].slice(),a=e=>{for(let t=0,s=Math.min(n.length,e);t<s;++t){const e=n.shift(),{dom:t}=u.default.addDialog(e,i,!1,!1,void 0,!0);t.lastMessageSpan.parentElement.remove()}n.length?o.innerHTML=`<div class="tgico-down"></div><div>Show ${Math.min(20,n.length)} more chat${n.length>1?"s":""}</div>`:o&&o.remove()};let o;s.append(i),n.length&&(o=document.createElement("div"),o.classList.add("show-more"),o.addEventListener("click",()=>a(20)),o.innerHTML=`<div class="tgico-down"></div><div>Show ${Math.min(20,n.length)} more chat${n.length>1?"s":""}</div>`,c.ripple(o),s.append(o)),a(4)})}editCheckForChange(){if("edit"==this.type){const e=!h.deepEqual(this.originalFilter,this.filter);this.confirmBtn.classList.toggle("hide",!e),this.menuBtn.classList.toggle("hide",e)}}setFilter(e,t){this.onCloseAfterTimeout(),t?(this.originalFilter=e,this.filter=h.copy(e)):(this.filter=e,this.onEditOpen(),this.editCheckForChange())}open(e){r.default.selectTab(r.AppSidebarLeft.SLIDERITEMSIDS.editFolder),void 0===e?(this.setFilter({_:"dialogFilter",flags:0,id:0,title:"",pFlags:{},pinned_peers:[],include_peers:[],exclude_peers:[]},!0),this.type="create",this.onCreateOpen()):(this.setFilter(e,!0),this.type="edit",this.onEditOpen())}}},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=s(48),l=a(s(13)),d=o(s(15)),c=o(s(8)),u=o(s(5)),h=s(0);t.default=class{constructor(){this.renderResults=e=>{const t="included"==this.type?this.filter.exclude_peers:this.filter.include_peers;e.forEach(e=>{if(t.includes(e))return;const{dom:s}=d.default.addDialog(e,this.selector.scrollable,!1,!1),i=this.selector.selected.has(e);s.containerEl.insertAdjacentHTML("beforeend",this.checkbox(i)),i&&s.listEl.classList.add("active");let n="";n=e>0?e==h.$rootScope.myID?"Chat with yourself":u.default.isBot(e)?"Bot":u.default.contactsList.has(e)?"Contact":"Non-Contact":c.default.isBroadcast(e)?"Channel":"Group",s.lastMessageSpan.innerHTML=n})},this.onSelectChange=e=>{"included"==this.type&&(this.confirmBtn.style.display=e?"":"none")}}init(){this.container=document.querySelector(".included-chats-container"),this.closeBtn=this.container.querySelector(".sidebar-close-button"),this.confirmBtn=this.container.querySelector(".btn-confirm"),this.title=this.container.querySelector(".sidebar-header__title"),this.confirmBtn.addEventListener("click",()=>{const e=this.selector.getSelected();if("included"==this.type)for(const e in this.filter.pFlags)0!==e.indexOf("exclude_")&&delete this.filter.pFlags[e];else for(const e in this.filter.pFlags)0===e.indexOf("exclude_")&&delete this.filter.pFlags[e];const t=[];for(const s of e)"number"==typeof s?t.push(s):this.filter.pFlags[s]=!0;this.filter["included"==this.type?"include_peers":"exclude_peers"]=t,l.default.editFolderTab.setFilter(this.filter,!1),this.closeBtn.click()})}checkbox(e){return`<div class="checkbox"><label><input type="checkbox" ${e?"checked":""}><span></span></label></div>`}onOpen(){this.init&&(this.init(),this.init=null),this.confirmBtn.style.display="excluded"==this.type?"":"none",this.title.innerText="included"==this.type?"Included Chats":"Excluded Chats";const e=this.filter,t=document.createDocumentFragment(),s=document.createElement("div");s.classList.add("sidebar-left-h2"),s.innerText="Chat types";const i=document.createElement("div");let n;i.classList.add("folder-categories"),n="excluded"==this.type?{exclude_muted:{ico:"tgico-mute",text:"Muted"},exclude_archived:{ico:"tgico-archive",text:"Archived"},exclude_read:{ico:"tgico-readchats",text:"Read"}}:{contacts:{ico:"tgico-newprivate",text:"Contacts"},non_contacts:{ico:"tgico-noncontacts",text:"Non-Contacts"},groups:{ico:"tgico-group",text:"Groups"},broadcasts:{ico:"tgico-newchannel",text:"Channels"},bots:{ico:"tgico-bots",text:"Bots"}};let a="";for(const e in n)a+=`<div class="folder-category-button ${n[e].ico}" data-peerID="${e}"><p>${n[e].text}</p>${this.checkbox()}</div>`;i.innerHTML=a;const o=document.createElement("hr");o.style.margin="7px 0 9px";const l=document.createElement("div");l.classList.add("sidebar-left-h2"),l.innerText="Chats",t.append(s,i,o,l);const d=("included"==this.type?e.include_peers:e.exclude_peers).slice();this.selector=new r.AppSelectPeers(this.container,this.onSelectChange,"dialogs",null,this.renderResults),this.selector.selected=new Set(d),this.selector.input.placeholder="Search";const c=this.selector.add.bind(this.selector);this.selector.add=(e,t)=>{var s;const i=c(e,null===(s=n[e])||void 0===s?void 0:s.text);return n[e]&&i.querySelector("avatar-element").classList.add(n[e].ico),i},this.selector.list.parentElement.insertBefore(t,this.selector.list),d.forEach(e=>{this.selector.add(e)});for(const t in e.pFlags)n.hasOwnProperty(t)&&e.pFlags[t]&&i.querySelector(`[data-peerID="${t}"]`).click()}onCloseAfterTimeout(){this.selector&&(this.selector.container.remove(),this.selector=null)}open(e,t){this.originalFilter=e,this.filter=h.copy(this.originalFilter),this.type=t,l.default.selectTab(l.AppSidebarLeft.SLIDERITEMSIDS.includedChats)}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInput=void 0;const n=i(s(9)),a=s(3),o=i(s(2)),r=i(s(52)),l=i(s(18)),d=s(0),c=s(24),u=i(s(6)),h=s(55),p=i(s(93)),f=i(s(45)),m=s(4),g=i(s(12)),v=i(s(94)),b=i(s(95));t.ChatInput=class{constructor(){this.pageEl=document.getElementById("page-chats"),this.messageInput=document.getElementById("input-message"),this.fileInput=document.getElementById("input-file"),this.inputMessageContainer=document.getElementsByClassName("input-message-container")[0],this.inputScroll=new n.default(this.inputMessageContainer),this.btnSend=document.getElementById("btn-send"),this.btnCancelRecord=this.btnSend.parentElement.previousElementSibling,this.lastUrl="",this.lastTimeType=0,this.inputContainer=this.btnSend.parentElement.parentElement,this.chatInput=this.inputContainer.parentElement,this.attachMenu={},this.attachMediaPopUp={},this.replyElements={},this.willSendWebPage=null,this.replyToMsgID=0,this.editMsgID=0,this.noWebPage=!1,this.recording=!1,this.recordCanceled=!1,this.recordTimeEl=this.inputContainer.querySelector(".record-time"),this.recordRippleEl=this.inputContainer.querySelector(".record-ripple"),this.recordStartTime=0,this.scrollTop=0,this.scrollOffsetTop=0,this.scrollDiff=0,this.attachMenu.container=document.getElementById("attach-file"),this.attachMenu.media=this.attachMenu.container.querySelector(".menu-media"),this.attachMenu.document=this.attachMenu.container.querySelector(".menu-document"),this.attachMenu.poll=this.attachMenu.container.querySelector(".menu-poll"),this.attachMediaPopUp.container=this.pageEl.querySelector(".popup-send-photo"),this.attachMediaPopUp.titleEl=this.attachMediaPopUp.container.querySelector(".popup-title"),this.attachMediaPopUp.sendBtn=this.attachMediaPopUp.container.querySelector(".btn-primary"),this.attachMediaPopUp.mediaContainer=this.attachMediaPopUp.container.querySelector(".popup-photo"),this.attachMediaPopUp.captionInput=this.attachMediaPopUp.container.querySelector("input"),this.replyElements.container=this.pageEl.querySelector(".reply-wrapper"),this.replyElements.cancelBtn=this.replyElements.container.querySelector(".reply-cancel"),this.replyElements.titleEl=this.replyElements.container.querySelector(".reply-title"),this.replyElements.subtitleEl=this.replyElements.container.querySelector(".reply-subtitle");try{this.recorder=new p.default({encoderSampleRate:48e3,monitorGain:0,numberOfChannels:1,recordingGain:1,reuseWorker:!0})}catch(e){this.btnSend.classList.remove("tgico-microphone2"),this.btnSend.classList.add("tgico-send"),console.error("Recorder constructor error:",e)}this.messageInput.addEventListener("keydown",e=>{if("Enter"==e.key&&!m.touchSupport){if(e.shiftKey||e.ctrlKey||e.metaKey)return;this.sendMessage()}}),m.touchSupport&&(this.messageInput.addEventListener("touchend",e=>{this.saveScroll(),v.default.toggle(!1)}),window.addEventListener("resize",()=>{this.restoreScroll()})),this.messageInput.addEventListener("input",e=>{let t=this.messageInput.innerText,s=a.RichTextProcessor.parseEntities(t).find(e=>"messageEntityUrl"==e._);if(s){let e=t.slice(s.offset,s.offset+s.length);this.lastUrl!=e&&(this.lastUrl=e,this.willSendWebPage=null,o.default.invokeApi("messages.getWebPage",{url:e,hash:0}).then(t=>{r.default.saveWebPage(t),this.lastUrl==e&&(this.setTopInfo(t.site_name||t.title,t.description||t.url),this.replyToMsgID=0,this.noWebPage=!1,this.willSendWebPage=t)}))}if(t.trim()||this.serializeNodes(Array.from(this.messageInput.childNodes)).trim()){if(!this.btnSend.classList.contains("tgico-send")||!this.recorder){this.recorder&&(this.btnSend.classList.add("tgico-send"),this.btnSend.classList.remove("tgico-microphone2"));let e=Date.now();e-this.lastTimeType>=6e3&&(this.lastTimeType=e,u.default.setTyping("sendMessageTypingAction"))}}else this.messageInput.innerHTML="",this.recorder&&(this.btnSend.classList.remove("tgico-send"),this.btnSend.classList.add("tgico-microphone2")),u.default.setTyping("sendMessageCancelAction")}),a.RichTextProcessor.emojiSupported||this.messageInput.addEventListener("copy",e=>{const t=document.getSelection();let s=t.getRangeAt(0),i=s.commonAncestorContainer,n="",a=Array.from(i.childNodes).slice(s.startOffset,s.endOffset);n=a.length?this.serializeNodes(a):t.toString(),event.clipboardData.setData("text/plain",n),event.preventDefault()}),this.messageInput.addEventListener("paste",e=>{e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");t=a.RichTextProcessor.wrapEmojiText(t),window.document.execCommand("insertHTML",!1,t)});let e=e=>new Promise((t,i)=>{let n={};n.file=e;let a=document.createElement("div");switch(s.type){case"media":{let s=0===e.type.indexOf("video/");if(a.classList.add("popup-item-media"),s){let s=document.createElement("video"),i=document.createElement("source");i.src=n.objectURL=URL.createObjectURL(e),s.autoplay=!1,s.controls=!1,s.muted=!0,s.setAttribute("playsinline",""),s.onloadeddata=()=>{n.width=s.videoWidth,n.height=s.videoHeight,n.duration=Math.floor(s.duration),a.append(s),t(a)},s.append(i)}else{let s=new Image;s.src=n.objectURL=URL.createObjectURL(e),s.onload=()=>{n.width=s.naturalWidth,n.height=s.naturalHeight,a.append(s),t(a)}}break}case"document":{let s=c.wrapDocument({file:e,file_name:e.name||"",size:e.size,type:-1!==e.type.indexOf("image/")?"photo":"doc"},!1,!0);n.objectURL=URL.createObjectURL(e),a.append(s),t(a);break}}s.sendFileDetails.push(n)}),t=t=>{this.fileInput.value="";let i=this.attachMediaPopUp.container.firstElementChild;if(i.classList.remove("is-media","is-document","is-album"),this.attachMediaPopUp.captionInput.value="",this.attachMediaPopUp.mediaContainer.innerHTML="",this.attachMediaPopUp.mediaContainer.style.width=this.attachMediaPopUp.mediaContainer.style.height="",s.sendFileDetails=[],(t=t.filter(e=>"media"!=s.type||["image/","video/"].find(t=>0===e.type.indexOf(t)))).length)if("document"==s.type)this.attachMediaPopUp.titleEl.innerText="Send "+(t.length>1?t.length+" Files":"File"),i.classList.add("is-document");else{i.classList.add("is-media");let e=0,s=0;t.forEach(t=>{0===t.type.indexOf("image/")?++e:0===t.type.indexOf("video/")&&++s}),e&&s?this.attachMediaPopUp.titleEl.innerText="Send Album":e?this.attachMediaPopUp.titleEl.innerText="Send "+(e>1?e+" Photos":"Photo"):s&&(this.attachMediaPopUp.titleEl.innerText="Send "+(s>1?s+" Videos":"Video"))}Promise.all(t.map(e)).then(e=>{if("media"==s.type)if(s.sendFileDetails.length>1){i.classList.add("is-album");let t=new h.Layouter(s.sendFileDetails.map(e=>({w:e.width,h:e.height})),380,100,4).layout();for(let{geometry:s,sides:i}of t){let t=e.shift();t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.top=s.y+"px",t.style.left=s.x+"px",i&h.RectPart.Right&&(this.attachMediaPopUp.mediaContainer.style.width=s.width+s.x+"px"),i&h.RectPart.Bottom&&(this.attachMediaPopUp.mediaContainer.style.height=s.height+s.y+"px"),this.attachMediaPopUp.mediaContainer.append(t)}}else{let t=s.sendFileDetails[0],i=e[0],{w:n,h:a}=d.calcImageInBox(t.width,t.height,380,320);i.style.width=n+"px",i.style.height=a+"px",this.attachMediaPopUp.mediaContainer.append(i)}else this.attachMediaPopUp.mediaContainer.append(...e);this.attachMediaPopUp.container.classList.add("active")})},s={sendFileDetails:[]};this.fileInput.addEventListener("change",e=>{let s=e.target.files;s.length&&t(Array.from(s))},!1),this.attachMenu.media.addEventListener("click",()=>{this.fileInput.setAttribute("accept","image/*, video/*"),s.type="media",this.fileInput.click()}),this.attachMenu.document.addEventListener("click",()=>{this.fileInput.removeAttribute("accept"),s.type="document",this.fileInput.click()}),this.attachMenu.poll.addEventListener("click",()=>{(new b.default).show()}),document.addEventListener("paste",e=>{if(l.default.peerID&&!this.attachMediaPopUp.container.classList.contains("active")){var i=(e.clipboardData||e.originalEvent.clipboardData).items;for(let n=0;n<i.length;++n)if("file"==i[n].kind){e.preventDefault(),e.cancelBubble=!0,e.stopPropagation();let a=i[n].getAsFile();if(!a)continue;s.type=0===a.type.indexOf("image/")?"media":"document",t([a])}}},!0),this.attachMediaPopUp.sendBtn.addEventListener("click",()=>{this.attachMediaPopUp.container.classList.remove("active");let e=this.attachMediaPopUp.captionInput.value;s.isMedia="media"==s.type;let t=l.default.peerID;if(s.sendFileDetails.length>1&&s.isMedia)u.default.sendAlbum(t,s.sendFileDetails.map(e=>e.file),Object.assign({caption:e,replyToMsgID:this.replyToMsgID},s));else{e&&s.sendFileDetails.length>1&&(u.default.sendText(t,e,{replyToMsgID:this.replyToMsgID}),e="",this.replyToMsgID=0);s.sendFileDetails.map(i=>{let n=u.default.sendFile(t,i.file,Object.assign({isMedia:i.file.type.includes("audio/")||s.isMedia,caption:e,replyToMsgID:this.replyToMsgID},i));return e="",this.replyToMsgID=0,n})}this.onMessageSent()}),this.btnSend.addEventListener("click",()=>{this.btnSend.classList.contains("tgico-send")||!this.recorder?this.recording?this.recorder.stop():this.sendMessage():this.recorder.start().then(()=>{this.recordCanceled=!1,this.btnSend.classList.add("tgico-send"),this.chatInput.classList.add("is-recording"),this.recording=!0,f.default.setKeepAlive(!0),this.recordStartTime=Date.now();const e=this.recorder.sourceNode,t=e.context.createAnalyser();e.connect(t),t.fftSize=32;const s=new Uint8Array(t.frequencyBinCount),i=255*s.length;let n=()=>{if(!this.recording)return;t.getByteFrequencyData(s);let e=0;s.forEach(t=>{e+=t});let a=Math.min(1,e/i+.36);this.recordRippleEl.style.transform=`scale(${a})`;let o=Date.now()-this.recordStartTime,r=o%1e3,l=(""+o/1e3).toHHMMSS()+","+("00"+Math.round(r/10)).slice(-2);this.recordTimeEl.innerText=l,window.requestAnimationFrame(n)};n()}).catch(e=>{console.error("Recorder start error:",e)})}),this.recorder&&(this.btnCancelRecord.addEventListener("click",()=>{this.recordCanceled=!0,this.recorder.stop(),f.default.setKeepAlive(!1)}),this.recorder.onstop=()=>{this.recording=!1,this.chatInput.classList.remove("is-recording"),this.btnSend.classList.remove("tgico-send"),this.recordRippleEl.style.transform=""},this.recorder.ondataavailable=e=>{if(this.recordCanceled)return;const t=(Date.now()-this.recordStartTime)/1e3|0,s=new Blob([e],{type:"audio/ogg"});let i=performance.now();f.default.decode(e,!0).then(e=>{console.log("WAVEFORM!:",performance.now()-i),f.default.setKeepAlive(!1);let n=l.default.peerID;u.default.sendFile(n,s,{isVoiceMessage:!0,isMedia:!0,duration:t,waveform:e.waveform,objectURL:e.url,replyToMsgID:this.replyToMsgID}),this.onMessageSent(!1,!0)})}),this.replyElements.cancelBtn.addEventListener("click",()=>{if(this.replyElements.container.classList.remove("active"),this.replyToMsgID=0,this.editMsgID)if(this.willSendWebPage){let e=u.default.getMessage(this.editMsgID);this.setTopInfo("Editing",e.message)}else this.editMsgID=0,this.messageInput.innerHTML="",this.recorder&&(this.btnSend.classList.remove("tgico-send"),this.btnSend.classList.add("tgico-microphone2"));this.noWebPage=!0,this.willSendWebPage=null})}serializeNodes(e){return e.reduce((e,t)=>"object"==typeof t&&t.textContent?e+t.textContent:t.innerText?e+t.innerText:"IMG"==t.tagName&&t.classList&&t.classList.contains("emoji")?e+t.getAttribute("alt"):e,"")}onMessageSent(e=!0,t){let s=u.default.getDialogByPeerID(l.default.peerID)[0];s&&s.top_message&&u.default.readHistory(l.default.peerID,s.top_message),e&&(this.lastUrl="",this.editMsgID=0,this.noWebPage=!1,this.willSendWebPage=null,this.messageInput.innerText="",this.recorder&&(this.btnSend.classList.remove("tgico-send"),this.btnSend.classList.add("tgico-microphone2"))),(t||e)&&(this.replyToMsgID=0,this.replyElements.container.classList.remove("active"))}sendMessage(){let e=d.getRichValue(this.messageInput);this.editMsgID?u.default.editMessage(this.editMsgID,e,{noWebPage:this.noWebPage}):u.default.sendText(l.default.peerID,e,{replyToMsgID:0==this.replyToMsgID?void 0:this.replyToMsgID,noWebPage:this.noWebPage,webPage:this.willSendWebPage}),this.onMessageSent()}sendMessageWithDocument(e){return"documentEmpty"!=(e=g.default.getDoc(e))._&&(u.default.sendFile(l.default.peerID,e,{isMedia:!0,replyToMsgID:this.replyToMsgID}),this.onMessageSent(!1,!0),"sticker"==e.type&&v.default.stickersTab.pushRecentSticker(e),!0)}setTopInfo(e,t,s,i){"DIV"==this.replyElements.container.lastElementChild.tagName&&(this.replyElements.container.lastElementChild.remove(),this.replyElements.container.append(c.wrapReply(e,t,i))),this.replyElements.container.classList.add("active"),void 0!==s&&(this.messageInput.innerHTML=s?a.RichTextProcessor.wrapRichText(s):"",this.btnSend.classList.remove("tgico-microphone2"),this.btnSend.classList.add("tgico-send"))}saveScroll(){this.scrollTop=l.default.scrollable.container.scrollTop,this.scrollOffsetTop=this.chatInput.offsetTop}restoreScroll(){if(this.chatInput.style.display)return;let e=this.chatInput.offsetTop,t=l.default.scrollable.container,s=t.scrollTop,i=t.clientHeight,n=t.scrollHeight;if(e<this.scrollOffsetTop)this.scrollDiff=this.scrollOffsetTop-e,t.scrollTop+=this.scrollDiff;else if(s!=this.scrollTop){n-(s+i)<this.scrollDiff||(t.scrollTop-=this.scrollDiff)}}}},function(e,t,s){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=0)}([function(e,t,s){"use strict";(function(t){var s=t.AudioContext||t.webkitAudioContext,i=function(e){if(!i.isRecordingSupported())throw new Error("Recording is not supported in this browser");e||(e={}),this.state="inactive",this.config=Object.assign({bufferLength:4096,encoderApplication:2049,encoderFrameSize:20,encoderPath:"encoderWorker.min.js",encoderSampleRate:48e3,maxFramesPerPage:40,mediaTrackConstraints:!0,monitorGain:0,numberOfChannels:1,recordingGain:1,resampleQuality:3,streamPages:!1,reuseWorker:!1,wavBitDepth:16},e),this.encodedSamplePosition=0};i.isRecordingSupported=function(){return s&&t.navigator&&t.navigator.mediaDevices&&t.navigator.mediaDevices.getUserMedia&&t.WebAssembly},i.prototype.clearStream=function(){this.stream&&(this.stream.getTracks?this.stream.getTracks().forEach((function(e){e.stop()})):this.stream.stop(),delete this.stream),this.audioContext&&this.closeAudioContext&&(this.audioContext.close(),delete this.audioContext)},i.prototype.encodeBuffers=function(e){if("recording"===this.state){for(var t=[],s=0;s<e.numberOfChannels;s++)t[s]=e.getChannelData(s);this.encoder.postMessage({command:"encode",buffers:t})}},i.prototype.initAudioContext=function(e){return e&&e.context?(this.audioContext=e.context,this.closeAudioContext=!1):(this.audioContext=new s,this.closeAudioContext=!0),this.audioContext},i.prototype.initAudioGraph=function(){this.encodeBuffers=function(){delete this.encodeBuffers},this.scriptProcessorNode=this.audioContext.createScriptProcessor(this.config.bufferLength,this.config.numberOfChannels,this.config.numberOfChannels),this.scriptProcessorNode.connect(this.audioContext.destination),this.scriptProcessorNode.onaudioprocess=e=>{this.encodeBuffers(e.inputBuffer)},this.monitorGainNode=this.audioContext.createGain(),this.setMonitorGain(this.config.monitorGain),this.monitorGainNode.connect(this.audioContext.destination),this.recordingGainNode=this.audioContext.createGain(),this.setRecordingGain(this.config.recordingGain),this.recordingGainNode.connect(this.scriptProcessorNode)},i.prototype.initSourceNode=function(e){return e&&e.context?t.Promise.resolve(e):t.navigator.mediaDevices.getUserMedia({audio:this.config.mediaTrackConstraints}).then(e=>(this.stream=e,this.audioContext.createMediaStreamSource(e)))},i.prototype.loadWorker=function(){this.encoder||(this.encoder=new t.Worker(this.config.encoderPath))},i.prototype.initWorker=function(){var e=(this.config.streamPages?this.streamPage:this.storePage).bind(this);return this.recordedPages=[],this.totalLength=0,this.loadWorker(),new Promise((t,s)=>{var i=s=>{switch(s.data.message){case"ready":t();break;case"page":this.encodedSamplePosition=s.data.samplePosition,e(s.data.page);break;case"done":this.encoder.removeEventListener("message",i),this.finish()}};this.encoder.addEventListener("message",i),this.encoder.postMessage(Object.assign({command:"init",originalSampleRate:this.audioContext.sampleRate,wavSampleRate:this.audioContext.sampleRate},this.config))})},i.prototype.pause=function(e){if("recording"===this.state){if(this.state="paused",e&&this.config.streamPages){var t=this.encoder;return new Promise((e,s)=>{var i=s=>{"flushed"===s.data.message&&(t.removeEventListener("message",i),this.onpause(),e())};t.addEventListener("message",i),t.postMessage({command:"flush"})})}return this.onpause(),Promise.resolve()}},i.prototype.resume=function(){"paused"===this.state&&(this.state="recording",this.onresume())},i.prototype.setRecordingGain=function(e){this.config.recordingGain=e,this.recordingGainNode&&this.audioContext&&this.recordingGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01)},i.prototype.setMonitorGain=function(e){this.config.monitorGain=e,this.monitorGainNode&&this.audioContext&&this.monitorGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01)},i.prototype.start=function(e){if("inactive"===this.state)return this.initAudioContext(e),this.initAudioGraph(),this.encodedSamplePosition=0,this.initWorker().then(()=>this.initSourceNode(e)).then(e=>{this.sourceNode=e,this.state="recording",this.onstart(),this.encoder.postMessage({command:"getHeaderPages"}),this.sourceNode.connect(this.monitorGainNode),this.sourceNode.connect(this.recordingGainNode)})},i.prototype.stop=function(){if("inactive"!==this.state){this.state="inactive",this.monitorGainNode.disconnect(),this.scriptProcessorNode.disconnect(),this.recordingGainNode.disconnect(),this.sourceNode.disconnect(),this.clearStream();var e=this.encoder;return new Promise(t=>{var s=i=>{"done"===i.data.message&&(e.removeEventListener("message",s),t())};e.addEventListener("message",s),e.postMessage({command:"done"}),this.config.reuseWorker||e.postMessage({command:"close"})})}return Promise.resolve()},i.prototype.destroyWorker=function(){"inactive"===this.state&&this.encoder&&(this.encoder.postMessage({command:"close"}),delete this.encoder)},i.prototype.storePage=function(e){this.recordedPages.push(e),this.totalLength+=e.length},i.prototype.streamPage=function(e){this.ondataavailable(e)},i.prototype.finish=function(){if(!this.config.streamPages){var e=new Uint8Array(this.totalLength);this.recordedPages.reduce((function(t,s){return e.set(s,t),t+s.length}),0),this.ondataavailable(e)}this.onstop(),this.config.reuseWorker||delete this.encoder},i.prototype.ondataavailable=function(){},i.prototype.onpause=function(){},i.prototype.onresume=function(){},i.prototype.onstart=function(){},i.prototype.onstop=function(){},e.exports=i}).call(this,s(1))},function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s}])},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EMOTICONSSTICKERGROUP=void 0;const l=r(s(18)),d=s(1),c=r(s(17)),u=r(s(9)),h=s(0),p=s(3),f=r(s(40)),m=r(s(2)),g=r(s(31)),v=s(24),b=r(s(12)),y=r(s(23)),_=a(s(4)),w=r(s(20)),S=r(s(38)),L=r(s(36));t.EMOTICONSSTICKERGROUP="emoticons-dropdown";class M{constructor(){this.recent=[],this.heights=[],this.onContentClick=e=>{let t=e.target;if("SPAN"!=t.tagName||t.classList.contains("emoji")){if("DIV"==t.tagName)return}else t=t.firstElementChild;l.default.chatInputC.messageInput.innerHTML+=t.outerHTML;const s=this.getEmojiFromElement(t);Array.from(this.recentItemsDiv.children).forEach((e,t)=>{const i=this.getEmojiFromElement(e);s==i&&e.remove()});const i=this.recentItemsDiv.scrollHeight;this.appendEmoji(s,this.recentItemsDiv,!0),this.recentItemsDiv.scrollHeight!=i&&(this.heights.length=0,Array.from(this.scroll.container.children).forEach(e=>{this.heights.push((this.heights[this.heights.length-1]||0)+e.scrollHeight)})),this.recent.findAndSplice(e=>e==s),this.recent.unshift(s),this.recent.length>36&&(this.recent.length=36),L.default.pushToState("recentEmoji",this.recent);const n=new Event("input",{bubbles:!0,cancelable:!0});l.default.chatInputC.messageInput.dispatchEvent(n)}}init(){this.content=document.getElementById("content-emoji");const e=["Smileys & Emotion","Animals & Nature","Food & Drink","Travel & Places","Activities","Objects","Flags","Skin Tones"],t={},s={Recent:[]};for(const t in _.default.Emoji){const i=""+_.default.Emoji[t],n=e[+i[0]-1];n&&(s[n]||(s[n]=[]),s[n][+i.slice(1)||0]=t)}e.pop(),delete s["Skin Tones"];for(const e in s){const i=document.createElement("div");i.classList.add("emoji-category");const n=document.createElement("div");n.classList.add("category-title"),n.innerText=e;const a=document.createElement("div");a.classList.add("category-items"),i.append(n,a);s[e].forEach(e=>{this.appendEmoji(e,a)}),t[e]=i}let i=0;const n=this.content.previousElementSibling.firstElementChild,a=this.scroll=new u.default(this.content,"y","EMOJI",null);a.container.addEventListener("scroll",e=>{i=I.contentOnScroll(n,this.heights,i,a.container)});const o=d.putPreloader(this.content,!0);Promise.all([new Promise(e=>setTimeout(e,200)),L.default.getState().then(e=>{Array.isArray(e.recentEmoji)&&(this.recent=e.recentEmoji)})]).then(()=>{o.remove(),this.recentItemsDiv=t.Recent.querySelector(".category-items");for(const e of this.recent)this.appendEmoji(e,this.recentItemsDiv);e.unshift("Recent"),e.map(e=>{const s=t[e];return s||console.error("no div by category:",e),a.append(s),s}).forEach(e=>{this.heights.push((this.heights[this.heights.length-1]||0)+e.scrollHeight)})}),this.content.addEventListener("click",this.onContentClick),I.menuOnClick(n,this.heights,a),this.init=null}appendEmoji(e,t,s=!1){const i=document.createElement("span"),n=p.RichTextProcessor.wrapEmojiText(e);i.innerHTML=n,s?t.prepend(i):t.appendChild(i)}getEmojiFromElement(e){return"SPAN"!=e.tagName||e.classList.contains("emoji")||(e=e.firstElementChild),e.getAttribute("alt")||e.innerText}onClose(){}}class D{constructor(){this.stickerSets={},this.recentStickers=[],this.heights=[],this.heightRAF=0,this.mounted=!1}categoryPush(e,t,s,i){let n=document.createElement("div");n.classList.add("category-items");let a=document.createElement("div");a.classList.add("category-title"),a.innerText=t,e.append(a,n),s.forEach(e=>{n.append(this.renderSticker(e))}),i?this.recentDiv.parentElement?(this.scroll.prepend(e),this.scroll.prepend(this.recentDiv)):this.scroll.prepend(e):this.scroll.append(e),this.setNewHeights()}setNewHeights(){this.heightRAF||(this.heightRAF=window.requestAnimationFrame(()=>{this.heightRAF=0;const e=this.heights;let t=parseInt(window.getComputedStyle(this.scroll.container).getPropertyValue("padding-top"))||0;e.length=0,Array.from(this.scroll.splitUp.children).forEach((s,i)=>{e[i]=(e[i-1]||0)+s.scrollHeight+(0==i?t:0)}),this.scroll.reorder()}))}renderSticker(e){let s=document.createElement("div");return v.wrapSticker({doc:e,div:s,lazyLoadQueue:I.lazyLoadQueue,group:t.EMOTICONSSTICKERGROUP,onlyThumb:!0}),s}renderStickerSet(e,s=!1){return o(this,void 0,void 0,(function*(){let i=document.createElement("div");i.classList.add("sticker-category");let n=document.createElement("li");n.classList.add("btn-icon"),this.stickerSets[e.id]={stickers:i,tab:n},s?this.menu.insertBefore(n,this.menu.firstElementChild.nextSibling):this.menu.append(n);let a=yield f.default.getStickerSet(e);a.set.thumb?f.default.getStickerSetThumb(a.set).then(e=>{if(a.set.pFlags.animated){const s=new FileReader;s.addEventListener("loadend",e=>o(this,void 0,void 0,(function*(){const s=e.srcElement.result;let i=yield m.default.gzipUncompress(s,!0);yield c.default.loadAnimationWorker({container:n,loop:!0,autoplay:!1,animationData:JSON.parse(i),width:32,height:32},t.EMOTICONSSTICKERGROUP)}))),s.readAsArrayBuffer(e)}else{let t=new Image;d.renderImageFromUrl(t,URL.createObjectURL(e)),n.append(t)}}):v.wrapSticker({doc:a.documents[0],div:n,group:t.EMOTICONSSTICKERGROUP}),this.categoryPush(i,a.set.title,a.documents,s)}))}init(){this.content=document.getElementById("content-stickers"),this.recentDiv=document.createElement("div"),this.recentDiv.classList.add("sticker-category");let e=this.content.previousElementSibling;this.menu=e.firstElementChild.firstElementChild;let t=new u.default(e,"x"),s=document.createElement("div");s.classList.add("stickers-categories"),this.content.append(s),h.$rootScope.$on("stickers_installed",e=>{const t=e.detail;!this.stickerSets[t.id]&&this.mounted&&this.renderStickerSet(t,!0)}),h.$rootScope.$on("stickers_deleted",e=>{const t=e.detail;if(this.stickerSets[t.id]&&this.mounted){const e=this.stickerSets[t.id];e.stickers.remove(),e.tab.remove(),this.setNewHeights(),delete this.stickerSets[t.id]}}),s.addEventListener("click",I.onMediaClick);let i=0;this.scroll=new u.default(this.content,"y","STICKERS",void 0,void 0,2),this.scroll.container.addEventListener("scroll",e=>{0==this.heights[1]&&this.setNewHeights(),i=I.contentOnScroll(this.menu,this.heights,i,this.scroll.container,t)}),this.scroll.setVirtualContainer(s),this.menu.addEventListener("click",()=>{0==this.heights[1]&&this.setNewHeights()}),I.menuOnClick(this.menu,this.heights,this.scroll,t);const n=d.putPreloader(this.content,!0);Promise.all([f.default.getRecentStickers().then(e=>{this.recentStickers=e.stickers.slice(0,20),this.stickerSets.recent={stickers:this.recentDiv,tab:this.menu.firstElementChild},n.remove(),this.categoryPush(this.recentDiv,"Recent",this.recentStickers,!0)}),m.default.invokeApi("messages.getAllStickers",{hash:0}).then(e=>o(this,void 0,void 0,(function*(){let t=e;n.remove();for(let e of t.sets)this.renderStickerSet(e)})))]).finally(()=>{this.mounted=!0}),this.init=null}pushRecentSticker(e){if(!this.recentDiv.parentElement)return;let t=this.recentDiv.querySelector(`[data-doc-i-d="${e.id}"]`);t||(t=this.renderSticker(e));const s=this.recentDiv.lastElementChild;s.prepend(t),s.childElementCount>20&&Array.from(s.children).slice(20).forEach(e=>e.remove()),this.setNewHeights()}onClose(){}}class E{init(){this.content=document.getElementById("content-gifs");const e=this.content.firstElementChild;e.addEventListener("click",I.onMediaClick);new u.default(this.content,"y","GIFS",null);const t=d.putPreloader(this.content,!0);m.default.invokeApi("messages.getSavedGifs",{hash:0}).then(s=>{let i=s;i.gifs.forEach((e,t)=>{i.gifs[t]=b.default.saveDoc(e)}),t.remove();for(let t=0,s=i.gifs.length;t<s;){let s=i.gifs[t],n=s.w,a=s.h;a<100&&(n*=100/a,a=100);let o=Math.min(300,400,n),{w:r,h:l}=h.calcImageInBox(n,a,o,100);++t;let d=document.createElement("div");d.style.width=r+"px",d.dataset.docID=s.id,e.append(d);let c=new y.default(d);I.lazyLoadQueue.push({div:d,load:()=>{let e=b.default.downloadDoc(s);return c.attach(d,!0,e),e.then(e=>{c.detach(),d.innerHTML=`<video autoplay="true" muted="true" loop="true" src="${s.url}" type="video/mp4"></video>`}),e}})}}),this.init=null}onClose(){}}let I=(()=>{class e{constructor(){this.tabID=-1,this.toggle=s=>o(this,void 0,void 0,(function*(){const i=!!this.element.style.display&&void 0===s||s;if(this.init){if(!i)return;this.init(),this.init=null}_.touchSupport?(this.toggleEl.classList.toggle("flip-icon",i),i&&(l.default.chatInputC.saveScroll(),document.activeElement.blur(),yield new Promise(e=>{setTimeout(e,100)}))):this.toggleEl.classList.toggle("active",s),this.element.style.display&&void 0===s||s?(this.element.style.display="",this.element.offsetLeft,this.element.classList.add("active"),e.lazyLoadQueue.lockIntersection(),w.default.lockIntersectionGroup(t.EMOTICONSSTICKERGROUP),clearTimeout(this.displayTimeout),this.displayTimeout=setTimeout(()=>{w.default.unlockIntersectionGroup(t.EMOTICONSSTICKERGROUP),e.lazyLoadQueue.unlockIntersection()},_.touchSupport?0:200)):(this.element.classList.remove("active"),e.lazyLoadQueue.lockIntersection(),w.default.lockIntersectionGroup(t.EMOTICONSSTICKERGROUP),w.default.checkAnimations(!0,t.EMOTICONSSTICKERGROUP),clearTimeout(this.displayTimeout),this.displayTimeout=setTimeout(()=>{this.element.style.display="none",w.default.unlockIntersectionGroup(t.EMOTICONSSTICKERGROUP),e.lazyLoadQueue.unlockIntersection()},_.touchSupport?0:200))})),this.element=document.getElementById("emoji-dropdown");let s=!0;this.toggleEl=document.getElementById("toggle-emoticons"),_.touchSupport?this.toggleEl.addEventListener("click",()=>{s?(s=!1,this.toggle(!0)):this.toggle()}):this.toggleEl.onmouseover=e=>{clearTimeout(this.displayTimeout),s&&(this.toggleEl.onmouseout=this.element.onmouseout=e=>{clearTimeout(this.displayTimeout),this.displayTimeout=setTimeout(()=>{this.toggle()},200)},this.element.onmouseover=e=>{clearTimeout(this.displayTimeout)},s=!1),this.toggle(!0)}}init(){this.emojiTab=new M,this.stickersTab=new D,this.gifsTab=new E,this.tabs={0:this.emojiTab,1:this.stickersTab,2:this.gifsTab},this.container=this.element.querySelector(".emoji-container .tabs-container"),this.tabsEl=this.element.querySelector(".emoji-tabs"),d.horizontalMenu(this.tabsEl,this.container,e=>{w.default.checkAnimations(!0,t.EMOTICONSSTICKERGROUP),this.tabID=e,this.searchButton.classList.toggle("hide",1!=this.tabID),this.deleteBtn.classList.toggle("hide",0!=this.tabID)},()=>{const e=this.tabs[this.tabID];e.init&&e.init(),e.onCloseAfterTimeout&&e.onCloseAfterTimeout(),w.default.checkAnimations(!1,t.EMOTICONSSTICKERGROUP)}),this.searchButton=this.element.querySelector(".emoji-tabs-search"),this.searchButton.addEventListener("click",()=>{S.default.stickersTab.init()}),this.deleteBtn=this.element.querySelector(".emoji-tabs-delete"),this.deleteBtn.addEventListener("click",()=>{var e;const t=l.default.chatInputC.messageInput;(null===(e=t.lastChild)||void 0===e?void 0:e.tagName)?t.lastElementChild.remove():t.lastChild&&(t.lastChild.textContent.length?t.lastChild.textContent=t.lastChild.textContent.slice(0,-1):t.lastChild.remove());const s=new Event("input",{bubbles:!0,cancelable:!0});l.default.chatInputC.messageInput.dispatchEvent(s)}),this.tabsEl.firstElementChild.children[1].click(),this.tabs[0].init()}}return e.lazyLoadQueue=new g.default,e.menuOnClick=(e,t,s,i)=>{e.addEventListener("click",(function(e){let i=e.target;if(i=h.findUpTag(i,"LI"),!i)return;let n=h.whichChild(i),a=t[n-1]||0;s.container.scrollTop=a}))},e.contentOnScroll=(e,t,s,i,n)=>{let a=Math.round(i.scrollTop);for(let i=0;i<t.length;++i){if(a<t[i]){e.children[s].classList.remove("active"),s=i,e.children[s].classList.add("active"),n&&(i<t.length-4?n.container.scrollLeft=47*(i-3):n.container.scrollLeft=47*i);break}}return s},e.onMediaClick=e=>{let t=e.target;if(t=h.findUpTag(t,"DIV"),!t)return;let s=t.dataset.docID;l.default.chatInputC.sendMessageWithDocument(s)?P.toggle(!1):console.warn("got no doc by id:",s)},e})();const P=new I;t.default=P},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(30),a=i(s(9)),o=i(s(6)),r=s(0),l=s(1),d=(e,t,s)=>{const i=document.createElement("div");return i.classList.add("input-field"),i.innerHTML=`\n <input type="text" name="${s}" id="input-${s}" placeholder="${e}" autocomplete="off" required="">\n <label for="input-${s}">${t}</label>\n `,i};class c extends n.PopupElement{constructor(){super("popup-create-poll popup-new-media",null,{closable:!0,withConfirm:"CREATE",body:!0}),this.tempID=0,this.onSubmitClick=e=>{const t=this.questionInput.value;if(!t.trim())return void l.toast("Please enter a question");const s=Array.from(this.questions.children).map((e,t)=>e.firstElementChild.value).filter(e=>!!e.trim());if(s.length<2)return void l.toast("Please enter at least two options");this.closeBtn.click(),this.confirmBtn.removeEventListener("click",this.onSubmitClick);const i={_:"poll",flags:0};i.question=t,i.answers=s.map((e,t)=>({_:"pollAnswer",text:e,option:new Uint8Array([t])})),o.default.sendOther(r.$rootScope.selectedPeerID,{_:"inputMediaPoll",flags:0,poll:i})},this.onInput=e=>{const t=e.target;t.value.length&&t.parentElement.classList.add("is-filled");!t.parentElement.nextElementSibling&&t.value.length&&this.questions.childElementCount<10&&this.appendMoreField()},this.onDeleteClick=e=>{e.target.parentElement.remove(),Array.from(this.questions.children).forEach((e,t)=>{e.firstElementChild.nextElementSibling.innerText="Option "+(t+1)})},this.title.innerText="New Poll";const e=d("Ask a Question","Ask a Question","question");this.questionInput=e.firstElementChild,this.header.append(e);const t=document.createElement("hr"),s=document.createElement("div");s.classList.add("caption"),s.innerText="Options",this.questions=document.createElement("div"),this.questions.classList.add("poll-create-questions"),this.body.parentElement.insertBefore(t,this.body),this.body.append(s,this.questions),this.confirmBtn.addEventListener("click",this.onSubmitClick),this.scrollable=new a.default(this.body,"y",void 0),this.appendMoreField()}appendMoreField(){const e=this.questions.childElementCount+1,t=d("Add an Option","Option "+e,"question-"+this.tempID++);t.firstElementChild.addEventListener("input",this.onInput);const s=document.createElement("span");s.classList.add("btn-icon","tgico-close"),t.append(s),s.addEventListener("click",this.onDeleteClick,{once:!0}),this.questions.append(t),this.scrollable.scrollTo(this.scrollable.scrollHeight,!0,!0)}}t.default=c},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(0);t.default=class{constructor(){this.bubblesByGroups=[],this.groups=[],this.newGroupDiff=120}removeBubble(e,t){let s=this.bubblesByGroups.findAndSplice(e=>e.mid==t);s&&s.group.length&&(s.group.findAndSplice(t=>t==e),s.group.length?this.updateGroup(s.group):this.groups.findAndSplice(e=>e==s.group))}addBubble(e,t,s){let n,a=t.date,o=t.fromID;if(o==i.$rootScope.myID&&i.$rootScope.selectedPeerID==i.$rootScope.myID&&t.fwdFromID==o&&(o=-o),this.bubblesByGroups.length)if(s){let t=this.bubblesByGroups[0];t.fromID==o&&t.timestamp-a<this.newGroupDiff?(n=t.group,n.unshift(e)):this.groups.unshift(n=[e])}else{let t=this.bubblesByGroups[this.bubblesByGroups.length-1];t.fromID==o&&a-t.timestamp<this.newGroupDiff?(n=t.group,n.push(e)):this.groups.push(n=[e])}else this.groups.push(n=[e]);this.bubblesByGroups[s?"unshift":"push"]({timestamp:a,fromID:o,mid:t.mid,group:n}),this.updateGroup(n)}setClipIfNeeded(e,t=!1){if(e.classList.contains("is-message-empty")&&(e.classList.contains("photo")||e.classList.contains("video"))){let s=e.querySelector(".bubble__media-container");if(!s)return;Array.from(s.children).forEach(n=>{if(!(n instanceof SVGDefsElement))if(t)n.removeAttributeNS(null,"clip-path");else{let t,a,o=s.dataset.clipID,r=s.firstElementChild.firstElementChild.lastElementChild,l=+n.getAttributeNS(null,"width"),d=+n.getAttributeNS(null,"height"),c=e.classList.contains("is-out"),u=e.classList.contains("is-reply"),h="";e.classList.contains("forwarded")||u?t=a=0:c?(t=e.classList.contains("is-group-first")?12:6,a=12):(t=12,a=e.classList.contains("is-group-first")?12:6),h=c?i.generatePathData(0,0,l-9,d,a,t,0,12):i.generatePathData(9,0,l-9,d,a,t,12,0),r.setAttributeNS(null,"d",h),n.setAttributeNS(null,"clip-path","url(#"+o+")")}})}}updateGroup(e){if(!e.length)return;let t=e[0];if(1==e.length)return t.classList.add("is-group-first","is-group-last"),void this.setClipIfNeeded(t);t.classList.remove("is-group-last"),t.classList.add("is-group-first"),this.setClipIfNeeded(t,!0);let s=e.length-1;for(let t=1;t<s;++t){let s=e[t];s.classList.remove("is-group-last","is-group-first"),this.setClipIfNeeded(s,!0)}let i=e[e.length-1];i.classList.remove("is-group-first"),i.classList.add("is-group-last"),this.setClipIfNeeded(i)}updateGroupByMessageID(e){let t=this.bubblesByGroups.find(t=>t.mid==e);t&&this.updateGroup(t.group)}cleanup(){this.bubblesByGroups=[],this.groups=[]}}},function(e,t,s){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AppInlineBotsManager=void 0;const n=i(s(6)),a=i(s(2)),o=i(s(8)),r=i(s(28)),l=s(1),d=s(3);class c{callbackButtonClick(e,t){let s=n.default.getMessage(e),i=n.default.getMessagePeer(s);return a.default.invokeApi("messages.getBotCallbackAnswer",{flags:1,peer:o.default.getInputPeerByID(i),msg_id:r.default.getMessageLocalID(e),data:t.data},{timeout:1,stopTime:-1,noErrorBox:!0}).then(e=>{"string"==typeof e.message&&e.message.length&&l.toast(d.RichTextProcessor.wrapRichText(e.message,{noLinks:!0,noLinebreaks:!0})),console.log("callbackButtonClick callbackAnswer:",e)})}}t.AppInlineBotsManager=c;const u=new c;t.default=u},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t){this.container=e,this.handler=t,this.observeHeaders(),this.observeElements()}observeHeaders(){this.headersObserver=new IntersectionObserver(e=>{for(const t of e){const e=t.boundingClientRect,s=t.target.parentElement,i=t.rootBounds;e.bottom<i.top&&this.handler(!0,s),e.bottom>=i.top&&e.bottom<i.bottom&&this.handler(!1,s)}},{threshold:0,root:this.container})}observeElements(){this.elementsObserver=new IntersectionObserver(e=>{let t=e.filter(e=>e.boundingClientRect.top<0).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];if(!t)return;let s=t.isIntersecting?t.target:t.target.nextElementSibling;this.handler(!0,s)},{root:this.container})}addSentinel(e,t){const s=document.createElement("div");return s.classList.add("sticky_sentinel",t),e.appendChild(s)}observeStickyHeaderChanges(e){const t=this.addSentinel(e,"sticky_sentinel--top");this.headersObserver.observe(t),this.elementsObserver.observe(e)}disconnect(){this.headersObserver.disconnect(),this.elementsObserver.disconnect()}unobserve(e,t){this.elementsObserver.unobserve(e),this.headersObserver.unobserve(t)}}},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=s(30);class n extends i.PopupElement{constructor(e,t){super("popup-date-picker",[{text:"CANCEL",isCancel:!0},{text:"JUMP TO DATE",callback:()=>{this.onPick&&this.onPick(this.selectedDate.getTime()/1e3|0)}}]),this.onPick=t,this.minDate=new Date("2013-08-01T00:00:00"),this.onPrevClick=e=>{this.selectedMonth.setMonth(this.selectedMonth.getMonth()-1),this.setMonth(),this.selectedMonth.getTime()==this.minMonth.getTime()&&this.prevBtn.setAttribute("disabled","true"),this.nextBtn.removeAttribute("disabled")},this.onNextClick=e=>{this.selectedMonth.setMonth(this.selectedMonth.getMonth()+1),this.setMonth(),this.selectedMonth.getTime()==this.maxMonth.getTime()&&this.nextBtn.setAttribute("disabled","true"),this.prevBtn.removeAttribute("disabled")},this.onDateClick=e=>{const t=e.target;if(!t.dataset.timestamp)return;if(this.selectedEl){if(this.selectedEl==t)return;this.selectedEl.classList.remove("active")}t.classList.add("active");const s=+t.dataset.timestamp;this.selectedDate=new Date(s),this.setTitle(),this.setMonth()};const s=document.createElement("div");s.classList.add("popup-body"),this.controlsDiv=document.createElement("div"),this.controlsDiv.classList.add("date-picker-controls"),this.prevBtn=document.createElement("button"),this.prevBtn.classList.add("btn-icon","tgico-down","date-picker-prev"),this.prevBtn.addEventListener("click",this.onPrevClick),this.nextBtn=document.createElement("button"),this.nextBtn.classList.add("btn-icon","tgico-down","date-picker-next"),this.nextBtn.addEventListener("click",this.onNextClick),this.monthTitle=document.createElement("div"),this.monthTitle.classList.add("date-picker-month-title"),this.controlsDiv.append(this.prevBtn,this.monthTitle,this.nextBtn),this.monthsContainer=document.createElement("div"),this.monthsContainer.classList.add("date-picker-months"),this.monthsContainer.addEventListener("click",this.onDateClick),s.append(this.controlsDiv,this.monthsContainer),this.container.append(s),e.setHours(0,0,0,0),this.selectedDate=e,this.maxDate=new Date,this.maxDate.setHours(0,0,0,0),this.selectedMonth=new Date(this.selectedDate),this.selectedMonth.setDate(1),this.maxMonth=new Date(this.maxDate),this.maxMonth.setDate(1),this.minMonth=new Date(this.minDate),this.minMonth.setDate(1),this.selectedMonth.getTime()==this.minMonth.getTime()&&this.prevBtn.setAttribute("disabled","true"),this.selectedMonth.getTime()==this.maxMonth.getTime()&&this.nextBtn.setAttribute("disabled","true"),this.setTitle(),this.setMonth()}setTitle(){const e=this.selectedDate.toString().split(" ",3);this.title.innerText=e[0]+", "+e[1]+" "+e[2]}setMonth(){this.monthTitle.innerText=["January","February","March","April","May","June","July","August","September","October","November","December"][this.selectedMonth.getMonth()]+" "+this.selectedMonth.getFullYear(),this.month&&this.month.remove(),this.month=document.createElement("div"),this.month.classList.add("date-picker-month");const e=["M","T","W","T","F","S","S"];this.month.append(...e.map(e=>{const t=document.createElement("span");return t.innerText=e,t}));const t=new Date(this.selectedMonth);let s=t.getDay()-1;-1==s&&(s=e.length-1);for(let e=0;e<s;++e){const e=document.createElement("span");this.month.append(e)}do{const e=t.getDate(),s=document.createElement("button");s.classList.add("btn-icon"),s.innerText=""+e,s.dataset.timestamp=""+t.getTime(),t>this.maxDate&&s.setAttribute("disabled","true"),t.getTime()==this.selectedDate.getTime()&&(this.selectedEl=s,s.classList.add("active")),this.month.append(s),t.setDate(e+1)}while(1!=t.getDate());this.container.classList.toggle("is-max-lines",this.month.childElementCount/7>6),this.monthsContainer.append(this.month)}}t.default=n},function(e,t,s){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&i(t,e,s);return n(t,e),t},o=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,r)}l((i=i.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=r(s(2)),d=r(s(19)),c=r(s(26)),u=r(s(60)),h=r(s(44)),p=s(25),f=s(11),m=r(s(29));let g;const v=new d.default("page-signQR",!0,()=>g,()=>{console.log("onMount"),g||(g=o(void 0,void 0,void 0,(function*(){const e=v.pageEl.querySelector(".auth-image");v.pageEl.querySelector(".a-qr").addEventListener("click",()=>{h.default.mount(),i=!0});const t=(yield Promise.all([Promise.resolve().then(()=>a(s(101)))]))[0].default;let i=!1;document.addEventListener("user_auth",()=>{i=!0,g=null},{once:!0});let n,r={ignoreErrors:!0};return()=>o(void 0,void 0,void 0,(function*(){for(i=!1;!i;)try{let s=yield l.default.invokeApi("auth.exportLoginToken",{api_id:p.App.id,api_hash:p.App.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"==s._&&(r.dcID||(r.dcID=s.dc_id,l.default.setBaseDcID(s.dc_id)),s=yield l.default.invokeApi("auth.importLoginToken",{token:s.token},r)),"auth.loginTokenSuccess"==s._){let e=s.authorization;l.default.setUserAuth({id:e.user.id}),c.default.mount();break}if(!n||!f.bytesCmp(n,s.token)){n=s.token;let i="tg://login?token="+f.bytesToBase64(s.token).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"");e.innerHTML="",new t({width:166,height:166,data:i,image:"assets/img/logo_padded.svg",dotsOptions:{color:"#000000",type:"rounded"},imageOptions:{imageSize:.75},backgroundOptions:{color:"#ffffff"},qrOptions:{errorCorrectionLevel:"L"}}).append(e)}let i=Date.now()/1e3,a=s.expires-i-m.default.serverTimeOffset;yield new Promise((e,t)=>setTimeout(e,a>5?5e3:1e3*a|0))}catch(e){switch(e.type){case"SESSION_PASSWORD_NEEDED":console.warn("pageSignQR: SESSION_PASSWORD_NEEDED"),e.handled=!0,u.default.mount(),i=!0,g=null;break;default:console.error("pageSignQR: default error:",e)}}}))}))),g.then(e=>{e()})});t.default=v}]);