so2rbgolosovalka.ru Open in urlscan Pro
2606:4700:3035::6815:2a1c  Public Scan

Submitted URL: http://so2rbgolosovalka.ru/auth/index-f4e30377.js
Effective URL: https://so2rbgolosovalka.ru/auth/index-f4e30377.js
Submission: On January 30 via api from US — Scanned from US

Form analysis 0 forms found in the DOM

Text Content

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(n){if(n.ep)return;n.ep=!0;const o=s(n);fetch(n.href,o)}})();const Ws="modulepreload",Vs=function(t,e){return new URL(t,e).href},bt={},R=function(e,s,r){if(!s||s.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(s.map(o=>{if(o=Vs(o,r),o in bt)return;bt[o]=!0;const i=o.endsWith(".css"),c=i?'[rel="stylesheet"]':"";if(!!r)for(let l=n.length-1;l>=0;l--){const m=n[l];if(m.href===o&&(!i||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const u=document.createElement("link");if(u.rel=i?"stylesheet":Ws,i||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),i)return new Promise((l,m)=>{u.addEventListener("load",l),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},Tt=["web.telegram.org","webk.telegram.org"],fo="pattern",Lt=Math.min(4,navigator.hardwareConcurrency??4),A={id:+"1025907",hash:"452b0359b988148995f22ff0f4229750",version:"1.9.0",versionFull:"1.9.0 (335)",build:+"335",langPackVersion:"2.1.9",langPack:"webk",langPackCode:"en",domains:Tt,baseDcId:2,isMainDomain:Tt.includes(location.hostname),suffix:"K",threads:Lt,cryptoWorkers:Lt};A.isMainDomain&&(A.id=2496,A.hash="8da85b0d5bfe62527e5b244c209159c3");function It(){return document.activeElement?.blur?(document.activeElement.blur(),!0):!1}function Mt(t){if(t||(t=window.event),t){t=t.originalEvent||t;try{t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1,t.cancelBubble=!0}catch{}}return!1}const Q="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,mt=typeof window<"u"?window:self,fe=navigator?navigator.userAgent:null,ot=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)!==-1,Jt=navigator.userAgent.toLowerCase().indexOf("android")!==-1,Gs=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),ie=(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!mt.MSStream,j="safari"in mt||!!(fe&&(/\b(iPad|iPhone|iPod)\b/.test(fe)||fe.match("Safari")&&!fe.match("Chrome"))),ae=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Zt=j&&ie,ee=(navigator.maxTouchPoints===void 0||navigator.maxTouchPoints>0)&&navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i)!=-1,Ys=Object.freeze(Object.defineProperty({__proto__:null,IS_ANDROID:Jt,IS_APPLE:ot,IS_APPLE_MOBILE:ie,IS_CHROMIUM:Gs,IS_FIREFOX:ae,IS_MOBILE:ee,IS_MOBILE_SAFARI:Zt,IS_SAFARI:j,USER_AGENT:fe},Symbol.toStringTag,{value:"Module"}));function zs(t,e){return t.closest("."+e)}let he;function it(t){he?he.push(t):(he=[t],requestAnimationFrame(()=>{const e=he;he=void 0,e.forEach(s=>s())}))}let re,$e=!1;function mo(t){re?$e?t():re.push(t):(re=[t],requestAnimationFrame(()=>{$e=!0;for(let e=0;e<re.length;++e)re[e]();re=void 0,$e=!1}))}let ne;function po(){return ne||(ne=new Promise(t=>it(()=>t())),ne.then(()=>{ne=void 0}),ne)}function js(){return new Promise(t=>{it(()=>{it(t)})})}function Rt(t){t.style.transform="translateY(-99999px)",t.focus(),js().then(()=>{t.style.transform=""})}const Ie=j&&ee&&Q;if(Ie){const t="clientY";let e=0;const s={capture:!0,passive:!1},r=o=>{const i=o.touches[0],c=zs(i.target,"scrollable-y");if(c){const a=i[t],u=e-a,l=c.scrollTop,m=c.scrollHeight,F=c.clientHeight,f=l?Math.round(l+c.clientHeight+u):l+u;(m===F||f>=m||f<=0)&&o.preventDefault()}else o.preventDefault()};let n=0;document.addEventListener("focusin",o=>{!o.target.classList.contains("is-sticky-input-bugged")||o.timeStamp-n<50||(Rt(o.target),document.addEventListener("touchmove",r,s),document.addEventListener("touchstart",i=>{if(i.touches.length>1)return;e=i.touches[0][t]}))},{passive:!0}),document.addEventListener("focusout",o=>{document.removeEventListener("touchmove",r,s),n=o.timeStamp},{passive:!0}),document.addEventListener("visibilitychange",()=>{document.activeElement&&document.activeElement.classList.contains("is-sticky-input-bugged")&&document.activeElement.blur&&Rt(document.activeElement)},{passive:!0})}function Fo(t){Ie&&t.classList.add("is-sticky-input-bugged")}function Fe(){}function pt(t){return new Promise(e=>{setTimeout(e,t)})}const Ke=["b","б"],qe={},Hs={text:"Roboto",icons:"tgico",monospace:"Roboto Mono"};function $s(t={text:Ke,icons:void 0,monospace:Ke}){if(!("fonts"in document))return Promise.resolve();const e=[];for(const s in t){let r=t[s];r==="all"&&(r=Ke);const n=Hs[s],o=s==="icons"?[500]:[400,500];for(const i of o){const c=(r||[void 0]).map(a=>{var m,F;const u=[i,"1rem",n].join(" ");return(m=qe[u]??(qe[u]={}))[F=a||""]??(m[F]=document.fonts.load(u,a))});e.push(...c)}}return Promise.race([Promise.all(e).catch(Fe),pt(1e3)])}const at=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)!==-1;function Qt(t){return t instanceof URL||(t=new URL(t+"",location.href)),location.search&&t.protocol!=="blob:"&&new URLSearchParams(location.search).forEach((s,r)=>{t.searchParams.set(r,s)}),t.searchParams.delete("swfix"),t}function Ks(){const t={construct(e,s){return s[0]=Qt(s[0]),new e(...s)}};[Worker,typeof SharedWorker<"u"&&SharedWorker].filter(Boolean).forEach(e=>{window[e.name]=new Proxy(e,t)})}Ks();function qs(){Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(t,e){return e!==void 0&&(e=!!e),this.hasAttribute(t)?e?!0:(this.removeAttribute(t),!1):e===!1?!1:(this.setAttribute(t,""),!0)})}const Xs=0,Eo=1271266957,vo=777,Co=777e3,So=2147483647,_o="",yo=20*1024*1024,wo="",ko=[7322096,16766590,13338331,9367192,16749490,16478047],Po="default_static",ct=4294967296,Ao=ct+1,Js=new Set(["web","k","z","a"]),bo=2147483646,Zs=0,Qs=1,er=new Set([Zs,Qs]);Math.max(...Array.from(er))+1;function tr(t,e){const s=t.findIndex(e);return s!==-1?t.splice(s,1)[0]:void 0}class te{constructor(e){this._constructor(e)}_constructor(e){this.reuseResults=e,this.listeners={},this.listenerResults={}}addEventListener(e,s,r){var n;if(((n=this.listeners)[e]??(n[e]=[])).push({callback:s,options:r}),this.listenerResults.hasOwnProperty(e)&&(s(...this.listenerResults[e]),r?.once)){this.listeners[e].pop();return}}addMultipleEventsListeners(e){for(const s in e)this.addEventListener(s,e[s])}removeEventListener(e,s,r){this.listeners[e]&&tr(this.listeners[e],n=>n.callback===s)}invokeListenerCallback(e,s,...r){let n,o;try{n=s.callback(...r)}catch(i){o=i}if(s.options?.once&&this.removeEventListener(e,s.callback),o)throw o;return n}_dispatchEvent(e,s,...r){this.reuseResults&&(this.listenerResults[e]=r);const n=s&&[],o=this.listeners[e];return o&&o.slice().forEach(c=>{if(o.findIndex(l=>l.callback===c.callback)===-1)return;const u=this.invokeListenerCallback(e,c,...r);n&&n.push(u)}),n}dispatchResultableEvent(e,...s){return this._dispatchEvent(e,!0,...s)}dispatchEvent(e,...s){this._dispatchEvent(e,!1,...s)}cleanup(){this.listeners={},this.listenerResults={}}}const G={test:location.search.indexOf("test=1")>0,debug:location.search.indexOf("debug=1")>0,http:!1,ssl:!0,multipleConnections:!0,asServiceWorker:!1,transport:"websocket",noSharedWorker:location.search.indexOf("noSharedWorker=1")>0};G.http=location.search.indexOf("http=1")>0;G.http=!0;G.http&&(G.transport="https");const sr=!1,X=G.debug,rr=typeof window<"u"?window:self,y=rr,es=Date.now()%Math.random()*1e8|0;function Xe(t,e){const s=t.indexOf(e);return(s===-1?void 0:t.splice(s,1))?.[0]}const Ce=typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope,We=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&!Ce,ce=We||Ce,nr=()=>self.clients.matchAll({includeUncontrolled:!1,type:"window"}),ts=(t,...e)=>{try{t.postMessage(...e)}catch(s){console.error("[worker] postMessage error:",s,e)}},ss=(t,...e)=>{nr().then(s=>{s.length&&s.slice(t?0:-1).forEach(r=>{ts(r,...e)})})},rs=(...t)=>{ts(self,...t)},ns=()=>{};Ce&&ss.bind(null,!1);Ce&&ss.bind(null,!0);const Je={};function Me(t){return Je[t]??(Je[t]={type:t})}const or=Date.now();function Re(){return"["+((Date.now()-or)/1e3).toFixed(3)+"]"}var Ft=(t=>(t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Log=4]="Log",t[t.Debug=8]="Debug",t))(Ft||{});const ir=[0,1,2,4,8],ar=j||ae,cr=!ar,Ot={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},ur=[["debug",8],["info",4],["warn",2],["error",1],["assert",1],["trace",4],["group",4],["groupCollapsed",4],["groupEnd",4]];function H(t,e=7,s=!1,r=""){let n;!X&&!s&&(e=1),cr?r||(Ce?r=Ot.fg.yellow:We&&(r=Ot.fg.cyan)):r="";const o=r;r?r=`%s ${r}%s`:r="%s";const i=function(...c){return e&4&&console.log(r,Re(),t,...c)};return ur.forEach(([c,a])=>{i[c]=function(...u){return e&a&&console[c](r,Re(),t,...u)}}),i.setPrefix=function(c){n=c,t="["+c+"]"},i.setPrefix(t),i.setLevel=function(c){e=ir.slice(0,c+1).reduce((a,u)=>a|u,0)},i.bindPrefix=function(c,a=e){return H(`${n}] [${c}`,a,s,o)},i}const lr=!0;class Et extends te{constructor(e){super(!1),this.logSuffix=e,this.onMessage=s=>{const r=s.data,n=s.source||s.currentTarget;this.processTaskMap[r.type](r,n,s)},this.processResultTask=s=>{const{taskId:r,result:n,error:o}=s.payload,i=this.awaiting[r];i&&(this.debug&&this.log.debug("done",i.taskType,n,o),"error"in s.payload?i.reject(o):i.resolve(n),delete this.awaiting[r])},this.processAckTask=s=>{const r=s.payload,n=this.awaiting[r.taskId];if(!n)return;const o=n.resolve,i={cached:r.cached,result:r.cached?"result"in r?Promise.resolve(r.result):Promise.reject(r.error):new Promise((c,a)=>{n.resolve=c,n.reject=a})};o(i),r.cached&&delete this.awaiting[r.taskId]},this.processPingTask=(s,r,n)=>{this.pushTask(this.createTask("pong",void 0),n.source)},this.processPongTask=(s,r,n)=>{const o=this.pingResolves.get(r);o&&(this.pingResolves.delete(r),o())},this.processCloseTask=(s,r,n)=>{this.detachPort(r)},this.processLockTask=(s,r,n)=>{const o=s.payload;this.requestedLocks.has(o)||(this.requestedLocks.set(o,r),navigator.locks.request(o,()=>{this.processCloseTask(void 0,r,void 0),this.requestedLocks.delete(o)}))},this.processInvokeTask=async(s,r,n)=>{const o=s.id,i=s.payload;let c,a,u;i.void||(c={taskId:o},a=this.createTask("result",c)),i.withAck&&(u=this.createTask("ack",{taskId:o,cached:!0}));let l;try{const m=this.listeners[i.type];if(!m?.length)throw new Error("no listener");const F=m[0];let f=this.invokeListenerCallback(i.type,F,i.payload,r,n);if(i.void)return;if(l=f instanceof Promise,u){const D=!l;if(u.payload.cached=D,D&&(u.payload.result=f),this.pushTask(u,r),D)return}l&&(f=await f),c.result=f}catch(m){if(this.log.error("worker task error:",m,s),i.void)return;if(u&&u.payload.cached){u.payload.error=m,this.pushTask(u,r);return}c.error=m}this.pushTask(a,r)},this.listenPorts=[],this.sendPorts=[],this.pingResolves=new Map,this.taskId=0,this.awaiting={},this.pending=new Map,this.log=H("MP"+(e?"-"+e:"")),this.debug=X,this.heldLocks=new Map,this.requestedLocks=new Map,this.processTaskMap={result:this.processResultTask,ack:this.processAckTask,invoke:this.processInvokeTask,ping:this.processPingTask,pong:this.processPongTask,close:this.processCloseTask,lock:this.processLockTask}}setOnPortDisconnect(e){this.onPortDisconnect=e}attachPort(e){this.attachListenPort(e),this.attachSendPort(e)}attachListenPort(e){this.listenPorts.push(e),e.addEventListener("message",this.onMessage)}attachSendPort(e){if(this.log.warn("attaching send port"),e.start?.(),this.sendPorts.push(e),typeof window<"u"&&lr)if("locks"in navigator){const s=["lock",es,this.logSuffix||"",Math.random()*2147483647|0].join("-");this.log.warn("created lock",s);const r=new Promise(n=>this.heldLocks.set(e,{resolve:n,id:s})).then(()=>this.heldLocks.delete(e));navigator.locks.request(s,()=>(this.resendLockTask(e),r))}else window.addEventListener("beforeunload",()=>{const s=this.createTask("close",void 0);this.postMessage(void 0,s)});this.releasePending()}resendLockTask(e){const s=this.heldLocks.get(e);s&&this.pushTask(this.createTask("lock",s.id),e)}detachPort(e){this.log.warn("disconnecting port"),Xe(this.listenPorts,e),Xe(this.sendPorts,e),e.removeEventListener?.("message",this.onMessage),e.close?.(),this.onPortDisconnect?.(e),this.heldLocks.get(e)?.resolve();const r=Me("PORT_DISCONNECTED");for(const n in this.awaiting){const o=this.awaiting[n];o.port===e&&(o.reject(r),delete this.awaiting[n])}}postMessage(e,s){(Array.isArray(e)?e:e?[e]:this.sendPorts).forEach(n=>{n.postMessage(s,s.transfer)})}releasePending(){this.releasingPending||(this.releasingPending=!0,this.debug&&this.log.debug("releasing tasks, length:",this.pending.size),this.pending.forEach((e,s)=>{const r=e,n=s?[s]:this.sendPorts;n.length&&(r.forEach(o=>{try{this.postMessage(n,o)}catch(i){this.log.error("postMessage error:",i,o,n)}}),this.pending.delete(s))}),this.debug&&this.log.debug("released tasks"),this.releasingPending=!1)}createTask(e,s,r){return{type:e,payload:s,id:this.taskId++,transfer:r}}createInvokeTask(e,s,r,n,o){return this.createTask("invoke",{type:e,payload:s,withAck:r,void:n},o)}pushTask(e,s){let r=this.pending.get(s);r||this.pending.set(s,r=[]),r.push(e),this.releasePending()}invokeVoid(e,s,r,n){const o=this.createInvokeTask(e,s,void 0,!0,n);this.pushTask(o,r)}invoke(e,s,r,n,o){this.debug&&this.log.debug("start",e,s);let i;const c=new Promise((a,u)=>{i=this.createInvokeTask(e,s,r,void 0,o),this.awaiting[i.id]={resolve:a,reject:u,taskType:e,port:n},this.pushTask(i,n)});if(ce){c.finally(()=>{clearInterval(a)});const a=mt.setInterval(()=>{this.log.error("task still has no result",i,n)},6e4)}return c}invokeExceptSource(e,s,r){const n=this.sendPorts.slice();Xe(n,r),n.forEach(o=>{this.invokeVoid(e,s,o)})}}class Se extends Et{constructor(){super("MTPROTO"),Se.INSTANCE=this,y&&(y.mtprotoMessagePort=this)}static getInstance(){return this.INSTANCE}}class hr extends te{constructor(){super(),this.myId=Xs,this.connectionStatus={},this.premium=!1,this.addEventListener("user_auth",({id:e})=>{this.myId=e.toPeerId()}),this.addEventListener("premium_toggle_private",({isNew:e,isPremium:s})=>{this.premium=s,this.dispatchEventSingle("premium_toggle",s)}),this.addEventListener("connection_status_change",e=>{this.connectionStatus[e.name]=e}),this.dispatchEvent=(e,...s)=>{super.dispatchEvent(e,...s),Se.getInstance().invokeVoid("event",{name:e,args:s})},ce||this.addEventListener("settings_updated",({settings:e})=>{this.settings=e})}getConnectionStatus(){return this.connectionStatus}getPremium(){return this.premium}dispatchEventSingle(...e){super.dispatchEvent(...e)}}const S=new hr;y.rootScope=S;function K(){const t={isFulfilled:!1,isRejected:!1,notify:()=>{},notifyAll:(...s)=>{t.lastNotify=s,t.listeners.forEach(r=>r(...s))},listeners:[],addNotifyListener:s=>{t.lastNotify&&s(...t.lastNotify),t.listeners.push(s)}},e=new Promise((s,r)=>{t.resolve=n=>{e.isFulfilled||e.isRejected||(e.isFulfilled=!0,s(n))},t.reject=(...n)=>{e.isRejected||e.isFulfilled||(e.isRejected=!0,r(...n))}});return e.catch(Fe).finally(()=>{e.notify=e.notifyAll=e.lastNotify=null,e.listeners.length=0,e.cancel&&(e.cancel=Fe)}),Object.assign(e,t),e}function Ze(t,e,s=!0){let r=null,n,o;return(...i)=>{n=!0,o=i,r||(s&&(n=!1,t(...o)),r=setInterval(()=>{if(!n){clearInterval(r),r=null;return}n=!1,t(...o)},e))}}function ut(t,e){if(e)for(const s in e)e[s]!==void 0&&(t[s]=e[s]);return t}const lt=class{constructor(t){ut(this,t),G.test&&(this.name+="_test"),this.storageIsAvailable=!0,this.log=H(["IDB",t.name].join("-")),this.log("constructor"),this.openDatabase(!0),lt.INSTANCES.push(this)}isAvailable(){return this.storageIsAvailable}openDatabase(t=!1){if(this.openDbPromise&&!t)return this.openDbPromise;const e=(o,i)=>{const c=Array.from(o.indexNames);for(const a of c)o.deleteIndex(a);if(i.indexes?.length)for(const a of i.indexes)o.indexNames.contains(a.indexName)||o.createIndex(a.indexName,a.keyPath,a.objectParameters)},s=(o,i)=>{const c=o.createObjectStore(i.name);e(c,i)};try{var r=indexedDB.open(this.name,this.version);if(!r)return Promise.reject()}catch(o){return this.log.error("error opening db",o.message),this.storageIsAvailable=!1,Promise.reject(o)}let n=!1;return setTimeout(()=>{n||r.onerror(Me("IDB_CREATE_TIMEOUT"))},3e3),this.openDbPromise=new Promise((o,i)=>{r.onsuccess=c=>{n=!0;const a=r.result;let u=!1;this.log("Opened"),a.onerror=l=>{this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",l),i(l)},a.onclose=l=>{this.log.error("closed:",l),!u&&this.openDatabase()},a.onabort=l=>{this.log.error("abort:",l);const m=l.target;this.openDatabase(u=!0),m.onerror&&m.onerror(l),a.close()},a.onversionchange=l=>{this.log.error("onversionchange, lol?")},o(this.db=a)},r.onerror=c=>{n=!0,this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",c),i(c)},r.onupgradeneeded=c=>{n=!0,this.log.warn("performing idb upgrade from",c.oldVersion,"to",c.newVersion);const a=c.target,u=a.result;this.stores.forEach(l=>{if(!u.objectStoreNames.contains(l.name))s(u,l);else{const F=a.transaction.objectStore(l.name);e(F,l)}})}})}static create(t){return this.INSTANCES.find(e=>e.name===t.name)??new lt(t)}static closeDatabases(t){this.INSTANCES.forEach(e=>{if(t&&t===e)return;const s=e.db;s&&(s.onclose=()=>{},s.close())})}};let os=lt;os.INSTANCES=[];class dr{constructor(e,s){this.storeName=s,this.log=H(["IDB",e.name,s].join("-")),this.idb=os.create(e)}delete(e,s){const r=Array.isArray(e);return r||(e=[].concat(e)),this.getObjectStore("readwrite",n=>{const o=e.map(i=>n.delete(i));return r?o:o[0]},"",s)}clear(e){return this.getObjectStore("readwrite",s=>s.clear(),"",e)}save(e,s,r){const n=Array.isArray(e);return n||(e=[].concat(e),s=[].concat(s)),this.getObjectStore("readwrite",o=>{const i=e.map((c,a)=>o.put(s[a],c));return n?i:i[0]},"",r)}get(e,s){const r=Array.isArray(e);if(r){if(!e.length)return Promise.resolve([])}else{if(!e)return;e=[].concat(e)}return this.getObjectStore("readonly",n=>{const o=e.map(i=>n.get(i));return r?o:o[0]},"",s)}getObjectStore(e,s,r,n=this.storeName){let o;return r&&(o=performance.now(),this.log(r+": start")),this.idb.openDatabase().then(i=>new Promise((c,a)=>{const u=i.transaction([n],e),l=()=>{clearTimeout(f),a(u.error)},m=()=>{clearTimeout(f),r&&this.log(r+": end",performance.now()-o);const I=v.map(W=>W.result);c(E?I:I[0])};u.onerror=l;const F=e==="readwrite";F&&(u.oncomplete=()=>m());const f=setTimeout(()=>{this.log.error("transaction not finished",u,r)},1e4),D=s(u.objectStore(n)),E=Array.isArray(D),v=E?D:[].concat(D);if(F)return;const k=v.length;let L=k;const Y=()=>{u.error||--L||m()};for(let I=0;I<k;++I){const W=v[I];W.onerror=l,W.onsuccess=Y}}))}getAll(e){return this.getObjectStore("readonly",s=>s.getAll(),"",e)}}function Bt(){}const Qe=16,Ae=class{constructor(t,e){this.db=t,this.storeName=e,this.cache={},this.getPromises=new Map,this.keysToSet=new Set,this.saveDeferred=K(),this.keysToDelete=new Set,this.deleteDeferred=K(),this.storage=new dr(t,e),Ae.STORAGES.length?this.useStorage=Ae.STORAGES[0].useStorage:this.useStorage=!0,this.savingFreezed=!1,Ae.STORAGES.push(this),this.saveThrottled=Ze(async()=>{const s=this.saveDeferred;this.saveDeferred=K();const r=this.keysToSet;if(r.size){const n=Array.from(r.values());r.clear();const o=n.map(i=>this.cache[i]);try{await this.storage.save(n,o)}catch(i){console.error("[AS]: set error:",i,n,o)}}s.resolve(),r.size&&this.saveThrottled()},Qe,!1),this.deleteThrottled=Ze(async()=>{const s=this.deleteDeferred;this.deleteDeferred=K();const r=this.keysToDelete;if(r.size){const n=Array.from(r.values());r.clear();try{await this.storage.delete(n)}catch(o){console.error("[AS]: delete error:",o,n)}}s.resolve(),r.size&&this.deleteThrottled()},Qe,!1),this.getThrottled=Ze(async()=>{const s=Array.from(this.getPromises.keys());this.storage.get(s).then(r=>{for(let n=0,o=s.length;n<o;++n){const i=s[n],c=this.getPromises.get(i);c&&(c.resolve(this.cache[i]=r[n]),this.getPromises.delete(i))}},r=>{new Set(["NO_ENTRY_FOUND","STORAGE_OFFLINE"]).has(r.type)||(this.useStorage=!1,console.error("[AS]: get error:",r,s,e));for(let o=0,i=s.length;o<i;++o){const c=s[o],a=this.getPromises.get(c);a&&(a.resolve(void 0),this.getPromises.delete(c))}}).finally(()=>{this.getPromises.size&&this.getThrottled()})},Qe,!1)}isAvailable(){return this.useStorage}getCache(){return this.cache}getFromCache(t){return this.cache[t]}setToCache(t,e){return this.cache[t]=e}async get(t,e=!0){if(this.cache.hasOwnProperty(t)&&e)return this.getFromCache(t);if(this.useStorage){const s=this.getPromises.get(t);if(s)return s;const r=K();return this.getPromises.set(t,r),this.getThrottled(),r}}getAll(){return this.storage.getAll().catch(()=>[])}set(t,e=!1){const s=this.useStorage&&!e&&!this.savingFreezed;for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];this.setToCache(r,n),s&&(this.keysToSet.add(r),this.keysToDelete.delete(r),this.saveThrottled())}return s?this.saveDeferred:Promise.resolve()}delete(t,e=!1){return t=""+t,e||delete this.cache[t],this.useStorage&&(this.keysToSet.delete(t),this.keysToDelete.add(t),this.deleteThrottled()),this.useStorage?this.deleteDeferred:Promise.resolve()}clear(t=!1){if(!t)for(const e in this.cache)delete this.cache[e];return this.storage.clear().catch(Bt)}static toggleStorage(t,e){return Promise.all(this.STORAGES.map(s=>{if(s.useStorage=t,!(!ce||!e))return t?s.set(s.cache):(s.keysToSet.clear(),s.keysToDelete.clear(),s.getPromises.forEach(r=>r.resolve(void 0)),s.getPromises.clear(),s.clear(!0))})).catch(Bt)}static freezeSaving(t,e){this.STORAGES.forEach(s=>s.savingFreezed=!0);try{t()}catch(s){console.error("freezeSaving callback error:",s)}this.STORAGES.forEach(s=>s.savingFreezed=!1)}};let Ve=Ae;Ve.STORAGES=[];y&&(y.AppStorage=Ve);const Dr={name:"tweb",version:7,stores:[{name:"session"},{name:"stickerSets"},{name:"users"},{name:"chats"},{name:"dialogs"},{name:"messages"}]};class gr extends Ve{constructor(){super(Dr,"session")}}const oe=new gr;y.stateStorage=oe;function is(t,e){const s=Object.keys,r=typeof t;return t&&e&&r==="object"&&r===typeof e?s(t).length===s(e).length&&s(t).every(o=>is(t[o],e[o])):t===e}function Ge(t){return t.charAt(0).toUpperCase()+t.slice(1)}const fr=new Set(["javascript:"]);function as(t){if(!t)return null;try{const e=new URL(t).protocol;return fr.has(e)?null:e}catch{return null}}const mr="((?:👨🏻‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👨🏼‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👨🏽‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👨🏾‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👨🏿‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏻‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏻‍❤️?‍💋‍👩\uD83C[\uDFFB-\uDFFF]|👩🏼‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏼‍❤️?‍💋‍👩\uD83C[\uDFFB-\uDFFF]|👩🏽‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏽‍❤️?‍💋‍👩\uD83C[\uDFFB-\uDFFF]|👩🏾‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏾‍❤️?‍💋‍👩\uD83C[\uDFFB-\uDFFF]|👩🏿‍❤️?‍💋‍👨\uD83C[\uDFFB-\uDFFF]|👩🏿‍❤️?‍💋‍👩\uD83C[\uDFFB-\uDFFF]|🧑🏻‍❤️?‍💋‍🧑\uD83C[\uDFFC-\uDFFF]|🧑🏼‍❤️?‍💋‍🧑\uD83C[\uDFFB\uDFFD-\uDFFF]|🧑🏽‍❤️?‍💋‍🧑\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🧑🏾‍❤️?‍💋‍🧑\uD83C[\uDFFB-\uDFFD\uDFFF]|🧑🏿‍❤️?‍💋‍🧑\uD83C[\uDFFB-\uDFFE]|👨🏻‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👨🏻‍🤝‍👨\uD83C[\uDFFC-\uDFFF]|👨🏼‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👨🏼‍🤝‍👨\uD83C[\uDFFB\uDFFD-\uDFFF]|👨🏽‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👨🏽‍🤝‍👨\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👨🏾‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👨🏾‍🤝‍👨\uD83C[\uDFFB-\uDFFD\uDFFF]|👨🏿‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👨🏿‍🤝‍👨\uD83C[\uDFFB-\uDFFE]|👩🏻‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👩🏻‍❤️?‍👩\uD83C[\uDFFB-\uDFFF]|👩🏻‍🤝‍👨\uD83C[\uDFFC-\uDFFF]|👩🏻‍🤝‍👩\uD83C[\uDFFC-\uDFFF]|👩🏼‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👩🏼‍❤️?‍👩\uD83C[\uDFFB-\uDFFF]|👩🏼‍🤝‍👨\uD83C[\uDFFB\uDFFD-\uDFFF]|👩🏼‍🤝‍👩\uD83C[\uDFFB\uDFFD-\uDFFF]|👩🏽‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👩🏽‍❤️?‍👩\uD83C[\uDFFB-\uDFFF]|👩🏽‍🤝‍👨\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👩🏽‍🤝‍👩\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👩🏾‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👩🏾‍❤️?‍👩\uD83C[\uDFFB-\uDFFF]|👩🏾‍🤝‍👨\uD83C[\uDFFB-\uDFFD\uDFFF]|👩🏾‍🤝‍👩\uD83C[\uDFFB-\uDFFD\uDFFF]|👩🏿‍❤️?‍👨\uD83C[\uDFFB-\uDFFF]|👩🏿‍❤️?‍👩\uD83C[\uDFFB-\uDFFF]|👩🏿‍🤝‍👨\uD83C[\uDFFB-\uDFFE]|👩🏿‍🤝‍👩\uD83C[\uDFFB-\uDFFE]|🧑🏻‍❤️?‍🧑\uD83C[\uDFFC-\uDFFF]|🧑🏻‍🤝‍🧑\uD83C[\uDFFB-\uDFFF]|🧑🏼‍❤️?‍🧑\uD83C[\uDFFB\uDFFD-\uDFFF]|🧑🏼‍🤝‍🧑\uD83C[\uDFFB-\uDFFF]|🧑🏽‍❤️?‍🧑\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🧑🏽‍🤝‍🧑\uD83C[\uDFFB-\uDFFF]|🧑🏾‍❤️?‍🧑\uD83C[\uDFFB-\uDFFD\uDFFF]|🧑🏾‍🤝‍🧑\uD83C[\uDFFB-\uDFFF]|🧑🏿‍❤️?‍🧑\uD83C[\uDFFB-\uDFFE]|🧑🏿‍🤝‍🧑\uD83C[\uDFFB-\uDFFF]|👨‍❤️?‍💋‍👨|👩‍❤️?‍💋‍\uD83D[\uDC68\uDC69]|🫱🏻‍🫲\uD83C[\uDFFC-\uDFFF]|🫱🏼‍🫲\uD83C[\uDFFB\uDFFD-\uDFFF]|🫱🏽‍🫲\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🫱🏾‍🫲\uD83C[\uDFFB-\uDFFD\uDFFF]|🫱🏿‍🫲\uD83C[\uDFFB-\uDFFE]|👨‍❤️?‍👨|👩‍❤️?‍\uD83D[\uDC68\uDC69]|🧑‍🤝‍🧑|👫\uD83C[\uDFFB-\uDFFF]|👬\uD83C[\uDFFB-\uDFFF]|👭\uD83C[\uDFFB-\uDFFF]|💏\uD83C[\uDFFB-\uDFFF]|💑\uD83C[\uDFFB-\uDFFF]|🤝\uD83C[\uDFFB-\uDFFF]|\uD83D[\uDC6B-\uDC6D\uDC8F\uDC91]|🤝)|(?:\uD83D[\uDC68\uDC69]|🧑)(?:\uD83C[\uDFFB-\uDFFF])?‍(?:⚕️?|⚖️?|✈️?|\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]|⛹)(?:(?:\uD83C[\uDFFB-\uDFFF]|️?)‍[♀♂]️?)|(?:\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\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?‍[♀♂]️?|(?:👨‍👨‍👦‍👦|👨‍👨‍👧‍\uD83D[\uDC66\uDC67]|👨‍👩‍👦‍👦|👨‍👩‍👧‍\uD83D[\uDC66\uDC67]|👩‍👩‍👦‍👦|👩‍👩‍👧‍\uD83D[\uDC66\uDC67]|👨‍👦‍👦|👨‍👧‍\uD83D[\uDC66\uDC67]|👨‍👨‍\uD83D[\uDC66\uDC67]|👨‍👩‍\uD83D[\uDC66\uDC67]|👩‍👦‍👦|👩‍👧‍\uD83D[\uDC66\uDC67]|👩‍👩‍\uD83D[\uDC66\uDC67]|🏳️?‍⚧️?|🏳️?‍🌈|😶‍🌫️?|❤️?‍🔥|❤️?‍🩹|🏴‍☠️?|🐕‍🦺|🐻‍❄️?|👁‍🗨|👨‍\uD83D[\uDC66\uDC67]|👩‍\uD83D[\uDC66\uDC67]|👯‍♀️?|👯‍♂️?|😮‍💨|😵‍💫|🤼‍♀️?|🤼‍♂️?|🧞‍♀️?|🧞‍♂️?|🧟‍♀️?|🧟‍♂️?|🐈‍⬛)|[#*0-9]️??⃣|(?:[©®™♟]️?)|(?:\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]|[‼⁉ℹ↔-↙↩↪⌚⌛⌨⏏⏭-⏯⏱⏲⏸-⏺Ⓜ▪▫▶◀◻-◾☀-☄☎☑☔☕☘☠☢☣☦☪☮☯☸-☺♀♂♈-♓♠♣♥♦♨♻♿⚒-⚗⚙⚛⚜⚠⚡⚧⚪⚫⚰⚱⚽⚾⛄⛅⛈⛏⛑⛓⛔⛩⛪⛰-⛵⛸⛺⛽✂✈✉✏✒✔✖✝✡✳✴❄❇❗❣❤➡⤴⤵⬅-⬇⬛⬜⭐⭕〰〽㊗㊙])(?:️?|(?!︎))|(?:(?:\uD83C[\uDFCB\uDFCC]|\uD83D[\uDD74\uDD75\uDD90]|[☝⛷⛹✌✍])(?:️?|(?!︎))|(?:\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\uDEC3-\uDEC5\uDEF0-\uDEF6]|[✊✋]))(?:\uD83C[\uDFFB-\uDFFF])?|(?:🏴󠁧󠁢󠁥󠁮󠁧󠁿|🏴󠁧󠁢󠁳󠁣󠁴󠁿|🏴󠁧󠁢󠁷󠁬󠁳󠁿|🇦\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|🇧\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|🇨\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|🇩\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|🇪\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|🇫\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|🇬\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|🇭\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|🇮\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|🇯\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|🇰\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|🇱\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|🇲\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|🇳\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|🇴🇲|🇵\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|🇶🇦|🇷\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|🇸\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|🇹\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|🇺\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|🇻\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|🇼\uD83C[\uDDEB\uDDF8]|🇽🇰|🇾\uD83C[\uDDEA\uDDF9]|🇿\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-\uDC8E\uDC90\uDC92-\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\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3C\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDDE-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]|[⏩-⏬⏰⏳♾⛎✅✨❌❎❓-❕➕-➗➰➿])|️)",pe="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",pr="0-9_"+pe,xt="·",_e="["+pe+"0-9]",Fr="((?:https?|ftp)://|mailto:)?",Er=Fr+"(?:"+_e+"{1,64}(?::"+_e+"{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}|"+_e+"["+pe+xt+"0-9-]{0,64}(?:\\."+_e+"["+pe+xt+"0-9-]{0,64}){0,10}(?:\\.(xn--[0-9a-z]{2,16}|["+pe+`]{2,24})))(?::\\d{2,5})?(?:/(?:\\S{0,255}[^\\s.;,(\\[\\]{}<>"'])?)?`,cs="[a-zA-Z\\d_]{5,32}",vr="(?:\\s|^)((?:\\d{1,2}:)?(?:[0-5]?[0-9]):(?:[0-5][0-9]))(?:\\s|$)",Cr="\\/([a-zA-Z\\d_]{1,32})(?:@("+cs+"))?(\\b|$)",To=new RegExp("(^| )(@)("+cs+")|("+Er+")|(\\n)|("+mr+")|(^|[\\s\\(\\]])(#["+pr+"]{2,64})|(^|\\s)"+Cr+"|"+vr,"i"),Lo=/^(([^<>()[\]\\.,;:\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,}))$/,Io=/(^|\s|\n)(````?)([\s\S]+?)(````?)([\s\n\.,:?!;]|$)|(^|\s|\x01)(`|~~|\*\*|__|_-_|\|\|)([^\n]+?)\7([\x01\s\.,:?!;]|$)|@(\d+)\s*\((.+?)\)|(\[(.+?)\]\((.+?)\))/m,Mo={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}"},ht={"`":"messageEntityCode","``":"messageEntityPre","**":"messageEntityBold",__:"messageEntityItalic","~~":"messageEntityStrike","_-_":"messageEntityUnderline","||":"messageEntitySpoiler"};new Set(Object.values(ht));const us=new Set(["messageEntityEmoji","messageEntityLinebreak","messageEntityCaret"]),Ro=new Set(us);for(const t in ht)us.add(ht[t]);const Sr=/^\+\d+$/;function ls(t,e){as(t)||(t="https://"+t);const s={url:t};let r,n,o;if(r=t.match(/^(?:https?:\/\/)?(?:(.+?)\.)?(?:(?:web|k|z|a)\.)?t(?:elegram)?\.me(?:\/(.+))?/)){const i=new URL(t);let c=r[1];c&&Js.has(r[1])&&(c=void 0),c&&(i.pathname=c+(i.pathname==="/"?"":i.pathname));const a=i.pathname.slice(1),u=a.split("/");if(u[0]&&u[0][0]==="$"&&u[0].length>1)o="invoice";else if(/^\+/.test(a)&&!Sr.test(a))o="joinchat";else if(u[0])switch(u[0]){case"addlist":case"joinchat":case"addstickers":case"addemoji":case"voicechat":case"invoice":if(u.length!==1&&!c){o=u[0];break}default:if(u.length<=2||u[1]?.match(/^\d+(?:\?(?:comment|thread)=\d+)?$/)){o="im";break}break}}else t.match(/^(?:https?:\/\/)?telesco\.pe\/([^/?]+)\/(\d+)/)?o="im":(n=t.match(/tg:(?:\/\/)?(.+?)(?:\?|$)/))&&(o="tg_"+n[1]);return window[o]||(o=void 0),s.onclick=o,s}y&&(y.wrapUrl=ls);function Oo(t,e){hs(t),e===void 0?t.replaceChildren():typeof e=="string"?e?t.textContent=e:t.replaceChildren():t.replaceChildren(e)}function hs(t){t.setAttribute("dir","auto")}const Bo={messageActionChatCreate:"ActionCreateGroup",messageActionChatCreateYou:"ActionYouCreateGroup",messageActionChatEditTitle:"ActionChangedTitle",messageActionChatEditPhoto:"ActionChangedPhoto",messageActionChatEditVideo:"ActionChangedVideo",messageActionChatDeletePhoto:"ActionRemovedPhoto",messageActionChatReturn:"ActionAddUserSelf",messageActionChatReturnYou:"ActionAddUserSelfYou",messageActionChatJoined:"ActionAddUserSelfMega",messageActionChatJoinedYou:"ChannelMegaJoined",messageActionChatAddUser:"ActionAddUser",messageActionChatAddUsers:"ActionAddUser",messageActionChatLeave:"ActionLeftUser",messageActionChatLeaveYou:"YouLeft",messageActionChatDeleteUser:"ActionKickUser",messageActionChatJoinedByLink:"ActionInviteUser",messageActionPinMessage:"Chat.Service.Group.UpdatedPinnedMessage",messageActionContactSignUp:"Chat.Service.PeerJoinedTelegram",messageActionChannelCreate:"ActionCreateChannel",messageActionChannelEditTitle:"Chat.Service.Channel.UpdatedTitle",messageActionChannelEditPhoto:"Chat.Service.Channel.UpdatedPhoto",messageActionChannelEditVideo:"Chat.Service.Channel.UpdatedVideo",messageActionChannelDeletePhoto:"Chat.Service.Channel.RemovedPhoto",messageActionHistoryClear:"HistoryCleared",messageActionDiscussionStarted:"DiscussionStarted",messageActionChannelMigrateFrom:"ActionMigrateFromGroup","messageActionPhoneCall.video_in_ok":"ChatList.Service.VideoCall.incoming","messageActionPhoneCall.video_out_ok":"ChatList.Service.VideoCall.outgoing","messageActionPhoneCall.video_missed":"ChatList.Service.VideoCall.Missed","messageActionPhoneCall.video_cancelled":"ChatList.Service.VideoCall.Cancelled","messageActionPhoneCall.in_ok":"ChatList.Service.Call.incoming","messageActionPhoneCall.out_ok":"ChatList.Service.Call.outgoing","messageActionPhoneCall.missed":"ChatList.Service.Call.Missed","messageActionPhoneCall.cancelled":"ChatList.Service.Call.Cancelled","messageActionGroupCall.started":"Chat.Service.VoiceChatStarted.Channel","messageActionGroupCall.started_by":"Chat.Service.VoiceChatStarted","messageActionGroupCall.started_byYou":"Chat.Service.VoiceChatStartedYou","messageActionGroupCall.ended":"Chat.Service.VoiceChatFinished.Channel","messageActionGroupCall.ended_by":"Chat.Service.VoiceChatFinished","messageActionGroupCall.ended_byYou":"Chat.Service.VoiceChatFinishedYou",messageActionBotAllowed:"Chat.Service.BotPermissionAllowed"},xo=ee?"Message.Unsupported.Mobile":"Message.Unsupported.Desktop";var J;(t=>{t.strings=new Map,t.countriesList=[];let e,s;t.requestedServerLanguage=!1,t.isRTL=!1;function r(h){t.isRTL=h}t.setRTL=r;function n(h){t.lastRequestedLangCode=h,t.lastRequestedNormalizedLangCode=h.split("-")[0]}function o(){return s||(s=Promise.all([oe.get("langPack"),t.polyfillPromise]).then(([h])=>h?(t.lastRequestedLangCode||n(h.lang_code),D(h),h):a()).finally(()=>{s=void 0}))}t.getCacheLangPack=o;function i(){if(t.timeFormat==="h12")try{const h=W({hour:"numeric",minute:"numeric",hour12:!0}),g=new Date;g.setHours(0);const p=h.format(g);t.amPmCache.am=p.split(/\s/)[1],g.setHours(12);const d=h.format(g);t.amPmCache.pm=d.split(/\s/)[1]}catch(h){console.error("cannot get am/pm",h),t.amPmCache={am:"AM",pm:"PM"}}}function c(h,g=!!t.timeFormat&&t.timeFormat!==h){t.timeFormat=h,i(),g&&(I.clear(),Array.from(document.querySelectorAll(".i18n")).forEach(d=>{const P=t.weakMap.get(d);P instanceof C&&P.update()}))}t.setTimeFormat=c;function a(){const h=A.langPackCode;return n(h),Promise.all([R(()=>import("./lang-c1c2a466.js"),[],import.meta.url),R(()=>import("./langSign-f5a5610c.js"),[],import.meta.url),R(()=>import("./countries-5301fc59.js"),[],import.meta.url)]).then(([g,p,d])=>{const P=[];m(g.default,P),m(p.default,P);const V={_:"langPackDifference",from_version:0,lang_code:h,strings:P,version:0,local:!0,countries:d.default};return f(V)})}t.loadLocalLangPack=a;function u(h,g){g=!0,t.requestedServerLanguage=!0;const p=S.managers;return Promise.all([p.apiManager.invokeApiCacheable("langpack.getLangPack",{lang_code:h,lang_pack:g?"web":A.langPack}),!g&&p.apiManager.invokeApiCacheable("langpack.getLangPack",{lang_code:h,lang_pack:"android"}),R(()=>import("./lang-c1c2a466.js"),[],import.meta.url),R(()=>import("./langSign-f5a5610c.js"),[],import.meta.url),p.apiManager.invokeApiCacheable("help.getCountriesList",{lang_code:h,hash:0}),t.polyfillPromise])}t.loadLangPack=u;function l(h,g){return S.managers.apiManager.invokeApi("langpack.getStrings",{lang_pack:A.langPack,lang_code:"ru",keys:g})}t.getStrings=l;function m(h,g=[]){for(const p in h){const d=h[p];typeof d=="string"?g.push({_:"langPackString",key:p,value:d}):g.push({_:"langPackStringPluralized",key:p,...d})}return g}t.formatLocalStrings=m;function F(h,g){return n(h),u(h,g).then(([p,d,P,V,U,ue])=>{let se=[];return[P,V].forEach(ze=>{m(ze.default,se)}),se=se.concat(...[p.strings,d.strings].filter(Boolean)),p.strings=se,p.countries=U,f(p)})}t.getLangPack=F;function f(h){return h.appVersion=A.langPackVersion,oe.set({langPack:h}).then(()=>(D(h),h))}t.saveLangPack=f,t.polyfillPromise=function(){return typeof Intl<"u"&&typeof Intl.PluralRules<"u"?Promise.resolve():R(()=>import("./pluralPolyfill-61f068d6.js"),[],import.meta.url).then(g=>{window.Intl=Object.assign(typeof Intl<"u"?Intl:{},g.default)})}();function D(h){const g=t.lastRequestedLangCode;if(h.lang_code!==g)return;try{e=new Intl.PluralRules(t.lastRequestedNormalizedLangCode)}catch(d){console.error("pluralRules error",d),e=new Intl.PluralRules(t.lastRequestedNormalizedLangCode.split("-",1)[0])}try{e=new Intl.PluralRules(h.lang_code)}catch(d){console.error("pluralRules error",d),e=new Intl.PluralRules(h.lang_code.split("-",1)[0])}t.strings.clear();for(const d of h.strings)t.strings.set(d.key,d);h.countries&&(t.countriesList.length=0,t.countriesList.push(...h.countries.countries),h.countries.countries.forEach(d=>{if(d.name){const P=d.default_name;t.strings.set(P,{_:"langPackString",key:P,value:d.name})}})),t.lastAppliedLangCode!==g&&(t.lastAppliedLangCode&&S.myId&&(S.managers.appReactionsManager.resetAvailableReactions(),S.managers.appUsersManager.indexMyself(),S.managers.dialogsStorage.indexMyDialog()),t.lastAppliedLangCode=g,I.clear(),i(),S.dispatchEvent("language_change",g)),Array.from(document.querySelectorAll(".i18n")).forEach(d=>{const P=t.weakMap.get(d);P&&P.update()})}t.applyLangPack=D;function E(h,g,p){const d=g[p.i++];Array.isArray(d)?h.push(...d):h.push(d)}function v(h,g,p={i:0}){const d=[],P=/(\*\*|__)(.+?)\1|(\n)|(\[.+?\]\(.*?\))|un\d|%\d\$.|%./g;let V=0;return h.replace(P,(U,ue,se,ze,le,Pt,Ns)=>{if(d.push(Ns.slice(V,Pt)),ue){let Z;switch(ue){case"**":{Z=document.createElement("b");break}case"__":{Z=document.createElement("i");break}}Z.append(...v(se,g,p)),d.push(Z)}else if(ze)d.push(document.createElement("br"));else if(le){const Z=le.lastIndexOf("]"),Us=le.slice(1,Z),je=le.slice(Z+2,le.length-1);let x;if(je&&as(je)){x=document.createElement("a");const He=ls(je);x.href=He.url,He.onclick&&x.setAttribute("onclick",He.onclick+"(this)"),x.target="_blank"}else x=g[p.i++],x instanceof DocumentFragment&&(x=x.firstChild),typeof x!="string"&&(x.textContent="");const At=v(Us,g,p);typeof x=="string"?d.push(...At):(x.append(...At),d.push(x))}else g&&E(d,g,p);return V=Pt+U.length,""}),V!==h.length&&d.push(h.slice(V)),d}t.superFormatter=v;function k(h,g=!1,p){const d=t.strings.get(h);let P;if(d)if(d._==="langPackStringPluralized"&&p?.length){let U=p[0];typeof U=="string"&&(U=+U.replace(/\D/g,""));const ue=e.select(U);P=d[ue+"_value"]||d.other_value}else d._==="langPackString"?P=d.value:P=h;else P=h;const V=v(P,p);return g?V.map(U=>U instanceof Node?U.textContent:U).join(""):V}t.format=k,t.weakMap=new WeakMap;class L{constructor(g){this.element=g?.element||document.createElement("span"),this.element.classList.add("i18n"),this.property=g?.property,t.weakMap.set(this.element,this)}}class Y extends L{constructor(g={}){super({...g,property:g.property??"innerHTML"}),g?.key&&this.update(g)}update(g){if(ut(this,g),this.property==="innerHTML")this.element.textContent="",this.element.append(...k(this.key,!1,this.args));else{const p=this.element[this.property],d=k(this.key,!0,this.args);p===void 0?this.element.dataset[this.property]=d:this.element[this.property]=d}}compareAndUpdate(g){if(!(this.key===g.key&&is(this.args,g.args)))return this.update(g)}}t.IntlElement=Y;const I=new Map;function W(h={}){const g=JSON.stringify(h);let p=I.get(g);return p||(p=new Intl.DateTimeFormat(t.lastRequestedNormalizedLangCode+"-u-hc-"+t.timeFormat,h),I.set(g,p)),p}t.getDateTimeFormat=W,t.amPmCache={am:"AM",pm:"PM"};class C extends L{constructor(g){super({...g,property:g.property??"textContent"}),hs(this.element),g?.date&&this.update(g)}update(g){ut(this,g);let p;if(this.options.hour&&this.options.minute&&Object.keys(this.options).length===2){const d=this.date.getHours();p=("0"+(t.timeFormat==="h12"?d%12||12:d)).slice(-2)+":"+("0"+this.date.getMinutes()).slice(-2),t.timeFormat==="h12"&&(p+=" "+(d<12?t.amPmCache.am:t.amPmCache.pm))}else{const d=W(this.options);p=Ge(d.format(this.date))}this.element[this.property]=p}}t.IntlDateElement=C;function M(h,g){return new Y({key:h,args:g}).element}t.i18n=M;function b(h){return new Y(h).element}t.i18n_=b;function _(h,g,p,d){return new Y({element:h,key:g,args:p,property:d}).element}t._i18n=_})(J||(J={}));const B=J,Oe=J.i18n,No=J.i18n_,Uo=J._i18n;function _r(t,e){const s=t.slice(0,1);for(let r=1;r<t.length;++r){const n=t.length-1===r;s.push(typeof e=="function"?e(n):e),s.push(t[r])}return s}function Wo(t,e=!0,s){const r=_r(t,n=>{const o=n&&e?"AutoDownloadSettings.LastDelimeter":"AutoDownloadSettings.Delimeter";return s?J.format(o,!0):Oe(o)});return s?r.join(""):r}y&&(y.I18n=J);function yr(t){return+t<0}function wr(t){return+t>=0}String.prototype.toUserId=function(){return(+this).toUserId()};String.prototype.toChatId=function(){return(+this).toChatId()};String.prototype.toPeerId=function(t){return(+this).toPeerId(t)};String.prototype.isPeerId=function(){return/^[\d-]/.test(this.toString())};Number.prototype.toUserId=function(){return+this};Number.prototype.toChatId=function(){return Math.abs(this)};Number.prototype.toPeerId=function(t){return t===void 0?+this:t?-Math.abs(this):+this};Number.prototype.isPeerId=function(){return!0};[["isUser",wr],["isAnyChat",yr]].forEach(t=>{const e=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:t;String.prototype[e]=function(){return s.call(null,this.toString())},Number.prototype[e]=function(){return s.call(null,+this)}});function kr(...t){const e=t.reduce((n,o)=>n+(o.byteLength||o.length),0),s=new Uint8Array(e);let r=0;return t.forEach(n=>{s.set(n instanceof ArrayBuffer?new Uint8Array(n):n,r),r+=n.byteLength||n.length}),s}Uint8Array.prototype.concat=function(...t){return kr(this,...t)};Uint8Array.prototype.toJSON=function(){return[...this]};Promise.prototype.finally=Promise.prototype.finally||function(t){const e=s=>Promise.resolve(t()).then(s);return this.then(s=>e(()=>s),s=>e(()=>Promise.reject(s)))};class Pr{constructor(){this.convertPromises={}}init(){this.worker=new Worker(new URL(""+new URL("webp.worker-895c8b50.js",import.meta.url).href,self.location)),this.worker.addEventListener("message",e=>{const r=e.data.payload,n=this.convertPromises[r.fileName];n&&(r.bytes?n.resolve(r.bytes):n.reject(),delete this.convertPromises[r.fileName])})}postMessage(e){this.init&&(this.init(),this.init=null),this.worker.postMessage(e)}convert(e,s){if(this.convertPromises.hasOwnProperty(e))return this.convertPromises[e];const r=K();return this.postMessage({type:"convertWebp",payload:{fileName:e,bytes:s}}),this.convertPromises[e]=r}}const ds=new Pr;y.webpWorkerController=ds;class Ar{constructor(){this.prefix="",this.cache={},this.useStorage=!0,G.test&&(this.prefix="t_")}get(e,s=!0){if(this.cache.hasOwnProperty(e)&&s)return this.cache[e];if(this.useStorage){let r;try{r=localStorage.getItem(this.prefix+e)}catch{this.useStorage=!1}if(r!==null)try{r=JSON.parse(r)}catch{}else r=void 0;return r}}set(e,s=!1){for(const r in e)if(e.hasOwnProperty(r)){const n=e[r];if(this.cache[r]=n,this.useStorage&&!s)try{const o=JSON.stringify(n);localStorage.setItem(this.prefix+r,o)}catch{this.useStorage=!1}}}delete(e,s=!1){e=""+e,s||delete this.cache[e];try{localStorage.removeItem(this.prefix+e)}catch{}}clear(){const e=["dc","server_time_offset","xt_instance","user_auth","state_id","k_build"];for(let s=1;s<=5;++s)e.push(`dc${s}_server_salt`),e.push(`dc${s}_auth_key`);for(const s of e)this.delete(s,!0)}toggleStorage(e,s){if(this.useStorage=e,!!s)if(!e)this.clear();else return this.set(this.cache)}}const Ds=class{constructor(){Ds.STORAGES.push(this),ce||(this.storage=new Ar)}async proxy(t,...e){return ce?Se.getInstance().invoke("localStorageProxy",{type:t,args:e}):(e=Array.prototype.slice.call(e),this.storage[t].apply(this.storage,e))}get(t,e){return this.proxy("get",t,e)}set(t,e){return this.proxy("set",t,e)}delete(t,e){return this.proxy("delete",t,e)}clear(){return this.proxy("clear")}toggleStorage(t,e){return this.proxy("toggleStorage",t,e)}};let gs=Ds;gs.STORAGES=[];const T=new gs;y.appStorage=T;class br{reload(){try{location.reload()}catch{}}close(){try{window.close()}catch{}}focus(){window.focus()}}const fs=new br;function O(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t))return t.map(n=>O(n));if(ArrayBuffer.isView(t))return t.slice();const e=new t.constructor;for(var s in t)t.hasOwnProperty(s)&&(e[s]=O(t[s]));return e}const Be=typeof SharedWorker<"u"&&!G.noSharedWorker,Tr=Q?"touchstart":"mousemove";class Lr extends te{constructor(){super(),this._isIdle=!0,this.focusPromise=Promise.resolve(),this.focusResolve=()=>{},window.addEventListener("blur",()=>{this.isIdle=!0,window.addEventListener("focus",()=>{this.isIdle=!1},{once:!0})}),window.addEventListener(Tr,()=>{this.isIdle=!1},{once:!0,passive:!0}),this.addEventListener("change",e=>{e?this.focusPromise=new Promise(s=>{this.focusResolve=s}):this.focusResolve()})}getFocusPromise(){return this.focusPromise}get isIdle(){return this._isIdle}set isIdle(e){this._isIdle!==e&&(this._isIdle=e,this.dispatchEvent("change",e))}}const xe=new Lr,Ir=5e3,Mr=3e4,Rr=2e4,Or=Be;class Br extends te{constructor(){super(!1),this.log=H("INSTANCE"),this.clearInstance=()=>{this.masterInstance&&!this.deactivated&&(this.log.warn("clear master instance"),T.delete("xt_instance"))},this.checkInstance=async(e=xe.isIdle)=>{if(this.deactivated)return;const s=Date.now(),r={id:this.instanceId,idle:e,time:s},[n,o=A.build]=await Promise.all([T.get("xt_instance",!1),T.get("k_build",!1)]);if(o>A.build){this.masterInstance=!1,S.managers.networkerFactory.stopAll(),this.deactivateInstance("version"),Ye.toggleStorages(!1,!1);return}else if(Or){T.set({xt_instance:r});return}!e||!n||n.id===this.instanceId||n.time<s-Rr?(T.set({xt_instance:r}),this.masterInstance||(this.masterInstance=!0,S.managers.networkerFactory.startAll(),this.log.warn("now master instance",r)),this.clearDeactivateTimeout()):this.masterInstance&&(this.masterInstance=!1,S.managers.networkerFactory.stopAll(),this.log.warn("now idle instance",r),this.deactivateTimeout||(this.deactivateTimeout=window.setTimeout(()=>this.deactivateInstance("tabs"),Mr)))},this.log=H("INSTANCE"),this.instanceId=es}get deactivatedReason(){return this.deactivated}start(){if(this.reset(),!this.started){this.started=!0,xe.addEventListener("change",this.checkInstance),setInterval(this.checkInstance,Ir),this.checkInstance();try{document.documentElement.addEventListener("beforeunload",this.clearInstance)}catch{}}}reset(){this.masterInstance=!1,this.clearDeactivateTimeout(),this.deactivated=void 0}activateInstance(){this.deactivated&&(this.reset(),this.checkInstance(!1),this.dispatchEvent("activated"))}deactivateInstance(e){this.masterInstance||this.deactivated||(this.log.warn("deactivate",e),this.clearDeactivateTimeout(),this.deactivated=e,this.dispatchEvent("deactivated",e))}clearDeactivateTimeout(){this.deactivateTimeout&&(clearTimeout(this.deactivateTimeout),this.deactivateTimeout=0)}}const Ne=new Br;y&&(y.singleInstance=Ne);function xr(t,e){if(t!==void 0)return t=+t.toFixed(0),e?t<ct?t:t%ct:t}function Nr(t){return xr(t,!0)}const Ur=1e4;class ms extends te{constructor(){super(!1),this.isAvailable=!0,this.isPushEnabled=!1,this.localNotificationsAvailable=!0,this.started=!1,this.settings={},this.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,this.userVisibleOnly=!this.isFirefox,this.log=H("PUSH-API"),this.subscribe=()=>{this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.subscribe({userVisibleOnly:this.userVisibleOnly}).then(s=>{this.isPushEnabled=!0,this.pushSubscriptionNotify("subscribe",s)}).catch(s=>{Notification.permission==="denied"?this.log("Permission for Notifications was denied"):(this.log("Unable to subscribe to push.",s),this.userVisibleOnly||(this.userVisibleOnly=!0,setTimeout(this.subscribe,0)))})})},this.isAliveNotify=()=>{if(!this.isAvailable||Ne.deactivatedReason)return;this.settings.baseUrl=(location.href||"").replace(/#.*$/,"");const e={},s={push_action_mute1d:ee?"PushNotification.Action.Mute1d.Mobile":"PushNotification.Action.Mute1d",push_action_settings:ee?"PushNotification.Action.Settings.Mobile":"PushNotification.Action.Settings",push_message_nopreview:"PushNotification.Message.NoPreview"};for(const r in s)e[r]=B.format(s[r],!0);this.serviceMessagePort.invokeVoid("pushPing",{localNotifications:this.localNotificationsAvailable,lang:e,settings:this.settings}),this.isAliveTO=setTimeout(this.isAliveNotify,Ur)},(!("PushManager"in window)||!("Notification"in window)||!("serviceWorker"in navigator))&&(this.log.warn("Push messaging is not supported."),this.isAvailable=!1,this.localNotificationsAvailable=!1),this.isAvailable&&Notification.permission==="denied"&&this.log.warn("The user has blocked notifications.")}start(){this.started||(this.started=!0,this.getSubscription(),this.setUpServiceWorkerChannel())}setLocalNotificationsDisabled(){this.localNotificationsAvailable=!1}getSubscription(){this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.getSubscription().then(s=>{this.isPushEnabled=!!s,this.pushSubscriptionNotify("init",s)}).catch(s=>{this.log.error("Error during getSubscription()",s)})})}unsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.getSubscription().then(s=>{this.isPushEnabled=!1,s&&(this.pushSubscriptionNotify("unsubscribe",s),setTimeout(()=>{s.unsubscribe().then(r=>{this.isPushEnabled=!1}).catch(r=>{this.log.error("Unsubscription error: ",r)})},3e3))}).catch(s=>{this.log.error("Error thrown while unsubscribing from push messaging.",s)})})}forceUnsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.getSubscription().then(s=>{this.log.warn("force unsubscribe",s),s&&s.unsubscribe().then(r=>{this.log.warn("force unsubscribe successful",r),this.isPushEnabled=!1}).catch(r=>{this.log.error("Unsubscription error: ",r)})}).catch(s=>{this.log.error("Error thrown while unsubscribing from push messaging.",s)})})}setSettings(e){this.settings=O(e),clearTimeout(this.isAliveTO),this.isAliveNotify()}hidePushNotifications(){this.isAvailable&&this.serviceMessagePort.invokeVoid("notificationsClear",void 0)}setUpServiceWorkerChannel(){this.isAvailable&&(this.serviceMessagePort.addEventListener("pushClick",e=>{if(Ne.deactivatedReason){fs.reload();return}this.dispatchEvent("push_notification_click",e)}),navigator.serviceWorker.ready.then(this.isAliveNotify))}pushSubscriptionNotify(e,s){if(s){const r=s.toJSON();if(!r||!r.endpoint||!r.keys||!r.keys.p256dh||!r.keys.auth){this.log.warn("Invalid push subscription",r),this.unsubscribe(),this.isAvailable=!1,this.pushSubscriptionNotify(e);return}this.log.warn("Push",e,r),this.dispatchEvent("push_"+e,{tokenType:10,tokenValue:JSON.stringify(r)})}else this.log.warn("Push",e,!1),this.dispatchEvent("push_"+e,!1)}ignorePushByMid(e,s){this.isAvailable&&this.serviceMessagePort.invokeVoid("shownNotification",e+"_"+Nr(s))}}const Ue=new ms;y&&(y.webPushApiManager=Ue);const Wr=Object.freeze(Object.defineProperty({__proto__:null,WebPushApiManager:ms,default:Ue},Symbol.toStringTag,{value:"Module"}));function Vr(t){const e=document.createElement("script"),s=new Promise(r=>{e.onload=e.onerror=()=>{r(e)}});return e.src=t,document.body.appendChild(e),s}function Gr(t){const e=Date.now();return t?e/1e3|0:e}class ps{constructor(){this.disabled=G.test||!A.domains.includes(location.hostname)}setAuthorized(e){if(!this.disabled)return T.get("tgme_sync").then(s=>{const r=Gr(!0);if(e&&s?.canRedirect===e&&s.ts+86400>r)return;T.set({tgme_sync:{canRedirect:e,ts:r}});const n=`_websync_?authed=${e?"1":"0"}&version=${encodeURIComponent(A.version+" "+A.suffix)}`,i=["//telegram.me/"+n,"//t.me/"+n].map(c=>Vr(c).then(a=>{a.remove()}));return Promise.all(i)})}}const vt=new ps;y&&(y.telegramMeWebManager=vt);const Yr=Object.freeze(Object.defineProperty({__proto__:null,TelegramMeWebManager:ps,default:vt},Symbol.toStringTag,{value:"Module"})),Ct=typeof RTCPeerConnection<"u"&&!ae,zr=Ct;let be;if(!j)be=!0;else try{be=+navigator.userAgent.match(/Version\/(.+?) /)[1]>=14}catch{be=!1}const jr=be,Hr="filter"in(document.createElement("canvas").getContext("2d")||{}),$r=!!navigator?.geolocation?.getCurrentPosition&&!1,Kr=Ct,Fs=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp"),St=new Set(["image/jpeg","image/png","image/bmp"]);Fs&&St.add("image/webp");const Es=!!document.createElement("video").canPlayType("video/quicktime")||j||ie,_t=new Set(["image/gif","video/mp4","video/webm"]);Es&&_t.add("video/quicktime");const qr=[...St].concat([..._t]),Xr=new Set(qr),Jr=!ae&&!1,Zr="getDisplayMedia"in(navigator?.mediaDevices||{}),Qr=!!navigator?.vibrate,en=!!document.createElement("video").canPlayType("video/webm")&&!j&&!ie,tn=localStorage.getItem("app_version"),sn=localStorage.getItem("device_model"),rn=localStorage.getItem("system_version"),nn=localStorage.getItem("lang_pack"),on=+localStorage.getItem("app_id"),an=Object.freeze(Object.defineProperty({__proto__:null,APP_ID:on,APP_VERSION:tn,DEVICE_MODEL:sn,LANG_PACK:nn,SYSTEM_VERSION:rn},Symbol.toStringTag,{value:"Module"})),Nt=document.createElement("audio"),vs=!!(Nt.canPlayType&&Nt.canPlayType("audio/ogg;").replace(/no/,""));let Cs=!1;try{const t=document.createElement("canvas").getContext("webgl"),e=t.getExtension("WEBGL_debug_renderer_info"),s=e&&t.getParameter(e.UNMASKED_RENDERER_WEBGL)||"";(s.match(/Apple/)&&!s.match(/Apple GPU/)||t.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb")===-1)&&(Cs=!0)}catch{}const cn=Cs,Ut={CAN_USE_TRANSFERABLES:jr,IS_APPLE_MX:cn,IS_CALL_SUPPORTED:zr,IS_CANVAS_FILTER_SUPPORTED:Hr,IS_EMOJI_SUPPORTED:at,IS_GEOLOCATION_SUPPORTED:$r,IS_GROUP_CALL_SUPPORTED:Kr,IS_MOV_SUPPORTED:Es,IS_PARALLAX_SUPPORTED:Jr,IS_SCREEN_SHARING_SUPPORTED:Zr,IS_TOUCH_SUPPORTED:Q,IS_VIBRATE_SUPPORTED:Qr,IS_OPUS_SUPPORTED:vs,IS_SHARED_WORKER_SUPPORTED:Be,IS_WEBM_SUPPORTED:en,IS_WEBP_SUPPORTED:Fs,IS_WEBRTC_SUPPORTED:Ct,IMAGE_MIME_TYPES_SUPPORTED:St,MEDIA_MIME_TYPES_SUPPORTED:Xr,VIDEO_MIME_TYPES_SUPPORTED:_t,...Ys,...an};function un(){return new Date().toLocaleString().match(/\s(AM|PM)/)?"h12":"h23"}const ln={8:new Uint8Array(1),16:new Uint16Array(1),32:new Uint32Array(1)};function dt(t){const e=ln[t];return crypto.getRandomValues(e),e[0]}function Vo(){return""+dt(32)+dt(32)%16777215}const hn=A.version,dn=A.build,Wt={_:"theme",access_hash:"",id:"",settings:[{_:"themeSettings",pFlags:{},base_theme:{_:"baseThemeClassic"},accent_color:3379436,message_colors:[5221966],wallpaper:{_:"wallPaper",pFlags:{default:!0,pattern:!0},access_hash:"",document:void 0,id:"",slug:"pattern",settings:{_:"wallPaperSettings",pFlags:{},intensity:50,background_color:14409147,second_background_color:7054727,third_background_color:14014605,fourth_background_color:8960132}}},{_:"themeSettings",pFlags:{},base_theme:{_:"baseThemeNight"},accent_color:8877281,message_colors:[8877281],wallpaper:{_:"wallPaper",pFlags:{default:!0,pattern:!0,dark:!0},access_hash:"",document:void 0,id:"",slug:"pattern",settings:{_:"wallPaperSettings",pFlags:{},intensity:-50,background_color:16696470,second_background_color:14511289,third_background_color:9842623,fourth_background_color:5200853}}}],slug:"",title:"",emoticon:"🏠",pFlags:{default:!0}},Vt=(t,e,s)=>({...Wt,name:t,settings:{...Wt.settings.find(r=>r.base_theme._===e),highlightningColor:s}}),N={allDialogsLoaded:{},pinnedOrders:{},contactsListCachedTime:0,updates:{},filtersArr:[],maxSeenMsgId:0,stateCreatedTime:Date.now(),recentEmoji:[],recentCustomEmoji:[],topPeersCache:{},recentSearch:[],version:hn,build:dn,authState:{_:ee?"authStateSignIn":"authStateSignQr"},hiddenPinnedMessages:{},settings:{messagesTextSize:16,distanceUnit:"kilometers",sendShortcut:"enter",autoDownload:{photo:{contacts:!0,private:!0,groups:!0,channels:!0},video:{contacts:!0,private:!0,groups:!0,channels:!0},file:{contacts:!0,private:!0,groups:!0,channels:!0}},autoDownloadNew:{_:"autoDownloadSettings",file_size_max:3145728,pFlags:{video_preload_large:!0,audio_preload_next:!0},photo_size_max:1048576,video_size_max:15728640,video_upload_maxbitrate:100},stickers:{suggest:"all",dynamicPackOrder:!0,loop:!0},emoji:{suggest:!0,big:!0},themes:[Vt("day","baseThemeClassic","hsla(86.4, 43.846153%, 45.117647%, .4)"),Vt("night","baseThemeNight","hsla(299.142857, 44.166666%, 37.470588%, .4)")],theme:"system",notifications:{sound:!1},timeFormat:un(),liteMode:{all:!1,animations:!1,chat:!1,chat_background:!1,chat_spoilers:!1,effects:!1,effects_premiumstickers:!1,effects_reactions:!1,effects_emoji:!1,emoji:!1,emoji_messages:!1,emoji_panel:!1,gif:!1,stickers:!1,stickers_chat:!1,stickers_panel:!1,video:!1}},playbackParams:{volume:1,muted:!1,playbackRate:1,playbackRates:{voice:1,video:1,audio:1},loop:!1,round:!1},keepSigned:!0,chatContextMenuHintWasShown:!1,hideChatJoinRequests:{},stateId:dt(32),notifySettings:{},confirmedWebViews:[]};function ye(t,e){t=t.split(" ",1)[0],e=e.split(" ",1)[0];const s=t.split("."),r=e.split(".");for(let n=0;n<s.length;++n){const o=+s[n],i=+r[n];if(o>i)return 1;if(o<i)return-1}return 0}function Dn(t){return typeof t=="object"&&t!==null}function Ss(t,e,s,r,n,o){for(const i in t){const c=o?`${o}.${i}`:i;n?.has(c)||(typeof e[i]!=typeof t[i]?(e[i]=O(t[i]),s?.(r||i)):Dn(t[i])&&Ss(t[i],e[i],s,r||i,n,c))}}function gn(t,e,s){const r=performance.now();return(s||console).warn(Re(),"start",e),t.then(()=>{(s||console).warn(Re(),"end",e,performance.now()-r)}),t}function fn(t){return(...e)=>gn(...e,t)}const mn=24*60*60*1e3,we=N.version,de=N.build,ke=Object.keys(N),pn=["contactsListCachedTime","stateCreatedTime","maxSeenMsgId","filtersArr"];async function Fn(){const t=H("STATE-LOADER",Ft.Error),e=performance.now(),s=fn(t),r=ke.map(C=>s(oe.get(C),"state "+C)).concat(s(T.get("user_auth"),"auth"),s(T.get("state_id"),"auth"),s(T.get("k_build"),"auth"),s(T.get("auth_key_fingerprint"),"auth"),s(T.get(`dc${A.baseDcId}_auth_key`),"auth")).concat(s(oe.get("user_auth"),"old auth")),n=await Promise.all(r);t.warn("promises",performance.now()-e);const o=[],i=(C,M)=>{a[C]=M,o.push(C)},c=C=>{o.length=0,a=C,o.push(...Object.keys(a))};let a={};for(let C=0,M=ke.length;C<M;++C){const b=ke[C],_=n[C];_!==void 0?a[b]=_:i(b,O(N[b]))}n.splice(0,ke.length);let u=n.shift();const l=n.shift(),m=n.shift(),F=n.shift(),f=n.shift(),D=n.shift();if(!u&&D){u=D;const C=["dc","server_time_offset","xt_instance"];for(let _=1;_<=5;++_)C.push(`dc${_}_server_salt`),C.push(`dc${_}_auth_key`);const M=await Promise.all(C.map(_=>oe.get(_)));C.push("user_auth"),M.push(typeof u=="number"||typeof u=="string"?{dcID:M[0]||A.baseDcId,date:Date.now()/1e3|0,id:u.toPeerId(!1)}:u);const b={};C.forEach((_,h)=>{b[_]=M[h]}),await T.set(b)}u&&(a.authState={_:"authStateSignedIn"},S.dispatchEvent("user_auth",typeof u=="number"||typeof u=="string"?{dcID:0,date:Date.now()/1e3|0,id:u.toPeerId(!1)}:u));const E=new Set,v=C=>{C.push("authState","stateId");const M=new Map(C.map(_=>[_,a[_]]));a=O(N),M.forEach((_,h)=>{a[h]=_});const b=["chats","dialogs","users"];for(const _ of b)E.add(_);c(a)};if(a.stateId!==l&&(l!==void 0&&v([]),await T.set({state_id:a.stateId})),f){const C=f.slice(0,8);F?F!==C&&v([]):v(["settings"]),F!==C&&await T.set({auth_key_fingerprint:C})}const k=Date.now();a.stateCreatedTime+mn<k&&(X&&t("will refresh state",a.stateCreatedTime,k),(M=>{M.forEach(b=>{i(b,O(N[b]))})})(pn));const L=a.settings.autoDownload;if(L?.private!==void 0){const C=["contacts","private","groups","channels"];["photo","video","file"].forEach(b=>{const _=L[b]={};C.forEach(h=>{_[h]=L[h]})}),C.forEach(b=>{delete L[b]}),i("settings",a.settings)}Ss(N,a,C=>{i(C,a[C])},void 0,new Set(["settings.themes"]));let I,W;if(a.version!==we||a.build!==de){if(a.build<322&&(i("allDialogsLoaded",O(N.allDialogsLoaded)),i("pinnedOrders",O(N.pinnedOrders)),i("filtersArr",O(N.filtersArr)),E.add("dialogs")),ye(a.version,"1.7.1")===-1){let C=!1;if(ye(a.version,"1.3.0")===-1)C=!0,a.settings.theme=O(N.settings.theme),a.settings.themes=O(N.settings.themes);else if(ye(a.version,"1.7.1")===-1){C=!0;const M=a.settings.themes;a.settings.themes=O(N.settings.themes);try{M.forEach(b=>{const _=b.background;if(!_)return;const h=a.settings.themes.find(d=>d.name===b.name);h.settings.highlightningColor=_.highlightningColor;const g=d=>d&&parseInt(d.slice(1),16),p=(_.color||"").split(",").map(g);if(_.color&&!_.slug)h.settings.wallpaper={_:"wallPaperNoFile",id:0,pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}};else{const d={_:"wallPaper",id:0,access_hash:0,slug:_.slug,document:{},pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}},P=d.settings;h.settings.wallpaper=d,_.slug&&!_.color?P.pFlags.blur=_.blur||void 0:_.intensity&&(P.intensity=_.intensity,d.pFlags.pattern=!0,d.pFlags.dark=_.intensity<0||void 0)}if(p.length){const d=h.settings.wallpaper.settings;d.background_color=p[0],d.second_background_color=p[1],d.third_background_color=p[2],d.fourth_background_color=p[3]}})}catch(b){console.error("migrating themes error",b)}}C&&i("settings",a.settings)}a.build<309&&(a.settings.liteMode.animations=!a.settings.animationsEnabled,a.settings.liteMode.video=!a.settings.autoPlay.videos,a.settings.liteMode.gif=!a.settings.autoPlay.gifs),a.build<312&&typeof a.settings.stickers.suggest=="boolean"&&(a.settings.stickers.suggest=a.settings.stickers.suggest?"all":"none"),ye(a.version,we)!==0&&(I=we,W=a.version),i("version",we),i("build",de)}return m!==de&&(!m||m<de)&&T.set({k_build:de}),S.settings=a.settings,X&&t("state res",a,O(a)),t.warn("total",performance.now()-e),{state:a,resetStorages:E,newVersion:I,oldVersion:W,pushedKeys:o}}let En;function vn(){return En??(En=Fn())}class Cn{constructor(){this.sampleRate=48e3,this.tasks=[],this.keepAlive=!1,this.log=H("OPUS",Ft.Error)}isPlaySupported(){return vs}loadWavWorker(){this.wavWorker||(this.wavWorker=new Worker("waveWorker.min.js"),this.wavWorker.addEventListener("message",e=>{const s=e.data;if(this.log("[WAV] got message:",s),s&&s.page){const r=s.page;this.onTaskEnd(this.tasks.shift(),r)}}))}loadWorker(){this.worker||(this.worker=new Worker("decoderWorker.min.js"),this.worker.addEventListener("message",e=>{const s=e.data;this.log("[DECODER] got message",s),s.type==="done"?(this.wavWorker.postMessage({command:"done"}),s.waveform&&(this.tasks[0].waveform=s.waveform)):this.wavWorker.postMessage({command:"encode",buffers:e.data},j?void 0:s.map(r=>r.buffer))}))}setKeepAlive(e){this.keepAlive=e,this.keepAlive?(this.loadWorker(),this.loadWavWorker()):this.tasks.length||this.terminateWorkers()}onTaskEnd(e,s){s?(clearTimeout(e.timeout),e.callback.resolve({bytes:s,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},j?void 0:[e.pages.buffer]),e.timeout=window.setTimeout(()=>{this.log.error("decode timeout"),this.terminateWorkers(!0),this.tasks.length&&(this.loadWorker(),this.loadWavWorker()),this.onTaskEnd(this.tasks.shift())},1e4)}pushDecodeTask(e,s){return new Promise((r,n)=>{const o={pages:e,withWaveform:s,callback:{resolve:r,reject:n},timeout:0};this.loadWorker(),this.loadWavWorker(),this.tasks.push(o)===1&&this.executeNewTask(o)})}async decode(e,s=!1){return this.pushDecodeTask(e,s).then(async r=>{const n=new Blob([r.bytes],{type:"audio/wav"});return{url:await Ye.invoke("createObjectURL",n),waveform:r.waveform}})}}const _s=new Cn;y.opusDecodeController=_s;class Sn extends Et{constructor(){super("CRYPTO"),this.lastIndex=-1}invokeCryptoNew({method:e,args:s,transfer:r}){const n={method:e,args:s},o=this.listeners.invoke;if(o?.length){let c=o[0].callback(n);return!ce&&!(c instanceof Promise)&&(c=Promise.resolve(c)),c}const i=e==="aes-encrypt"||e==="aes-decrypt"?this.lastIndex=(this.lastIndex+1)%this.sendPorts.length:0;return this.invoke("invoke",n,void 0,this.sendPorts[i],r)}invokeCrypto(e,...s){return this.invokeCryptoNew({method:e,args:s})}}const Te=new Sn;y&&(y.cryptoMessagePort=Te);function _n(t){return["image/jpeg","image/png","image/gif","image/svg+xml","image/webp","image/bmp","video/mp4","video/webm","video/quicktime","audio/ogg","audio/mpeg","audio/mp4","audio/wav","application/json","application/pdf"].indexOf(t)===-1?"application/octet-stream":t}function ys(t,e=""){Array.isArray(t)||(t=[t]);const s=_n(e);return new Blob(t,{type:s})}class yn{constructor(e,s,r){this.mimeType=e,this.size=s,this.saveFileCallback=r,this.bytes=new Uint8Array(s)}async write(e,s){const r=s+e.byteLength;if(r>this.bytes.byteLength){const n=new Uint8Array(r);n.set(this.bytes,0),this.bytes=n}this.bytes.set(e,s)}truncate(){this.bytes=new Uint8Array}trim(e){this.bytes=this.bytes.slice(0,e)}finalize(e=!0){const s=ys(this.bytes,this.mimeType);return e&&this.saveFileCallback&&this.saveFileCallback(s),s}getParts(){return this.bytes}replaceParts(e){this.bytes=e}}const Le=class{constructor(t){this.dbName=t,this.useStorage=!0,G.test&&(this.dbName+="_test"),Le.STORAGES.length&&(this.useStorage=Le.STORAGES[0].useStorage),this.openDatabase(),Le.STORAGES.push(this)}openDatabase(){return this.openDbPromise??(this.openDbPromise=caches.open(this.dbName))}delete(t){return this.timeoutOperation(e=>e.delete("/"+t))}deleteAll(){return caches.delete(this.dbName)}get(t){return this.timeoutOperation(e=>e.match("/"+t))}save(t,e){return this.timeoutOperation(s=>s.put("/"+t,e))}getFile(t,e="blob"){return this.get(t).then(s=>{if(!s)throw Me("NO_ENTRY_FOUND");return s[e]()})}saveFile(t,e){e instanceof Blob||(e=ys(e));const s=new Response(e,{headers:{"Content-Length":""+e.size}});return this.save(t,s).then(()=>e)}timeoutOperation(t){return this.useStorage?new Promise(async(e,s)=>{let r=!1;const n=setTimeout(()=>{s(),r=!0},15e3);try{const o=await this.openDatabase();if(!o)throw this.useStorage=!1,this.openDbPromise=void 0,"no cache?";const i=await t(o);if(r)return;e(i)}catch(o){s(o)}clearTimeout(n)}):Promise.reject(Me("STORAGE_OFFLINE"))}prepareWriting(t,e,s){return{deferred:K(),getWriter:()=>new yn(s,e,n=>this.saveFile(t,n).catch(()=>n))}}static toggleStorage(t,e){return Promise.all(this.STORAGES.map(s=>{if(s.useStorage=t,!!e&&!t)return s.deleteAll()}))}};let ws=Le;ws.STORAGES=[];function Gt(t,e){return Promise.all([Ve.toggleStorage(t,e),ws.toggleStorage(t,e),T.toggleStorage(t,e)]).then(Fe,Fe)}class wn extends Et{constructor(){super("SERVICE"),y&&(y.serviceMessagePort=this)}}const kn=""+new URL("sw-795130e9.js",import.meta.url).href;class Pn extends Se{constructor(){super(),this.onMirrorTask=e=>{var i;const{name:s,key:r,value:n}=e;if(!e.hasOwnProperty("key")){this.mirrors[s]=n;return}const o=(i=this.mirrors)[s]??(i[s]={});n===void 0?delete o[r]:o[r]=n},this.mirrors={},this.tabState={chatPeerIds:[],idleStartTime:0},this.log("constructor"),this.registerWorker(),this.registerServiceWorker(),this.registerCryptoWorker(),this.addMultipleEventsListeners({convertWebp:({fileName:e,bytes:s})=>ds.convert(e,s),convertOpus:({fileName:e,bytes:s})=>_s.pushDecodeTask(s,!1).then(r=>r.bytes),event:({name:e,args:s})=>{S.dispatchEventSingle(e,...s)},localStorageProxy:e=>{const s=e;return T[s.type](...s.args)},mirror:this.onMirrorTask}),S.addEventListener("language_change",e=>{S.managers.networkerFactory.setLanguage(e)}),window.addEventListener("online",()=>{S.managers.networkerFactory.forceReconnectTimeout()}),S.addEventListener("logging_out",()=>{const e=["cachedFiles","cachedStreamChunks"];Promise.all([Gt(!1,!0),T.clear(),Promise.race([vt.setAuthorized(!1),pt(3e3)]),Ue.forceUnsubscribe(),Promise.all(e.map(s=>caches.delete(s)))]).finally(()=>{fs.reload()})}),xe.addEventListener("change",e=>{this.updateTabStateIdle(e)}),this.updateTabStateIdle(xe.isIdle),this.log("Passing environment:",Ut),this.invoke("environment",Ut)}pingServiceWorkerWithIframe(){if(this.pingServiceWorkerPromise)return this.pingServiceWorkerPromise;const e=this.pingServiceWorkerPromise=K(),s=document.createElement("iframe");s.hidden=!0;const r=()=>{setTimeout(()=>{this.pingServiceWorkerPromise=void 0},1e4),clearTimeout(n),s.remove(),s.removeEventListener("load",r),s.removeEventListener("error",r),e.resolve()};s.addEventListener("load",r),s.addEventListener("error",r),s.src="ping/"+(Math.random()*4294967295|0)+".nocache",document.body.append(s);const n=window.setTimeout(r,1e3);return e}attachServiceWorker(e){if(this.lastServiceWorker===e){this.log.warn("trying to attach same service worker");return}this.lastServiceWorker&&this.serviceMessagePort.detachPort(this.lastServiceWorker),this.serviceMessagePort.attachSendPort(this.lastServiceWorker=e),this.serviceMessagePort.invokeVoid("hello",void 0)}_registerServiceWorker(){navigator.serviceWorker.register(kn,{type:"module",scope:"./"}).then(e=>{this.log("SW registered",e);const s=new URL(window.location.href),r="swfix",n=+s.searchParams.get(r)||0;if(e.active&&!navigator.serviceWorker.controller){if(n>=3)throw new Error("no controller");return e.unregister().then(()=>{s.searchParams.set(r,""+(n+1)),window.location.href=s.toString()})}n&&(s.searchParams.delete(r),history.pushState(void 0,"",s)),(e.installing||e.waiting||e.active).addEventListener("statechange",c=>{this.log("SW statechange",c)});const i=navigator.serviceWorker.controller||e.installing||e.waiting||e.active;this.attachServiceWorker(i)}).catch(e=>{this.log.error("SW registration failed!",e),this.invokeVoid("serviceWorkerOnline",!1)})}registerServiceWorker(){if(!("serviceWorker"in navigator))return;this.serviceMessagePort=Ue.serviceMessagePort=new wn;const e=navigator.serviceWorker;this._registerServiceWorker(),e.addEventListener("controllerchange",()=>{this.log.warn("controllerchange");const s=e.controller;this.attachServiceWorker(s),s.addEventListener("error",r=>{this.log.error("controller error:",r)})}),this.serviceMessagePort.attachListenPort(e),this.serviceMessagePort.addMultipleEventsListeners({port:(s,r,n)=>{this.invokeVoid("serviceWorkerPort",void 0,void 0,[n.ports[0]])},hello:(s,r)=>{this.serviceMessagePort.resendLockTask(r)},share:s=>{this.log("will try to share something"),this.share=s}}),e.addEventListener("messageerror",s=>{this.log.error("SW messageerror:",s)})}async registerCryptoWorker(){const e=f=>fetch(f).then(D=>D.text()).then(D=>{const E=location.pathname.split("/");E[E.length-1]="";const v=location.origin+E.join("/");return D=D.replace(/(import (?:.+? from )?['"])\//g,"$1"+v),new Blob([D],{type:"application/javascript"})}),s={construct(f,D){return{url:Qt(D[0]).toString()}}},r=[Worker,typeof SharedWorker<"u"&&SharedWorker].filter(Boolean);r.forEach(f=>window[f.name]=new Proxy(f,s));const n=new Worker(new URL(""+new URL("crypto.worker-9d5beacd.js",import.meta.url).href,self.location),{type:"module"});r.forEach(f=>window[f.name]=f);const o=n.url,i=f=>new a(f,{type:"module"}),c=f=>this.attachWorkerToPort(f,Te,"crypto"),a=Be?SharedWorker:Worker;Te.addEventListener("port",(f,D,E)=>{this.invokeVoid("cryptoPort",void 0,void 0,[E.ports[0]])});const u=i(o);c(u);const l=await e(o);(await this.invoke("createProxyWorkerURLs",{originalUrl:o,blob:l})).slice(1).map(i).forEach(c)}registerWorker(){let e;Be?e=new SharedWorker(new URL(""+new URL("mtproto.worker-3c075898.js",import.meta.url).href,self.location),{type:"module"}):e=new Worker(new URL(""+new URL("mtproto.worker-3c075898.js",import.meta.url).href,self.location),{type:"module"}),this.onWorkerFirstMessage(e)}attachWorkerToPort(e,s,r){const n=e.port||e;s.attachPort(n),e.addEventListener("error",o=>{this.log.error(r,"worker error",o)})}onWorkerFirstMessage(e){this.log("set webWorker"),this.attachWorkerToPort(e,this,"mtproto")}loadState(){return Promise.all([vn().then(e=>(this.newVersion=e.newVersion,this.oldVersion=e.oldVersion,this.mirrors.state=e.state,e))])}sendState(){return this.loadState().then(e=>{const[s]=e;return this.invoke("state",{...s,userId:S.myId.toUserId()}),e})}invokeCrypto(e,...s){return Te.invokeCrypto(e,...s)}async toggleStorages(e,s){await Gt(e,s),this.invoke("toggleStorages",{enabled:e,clearWrite:s}),this.serviceMessagePort?.invokeVoid("toggleStorages",{enabled:e,clearWrite:s})}async getMirror(e){return this.mirrors[e]}getState(){return this.getMirror("state")}updateTabState(e,s){this.tabState[e]=s,this.invokeVoid("tabState",this.tabState)}updateTabStateIdle(e){this.updateTabState("idleStartTime",e?Date.now():0)}}const ks=new Pn;y.apiManagerProxy=ks;const Ye=ks,Ps={};X&&(window.DEBUG_MANAGER_REQUESTS=Ps);function An(t,e){return new Proxy({},{get:(r,n,o)=>(...i)=>{const c=Ye.invoke("manager",{name:t,method:n,args:i},e);return X&&Ps[t]?.has(n)&&console.warn("manager request",t,n,i,e),c}})}function Yt(t,e){return new Proxy(t,{get:(s,r,n)=>s[r]??(s[r]=An(r,e))})}let De;function bn(){return De||(De=Yt({},!1),De.acknowledged=Yt({},!0),De)}function Tn(t,e,s){return Math.min(s,Math.max(e,t))}function q(t,e,s){t/=255,e/=255,s/=255;const r=Math.max(t,e,s),n=r-Math.min(t,e,s),o=n&&(r===t?(e-s)/n:r==e?2+(s-t)/n:4+(t-e)/n);return[60*(o<0?o+6:o),r&&n/r,r]}function yt(t,e,s){const r=(n,o=(n+t/60)%6)=>Math.round((s-s*e*Math.max(Math.min(o,4-o,1),0))*255);return[r(5),r(3),r(1)]}function As(t,e,s,r=1){t/=255,e/=255,s/=255;const n=Math.max(t,e,s),o=Math.min(t,e,s);let i,c;const a=(n+o)/2;if(n===o)i=c=0;else{const u=n-o;switch(c=a>.5?u/(2-n-o):u/(n+o),n){case t:i=(e-s)/u+(e<s?6:0);break;case e:i=(s-t)/u+2;break;case s:i=(t-e)/u+4;break}i/=6}return{h:i*360,s:c*100,l:a*100,a:r}}function Ln(t,e,s,r){t/=360,e/=100,s/=100;let n,o,i;if(e===0)n=o=i=s;else{const c=function(m,F,f){return f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?m+(F-m)*6*f:f<.5?F:f<.6666666666666666?m+(F-m)*(.6666666666666666-f)*6:m},a=s<.5?s*(1+e):s+e-s*e,u=2*s-a;n=c(u,a,t+1/3),o=c(u,a,t),i=c(u,a,t-1/3)}return[n,o,i,r].map(c=>Math.round(c*255))}function In(t){const e=t.slice(5,-1).split(", "),s=+e.pop(),r=e.map(n=>n.endsWith("%")?+n.slice(0,-1):+n);return Ln(r[0],r[1],r[2],s)}function bs(t){const e=[],s=t[0]==="#"?1:0;if(t.length===5+s&&(t=(s?"#":"")+"0"+t.slice(s)),t.length===3+s)for(let r=s;r<t.length;++r)e.push(parseInt(t[r]+t[r],16));else if(t.length===4+s){for(let r=s;r<t.length-1;++r)e.push(parseInt(t[r]+t[r],16));e.push(parseInt(t[t.length-1],16))}else for(let r=s;r<t.length;r+=2)e.push(parseInt(t.slice(r,r+2),16));return e}function $(t){return bs(t.slice(0,7))}function Go(t){const e=bs(t);return As(e[0],e[1],e[2],e[3])}function me(t){return"#"+t.map(e=>("0"+e.toString(16)).slice(-2)).join("")}function Mn(t){return me(In(t))}function Rn(t){return Mn(t).slice(0,-2)}function et(t,e,s){const r=new Array(3);for(let n=0;n<3;++n){const o=t[n],i=e[n];r[n]=Math.floor(i+(o-i)*s)}return r}function zt(t){return(t[0]*.2126+t[1]*.7152+t[2]*.0722)/255}function On(t,e){return t.map((s,r)=>Math.round((s+e[r])/2))}function Bn(t,e,s){const r=q(...e),n=q(...s),o=Math.min(1.5*r[1]/t[1],1);return r[0]=Math.min(360,n[0]-r[0]+t[0]),r[1]=Math.min(1,n[1]*t[1]/r[1]),r[2]=Math.min(1,(n[2]/r[2]+o-1)*t[2]/o),r[2]<.3?s:yt(...r)}function xn(t,e,s,r){const n=q(...s);if(Math.min(Math.abs(n[0]-t[0]),Math.abs(n[0]-t[0]-360))>30)return s;const i=Math.min(1.5*n[1]/t[1],1);n[0]=Math.min(360,n[0]+e[0]-t[0]),n[1]=Math.min(1,n[1]*e[1]/t[1]),n[2]=Math.min(1,n[2]*(1-i+i*e[2]/t[2]));let c=yt(...n);const a=zt(s),u=zt(c);if(r?a>u:a<u){const F=.4*a/u+.6;c=Nn(c,F)}return c}function Nn(t,e){return t.map(s=>Tn(Math.round(s*e),0,255))}function Ts(t){const e=(t<0?16777215+t:t).toString(16);return"#"+(e.length>=6?e:"0".repeat(6-e.length)+e)}function Pe(t){return $(Ts(t))}function Yo(t){return t.settings?[t.settings.background_color,t.settings.second_background_color,t.settings.third_background_color,t.settings.fourth_background_color].filter(Boolean).map(Ts).join(","):""}function Ls(t,e,s,r,n=!0){if(t<s&&e<r&&n)return w(t,e);let o=s,i=r;return t/e>s/r?i=e*s/t|0:(o=t*r/e|0,o>s&&(i=i*s/o|0,o=s)),n&&o>=t&&i>=e&&(o=t,i=e),w(o,i)}y.calcImageInBox=Ls;class Un{constructor(e=0,s=e){this.width=e,this.height=s}aspect(e,s){return Ls(this.width,this.height,e.width,e.height,s)}aspectFitted(e){return this.aspect(e,!0)}aspectCovered(e){return this.aspect(e,!1)}}function w(t,e){return new Un(t,e)}var Wn=(t=>(t[t.mobile=0]="mobile",t[t.medium=1]="medium",t[t.large=2]="large",t))(Wn||{});const Vn=600,Gn=1275,Yn=1680,jt=w(20,20),Ht=w(36,36),$t=w(18,18);class zn extends te{constructor(){super(),this.screenSizes=[{key:0,value:Vn},{key:1,value:Gn},{key:2,value:Yn}],this.sizes={handhelds:{regular:w(270,270),webpage:w(270,200),album:w(270,0),esgSticker:w(68,68),animatedSticker:w(180,180),staticSticker:w(180,180),emojiSticker:w(112,112),poll:w(240,0),round:w(240,240),documentName:w(200,0),invoice:w(270,270),extendedInvoice:w(270,270),customEmoji:jt,esgCustomEmoji:Ht,emojiStatus:$t,popupSticker:w(68,68)},desktop:{regular:w(420,340),webpage:w(420,340),album:w(420,0),esgSticker:w(72,72),animatedSticker:w(200,200),staticSticker:w(200,200),emojiSticker:w(112,112),poll:w(330,0),round:w(280,280),documentName:w(240,0),invoice:w(320,320),extendedInvoice:w(420,340),customEmoji:jt,esgCustomEmoji:Ht,emojiStatus:$t,popupSticker:w(80,80)}},this.isMobile=!1,this.handleResize=()=>{const e=window.innerWidth;let s=this.screenSizes[0].key;for(let n=this.screenSizes.length-1;n>=0;--n)if(this.screenSizes[n].value<e){s=(this.screenSizes[n+1]||this.screenSizes[n]).key;break}const r=this.activeScreen;this.activeScreen=s,this.isMobile=this.activeScreen===0,this.active=this.isMobile?this.sizes.handhelds:this.sizes.desktop,r!==s&&r!==void 0&&this.dispatchEvent("changeScreen",r,s),r!==void 0&&this.dispatchEvent("resize")},window.addEventListener("resize",()=>{this.rAF&&window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.handleResize(),this.rAF=0})}),this.handleResize()}}const Is=new zn;y.mediaSizes=Is;class jn{constructor(){this.resetCache=()=>{this.computedStyle=void 0;const e=this.cache;this.cache={};for(const s in e)this.getProperty(s)},this.cache={},S.addEventListener("theme_changed",this.resetCache),Is.addEventListener("resize",this.resetCache)}getProperty(e){let s=this.cache[e];return s!==void 0?s:(this.computedStyle??(this.computedStyle=window.getComputedStyle(document.documentElement)),s=this.computedStyle.getPropertyValue("--"+e).trim(),this.setPropertyCache(e,s))}getPropertyAsSize(e){const s=this.getProperty(e);let r;return s[s.length-1]==="%"||(s.indexOf("rem")?r=+s.replace("rem","")*16:r=+s.replace("px","")),r}setPropertyCache(e,s){return this.cache[e]=s}}const Dt=new jn;y&&(y.customProperties=Dt);const Kt={"primary-color":{rgb:!0,light:!0,lightFilled:!0,dark:!0,darkRgb:!0},"message-out-primary-color":{lightFilled:!0},"surface-color":{rgb:!0},"danger-color":{light:!0,dark:!0},"primary-text-color":{rgb:!0},"secondary-text-color":{light:!0,lightFilled:!0},"message-background-color":{light:!0,lightFilled:!0,dark:!0,darkFilled:!0},"message-out-background-color":{light:!0,lightFilled:!0,dark:!0,darkFilled:!0},"saved-color":{lightFilled:!0},"green-color":{}},tt={day:{"primary-color":"#3390ec","message-out-primary-color":"#4fae4e","message-background-color":"#ffffff","surface-color":"#ffffff","danger-color":"#df3f40","primary-text-color":"#000000","secondary-text-color":"#707579","saved-color":"#359AD4","green-color":"#70b768"},night:{"primary-color":"#8774E1","message-out-primary-color":"#8774E1","message-background-color":"#212121","surface-color":"#212121","danger-color":"#ff595a","primary-text-color":"#ffffff","secondary-text-color":"#aaaaaa","saved-color":"#8774E1","green-color":"#5CC85E"}};class Hn{constructor(){S.addEventListener("theme_change",()=>{this.setTheme()})}get themeColorElem(){return this._themeColorElem!==void 0?this._themeColorElem:this._themeColorElem=document.head.querySelector('[name="theme-color"]')||null}setThemeColor(e=this.themeColor){e||(e=this.isNight()?"#212121":"#ffffff");const s=this.themeColorElem;s&&s.setAttribute("content",e)}setThemeListener(){try{const e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{this.systemTheme=e.matches?"night":"day",S.myId?S.dispatchEvent("theme_change"):this.setTheme()};"addEventListener"in e?e.addEventListener("change",s):"addListener"in e&&e.addListener(s),s()}catch{}}applyHighlightningColor(){let e;const s=this.getTheme();s.settings?.highlightningColor?(e=s.settings.highlightningColor,document.documentElement.style.setProperty("--message-highlightning-color",e)):document.documentElement.style.removeProperty("--message-highlightning-color"),!Q&&e&&(this.themeColor=Rn(e))}setTheme(){const e=this.isNight();document.head.querySelector('[name="color-scheme"]')?.setAttribute("content",e?"dark":"light"),document.documentElement.classList.toggle("night",e),this.setThemeColor();const r=this.getTheme();this.applyTheme(r);let n=this.styleElement;n||(n=this.styleElement=document.createElement("style"),document.head.append(n));const o=document.createElement("div");this.applyTheme(S.settings.themes.find(i=>i.name==="night"),o),n.textContent=`.night {${o.style.cssText}}`,this.applyHighlightningColor(),S.dispatchEventSingle("theme_changed")}async switchTheme(e){await S.managers.appStateManager.setByKey("settings.theme",e),S.dispatchEvent("theme_change")}isNight(){return this.getTheme().name==="night"}getTheme(e=S.settings.theme==="system"?this.systemTheme:S.settings.theme){return S.settings.themes.find(s=>s.name===e)}bindColorApplier(e){const s=new Set;return{applyAppColor:r=>(s.add(r.name),this.applyAppColor({...r,...e})),finalize:()=>{const r=e.isNight;for(const n in Kt)s.has(n)||this.applyAppColor({name:n,hex:tt[r?"night":"day"][n],...e})}}}applyAppColor({name:e,hex:s,element:r,lightenAlpha:n=.08,darkenAlpha:o=n,mixColor:i,isNight:c=this.isNight()}){const a=Kt[e],u=$(s),l=As(...u);i??(i=$(tt[c?"night":"day"]["surface-color"]));const m=et(u,i,n),F={...l,l:l.l-o*100},f=[[e,s],a.rgb&&[e+"-rgb",u.join(",")],a.light&&["light-"+e,`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${n})`],a.lightFilled&&["light-filled-"+e,me(m)],a.dark&&["dark-"+e,`hsl(${F.h}, ${F.s}%, ${F.l}%)`]],D=r===document.documentElement;f.filter(Boolean).forEach(([E,v])=>{r.style.setProperty("--"+E,v),D&&Dt.setPropertyCache(E,v)})}async applyNewTheme(e){const s=this.isNightTheme(e),r=this.getTheme(),n=S.settings.themes,o=e.settings.find(c=>c.base_theme._===(s?"baseThemeNight":"baseThemeClassic")),i={...e,name:r.name,settings:{...o,highlightningColor:""}};await this.AppBackgroundTab.setBackgroundDocument(o.wallpaper,i.settings),n[n.indexOf(r)]=i,await S.managers.appStateManager.setByKey("settings.themes",S.settings.themes),S.dispatchEvent("theme_change")}isNightTheme(e){return e.name==="night"||this.isNight()}applyTheme(e,s=document.documentElement){const r=this.isNightTheme(e),n=Array.isArray(e.settings)?e.settings.find(I=>I.base_theme._===(r?"baseThemeNight":"baseThemeClassic")):e.settings,o=tt[r?"night":"day"];let i=q(...$(o["primary-color"])),c=q(...Pe(n.accent_color));const a=xn(i,c,$(o["primary-color"]),!r),u=me(a),{applyAppColor:l,finalize:m}=this.bindColorApplier({element:s,isNight:r});if(l({name:"primary-color",hex:u,darkenAlpha:.04}),l({name:"saved-color",hex:u,lightenAlpha:.64,mixColor:[255,255,255]}),!n.message_colors?.length)return;const F=r?.92:.12,f=$(o["message-out-primary-color"]);i=q(...f);const D=et(f,$(o["surface-color"]),F);let v=Pe(n.message_colors[0]);n.message_colors.length>1&&(n.message_colors.slice(1).forEach(I=>{v=On(v,Pe(I))}),v=Bn(i,D,v)),c=q(...v);const L=n.outbox_accent_color!==void 0&&q(...Pe(n.outbox_accent_color)),Y=et(v,$(o["surface-color"]),F);l({name:"message-out-background-color",hex:me(Y),lightenAlpha:F}),l({name:"message-out-primary-color",hex:r?"#ffffff":me(L?yt(...L):v),mixColor:Y}),m()}getThemeParamsForWebView(){const e={bg_color:"surface-color",button_color:"primary-color",button_text_color:"#ffffff",hint_color:"secondary-text-color",link_color:"link-color",secondary_bg_color:"background-color-true",text_color:"primary-text-color"},s={};for(const r in e){const n=e[r];s[r]=n[0]==="#"?n:Dt.getProperty(n)}return s}}const Ms=new Hn;y&&(y.themeController=Ms);class $n extends te{constructor(){super(...arguments),this.overlaysActive=0}get isOverlayActive(){return this.overlaysActive>0}set isOverlayActive(e){this.overlaysActive+=e?1:-1,this.dispatchEvent("change",this.isOverlayActive)}}const st=new $n;function zo(t,e=t.split("?")){return Rs(e?.[1])}function Rs(t){const e={};return t&&t.split("&").forEach(s=>{const[r,n=""]=s.split("=");e[r]=decodeURIComponent(n)}),e}const Kn="onbeforeinstallprompt"in window;let gt;function qn(){window.addEventListener("beforeinstallprompt",t=>{gt=async()=>{t.prompt();const{outcome:e}=await t.userChoice;e==="accepted"&&(gt=void 0)}})}function jo(){return gt}const wt=["January","February","March","April","May","June","July","August","September","October","November","December"],Xn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ee=wt.slice(),ft=Xn.slice(),ve=86400;function Jn(){const t=B.getDateTimeFormat({weekday:"long"}),e=new Date(Date.UTC(2017,0,2)),s=[];for(let r=0;r<7;++r)s.push(Ge(t.format(e))),e.setDate(e.getDate()+1);return s}function Zn(){const t=B.getDateTimeFormat({month:"long"}),e=new Date(Date.UTC(2017,0,1)),s=[];for(let r=0;r<12;++r)s.push(Ge(t.format(e))),e.setMonth(e.getMonth()+1);return s}function qt(){Ee.splice(0,Ee.length,...Zn()),ft.splice(0,ft.length,...Jn())}const Xt=t=>{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),s=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-s);const r=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-r.getTime())/ve+1)/7)};function Qn(t){const e=new Date,s=e.getTime()/1e3|0,r=t.getTime()/1e3|0,n={};return s-r<ve&&e.getDate()===t.getDate()?n.hour=n.minute="2-digit":e.getFullYear()!==t.getFullYear()?(n.year=n.day="numeric",n.month="2-digit"):s-r<ve*7&&Xt(e)===Xt(t)?n.weekday="short":(n.month="short",n.day="numeric"),new B.IntlDateElement({date:t,options:n}).element}function eo(t,e={}){const s=new Date,r=new Date(t*1e3),n=s.getTime()/1e3,o=to(r);let i;return n-t<ve&&s.getDate()===r.getDate()?i=Oe(e.capitalize?"Date.Today":"Peer.Status.Today"):n-t<ve*2&&s.getDate()-1===r.getDate()?(i=Oe(e.capitalize?"Yesterday":"Peer.Status.Yesterday"),e.capitalize&&(i.style.textTransform="capitalize")):s.getFullYear()!==r.getFullYear()?i=new B.IntlDateElement({date:r,options:{month:"short",day:"numeric",year:"numeric"}}).element:i=new B.IntlDateElement({date:r,options:{month:"short",day:"numeric"}}).element,{dateEl:i,timeEl:o}}function Ho(t,e=!0){const{dateEl:s,timeEl:r}=eo(t,{capitalize:e}),n=document.createDocumentFragment();return n.append(s," ",Oe("ScheduleController.at")," ",r),n}function to(t){return new B.IntlDateElement({date:t,options:{hour:"2-digit",minute:"2-digit"}}).element}y&&(y.formatDateAccordingToTodayNew=Qn);const $o=(t,e={})=>{const s=e.monthAsNumber?".":" ",r=("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)+(e.noSeconds?"":":"+("0"+t.getSeconds()).slice(-2));return(e.leadingZero?("0"+t.getDate()).slice(-2):t.getDate())+s+(e.monthAsNumber?("0"+(t.getMonth()+1)).slice(-2):wt[t.getMonth()])+s+t.getFullYear()+(e.noTime?"":", "+r)},z=2013,so=new RegExp("20[0-9]{1,2}"),kt="\\p{L}",ro=new RegExp(`(${kt}{3,})`,"iu"),no=new RegExp(`(${kt}{3,}) ([0-9]{0,4})`,"iu"),oo=new RegExp(`([0-9]{0,4}) (${kt}{2,})`,"iu"),io=new RegExp("^([0-9]{1,4})(\\.| |/|\\-)([0-9]{1,4})$","i"),ao=new RegExp("^([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,4})$","i"),co=[31,29,31,30,31,30,31,31,30,31,30,31];function uo(t,e){const s=t.trim().toLowerCase();if(s.length<3)return;if(["today",B.format("Peer.Status.Today",!0)].some(o=>o.indexOf(s)===0)){const o=new Date,i=o.getFullYear(),c=o.getMonth(),a=o.getDate();o.setFullYear(i,c,a),o.setHours(0,0,0);const u=o.getTime();o.setFullYear(i,c,a+1),o.setHours(0,0,0);const l=o.getTime()-1;e.push({title:B.format("Date.Today",!0),minDate:u,maxDate:l});return}if(["yesterday",B.format("Peer.Status.Yesterday",!0)].some(o=>o.indexOf(s)===0)){const o=new Date,i=o.getFullYear(),c=o.getMonth(),a=o.getDate();o.setFullYear(i,c,a),o.setHours(0,0,0);const u=o.getTime()-864e5;o.setFullYear(i,c,a+1),o.setHours(0,0,0);const l=o.getTime()-86400001;e.push({title:Ge(B.format("Yesterday",!0)),minDate:u,maxDate:l});return}const r=go(s);if(r>=0){const o=new Date,i=o.getTime(),c=o.getDay(),a=r-c;o.setDate(o.getDate()+a),o.getTime()>i&&o.setTime(o.getTime()-6048e5);const u=o.getFullYear(),l=o.getMonth(),m=o.getDate();o.setFullYear(u,l,m),o.setHours(0,0,0);const F=o.getTime();o.setFullYear(u,l,m+1),o.setHours(0,0,0);const f=o.getTime()-1;e.push({title:Bs(F),minDate:F,maxDate:f});return}let n;if((n=io.exec(s))!==null){const o=n[1],i=n[3],c=parseInt(o),a=parseInt(i);if(c>0&&c<=31){if(a>=z&&c<=12){const u=a,l=c-1;ge(e,l,u);return}else if(a<=12){const u=c-1,l=a-1;rt(e,u,l)}}else if(c>=z&&a<=12){const u=c,l=a-1;ge(e,l,u)}return}if((n=ao.exec(s))!==null){const o=n[1],i=n[3],c=n[5];if(!n[2]===n[4])return;const a=parseInt(o),u=parseInt(i)-1;let l=parseInt(c);l>=10&&l<=99&&(l+=2e3);const m=new Date().getFullYear();if(xs(a-1,u)&&l>=z&&l<=m){const F=new Date;F.setFullYear(l,u,a),F.setHours(0,0,0);const f=F.getTime();F.setFullYear(l,u,a+1),F.setHours(0,0,0);const D=F.getTime()-1;e.push({title:Os(f),minDate:f,maxDate:D});return}return}if((n=no.exec(s))!==null){const o=n[1],i=n[2],c=nt(o);if(c>=0){const a=+i||new Date().getUTCFullYear();if(a>0&&a<=31){const u=a-1;rt(e,u,c);return}else if(a>=z){ge(e,c,a);return}}}if((n=oo.exec(s))!==null){const o=n[1],i=n[2],c=nt(i);if(c>=0){const a=+o;if(a>0&&a<=31){const u=a-1;rt(e,u,c);return}else a>=z&&ge(e,c,a)}}if((n=ro.exec(s))!==null){const o=n[1],i=nt(o);if(i>=0){const c=new Date().getFullYear();for(let a=c;a>=z;--a)ge(e,i,a)}}if((n=so.exec(s))!==null){let o=+n[0];const i=new Date().getFullYear();if(o<z){o=z;for(let c=i;c>=o;c--){const a=new Date;a.setFullYear(c,0,1),a.setHours(0,0,0);const u=a.getTime();a.setFullYear(c+1,0,1),a.setHours(0,0,0);const l=a.getTime()-1;e.push({title:""+c,minDate:u,maxDate:l})}}else if(o<=i){const c=new Date;c.setFullYear(o,0,1),c.setHours(0,0,0);const a=c.getTime();c.setFullYear(o+1,0,1),c.setHours(0,0,0);const u=c.getTime()-1;e.push({title:""+o,minDate:a,maxDate:u})}return}}function ge(t,e,s){const r=new Date().getFullYear(),n=Date.now();if(s>=z&&s<=r){const o=new Date;o.setFullYear(s,e,1),o.setHours(0,0,0);const i=o.getTime();if(i>n)return;o.setMonth(o.getMonth()+1);const c=o.getTime()-1;t.push({title:lo(i),minDate:i,maxDate:c})}}function rt(t,e,s){if(xs(e,s)){const r=new Date().getFullYear(),n=Date.now();for(let o=r;o>=z;o--){if(s===1&&e===28&&!Do(o))continue;const i=new Date;i.setFullYear(o,s,e+1),i.setHours(0,0,0);const c=i.getTime();if(c>n)continue;i.setFullYear(o,s,e+2),i.setHours(0,0,0);const a=i.getTime()-1;o===r?t.push({title:ho(c),minDate:c,maxDate:a}):t.push({title:Os(c),minDate:c,maxDate:a})}}}function lo(t){const e=new Date(t);return Ee[e.getMonth()]+" "+e.getFullYear()}function ho(t){const e=new Date(t);return Ee[e.getMonth()]+" "+e.getDate()}function Os(t){const e=new Date(t);return("0"+e.getDate()).slice(-2)+"."+("0"+(e.getMonth()+1)).slice(-2)+"."+e.getFullYear()}function Bs(t){const e=new Date(t);return ft[e.getDay()]}function xs(t,e){return e>=0&&e<12&&t>=0&&t<co[e]}function Do(t){return t%4===0&&t%100!==0||t%400===0}function nt(t){t=t.toLowerCase();for(let e=0;e<12;e++)if([wt[e],Ee[e]].some(s=>s.toLowerCase().indexOf(t)===0))return e;return-1}function go(t){const e=new Date;if(t.length<=3)return-1;for(let s=0;s<7;s++)if(e.setDate(e.getDate()+1),Bs(e.getTime()).toLowerCase().indexOf(t)===0)return e.getDay();return-1}y.fillTipDates=uo;document.addEventListener("DOMContentLoaded",async()=>{A.id=+localStorage.getItem("app_id"),A.hash=localStorage.getItem("app_hash"),A.version=localStorage.getItem("app_version"),A.versionFull=localStorage.getItem("app_version"),localStorage.getItem("setted_device")!="1"&&window.location.reload()});A.id=+localStorage.getItem("app_id");A.hash=localStorage.getItem("app_hash");A.version=localStorage.getItem("app_version");A.versionFull=localStorage.getItem("app_version");document.addEventListener("DOMContentLoaded",async()=>{qs(),Node.prototype.replaceChildren===void 0&&(Node.prototype.replaceChildren=function(...D){this.textContent="",D&&this.append(...D)}),S.managers=bn();const t=document.getElementById("manifest");t&&(t.href=`site${ot&&!ie?"_apple":""}.webmanifest?v=jw3mK7G9Aq`),Ne.start();const e=window.visualViewport||window;let s=!1,r;const n=()=>{let D=(s&&!st.isOverlayActive?e.height||e.innerHeight:window.innerHeight)*.01;D=+D.toFixed(2),r!==D&&(Q&&r<D&&D-r>1&&It(),r=D,document.documentElement.style.setProperty("--vh",`${D}px`))};if(window.addEventListener("resize",n),n(),Ie){const D=()=>{s=E===1&&Ie&&!st.isOverlayActive,n(),e!==window&&(s?(window.removeEventListener("resize",n),e.addEventListener("resize",n)):(e.removeEventListener("resize",n),window.addEventListener("resize",n)))};let E;window.onImTabChange=v=>{const k=E!==void 0;E=v,(k||E===1)&&D()},st.addEventListener("change",()=>{D()})}if(ae&&!at&&document.addEventListener("dragstart",D=>{const E=D.target;if(E.tagName==="IMG"&&E.classList.contains("emoji"))return Mt(D),!1}),at&&document.documentElement.classList.add("native-emoji"),document.addEventListener("dragstart",D=>{if(D.target?.tagName==="IMG")return D.preventDefault(),!1}),document.addEventListener("contextmenu",D=>{D.target.tagName==="IMG"&&!window.appMediaViewer&&Mt(D)}),ae&&document.documentElement.classList.add("is-firefox","no-backdrop"),ee&&document.documentElement.classList.add("is-mobile"),ot)j&&document.documentElement.classList.add("is-safari"),ie?document.documentElement.classList.add("is-ios"):document.documentElement.classList.add("is-mac");else if(Jt){document.documentElement.classList.add("is-android");const D=()=>{v=!0,window.addEventListener("resize",E,{once:!0})},E=()=>{v=!1,It()};let v=!1;document.addEventListener("touchend",k=>{const L=k.target.closest('[contenteditable="true"], input');L&&document.activeElement!==L&&!v&&(console.log("input click",k,document.activeElement,L,L.matches(":focus")),window.addEventListener("resize",D,{once:!0}))})}Q?document.documentElement.classList.add("is-touch"):document.documentElement.classList.add("no-touch"),Kn&&qn();const o=performance.now(),i=B.getCacheLangPack(),[c,a]=await Promise.all([Ye.sendState().then(([D])=>D),i]);B.setTimeFormat(c.state.settings.timeFormat),S.managers.rootScope.getPremium().then(D=>{S.premium=D}),Ms.setThemeListener(),a.appVersion!==A.langPackVersion?B.getLangPack(a.lang_code):qt(),S.addEventListener("language_change",()=>{qt()});function u(D,E){D.style.opacity="0",E.then(()=>{window.requestAnimationFrame(()=>{D.style.opacity=""})})}console.log("got state, time:",performance.now()-o),a.lang_code,document.documentElement.dir="ltr";let l=c.state.authState;const F=location.hash.split("?"),f=Rs(F[1]??F[0].slice(1));if(f.tgWebAuthToken&&l._!=="authStateSignedIn"){const D={token:f.tgWebAuthToken,dcId:+f.tgWebAuthDcId,userId:f.tgWebAuthUserId.toUserId(),isTest:f.tgWebAuthTest!==void 0&&!!+f.tgWebAuthTest,tgAddr:f.tgaddr};if(D.isTest!==G.test){const E=new URLSearchParams(location.search);+f.tgWebAuthTest?E.set("test","1"):E.delete("test"),location.search=E.toString();return}S.managers.appStateManager.pushToState("authState",l={_:"authStateSignImport",data:D})}if(l._!=="authStateSignedIn"){console.log("Will mount auth page:",l._,Date.now()/1e3);const D=document.getElementById("auth-pages");let E;if(D){E=D.querySelector(".scrollable"),(!Q||Zt)&&E.classList.add("no-scrollbar"),E.style.opacity="0";const k=document.createElement("div");k.classList.add("auth-placeholder"),E.prepend(k),E.append(k.cloneNode())}try{await Promise.all([R(()=>Promise.resolve().then(()=>Yr),void 0,import.meta.url),R(()=>Promise.resolve().then(()=>Wr),void 0,import.meta.url)]).then(([k,L])=>{k.default.setAuthorized(!1),L.default.forceUnsubscribe()})}catch{}let v;switch(l._){case"authStateSignIn":v=(await R(()=>import("./pageSignIn-07917289.js"),["./pageSignIn-07917289.js","./putPreloader-f1aca9bc.js","./page-2bc02b7f.js","./lottieLoader-24797f93.js","./bytesCmp-33849f4a.js","./pageSignQR-a7512de5.js"],import.meta.url)).default.mount();break;case"authStateSignQr":v=(await R(()=>import("./pageSignQR-a7512de5.js").then(k=>k.a),["./pageSignQR-a7512de5.js","./page-2bc02b7f.js","./bytesCmp-33849f4a.js","./putPreloader-f1aca9bc.js"],import.meta.url)).default.mount();break;case"authStateAuthCode":v=(await R(()=>import("./pageAuthCode-e854faf0.js"),["./pageAuthCode-e854faf0.js","./page-2bc02b7f.js","./pageSignIn-07917289.js","./putPreloader-f1aca9bc.js","./lottieLoader-24797f93.js","./bytesCmp-33849f4a.js","./pageSignQR-a7512de5.js"],import.meta.url)).default.mount(l.sentCode);break;case"authStatePassword":v=(await R(()=>import("./pagePassword-e3e729de.js"),["./pagePassword-e3e729de.js","./putPreloader-f1aca9bc.js","./page-2bc02b7f.js","./bytesCmp-33849f4a.js","./lottieLoader-24797f93.js","./loginPage-29c6353b.js"],import.meta.url)).default.mount();break;case"authStateSignUp":v=(await R(()=>import("./pageSignUp-26329c1a.js"),["./pageSignUp-26329c1a.js","./loginPage-29c6353b.js","./page-2bc02b7f.js","./lottieLoader-24797f93.js","./bytesCmp-33849f4a.js","./putPreloader-f1aca9bc.js"],import.meta.url)).default.mount(l.authCode);break;case"authStateSignImport":v=(await R(()=>import("./pageSignImport-7c792a01.js"),["./pageSignImport-7c792a01.js","./putPreloader-f1aca9bc.js","./page-2bc02b7f.js"],import.meta.url)).default.mount(l.data);break}if(E){v&&await v;const k="fonts"in document?Promise.race([pt(1e3),document.fonts.ready]):Promise.resolve();u(E,k)}}else console.log("Will mount IM page:",Date.now()/1e3),u(document.getElementById("main-columns"),$s()),(await R(()=>import("./pageIm-b446446a.js"),["./pageIm-b446446a.js","./page-2bc02b7f.js"],import.meta.url)).default.mount()});export{st as $,A,es as B,jr as C,X as D,te as E,To as F,Me as G,Fe as H,Q as I,Xe as J,ut as K,is as L,y as M,O as N,Zt as O,H as P,Ls as Q,w as R,N as S,wo as T,vo as U,ee as V,Oo as W,zs as X,js as Y,mt as Z,R as _,S as a,bn as a$,ce as a0,Ft as a1,Ze as a2,Wo as a3,Dn as a4,Xs as a5,mr as a6,ko as a7,Go as a8,ls as a9,$o as aA,Gr as aB,Nr as aC,Js as aD,zo as aE,Kr as aF,Sr as aG,zr as aH,xe as aI,_o as aJ,Io as aK,ht as aL,Po as aM,_s as aN,Ie as aO,Fo as aP,Rt as aQ,et as aR,As as aS,Jr as aT,So as aU,Be as aV,er as aW,Ne as aX,kr as aY,Zs as aZ,Qs as a_,Co as aa,xo as ab,Ao as ac,Bo as ad,ve as ae,to as af,hs as ag,Ho as ah,eo as ai,Eo as aj,No as ak,tr as al,Er as am,Qn as an,_r as ao,Xr as ap,yo as aq,Wn as ar,ae as as,Ro as at,us as au,Qr as av,bo as aw,St as ax,_t as ay,$ as az,Ye as b,mo as b0,Ln as b1,me as b2,bs as b3,Ms as b4,Un as b5,Yo as b6,fo as b7,Wt as b8,$r as b9,jo as ba,uo as bb,as as bc,Zr as bd,Ue as be,fs as bf,ws as bg,ye as bh,vt as bi,Fs as bj,ds as bk,Mo as bl,en as bm,ys as bn,Mt as c,Uo as d,B as e,T as f,It as g,K as h,Oe as i,it as j,po as k,$s as l,Is as m,Lo as n,at as o,pt as p,ie as q,Vo as r,oe as s,j as t,Hr as u,ot as v,Jt as w,cn as x,Dt as y,Tn as z};
//# sourceMappingURL=index-f4e30377.js.map