dashboard-ui/modules/browser.js
2023-08-31 15:30:17 +02:00

1 line
3.7 KiB
JavaScript

define(["exports"],function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var userAgent=navigator.userAgent,match=(ua=(ua=userAgent).toLowerCase(),match=/(edge)[ \/]([\w.]+)/.exec(ua)||/(opera)[ \/]([\w.]+)/.exec(ua)||/(opr)[ \/]([\w.]+)/.exec(ua)||/(chrome)[ \/]([\w.]+)/.exec(ua)||/(safari)[ \/]([\w.]+)/.exec(ua)||/(firefox)[ \/]([\w.]+)/.exec(ua)||[],ua=/(ipad)/.exec(ua)||/(iphone)/.exec(ua)||/(android)/.exec(ua)||[],"edge"===(match=match[1]||"")&&(ua=[""]),{browser:match="opr"===match?"opera":match,platform:ua[0]||""}),ua={},match=(match.browser&&(ua[match.browser]=!0),match.platform&&(ua[match.platform]=!0),userAgent.toLowerCase()),match=(ua.chrome||ua.edge||ua.opera||!match.includes("webkit")||(ua.safari=!0),match.includes("playstation")&&(ua.playstation=!0,ua.tv=!0,match.includes("playstation 4"))&&(ua.ps4=!0),ua.xboxOne=function(userAgentLower){return!!userAgentLower.includes("xbox")||!("undefined"==typeof Windows||!Windows.System)&&"Windows.Xbox"===Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily}(match),ua.tizen=match.includes("tizen")||null!=globalThis.tizen,ua.web0s=match.includes("Web0S".toLowerCase()),ua.netcast=match.includes("netcast"),ua.electron=match.includes("electron"),ua.windows=match.includes("windows"),ua.tizen&&(ua.sdkVersion=function(){var v;if("undefined"!=typeof tizen&&tizen.systeminfo)return v=tizen.systeminfo.getCapability("http://tizen.org/feature/platform.version"),parseFloat(v)}()),ua.tv=function(userAgent){return!!((userAgent=userAgent.toLowerCase()).includes("tv")||userAgent.includes("viera")||userAgent.includes("web0s")||userAgent.includes("zidoo"))}(userAgent),(ua.tv&&match.includes("opr/")||globalThis.location&&(globalThis.location.href||"").toString().toLowerCase().includes("operatv"))&&(ua.tv=!0,ua.operaTv=!0),(ua.xboxOne||ua.playstation||ua.tizen||ua.netcast||ua.web0s||ua.operaTv||match.includes("smarthub"))&&(ua.tv=!0),ua.iOS=ua.ipad||ua.iphone||ua.ipod,ua.iOS||(ua.osx=match.includes("mac os x")),ua.chromecast=ua.chrome&&match.includes("crkey"),!function(browser,userAgent){var userAgentData=navigator.userAgentData;if(userAgentData||(userAgentData={},navigator.userAgentData=userAgentData),null==userAgentData.mobile)try{userAgentData.mobile=function(userAgent){var lower=userAgent.toLowerCase();if(lower.includes("android tv"))return!1;for(var terms=["mobi","ipad","iphone","ipod","silk","kindle fire","opera mini"],i=0,length=terms.length;i<length;i++)if(lower.includes(terms[i]))return!0;return"undefined"!=typeof document&&"ontouchstart"in document.documentElement}(userAgent)}catch(err){console.log("error setting userAgentData.mobile: "+err)}!function(userAgentData,browser){var brands=userAgentData.brands;if(brands||(userAgentData.brands=brands=[]),!brands.length){userAgentData=browser.chrome?"Chrome":browser.edge?"Edge":browser.firefox?"Firefox":browser.opera?"Opera":browser.safari?"Safari":"Web Browser";try{brands.push({brand:userAgentData})}catch(err){console.log("error adding brands: "+err)}if(browser.chrome||browser.opera)try{brands.push({brand:"Chromium"})}catch(err){console.log("error adding brands: "+err)}}}(userAgentData,browser),userAgentData.getHighEntropyValues||(userAgentData.getHighEntropyValues=function(){var info={};return this.android?info.platform="Android":this.iOS?info.platform="iOS":this.ipad?info.platform="iPadOS":this.osx?info.platform="macOS":this.xboxOne?info.platform="Xbox One":this.windows?info.platform="Windows":this.playstation?info.platform="PlayStation":this.web0s||this.netcast?info.platform="LG TV":this.tizen?info.platform="Samsung TV":this.operaTv&&(info.platform="Opera TV"),Promise.resolve(info)}.bind(browser))}(ua,userAgent),ua);_exports.default=match});