hina-cloud-js-sdk 3.1.6 → 3.1.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitlab-ci.yml +2 -6
- package/build/hina.cjs.min.js +1 -0
- package/build/hina.esm.min.js +1 -0
- package/build/hina.min.js +1 -4
- package/build/hotAnalyse.min.js +1 -1
- package/package.json +2 -7
- package/packages/core/dist/index.cjs.js +64 -0
- package/packages/core/dist/index.cjs.js.map +1 -0
- package/packages/core/dist/index.d.ts +45 -0
- package/packages/core/dist/index.esm.js +62 -0
- package/packages/core/dist/index.esm.js.map +1 -0
- package/packages/core/dist/index.global.js +1199 -0
- package/packages/core/dist/index.global.js.map +1 -0
- package/packages/core/dist/index.js +1200 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/monitor/dist/index.cjs.js +150 -0
- package/packages/monitor/dist/index.cjs.js.map +1 -0
- package/packages/monitor/dist/index.d.ts +35 -0
- package/packages/monitor/dist/index.esm.js +145 -0
- package/packages/monitor/dist/index.esm.js.map +1 -0
- package/packages/monitor/dist/index.global.js +1343 -0
- package/packages/monitor/dist/index.global.js.map +1 -0
- package/packages/monitor/dist/index.js +1344 -0
- package/packages/monitor/dist/index.js.map +1 -0
- package/packages/track/dist/index.cjs.js +1930 -0
- package/packages/track/dist/index.cjs.js.map +1 -0
- package/packages/track/dist/index.d.ts +212 -0
- package/packages/track/dist/index.esm.js +1925 -0
- package/packages/track/dist/index.esm.js.map +1 -0
- package/packages/track/dist/index.global.js +4259 -0
- package/packages/track/dist/index.global.js.map +1 -0
- package/packages/track/dist/index.js +4260 -0
- package/packages/track/dist/index.js.map +1 -0
- package/packages/types/dist/index.d.ts +603 -0
- package/packages/types/dist/index.esm.js +25 -0
- package/packages/types/dist/index.esm.js.map +1 -0
- package/packages/utils/dist/index.cjs.js +1535 -0
- package/packages/utils/dist/index.cjs.js.map +1 -0
- package/packages/utils/dist/index.d.ts +394 -0
- package/packages/utils/dist/index.esm.js +1465 -0
- package/packages/utils/dist/index.esm.js.map +1 -0
- package/packages/utils/dist/index.global.js +2507 -0
- package/packages/utils/dist/index.global.js.map +1 -0
- package/packages/utils/dist/index.js +2508 -0
- package/packages/utils/dist/index.js.map +1 -0
@@ -0,0 +1,1343 @@
|
|
1
|
+
var hinaEpmStatistic = (function (exports) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
/******************************************************************************
|
5
|
+
Copyright (c) Microsoft Corporation.
|
6
|
+
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
8
|
+
purpose with or without fee is hereby granted.
|
9
|
+
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
11
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
12
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
13
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
14
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
15
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
|
+
PERFORMANCE OF THIS SOFTWARE.
|
17
|
+
***************************************************************************** */
|
18
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
19
|
+
|
20
|
+
var extendStatics = function(d, b) {
|
21
|
+
extendStatics = Object.setPrototypeOf ||
|
22
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
23
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
24
|
+
return extendStatics(d, b);
|
25
|
+
};
|
26
|
+
|
27
|
+
function __extends(d, b) {
|
28
|
+
if (typeof b !== "function" && b !== null)
|
29
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
30
|
+
extendStatics(d, b);
|
31
|
+
function __() { this.constructor = d; }
|
32
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
33
|
+
}
|
34
|
+
|
35
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
36
|
+
var e = new Error(message);
|
37
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
38
|
+
};
|
39
|
+
|
40
|
+
var ConsoleTypes;
|
41
|
+
(function (ConsoleTypes) {
|
42
|
+
ConsoleTypes["LOG"] = "log";
|
43
|
+
ConsoleTypes["INFO"] = "info";
|
44
|
+
ConsoleTypes["WARN"] = "warn";
|
45
|
+
ConsoleTypes["ERROR"] = "error";
|
46
|
+
ConsoleTypes["ASSERT"] = "assert";
|
47
|
+
})(ConsoleTypes || (ConsoleTypes = {}));
|
48
|
+
var ReportType;
|
49
|
+
(function (ReportType) {
|
50
|
+
ReportType["BEACON"] = "beacon";
|
51
|
+
ReportType["IMAGE"] = "image";
|
52
|
+
ReportType["AJAX"] = "ajax";
|
53
|
+
})(ReportType || (ReportType = {}));
|
54
|
+
|
55
|
+
var PluginBase = /** @class */ (function () {
|
56
|
+
function PluginBase(options, context) {
|
57
|
+
this.options = options;
|
58
|
+
this.context = context;
|
59
|
+
}
|
60
|
+
return PluginBase;
|
61
|
+
}());
|
62
|
+
|
63
|
+
function isObject(val) {
|
64
|
+
return Object.prototype.toString.call(val) === '[object Object]';
|
65
|
+
}
|
66
|
+
function merge() {
|
67
|
+
var args = [];
|
68
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
69
|
+
args[_i] = arguments[_i];
|
70
|
+
}
|
71
|
+
var result = Object.create(null);
|
72
|
+
args.forEach(function (obj) {
|
73
|
+
if (obj) {
|
74
|
+
Object.keys(obj).forEach(function (key) {
|
75
|
+
var val = obj[key];
|
76
|
+
if (isObject(val)) {
|
77
|
+
if (isObject(result[key])) {
|
78
|
+
result[key] = merge(result[key], val);
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
result[key] = merge(val);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
result[key] = val;
|
86
|
+
}
|
87
|
+
});
|
88
|
+
}
|
89
|
+
});
|
90
|
+
return result;
|
91
|
+
}
|
92
|
+
|
93
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
94
|
+
|
95
|
+
var uaParser = {exports: {}};
|
96
|
+
|
97
|
+
(function (module, exports) {
|
98
|
+
/////////////////////////////////////////////////////////////////////////////////
|
99
|
+
/* UAParser.js v1.0.38
|
100
|
+
Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
|
101
|
+
MIT License *//*
|
102
|
+
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
103
|
+
Supports browser & node.js environment.
|
104
|
+
Demo : https://faisalman.github.io/ua-parser-js
|
105
|
+
Source : https://github.com/faisalman/ua-parser-js */
|
106
|
+
/////////////////////////////////////////////////////////////////////////////////
|
107
|
+
|
108
|
+
(function (window, undefined$1) {
|
109
|
+
|
110
|
+
//////////////
|
111
|
+
// Constants
|
112
|
+
/////////////
|
113
|
+
|
114
|
+
|
115
|
+
var LIBVERSION = '1.0.38',
|
116
|
+
EMPTY = '',
|
117
|
+
UNKNOWN = '?',
|
118
|
+
FUNC_TYPE = 'function',
|
119
|
+
UNDEF_TYPE = 'undefined',
|
120
|
+
OBJ_TYPE = 'object',
|
121
|
+
STR_TYPE = 'string',
|
122
|
+
MAJOR = 'major',
|
123
|
+
MODEL = 'model',
|
124
|
+
NAME = 'name',
|
125
|
+
TYPE = 'type',
|
126
|
+
VENDOR = 'vendor',
|
127
|
+
VERSION = 'version',
|
128
|
+
ARCHITECTURE= 'architecture',
|
129
|
+
CONSOLE = 'console',
|
130
|
+
MOBILE = 'mobile',
|
131
|
+
TABLET = 'tablet',
|
132
|
+
SMARTTV = 'smarttv',
|
133
|
+
WEARABLE = 'wearable',
|
134
|
+
EMBEDDED = 'embedded',
|
135
|
+
UA_MAX_LENGTH = 500;
|
136
|
+
|
137
|
+
var AMAZON = 'Amazon',
|
138
|
+
APPLE = 'Apple',
|
139
|
+
ASUS = 'ASUS',
|
140
|
+
BLACKBERRY = 'BlackBerry',
|
141
|
+
BROWSER = 'Browser',
|
142
|
+
CHROME = 'Chrome',
|
143
|
+
EDGE = 'Edge',
|
144
|
+
FIREFOX = 'Firefox',
|
145
|
+
GOOGLE = 'Google',
|
146
|
+
HUAWEI = 'Huawei',
|
147
|
+
LG = 'LG',
|
148
|
+
MICROSOFT = 'Microsoft',
|
149
|
+
MOTOROLA = 'Motorola',
|
150
|
+
OPERA = 'Opera',
|
151
|
+
SAMSUNG = 'Samsung',
|
152
|
+
SHARP = 'Sharp',
|
153
|
+
SONY = 'Sony',
|
154
|
+
XIAOMI = 'Xiaomi',
|
155
|
+
ZEBRA = 'Zebra',
|
156
|
+
FACEBOOK = 'Facebook',
|
157
|
+
CHROMIUM_OS = 'Chromium OS',
|
158
|
+
MAC_OS = 'Mac OS';
|
159
|
+
|
160
|
+
///////////
|
161
|
+
// Helper
|
162
|
+
//////////
|
163
|
+
|
164
|
+
var extend = function (regexes, extensions) {
|
165
|
+
var mergedRegexes = {};
|
166
|
+
for (var i in regexes) {
|
167
|
+
if (extensions[i] && extensions[i].length % 2 === 0) {
|
168
|
+
mergedRegexes[i] = extensions[i].concat(regexes[i]);
|
169
|
+
} else {
|
170
|
+
mergedRegexes[i] = regexes[i];
|
171
|
+
}
|
172
|
+
}
|
173
|
+
return mergedRegexes;
|
174
|
+
},
|
175
|
+
enumerize = function (arr) {
|
176
|
+
var enums = {};
|
177
|
+
for (var i=0; i<arr.length; i++) {
|
178
|
+
enums[arr[i].toUpperCase()] = arr[i];
|
179
|
+
}
|
180
|
+
return enums;
|
181
|
+
},
|
182
|
+
has = function (str1, str2) {
|
183
|
+
return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;
|
184
|
+
},
|
185
|
+
lowerize = function (str) {
|
186
|
+
return str.toLowerCase();
|
187
|
+
},
|
188
|
+
majorize = function (version) {
|
189
|
+
return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split('.')[0] : undefined$1;
|
190
|
+
},
|
191
|
+
trim = function (str, len) {
|
192
|
+
if (typeof(str) === STR_TYPE) {
|
193
|
+
str = str.replace(/^\s\s*/, EMPTY);
|
194
|
+
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
///////////////
|
199
|
+
// Map helper
|
200
|
+
//////////////
|
201
|
+
|
202
|
+
var rgxMapper = function (ua, arrays) {
|
203
|
+
|
204
|
+
var i = 0, j, k, p, q, matches, match;
|
205
|
+
|
206
|
+
// loop through all regexes maps
|
207
|
+
while (i < arrays.length && !matches) {
|
208
|
+
|
209
|
+
var regex = arrays[i], // even sequence (0,2,4,..)
|
210
|
+
props = arrays[i + 1]; // odd sequence (1,3,5,..)
|
211
|
+
j = k = 0;
|
212
|
+
|
213
|
+
// try matching uastring with regexes
|
214
|
+
while (j < regex.length && !matches) {
|
215
|
+
|
216
|
+
if (!regex[j]) { break; }
|
217
|
+
matches = regex[j++].exec(ua);
|
218
|
+
|
219
|
+
if (!!matches) {
|
220
|
+
for (p = 0; p < props.length; p++) {
|
221
|
+
match = matches[++k];
|
222
|
+
q = props[p];
|
223
|
+
// check if given property is actually array
|
224
|
+
if (typeof q === OBJ_TYPE && q.length > 0) {
|
225
|
+
if (q.length === 2) {
|
226
|
+
if (typeof q[1] == FUNC_TYPE) {
|
227
|
+
// assign modified match
|
228
|
+
this[q[0]] = q[1].call(this, match);
|
229
|
+
} else {
|
230
|
+
// assign given value, ignore regex match
|
231
|
+
this[q[0]] = q[1];
|
232
|
+
}
|
233
|
+
} else if (q.length === 3) {
|
234
|
+
// check whether function or regex
|
235
|
+
if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
236
|
+
// call function (usually string mapper)
|
237
|
+
this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined$1;
|
238
|
+
} else {
|
239
|
+
// sanitize match using given regex
|
240
|
+
this[q[0]] = match ? match.replace(q[1], q[2]) : undefined$1;
|
241
|
+
}
|
242
|
+
} else if (q.length === 4) {
|
243
|
+
this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined$1;
|
244
|
+
}
|
245
|
+
} else {
|
246
|
+
this[q] = match ? match : undefined$1;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
i += 2;
|
252
|
+
}
|
253
|
+
},
|
254
|
+
|
255
|
+
strMapper = function (str, map) {
|
256
|
+
|
257
|
+
for (var i in map) {
|
258
|
+
// check if current value is array
|
259
|
+
if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
|
260
|
+
for (var j = 0; j < map[i].length; j++) {
|
261
|
+
if (has(map[i][j], str)) {
|
262
|
+
return (i === UNKNOWN) ? undefined$1 : i;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
} else if (has(map[i], str)) {
|
266
|
+
return (i === UNKNOWN) ? undefined$1 : i;
|
267
|
+
}
|
268
|
+
}
|
269
|
+
return str;
|
270
|
+
};
|
271
|
+
|
272
|
+
///////////////
|
273
|
+
// String map
|
274
|
+
//////////////
|
275
|
+
|
276
|
+
// Safari < 3.0
|
277
|
+
var oldSafariMap = {
|
278
|
+
'1.0' : '/8',
|
279
|
+
'1.2' : '/1',
|
280
|
+
'1.3' : '/3',
|
281
|
+
'2.0' : '/412',
|
282
|
+
'2.0.2' : '/416',
|
283
|
+
'2.0.3' : '/417',
|
284
|
+
'2.0.4' : '/419',
|
285
|
+
'?' : '/'
|
286
|
+
},
|
287
|
+
windowsVersionMap = {
|
288
|
+
'ME' : '4.90',
|
289
|
+
'NT 3.11' : 'NT3.51',
|
290
|
+
'NT 4.0' : 'NT4.0',
|
291
|
+
'2000' : 'NT 5.0',
|
292
|
+
'XP' : ['NT 5.1', 'NT 5.2'],
|
293
|
+
'Vista' : 'NT 6.0',
|
294
|
+
'7' : 'NT 6.1',
|
295
|
+
'8' : 'NT 6.2',
|
296
|
+
'8.1' : 'NT 6.3',
|
297
|
+
'10' : ['NT 6.4', 'NT 10.0'],
|
298
|
+
'RT' : 'ARM'
|
299
|
+
};
|
300
|
+
|
301
|
+
//////////////
|
302
|
+
// Regex map
|
303
|
+
/////////////
|
304
|
+
|
305
|
+
var regexes = {
|
306
|
+
|
307
|
+
browser : [[
|
308
|
+
|
309
|
+
/\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
|
310
|
+
], [VERSION, [NAME, 'Chrome']], [
|
311
|
+
/edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge
|
312
|
+
], [VERSION, [NAME, 'Edge']], [
|
313
|
+
|
314
|
+
// Presto based
|
315
|
+
/(opera mini)\/([-\w\.]+)/i, // Opera Mini
|
316
|
+
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet
|
317
|
+
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera
|
318
|
+
], [NAME, VERSION], [
|
319
|
+
/opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0
|
320
|
+
], [VERSION, [NAME, OPERA+' Mini']], [
|
321
|
+
/\bop(?:rg)?x\/([\w\.]+)/i // Opera GX
|
322
|
+
], [VERSION, [NAME, OPERA+' GX']], [
|
323
|
+
/\bopr\/([\w\.]+)/i // Opera Webkit
|
324
|
+
], [VERSION, [NAME, OPERA]], [
|
325
|
+
|
326
|
+
// Mixed
|
327
|
+
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
|
328
|
+
], [VERSION, [NAME, 'Baidu']], [
|
329
|
+
/(kindle)\/([\w\.]+)/i, // Kindle
|
330
|
+
/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer
|
331
|
+
// Trident based
|
332
|
+
/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser
|
333
|
+
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
334
|
+
|
335
|
+
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
|
336
|
+
/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
|
337
|
+
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
|
338
|
+
/(heytap|ovi)browser\/([\d\.]+)/i, // Heytap/Ovi
|
339
|
+
/(weibo)__([\d\.]+)/i // Weibo
|
340
|
+
], [NAME, VERSION], [
|
341
|
+
/\bddg\/([\w\.]+)/i // DuckDuckGo
|
342
|
+
], [VERSION, [NAME, 'DuckDuckGo']], [
|
343
|
+
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
|
344
|
+
], [VERSION, [NAME, 'UC'+BROWSER]], [
|
345
|
+
/microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser
|
346
|
+
/\bqbcore\/([\w\.]+).+microm/i,
|
347
|
+
/micromessenger\/([\w\.]+)/i // WeChat
|
348
|
+
], [VERSION, [NAME, 'WeChat']], [
|
349
|
+
/konqueror\/([\w\.]+)/i // Konqueror
|
350
|
+
], [VERSION, [NAME, 'Konqueror']], [
|
351
|
+
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
|
352
|
+
], [VERSION, [NAME, 'IE']], [
|
353
|
+
/ya(?:search)?browser\/([\w\.]+)/i // Yandex
|
354
|
+
], [VERSION, [NAME, 'Yandex']], [
|
355
|
+
/slbrowser\/([\w\.]+)/i // Smart Lenovo Browser
|
356
|
+
], [VERSION, [NAME, 'Smart Lenovo '+BROWSER]], [
|
357
|
+
/(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
|
358
|
+
], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [
|
359
|
+
/\bfocus\/([\w\.]+)/i // Firefox Focus
|
360
|
+
], [VERSION, [NAME, FIREFOX+' Focus']], [
|
361
|
+
/\bopt\/([\w\.]+)/i // Opera Touch
|
362
|
+
], [VERSION, [NAME, OPERA+' Touch']], [
|
363
|
+
/coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
|
364
|
+
], [VERSION, [NAME, 'Coc Coc']], [
|
365
|
+
/dolfin\/([\w\.]+)/i // Dolphin
|
366
|
+
], [VERSION, [NAME, 'Dolphin']], [
|
367
|
+
/coast\/([\w\.]+)/i // Opera Coast
|
368
|
+
], [VERSION, [NAME, OPERA+' Coast']], [
|
369
|
+
/miuibrowser\/([\w\.]+)/i // MIUI Browser
|
370
|
+
], [VERSION, [NAME, 'MIUI '+BROWSER]], [
|
371
|
+
/fxios\/([-\w\.]+)/i // Firefox for iOS
|
372
|
+
], [VERSION, [NAME, FIREFOX]], [
|
373
|
+
/\bqihu|(qi?ho?o?|360)browser/i // 360
|
374
|
+
], [[NAME, '360 ' + BROWSER]], [
|
375
|
+
/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i
|
376
|
+
], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser
|
377
|
+
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
|
378
|
+
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
|
379
|
+
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
|
380
|
+
], [[NAME, /_/g, ' '], VERSION], [
|
381
|
+
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
|
382
|
+
], [VERSION, [NAME, 'Sogou Explorer']], [
|
383
|
+
/(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
|
384
|
+
], [[NAME, 'Sogou Mobile'], VERSION], [
|
385
|
+
/(electron)\/([\w\.]+) safari/i, // Electron-based App
|
386
|
+
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
|
387
|
+
/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/2345 Browser
|
388
|
+
], [NAME, VERSION], [
|
389
|
+
/(lbbrowser)/i, // LieBao Browser
|
390
|
+
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
|
391
|
+
], [NAME], [
|
392
|
+
|
393
|
+
// WebView
|
394
|
+
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
|
395
|
+
], [[NAME, FACEBOOK], VERSION], [
|
396
|
+
/(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
|
397
|
+
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
|
398
|
+
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
|
399
|
+
/safari (line)\/([\w\.]+)/i, // Line App for iOS
|
400
|
+
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
|
401
|
+
/(alipay)client\/([\w\.]+)/i, // Alipay
|
402
|
+
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
|
403
|
+
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat
|
404
|
+
], [NAME, VERSION], [
|
405
|
+
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
|
406
|
+
], [VERSION, [NAME, 'GSA']], [
|
407
|
+
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
|
408
|
+
], [VERSION, [NAME, 'TikTok']], [
|
409
|
+
|
410
|
+
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
|
411
|
+
], [VERSION, [NAME, CHROME+' Headless']], [
|
412
|
+
|
413
|
+
/ wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
|
414
|
+
], [[NAME, CHROME+' WebView'], VERSION], [
|
415
|
+
|
416
|
+
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
|
417
|
+
], [VERSION, [NAME, 'Android '+BROWSER]], [
|
418
|
+
|
419
|
+
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
|
420
|
+
], [NAME, VERSION], [
|
421
|
+
|
422
|
+
/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari
|
423
|
+
], [VERSION, [NAME, 'Mobile Safari']], [
|
424
|
+
/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
|
425
|
+
], [VERSION, NAME], [
|
426
|
+
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
|
427
|
+
], [NAME, [VERSION, strMapper, oldSafariMap]], [
|
428
|
+
|
429
|
+
/(webkit|khtml)\/([\w\.]+)/i
|
430
|
+
], [NAME, VERSION], [
|
431
|
+
|
432
|
+
// Gecko based
|
433
|
+
/(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
|
434
|
+
], [[NAME, 'Netscape'], VERSION], [
|
435
|
+
/mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
|
436
|
+
], [VERSION, [NAME, FIREFOX+' Reality']], [
|
437
|
+
/ekiohf.+(flow)\/([\w\.]+)/i, // Flow
|
438
|
+
/(swiftfox)/i, // Swiftfox
|
439
|
+
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
|
440
|
+
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
|
441
|
+
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
|
442
|
+
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
443
|
+
/(firefox)\/([\w\.]+)/i, // Other Firefox-based
|
444
|
+
/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla
|
445
|
+
|
446
|
+
// Other
|
447
|
+
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
|
448
|
+
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
|
449
|
+
/(links) \(([\w\.]+)/i, // Links
|
450
|
+
/panasonic;(viera)/i // Panasonic Viera
|
451
|
+
], [NAME, VERSION], [
|
452
|
+
|
453
|
+
/(cobalt)\/([\w\.]+)/i // Cobalt
|
454
|
+
], [NAME, [VERSION, /master.|lts./, ""]]
|
455
|
+
],
|
456
|
+
|
457
|
+
cpu : [[
|
458
|
+
|
459
|
+
/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i // AMD64 (x64)
|
460
|
+
], [[ARCHITECTURE, 'amd64']], [
|
461
|
+
|
462
|
+
/(ia32(?=;))/i // IA32 (quicktime)
|
463
|
+
], [[ARCHITECTURE, lowerize]], [
|
464
|
+
|
465
|
+
/((?:i[346]|x)86)[;\)]/i // IA32 (x86)
|
466
|
+
], [[ARCHITECTURE, 'ia32']], [
|
467
|
+
|
468
|
+
/\b(aarch64|arm(v?8e?l?|_?64))\b/i // ARM64
|
469
|
+
], [[ARCHITECTURE, 'arm64']], [
|
470
|
+
|
471
|
+
/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i // ARMHF
|
472
|
+
], [[ARCHITECTURE, 'armhf']], [
|
473
|
+
|
474
|
+
// PocketPC mistakenly identified as PowerPC
|
475
|
+
/windows (ce|mobile); ppc;/i
|
476
|
+
], [[ARCHITECTURE, 'arm']], [
|
477
|
+
|
478
|
+
/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i // PowerPC
|
479
|
+
], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [
|
480
|
+
|
481
|
+
/(sun4\w)[;\)]/i // SPARC
|
482
|
+
], [[ARCHITECTURE, 'sparc']], [
|
483
|
+
|
484
|
+
/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
|
485
|
+
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
|
486
|
+
], [[ARCHITECTURE, lowerize]]
|
487
|
+
],
|
488
|
+
|
489
|
+
device : [[
|
490
|
+
|
491
|
+
//////////////////////////
|
492
|
+
// MOBILES & TABLETS
|
493
|
+
/////////////////////////
|
494
|
+
|
495
|
+
// Samsung
|
496
|
+
/\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
|
497
|
+
], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
|
498
|
+
/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
|
499
|
+
/samsung[- ]([-\w]+)/i,
|
500
|
+
/sec-(sgh\w+)/i
|
501
|
+
], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
|
502
|
+
|
503
|
+
// Apple
|
504
|
+
/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone
|
505
|
+
], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
|
506
|
+
/\((ipad);[-\w\),; ]+apple/i, // iPad
|
507
|
+
/applecoremedia\/[\w\.]+ \((ipad)/i,
|
508
|
+
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
|
509
|
+
], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
|
510
|
+
/(macintosh);/i
|
511
|
+
], [MODEL, [VENDOR, APPLE]], [
|
512
|
+
|
513
|
+
// Sharp
|
514
|
+
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
|
515
|
+
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
|
516
|
+
|
517
|
+
// Huawei
|
518
|
+
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
|
519
|
+
], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
|
520
|
+
/(?:huawei|honor)([-\w ]+)[;\)]/i,
|
521
|
+
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
|
522
|
+
], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
|
523
|
+
|
524
|
+
// Xiaomi
|
525
|
+
/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO
|
526
|
+
/\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
|
527
|
+
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
|
528
|
+
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
|
529
|
+
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
|
530
|
+
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
|
531
|
+
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
|
532
|
+
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, // Redmi Pad
|
533
|
+
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
|
534
|
+
],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
|
535
|
+
|
536
|
+
// OPPO
|
537
|
+
/; (\w+) bui.+ oppo/i,
|
538
|
+
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
|
539
|
+
], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [
|
540
|
+
/\b(opd2\d{3}a?) bui/i
|
541
|
+
], [MODEL, [VENDOR, 'OPPO'], [TYPE, TABLET]], [
|
542
|
+
|
543
|
+
// Vivo
|
544
|
+
/vivo (\w+)(?: bui|\))/i,
|
545
|
+
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
|
546
|
+
], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [
|
547
|
+
|
548
|
+
// Realme
|
549
|
+
/\b(rmx[1-3]\d{3})(?: bui|;|\))/i
|
550
|
+
], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [
|
551
|
+
|
552
|
+
// Motorola
|
553
|
+
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
|
554
|
+
/\bmot(?:orola)?[- ](\w*)/i,
|
555
|
+
/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
|
556
|
+
], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
|
557
|
+
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
|
558
|
+
], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
|
559
|
+
|
560
|
+
// LG
|
561
|
+
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
|
562
|
+
], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
|
563
|
+
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
|
564
|
+
/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
|
565
|
+
/\blg-?([\d\w]+) bui/i
|
566
|
+
], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [
|
567
|
+
|
568
|
+
// Lenovo
|
569
|
+
/(ideatab[-\w ]+)/i,
|
570
|
+
/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
|
571
|
+
], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [
|
572
|
+
|
573
|
+
// Nokia
|
574
|
+
/(?:maemo|nokia).*(n900|lumia \d+)/i,
|
575
|
+
/nokia[-_ ]?([-\w\.]*)/i
|
576
|
+
], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [
|
577
|
+
|
578
|
+
// Google
|
579
|
+
/(pixel c)\b/i // Google Pixel C
|
580
|
+
], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
|
581
|
+
/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
|
582
|
+
], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
|
583
|
+
|
584
|
+
// Sony
|
585
|
+
/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
|
586
|
+
], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
|
587
|
+
/sony tablet [ps]/i,
|
588
|
+
/\b(?:sony)?sgp\w+(?: bui|\))/i
|
589
|
+
], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
|
590
|
+
|
591
|
+
// OnePlus
|
592
|
+
/ (kb2005|in20[12]5|be20[12][59])\b/i,
|
593
|
+
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
|
594
|
+
], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
|
595
|
+
|
596
|
+
// Amazon
|
597
|
+
/(alexa)webm/i,
|
598
|
+
/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i, // Kindle Fire without Silk / Echo Show
|
599
|
+
/(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
|
600
|
+
], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
|
601
|
+
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
|
602
|
+
], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [
|
603
|
+
|
604
|
+
// BlackBerry
|
605
|
+
/(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook
|
606
|
+
], [MODEL, VENDOR, [TYPE, TABLET]], [
|
607
|
+
/\b((?:bb[a-f]|st[hv])100-\d)/i,
|
608
|
+
/\(bb10; (\w+)/i // BlackBerry 10
|
609
|
+
], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [
|
610
|
+
|
611
|
+
// Asus
|
612
|
+
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
|
613
|
+
], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
|
614
|
+
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
|
615
|
+
], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [
|
616
|
+
|
617
|
+
// HTC
|
618
|
+
/(nexus 9)/i // HTC Nexus 9
|
619
|
+
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
620
|
+
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC
|
621
|
+
|
622
|
+
// ZTE
|
623
|
+
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
|
624
|
+
/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
625
|
+
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
626
|
+
|
627
|
+
// Acer
|
628
|
+
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
|
629
|
+
], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
|
630
|
+
|
631
|
+
// Meizu
|
632
|
+
/droid.+; (m[1-5] note) bui/i,
|
633
|
+
/\bmz-([-\w]{2,})/i
|
634
|
+
], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
|
635
|
+
|
636
|
+
// Ulefone
|
637
|
+
/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
|
638
|
+
], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [
|
639
|
+
|
640
|
+
// MIXED
|
641
|
+
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,
|
642
|
+
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
|
643
|
+
/(hp) ([\w ]+\w)/i, // HP iPAQ
|
644
|
+
/(asus)-?(\w+)/i, // Asus
|
645
|
+
/(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
|
646
|
+
/(lenovo)[-_ ]?([-\w]+)/i, // Lenovo
|
647
|
+
/(jolla)/i, // Jolla
|
648
|
+
/(oppo) ?([\w ]+) bui/i // OPPO
|
649
|
+
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
650
|
+
|
651
|
+
/(kobo)\s(ereader|touch)/i, // Kobo
|
652
|
+
/(archos) (gamepad2?)/i, // Archos
|
653
|
+
/(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
|
654
|
+
/(kindle)\/([\w\.]+)/i, // Kindle
|
655
|
+
/(nook)[\w ]+build\/(\w+)/i, // Nook
|
656
|
+
/(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
657
|
+
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
658
|
+
/(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
659
|
+
/(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
660
|
+
/(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
661
|
+
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
662
|
+
|
663
|
+
/(surface duo)/i // Surface Duo
|
664
|
+
], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
|
665
|
+
/droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone
|
666
|
+
], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
|
667
|
+
/(u304aa)/i // AT&T
|
668
|
+
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
669
|
+
/\bsie-(\w*)/i // Siemens
|
670
|
+
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
671
|
+
/\b(rct\w+) b/i // RCA Tablets
|
672
|
+
], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
673
|
+
/\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
674
|
+
], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
675
|
+
/\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
676
|
+
], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
677
|
+
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
678
|
+
], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
679
|
+
/\b(tm\d{3}\w+) b/i
|
680
|
+
], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
681
|
+
/\b(k88) b/i // ZTE K Series Tablet
|
682
|
+
], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
683
|
+
/\b(nx\d{3}j) b/i // ZTE Nubia
|
684
|
+
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
685
|
+
/\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
686
|
+
], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
687
|
+
/\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
688
|
+
], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
689
|
+
/\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
690
|
+
], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
691
|
+
/\b([yr]\d{2}) b/i,
|
692
|
+
/\b(dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
693
|
+
], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [
|
694
|
+
/\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
695
|
+
], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
696
|
+
/\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
697
|
+
], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
698
|
+
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
699
|
+
], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
700
|
+
/\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
701
|
+
], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
702
|
+
/\b(ph-1) /i // Essential PH-1
|
703
|
+
], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
704
|
+
/\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
705
|
+
], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
706
|
+
/\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
707
|
+
], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
708
|
+
/\btu_(1491) b/i // Rotor Tablets
|
709
|
+
], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [
|
710
|
+
/(shield[\w ]+) b/i // Nvidia Shield Tablets
|
711
|
+
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [
|
712
|
+
/(sprint) (\w+)/i // Sprint Phones
|
713
|
+
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
714
|
+
/(kin\.[onetw]{3})/i // Microsoft Kin
|
715
|
+
], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
|
716
|
+
/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra
|
717
|
+
], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
|
718
|
+
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
|
719
|
+
], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [
|
720
|
+
|
721
|
+
///////////////////
|
722
|
+
// SMARTTVS
|
723
|
+
///////////////////
|
724
|
+
|
725
|
+
/smart-tv.+(samsung)/i // Samsung
|
726
|
+
], [VENDOR, [TYPE, SMARTTV]], [
|
727
|
+
/hbbtv.+maple;(\d+)/i
|
728
|
+
], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
|
729
|
+
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i // LG SmartTV
|
730
|
+
], [[VENDOR, LG], [TYPE, SMARTTV]], [
|
731
|
+
/(apple) ?tv/i // Apple TV
|
732
|
+
], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
|
733
|
+
/crkey/i // Google Chromecast
|
734
|
+
], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
735
|
+
/droid.+aft(\w+)( bui|\))/i // Fire TV
|
736
|
+
], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
|
737
|
+
/\(dtv[\);].+(aquos)/i,
|
738
|
+
/(aquos-tv[\w ]+)\)/i // Sharp
|
739
|
+
], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
|
740
|
+
/(bravia[\w ]+)( bui|\))/i // Sony
|
741
|
+
], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
|
742
|
+
/(mitv-\w{5}) bui/i // Xiaomi
|
743
|
+
], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
|
744
|
+
/Hbbtv.*(technisat) (.*);/i // TechniSAT
|
745
|
+
], [VENDOR, MODEL, [TYPE, SMARTTV]], [
|
746
|
+
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
|
747
|
+
/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices
|
748
|
+
], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
|
749
|
+
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors
|
750
|
+
], [[TYPE, SMARTTV]], [
|
751
|
+
|
752
|
+
///////////////////
|
753
|
+
// CONSOLES
|
754
|
+
///////////////////
|
755
|
+
|
756
|
+
/(ouya)/i, // Ouya
|
757
|
+
/(nintendo) ([wids3utch]+)/i // Nintendo
|
758
|
+
], [VENDOR, MODEL, [TYPE, CONSOLE]], [
|
759
|
+
/droid.+; (shield) bui/i // Nvidia
|
760
|
+
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
|
761
|
+
/(playstation [345portablevi]+)/i // Playstation
|
762
|
+
], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
|
763
|
+
/\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox
|
764
|
+
], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [
|
765
|
+
|
766
|
+
///////////////////
|
767
|
+
// WEARABLES
|
768
|
+
///////////////////
|
769
|
+
|
770
|
+
/((pebble))app/i // Pebble
|
771
|
+
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
|
772
|
+
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
|
773
|
+
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
|
774
|
+
/droid.+; (glass) \d/i // Google Glass
|
775
|
+
], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
|
776
|
+
/droid.+; (wt63?0{2,3})\)/i
|
777
|
+
], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
|
778
|
+
/(quest( \d| pro)?)/i // Oculus Quest
|
779
|
+
], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [
|
780
|
+
|
781
|
+
///////////////////
|
782
|
+
// EMBEDDED
|
783
|
+
///////////////////
|
784
|
+
|
785
|
+
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
|
786
|
+
], [VENDOR, [TYPE, EMBEDDED]], [
|
787
|
+
/(aeobc)\b/i // Echo Dot
|
788
|
+
], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
|
789
|
+
|
790
|
+
////////////////////
|
791
|
+
// MIXED (GENERIC)
|
792
|
+
///////////////////
|
793
|
+
|
794
|
+
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
|
795
|
+
], [MODEL, [TYPE, MOBILE]], [
|
796
|
+
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
|
797
|
+
], [MODEL, [TYPE, TABLET]], [
|
798
|
+
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
|
799
|
+
], [[TYPE, TABLET]], [
|
800
|
+
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
|
801
|
+
], [[TYPE, MOBILE]], [
|
802
|
+
/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
|
803
|
+
], [MODEL, [VENDOR, 'Generic']]
|
804
|
+
],
|
805
|
+
|
806
|
+
engine : [[
|
807
|
+
|
808
|
+
/windows.+ edge\/([\w\.]+)/i // EdgeHTML
|
809
|
+
], [VERSION, [NAME, EDGE+'HTML']], [
|
810
|
+
|
811
|
+
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
|
812
|
+
], [VERSION, [NAME, 'Blink']], [
|
813
|
+
|
814
|
+
/(presto)\/([\w\.]+)/i, // Presto
|
815
|
+
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
|
816
|
+
/ekioh(flow)\/([\w\.]+)/i, // Flow
|
817
|
+
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
|
818
|
+
/(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
|
819
|
+
/\b(libweb)/i
|
820
|
+
], [NAME, VERSION], [
|
821
|
+
|
822
|
+
/rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
|
823
|
+
], [VERSION, NAME]
|
824
|
+
],
|
825
|
+
|
826
|
+
os : [[
|
827
|
+
|
828
|
+
// Windows
|
829
|
+
/microsoft (windows) (vista|xp)/i // Windows (iTunes)
|
830
|
+
], [NAME, VERSION], [
|
831
|
+
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i // Windows Phone
|
832
|
+
], [NAME, [VERSION, strMapper, windowsVersionMap]], [
|
833
|
+
/windows nt 6\.2; (arm)/i, // Windows RT
|
834
|
+
/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,
|
835
|
+
/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i
|
836
|
+
], [[VERSION, strMapper, windowsVersionMap], [NAME, 'Windows']], [
|
837
|
+
|
838
|
+
// iOS/macOS
|
839
|
+
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
|
840
|
+
/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
|
841
|
+
/cfnetwork\/.+darwin/i
|
842
|
+
], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
|
843
|
+
/(mac os x) ?([\w\. ]*)/i,
|
844
|
+
/(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
|
845
|
+
], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [
|
846
|
+
|
847
|
+
// Mobile OSes
|
848
|
+
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
|
849
|
+
], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
|
850
|
+
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
|
851
|
+
/(blackberry)\w*\/([\w\.]*)/i, // Blackberry
|
852
|
+
/(tizen|kaios)[\/ ]([\w\.]+)/i, // Tizen/KaiOS
|
853
|
+
/\((series40);/i // Series 40
|
854
|
+
], [NAME, VERSION], [
|
855
|
+
/\(bb(10);/i // BlackBerry 10
|
856
|
+
], [VERSION, [NAME, BLACKBERRY]], [
|
857
|
+
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i // Symbian
|
858
|
+
], [VERSION, [NAME, 'Symbian']], [
|
859
|
+
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
|
860
|
+
], [VERSION, [NAME, FIREFOX+' OS']], [
|
861
|
+
/web0s;.+rt(tv)/i,
|
862
|
+
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
|
863
|
+
], [VERSION, [NAME, 'webOS']], [
|
864
|
+
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
|
865
|
+
], [VERSION, [NAME, 'watchOS']], [
|
866
|
+
|
867
|
+
// Google Chromecast
|
868
|
+
/crkey\/([\d\.]+)/i // Google Chromecast
|
869
|
+
], [VERSION, [NAME, CHROME+'cast']], [
|
870
|
+
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
|
871
|
+
], [[NAME, CHROMIUM_OS], VERSION],[
|
872
|
+
|
873
|
+
// Smart TVs
|
874
|
+
/panasonic;(viera)/i, // Panasonic Viera
|
875
|
+
/(netrange)mmh/i, // Netrange
|
876
|
+
/(nettv)\/(\d+\.[\w\.]+)/i, // NetTV
|
877
|
+
|
878
|
+
// Console
|
879
|
+
/(nintendo|playstation) ([wids345portablevuch]+)/i, // Nintendo/Playstation
|
880
|
+
/(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)
|
881
|
+
|
882
|
+
// Other
|
883
|
+
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm
|
884
|
+
/(mint)[\/\(\) ]?(\w*)/i, // Mint
|
885
|
+
/(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux
|
886
|
+
/([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,
|
887
|
+
// Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
|
888
|
+
/(hurd|linux) ?([\w\.]*)/i, // Hurd/Linux
|
889
|
+
/(gnu) ?([\w\.]*)/i, // GNU
|
890
|
+
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
|
891
|
+
/(haiku) (\w+)/i // Haiku
|
892
|
+
], [NAME, VERSION], [
|
893
|
+
/(sunos) ?([\w\.\d]*)/i // Solaris
|
894
|
+
], [[NAME, 'Solaris'], VERSION], [
|
895
|
+
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
|
896
|
+
/(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX
|
897
|
+
/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
|
898
|
+
/(unix) ?([\w\.]*)/i // UNIX
|
899
|
+
], [NAME, VERSION]
|
900
|
+
]
|
901
|
+
};
|
902
|
+
|
903
|
+
/////////////////
|
904
|
+
// Constructor
|
905
|
+
////////////////
|
906
|
+
|
907
|
+
var UAParser = function (ua, extensions) {
|
908
|
+
|
909
|
+
if (typeof ua === OBJ_TYPE) {
|
910
|
+
extensions = ua;
|
911
|
+
ua = undefined$1;
|
912
|
+
}
|
913
|
+
|
914
|
+
if (!(this instanceof UAParser)) {
|
915
|
+
return new UAParser(ua, extensions).getResult();
|
916
|
+
}
|
917
|
+
|
918
|
+
var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined$1;
|
919
|
+
var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY);
|
920
|
+
var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined$1;
|
921
|
+
var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
|
922
|
+
var _isSelfNav = _navigator && _navigator.userAgent == _ua;
|
923
|
+
|
924
|
+
this.getBrowser = function () {
|
925
|
+
var _browser = {};
|
926
|
+
_browser[NAME] = undefined$1;
|
927
|
+
_browser[VERSION] = undefined$1;
|
928
|
+
rgxMapper.call(_browser, _ua, _rgxmap.browser);
|
929
|
+
_browser[MAJOR] = majorize(_browser[VERSION]);
|
930
|
+
// Brave-specific detection
|
931
|
+
if (_isSelfNav && _navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) {
|
932
|
+
_browser[NAME] = 'Brave';
|
933
|
+
}
|
934
|
+
return _browser;
|
935
|
+
};
|
936
|
+
this.getCPU = function () {
|
937
|
+
var _cpu = {};
|
938
|
+
_cpu[ARCHITECTURE] = undefined$1;
|
939
|
+
rgxMapper.call(_cpu, _ua, _rgxmap.cpu);
|
940
|
+
return _cpu;
|
941
|
+
};
|
942
|
+
this.getDevice = function () {
|
943
|
+
var _device = {};
|
944
|
+
_device[VENDOR] = undefined$1;
|
945
|
+
_device[MODEL] = undefined$1;
|
946
|
+
_device[TYPE] = undefined$1;
|
947
|
+
rgxMapper.call(_device, _ua, _rgxmap.device);
|
948
|
+
if (_isSelfNav && !_device[TYPE] && _uach && _uach.mobile) {
|
949
|
+
_device[TYPE] = MOBILE;
|
950
|
+
}
|
951
|
+
// iPadOS-specific detection: identified as Mac, but has some iOS-only properties
|
952
|
+
if (_isSelfNav && _device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) {
|
953
|
+
_device[MODEL] = 'iPad';
|
954
|
+
_device[TYPE] = TABLET;
|
955
|
+
}
|
956
|
+
return _device;
|
957
|
+
};
|
958
|
+
this.getEngine = function () {
|
959
|
+
var _engine = {};
|
960
|
+
_engine[NAME] = undefined$1;
|
961
|
+
_engine[VERSION] = undefined$1;
|
962
|
+
rgxMapper.call(_engine, _ua, _rgxmap.engine);
|
963
|
+
return _engine;
|
964
|
+
};
|
965
|
+
this.getOS = function () {
|
966
|
+
var _os = {};
|
967
|
+
_os[NAME] = undefined$1;
|
968
|
+
_os[VERSION] = undefined$1;
|
969
|
+
rgxMapper.call(_os, _ua, _rgxmap.os);
|
970
|
+
if (_isSelfNav && !_os[NAME] && _uach && _uach.platform && _uach.platform != 'Unknown') {
|
971
|
+
_os[NAME] = _uach.platform
|
972
|
+
.replace(/chrome os/i, CHROMIUM_OS)
|
973
|
+
.replace(/macos/i, MAC_OS); // backward compatibility
|
974
|
+
}
|
975
|
+
return _os;
|
976
|
+
};
|
977
|
+
this.getResult = function () {
|
978
|
+
return {
|
979
|
+
ua : this.getUA(),
|
980
|
+
browser : this.getBrowser(),
|
981
|
+
engine : this.getEngine(),
|
982
|
+
os : this.getOS(),
|
983
|
+
device : this.getDevice(),
|
984
|
+
cpu : this.getCPU()
|
985
|
+
};
|
986
|
+
};
|
987
|
+
this.getUA = function () {
|
988
|
+
return _ua;
|
989
|
+
};
|
990
|
+
this.setUA = function (ua) {
|
991
|
+
_ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;
|
992
|
+
return this;
|
993
|
+
};
|
994
|
+
this.setUA(_ua);
|
995
|
+
return this;
|
996
|
+
};
|
997
|
+
|
998
|
+
UAParser.VERSION = LIBVERSION;
|
999
|
+
UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR]);
|
1000
|
+
UAParser.CPU = enumerize([ARCHITECTURE]);
|
1001
|
+
UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
|
1002
|
+
UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);
|
1003
|
+
|
1004
|
+
///////////
|
1005
|
+
// Export
|
1006
|
+
//////////
|
1007
|
+
|
1008
|
+
// check js environment
|
1009
|
+
{
|
1010
|
+
// nodejs env
|
1011
|
+
if (module.exports) {
|
1012
|
+
exports = module.exports = UAParser;
|
1013
|
+
}
|
1014
|
+
exports.UAParser = UAParser;
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
// jQuery/Zepto specific (optional)
|
1018
|
+
// Note:
|
1019
|
+
// In AMD env the global scope should be kept clean, but jQuery is an exception.
|
1020
|
+
// jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
|
1021
|
+
// and we should catch that.
|
1022
|
+
var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);
|
1023
|
+
if ($ && !$.ua) {
|
1024
|
+
var parser = new UAParser();
|
1025
|
+
$.ua = parser.getResult();
|
1026
|
+
$.ua.get = function () {
|
1027
|
+
return parser.getUA();
|
1028
|
+
};
|
1029
|
+
$.ua.set = function (ua) {
|
1030
|
+
parser.setUA(ua);
|
1031
|
+
var result = parser.getResult();
|
1032
|
+
for (var prop in result) {
|
1033
|
+
$.ua[prop] = result[prop];
|
1034
|
+
}
|
1035
|
+
};
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
})(typeof window === 'object' ? window : commonjsGlobal);
|
1039
|
+
} (uaParser, uaParser.exports));
|
1040
|
+
|
1041
|
+
var Request = /** @class */ (function () {
|
1042
|
+
function Request(options) {
|
1043
|
+
this.options = options;
|
1044
|
+
}
|
1045
|
+
return Request;
|
1046
|
+
}());
|
1047
|
+
/**
|
1048
|
+
* 图片请求
|
1049
|
+
*/
|
1050
|
+
/** @class */ ((function (_super) {
|
1051
|
+
__extends(ImageRequest, _super);
|
1052
|
+
function ImageRequest(options) {
|
1053
|
+
var _this = _super.call(this, options) || this;
|
1054
|
+
_this.options = options;
|
1055
|
+
return _this;
|
1056
|
+
}
|
1057
|
+
ImageRequest.prototype.run = function () {
|
1058
|
+
var _this = this;
|
1059
|
+
return new Promise(function (resolve) {
|
1060
|
+
var _a = _this.options, imgUseCrossOrigin = _a.imgUseCrossOrigin, url = _a.url, data = _a.data;
|
1061
|
+
var img = new Image();
|
1062
|
+
if (imgUseCrossOrigin) {
|
1063
|
+
img.crossOrigin = 'anonymous';
|
1064
|
+
}
|
1065
|
+
var spliceStr = url.indexOf('?') === -1 ? '?' : '&';
|
1066
|
+
img.src = "".concat(url).concat(spliceStr, "data=").concat(data);
|
1067
|
+
var callback = function (type) {
|
1068
|
+
img.src = null;
|
1069
|
+
img = null;
|
1070
|
+
resolve({ type: type });
|
1071
|
+
};
|
1072
|
+
img.onload = function () {
|
1073
|
+
callback('success');
|
1074
|
+
};
|
1075
|
+
img.onerror = function () {
|
1076
|
+
callback('error');
|
1077
|
+
};
|
1078
|
+
img.onabort = function () {
|
1079
|
+
callback('abort');
|
1080
|
+
};
|
1081
|
+
});
|
1082
|
+
};
|
1083
|
+
return ImageRequest;
|
1084
|
+
})(Request));
|
1085
|
+
/**
|
1086
|
+
* ajax请求
|
1087
|
+
*/
|
1088
|
+
/** @class */ ((function (_super) {
|
1089
|
+
__extends(AjaxRequest, _super);
|
1090
|
+
function AjaxRequest(options) {
|
1091
|
+
var _this = _super.call(this, options) || this;
|
1092
|
+
_this.options = options;
|
1093
|
+
return _this;
|
1094
|
+
}
|
1095
|
+
AjaxRequest.prototype.run = function () {
|
1096
|
+
var _this = this;
|
1097
|
+
return new Promise(function (resolve) {
|
1098
|
+
var _a = _this.options, url = _a.url, data = _a.data, timeout = _a.timeout;
|
1099
|
+
var xhr = new XMLHttpRequest();
|
1100
|
+
xhr.open('POST', url, true);
|
1101
|
+
xhr.timeout = timeout || 20000;
|
1102
|
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
1103
|
+
xhr.send(data || null);
|
1104
|
+
xhr.onreadystatechange = function () {
|
1105
|
+
if (xhr.readyState === 4) {
|
1106
|
+
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) {
|
1107
|
+
resolve({
|
1108
|
+
type: 'success'
|
1109
|
+
});
|
1110
|
+
}
|
1111
|
+
else {
|
1112
|
+
resolve({
|
1113
|
+
type: 'error',
|
1114
|
+
msg: "\u7F51\u7EDC\u5F02\u5E38, \u8BF7\u6C42\u5931\u8D25".concat(xhr.status)
|
1115
|
+
});
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
};
|
1119
|
+
});
|
1120
|
+
};
|
1121
|
+
return AjaxRequest;
|
1122
|
+
})(Request));
|
1123
|
+
/**
|
1124
|
+
* beacon请求
|
1125
|
+
*/
|
1126
|
+
/** @class */ ((function (_super) {
|
1127
|
+
__extends(BeaconRequest, _super);
|
1128
|
+
function BeaconRequest(options) {
|
1129
|
+
var _this = _super.call(this, options) || this;
|
1130
|
+
_this.options = options;
|
1131
|
+
return _this;
|
1132
|
+
}
|
1133
|
+
BeaconRequest.prototype.run = function () {
|
1134
|
+
var _this = this;
|
1135
|
+
return new Promise(function (resolve) {
|
1136
|
+
var _a = _this.options, url = _a.url, data = _a.data;
|
1137
|
+
if (navigator.sendBeacon) {
|
1138
|
+
var isSuccess = navigator.sendBeacon(url, data);
|
1139
|
+
if (isSuccess) {
|
1140
|
+
resolve({
|
1141
|
+
type: 'success'
|
1142
|
+
});
|
1143
|
+
}
|
1144
|
+
else {
|
1145
|
+
resolve({
|
1146
|
+
type: 'error',
|
1147
|
+
msg: 'sendBeacon 请求失败'
|
1148
|
+
});
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
});
|
1152
|
+
};
|
1153
|
+
return BeaconRequest;
|
1154
|
+
})(Request));
|
1155
|
+
|
1156
|
+
/**
|
1157
|
+
* 是否支持console
|
1158
|
+
*/
|
1159
|
+
function supportConsole() {
|
1160
|
+
return typeof console !== 'undefined';
|
1161
|
+
}
|
1162
|
+
/**
|
1163
|
+
* 打印日志
|
1164
|
+
* @param message
|
1165
|
+
* @param type
|
1166
|
+
*/
|
1167
|
+
function log(message, type) {
|
1168
|
+
if (type === void 0) { type = ConsoleTypes.LOG; }
|
1169
|
+
var func = console[type] || console.log;
|
1170
|
+
if (typeof func === 'function') {
|
1171
|
+
func(message);
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
var BaseCore = /** @class */ (function () {
|
1176
|
+
function BaseCore(options, useInstancing) {
|
1177
|
+
if (useInstancing === void 0) { useInstancing = true; }
|
1178
|
+
/**
|
1179
|
+
* SDK是否已准备就绪
|
1180
|
+
*/
|
1181
|
+
this.isReady = false;
|
1182
|
+
/**
|
1183
|
+
* 控制台前缀
|
1184
|
+
*/
|
1185
|
+
this.consolePrefix = '';
|
1186
|
+
/**
|
1187
|
+
* 初始化SDK的方式,默认为true,即通过new的方式初始化SDK,如果使用函数调用初始化SDK,则设置为false
|
1188
|
+
*/
|
1189
|
+
this.useInstancing = true;
|
1190
|
+
this.options = options;
|
1191
|
+
this.useInstancing = useInstancing;
|
1192
|
+
}
|
1193
|
+
/**
|
1194
|
+
* 打印日志
|
1195
|
+
* @param message 日志消息
|
1196
|
+
* @param type 日志类型
|
1197
|
+
*/
|
1198
|
+
BaseCore.prototype.log = function (message, type) {
|
1199
|
+
if (type === void 0) { type = ConsoleTypes.LOG; }
|
1200
|
+
var showLog = this.options.showLog;
|
1201
|
+
if (!supportConsole() || !showLog)
|
1202
|
+
return;
|
1203
|
+
if (typeof message === 'string' && this.consolePrefix) {
|
1204
|
+
message = "".concat(this.consolePrefix, "\uFF1A").concat(message);
|
1205
|
+
}
|
1206
|
+
log(message, type);
|
1207
|
+
};
|
1208
|
+
/**
|
1209
|
+
* 执行插件
|
1210
|
+
* @param plugins
|
1211
|
+
*/
|
1212
|
+
BaseCore.prototype.runPlugins = function (plugins) {
|
1213
|
+
var _this = this;
|
1214
|
+
var _loop_1 = function (i) {
|
1215
|
+
var plugin = plugins[i];
|
1216
|
+
plugin.init(function (data) {
|
1217
|
+
if (!plugin.transform)
|
1218
|
+
return;
|
1219
|
+
var result = plugin.transform(data);
|
1220
|
+
if (!result)
|
1221
|
+
return;
|
1222
|
+
_this.report(result);
|
1223
|
+
});
|
1224
|
+
};
|
1225
|
+
for (var i = 0; i < plugins.length; i++) {
|
1226
|
+
_loop_1(i);
|
1227
|
+
}
|
1228
|
+
};
|
1229
|
+
return BaseCore;
|
1230
|
+
}());
|
1231
|
+
|
1232
|
+
var GET_DEFAULT_OPTIONS = function () {
|
1233
|
+
return {
|
1234
|
+
serverUrl: '',
|
1235
|
+
name: '',
|
1236
|
+
errorCapture: true,
|
1237
|
+
performance: true
|
1238
|
+
};
|
1239
|
+
};
|
1240
|
+
|
1241
|
+
var JsErrorPlugin = /** @class */ (function (_super) {
|
1242
|
+
__extends(JsErrorPlugin, _super);
|
1243
|
+
function JsErrorPlugin(options, context) {
|
1244
|
+
var _this = _super.call(this, options, context) || this;
|
1245
|
+
_this.options = options;
|
1246
|
+
_this.context = context;
|
1247
|
+
_this.name = 'JsErrorPlugin';
|
1248
|
+
return _this;
|
1249
|
+
}
|
1250
|
+
JsErrorPlugin.prototype.init = function (notify) {
|
1251
|
+
window.onerror = function (message, source, lineno, colno, error) {
|
1252
|
+
console.log('message', message);
|
1253
|
+
console.log('source', source);
|
1254
|
+
console.log('lineno', lineno, colno);
|
1255
|
+
console.log('error', error);
|
1256
|
+
};
|
1257
|
+
};
|
1258
|
+
JsErrorPlugin.prototype.transform = function (data) {
|
1259
|
+
return undefined;
|
1260
|
+
};
|
1261
|
+
return JsErrorPlugin;
|
1262
|
+
}(PluginBase));
|
1263
|
+
|
1264
|
+
var Monitor = /** @class */ (function (_super) {
|
1265
|
+
__extends(Monitor, _super);
|
1266
|
+
function Monitor(options, useInstancing) {
|
1267
|
+
if (useInstancing === void 0) { useInstancing = true; }
|
1268
|
+
var _this = _super.call(this, options, useInstancing) || this;
|
1269
|
+
_this.consolePrefix = '性能监控SDK';
|
1270
|
+
/**
|
1271
|
+
* 插件列表
|
1272
|
+
*/
|
1273
|
+
_this.plugins = [];
|
1274
|
+
// 使用new的方式初始化SDK,需要默认调用init方法进行初始化
|
1275
|
+
if (_this.useInstancing) {
|
1276
|
+
_this.init(options);
|
1277
|
+
}
|
1278
|
+
return _this;
|
1279
|
+
}
|
1280
|
+
/**
|
1281
|
+
* 注册/初始化SDK
|
1282
|
+
* @param options
|
1283
|
+
*/
|
1284
|
+
Monitor.prototype.init = function (options) {
|
1285
|
+
if (this.isReady) {
|
1286
|
+
this.log('Monitor has been initialized', ConsoleTypes.ERROR);
|
1287
|
+
return;
|
1288
|
+
}
|
1289
|
+
var default_config = GET_DEFAULT_OPTIONS();
|
1290
|
+
// 将用户配置项和默认配置项合并
|
1291
|
+
this.options = merge(default_config, options);
|
1292
|
+
// 处理配置信息
|
1293
|
+
this.normalizeConfig();
|
1294
|
+
// 插件初始化
|
1295
|
+
this.initPlugins();
|
1296
|
+
// SDK初始化成功,一切准备就绪
|
1297
|
+
this.isReady = true;
|
1298
|
+
this.log('Monitor initialized successfully');
|
1299
|
+
console.log('this.options', this);
|
1300
|
+
};
|
1301
|
+
/**
|
1302
|
+
* 处理配置信息
|
1303
|
+
*/
|
1304
|
+
Monitor.prototype.normalizeConfig = function () {
|
1305
|
+
var serverUrl = this.options.serverUrl;
|
1306
|
+
serverUrl = serverUrl || '';
|
1307
|
+
serverUrl = serverUrl.trim();
|
1308
|
+
if (serverUrl === '') {
|
1309
|
+
this.log('当前 serverUrl 为空或不正确,network 中不会发数据,请配置正确的 serverUrl!', ConsoleTypes.WARN);
|
1310
|
+
}
|
1311
|
+
};
|
1312
|
+
/**
|
1313
|
+
* 应用插件
|
1314
|
+
*/
|
1315
|
+
Monitor.prototype.initPlugins = function () {
|
1316
|
+
var jsErrorPlugin = new JsErrorPlugin(this.options, this);
|
1317
|
+
this.plugins = [jsErrorPlugin];
|
1318
|
+
this.runPlugins(this.plugins);
|
1319
|
+
};
|
1320
|
+
/**
|
1321
|
+
* 上报数据
|
1322
|
+
* @param data
|
1323
|
+
* @param callback
|
1324
|
+
* @param type
|
1325
|
+
*/
|
1326
|
+
Monitor.prototype.report = function (data, callback, type) { };
|
1327
|
+
return Monitor;
|
1328
|
+
}(BaseCore));
|
1329
|
+
|
1330
|
+
function createInstance(options) {
|
1331
|
+
return new Monitor(options, false);
|
1332
|
+
}
|
1333
|
+
var hinaEpmSdk = createInstance({});
|
1334
|
+
|
1335
|
+
exports.Monitor = Monitor;
|
1336
|
+
exports.default = hinaEpmSdk;
|
1337
|
+
|
1338
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
1339
|
+
|
1340
|
+
return exports;
|
1341
|
+
|
1342
|
+
})({});
|
1343
|
+
//# sourceMappingURL=index.global.js.map
|