2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
|
(()=>{"use strict";const e="account",t="tt-media-progressive",n="tt-assets",s=("undefined"!=typeof window&&window.innerHeight,Math.round(450),new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory","deleteParticipantHistory"]),new Set(["svg","svgz"]),new Set(["image/png","image/jpeg","image/gif"])),a=new Set(["video/mp4","video/quicktime"]);new Set(["audio/mp3","audio/ogg","audio/wav","audio/mpeg","audio/flac","audio/aac","audio/m4a","audio/mp4","audio/x-m4a"]),new Set([...s,...a]),new Set(["USERNAME_PURCHASE_AVAILABLE","USERNAME_INVALID"]),new Set(["t.me","web.t.me","a.t.me","k.t.me","z.t.me"]),new Set(["AU","BD","CA","CO","EG","HN","IE","IN","JO","MX","MY","NI","NZ","PH","PK","SA","SV","US"]),(-(10n**12n)-777n).toString(),new Set(["USER_CANCELED"]);const i=e=>new Promise(t=>{setTimeout(()=>t(),e)});async function o(e){const t=await r(async()=>{const t=await self.caches.open(n),s=await t.match(e.request);return{cache:t,cached:s}},3e3),{cache:s,cached:a}=t||{};if(s&&a){if(a.ok)return a;await s.delete(e.request)}const i=await fetch(e.request);return i.ok&&s&&s.put(e.request,i.clone()),i}async function r(e,t){let n=!1;try{return await Promise.race([i(t).then(()=>n?void 0:Promise.reject(new Error("TIMEOUT"))),e()])}catch(e){return void console.error(e)}finally{n=!0}}"function"==typeof SuppressedError&&SuppressedError;new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;const c="SharedWorker"in globalThis;Intl,new URL("tg://host").host,(globalThis||window).isTauri,Boolean(globalThis.electron);const l="undefined"!=typeof WorkerGlobalScope&&globalThis.self instanceof WorkerGlobalScope?globalThis.self.name:void 0;function u(t){const n=new URL(t).searchParams.get(e),s=n?Number(n):1;if(s&&!Number.isNaN(s)&&1!==s)return s}if((l?Number(new URLSearchParams(l).get(e)):void 0)||c&&u(globalThis.location.href),"object"==typeof window){const e=new BroadcastChannel("tt-version");e.postMessage({version:"1.0.0"}),e.addEventListener("message",t=>{const{version:n}=t.data;n&&(-1===d("1.0.0",n)&&window.location.reload(),1===d("1.0.0",n)&&e.postMessage({version:"1.0.0"}))})}function d(e,t){return e.startsWith(`${t}-`)?-1:t.startsWith(`${e}-`)?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"case",caseFirst:"upper"})}const f=524288,p=new Map;async function h(e,t){const n=t.url.includes("/download/"),s=await(n?async function(e){const t=u(e);return(await self.clients.matchAll()).find(e=>"window"===e.type&&"top-level"===e.frameType&&u(e.url)===t)}(t.url):self.clients.get(e.clientId));if(!s)return;const a=Date.now().toString(36)+Math.random().toString(36).slice(2),o={};let r=!1;const c=Promise.race([i(6e4).then(()=>r?void 0:Promise.reject(new Error("ERROR_PART_TIMEOUT"))),new Promise((e,t)=>{Object.assign(o,{resolve:e,reject:t})})]);return p.set(a,o),c.catch(()=>{}).finally(()=>{p.delete(a),r=!0}),s.postMessage({type:"requestPart",messageId:a,params:t}),c}self.addEventListener("message",e=>{const{type:t,messageId:n,result:s}=e.data;if("partResponse"===t){const e=p.get(n);e&&e.resolve(s)}});const w=1048576;class g{constructor(){this.queue=[]}push(e){this.queue.push(e)}async pop(){return await this.queue.shift()}get size(){return this.queue.length}}var m=function(e){return e.True="1",e.False="0",e}(m||{});let y=(new Date).valueOf();const v=new Set,S={};function R(e){return e.custom.from_id?e.custom.from_id:e.custom.chat_id||e.custom.channel_id?`-${e.custom.chat_id||e.custom.channel_id}`:void 0}function b(e){if(e.custom.msg_id)return parseInt(e.custom.msg_id,10)}async function M(){const e=new URL(self.registration.scope).origin;return(await self.clients.matchAll({type:"window"})).filter(t=>new URL(t.url).origin===e)}async function I(e){const t=(await M())[0];t&&t.postMessage({type:"playNotificationSound",payload:{id:e}})}function E({chatId:e,messageId:t,body:n,title:s,icon:a,reaction:i,isSilent:o,shouldReplaceHistory:r}){const c=(new Date).valueOf()-y<1e3,l={body:n,data:{chatId:e,messageId:t,reaction:i,count:1,shouldReplaceHistory:r},icon:a||"icon-192x192.png",badge:"icon-192x192.png",tag:String(
|
||
|
|
//# sourceMappingURL=234.f255bcdf884280d7dc10.js.map
|