"use strict";function Shuffle(t){return t.map(t=>({value:t,sort:Math.random()})).sort((t,e)=>t.sort-e.sort).map(({value:t})=>t)}function NoConnection(){document.title="😨 No Internet connection",$(document.body).html(`<div class="d-flex align-items-center justify-content-center vh-100 system">\n<div class="alert alert-danger fs-2" style="app-region: drag;">${document.title}</div>\n</div>`).on("contextmenu",".system",function(t){t.preventDefault(),UP.AppMenu()})}const link={ru:t=>`Для продолжения пользования приложением,&nbsp;необходимо активировать ваш IP-адрес. Пожалуйста,&nbsp;<a href="${t}" target="_blank" title="Alt + Клик = скопировать в буфер обмена">перейдите по ссылке</a>.`,en:t=>`To continue using the app,&nbsp;you need to activate your IP address. Please,&nbsp;<a href="${t}" target="_blank" title="Alt + Click = copy to clipboard">follow the link</a>.`},rus="ru"===localStorage.getItem("language"),prev=localStorage.getItem("pivot"),fetch_init=Object.freeze({mode:"no-cors",cache:"reload",credentials:"omit",referrerPolicy:"no-referrer"}),app=Vue.createApp({data:()=>({activation_required:rus?"Необходима активация":"Activation is required",activation:""})});("1"===localStorage.getItem("dark")||matchMedia("(prefers-color-scheme: dark)").matches)&&document.documentElement.setAttribute("data-bs-theme","dark"),navigator.onLine?($(document).on("click","a[target=_blank]",function(t){(t.altKey||t.metaKey)&&(UP.Text2Clipboard($(this).attr("href")),t.preventDefault())}),fetch("https://cloudflare-dns.com/dns-query?name=pivot.sender.services&type=txt",Object.assign({signal:AbortSignal.timeout(5200),headers:{accept:"application/dns-json"}},fetch_init)).catch(()=>fetch("https://dns.google/resolve?name=pivot.sender.services&type=txt",Object.assign({signal:AbortSignal.timeout(5200)},fetch_init))).then(t=>t.ok?t.json():Promise.reject(t)).then(({Answer:[{data:t}]})=>t.replace(/"/g,"").split(","),()=>["ru1","nl3","am1","de1","in1"]).then(async function(t){const e=(localStorage.getItem("pivot_exclude")??"").split(",").map(t=>t.trim()),n=Shuffle(t).filter(t=>!e.includes(t)),a=n.indexOf(prev);n.length<1&&(n.push(...t),localStorage.removeItem("pivot_exclude")),localStorage.setItem("pivots",n.join(",")),a>-1&&(n.splice(a,1),n.unshift(prev));for(const t of n){const e=`https://${t}.sender.services:3110/`,n=Object.assign({signal:AbortSignal.timeout(5200)},fetch_init);if(await fetch(e,n).then(async function(t){if(403!==t.status)return!0;const{activation:n}=await t.json();if(!n)return!1;$(document.body).html('<section class="d-flex flex-column align-items-center justify-content-center vh-100"><h2>{{activation_required}}</h2><p class="m-2" v-html="activation"></p></section>');const a=app.mount("body");return a.activation=rus?link.ru(n):link.en(n),new Promise(function(t){const n=Object.assign({headers:{"X-Skip-Proxy":"7"}},fetch_init),i=setInterval(async function(){const o=await fetch(e,n).then(t=>403!==t.status||t.json(),()=>({}));if(!0===o)return clearInterval(i),t(!0);o?.activation&&(a.activation=rus?link.ru(o.activation):link.en(o.activation))},6e4)})},()=>null))return UP.SetLanguage(rus?"ru":"en"),localStorage.setItem("pivot",t),void location.replace("window.html")}NoConnection()})):NoConnection();
