-
Notifications
You must be signed in to change notification settings - Fork 0
/
default-uiweb_node_modules_walletconnect_browser-utils_dist_esm_index_js.js.map
1 lines (1 loc) · 23.1 KB
/
default-uiweb_node_modules_walletconnect_browser-utils_dist_esm_index_js.js.map
1
{"version":3,"file":"default-uiweb_node_modules_walletconnect_browser-utils_dist_esm_index_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAiE;AACF;AACtB;AAClC;AACP,WAAW,sDAAM;AACjB;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO,sBAAsB,wEAA2B;AACjD,6BAA6B,+EAAkC;AAC/D,2BAA2B,6EAAgC;AAC3D,oBAAoB,sEAAyB;AAC7C,4BAA4B,8EAAiC;AAC7D,qBAAqB,uEAA0B;AAC/C,2BAA2B,6EAAgC;AAC3D,oBAAoB,sEAAyB;AAC7C,yBAAyB,2EAA8B;AACvD,kBAAkB,oEAAuB;AACzC,+BAA+B,iFAAoC;AACnE,wBAAwB,0EAA6B;AACrD;AACP,WAAW,6EAAgC;AAC3C;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjD0B;AACH;AACC;AACC;AACE;AAC3B;;;;;;;;;;;;;ACLqD;AAC9C,sBAAsB,mEAAsB;AAC5C,0BAA0B,uEAA0B;AAC3D;;;;;;;;;;;;;;;ACH0D;AACd;AACrC;AACP,gBAAgB,wDAAiB;AACjC,kBAAkB,yDAAe;AACjC;AACA;AACA;AACA;AACO;AACP;AACA;AACA,kBAAkB,yDAAe;AACjC;AACA;AACA;AACA,iBAAiB,oDAAa;AAC9B;AACA;AACO;AACP,kBAAkB,yDAAe;AACjC;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACzBmC;AAC5B;AACA;AACP;AACA;AACA,aAAa,oBAAoB,UAAU,WAAW;AACtD;AACA,iBAAiB,eAAe,EAAE,0CAA0C,SAAS,WAAW;AAChG;AACA;AACO;AACP;AACA,IAAI,gDAAQ,oDAAoD,WAAW,gBAAgB;AAC3F;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACxBA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvBO;AACP;AACA,gEAAgE,aAAa;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;;;;;;;ACda;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB,GAAG,8BAA8B,GAAG,iBAAiB,GAAG,wBAAwB,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,2BAA2B,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,4BAA4B,GAAG,qBAAqB;AACzT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,uBAAuB;AACvB;;;;;;;AC3Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yBAAyB;AACzB,yBAAyB,mBAAO,CAAC,KAA+B;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;;;;;;;;;;;;;;;;;;;;ACjGA,sBAAsB,SAAI,IAAI,SAAI;AAClC,kDAAkD,QAAQ;AAC1D,yCAAyC,QAAQ;AACjD,yDAAyD,QAAQ;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACsB;AACvB;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA,CAAC;AACmB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC8B;AAC/B;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,CAAC;AACkB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC0B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,0DAA0D,YAAY;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,wBAAwB,OAAO,oBAAoB,OAAO;AAC1D,iCAAiC,OAAO;AACxC;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA","sources":["webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/browser.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/index.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/json.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/local.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/mobile.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/dist/esm/registry.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/node_modules/@walletconnect/safe-json/dist/esm/index.js","webpack:///../../uiweb/node_modules/@walletconnect/browser-utils/node_modules/@walletconnect/window-getters/dist/cjs/index.js","webpack:///../../uiweb/node_modules/@walletconnect/window-metadata/dist/cjs/index.js","webpack:///../../uiweb/node_modules/detect-browser/es/index.js"],"sourcesContent":["import * as windowMetadata from \"@walletconnect/window-metadata\";\nimport * as windowGetters from \"@walletconnect/window-getters\";\nimport { detect, } from \"detect-browser\";\nexport function detectEnv(userAgent) {\n return detect(userAgent);\n}\nexport function detectOS() {\n const env = detectEnv();\n return env && env.os ? env.os : undefined;\n}\nexport function isAndroid() {\n const os = detectOS();\n return os ? os.toLowerCase().includes(\"android\") : false;\n}\nexport function isIOS() {\n const os = detectOS();\n return os\n ? os.toLowerCase().includes(\"ios\") ||\n (os.toLowerCase().includes(\"mac\") && navigator.maxTouchPoints > 1)\n : false;\n}\nexport function isMobile() {\n const os = detectOS();\n return os ? isAndroid() || isIOS() : false;\n}\nexport function isNode() {\n const env = detectEnv();\n const result = env && env.name ? env.name.toLowerCase() === \"node\" : false;\n return result;\n}\nexport function isBrowser() {\n const result = !isNode() && !!getNavigator();\n return result;\n}\nexport const getFromWindow = windowGetters.getFromWindow;\nexport const getFromWindowOrThrow = windowGetters.getFromWindowOrThrow;\nexport const getDocumentOrThrow = windowGetters.getDocumentOrThrow;\nexport const getDocument = windowGetters.getDocument;\nexport const getNavigatorOrThrow = windowGetters.getNavigatorOrThrow;\nexport const getNavigator = windowGetters.getNavigator;\nexport const getLocationOrThrow = windowGetters.getLocationOrThrow;\nexport const getLocation = windowGetters.getLocation;\nexport const getCryptoOrThrow = windowGetters.getCryptoOrThrow;\nexport const getCrypto = windowGetters.getCrypto;\nexport const getLocalStorageOrThrow = windowGetters.getLocalStorageOrThrow;\nexport const getLocalStorage = windowGetters.getLocalStorage;\nexport function getClientMeta() {\n return windowMetadata.getWindowMetadata();\n}\n//# sourceMappingURL=browser.js.map","export * from \"./browser\";\nexport * from \"./json\";\nexport * from \"./local\";\nexport * from \"./mobile\";\nexport * from \"./registry\";\n//# sourceMappingURL=index.js.map","import * as safeJson from \"@walletconnect/safe-json\";\nexport const safeJsonParse = safeJson.safeJsonParse;\nexport const safeJsonStringify = safeJson.safeJsonStringify;\n//# sourceMappingURL=json.js.map","import { safeJsonParse, safeJsonStringify } from \"./json\";\nimport { getLocalStorage } from \"./browser\";\nexport function setLocal(key, data) {\n const raw = safeJsonStringify(data);\n const local = getLocalStorage();\n if (local) {\n local.setItem(key, raw);\n }\n}\nexport function getLocal(key) {\n let data = null;\n let raw = null;\n const local = getLocalStorage();\n if (local) {\n raw = local.getItem(key);\n }\n data = raw ? safeJsonParse(raw) : raw;\n return data;\n}\nexport function removeLocal(key) {\n const local = getLocalStorage();\n if (local) {\n local.removeItem(key);\n }\n}\n//# sourceMappingURL=local.js.map","import { setLocal } from \"./local\";\nexport const mobileLinkChoiceKey = \"WALLETCONNECT_DEEPLINK_CHOICE\";\nexport function formatIOSMobile(uri, entry) {\n const encodedUri = encodeURIComponent(uri);\n return entry.universalLink\n ? `${entry.universalLink}/wc?uri=${encodedUri}`\n : entry.deepLink\n ? `${entry.deepLink}${entry.deepLink.endsWith(\":\") ? \"//\" : \"/\"}wc?uri=${encodedUri}`\n : \"\";\n}\nexport function saveMobileLinkInfo(data) {\n const focusUri = data.href.split(\"?\")[0];\n setLocal(mobileLinkChoiceKey, Object.assign(Object.assign({}, data), { href: focusUri }));\n}\nexport function getMobileRegistryEntry(registry, name) {\n return registry.filter((entry) => entry.name.toLowerCase().includes(name.toLowerCase()))[0];\n}\nexport function getMobileLinkRegistry(registry, whitelist) {\n let links = registry;\n if (whitelist) {\n links = whitelist.map((name) => getMobileRegistryEntry(registry, name)).filter(Boolean);\n }\n return links;\n}\n//# sourceMappingURL=mobile.js.map","const API_URL = \"https://registry.walletconnect.com\";\nexport function getWalletRegistryUrl() {\n return API_URL + \"/api/v2/wallets\";\n}\nexport function getDappRegistryUrl() {\n return API_URL + \"/api/v2/dapps\";\n}\nexport function formatMobileRegistryEntry(entry, platform = \"mobile\") {\n var _a;\n return {\n name: entry.name || \"\",\n shortName: entry.metadata.shortName || \"\",\n color: entry.metadata.colors.primary || \"\",\n logo: (_a = entry.image_url.sm) !== null && _a !== void 0 ? _a : \"\",\n universalLink: entry[platform].universal || \"\",\n deepLink: entry[platform].native || \"\",\n };\n}\nexport function formatMobileRegistry(registry, platform = \"mobile\") {\n return Object.values(registry)\n .filter(entry => !!entry[platform].universal || !!entry[platform].native)\n .map((entry) => formatMobileRegistryEntry(entry, platform));\n}\n//# sourceMappingURL=registry.js.map","export function safeJsonParse(value) {\n if (typeof value !== \"string\") {\n throw new Error(`Cannot safe json parse value of type ${typeof value}`);\n }\n try {\n return JSON.parse(value);\n }\n catch (_a) {\n return value;\n }\n}\nexport function safeJsonStringify(value) {\n return typeof value === \"string\" ? value : JSON.stringify(value);\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getLocalStorage = exports.getLocalStorageOrThrow = exports.getCrypto = exports.getCryptoOrThrow = exports.getLocation = exports.getLocationOrThrow = exports.getNavigator = exports.getNavigatorOrThrow = exports.getDocument = exports.getDocumentOrThrow = exports.getFromWindowOrThrow = exports.getFromWindow = void 0;\nfunction getFromWindow(name) {\n let res = undefined;\n if (typeof window !== \"undefined\" && typeof window[name] !== \"undefined\") {\n res = window[name];\n }\n return res;\n}\nexports.getFromWindow = getFromWindow;\nfunction getFromWindowOrThrow(name) {\n const res = getFromWindow(name);\n if (!res) {\n throw new Error(`${name} is not defined in Window`);\n }\n return res;\n}\nexports.getFromWindowOrThrow = getFromWindowOrThrow;\nfunction getDocumentOrThrow() {\n return getFromWindowOrThrow(\"document\");\n}\nexports.getDocumentOrThrow = getDocumentOrThrow;\nfunction getDocument() {\n return getFromWindow(\"document\");\n}\nexports.getDocument = getDocument;\nfunction getNavigatorOrThrow() {\n return getFromWindowOrThrow(\"navigator\");\n}\nexports.getNavigatorOrThrow = getNavigatorOrThrow;\nfunction getNavigator() {\n return getFromWindow(\"navigator\");\n}\nexports.getNavigator = getNavigator;\nfunction getLocationOrThrow() {\n return getFromWindowOrThrow(\"location\");\n}\nexports.getLocationOrThrow = getLocationOrThrow;\nfunction getLocation() {\n return getFromWindow(\"location\");\n}\nexports.getLocation = getLocation;\nfunction getCryptoOrThrow() {\n return getFromWindowOrThrow(\"crypto\");\n}\nexports.getCryptoOrThrow = getCryptoOrThrow;\nfunction getCrypto() {\n return getFromWindow(\"crypto\");\n}\nexports.getCrypto = getCrypto;\nfunction getLocalStorageOrThrow() {\n return getFromWindowOrThrow(\"localStorage\");\n}\nexports.getLocalStorageOrThrow = getLocalStorageOrThrow;\nfunction getLocalStorage() {\n return getFromWindow(\"localStorage\");\n}\nexports.getLocalStorage = getLocalStorage;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getWindowMetadata = void 0;\nconst window_getters_1 = require(\"@walletconnect/window-getters\");\nfunction getWindowMetadata() {\n let doc;\n let loc;\n try {\n doc = window_getters_1.getDocumentOrThrow();\n loc = window_getters_1.getLocationOrThrow();\n }\n catch (e) {\n return null;\n }\n function getIcons() {\n const links = doc.getElementsByTagName(\"link\");\n const icons = [];\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const rel = link.getAttribute(\"rel\");\n if (rel) {\n if (rel.toLowerCase().indexOf(\"icon\") > -1) {\n const href = link.getAttribute(\"href\");\n if (href) {\n if (href.toLowerCase().indexOf(\"https:\") === -1 &&\n href.toLowerCase().indexOf(\"http:\") === -1 &&\n href.indexOf(\"//\") !== 0) {\n let absoluteHref = loc.protocol + \"//\" + loc.host;\n if (href.indexOf(\"/\") === 0) {\n absoluteHref += href;\n }\n else {\n const path = loc.pathname.split(\"/\");\n path.pop();\n const finalPath = path.join(\"/\");\n absoluteHref += finalPath + \"/\" + href;\n }\n icons.push(absoluteHref);\n }\n else if (href.indexOf(\"//\") === 0) {\n const absoluteUrl = loc.protocol + href;\n icons.push(absoluteUrl);\n }\n else {\n icons.push(href);\n }\n }\n }\n }\n }\n return icons;\n }\n function getWindowMetadataOfAny(...args) {\n const metaTags = doc.getElementsByTagName(\"meta\");\n for (let i = 0; i < metaTags.length; i++) {\n const tag = metaTags[i];\n const attributes = [\"itemprop\", \"property\", \"name\"]\n .map((target) => tag.getAttribute(target))\n .filter((attr) => {\n if (attr) {\n return args.includes(attr);\n }\n return false;\n });\n if (attributes.length && attributes) {\n const content = tag.getAttribute(\"content\");\n if (content) {\n return content;\n }\n }\n }\n return \"\";\n }\n function getName() {\n let name = getWindowMetadataOfAny(\"name\", \"og:site_name\", \"og:title\", \"twitter:title\");\n if (!name) {\n name = doc.title;\n }\n return name;\n }\n function getDescription() {\n const description = getWindowMetadataOfAny(\"description\", \"og:description\", \"twitter:description\", \"keywords\");\n return description;\n }\n const name = getName();\n const description = getDescription();\n const url = loc.origin;\n const icons = getIcons();\n const meta = {\n description,\n url,\n icons,\n name,\n };\n return meta;\n}\nexports.getWindowMetadata = getWindowMetadata;\n//# sourceMappingURL=index.js.map","var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nvar BrowserInfo = /** @class */ (function () {\n function BrowserInfo(name, version, os) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.type = 'browser';\n }\n return BrowserInfo;\n}());\nexport { BrowserInfo };\nvar NodeInfo = /** @class */ (function () {\n function NodeInfo(version) {\n this.version = version;\n this.type = 'node';\n this.name = 'node';\n this.os = process.platform;\n }\n return NodeInfo;\n}());\nexport { NodeInfo };\nvar SearchBotDeviceInfo = /** @class */ (function () {\n function SearchBotDeviceInfo(name, version, os, bot) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.bot = bot;\n this.type = 'bot-device';\n }\n return SearchBotDeviceInfo;\n}());\nexport { SearchBotDeviceInfo };\nvar BotInfo = /** @class */ (function () {\n function BotInfo() {\n this.type = 'bot';\n this.bot = true; // NOTE: deprecated test name instead\n this.name = 'bot';\n this.version = null;\n this.os = null;\n }\n return BotInfo;\n}());\nexport { BotInfo };\nvar ReactNativeInfo = /** @class */ (function () {\n function ReactNativeInfo() {\n this.type = 'react-native';\n this.name = 'react-native';\n this.version = null;\n this.os = null;\n }\n return ReactNativeInfo;\n}());\nexport { ReactNativeInfo };\n// tslint:disable-next-line:max-line-length\nvar SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;\nvar SEARCHBOT_OS_REGEX = /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\\ Jeeves\\/Teoma|ia_archiver)/;\nvar REQUIRED_VERSION_PARTS = 3;\nvar userAgentRules = [\n ['aol', /AOLShield\\/([0-9\\._]+)/],\n ['edge', /Edge\\/([0-9\\._]+)/],\n ['edge-ios', /EdgiOS\\/([0-9\\._]+)/],\n ['yandexbrowser', /YaBrowser\\/([0-9\\._]+)/],\n ['kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/],\n ['samsung', /SamsungBrowser\\/([0-9\\.]+)/],\n ['silk', /\\bSilk\\/([0-9._-]+)\\b/],\n ['miui', /MiuiBrowser\\/([0-9\\.]+)$/],\n ['beaker', /BeakerBrowser\\/([0-9\\.]+)/],\n ['edge-chromium', /EdgA?\\/([0-9\\.]+)/],\n [\n 'chromium-webview',\n /(?!Chrom.*OPR)wv\\).*Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/,\n ],\n ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/],\n ['phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/],\n ['crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/],\n ['firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/],\n ['fxios', /FxiOS\\/([0-9\\.]+)/],\n ['opera-mini', /Opera Mini.*Version\\/([0-9\\.]+)/],\n ['opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/],\n ['opera', /OPR\\/([0-9\\.]+)(:?\\s|$)/],\n ['ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/],\n ['ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/],\n ['ie', /MSIE\\s(7\\.0)/],\n ['bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/],\n ['android', /Android\\s([0-9\\.]+)/],\n ['ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/],\n ['safari', /Version\\/([0-9\\._]+).*Safari/],\n ['facebook', /FBAV\\/([0-9\\.]+)/],\n ['instagram', /Instagram\\s([0-9\\.]+)/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Mobile/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Gecko\\)$/],\n ['searchbot', SEARCHBOX_UA_REGEX],\n];\nvar operatingSystemRules = [\n ['iOS', /iP(hone|od|ad)/],\n ['Android OS', /Android/],\n ['BlackBerry OS', /BlackBerry|BB10/],\n ['Windows Mobile', /IEMobile/],\n ['Amazon OS', /Kindle/],\n ['Windows 3.11', /Win16/],\n ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],\n ['Windows 98', /(Windows 98)|(Win98)/],\n ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],\n ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],\n ['Windows Server 2003', /(Windows NT 5.2)/],\n ['Windows Vista', /(Windows NT 6.0)/],\n ['Windows 7', /(Windows NT 6.1)/],\n ['Windows 8', /(Windows NT 6.2)/],\n ['Windows 8.1', /(Windows NT 6.3)/],\n ['Windows 10', /(Windows NT 10.0)/],\n ['Windows ME', /Windows ME/],\n ['Open BSD', /OpenBSD/],\n ['Sun OS', /SunOS/],\n ['Chrome OS', /CrOS/],\n ['Linux', /(Linux)|(X11)/],\n ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],\n ['QNX', /QNX/],\n ['BeOS', /BeOS/],\n ['OS/2', /OS\\/2/],\n];\nexport function detect(userAgent) {\n if (!!userAgent) {\n return parseUserAgent(userAgent);\n }\n if (typeof document === 'undefined' &&\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative') {\n return new ReactNativeInfo();\n }\n if (typeof navigator !== 'undefined') {\n return parseUserAgent(navigator.userAgent);\n }\n return getNodeVersion();\n}\nfunction matchUserAgent(ua) {\n // opted for using reduce here rather than Array#first with a regex.test call\n // this is primarily because using the reduce we only perform the regex\n // execution once rather than once for the test and for the exec again below\n // probably something that needs to be benchmarked though\n return (ua !== '' &&\n userAgentRules.reduce(function (matched, _a) {\n var browser = _a[0], regex = _a[1];\n if (matched) {\n return matched;\n }\n var uaMatch = regex.exec(ua);\n return !!uaMatch && [browser, uaMatch];\n }, false));\n}\nexport function browserName(ua) {\n var data = matchUserAgent(ua);\n return data ? data[0] : null;\n}\nexport function parseUserAgent(ua) {\n var matchedRule = matchUserAgent(ua);\n if (!matchedRule) {\n return null;\n }\n var name = matchedRule[0], match = matchedRule[1];\n if (name === 'searchbot') {\n return new BotInfo();\n }\n var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);\n if (versionParts) {\n if (versionParts.length < REQUIRED_VERSION_PARTS) {\n versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length));\n }\n }\n else {\n versionParts = [];\n }\n var version = versionParts.join('.');\n var os = detectOS(ua);\n var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);\n if (searchBotMatch && searchBotMatch[1]) {\n return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);\n }\n return new BrowserInfo(name, version, os);\n}\nexport function detectOS(ua) {\n for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {\n var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];\n var match = regex.exec(ua);\n if (match) {\n return os;\n }\n }\n return null;\n}\nexport function getNodeVersion() {\n var isNode = typeof process !== 'undefined' && process.version;\n return isNode ? new NodeInfo(process.version.slice(1)) : null;\n}\nfunction createVersionParts(count) {\n var output = [];\n for (var ii = 0; ii < count; ii++) {\n output.push('0');\n }\n return output;\n}\n"],"names":[],"sourceRoot":""}