/* esm.sh - @repobit/dex-utils@1.3.0 */
import P from"/js-cookie@^3.0.5?target=es2022";var N=P;N.has=function(n){let t=this.get(n);return t!==""&&typeof t<"u"};var h=N;var x=class{country;language;locale;name;queryParams;environment;constructor(t,i,r){this.locale=t,this.name=i,this.environment=r,this.country=this.locale.split("-")[1],this.language=this.locale.split("-")[0],this.queryParams=this.getQueryParams()}getQueryParams(){return new URLSearchParams(window.location.search)}getParamValue(t){return this.queryParams.get(t)}};import{Constants as c}from"/@repobit/dex-constants@^1.1.0?target=es2022";var v=(n,t,i)=>{"use strict";let r=" ua-",a=/\s*([\-\w ]+)[\s\/\:]([\d_]+\b(?:[\-\._\/]\w+)*)/,p=/([\w\-\.]+[\s\/][v]?[\d_]+\b(?:[\-\._\/]\w+)*)/g,E=/\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/,y=/\bsilk-accelerated=true\b/,k=/\bfluidapp\b/,U=/(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/,C=/(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/,G=/(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/,b={parse:function(o,f){let e={};if(f&&(e.standalone=f),o=(""+o).toLowerCase(),!o)return e;let s,u,g=o.split(/[()]/);for(let l=0,L=g.length;l<L;l++)if(l%2){let _=g[l].split(";");for(s=0,u=_.length;s<u;s++)if(a.exec(_[s])){let d=RegExp.$1.split(" ").join("_"),A=RegExp.$2;(!e[d]||parseFloat(e[d])<parseFloat(A))&&(e[d]=A)}}else{let _=g[l].match(p);if(_)for(s=0,u=_.length;s<u;s++){let d=_[s].split(/[\/\s]+/);d.length&&d[0]!=="mozilla"&&(e[d[0].split(" ").join("_")]=d.slice(1).join("-"))}}if(C.exec(o))e.mobile=RegExp.$1,E.exec(o)&&(delete e[e.mobile],e.blackberry=e.version||RegExp.$3||RegExp.$2||RegExp.$1,RegExp.$1?e.mobile="blackberry":e.version==="0.0.1"&&(e.blackberry="7.1.0.0"));else if(G.exec(o)){e.game=RegExp.$1;let l=e.game.split(" ").join("_");e.version&&!e[l]&&(e[l]=e.version)}else U.exec(o)&&(e.desktop=RegExp.$1);return e.intel_mac_os_x?(e.mac_os_x=e.intel_mac_os_x.split("_").join("."),delete e.intel_mac_os_x):e.cpu_iphone_os?(e.ios=e.cpu_iphone_os.split("_").join("."),delete e.cpu_iphone_os):e.cpu_os?(e.ios=e.cpu_os.split("_").join("."),delete e.cpu_os):e.mobile==="iphone"&&!e.ios&&(e.ios="1"),e.opera&&e.version?(e.opera=e.version,delete e.blackberry):y.exec(o)?e.silk_accelerated=!0:k.exec(o)&&(e.fluidapp=e.version),e.edge&&(delete e.applewebkit,delete e.safari,delete e.chrome,delete e.android),e.applewebkit?(e.webkit=e.applewebkit,delete e.applewebkit,e.opr&&(e.opera=e.opr,delete e.opr,delete e.chrome),e.safari&&(e.chrome||e.crios||e.fxios||e.opera||e.silk||e.fluidapp||e.phantomjs||e.mobile&&!e.ios?(delete e.safari,e.vivaldi&&delete e.chrome):e.version&&!e.rim_tablet_os?e.safari=e.version:e.safari={419:"2.0.4",417:"2.0.3",416:"2.0.2",412:"2.0",312:"1.3",125:"1.2",85:"1.0"}[parseInt(e.safari,10)]||e.safari)):e.msie||e.trident?(e.opera||(e.ie=e.msie||e.rv),delete e.msie,delete e.android,e.windows_phone_os?(e.windows_phone=e.windows_phone_os,delete e.windows_phone_os):(e.mobile==="wpdesktop"||e.mobile==="xblwp7"||e.mobile==="zunewp7")&&(e.mobile="windows desktop",e.windows_phone=+e.ie<9?"7.0":+e.ie<10?"7.5":"8.0",delete e.windows_nt)):(e.gecko||e.firefox)&&(e.gecko=e.rv),e.rv&&delete e.rv,e.version&&delete e.version,e},format:function(o){function f(s,u){s=s.split(".").join("-");let g=r+s;if(typeof u=="string"){u=u.split(" ").join("_").split(".").join("-");let l=u.indexOf("-");for(;l>0;)g+=r+s+"-"+u.substring(0,l),l=u.indexOf("-",l+1);g+=r+s+"-"+u}return g}let e="";for(let s in o)s&&o.hasOwnProperty(s)&&(e+=f(s,o[s]));return e},encode:function(o){let f="";for(let e in o)e&&o.hasOwnProperty(e)&&(f&&(f+="&"),f+=encodeURIComponent(e)+"="+encodeURIComponent(o[e]));return f},userAgent:{},ua:{}};b.userAgent=b.ua=b.parse(t,i);let R=b.format(b.ua)+" js";return n.className?n.className=n.className.replace(/\bno-js\b/g,"")+R:n.className=R.substr(1),b},O=v(document.documentElement,navigator.userAgent,navigator.standalone);var m=class{static cssuaUserAgent=O.userAgent;static get windows(){return"Windows"}static get macos(){return"Mac/iOS"}static get ios(){return"ios"}static get android(){return"android"}static get linux(){return"Linux"}static get edge(){return"edge"}static get chrome(){return"chrome"}static get firefox(){return"firefox"}static get safari(){return"safari"}static get opera(){return"opera"}static get ie(){return"ie"}static get vivaldi(){return"vivaldi"}static get isWindows(){return this.cssuaUserAgent.desktop==="windows"}static get isMacos(){return this.cssuaUserAgent.desktop==="macintosh"}static get isLinux(){return this.cssuaUserAgent.desktop==="linux"}static get isUnix(){return this.cssuaUserAgent.desktop==="unix"}static get isAndroid(){return this.cssuaUserAgent.mobile==="android"}static get isIos(){return this.cssuaUserAgent.mobile==="iphone"||this.cssuaUserAgent.mobile==="ipad"}static get isDesktop(){return this.isWindows||this.isMacos}static get isMobile(){return this.isAndroid||this.isIos}static get isEdge(){return this.cssuaUserAgent.edge}static get isChrome(){return this.cssuaUserAgent.chrome}static get isFirefox(){return this.cssuaUserAgent.firefox}static get isSafari(){return this.cssuaUserAgent.safari}static get isOpera(){return this.cssuaUserAgent.opera}static get isVivaldi(){return this.cssuaUserAgent.vivaldi}static get isIe(){return this.cssuaUserAgent.ie}static get os(){if(this.isWindows)return this.windows;if(this.isMacos)return this.macos;if(this.isAndroid)return this.android;if(this.isIos)return this.ios;if(this.isLinux||this.isUnix)return this.linux}static get browser(){if(this.isEdge)return this.edge;if(this.isChrome)return this.chrome;if(this.isFirefox)return this.firefox;if(this.isSafari)return this.safari;if(this.isOpera)return this.opera;if(this.isVivaldi)return this.vivaldi;if(this.isIe)return this.ie}};var w=class{static _info=this.staticInitialise();static _fingerprint=this.getFingerprint();static _country=this.getGeolocation();static _locale=this.getUserLocale();static async staticInitialise(){if(!h.has(c.LOGIN_LOGGED_USER_EXPIRY_COOKIE_NAME))return null;try{let t=await fetch(`${c.PUBLIC_URL_ORIGIN}/bin/login/userInfo.json`);return t.ok?(await t.json()).result:null}catch{return null}}static async getFingerprint(){let t=localStorage.getItem(c.FINGERPRINT_LOCAL_STORAGE_NAME);if(t)return t;let i=await this._info;if(i)return localStorage.setItem(c.FINGERPRINT_LOCAL_STORAGE_NAME,i.fingerprint),i.fingerprint;if(!h.has(c.NO_FINGERPRINT_COOKIE_NAME)&&m.isWindows)try{let a=await fetch(`${c.WWW_ONLY_ORIGIN}/site/Main/dummyPost?${Math.random()}`,{method:"POST",headers:{"Content-type":"application/x-www-form-urlencoded",Pragma:"no-cache","Cache-Control":"no-store, no-cache, must-revalidate, max-age=0",Expires:"Tue, 01 Jan 1971 02:00:00 GMT",BDUS_A312C09A2666456D9F2B2AA5D6B463D6:"check.bitdefender"}});if(a.ok&&a.headers.has(c.FINGERPRINT_HEADER)){let p=a.headers.get(c.FINGERPRINT_HEADER);return localStorage.setItem(c.FINGERPRINT_LOCAL_STORAGE_NAME,p),p}else h.set(c.NO_FINGERPRINT_COOKIE_NAME,"true",{expires:1})}catch{}return null}static async getGeolocation(){try{let t=await fetch(`${c.PUBLIC_URL_ORIGIN}/geoip`);if(!t.ok)return"us";let i=await t.json();return i.error_code?"us":i.country.toLowerCase()}catch{return"us"}}static async getUserLocale(){let t=await this._country;try{return(await(await fetch(`${c.WWW_ONLY_ORIGIN}/p-api/v1/countries/${t.toUpperCase()}/locales`)).json())[0].locale.toLowerCase()}catch{return"en-us"}}static async login(){let t=sessionStorage.getItem(c.LOGIN_ATTEMPT_SESSION_STORAGE_KEY),i=await this._info,r=Number(h.get(c.LOGIN_LOGGED_USER_EXPIRY_COOKIE_NAME))||0;if(!t&&!i&&r>Date.now()){sessionStorage.setItem(c.LOGIN_ATTEMPT_SESSION_STORAGE_KEY,"true");let a=new URL(`${c.PUBLIC_URL_ORIGIN}${c.LOGIN_ENDPOINT}`);a.searchParams.set("origin",`${window.location.pathname}${window.location.search}`),window.location.href=a.href}}static get info(){return this._info}static get fingerprint(){return this._fingerprint}static get country(){return this._country}static get locale(){return this._locale}};function T(n,t={}){return new Promise((i,r)=>{if(document.querySelector(`head > script[src="${n}"]`))i();else{let a=document.createElement("script");a.src=n;for(let p in t)a.setAttribute(p,t[p]);a.onload=()=>i(),a.onerror=r,document.head.append(a)}})}function D(n,t=250){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{n(...r),i=!1},t))}}function $(n,t=250,i=!1){let r=null;return(...a)=>{let p=()=>{r=null,i||n(...a)},E=i&&!r;clearTimeout(r),r=setTimeout(p,t),E&&n(...a)}}var I=window;I.BD=I.BD||{};I.BD.Cookies=h;I.BD.User=w;I.BD.UserAgent=m;export{h as Cookies,x as Page,w as User,m as UserAgent,$ as debounce,T as loadScript,D as throttle};
//# sourceMappingURL=dex-utils.mjs.map