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