@scandit/web-barcode-link
Version:
The Scandit Web Barcode Link package
1,554 lines (1,553 loc) • 121 kB
JavaScript
var Nt = Object.defineProperty;
var Lt = (i, e, t) => e in i ? Nt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var _ = (i, e, t) => (Lt(i, typeof e != "symbol" ? e + "" : e, t), t);
class Dt {
constructor(e) {
this.barcodeLink = e;
}
getConfiguration() {
return { ...this.barcodeLink.configuration };
}
onCancel() {
this.barcodeLink.dispose(), this.barcodeLink.listeners.forEach((e) => {
var t;
(t = e.onCancel) == null || t.call(e);
});
}
onCapture(e, t) {
this.barcodeLink.listeners.forEach((s) => {
var n;
(n = s.onCapture) == null || n.call(s, e, t);
});
}
/**
* @deprecated Use onConnectionStateChanged instead.
*/
onDeviceConnected() {
this.barcodeLink.listeners.forEach((e) => {
var t;
(t = e.onDeviceConnected) == null || t.call(e);
});
}
/**
* @deprecated Use onConnectionStateChanged instead.
*/
onDeviceDisconnected() {
this.barcodeLink.listeners.forEach((e) => {
var t;
(t = e.onDeviceDisconnected) == null || t.call(e);
});
}
onConnectionStateChanged(e) {
this.barcodeLink.listeners.forEach((t) => {
var s;
(s = t.onConnectionStateChanged) == null || s.call(t, e);
});
}
}
var ut = /* @__PURE__ */ ((i) => (i.Unique = "unique", i.Count = "count", i))(ut || {}), dt = /* @__PURE__ */ ((i) => (i.SingleScanning = "singleScanning", i.ContinuousScanning = "continuousScanning", i.SingleListBuilding = "singleListBuilding", i.ContinuousListBuilding = "continuousListBuilding", i))(dt || {}), me = /* @__PURE__ */ ((i) => (i.Express = "express", i.Web = "web", i))(me || {});
class ft {
constructor(e) {
_(this, "configuration", {
barcodeLinkMode: dt.SingleScanning,
licenseKey: "",
listBehavior: ut.Unique,
symbologies: {}
});
_(this, "flow");
_(this, "flowDelegate", new Dt(this));
_(this, "listeners", /* @__PURE__ */ new Set());
this.configuration.licenseKey = e;
}
static forLicenseKey(e) {
return new ft(e);
}
setSymbologies(e) {
return this.configuration.symbologies = e, this;
}
setBarcodeLinkMode(e) {
return this.configuration.barcodeLinkMode = e, this;
}
setBarcodeRegexValidation(e) {
return this.configuration.barcodeRegexValidation = String(e).slice(1, -1), this;
}
setBarcodeTransformations(e) {
return this.configuration.barcodeTransformations = e, this;
}
setPlatform(e) {
switch (e) {
case me.Express:
return delete this.configuration.platform, this;
case me.Web:
return this.configuration.platform = e, this;
}
}
setListBehavior(e) {
return this.configuration.listBehavior = e, this;
}
addListener(e) {
return this.listeners.add(e), this;
}
removeListener(e) {
return this.listeners.delete(e), this;
}
async initialize(e) {
return this.flow = e, this.flow.setDelegate(this.flowDelegate), await this.flow.initialize();
}
dispose() {
var e;
(e = this.flow) == null || e.dispose();
}
}
var Mt = ((i) => (i.EAN13UPCA = "ean13Upca", i.UPCE = "upce", i.EAN8 = "ean8", i.Code39 = "code39", i.Code93 = "code93", i.Code128 = "code128", i.Code11 = "code11", i.Code25 = "code25", i.Codabar = "codabar", i.InterleavedTwoOfFive = "interleavedTwoOfFive", i.MSIPlessey = "msiPlessey", i.QR = "qr", i.DataMatrix = "dataMatrix", i.Aztec = "aztec", i.MaxiCode = "maxicode", i.DotCode = "dotcode", i.KIX = "kix", i.RM4SCC = "rm4scc", i.GS1Databar = "databar", i.GS1DatabarExpanded = "databarExpanded", i.GS1DatabarLimited = "databarLimited", i.PDF417 = "pdf417", i.MicroPDF417 = "microPdf417", i.MicroQR = "microQr", i.Code32 = "code32", i.Lapa4SC = "lapa4sc", i.IATATwoOfFive = "iata2of5", i.MatrixTwoOfFive = "matrix2of5", i.USPSIntelligentMail = "uspsIntelligentMail", i))(Mt || {}), Pt = ((i) => (i.A = "A", i.B = "B", i.C = "C", i))(Pt || {}), Ut = ((i) => (i.Mod10 = "mod10", i.Mod11 = "mod11", i.Mod16 = "mod16", i.Mod43 = "mod43", i.Mod47 = "mod47", i.Mod103 = "mod103", i.Mod10AndMod11 = "mod1110", i.Mod10AndMod10 = "mod1010", i))(Ut || {}), qt = ((i) => (i.None = "none", i.Unknown = "unknown", i.Linked = "linked", i.GS1TypeA = "gs1TypeA", i.GS1TypeB = "gs1TypeB", i.GS1TypeC = "gs1TypeC", i))(qt || {});
const It = ".sdc-barcode-link{position:fixed;top:0;left:0;width:100%;height:100%;height:100dvh;display:grid;background-color:#0000004d;z-index:100}.sdc-barcode-link iframe{max-width:650px;max-height:800px;width:90vw;height:90vh;margin:auto;transform:scale(0);animation:centerPop .3s 50ms ease-out forwards;transition:all .3s}@media screen and (max-width: 700px){.sdc-barcode-link iframe{width:100%;height:100%;max-height:none}}@keyframes centerPop{to{transform:none}}";
class Li {
constructor() {
_(this, "barcodeLinkUrl", "https://barcode-link.scandit.com");
_(this, "onIframeMessageListener", this.onIframeMessage.bind(this));
_(this, "sessionId");
_(this, "popup", null);
_(this, "iframe", null);
_(this, "style", null);
_(this, "delegate");
}
setDelegate(e) {
this.delegate = e;
}
async initialize() {
var e;
this.initStyles(), this.popup = this.createPopup(), this.iframe = this.createIframe({ src: this.barcodeLinkUrl }), this.popup.append(this.iframe), document.body.append(this.popup), this.listenToIframeMessages(), this.sessionId = await new Promise((t) => {
function s(n) {
n.data.type === "loaded" && (window.removeEventListener("message", s), t(n.data.sessionId));
}
window.addEventListener("message", s);
}), this.sendMessage({
type: "configuration",
configuration: (e = this.delegate) == null ? void 0 : e.getConfiguration()
});
}
dispose() {
window.removeEventListener("message", this.onIframeMessageListener), document.head.removeChild(this.style), document.body.removeChild(this.popup), this.popup = null, this.iframe = null, this.style = null;
}
listenToIframeMessages() {
window.addEventListener("message", this.onIframeMessageListener);
}
sendMessage(e) {
var n, c;
const t = new URL(this.barcodeLinkUrl), s = `${t.protocol}//${t.host}`;
(c = (n = this.iframe) == null ? void 0 : n.contentWindow) == null || c.postMessage(e, s);
}
onIframeMessage(e) {
var s, n, c, u, g;
if (e.source !== ((s = this.iframe) == null ? void 0 : s.contentWindow))
return;
const { type: t } = e.data;
switch (t) {
case "cancelled":
(c = (n = this.delegate) == null ? void 0 : n.onCancel) == null || c.call(n);
break;
case "capture":
(g = (u = this.delegate) == null ? void 0 : u.onCapture) == null || g.call(u, e.data.barcodes, e.data.finished);
break;
}
}
createPopup() {
const e = document.createElement("div");
return e.className = "sdc-barcode-link", e;
}
createIframe(e) {
const t = document.createElement("iframe");
return t.src = e.src, t.setAttribute("sandbox", "allow-scripts allow-same-origin"), t.setAttribute("allow", "camera"), t.setAttribute("referrerpolicy", "origin"), t.setAttribute("title", "Barcode Link Plugin"), t;
}
initStyles() {
document.querySelector('style[id="sdc-barcode-link"]') || (this.style = document.createElement("style"), this.style.textContent = It, document.head.append(this.style));
}
}
var V = /* @__PURE__ */ ((i) => (i.MainDeviceReconnected = "mainDeviceReconnected", i.MainDeviceDisconnected = "mainDeviceDisconnected", i.MainDeviceConnectionFailed = "mainDeviceConnectionFailed", i.RemoteDeviceConnected = "remoteDeviceConnected", i.RemoteDeviceDisconnected = "remoteDeviceDisconnected", i))(V || {}), Ft = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ae = { exports: {} };
(function(i, e) {
(function(t, s) {
var n = "1.0.40", c = "", u = "?", g = "function", y = "undefined", T = "object", S = "string", P = "major", r = "model", h = "name", o = "type", a = "vendor", l = "version", O = "architecture", H = "console", p = "mobile", m = "tablet", x = "smarttv", U = "wearable", be = "embedded", ge = 500, ee = "Amazon", K = "Apple", Ve = "ASUS", ze = "BlackBerry", te = "Browser", ie = "Chrome", At = "Edge", se = "Firefox", Y = "Google", We = "Huawei", ye = "LG", ve = "Microsoft", He = "Motorola", G = "Opera", X = "Samsung", Ke = "Sharp", ne = "Sony", ke = "Xiaomi", _e = "Zebra", Ye = "Facebook", Ge = "Chromium OS", Xe = "Mac OS", je = " Browser", Ot = function(w, v) {
var f = {};
for (var E in w)
v[E] && v[E].length % 2 === 0 ? f[E] = v[E].concat(w[E]) : f[E] = w[E];
return f;
}, re = function(w) {
for (var v = {}, f = 0; f < w.length; f++)
v[w[f].toUpperCase()] = w[f];
return v;
}, Je = function(w, v) {
return typeof w === S ? I(v).indexOf(I(w)) !== -1 : !1;
}, I = function(w) {
return w.toLowerCase();
}, Rt = function(w) {
return typeof w === S ? w.replace(/[^\d\.]/g, c).split(".")[0] : s;
}, Ee = function(w, v) {
if (typeof w === S)
return w = w.replace(/^\s\s*/, c), typeof v === y ? w : w.substring(0, ge);
}, j = function(w, v) {
for (var f = 0, E, q, N, k, d, L; f < v.length && !d; ) {
var Ce = v[f], Ze = v[f + 1];
for (E = q = 0; E < Ce.length && !d && Ce[E]; )
if (d = Ce[E++].exec(w), d)
for (N = 0; N < Ze.length; N++)
L = d[++q], k = Ze[N], typeof k === T && k.length > 0 ? k.length === 2 ? typeof k[1] == g ? this[k[0]] = k[1].call(this, L) : this[k[0]] = k[1] : k.length === 3 ? typeof k[1] === g && !(k[1].exec && k[1].test) ? this[k[0]] = L ? k[1].call(this, L, k[2]) : s : this[k[0]] = L ? L.replace(k[1], k[2]) : s : k.length === 4 && (this[k[0]] = L ? k[3].call(this, L.replace(k[1], k[2])) : s) : this[k] = L || s;
f += 2;
}
}, oe = function(w, v) {
for (var f in v)
if (typeof v[f] === T && v[f].length > 0) {
for (var E = 0; E < v[f].length; E++)
if (Je(v[f][E], w))
return f === u ? s : f;
} else if (Je(v[f], w))
return f === u ? s : f;
return v.hasOwnProperty("*") ? v["*"] : w;
}, Bt = {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}, Qe = {
ME: "4.90",
"NT 3.11": "NT3.51",
"NT 4.0": "NT4.0",
2e3: "NT 5.0",
XP: ["NT 5.1", "NT 5.2"],
Vista: "NT 6.0",
7: "NT 6.1",
8: "NT 6.2",
"8.1": "NT 6.3",
10: ["NT 6.4", "NT 10.0"],
RT: "ARM"
}, $e = {
browser: [
[
/\b(?:crmo|crios)\/([\w\.]+)/i
// Chrome for Android/iOS
],
[l, [h, "Chrome"]],
[
/edg(?:e|ios|a)?\/([\w\.]+)/i
// Microsoft Edge
],
[l, [h, "Edge"]],
[
// Presto based
/(opera mini)\/([-\w\.]+)/i,
// Opera Mini
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,
// Opera Mobi/Tablet
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i
// Opera
],
[h, l],
[
/opios[\/ ]+([\w\.]+)/i
// Opera mini on iphone >= 8.0
],
[l, [h, G + " Mini"]],
[
/\bop(?:rg)?x\/([\w\.]+)/i
// Opera GX
],
[l, [h, G + " GX"]],
[
/\bopr\/([\w\.]+)/i
// Opera Webkit
],
[l, [h, G]],
[
// Mixed
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i
// Baidu
],
[l, [h, "Baidu"]],
[
/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i
// Maxthon
],
[l, [h, "Maxthon"]],
[
/(kindle)\/([\w\.]+)/i,
// Kindle
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
// Trident based
/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,
// Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
/(?:ms|\()(ie) ([\w\.]+)/i,
// Internet Explorer
// Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
/(heytap|ovi|115)browser\/([\d\.]+)/i,
// HeyTap/Ovi/115
/(weibo)__([\d\.]+)/i
// Weibo
],
[h, l],
[
/quark(?:pc)?\/([-\w\.]+)/i
// Quark
],
[l, [h, "Quark"]],
[
/\bddg\/([\w\.]+)/i
// DuckDuckGo
],
[l, [h, "DuckDuckGo"]],
[
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
// UCBrowser
],
[l, [h, "UC" + te]],
[
/microm.+\bqbcore\/([\w\.]+)/i,
// WeChat Desktop for Windows Built-in Browser
/\bqbcore\/([\w\.]+).+microm/i,
/micromessenger\/([\w\.]+)/i
// WeChat
],
[l, [h, "WeChat"]],
[
/konqueror\/([\w\.]+)/i
// Konqueror
],
[l, [h, "Konqueror"]],
[
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
// IE11
],
[l, [h, "IE"]],
[
/ya(?:search)?browser\/([\w\.]+)/i
// Yandex
],
[l, [h, "Yandex"]],
[
/slbrowser\/([\w\.]+)/i
// Smart Lenovo Browser
],
[l, [h, "Smart Lenovo " + te]],
[
/(avast|avg)\/([\w\.]+)/i
// Avast/AVG Secure Browser
],
[[h, /(.+)/, "$1 Secure " + te], l],
[
/\bfocus\/([\w\.]+)/i
// Firefox Focus
],
[l, [h, se + " Focus"]],
[
/\bopt\/([\w\.]+)/i
// Opera Touch
],
[l, [h, G + " Touch"]],
[
/coc_coc\w+\/([\w\.]+)/i
// Coc Coc Browser
],
[l, [h, "Coc Coc"]],
[
/dolfin\/([\w\.]+)/i
// Dolphin
],
[l, [h, "Dolphin"]],
[
/coast\/([\w\.]+)/i
// Opera Coast
],
[l, [h, G + " Coast"]],
[
/miuibrowser\/([\w\.]+)/i
// MIUI Browser
],
[l, [h, "MIUI" + je]],
[
/fxios\/([\w\.-]+)/i
// Firefox for iOS
],
[l, [h, se]],
[
/\bqihoobrowser\/?([\w\.]*)/i
// 360
],
[l, [h, "360"]],
[
/\b(qq)\/([\w\.]+)/i
// QQ
],
[[h, /(.+)/, "$1Browser"], l],
[
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
],
[[h, /(.+)/, "$1" + je], l],
[
// Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
/samsungbrowser\/([\w\.]+)/i
// Samsung Internet
],
[l, [h, X + " Internet"]],
[
/metasr[\/ ]?([\d\.]+)/i
// Sogou Explorer
],
[l, [h, "Sogou Explorer"]],
[
/(sogou)mo\w+\/([\d\.]+)/i
// Sogou Mobile
],
[[h, "Sogou Mobile"], l],
[
/(electron)\/([\w\.]+) safari/i,
// Electron-based App
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,
// Tesla
/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i
// QQ/2345
],
[h, l],
[
/(lbbrowser|rekonq)/i,
// LieBao Browser/Rekonq
/\[(linkedin)app\]/i
// LinkedIn App for iOS & Android
],
[h],
[
/ome\/([\w\.]+) \w* ?(iron) saf/i,
// Iron
/ome\/([\w\.]+).+qihu (360)[es]e/i
// 360
],
[l, h],
[
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
// Facebook App for iOS & Android
],
[[h, Ye], l],
[
/(Klarna)\/([\w\.]+)/i,
// Klarna Shopping Browser for iOS & Android
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,
// Kakao App
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,
// Naver InApp
/safari (line)\/([\w\.]+)/i,
// Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i,
// Line App for Android
/(alipay)client\/([\w\.]+)/i,
// Alipay
/(twitter)(?:and| f.+e\/([\w\.]+))/i,
// Twitter
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i
// Chromium/Instagram/Snapchat
],
[h, l],
[
/\bgsa\/([\w\.]+) .*safari\//i
// Google Search Appliance on iOS
],
[l, [h, "GSA"]],
[
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i
// TikTok
],
[l, [h, "TikTok"]],
[
/headlesschrome(?:\/([\w\.]+)| )/i
// Chrome Headless
],
[l, [h, ie + " Headless"]],
[
/ wv\).+(chrome)\/([\w\.]+)/i
// Chrome WebView
],
[[h, ie + " WebView"], l],
[
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
// Android Browser
],
[l, [h, "Android " + te]],
[
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
],
[h, l],
[
/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i
// Mobile Safari
],
[l, [h, "Mobile Safari"]],
[
/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i
// Safari & Safari Mobile
],
[l, h],
[
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
// Safari < 3.0
],
[h, [l, oe, Bt]],
[
/(webkit|khtml)\/([\w\.]+)/i
],
[h, l],
[
// Gecko based
/(navigator|netscape\d?)\/([-\w\.]+)/i
// Netscape
],
[[h, "Netscape"], l],
[
/(wolvic|librewolf)\/([\w\.]+)/i
// Wolvic/LibreWolf
],
[h, l],
[
/mobile vr; rv:([\w\.]+)\).+firefox/i
// Firefox Reality
],
[l, [h, se + " Reality"]],
[
/ekiohf.+(flow)\/([\w\.]+)/i,
// Flow
/(swiftfox)/i,
// Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(firefox)\/([\w\.]+)/i,
// Other Firefox-based
/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,
// Mozilla
// Other
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser
/(links) \(([\w\.]+)/i
// Links
],
[h, [l, /_/g, "."]],
[
/(cobalt)\/([\w\.]+)/i
// Cobalt
],
[h, [l, /master.|lts./, ""]]
],
cpu: [
[
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i
// AMD64 (x64)
],
[[O, "amd64"]],
[
/(ia32(?=;))/i
// IA32 (quicktime)
],
[[O, I]],
[
/((?:i[346]|x)86)[;\)]/i
// IA32 (x86)
],
[[O, "ia32"]],
[
/\b(aarch64|arm(v?8e?l?|_?64))\b/i
// ARM64
],
[[O, "arm64"]],
[
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i
// ARMHF
],
[[O, "armhf"]],
[
// PocketPC mistakenly identified as PowerPC
/windows (ce|mobile); ppc;/i
],
[[O, "arm"]],
[
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i
// PowerPC
],
[[O, /ower/, c, I]],
[
/(sun4\w)[;\)]/i
// SPARC
],
[[O, "sparc"]],
[
/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
],
[[O, I]]
],
device: [
[
//////////////////////////
// MOBILES & TABLETS
/////////////////////////
// Samsung
/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
],
[r, [a, X], [o, m]],
[
/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
/samsung[- ]((?!sm-[lr])[-\w]+)/i,
/sec-(sgh\w+)/i
],
[r, [a, X], [o, p]],
[
// Apple
/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i
// iPod/iPhone
],
[r, [a, K], [o, p]],
[
/\((ipad);[-\w\),; ]+apple/i,
// iPad
/applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
],
[r, [a, K], [o, m]],
[
/(macintosh);/i
],
[r, [a, K]],
[
// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
],
[r, [a, Ke], [o, p]],
[
// Honor
/(?:honor)([-\w ]+)[;\)]/i
],
[r, [a, "Honor"], [o, p]],
[
// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
],
[r, [a, We], [o, m]],
[
/(?:huawei)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
],
[r, [a, We], [o, p]],
[
// Xiaomi
/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,
// Xiaomi POCO
/\b; (\w+) build\/hm\1/i,
// Xiaomi Hongmi 'numeric' models
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,
// Xiaomi Hongmi
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,
// Xiaomi Redmi
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,
// Xiaomi Redmi 'numeric' models
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i
// Xiaomi Mi
],
[[r, /_/g, " "], [a, ke], [o, p]],
[
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,
// Redmi Pad
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i
// Mi Pad tablets
],
[[r, /_/g, " "], [a, ke], [o, m]],
[
// OPPO
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
],
[r, [a, "OPPO"], [o, p]],
[
/\b(opd2\d{3}a?) bui/i
],
[r, [a, "OPPO"], [o, m]],
[
// Vivo
/vivo (\w+)(?: bui|\))/i,
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
],
[r, [a, "Vivo"], [o, p]],
[
// Realme
/\b(rmx[1-3]\d{3})(?: bui|;|\))/i
],
[r, [a, "Realme"], [o, p]],
[
// Motorola
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
/\bmot(?:orola)?[- ](\w*)/i,
/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
],
[r, [a, He], [o, p]],
[
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
],
[r, [a, He], [o, m]],
[
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
],
[r, [a, ye], [o, m]],
[
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
/\blg-?([\d\w]+) bui/i
],
[r, [a, ye], [o, p]],
[
// Lenovo
/(ideatab[-\w ]+)/i,
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
],
[r, [a, "Lenovo"], [o, m]],
[
// Nokia
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?([-\w\.]*)/i
],
[[r, /_/g, " "], [a, "Nokia"], [o, p]],
[
// Google
/(pixel c)\b/i
// Google Pixel C
],
[r, [a, Y], [o, m]],
[
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i
// Google Pixel
],
[r, [a, Y], [o, p]],
[
// Sony
/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
],
[r, [a, ne], [o, p]],
[
/sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i
],
[[r, "Xperia Tablet"], [a, ne], [o, m]],
[
// OnePlus
/ (kb2005|in20[12]5|be20[12][59])\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
],
[r, [a, "OnePlus"], [o, p]],
[
// Amazon
/(alexa)webm/i,
/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,
// Kindle Fire without Silk / Echo Show
/(kf[a-z]+)( bui|\)).+silk\//i
// Kindle Fire HD
],
[r, [a, ee], [o, m]],
[
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
// Fire Phone
],
[[r, /(.+)/g, "Fire Phone $1"], [a, ee], [o, p]],
[
// BlackBerry
/(playbook);[-\w\),; ]+(rim)/i
// BlackBerry PlayBook
],
[r, a, [o, m]],
[
/\b((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10; (\w+)/i
// BlackBerry 10
],
[r, [a, ze], [o, p]],
[
// Asus
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
],
[r, [a, Ve], [o, m]],
[
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
],
[r, [a, Ve], [o, p]],
[
// HTC
/(nexus 9)/i
// HTC Nexus 9
],
[r, [a, "HTC"], [o, m]],
[
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
// HTC
// ZTE
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i
// Alcatel/GeeksPhone/Nexian/Panasonic/Sony
],
[a, [r, /_/g, " "], [o, p]],
[
// TCL
/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i
],
[r, [a, "TCL"], [o, m]],
[
// itel
/(itel) ((\w+))/i
],
[[a, I], r, [o, oe, { tablet: ["p10001l", "w7001"], "*": "mobile" }]],
[
// Acer
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
],
[r, [a, "Acer"], [o, m]],
[
// Meizu
/droid.+; (m[1-5] note) bui/i,
/\bmz-([-\w]{2,})/i
],
[r, [a, "Meizu"], [o, p]],
[
// Ulefone
/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
],
[r, [a, "Ulefone"], [o, p]],
[
// Energizer
/; (energy ?\w+)(?: bui|\))/i,
/; energizer ([\w ]+)(?: bui|\))/i
],
[r, [a, "Energizer"], [o, p]],
[
// Cat
/; cat (b35);/i,
/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
],
[r, [a, "Cat"], [o, p]],
[
// Smartfren
/((?:new )?andromax[\w- ]+)(?: bui|\))/i
],
[r, [a, "Smartfren"], [o, p]],
[
// Nothing
/droid.+; (a(?:015|06[35]|142p?))/i
],
[r, [a, "Nothing"], [o, p]],
[
// MIXED
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan
/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,
// IMO
/(hp) ([\w ]+\w)/i,
// HP iPAQ
/(asus)-?(\w+)/i,
// Asus
/(microsoft); (lumia[\w ]+)/i,
// Microsoft Lumia
/(lenovo)[-_ ]?([-\w]+)/i,
// Lenovo
/(jolla)/i,
// Jolla
/(oppo) ?([\w ]+) bui/i
// OPPO
],
[a, r, [o, p]],
[
/(imo) (tab \w+)/i,
// IMO
/(kobo)\s(ereader|touch)/i,
// Kobo
/(archos) (gamepad2?)/i,
// Archos
/(hp).+(touchpad(?!.+tablet)|tablet)/i,
// HP TouchPad
/(kindle)\/([\w\.]+)/i,
// Kindle
/(nook)[\w ]+build\/(\w+)/i,
// Nook
/(dell) (strea[kpr\d ]*[\dko])/i,
// Dell Streak
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,
// Le Pan Tablets
/(trinity)[- ]*(t\d{3}) bui/i,
// Trinity Tablets
/(gigaset)[- ]+(q\w{1,9}) bui/i,
// Gigaset Tablets
/(vodafone) ([\w ]+)(?:\)| bui)/i
// Vodafone
],
[a, r, [o, m]],
[
/(surface duo)/i
// Surface Duo
],
[r, [a, ve], [o, m]],
[
/droid [\d\.]+; (fp\du?)(?: b|\))/i
// Fairphone
],
[r, [a, "Fairphone"], [o, p]],
[
/(u304aa)/i
// AT&T
],
[r, [a, "AT&T"], [o, p]],
[
/\bsie-(\w*)/i
// Siemens
],
[r, [a, "Siemens"], [o, p]],
[
/\b(rct\w+) b/i
// RCA Tablets
],
[r, [a, "RCA"], [o, m]],
[
/\b(venue[\d ]{2,7}) b/i
// Dell Venue Tablets
],
[r, [a, "Dell"], [o, m]],
[
/\b(q(?:mv|ta)\w+) b/i
// Verizon Tablet
],
[r, [a, "Verizon"], [o, m]],
[
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i
// Barnes & Noble Tablet
],
[r, [a, "Barnes & Noble"], [o, m]],
[
/\b(tm\d{3}\w+) b/i
],
[r, [a, "NuVision"], [o, m]],
[
/\b(k88) b/i
// ZTE K Series Tablet
],
[r, [a, "ZTE"], [o, m]],
[
/\b(nx\d{3}j) b/i
// ZTE Nubia
],
[r, [a, "ZTE"], [o, p]],
[
/\b(gen\d{3}) b.+49h/i
// Swiss GEN Mobile
],
[r, [a, "Swiss"], [o, p]],
[
/\b(zur\d{3}) b/i
// Swiss ZUR Tablet
],
[r, [a, "Swiss"], [o, m]],
[
/\b((zeki)?tb.*\b) b/i
// Zeki Tablets
],
[r, [a, "Zeki"], [o, m]],
[
/\b([yr]\d{2}) b/i,
/\b(dragon[- ]+touch |dt)(\w{5}) b/i
// Dragon Touch Tablet
],
[[a, "Dragon Touch"], r, [o, m]],
[
/\b(ns-?\w{0,9}) b/i
// Insignia Tablets
],
[r, [a, "Insignia"], [o, m]],
[
/\b((nxa|next)-?\w{0,9}) b/i
// NextBook Tablets
],
[r, [a, "NextBook"], [o, m]],
[
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i
// Voice Xtreme Phones
],
[[a, "Voice"], r, [o, p]],
[
/\b(lvtel\-)?(v1[12]) b/i
// LvTel Phones
],
[[a, "LvTel"], r, [o, p]],
[
/\b(ph-1) /i
// Essential PH-1
],
[r, [a, "Essential"], [o, p]],
[
/\b(v(100md|700na|7011|917g).*\b) b/i
// Envizen Tablets
],
[r, [a, "Envizen"], [o, m]],
[
/\b(trio[-\w\. ]+) b/i
// MachSpeed Tablets
],
[r, [a, "MachSpeed"], [o, m]],
[
/\btu_(1491) b/i
// Rotor Tablets
],
[r, [a, "Rotor"], [o, m]],
[
/(shield[\w ]+) b/i
// Nvidia Shield Tablets
],
[r, [a, "Nvidia"], [o, m]],
[
/(sprint) (\w+)/i
// Sprint Phones
],
[a, r, [o, p]],
[
/(kin\.[onetw]{3})/i
// Microsoft Kin
],
[[r, /\./g, " "], [a, ve], [o, p]],
[
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
// Zebra
],
[r, [a, _e], [o, m]],
[
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
],
[r, [a, _e], [o, p]],
[
///////////////////
// SMARTTVS
///////////////////
/smart-tv.+(samsung)/i
// Samsung
],
[a, [o, x]],
[
/hbbtv.+maple;(\d+)/i
],
[[r, /^/, "SmartTV"], [a, X], [o, x]],
[
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
// LG SmartTV
],
[[a, ye], [o, x]],
[
/(apple) ?tv/i
// Apple TV
],
[a, [r, K + " TV"], [o, x]],
[
/crkey/i
// Google Chromecast
],
[[r, ie + "cast"], [a, Y], [o, x]],
[
/droid.+aft(\w+)( bui|\))/i
// Fire TV
],
[r, [a, ee], [o, x]],
[
/\(dtv[\);].+(aquos)/i,
/(aquos-tv[\w ]+)\)/i
// Sharp
],
[r, [a, Ke], [o, x]],
[
/(bravia[\w ]+)( bui|\))/i
// Sony
],
[r, [a, ne], [o, x]],
[
/(mitv-\w{5}) bui/i
// Xiaomi
],
[r, [a, ke], [o, x]],
[
/Hbbtv.*(technisat) (.*);/i
// TechniSAT
],
[a, r, [o, x]],
[
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
// Roku
/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i
// HbbTV devices
],
[[a, Ee], [r, Ee], [o, x]],
[
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
// SmartTV from Unidentified Vendors
],
[[o, x]],
[
///////////////////
// CONSOLES
///////////////////
/(ouya)/i,
// Ouya
/(nintendo) ([wids3utch]+)/i
// Nintendo
],
[a, r, [o, H]],
[
/droid.+; (shield) bui/i
// Nvidia
],
[r, [a, "Nvidia"], [o, H]],
[
/(playstation [345portablevi]+)/i
// Playstation
],
[r, [a, ne], [o, H]],
[
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
// Microsoft Xbox
],
[r, [a, ve], [o, H]],
[
///////////////////
// WEARABLES
///////////////////
/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i
// Samsung Galaxy Watch
],
[r, [a, X], [o, U]],
[
/((pebble))app/i
// Pebble
],
[a, r, [o, U]],
[
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i
// Apple Watch
],
[r, [a, K], [o, U]],
[
/droid.+; (glass) \d/i
// Google Glass
],
[r, [a, Y], [o, U]],
[
/droid.+; (wt63?0{2,3})\)/i
],
[r, [a, _e], [o, U]],
[
///////////////////
// XR
///////////////////
/droid.+; (glass) \d/i
// Google Glass
],
[r, [a, Y], [o, U]],
[
/(pico) (4|neo3(?: link|pro)?)/i
// Pico
],
[a, r, [o, U]],
[
/; (quest( \d| pro)?)/i
// Oculus Quest
],
[r, [a, Ye], [o, U]],
[
///////////////////
// EMBEDDED
///////////////////
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
// Tesla
],
[a, [o, be]],
[
/(aeobc)\b/i
// Echo Dot
],
[r, [a, ee], [o, be]],
[
////////////////////
// MIXED (GENERIC)
///////////////////
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i
// Android Phones from Unidentified Vendors
],
[r, [o, p]],
[
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i
// Android Tablets from Unidentified Vendors
],
[r, [o, m]],
[
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
// Unidentifiable Tablet
],
[[o, m]],
[
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i
// Unidentifiable Mobile
],
[[o, p]],
[
/(android[-\w\. ]{0,9});.+buil/i
// Generic Android Device
],
[r, [a, "Generic"]]
],
engine: [
[
/windows.+ edge\/([\w\.]+)/i
// EdgeHTML
],
[l, [h, At + "HTML"]],
[
/(arkweb)\/([\w\.]+)/i
// ArkWeb
],
[h, l],
[
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
// Blink
],
[l, [h, "Blink"]],
[
/(presto)\/([\w\.]+)/i,
// Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,
// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
/ekioh(flow)\/([\w\.]+)/i,
// Flow
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,
// KHTML/Tasman/Links
/(icab)[\/ ]([23]\.[\d\.]+)/i,
// iCab
/\b(libweb)/i
],
[h, l],
[
/rv\:([\w\.]{1,9})\b.+(gecko)/i
// Gecko
],
[l, h]
],
os: [
[
// Windows
/microsoft (windows) (vista|xp)/i
// Windows (iTunes)
],
[h, l],
[
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i
// Windows Phone
],
[h, [l, oe, Qe]],
[
/windows nt 6\.2; (arm)/i,
// Windows RT
/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,
/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i
],
[[l, oe, Qe], [h, "Windows"]],
[
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,
// iOS
/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
/cfnetwork\/.+darwin/i
],
[[l, /_/g, "."], [h, "iOS"]],
[
/(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i
// Mac OS
],
[[h, Xe], [l, /_/g, "."]],
[
// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i
// Android-x86/HarmonyOS
],
[l, h],
[
// Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS/OpenHarmony
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,
/(blackberry)\w*\/([\w\.]*)/i,
// Blackberry
/(tizen|kaios)[\/ ]([\w\.]+)/i,
// Tizen/KaiOS
/\((series40);/i
// Series 40
],
[h, l],
[
/\(bb(10);/i
// BlackBerry 10
],
[l, [h, ze]],
[
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i
// Symbian
],
[l, [h, "Symbian"]],
[
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
// Firefox OS
],
[l, [h, se + " OS"]],
[
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i
// WebOS
],
[l, [h, "webOS"]],
[
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i
// watchOS
],
[l, [h, "watchOS"]],
[
// Google Chromecast
/crkey\/([\d\.]+)/i
// Google Chromecast
],
[l, [h, ie + "cast"]],
[
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i
// Chromium OS
],
[[h, Ge], l],
[
// Smart TVs
/panasonic;(viera)/i,
// Panasonic Viera
/(netrange)mmh/i,
// Netrange
/(nettv)\/(\d+\.[\w\.]+)/i,
// NetTV
// Console
/(nintendo|playstation) ([wids345portablevuch]+)/i,
// Nintendo/Playstation
/(xbox); +xbox ([^\);]+)/i,
// Microsoft Xbox (360, One, X, S, Series X, Series S)
// Other
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,
// Joli/Palm
/(mint)[\/\(\) ]?(\w*)/i,
// Mint
/(mageia|vectorlinux)[; ]/i,
// Mageia/VectorLinux
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
// Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
/(hurd|linux) ?([\w\.]*)/i,
// Hurd/Linux
/(gnu) ?([\w\.]*)/i,
// GNU
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,
// FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
/(haiku) (\w+)/i
// Haiku
],
[h, l],
[
/(sunos) ?([\w\.\d]*)/i
// Solaris
],
[[h, "Solaris"], l],
[
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,
// Solaris
/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,
// AIX
/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,
// BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
/(unix) ?([\w\.]*)/i
// UNIX
],
[h, l]
]
}, R = function(w, v) {
if (typeof w === T && (v = w, w = s), !(this instanceof R))
return new R(w, v).getResult();
var f = typeof t !== y && t.navigator ? t.navigator : s, E = w || (f && f.userAgent ? f.userAgent : c), q = f && f.userAgentData ? f.userAgentData : s, N = v ? Ot($e, v) : $e, k = f && f.userAgent == E;
return this.getBrowser = function() {
var d = {};
return d[h] = s, d[l] = s, j.call(d, E, N.browser), d[P] = Rt(d[l]), k && f && f.brave && typeof f.brave.isBrave == g && (d[h] = "Brave"), d;
}, this.getCPU = function() {
var d = {};
return d[O] = s, j.call(d, E, N.cpu), d;
}, this.getDevice = function() {
var d = {};
return d[a] = s, d[r] = s, d[o] = s, j.call(d, E, N.device), k && !d[o] && q && q.mobile && (d[o] = p), k && d[r] == "Macintosh" && f && typeof f.standalone !== y && f.maxTouchPoints && f.maxTouchPoints > 2 && (d[r] = "iPad", d[o] = m), d;
}, this.getEngine = function() {
var d = {};
return d[h] = s, d[l] = s, j.call(d, E, N.engine), d;
}, this.getOS = function() {
var d = {};
return d[h] = s, d[l] = s, j.call(d, E, N.os), k && !d[h] && q && q.platform && q.platform != "Unknown" && (d[h] = q.platform.replace(/chrome os/i, Ge).replace(/macos/i, Xe)), d;
}, this.getResult = function() {
return {
ua: this.getUA(),
browser: this.getBrowser(),
engine: this.getEngine(),
os: this.getOS(),
device: this.getDevice(),
cpu: this.getCPU()
};
}, this.getUA = function() {
return E;
}, this.setUA = function(d) {
return E = typeof d === S && d.length > ge ? Ee(d, ge) : d, this;
}, this.setUA(E), this;
};
R.VERSION = n, R.BROWSER = re([h, l, P]), R.CPU = re([O]), R.DEVICE = re([r, a, o, H, p, x, m, U, be]), R.ENGINE = R.OS = re([h, l]), i.exports && (e = i.exports = R), e.UAParser = R;
var F = typeof t !== y && (t.jQuery || t.Zepto);
if (F && !F.ua) {
var ae = new R();
F.ua = ae.getResult(), F.ua.get = function() {
return ae.getUA();
}, F.ua.set = function(w) {
ae.setUA(w);
var v = ae.getResult();
for (var f in v)
F.ua[f] = v[f];
};
}
})(typeof window == "object" ? window : Ft);
})(Ae, Ae.exports);
var Se = Ae.exports;
class et {
/**
* @returns Whether the device is a desktop/laptop for sure.
*/
static isDesktopDevice() {
var s;
if ("orientation" in window)
return !1;
const e = "(any-pointer: coarse)", t = (s = window.matchMedia) == null ? void 0 : s.call(window, e);
return navigator.maxTouchPoints === 0 || (t == null ? void 0 : t.media) === e && !(t != null && t.matches);
}
static isIpad(e) {
return new Se.UAParser(e).getDevice().vendor === "Apple" && window.screen.width === 820 && window.screen.height === 1180 && window.screen.colorDepth === 32 && window.screen.pixelDepth === 32;
}
/**
* @returns The browser version in lower case, or empty string if not found.
*/
static getBrowserName() {
var e;
return ((e = Se.UAParser(navigator.userAgent).browser.name) == null ? void 0 : e.toLowerCase()) ?? "";
}
/**
* @returns The browser version in lower case, or empty string if not found.
*/
static getBrowserVersion() {
var e;
return ((e = Se.UAParser(navigator.userAgent).browser.version) == null ? void 0 : e.toLowerCase()) ?? "";
}
}
class Vt {
constructor(e) {
this.barcodeLinkUrl = e;
}
async sendMetric(e) {
try {
await fetch(new URL("/api/metrics/ingest?uiless=true", this.barcodeLinkUrl), {
method: "POST",
body: JSON.stringify(e),
headers: new Headers({
"content-type": "application/json"
})
});
} catch (t) {
console.warn("error while sending metric", t);
}
}
getBrowserMetricData() {
return {
browser: et.getBrowserName(),
// we only keep major and minor part of the version, else we will end up having
// too many combinations of browser name and versions for all metrics
browserVersion: et.getBrowserVersion().split(".").slice(0, 2).join(".")
};
}
}
var Q = /* @__PURE__ */ ((i) => (i.AllOthersDisconnected = "allOthersDisconnected", i.Capture = "capture", i.Configuration = "configuration", i.RemoteScanStarted = "remoteScanStarted", i.AllOthersReconnected = "allOthersReconnected", i))(Q || {});
const M = /* @__PURE__ */ Object.create(null);
M.open = "0";
M.close = "1";
M.ping = "2";
M.pong = "3";
M.message = "4";
M.upgrade = "5";
M.noop = "6";
const de = /* @__PURE__ */ Object.create(null);
Object.keys(M).forEach((i) => {
de[M[i]] = i;
});
const Oe = { type: "error", data: "parser error" }, pt = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", mt = typeof ArrayBuffer == "function", wt = (i) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(i) : i && i.buffer instanceof ArrayBuffer, Me = ({ type: i, data: e }, t, s) => pt && e instanceof Blob ? t ? s(e) : tt(e, s) : mt && (e instanceof ArrayBuffer || wt(e)) ? t ? s(e) : tt(new Blob([e]), s) : s(M[i] + (e || "")), tt = (i, e) => {
const t = new FileReader();
return t.onload = function() {
const s = t.result.split(",")[1];
e("b" + (s || ""));
}, t.readAsDataURL(i);
};
function it(i) {
return i instanceof Uint8Array ? i : i instanceof ArrayBuffer ? new Uint8Array(i) : new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
}
let xe;
function zt(i, e) {
if (pt && i.data instanceof Blob)
return i.data.arrayBuffer().then(it).then(e);
if (mt && (i.data instanceof ArrayBuffer || wt(i.data)))
return e(it(i.data));
Me(i, !1, (t) => {
xe || (xe = new TextEncoder()), e(xe.encode(t));
});
}
const st = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", $ = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (let i = 0; i < st.length; i++)
$[st.charCodeAt(i)] = i;
const Wt = (i) => {
let e = i.length * 0.75, t = i.length, s, n = 0, c, u, g, y;
i[i.length - 1] === "=" && (e--, i[i.length - 2] === "=" && e--);
const T = new ArrayBuffer(e), S = new Uint8Array(T);
for (s = 0; s < t; s += 4)
c = $[i.charCodeAt(s)], u = $[i.charCodeAt(s + 1)], g = $[i.charCodeAt(s + 2)], y = $[i.charCodeAt(s + 3)], S[n++] = c << 2 | u >> 4, S[n++] = (u & 15) << 4 | g >> 2, S[n++] = (g & 3) << 6 | y & 63;
return T;
}, Ht = typeof ArrayBuffer == "function", Pe = (i, e) => {
if (typeof i != "string")
return {
type: "message",
data: bt(i, e)
};
const t = i.charAt(0);
return t === "b" ? {
type: "message",
data: Kt(i.substring(1), e)
} : de[t] ? i.length > 1 ? {
type: de[t],
data: i.substring(1)
} : {
type: de[t]
} : Oe;
}, Kt = (i, e) => {
if (Ht) {
const t = Wt(i);
return bt(t, e);
} else
return { base64: !0, data: i };
}, bt = (i, e) => {
switch (e) {
case "blob":
return i instanceof Blob ? i : new Blob([i]);