@bigbinary/neetoui 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/formik.cjs.js +2326 -602
- package/formik.cjs.js.map +1 -1
- package/formik.js +2327 -603
- package/formik.js.map +1 -1
- package/index.cjs.js +2328 -604
- package/index.cjs.js.map +1 -1
- package/index.css +1 -1
- package/index.js +2329 -605
- package/index.js.map +1 -1
- package/package.json +2 -2
package/formik.cjs.js
CHANGED
|
@@ -55,7 +55,7 @@ function _extends$2() {
|
|
|
55
55
|
return _extends$2.apply(this, arguments);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
58
|
+
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
59
59
|
|
|
60
60
|
var classnames$2 = {exports: {}};
|
|
61
61
|
|
|
@@ -111,22 +111,22 @@ var classnames$2 = {exports: {}};
|
|
|
111
111
|
|
|
112
112
|
var classnames$1 = classnames$2.exports;
|
|
113
113
|
|
|
114
|
-
function _typeof$
|
|
114
|
+
function _typeof$3(obj) {
|
|
115
115
|
"@babel/helpers - typeof";
|
|
116
116
|
|
|
117
|
-
return _typeof$
|
|
117
|
+
return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
118
118
|
return typeof obj;
|
|
119
119
|
} : function (obj) {
|
|
120
120
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
121
|
-
}, _typeof$
|
|
121
|
+
}, _typeof$3(obj);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function _toPrimitive(input, hint) {
|
|
125
|
-
if (_typeof$
|
|
125
|
+
if (_typeof$3(input) !== "object" || input === null) return input;
|
|
126
126
|
var prim = input[Symbol.toPrimitive];
|
|
127
127
|
if (prim !== undefined) {
|
|
128
128
|
var res = prim.call(input, hint || "default");
|
|
129
|
-
if (_typeof$
|
|
129
|
+
if (_typeof$3(res) !== "object") return res;
|
|
130
130
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
131
131
|
}
|
|
132
132
|
return (hint === "string" ? String : Number)(input);
|
|
@@ -134,7 +134,7 @@ function _toPrimitive(input, hint) {
|
|
|
134
134
|
|
|
135
135
|
function _toPropertyKey(arg) {
|
|
136
136
|
var key = _toPrimitive(arg, "string");
|
|
137
|
-
return _typeof$
|
|
137
|
+
return _typeof$3(key) === "symbol" ? key : String(key);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
function _defineProperty$1(obj, key, value) {
|
|
@@ -3676,7 +3676,7 @@ function applyDefaultFilter(v) {
|
|
|
3676
3676
|
return name + "(" + defaultValue + unit + ")";
|
|
3677
3677
|
}
|
|
3678
3678
|
const functionRegex = /([a-z-]*)\(.*?\)/g;
|
|
3679
|
-
const filter
|
|
3679
|
+
const filter = {
|
|
3680
3680
|
...complex,
|
|
3681
3681
|
getAnimatableNone: (v) => {
|
|
3682
3682
|
const functions = v.match(functionRegex);
|
|
@@ -3701,8 +3701,8 @@ const defaultValueTypes = {
|
|
|
3701
3701
|
borderRightColor: color,
|
|
3702
3702
|
borderBottomColor: color,
|
|
3703
3703
|
borderLeftColor: color,
|
|
3704
|
-
filter
|
|
3705
|
-
WebkitFilter: filter
|
|
3704
|
+
filter,
|
|
3705
|
+
WebkitFilter: filter,
|
|
3706
3706
|
};
|
|
3707
3707
|
/**
|
|
3708
3708
|
* Gets the default ValueType for the provided value key
|
|
@@ -3711,7 +3711,7 @@ const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
|
3711
3711
|
|
|
3712
3712
|
function getAnimatableNone(key, value) {
|
|
3713
3713
|
let defaultValueType = getDefaultValueType(key);
|
|
3714
|
-
if (defaultValueType !== filter
|
|
3714
|
+
if (defaultValueType !== filter)
|
|
3715
3715
|
defaultValueType = complex;
|
|
3716
3716
|
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
|
|
3717
3717
|
return defaultValueType.getAnimatableNone
|
|
@@ -9428,11 +9428,11 @@ Spinner$1.defaultProps = {
|
|
|
9428
9428
|
size: 14
|
|
9429
9429
|
};
|
|
9430
9430
|
|
|
9431
|
-
function _arrayWithHoles$
|
|
9431
|
+
function _arrayWithHoles$2(arr) {
|
|
9432
9432
|
if (Array.isArray(arr)) return arr;
|
|
9433
9433
|
}
|
|
9434
9434
|
|
|
9435
|
-
function _iterableToArrayLimit$
|
|
9435
|
+
function _iterableToArrayLimit$2(arr, i) {
|
|
9436
9436
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9437
9437
|
if (null != _i) {
|
|
9438
9438
|
var _s,
|
|
@@ -9460,27 +9460,27 @@ function _iterableToArrayLimit$1(arr, i) {
|
|
|
9460
9460
|
}
|
|
9461
9461
|
}
|
|
9462
9462
|
|
|
9463
|
-
function _arrayLikeToArray$
|
|
9463
|
+
function _arrayLikeToArray$2(arr, len) {
|
|
9464
9464
|
if (len == null || len > arr.length) len = arr.length;
|
|
9465
9465
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9466
9466
|
return arr2;
|
|
9467
9467
|
}
|
|
9468
9468
|
|
|
9469
|
-
function _unsupportedIterableToArray$
|
|
9469
|
+
function _unsupportedIterableToArray$2(o, minLen) {
|
|
9470
9470
|
if (!o) return;
|
|
9471
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
9471
|
+
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
9472
9472
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9473
9473
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9474
9474
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
9475
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
9475
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
9476
9476
|
}
|
|
9477
9477
|
|
|
9478
|
-
function _nonIterableRest$
|
|
9478
|
+
function _nonIterableRest$2() {
|
|
9479
9479
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9480
9480
|
}
|
|
9481
9481
|
|
|
9482
|
-
function _slicedToArray$
|
|
9483
|
-
return _arrayWithHoles$
|
|
9482
|
+
function _slicedToArray$2(arr, i) {
|
|
9483
|
+
return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
|
|
9484
9484
|
}
|
|
9485
9485
|
|
|
9486
9486
|
var top = 'top';
|
|
@@ -13357,7 +13357,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
13357
13357
|
hideOnTargetExit = _ref$hideOnTargetExit === void 0 ? false : _ref$hideOnTargetExit,
|
|
13358
13358
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$x);
|
|
13359
13359
|
var _useState = React.useState(null),
|
|
13360
|
-
_useState2 = _slicedToArray$
|
|
13360
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
13361
13361
|
instance = _useState2[0],
|
|
13362
13362
|
setInstance = _useState2[1];
|
|
13363
13363
|
var localProps = {};
|
|
@@ -15117,7 +15117,7 @@ var useNavPrompt = function useNavPrompt(_ref) {
|
|
|
15117
15117
|
var _ref$shouldBlock = _ref.shouldBlock,
|
|
15118
15118
|
shouldBlock = _ref$shouldBlock === void 0 ? true : _ref$shouldBlock;
|
|
15119
15119
|
var _useState = React.useState(false),
|
|
15120
|
-
_useState2 = _slicedToArray$
|
|
15120
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
15121
15121
|
isBlocked = _useState2[0],
|
|
15122
15122
|
setIsBlocked = _useState2[1];
|
|
15123
15123
|
var history = reactRouterDom.useHistory();
|
|
@@ -15202,647 +15202,2381 @@ var useOnClickOutside = function useOnClickOutside(insideRef, outsideRef, handle
|
|
|
15202
15202
|
}, [insideRef, outsideRef, handler]);
|
|
15203
15203
|
};
|
|
15204
15204
|
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
var
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15205
|
+
var MODES = {
|
|
15206
|
+
"default": "default",
|
|
15207
|
+
global: "global",
|
|
15208
|
+
scoped: "scoped"
|
|
15209
|
+
};
|
|
15210
|
+
var DEFAULT_CONFIG = {
|
|
15211
|
+
mode: MODES["default"],
|
|
15212
|
+
unbindOnUnmount: true,
|
|
15213
|
+
enabled: true
|
|
15214
|
+
};
|
|
15215
|
+
var MAC_TO_WINDOWS_KEYS_MAP = {
|
|
15216
|
+
option: "alt",
|
|
15217
|
+
command: "ctrl",
|
|
15218
|
+
"return": "enter",
|
|
15219
|
+
"delete": "backspace"
|
|
15220
|
+
};
|
|
15221
|
+
var OS = {
|
|
15222
|
+
mac: "OS X",
|
|
15223
|
+
windows: "Windows"
|
|
15224
|
+
};
|
|
15225
|
+
var KEY_NAMES = {
|
|
15226
|
+
"delete": "delete",
|
|
15227
|
+
backspace: "backspace"
|
|
15228
|
+
};
|
|
15227
15229
|
|
|
15228
|
-
function
|
|
15229
|
-
|
|
15230
|
+
function _arrayWithHoles$1(arr) {
|
|
15231
|
+
if (Array.isArray(arr)) return arr;
|
|
15232
|
+
}
|
|
15230
15233
|
|
|
15231
|
-
|
|
15232
|
-
|
|
15234
|
+
function _iterableToArrayLimit$1(r, l) {
|
|
15235
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
15236
|
+
if (null != t) {
|
|
15237
|
+
var e,
|
|
15238
|
+
n,
|
|
15239
|
+
i,
|
|
15240
|
+
u,
|
|
15241
|
+
a = [],
|
|
15242
|
+
f = !0,
|
|
15243
|
+
o = !1;
|
|
15244
|
+
try {
|
|
15245
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
15246
|
+
if (Object(t) !== t) return;
|
|
15247
|
+
f = !1;
|
|
15248
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
15249
|
+
} catch (r) {
|
|
15250
|
+
o = !0, n = r;
|
|
15251
|
+
} finally {
|
|
15252
|
+
try {
|
|
15253
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
15254
|
+
} finally {
|
|
15255
|
+
if (o) throw n;
|
|
15256
|
+
}
|
|
15257
|
+
}
|
|
15258
|
+
return a;
|
|
15233
15259
|
}
|
|
15260
|
+
}
|
|
15234
15261
|
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
if (typeof key !== 'string') key = '';
|
|
15241
|
-
key = key.replace(/\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等
|
|
15242
|
-
|
|
15243
|
-
var keys = key.split(','); // 同时设置多个快捷键,以','分割
|
|
15244
|
-
|
|
15245
|
-
var index = keys.lastIndexOf(''); // 快捷键可能包含',',需特殊处理
|
|
15262
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
15263
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
15264
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15265
|
+
return arr2;
|
|
15266
|
+
}
|
|
15246
15267
|
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15268
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
15269
|
+
if (!o) return;
|
|
15270
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
15271
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15272
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15273
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
15274
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
15275
|
+
}
|
|
15252
15276
|
|
|
15253
|
-
|
|
15254
|
-
|
|
15277
|
+
function _nonIterableRest$1() {
|
|
15278
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
15279
|
+
}
|
|
15255
15280
|
|
|
15281
|
+
function _slicedToArray$1(arr, i) {
|
|
15282
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
15283
|
+
}
|
|
15256
15284
|
|
|
15257
|
-
|
|
15258
|
-
var arr1 = a1.length >= a2.length ? a1 : a2;
|
|
15259
|
-
var arr2 = a1.length >= a2.length ? a2 : a1;
|
|
15260
|
-
var isIndex = true;
|
|
15285
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
15261
15286
|
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15287
|
+
function getDefaultExportFromCjs (x) {
|
|
15288
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
15289
|
+
}
|
|
15265
15290
|
|
|
15266
|
-
|
|
15267
|
-
}
|
|
15268
|
-
|
|
15269
|
-
var _keyMap = {
|
|
15270
|
-
backspace: 8,
|
|
15271
|
-
tab: 9,
|
|
15272
|
-
clear: 12,
|
|
15273
|
-
enter: 13,
|
|
15274
|
-
return: 13,
|
|
15275
|
-
esc: 27,
|
|
15276
|
-
escape: 27,
|
|
15277
|
-
space: 32,
|
|
15278
|
-
left: 37,
|
|
15279
|
-
up: 38,
|
|
15280
|
-
right: 39,
|
|
15281
|
-
down: 40,
|
|
15282
|
-
del: 46,
|
|
15283
|
-
delete: 46,
|
|
15284
|
-
ins: 45,
|
|
15285
|
-
insert: 45,
|
|
15286
|
-
home: 36,
|
|
15287
|
-
end: 35,
|
|
15288
|
-
pageup: 33,
|
|
15289
|
-
pagedown: 34,
|
|
15290
|
-
capslock: 20,
|
|
15291
|
-
num_0: 96,
|
|
15292
|
-
num_1: 97,
|
|
15293
|
-
num_2: 98,
|
|
15294
|
-
num_3: 99,
|
|
15295
|
-
num_4: 100,
|
|
15296
|
-
num_5: 101,
|
|
15297
|
-
num_6: 102,
|
|
15298
|
-
num_7: 103,
|
|
15299
|
-
num_8: 104,
|
|
15300
|
-
num_9: 105,
|
|
15301
|
-
num_multiply: 106,
|
|
15302
|
-
num_add: 107,
|
|
15303
|
-
num_enter: 108,
|
|
15304
|
-
num_subtract: 109,
|
|
15305
|
-
num_decimal: 110,
|
|
15306
|
-
num_divide: 111,
|
|
15307
|
-
'⇪': 20,
|
|
15308
|
-
',': 188,
|
|
15309
|
-
'.': 190,
|
|
15310
|
-
'/': 191,
|
|
15311
|
-
'`': 192,
|
|
15312
|
-
'-': isff ? 173 : 189,
|
|
15313
|
-
'=': isff ? 61 : 187,
|
|
15314
|
-
';': isff ? 59 : 186,
|
|
15315
|
-
'\'': 222,
|
|
15316
|
-
'[': 219,
|
|
15317
|
-
']': 221,
|
|
15318
|
-
'\\': 220
|
|
15319
|
-
}; // Modifier Keys
|
|
15320
|
-
|
|
15321
|
-
var _modifier = {
|
|
15322
|
-
// shiftKey
|
|
15323
|
-
'⇧': 16,
|
|
15324
|
-
shift: 16,
|
|
15325
|
-
// altKey
|
|
15326
|
-
'⌥': 18,
|
|
15327
|
-
alt: 18,
|
|
15328
|
-
option: 18,
|
|
15329
|
-
// ctrlKey
|
|
15330
|
-
'⌃': 17,
|
|
15331
|
-
ctrl: 17,
|
|
15332
|
-
control: 17,
|
|
15333
|
-
// metaKey
|
|
15334
|
-
'⌘': 91,
|
|
15335
|
-
cmd: 91,
|
|
15336
|
-
command: 91
|
|
15337
|
-
};
|
|
15338
|
-
var modifierMap = {
|
|
15339
|
-
16: 'shiftKey',
|
|
15340
|
-
18: 'altKey',
|
|
15341
|
-
17: 'ctrlKey',
|
|
15342
|
-
91: 'metaKey',
|
|
15343
|
-
shiftKey: 16,
|
|
15344
|
-
ctrlKey: 17,
|
|
15345
|
-
altKey: 18,
|
|
15346
|
-
metaKey: 91
|
|
15347
|
-
};
|
|
15348
|
-
var _mods = {
|
|
15349
|
-
16: false,
|
|
15350
|
-
18: false,
|
|
15351
|
-
17: false,
|
|
15352
|
-
91: false
|
|
15353
|
-
};
|
|
15354
|
-
var _handlers = {}; // F1~F12 special key
|
|
15355
|
-
|
|
15356
|
-
for (var k$1 = 1; k$1 < 20; k$1++) {
|
|
15357
|
-
_keyMap["f".concat(k$1)] = 111 + k$1;
|
|
15358
|
-
}
|
|
15359
|
-
|
|
15360
|
-
var _downKeys = []; // 记录摁下的绑定键
|
|
15361
|
-
|
|
15362
|
-
var _scope = 'all'; // 默认热键范围
|
|
15363
|
-
|
|
15364
|
-
var elementHasBindEvent = []; // 已绑定事件的节点记录
|
|
15365
|
-
// 返回键码
|
|
15366
|
-
|
|
15367
|
-
var code = function code(x) {
|
|
15368
|
-
return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
|
|
15369
|
-
}; // 设置获取当前范围(默认为'所有')
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
function setScope(scope) {
|
|
15373
|
-
_scope = scope || 'all';
|
|
15374
|
-
} // 获取当前范围
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
function getScope() {
|
|
15378
|
-
return _scope || 'all';
|
|
15379
|
-
} // 获取摁下绑定键的键值
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
function getPressedKeyCodes() {
|
|
15383
|
-
return _downKeys.slice(0);
|
|
15384
|
-
} // 表单控件控件判断 返回 Boolean
|
|
15385
|
-
// hotkey is effective only when filter return true
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
function filter(event) {
|
|
15389
|
-
var target = event.target || event.srcElement;
|
|
15390
|
-
var tagName = target.tagName;
|
|
15391
|
-
var flag = true; // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
|
|
15392
|
-
|
|
15393
|
-
if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
|
|
15394
|
-
flag = false;
|
|
15395
|
-
}
|
|
15291
|
+
var mousetrap = {exports: {}};
|
|
15396
15292
|
|
|
15397
|
-
|
|
15398
|
-
|
|
15293
|
+
/*global define:false */
|
|
15294
|
+
mousetrap.exports;
|
|
15295
|
+
(function (module) {
|
|
15296
|
+
/**
|
|
15297
|
+
* Copyright 2012-2017 Craig Campbell
|
|
15298
|
+
*
|
|
15299
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15300
|
+
* you may not use this file except in compliance with the License.
|
|
15301
|
+
* You may obtain a copy of the License at
|
|
15302
|
+
*
|
|
15303
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15304
|
+
*
|
|
15305
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15306
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15307
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15308
|
+
* See the License for the specific language governing permissions and
|
|
15309
|
+
* limitations under the License.
|
|
15310
|
+
*
|
|
15311
|
+
* Mousetrap is a simple keyboard shortcut library for Javascript with
|
|
15312
|
+
* no external dependencies
|
|
15313
|
+
*
|
|
15314
|
+
* @version 1.6.5
|
|
15315
|
+
* @url craig.is/killing/mice
|
|
15316
|
+
*/
|
|
15317
|
+
(function (window, document, undefined$1) {
|
|
15318
|
+
// Check if mousetrap is used inside browser, if not, return
|
|
15319
|
+
if (!window) {
|
|
15320
|
+
return;
|
|
15321
|
+
}
|
|
15399
15322
|
|
|
15323
|
+
/**
|
|
15324
|
+
* mapping of special keycodes to their corresponding keys
|
|
15325
|
+
*
|
|
15326
|
+
* everything in this dictionary cannot use keypress events
|
|
15327
|
+
* so it has to be here to map to the correct keycodes for
|
|
15328
|
+
* keyup/keydown events
|
|
15329
|
+
*
|
|
15330
|
+
* @type {Object}
|
|
15331
|
+
*/
|
|
15332
|
+
var _MAP = {
|
|
15333
|
+
8: 'backspace',
|
|
15334
|
+
9: 'tab',
|
|
15335
|
+
13: 'enter',
|
|
15336
|
+
16: 'shift',
|
|
15337
|
+
17: 'ctrl',
|
|
15338
|
+
18: 'alt',
|
|
15339
|
+
20: 'capslock',
|
|
15340
|
+
27: 'esc',
|
|
15341
|
+
32: 'space',
|
|
15342
|
+
33: 'pageup',
|
|
15343
|
+
34: 'pagedown',
|
|
15344
|
+
35: 'end',
|
|
15345
|
+
36: 'home',
|
|
15346
|
+
37: 'left',
|
|
15347
|
+
38: 'up',
|
|
15348
|
+
39: 'right',
|
|
15349
|
+
40: 'down',
|
|
15350
|
+
45: 'ins',
|
|
15351
|
+
46: 'del',
|
|
15352
|
+
91: 'meta',
|
|
15353
|
+
93: 'meta',
|
|
15354
|
+
224: 'meta'
|
|
15355
|
+
};
|
|
15400
15356
|
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15357
|
+
/**
|
|
15358
|
+
* mapping for special characters so they can support
|
|
15359
|
+
*
|
|
15360
|
+
* this dictionary is only used incase you want to bind a
|
|
15361
|
+
* keyup or keydown event to one of these keys
|
|
15362
|
+
*
|
|
15363
|
+
* @type {Object}
|
|
15364
|
+
*/
|
|
15365
|
+
var _KEYCODE_MAP = {
|
|
15366
|
+
106: '*',
|
|
15367
|
+
107: '+',
|
|
15368
|
+
109: '-',
|
|
15369
|
+
110: '.',
|
|
15370
|
+
111: '/',
|
|
15371
|
+
186: ';',
|
|
15372
|
+
187: '=',
|
|
15373
|
+
188: ',',
|
|
15374
|
+
189: '-',
|
|
15375
|
+
190: '.',
|
|
15376
|
+
191: '/',
|
|
15377
|
+
192: '`',
|
|
15378
|
+
219: '[',
|
|
15379
|
+
220: '\\',
|
|
15380
|
+
221: ']',
|
|
15381
|
+
222: '\''
|
|
15382
|
+
};
|
|
15405
15383
|
|
|
15406
|
-
|
|
15407
|
-
|
|
15384
|
+
/**
|
|
15385
|
+
* this is a mapping of keys that require shift on a US keypad
|
|
15386
|
+
* back to the non shift equivelents
|
|
15387
|
+
*
|
|
15388
|
+
* this is so you can use keyup events with these keys
|
|
15389
|
+
*
|
|
15390
|
+
* note that this will only work reliably on US keyboards
|
|
15391
|
+
*
|
|
15392
|
+
* @type {Object}
|
|
15393
|
+
*/
|
|
15394
|
+
var _SHIFT_MAP = {
|
|
15395
|
+
'~': '`',
|
|
15396
|
+
'!': '1',
|
|
15397
|
+
'@': '2',
|
|
15398
|
+
'#': '3',
|
|
15399
|
+
'$': '4',
|
|
15400
|
+
'%': '5',
|
|
15401
|
+
'^': '6',
|
|
15402
|
+
'&': '7',
|
|
15403
|
+
'*': '8',
|
|
15404
|
+
'(': '9',
|
|
15405
|
+
')': '0',
|
|
15406
|
+
'_': '-',
|
|
15407
|
+
'+': '=',
|
|
15408
|
+
':': ';',
|
|
15409
|
+
'\"': '\'',
|
|
15410
|
+
'<': ',',
|
|
15411
|
+
'>': '.',
|
|
15412
|
+
'?': '/',
|
|
15413
|
+
'|': '\\'
|
|
15414
|
+
};
|
|
15408
15415
|
|
|
15416
|
+
/**
|
|
15417
|
+
* this is a list of special strings you can use to map
|
|
15418
|
+
* to modifier keys when you specify your keyboard shortcuts
|
|
15419
|
+
*
|
|
15420
|
+
* @type {Object}
|
|
15421
|
+
*/
|
|
15422
|
+
var _SPECIAL_ALIASES = {
|
|
15423
|
+
'option': 'alt',
|
|
15424
|
+
'command': 'meta',
|
|
15425
|
+
'return': 'enter',
|
|
15426
|
+
'escape': 'esc',
|
|
15427
|
+
'plus': '+',
|
|
15428
|
+
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
|
|
15429
|
+
};
|
|
15409
15430
|
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15431
|
+
/**
|
|
15432
|
+
* variable to store the flipped version of _MAP from above
|
|
15433
|
+
* needed to check if we should use keypress or not when no action
|
|
15434
|
+
* is specified
|
|
15435
|
+
*
|
|
15436
|
+
* @type {Object|undefined}
|
|
15437
|
+
*/
|
|
15438
|
+
var _REVERSE_MAP;
|
|
15413
15439
|
|
|
15414
|
-
|
|
15440
|
+
/**
|
|
15441
|
+
* loop through the f keys, f1 to f19 and add them to the map
|
|
15442
|
+
* programatically
|
|
15443
|
+
*/
|
|
15444
|
+
for (var i = 1; i < 20; ++i) {
|
|
15445
|
+
_MAP[111 + i] = 'f' + i;
|
|
15446
|
+
}
|
|
15415
15447
|
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15448
|
+
/**
|
|
15449
|
+
* loop through to map numbers on the numeric keypad
|
|
15450
|
+
*/
|
|
15451
|
+
for (i = 0; i <= 9; ++i) {
|
|
15452
|
+
// This needs to use a string cause otherwise since 0 is falsey
|
|
15453
|
+
// mousetrap will never fire for numpad 0 pressed as part of a keydown
|
|
15454
|
+
// event.
|
|
15455
|
+
//
|
|
15456
|
+
// @see https://github.com/ccampbell/mousetrap/pull/258
|
|
15457
|
+
_MAP[i + 96] = i.toString();
|
|
15458
|
+
}
|
|
15419
15459
|
|
|
15420
|
-
|
|
15421
|
-
|
|
15460
|
+
/**
|
|
15461
|
+
* cross browser add event method
|
|
15462
|
+
*
|
|
15463
|
+
* @param {Element|HTMLDocument} object
|
|
15464
|
+
* @param {string} type
|
|
15465
|
+
* @param {Function} callback
|
|
15466
|
+
* @returns void
|
|
15467
|
+
*/
|
|
15468
|
+
function _addEvent(object, type, callback) {
|
|
15469
|
+
if (object.addEventListener) {
|
|
15470
|
+
object.addEventListener(type, callback, false);
|
|
15471
|
+
return;
|
|
15422
15472
|
}
|
|
15473
|
+
object.attachEvent('on' + type, callback);
|
|
15423
15474
|
}
|
|
15424
|
-
} // 如果scope被删除,将scope重置为all
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
if (getScope() === scope) setScope(newScope || 'all');
|
|
15428
|
-
} // 清除修饰键
|
|
15429
15475
|
|
|
15476
|
+
/**
|
|
15477
|
+
* takes the event and returns the key character
|
|
15478
|
+
*
|
|
15479
|
+
* @param {Event} e
|
|
15480
|
+
* @return {string}
|
|
15481
|
+
*/
|
|
15482
|
+
function _characterFromEvent(e) {
|
|
15483
|
+
// for keypress events we should return the character as is
|
|
15484
|
+
if (e.type == 'keypress') {
|
|
15485
|
+
var character = String.fromCharCode(e.which);
|
|
15486
|
+
|
|
15487
|
+
// if the shift key is not pressed then it is safe to assume
|
|
15488
|
+
// that we want the character to be lowercase. this means if
|
|
15489
|
+
// you accidentally have caps lock on then your key bindings
|
|
15490
|
+
// will continue to work
|
|
15491
|
+
//
|
|
15492
|
+
// the only side effect that might not be desired is if you
|
|
15493
|
+
// bind something like 'A' cause you want to trigger an
|
|
15494
|
+
// event when capital A is pressed caps lock will no longer
|
|
15495
|
+
// trigger the event. shift+a will though.
|
|
15496
|
+
if (!e.shiftKey) {
|
|
15497
|
+
character = character.toLowerCase();
|
|
15498
|
+
}
|
|
15499
|
+
return character;
|
|
15500
|
+
}
|
|
15430
15501
|
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15502
|
+
// for non keypress events the special maps are needed
|
|
15503
|
+
if (_MAP[e.which]) {
|
|
15504
|
+
return _MAP[e.which];
|
|
15505
|
+
}
|
|
15506
|
+
if (_KEYCODE_MAP[e.which]) {
|
|
15507
|
+
return _KEYCODE_MAP[e.which];
|
|
15508
|
+
}
|
|
15436
15509
|
|
|
15437
|
-
|
|
15438
|
-
_downKeys.splice(i, 1);
|
|
15439
|
-
} // 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
|
|
15510
|
+
// if it is not in the special map
|
|
15440
15511
|
|
|
15512
|
+
// with keydown and keyup events the character seems to always
|
|
15513
|
+
// come in as an uppercase character whether you are pressing shift
|
|
15514
|
+
// or not. we should make sure it is always lowercase for comparisons
|
|
15515
|
+
return String.fromCharCode(e.which).toLowerCase();
|
|
15516
|
+
}
|
|
15441
15517
|
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15518
|
+
/**
|
|
15519
|
+
* checks if two arrays are equal
|
|
15520
|
+
*
|
|
15521
|
+
* @param {Array} modifiers1
|
|
15522
|
+
* @param {Array} modifiers2
|
|
15523
|
+
* @returns {boolean}
|
|
15524
|
+
*/
|
|
15525
|
+
function _modifiersMatch(modifiers1, modifiers2) {
|
|
15526
|
+
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
|
|
15527
|
+
}
|
|
15445
15528
|
|
|
15529
|
+
/**
|
|
15530
|
+
* takes a key event and figures out what the modifiers are
|
|
15531
|
+
*
|
|
15532
|
+
* @param {Event} e
|
|
15533
|
+
* @returns {Array}
|
|
15534
|
+
*/
|
|
15535
|
+
function _eventModifiers(e) {
|
|
15536
|
+
var modifiers = [];
|
|
15537
|
+
if (e.shiftKey) {
|
|
15538
|
+
modifiers.push('shift');
|
|
15539
|
+
}
|
|
15540
|
+
if (e.altKey) {
|
|
15541
|
+
modifiers.push('alt');
|
|
15542
|
+
}
|
|
15543
|
+
if (e.ctrlKey) {
|
|
15544
|
+
modifiers.push('ctrl');
|
|
15545
|
+
}
|
|
15546
|
+
if (e.metaKey) {
|
|
15547
|
+
modifiers.push('meta');
|
|
15548
|
+
}
|
|
15549
|
+
return modifiers;
|
|
15550
|
+
}
|
|
15446
15551
|
|
|
15447
|
-
|
|
15552
|
+
/**
|
|
15553
|
+
* prevents default for this event
|
|
15554
|
+
*
|
|
15555
|
+
* @param {Event} e
|
|
15556
|
+
* @returns void
|
|
15557
|
+
*/
|
|
15558
|
+
function _preventDefault(e) {
|
|
15559
|
+
if (e.preventDefault) {
|
|
15560
|
+
e.preventDefault();
|
|
15561
|
+
return;
|
|
15562
|
+
}
|
|
15563
|
+
e.returnValue = false;
|
|
15564
|
+
}
|
|
15448
15565
|
|
|
15449
|
-
|
|
15450
|
-
|
|
15566
|
+
/**
|
|
15567
|
+
* stops propogation for this event
|
|
15568
|
+
*
|
|
15569
|
+
* @param {Event} e
|
|
15570
|
+
* @returns void
|
|
15571
|
+
*/
|
|
15572
|
+
function _stopPropagation(e) {
|
|
15573
|
+
if (e.stopPropagation) {
|
|
15574
|
+
e.stopPropagation();
|
|
15575
|
+
return;
|
|
15576
|
+
}
|
|
15577
|
+
e.cancelBubble = true;
|
|
15578
|
+
}
|
|
15451
15579
|
|
|
15452
|
-
|
|
15453
|
-
|
|
15580
|
+
/**
|
|
15581
|
+
* determines if the keycode specified is a modifier key or not
|
|
15582
|
+
*
|
|
15583
|
+
* @param {string} key
|
|
15584
|
+
* @returns {boolean}
|
|
15585
|
+
*/
|
|
15586
|
+
function _isModifier(key) {
|
|
15587
|
+
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
|
|
15454
15588
|
}
|
|
15455
|
-
}
|
|
15456
|
-
}
|
|
15457
15589
|
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15590
|
+
/**
|
|
15591
|
+
* reverses the map lookup so that we can look for specific keys
|
|
15592
|
+
* to see what can and can't use keypress
|
|
15593
|
+
*
|
|
15594
|
+
* @return {Object}
|
|
15595
|
+
*/
|
|
15596
|
+
function _getReverseMap() {
|
|
15597
|
+
if (!_REVERSE_MAP) {
|
|
15598
|
+
_REVERSE_MAP = {};
|
|
15599
|
+
for (var key in _MAP) {
|
|
15600
|
+
// pull out the numeric keypad from here cause keypress should
|
|
15601
|
+
// be able to detect the keys from the character
|
|
15602
|
+
if (key > 95 && key < 112) {
|
|
15603
|
+
continue;
|
|
15604
|
+
}
|
|
15605
|
+
if (_MAP.hasOwnProperty(key)) {
|
|
15606
|
+
_REVERSE_MAP[_MAP[key]] = key;
|
|
15607
|
+
}
|
|
15608
|
+
}
|
|
15609
|
+
}
|
|
15610
|
+
return _REVERSE_MAP;
|
|
15475
15611
|
}
|
|
15476
15612
|
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15613
|
+
/**
|
|
15614
|
+
* picks the best action based on the key combination
|
|
15615
|
+
*
|
|
15616
|
+
* @param {string} key - character for key
|
|
15617
|
+
* @param {Array} modifiers
|
|
15618
|
+
* @param {string=} action passed in
|
|
15619
|
+
*/
|
|
15620
|
+
function _pickBestAction(key, modifiers, action) {
|
|
15621
|
+
// if no action was picked in we should try to pick the one
|
|
15622
|
+
// that we think would work best for this key
|
|
15623
|
+
if (!action) {
|
|
15624
|
+
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
|
|
15625
|
+
}
|
|
15481
15626
|
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15627
|
+
// modifier keys don't work as expected with keypress,
|
|
15628
|
+
// switch to keydown
|
|
15629
|
+
if (action == 'keypress' && modifiers.length) {
|
|
15630
|
+
action = 'keydown';
|
|
15631
|
+
}
|
|
15632
|
+
return action;
|
|
15485
15633
|
}
|
|
15486
15634
|
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
var eachUnbind = function eachUnbind(_ref) {
|
|
15498
|
-
var key = _ref.key,
|
|
15499
|
-
scope = _ref.scope,
|
|
15500
|
-
method = _ref.method,
|
|
15501
|
-
_ref$splitKey = _ref.splitKey,
|
|
15502
|
-
splitKey = _ref$splitKey === void 0 ? '+' : _ref$splitKey;
|
|
15503
|
-
var multipleKeys = getKeys(key);
|
|
15504
|
-
multipleKeys.forEach(function (originKey) {
|
|
15505
|
-
var unbindKeys = originKey.split(splitKey);
|
|
15506
|
-
var len = unbindKeys.length;
|
|
15507
|
-
var lastKey = unbindKeys[len - 1];
|
|
15508
|
-
var keyCode = lastKey === '*' ? '*' : code(lastKey);
|
|
15509
|
-
if (!_handlers[keyCode]) return; // 判断是否传入范围,没有就获取范围
|
|
15510
|
-
|
|
15511
|
-
if (!scope) scope = getScope();
|
|
15512
|
-
var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
|
|
15513
|
-
_handlers[keyCode] = _handlers[keyCode].map(function (record) {
|
|
15514
|
-
// 通过函数判断,是否解除绑定,函数相等直接返回
|
|
15515
|
-
var isMatchingMethod = method ? record.method === method : true;
|
|
15516
|
-
|
|
15517
|
-
if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) {
|
|
15518
|
-
return {};
|
|
15635
|
+
/**
|
|
15636
|
+
* Converts from a string key combination to an array
|
|
15637
|
+
*
|
|
15638
|
+
* @param {string} combination like "command+shift+l"
|
|
15639
|
+
* @return {Array}
|
|
15640
|
+
*/
|
|
15641
|
+
function _keysFromString(combination) {
|
|
15642
|
+
if (combination === '+') {
|
|
15643
|
+
return ['+'];
|
|
15519
15644
|
}
|
|
15645
|
+
combination = combination.replace(/\+{2}/g, '+plus');
|
|
15646
|
+
return combination.split('+');
|
|
15647
|
+
}
|
|
15520
15648
|
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
}
|
|
15649
|
+
/**
|
|
15650
|
+
* Gets info for a specific key combination
|
|
15651
|
+
*
|
|
15652
|
+
* @param {string} combination key combination ("command+s" or "a" or "*")
|
|
15653
|
+
* @param {string=} action
|
|
15654
|
+
* @returns {Object}
|
|
15655
|
+
*/
|
|
15656
|
+
function _getKeyInfo(combination, action) {
|
|
15657
|
+
var keys;
|
|
15658
|
+
var key;
|
|
15659
|
+
var i;
|
|
15660
|
+
var modifiers = [];
|
|
15525
15661
|
|
|
15662
|
+
// take the keys from this pattern and figure out what the actual
|
|
15663
|
+
// pattern is all about
|
|
15664
|
+
keys = _keysFromString(combination);
|
|
15665
|
+
for (i = 0; i < keys.length; ++i) {
|
|
15666
|
+
key = keys[i];
|
|
15526
15667
|
|
|
15527
|
-
|
|
15528
|
-
|
|
15668
|
+
// normalize key names
|
|
15669
|
+
if (_SPECIAL_ALIASES[key]) {
|
|
15670
|
+
key = _SPECIAL_ALIASES[key];
|
|
15671
|
+
}
|
|
15529
15672
|
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15673
|
+
// if this is not a keypress event then we should
|
|
15674
|
+
// be smart about using shift keys
|
|
15675
|
+
// this will only work for US keyboards however
|
|
15676
|
+
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
|
|
15677
|
+
key = _SHIFT_MAP[key];
|
|
15678
|
+
modifiers.push('shift');
|
|
15679
|
+
}
|
|
15533
15680
|
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
modifiersMatch = false;
|
|
15681
|
+
// if this key is a modifier then add it to the list of modifiers
|
|
15682
|
+
if (_isModifier(key)) {
|
|
15683
|
+
modifiers.push(key);
|
|
15538
15684
|
}
|
|
15539
15685
|
}
|
|
15540
|
-
} // 调用处理程序,如果是修饰键不做处理
|
|
15541
15686
|
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15687
|
+
// depending on what the key combination is
|
|
15688
|
+
// we will try to pick the best event for it
|
|
15689
|
+
action = _pickBestAction(key, modifiers, action);
|
|
15690
|
+
return {
|
|
15691
|
+
key: key,
|
|
15692
|
+
modifiers: modifiers,
|
|
15693
|
+
action: action
|
|
15694
|
+
};
|
|
15695
|
+
}
|
|
15696
|
+
function _belongsTo(element, ancestor) {
|
|
15697
|
+
if (element === null || element === document) {
|
|
15698
|
+
return false;
|
|
15699
|
+
}
|
|
15700
|
+
if (element === ancestor) {
|
|
15701
|
+
return true;
|
|
15548
15702
|
}
|
|
15703
|
+
return _belongsTo(element.parentNode, ancestor);
|
|
15549
15704
|
}
|
|
15550
|
-
|
|
15551
|
-
|
|
15705
|
+
function Mousetrap(targetElement) {
|
|
15706
|
+
var self = this;
|
|
15707
|
+
targetElement = targetElement || document;
|
|
15708
|
+
if (!(self instanceof Mousetrap)) {
|
|
15709
|
+
return new Mousetrap(targetElement);
|
|
15710
|
+
}
|
|
15552
15711
|
|
|
15712
|
+
/**
|
|
15713
|
+
* element to attach key events to
|
|
15714
|
+
*
|
|
15715
|
+
* @type {Element}
|
|
15716
|
+
*/
|
|
15717
|
+
self.target = targetElement;
|
|
15553
15718
|
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15719
|
+
/**
|
|
15720
|
+
* a list of all the callbacks setup via Mousetrap.bind()
|
|
15721
|
+
*
|
|
15722
|
+
* @type {Object}
|
|
15723
|
+
*/
|
|
15724
|
+
self._callbacks = {};
|
|
15557
15725
|
|
|
15558
|
-
|
|
15559
|
-
|
|
15726
|
+
/**
|
|
15727
|
+
* direct map of string combinations to callbacks used for trigger()
|
|
15728
|
+
*
|
|
15729
|
+
* @type {Object}
|
|
15730
|
+
*/
|
|
15731
|
+
self._directMap = {};
|
|
15560
15732
|
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15733
|
+
/**
|
|
15734
|
+
* keeps track of what level each sequence is at since multiple
|
|
15735
|
+
* sequences can start out with the same sequence
|
|
15736
|
+
*
|
|
15737
|
+
* @type {Object}
|
|
15738
|
+
*/
|
|
15739
|
+
var _sequenceLevels = {};
|
|
15568
15740
|
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15741
|
+
/**
|
|
15742
|
+
* variable to store the setTimeout call
|
|
15743
|
+
*
|
|
15744
|
+
* @type {null|number}
|
|
15745
|
+
*/
|
|
15746
|
+
var _resetTimer;
|
|
15574
15747
|
|
|
15575
|
-
|
|
15576
|
-
|
|
15748
|
+
/**
|
|
15749
|
+
* temporary state where we will ignore the next keyup
|
|
15750
|
+
*
|
|
15751
|
+
* @type {boolean|string}
|
|
15752
|
+
*/
|
|
15753
|
+
var _ignoreNextKeyup = false;
|
|
15577
15754
|
|
|
15578
|
-
if (event[keyName] && _downKeys.indexOf(keyNum) === -1) {
|
|
15579
|
-
_downKeys.push(keyNum);
|
|
15580
|
-
} else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
|
|
15581
|
-
_downKeys.splice(_downKeys.indexOf(keyNum), 1);
|
|
15582
|
-
} else if (keyName === 'metaKey' && event[keyName] && _downKeys.length === 3) {
|
|
15583
15755
|
/**
|
|
15584
|
-
*
|
|
15585
|
-
*
|
|
15756
|
+
* temporary state where we will ignore the next keypress
|
|
15757
|
+
*
|
|
15758
|
+
* @type {boolean}
|
|
15586
15759
|
*/
|
|
15587
|
-
|
|
15588
|
-
_downKeys = _downKeys.slice(_downKeys.indexOf(keyNum));
|
|
15589
|
-
}
|
|
15590
|
-
}
|
|
15591
|
-
});
|
|
15592
|
-
/**
|
|
15593
|
-
* -------------------------------
|
|
15594
|
-
*/
|
|
15760
|
+
var _ignoreNextKeypress = false;
|
|
15595
15761
|
|
|
15596
|
-
|
|
15597
|
-
|
|
15762
|
+
/**
|
|
15763
|
+
* are we currently inside of a sequence?
|
|
15764
|
+
* type of action ("keyup" or "keydown" or "keypress") or false
|
|
15765
|
+
*
|
|
15766
|
+
* @type {boolean|string}
|
|
15767
|
+
*/
|
|
15768
|
+
var _nextExpectedAction = false;
|
|
15598
15769
|
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15770
|
+
/**
|
|
15771
|
+
* resets all sequence counters except for the ones passed in
|
|
15772
|
+
*
|
|
15773
|
+
* @param {Object} doNotReset
|
|
15774
|
+
* @returns void
|
|
15775
|
+
*/
|
|
15776
|
+
function _resetSequences(doNotReset) {
|
|
15777
|
+
doNotReset = doNotReset || {};
|
|
15778
|
+
var activeSequences = false,
|
|
15779
|
+
key;
|
|
15780
|
+
for (key in _sequenceLevels) {
|
|
15781
|
+
if (doNotReset[key]) {
|
|
15782
|
+
activeSequences = true;
|
|
15783
|
+
continue;
|
|
15784
|
+
}
|
|
15785
|
+
_sequenceLevels[key] = 0;
|
|
15786
|
+
}
|
|
15787
|
+
if (!activeSequences) {
|
|
15788
|
+
_nextExpectedAction = false;
|
|
15789
|
+
}
|
|
15790
|
+
}
|
|
15602
15791
|
|
|
15603
|
-
|
|
15604
|
-
|
|
15792
|
+
/**
|
|
15793
|
+
* finds all callbacks that match based on the keycode, modifiers,
|
|
15794
|
+
* and action
|
|
15795
|
+
*
|
|
15796
|
+
* @param {string} character
|
|
15797
|
+
* @param {Array} modifiers
|
|
15798
|
+
* @param {Event|Object} e
|
|
15799
|
+
* @param {string=} sequenceName - name of the sequence we are looking for
|
|
15800
|
+
* @param {string=} combination
|
|
15801
|
+
* @param {number=} level
|
|
15802
|
+
* @returns {Array}
|
|
15803
|
+
*/
|
|
15804
|
+
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
|
|
15805
|
+
var i;
|
|
15806
|
+
var callback;
|
|
15807
|
+
var matches = [];
|
|
15808
|
+
var action = e.type;
|
|
15605
15809
|
|
|
15810
|
+
// if there are no events related to this keycode
|
|
15811
|
+
if (!self._callbacks[character]) {
|
|
15812
|
+
return [];
|
|
15813
|
+
}
|
|
15606
15814
|
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
}
|
|
15612
|
-
/**
|
|
15613
|
-
* https://github.com/jaywcjlove/hotkeys/pull/129
|
|
15614
|
-
* This solves the issue in Firefox on Windows where hotkeys corresponding to special characters would not trigger.
|
|
15615
|
-
* An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
|
|
15616
|
-
* Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
|
|
15617
|
-
*/
|
|
15815
|
+
// if a modifier key is coming up on its own we should allow it
|
|
15816
|
+
if (action == 'keyup' && _isModifier(character)) {
|
|
15817
|
+
modifiers = [character];
|
|
15818
|
+
}
|
|
15618
15819
|
|
|
15820
|
+
// loop through all callbacks for the key that was pressed
|
|
15821
|
+
// and see if any of them match
|
|
15822
|
+
for (i = 0; i < self._callbacks[character].length; ++i) {
|
|
15823
|
+
callback = self._callbacks[character][i];
|
|
15619
15824
|
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15825
|
+
// if a sequence name is not specified, but this is a sequence at
|
|
15826
|
+
// the wrong level then move onto the next match
|
|
15827
|
+
if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
|
|
15828
|
+
continue;
|
|
15829
|
+
}
|
|
15624
15830
|
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15831
|
+
// if the action we are looking for doesn't match the action we got
|
|
15832
|
+
// then we should keep going
|
|
15833
|
+
if (action != callback.action) {
|
|
15834
|
+
continue;
|
|
15835
|
+
}
|
|
15836
|
+
|
|
15837
|
+
// if this is a keypress event and the meta key and control key
|
|
15838
|
+
// are not pressed that means that we need to only look at the
|
|
15839
|
+
// character, otherwise check the modifiers as well
|
|
15840
|
+
//
|
|
15841
|
+
// chrome will not fire a keypress if meta or control is down
|
|
15842
|
+
// safari will fire a keypress if meta or meta+shift is down
|
|
15843
|
+
// firefox will fire a keypress if meta or control is down
|
|
15844
|
+
if (action == 'keypress' && !e.metaKey && !e.ctrlKey || _modifiersMatch(modifiers, callback.modifiers)) {
|
|
15845
|
+
// when you bind a combination or sequence a second time it
|
|
15846
|
+
// should overwrite the first one. if a sequenceName or
|
|
15847
|
+
// combination is specified in this call it does just that
|
|
15848
|
+
//
|
|
15849
|
+
// @todo make deleting its own method?
|
|
15850
|
+
var deleteCombo = !sequenceName && callback.combo == combination;
|
|
15851
|
+
var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
|
|
15852
|
+
if (deleteCombo || deleteSequence) {
|
|
15853
|
+
self._callbacks[character].splice(i, 1);
|
|
15854
|
+
}
|
|
15855
|
+
matches.push(callback);
|
|
15856
|
+
}
|
|
15857
|
+
}
|
|
15858
|
+
return matches;
|
|
15859
|
+
}
|
|
15628
15860
|
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15861
|
+
/**
|
|
15862
|
+
* actually calls the callback function
|
|
15863
|
+
*
|
|
15864
|
+
* if your callback function returns false this will use the jquery
|
|
15865
|
+
* convention - prevent default and stop propogation on the event
|
|
15866
|
+
*
|
|
15867
|
+
* @param {Function} callback
|
|
15868
|
+
* @param {Event} e
|
|
15869
|
+
* @returns void
|
|
15870
|
+
*/
|
|
15871
|
+
function _fireCallback(callback, e, combo, sequence) {
|
|
15872
|
+
// if this event should not happen stop here
|
|
15873
|
+
if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
|
|
15874
|
+
return;
|
|
15875
|
+
}
|
|
15876
|
+
if (callback(e, combo) === false) {
|
|
15877
|
+
_preventDefault(e);
|
|
15878
|
+
_stopPropagation(e);
|
|
15879
|
+
}
|
|
15880
|
+
}
|
|
15632
15881
|
|
|
15882
|
+
/**
|
|
15883
|
+
* handles a character key event
|
|
15884
|
+
*
|
|
15885
|
+
* @param {string} character
|
|
15886
|
+
* @param {Array} modifiers
|
|
15887
|
+
* @param {Event} e
|
|
15888
|
+
* @returns void
|
|
15889
|
+
*/
|
|
15890
|
+
self._handleKey = function (character, modifiers, e) {
|
|
15891
|
+
var callbacks = _getMatches(character, modifiers, e);
|
|
15892
|
+
var i;
|
|
15893
|
+
var doNotReset = {};
|
|
15894
|
+
var maxLevel = 0;
|
|
15895
|
+
var processedSequenceCallback = false;
|
|
15896
|
+
|
|
15897
|
+
// Calculate the maxLevel for sequences so we can only execute the longest callback sequence
|
|
15898
|
+
for (i = 0; i < callbacks.length; ++i) {
|
|
15899
|
+
if (callbacks[i].seq) {
|
|
15900
|
+
maxLevel = Math.max(maxLevel, callbacks[i].level);
|
|
15901
|
+
}
|
|
15902
|
+
}
|
|
15633
15903
|
|
|
15634
|
-
|
|
15904
|
+
// loop through matching callbacks for this key event
|
|
15905
|
+
for (i = 0; i < callbacks.length; ++i) {
|
|
15906
|
+
// fire for all sequence callbacks
|
|
15907
|
+
// this is because if for example you have multiple sequences
|
|
15908
|
+
// bound such as "g i" and "g t" they both need to fire the
|
|
15909
|
+
// callback for matching g cause otherwise you can only ever
|
|
15910
|
+
// match the first one
|
|
15911
|
+
if (callbacks[i].seq) {
|
|
15912
|
+
// only fire callbacks for the maxLevel to prevent
|
|
15913
|
+
// subsequences from also firing
|
|
15914
|
+
//
|
|
15915
|
+
// for example 'a option b' should not cause 'option b' to fire
|
|
15916
|
+
// even though 'option b' is part of the other sequence
|
|
15917
|
+
//
|
|
15918
|
+
// any sequences that do not match here will be discarded
|
|
15919
|
+
// below by the _resetSequences call
|
|
15920
|
+
if (callbacks[i].level != maxLevel) {
|
|
15921
|
+
continue;
|
|
15922
|
+
}
|
|
15923
|
+
processedSequenceCallback = true;
|
|
15635
15924
|
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
}
|
|
15642
|
-
} // key 不在 _handlers 中返回
|
|
15925
|
+
// keep a list of which sequences were matches for later
|
|
15926
|
+
doNotReset[callbacks[i].seq] = 1;
|
|
15927
|
+
_fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
|
|
15928
|
+
continue;
|
|
15929
|
+
}
|
|
15643
15930
|
|
|
15931
|
+
// if there were no sequence matches but we are still here
|
|
15932
|
+
// that means this is a regular match so we should fire that
|
|
15933
|
+
if (!processedSequenceCallback) {
|
|
15934
|
+
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
|
|
15935
|
+
}
|
|
15936
|
+
}
|
|
15644
15937
|
|
|
15645
|
-
|
|
15938
|
+
// if the key you pressed matches the type of sequence without
|
|
15939
|
+
// being a modifier (ie "keyup" or "keypress") then we should
|
|
15940
|
+
// reset all sequences that were not matched by this event
|
|
15941
|
+
//
|
|
15942
|
+
// this is so, for example, if you have the sequence "h a t" and you
|
|
15943
|
+
// type "h e a r t" it does not match. in this case the "e" will
|
|
15944
|
+
// cause the sequence to reset
|
|
15945
|
+
//
|
|
15946
|
+
// modifier keys are ignored because you can have a sequence
|
|
15947
|
+
// that contains modifiers such as "enter ctrl+space" and in most
|
|
15948
|
+
// cases the modifier key will be pressed before the next key
|
|
15949
|
+
//
|
|
15950
|
+
// also if you have a sequence such as "ctrl+b a" then pressing the
|
|
15951
|
+
// "b" key will trigger a "keypress" and a "keydown"
|
|
15952
|
+
//
|
|
15953
|
+
// the "keydown" is expected when there is a modifier, but the
|
|
15954
|
+
// "keypress" ends up matching the _nextExpectedAction since it occurs
|
|
15955
|
+
// after and that causes the sequence to reset
|
|
15956
|
+
//
|
|
15957
|
+
// we ignore keypresses in a sequence that directly follow a keydown
|
|
15958
|
+
// for the same character
|
|
15959
|
+
var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
|
|
15960
|
+
if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
|
|
15961
|
+
_resetSequences(doNotReset);
|
|
15962
|
+
}
|
|
15963
|
+
_ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
|
|
15964
|
+
};
|
|
15646
15965
|
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15966
|
+
/**
|
|
15967
|
+
* handles a keydown event
|
|
15968
|
+
*
|
|
15969
|
+
* @param {Event} e
|
|
15970
|
+
* @returns void
|
|
15971
|
+
*/
|
|
15972
|
+
function _handleKeyEvent(e) {
|
|
15973
|
+
// normalize e.which for key events
|
|
15974
|
+
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
|
|
15975
|
+
if (typeof e.which !== 'number') {
|
|
15976
|
+
e.which = e.keyCode;
|
|
15977
|
+
}
|
|
15978
|
+
var character = _characterFromEvent(e);
|
|
15654
15979
|
|
|
15655
|
-
|
|
15656
|
-
|
|
15980
|
+
// no character found then stop
|
|
15981
|
+
if (!character) {
|
|
15982
|
+
return;
|
|
15657
15983
|
}
|
|
15658
15984
|
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15985
|
+
// need to use === for the character check because the character can be 0
|
|
15986
|
+
if (e.type == 'keyup' && _ignoreNextKeyup === character) {
|
|
15987
|
+
_ignoreNextKeyup = false;
|
|
15988
|
+
return;
|
|
15662
15989
|
}
|
|
15990
|
+
self.handleKey(character, _eventModifiers(e), e);
|
|
15663
15991
|
}
|
|
15664
|
-
}
|
|
15665
|
-
}
|
|
15666
|
-
} // 判断 element 是否已经绑定事件
|
|
15667
15992
|
|
|
15993
|
+
/**
|
|
15994
|
+
* called to set a 1 second timeout on the specified sequence
|
|
15995
|
+
*
|
|
15996
|
+
* this is so after each key press in the sequence you have 1 second
|
|
15997
|
+
* to press the next key before you have to start over
|
|
15998
|
+
*
|
|
15999
|
+
* @returns void
|
|
16000
|
+
*/
|
|
16001
|
+
function _resetSequenceTimer() {
|
|
16002
|
+
clearTimeout(_resetTimer);
|
|
16003
|
+
_resetTimer = setTimeout(_resetSequences, 1000);
|
|
16004
|
+
}
|
|
15668
16005
|
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
16006
|
+
/**
|
|
16007
|
+
* binds a key sequence to an event
|
|
16008
|
+
*
|
|
16009
|
+
* @param {string} combo - combo specified in bind call
|
|
16010
|
+
* @param {Array} keys
|
|
16011
|
+
* @param {Function} callback
|
|
16012
|
+
* @param {string=} action
|
|
16013
|
+
* @returns void
|
|
16014
|
+
*/
|
|
16015
|
+
function _bindSequence(combo, keys, callback, action) {
|
|
16016
|
+
// start off by adding a sequence level record for this combination
|
|
16017
|
+
// and setting the level to 0
|
|
16018
|
+
_sequenceLevels[combo] = 0;
|
|
15672
16019
|
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
16020
|
+
/**
|
|
16021
|
+
* callback to increase the sequence level for this sequence and reset
|
|
16022
|
+
* all other sequences that were active
|
|
16023
|
+
*
|
|
16024
|
+
* @param {string} nextAction
|
|
16025
|
+
* @returns {Function}
|
|
16026
|
+
*/
|
|
16027
|
+
function _increaseSequence(nextAction) {
|
|
16028
|
+
return function () {
|
|
16029
|
+
_nextExpectedAction = nextAction;
|
|
16030
|
+
++_sequenceLevels[combo];
|
|
16031
|
+
_resetSequenceTimer();
|
|
16032
|
+
};
|
|
16033
|
+
}
|
|
15676
16034
|
|
|
15677
|
-
|
|
15678
|
-
|
|
16035
|
+
/**
|
|
16036
|
+
* wraps the specified callback inside of another function in order
|
|
16037
|
+
* to reset all sequence counters as soon as this sequence is done
|
|
16038
|
+
*
|
|
16039
|
+
* @param {Event} e
|
|
16040
|
+
* @returns void
|
|
16041
|
+
*/
|
|
16042
|
+
function _callbackAndReset(e) {
|
|
16043
|
+
_fireCallback(callback, e, combo);
|
|
16044
|
+
|
|
16045
|
+
// we should ignore the next key up if the action is key down
|
|
16046
|
+
// or keypress. this is so if you finish a sequence and
|
|
16047
|
+
// release the key the final key will not trigger a keyup
|
|
16048
|
+
if (action !== 'keyup') {
|
|
16049
|
+
_ignoreNextKeyup = _characterFromEvent(e);
|
|
16050
|
+
}
|
|
15679
16051
|
|
|
15680
|
-
|
|
16052
|
+
// weird race condition if a sequence ends with the key
|
|
16053
|
+
// another sequence begins with
|
|
16054
|
+
setTimeout(_resetSequences, 10);
|
|
16055
|
+
}
|
|
16056
|
+
|
|
16057
|
+
// loop through keys one at a time and bind the appropriate callback
|
|
16058
|
+
// function. for any key leading up to the final one it should
|
|
16059
|
+
// increase the sequence. after the final, it should reset all sequences
|
|
16060
|
+
//
|
|
16061
|
+
// if an action is specified in the original bind call then that will
|
|
16062
|
+
// be used throughout. otherwise we will pass the action that the
|
|
16063
|
+
// next key in the sequence should match. this allows a sequence
|
|
16064
|
+
// to mix and match keypress and keydown events depending on which
|
|
16065
|
+
// ones are better suited to the key provided
|
|
16066
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
16067
|
+
var isFinal = i + 1 === keys.length;
|
|
16068
|
+
var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
|
|
16069
|
+
_bindSingle(keys[i], wrappedCallback, action, combo, i);
|
|
16070
|
+
}
|
|
16071
|
+
}
|
|
15681
16072
|
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
16073
|
+
/**
|
|
16074
|
+
* binds a single keyboard combination
|
|
16075
|
+
*
|
|
16076
|
+
* @param {string} combination
|
|
16077
|
+
* @param {Function} callback
|
|
16078
|
+
* @param {string=} action
|
|
16079
|
+
* @param {string=} sequenceName - name of sequence if part of sequence
|
|
16080
|
+
* @param {number=} level - what part of the sequence the command is
|
|
16081
|
+
* @returns void
|
|
16082
|
+
*/
|
|
16083
|
+
function _bindSingle(combination, callback, action, sequenceName, level) {
|
|
16084
|
+
// store a direct mapped reference for use with Mousetrap.trigger
|
|
16085
|
+
self._directMap[combination + ':' + action] = callback;
|
|
16086
|
+
|
|
16087
|
+
// make sure multiple spaces in a row become a single space
|
|
16088
|
+
combination = combination.replace(/\s+/g, ' ');
|
|
16089
|
+
var sequence = combination.split(' ');
|
|
16090
|
+
var info;
|
|
16091
|
+
|
|
16092
|
+
// if this pattern is a sequence of keys then run through this method
|
|
16093
|
+
// to reprocess each pattern one key at a time
|
|
16094
|
+
if (sequence.length > 1) {
|
|
16095
|
+
_bindSequence(combination, sequence, callback, action);
|
|
16096
|
+
return;
|
|
16097
|
+
}
|
|
16098
|
+
info = _getKeyInfo(combination, action);
|
|
16099
|
+
|
|
16100
|
+
// make sure to initialize array if this is the first time
|
|
16101
|
+
// a callback is added for this key
|
|
16102
|
+
self._callbacks[info.key] = self._callbacks[info.key] || [];
|
|
16103
|
+
|
|
16104
|
+
// remove an existing match if there is one
|
|
16105
|
+
_getMatches(info.key, info.modifiers, {
|
|
16106
|
+
type: info.action
|
|
16107
|
+
}, sequenceName, combination, level);
|
|
16108
|
+
|
|
16109
|
+
// add this call back to the array
|
|
16110
|
+
// if it is a sequence put it at the beginning
|
|
16111
|
+
// if not put it at the end
|
|
16112
|
+
//
|
|
16113
|
+
// this is important because the way these are processed expects
|
|
16114
|
+
// the sequence ones to come first
|
|
16115
|
+
self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
|
|
16116
|
+
callback: callback,
|
|
16117
|
+
modifiers: info.modifiers,
|
|
16118
|
+
action: info.action,
|
|
16119
|
+
seq: sequenceName,
|
|
16120
|
+
level: level,
|
|
16121
|
+
combo: combination
|
|
16122
|
+
});
|
|
16123
|
+
}
|
|
15686
16124
|
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
16125
|
+
/**
|
|
16126
|
+
* binds multiple combinations to the same callback
|
|
16127
|
+
*
|
|
16128
|
+
* @param {Array} combinations
|
|
16129
|
+
* @param {Function} callback
|
|
16130
|
+
* @param {string|undefined} action
|
|
16131
|
+
* @returns void
|
|
16132
|
+
*/
|
|
16133
|
+
self._bindMultiple = function (combinations, callback, action) {
|
|
16134
|
+
for (var i = 0; i < combinations.length; ++i) {
|
|
16135
|
+
_bindSingle(combinations[i], callback, action);
|
|
16136
|
+
}
|
|
16137
|
+
};
|
|
16138
|
+
|
|
16139
|
+
// start!
|
|
16140
|
+
_addEvent(targetElement, 'keypress', _handleKeyEvent);
|
|
16141
|
+
_addEvent(targetElement, 'keydown', _handleKeyEvent);
|
|
16142
|
+
_addEvent(targetElement, 'keyup', _handleKeyEvent);
|
|
16143
|
+
}
|
|
15690
16144
|
|
|
15691
|
-
|
|
15692
|
-
|
|
16145
|
+
/**
|
|
16146
|
+
* binds an event to mousetrap
|
|
16147
|
+
*
|
|
16148
|
+
* can be a single key, a combination of keys separated with +,
|
|
16149
|
+
* an array of keys, or a sequence of keys separated by spaces
|
|
16150
|
+
*
|
|
16151
|
+
* be sure to list the modifier keys first to make sure that the
|
|
16152
|
+
* correct key ends up getting bound (the last key in the pattern)
|
|
16153
|
+
*
|
|
16154
|
+
* @param {string|Array} keys
|
|
16155
|
+
* @param {Function} callback
|
|
16156
|
+
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
|
|
16157
|
+
* @returns void
|
|
16158
|
+
*/
|
|
16159
|
+
Mousetrap.prototype.bind = function (keys, callback, action) {
|
|
16160
|
+
var self = this;
|
|
16161
|
+
keys = keys instanceof Array ? keys : [keys];
|
|
16162
|
+
self._bindMultiple.call(self, keys, callback, action);
|
|
16163
|
+
return self;
|
|
16164
|
+
};
|
|
15693
16165
|
|
|
15694
|
-
|
|
16166
|
+
/**
|
|
16167
|
+
* unbinds an event to mousetrap
|
|
16168
|
+
*
|
|
16169
|
+
* the unbinding sets the callback function of the specified key combo
|
|
16170
|
+
* to an empty function and deletes the corresponding key in the
|
|
16171
|
+
* _directMap dict.
|
|
16172
|
+
*
|
|
16173
|
+
* TODO: actually remove this from the _callbacks dictionary instead
|
|
16174
|
+
* of binding an empty function
|
|
16175
|
+
*
|
|
16176
|
+
* the keycombo+action has to be exactly the same as
|
|
16177
|
+
* it was defined in the bind method
|
|
16178
|
+
*
|
|
16179
|
+
* @param {string|Array} keys
|
|
16180
|
+
* @param {string} action
|
|
16181
|
+
* @returns void
|
|
16182
|
+
*/
|
|
16183
|
+
Mousetrap.prototype.unbind = function (keys, action) {
|
|
16184
|
+
var self = this;
|
|
16185
|
+
return self.bind.call(self, keys, function () {}, action);
|
|
16186
|
+
};
|
|
15695
16187
|
|
|
15696
|
-
|
|
16188
|
+
/**
|
|
16189
|
+
* triggers an event that has already been bound
|
|
16190
|
+
*
|
|
16191
|
+
* @param {string} keys
|
|
16192
|
+
* @param {string=} action
|
|
16193
|
+
* @returns void
|
|
16194
|
+
*/
|
|
16195
|
+
Mousetrap.prototype.trigger = function (keys, action) {
|
|
16196
|
+
var self = this;
|
|
16197
|
+
if (self._directMap[keys + ':' + action]) {
|
|
16198
|
+
self._directMap[keys + ':' + action]({}, keys);
|
|
16199
|
+
}
|
|
16200
|
+
return self;
|
|
16201
|
+
};
|
|
15697
16202
|
|
|
15698
|
-
|
|
16203
|
+
/**
|
|
16204
|
+
* resets the library back to its initial state. this is useful
|
|
16205
|
+
* if you want to clear out the current keyboard shortcuts and bind
|
|
16206
|
+
* new ones - for example if you switch to another page
|
|
16207
|
+
*
|
|
16208
|
+
* @returns void
|
|
16209
|
+
*/
|
|
16210
|
+
Mousetrap.prototype.reset = function () {
|
|
16211
|
+
var self = this;
|
|
16212
|
+
self._callbacks = {};
|
|
16213
|
+
self._directMap = {};
|
|
16214
|
+
return self;
|
|
16215
|
+
};
|
|
15699
16216
|
|
|
15700
|
-
|
|
15701
|
-
|
|
16217
|
+
/**
|
|
16218
|
+
* should we stop this event before firing off callbacks
|
|
16219
|
+
*
|
|
16220
|
+
* @param {Event} e
|
|
16221
|
+
* @param {Element} element
|
|
16222
|
+
* @return {boolean}
|
|
16223
|
+
*/
|
|
16224
|
+
Mousetrap.prototype.stopCallback = function (e, element) {
|
|
16225
|
+
var self = this;
|
|
15702
16226
|
|
|
15703
|
-
|
|
16227
|
+
// if the element has the class "mousetrap" then no need to stop
|
|
16228
|
+
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
|
|
16229
|
+
return false;
|
|
16230
|
+
}
|
|
16231
|
+
if (_belongsTo(element, self.target)) {
|
|
16232
|
+
return false;
|
|
16233
|
+
}
|
|
15704
16234
|
|
|
15705
|
-
|
|
15706
|
-
|
|
16235
|
+
// Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,
|
|
16236
|
+
// not the initial event target in the shadow tree. Note that not all events cross the
|
|
16237
|
+
// shadow boundary.
|
|
16238
|
+
// For shadow trees with `mode: 'open'`, the initial event target is the first element in
|
|
16239
|
+
// the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event
|
|
16240
|
+
// target cannot be obtained.
|
|
16241
|
+
if ('composedPath' in e && typeof e.composedPath === 'function') {
|
|
16242
|
+
// For open shadow trees, update `element` so that the following check works.
|
|
16243
|
+
var initialEventTarget = e.composedPath()[0];
|
|
16244
|
+
if (initialEventTarget !== e.target) {
|
|
16245
|
+
element = initialEventTarget;
|
|
16246
|
+
}
|
|
16247
|
+
}
|
|
15707
16248
|
|
|
15708
|
-
|
|
16249
|
+
// stop for input, select, and textarea
|
|
16250
|
+
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
|
|
16251
|
+
};
|
|
15709
16252
|
|
|
15710
|
-
|
|
16253
|
+
/**
|
|
16254
|
+
* exposes _handleKey publicly so it can be overwritten by extensions
|
|
16255
|
+
*/
|
|
16256
|
+
Mousetrap.prototype.handleKey = function () {
|
|
16257
|
+
var self = this;
|
|
16258
|
+
return self._handleKey.apply(self, arguments);
|
|
16259
|
+
};
|
|
15711
16260
|
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
16261
|
+
/**
|
|
16262
|
+
* allow custom key mappings
|
|
16263
|
+
*/
|
|
16264
|
+
Mousetrap.addKeycodes = function (object) {
|
|
16265
|
+
for (var key in object) {
|
|
16266
|
+
if (object.hasOwnProperty(key)) {
|
|
16267
|
+
_MAP[key] = object[key];
|
|
16268
|
+
}
|
|
16269
|
+
}
|
|
16270
|
+
_REVERSE_MAP = null;
|
|
16271
|
+
};
|
|
15715
16272
|
|
|
15716
|
-
|
|
16273
|
+
/**
|
|
16274
|
+
* Init the global mousetrap functions
|
|
16275
|
+
*
|
|
16276
|
+
* This method is needed to allow the global mousetrap functions to work
|
|
16277
|
+
* now that mousetrap is a constructor function.
|
|
16278
|
+
*/
|
|
16279
|
+
Mousetrap.init = function () {
|
|
16280
|
+
var documentMousetrap = Mousetrap(document);
|
|
16281
|
+
for (var method in documentMousetrap) {
|
|
16282
|
+
if (method.charAt(0) !== '_') {
|
|
16283
|
+
Mousetrap[method] = function (method) {
|
|
16284
|
+
return function () {
|
|
16285
|
+
return documentMousetrap[method].apply(documentMousetrap, arguments);
|
|
16286
|
+
};
|
|
16287
|
+
}(method);
|
|
16288
|
+
}
|
|
16289
|
+
}
|
|
16290
|
+
};
|
|
16291
|
+
Mousetrap.init();
|
|
15717
16292
|
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
keydown: keydown,
|
|
15721
|
-
scope: scope,
|
|
15722
|
-
mods: mods,
|
|
15723
|
-
shortcut: keys[i],
|
|
15724
|
-
method: method,
|
|
15725
|
-
key: keys[i],
|
|
15726
|
-
splitKey: splitKey
|
|
15727
|
-
});
|
|
15728
|
-
} // 在全局document上设置快捷键
|
|
16293
|
+
// expose mousetrap to the global object
|
|
16294
|
+
window.Mousetrap = Mousetrap;
|
|
15729
16295
|
|
|
16296
|
+
// expose as a common js module
|
|
16297
|
+
if (module.exports) {
|
|
16298
|
+
module.exports = Mousetrap;
|
|
16299
|
+
}
|
|
15730
16300
|
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
16301
|
+
// expose mousetrap as an AMD module
|
|
16302
|
+
if (typeof undefined$1 === 'function' && undefined$1.amd) {
|
|
16303
|
+
undefined$1(function () {
|
|
16304
|
+
return Mousetrap;
|
|
16305
|
+
});
|
|
16306
|
+
}
|
|
16307
|
+
})(typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);
|
|
16308
|
+
})(mousetrap);
|
|
16309
|
+
var mousetrapExports = mousetrap.exports;
|
|
16310
|
+
var Mousetrap$1 = /*@__PURE__*/getDefaultExportFromCjs(mousetrapExports);
|
|
16311
|
+
|
|
16312
|
+
/**
|
|
16313
|
+
* adds a bindGlobal method to Mousetrap that allows you to
|
|
16314
|
+
* bind specific keyboard shortcuts that will still work
|
|
16315
|
+
* inside a text input field
|
|
16316
|
+
*
|
|
16317
|
+
* usage:
|
|
16318
|
+
* Mousetrap.bindGlobal('ctrl+s', _saveChanges);
|
|
16319
|
+
*/
|
|
16320
|
+
/* global Mousetrap:true */
|
|
16321
|
+
(function (Mousetrap) {
|
|
16322
|
+
var _globalCallbacks = {};
|
|
16323
|
+
var _originalStopCallback = Mousetrap.prototype.stopCallback;
|
|
16324
|
+
Mousetrap.prototype.stopCallback = function (e, element, combo, sequence) {
|
|
16325
|
+
var self = this;
|
|
16326
|
+
if (self.paused) {
|
|
16327
|
+
return true;
|
|
16328
|
+
}
|
|
16329
|
+
if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
|
|
16330
|
+
return false;
|
|
16331
|
+
}
|
|
16332
|
+
return _originalStopCallback.call(self, e, element, combo);
|
|
16333
|
+
};
|
|
16334
|
+
Mousetrap.prototype.bindGlobal = function (keys, callback, action) {
|
|
16335
|
+
var self = this;
|
|
16336
|
+
self.bind(keys, callback, action);
|
|
16337
|
+
if (keys instanceof Array) {
|
|
16338
|
+
for (var i = 0; i < keys.length; i++) {
|
|
16339
|
+
_globalCallbacks[keys[i]] = true;
|
|
16340
|
+
}
|
|
16341
|
+
return;
|
|
16342
|
+
}
|
|
16343
|
+
_globalCallbacks[keys] = true;
|
|
16344
|
+
};
|
|
16345
|
+
Mousetrap.prototype.unbindGlobal = function (keys, action) {
|
|
16346
|
+
var self = this;
|
|
16347
|
+
self.unbind(keys, action);
|
|
16348
|
+
if (keys instanceof Array) {
|
|
16349
|
+
for (var i = 0; i < keys.length; i++) {
|
|
16350
|
+
_globalCallbacks[keys[i]] = false;
|
|
16351
|
+
}
|
|
16352
|
+
return;
|
|
16353
|
+
}
|
|
16354
|
+
_globalCallbacks[keys] = false;
|
|
16355
|
+
};
|
|
16356
|
+
Mousetrap.init();
|
|
16357
|
+
})(Mousetrap);
|
|
15745
16358
|
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
getScope: getScope,
|
|
15749
|
-
deleteScope: deleteScope,
|
|
15750
|
-
getPressedKeyCodes: getPressedKeyCodes,
|
|
15751
|
-
isPressed: isPressed,
|
|
15752
|
-
filter: filter,
|
|
15753
|
-
unbind: unbind
|
|
15754
|
-
};
|
|
16359
|
+
function _typeof$2(o) {
|
|
16360
|
+
"@babel/helpers - typeof";
|
|
15755
16361
|
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
16362
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
16363
|
+
return typeof o;
|
|
16364
|
+
} : function (o) {
|
|
16365
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
16366
|
+
}, _typeof$2(o);
|
|
15760
16367
|
}
|
|
15761
16368
|
|
|
15762
|
-
|
|
15763
|
-
|
|
16369
|
+
var platform$1 = {exports: {}};
|
|
16370
|
+
|
|
16371
|
+
platform$1.exports;
|
|
16372
|
+
(function (module, exports) {
|
|
16373
|
+
(function () {
|
|
16374
|
+
|
|
16375
|
+
/** Used to determine if values are of the language type `Object`. */
|
|
16376
|
+
var objectTypes = {
|
|
16377
|
+
'function': true,
|
|
16378
|
+
'object': true
|
|
16379
|
+
};
|
|
16380
|
+
|
|
16381
|
+
/** Used as a reference to the global object. */
|
|
16382
|
+
var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$2(window)] && window || this;
|
|
16383
|
+
|
|
16384
|
+
/** Detect free variable `exports`. */
|
|
16385
|
+
var freeExports = exports;
|
|
16386
|
+
|
|
16387
|
+
/** Detect free variable `module`. */
|
|
16388
|
+
var freeModule = module && !module.nodeType && module;
|
|
15764
16389
|
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
16390
|
+
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
|
16391
|
+
var freeGlobal = freeExports && freeModule && _typeof$2(commonjsGlobal) == 'object' && commonjsGlobal;
|
|
16392
|
+
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
|
16393
|
+
root = freeGlobal;
|
|
15768
16394
|
}
|
|
15769
16395
|
|
|
15770
|
-
|
|
15771
|
-
|
|
16396
|
+
/**
|
|
16397
|
+
* Used as the maximum length of an array-like object.
|
|
16398
|
+
* See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
|
|
16399
|
+
* for more details.
|
|
16400
|
+
*/
|
|
16401
|
+
var maxSafeInteger = Math.pow(2, 53) - 1;
|
|
15772
16402
|
|
|
15773
|
-
|
|
15774
|
-
|
|
16403
|
+
/** Regular expression to detect Opera. */
|
|
16404
|
+
var reOpera = /\bOpera/;
|
|
15775
16405
|
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
};
|
|
16406
|
+
/** Used for native method references. */
|
|
16407
|
+
var objectProto = Object.prototype;
|
|
15779
16408
|
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
var targetTagName = target && target.tagName;
|
|
15783
|
-
return Boolean(targetTagName && enableOnTags && enableOnTags.includes(targetTagName));
|
|
15784
|
-
};
|
|
16409
|
+
/** Used to check for own properties of an object. */
|
|
16410
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
15785
16411
|
|
|
15786
|
-
|
|
15787
|
-
|
|
15788
|
-
};
|
|
16412
|
+
/** Used to resolve the internal `[[Class]]` of values. */
|
|
16413
|
+
var toString = objectProto.toString;
|
|
15789
16414
|
|
|
15790
|
-
|
|
15791
|
-
if (options instanceof Array) {
|
|
15792
|
-
deps = options;
|
|
15793
|
-
options = undefined;
|
|
15794
|
-
}
|
|
16415
|
+
/*--------------------------------------------------------------------------*/
|
|
15795
16416
|
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
16417
|
+
/**
|
|
16418
|
+
* Capitalizes a string value.
|
|
16419
|
+
*
|
|
16420
|
+
* @private
|
|
16421
|
+
* @param {string} string The string to capitalize.
|
|
16422
|
+
* @returns {string} The capitalized string.
|
|
16423
|
+
*/
|
|
16424
|
+
function capitalize(string) {
|
|
16425
|
+
string = String(string);
|
|
16426
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
16427
|
+
}
|
|
15807
16428
|
|
|
15808
|
-
|
|
16429
|
+
/**
|
|
16430
|
+
* A utility function to clean up the OS name.
|
|
16431
|
+
*
|
|
16432
|
+
* @private
|
|
16433
|
+
* @param {string} os The OS name to clean up.
|
|
16434
|
+
* @param {string} [pattern] A `RegExp` pattern matching the OS name.
|
|
16435
|
+
* @param {string} [label] A label for the OS.
|
|
16436
|
+
*/
|
|
16437
|
+
function cleanupOS(os, pattern, label) {
|
|
16438
|
+
// Platform tokens are defined at:
|
|
16439
|
+
// http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
|
|
16440
|
+
// http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
|
|
16441
|
+
var data = {
|
|
16442
|
+
'10.0': '10',
|
|
16443
|
+
'6.4': '10 Technical Preview',
|
|
16444
|
+
'6.3': '8.1',
|
|
16445
|
+
'6.2': '8',
|
|
16446
|
+
'6.1': 'Server 2008 R2 / 7',
|
|
16447
|
+
'6.0': 'Server 2008 / Vista',
|
|
16448
|
+
'5.2': 'Server 2003 / XP 64-bit',
|
|
16449
|
+
'5.1': 'XP',
|
|
16450
|
+
'5.01': '2000 SP1',
|
|
16451
|
+
'5.0': '2000',
|
|
16452
|
+
'4.0': 'NT',
|
|
16453
|
+
'4.90': 'ME'
|
|
16454
|
+
};
|
|
16455
|
+
// Detect Windows version from platform tokens.
|
|
16456
|
+
if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) && (data = data[/[\d.]+$/.exec(os)])) {
|
|
16457
|
+
os = 'Windows ' + data;
|
|
16458
|
+
}
|
|
16459
|
+
// Correct character case and cleanup string.
|
|
16460
|
+
os = String(os);
|
|
16461
|
+
if (pattern && label) {
|
|
16462
|
+
os = os.replace(RegExp(pattern, 'i'), label);
|
|
16463
|
+
}
|
|
16464
|
+
os = format(os.replace(/ ce$/i, ' CE').replace(/\bhpw/i, 'web').replace(/\bMacintosh\b/, 'Mac OS').replace(/_PowerPC\b/i, ' OS').replace(/\b(OS X) [^ \d]+/i, '$1').replace(/\bMac (OS X)\b/, '$1').replace(/\/(\d)/, ' $1').replace(/_/g, '.').replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '').replace(/\bx86\.64\b/gi, 'x86_64').replace(/\b(Windows Phone) OS\b/, '$1').replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1').split(' on ')[0]);
|
|
16465
|
+
return os;
|
|
16466
|
+
}
|
|
15809
16467
|
|
|
15810
|
-
|
|
15811
|
-
|
|
16468
|
+
/**
|
|
16469
|
+
* An iteration utility for arrays and objects.
|
|
16470
|
+
*
|
|
16471
|
+
* @private
|
|
16472
|
+
* @param {Array|Object} object The object to iterate over.
|
|
16473
|
+
* @param {Function} callback The function called per iteration.
|
|
16474
|
+
*/
|
|
16475
|
+
function each(object, callback) {
|
|
16476
|
+
var index = -1,
|
|
16477
|
+
length = object ? object.length : 0;
|
|
16478
|
+
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
|
|
16479
|
+
while (++index < length) {
|
|
16480
|
+
callback(object[index], index, object);
|
|
16481
|
+
}
|
|
16482
|
+
} else {
|
|
16483
|
+
forOwn(object, callback);
|
|
16484
|
+
}
|
|
16485
|
+
}
|
|
15812
16486
|
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
16487
|
+
/**
|
|
16488
|
+
* Trim and conditionally capitalize string values.
|
|
16489
|
+
*
|
|
16490
|
+
* @private
|
|
16491
|
+
* @param {string} string The string to format.
|
|
16492
|
+
* @returns {string} The formatted string.
|
|
16493
|
+
*/
|
|
16494
|
+
function format(string) {
|
|
16495
|
+
string = trim(string);
|
|
16496
|
+
return /^(?:webOS|i(?:OS|P))/.test(string) ? string : capitalize(string);
|
|
16497
|
+
}
|
|
15816
16498
|
|
|
16499
|
+
/**
|
|
16500
|
+
* Iterates over an object's own properties, executing the `callback` for each.
|
|
16501
|
+
*
|
|
16502
|
+
* @private
|
|
16503
|
+
* @param {Object} object The object to iterate over.
|
|
16504
|
+
* @param {Function} callback The function executed per own property.
|
|
16505
|
+
*/
|
|
16506
|
+
function forOwn(object, callback) {
|
|
16507
|
+
for (var key in object) {
|
|
16508
|
+
if (hasOwnProperty.call(object, key)) {
|
|
16509
|
+
callback(object[key], key, object);
|
|
16510
|
+
}
|
|
16511
|
+
}
|
|
16512
|
+
}
|
|
15817
16513
|
|
|
15818
|
-
|
|
15819
|
-
|
|
16514
|
+
/**
|
|
16515
|
+
* Gets the internal `[[Class]]` of a value.
|
|
16516
|
+
*
|
|
16517
|
+
* @private
|
|
16518
|
+
* @param {*} value The value.
|
|
16519
|
+
* @returns {string} The `[[Class]]`.
|
|
16520
|
+
*/
|
|
16521
|
+
function getClassOf(value) {
|
|
16522
|
+
return value == null ? capitalize(value) : toString.call(value).slice(8, -1);
|
|
15820
16523
|
}
|
|
15821
16524
|
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
16525
|
+
/**
|
|
16526
|
+
* Host objects can return type values that are different from their actual
|
|
16527
|
+
* data type. The objects we are concerned with usually return non-primitive
|
|
16528
|
+
* types of "object", "function", or "unknown".
|
|
16529
|
+
*
|
|
16530
|
+
* @private
|
|
16531
|
+
* @param {*} object The owner of the property.
|
|
16532
|
+
* @param {string} property The property to check.
|
|
16533
|
+
* @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
|
|
16534
|
+
*/
|
|
16535
|
+
function isHostType(object, property) {
|
|
16536
|
+
var type = object != null ? _typeof$2(object[property]) : 'number';
|
|
16537
|
+
return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true);
|
|
15825
16538
|
}
|
|
15826
16539
|
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
16540
|
+
/**
|
|
16541
|
+
* Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
|
|
16542
|
+
*
|
|
16543
|
+
* @private
|
|
16544
|
+
* @param {string} string The string to qualify.
|
|
16545
|
+
* @returns {string} The qualified string.
|
|
16546
|
+
*/
|
|
16547
|
+
function qualify(string) {
|
|
16548
|
+
return String(string).replace(/([ -])(?!$)/g, '$1?');
|
|
16549
|
+
}
|
|
15833
16550
|
|
|
16551
|
+
/**
|
|
16552
|
+
* A bare-bones `Array#reduce` like utility function.
|
|
16553
|
+
*
|
|
16554
|
+
* @private
|
|
16555
|
+
* @param {Array} array The array to iterate over.
|
|
16556
|
+
* @param {Function} callback The function called per iteration.
|
|
16557
|
+
* @returns {*} The accumulated result.
|
|
16558
|
+
*/
|
|
16559
|
+
function reduce(array, callback) {
|
|
16560
|
+
var accumulator = null;
|
|
16561
|
+
each(array, function (value, index) {
|
|
16562
|
+
accumulator = callback(accumulator, value, index, array);
|
|
16563
|
+
});
|
|
16564
|
+
return accumulator;
|
|
16565
|
+
}
|
|
15834
16566
|
|
|
15835
|
-
|
|
15836
|
-
|
|
16567
|
+
/**
|
|
16568
|
+
* Removes leading and trailing whitespace from a string.
|
|
16569
|
+
*
|
|
16570
|
+
* @private
|
|
16571
|
+
* @param {string} string The string to trim.
|
|
16572
|
+
* @returns {string} The trimmed string.
|
|
16573
|
+
*/
|
|
16574
|
+
function trim(string) {
|
|
16575
|
+
return String(string).replace(/^ +| +$/g, '');
|
|
15837
16576
|
}
|
|
15838
16577
|
|
|
15839
|
-
|
|
16578
|
+
/*--------------------------------------------------------------------------*/
|
|
16579
|
+
|
|
16580
|
+
/**
|
|
16581
|
+
* Creates a new platform object.
|
|
16582
|
+
*
|
|
16583
|
+
* @memberOf platform
|
|
16584
|
+
* @param {Object|string} [ua=navigator.userAgent] The user agent string or
|
|
16585
|
+
* context object.
|
|
16586
|
+
* @returns {Object} A platform object.
|
|
16587
|
+
*/
|
|
16588
|
+
function parse(ua) {
|
|
16589
|
+
/** The environment context object. */
|
|
16590
|
+
var context = root;
|
|
16591
|
+
|
|
16592
|
+
/** Used to flag when a custom context is provided. */
|
|
16593
|
+
var isCustomContext = ua && _typeof$2(ua) == 'object' && getClassOf(ua) != 'String';
|
|
16594
|
+
|
|
16595
|
+
// Juggle arguments.
|
|
16596
|
+
if (isCustomContext) {
|
|
16597
|
+
context = ua;
|
|
16598
|
+
ua = null;
|
|
16599
|
+
}
|
|
16600
|
+
|
|
16601
|
+
/** Browser navigator object. */
|
|
16602
|
+
var nav = context.navigator || {};
|
|
16603
|
+
|
|
16604
|
+
/** Browser user agent string. */
|
|
16605
|
+
var userAgent = nav.userAgent || '';
|
|
16606
|
+
ua || (ua = userAgent);
|
|
16607
|
+
|
|
16608
|
+
/** Used to detect if browser is like Chrome. */
|
|
16609
|
+
var likeChrome = isCustomContext ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
|
|
16610
|
+
|
|
16611
|
+
/** Internal `[[Class]]` value shortcuts. */
|
|
16612
|
+
var objectClass = 'Object',
|
|
16613
|
+
airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
|
|
16614
|
+
enviroClass = isCustomContext ? objectClass : 'Environment',
|
|
16615
|
+
javaClass = isCustomContext && context.java ? 'JavaPackage' : getClassOf(context.java),
|
|
16616
|
+
phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
|
|
16617
|
+
|
|
16618
|
+
/** Detect Java environments. */
|
|
16619
|
+
var java = /\bJava/.test(javaClass) && context.java;
|
|
16620
|
+
|
|
16621
|
+
/** Detect Rhino. */
|
|
16622
|
+
var rhino = java && getClassOf(context.environment) == enviroClass;
|
|
16623
|
+
|
|
16624
|
+
/** A character to represent alpha. */
|
|
16625
|
+
var alpha = java ? 'a' : "\u03B1";
|
|
16626
|
+
|
|
16627
|
+
/** A character to represent beta. */
|
|
16628
|
+
var beta = java ? 'b' : "\u03B2";
|
|
16629
|
+
|
|
16630
|
+
/** Browser document object. */
|
|
16631
|
+
var doc = context.document || {};
|
|
16632
|
+
|
|
16633
|
+
/**
|
|
16634
|
+
* Detect Opera browser (Presto-based).
|
|
16635
|
+
* http://www.howtocreate.co.uk/operaStuff/operaObject.html
|
|
16636
|
+
* http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
|
|
16637
|
+
*/
|
|
16638
|
+
var opera = context.operamini || context.opera;
|
|
16639
|
+
|
|
16640
|
+
/** Opera `[[Class]]`. */
|
|
16641
|
+
var operaClass = reOpera.test(operaClass = isCustomContext && opera ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : opera = null;
|
|
16642
|
+
|
|
16643
|
+
/*------------------------------------------------------------------------*/
|
|
16644
|
+
|
|
16645
|
+
/** Temporary variable used over the script's lifetime. */
|
|
16646
|
+
var data;
|
|
16647
|
+
|
|
16648
|
+
/** The CPU architecture. */
|
|
16649
|
+
var arch = ua;
|
|
16650
|
+
|
|
16651
|
+
/** Platform description array. */
|
|
16652
|
+
var description = [];
|
|
16653
|
+
|
|
16654
|
+
/** Platform alpha/beta indicator. */
|
|
16655
|
+
var prerelease = null;
|
|
16656
|
+
|
|
16657
|
+
/** A flag to indicate that environment features should be used to resolve the platform. */
|
|
16658
|
+
var useFeatures = ua == userAgent;
|
|
16659
|
+
|
|
16660
|
+
/** The browser/environment version. */
|
|
16661
|
+
var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
|
|
16662
|
+
|
|
16663
|
+
/** A flag to indicate if the OS ends with "/ Version" */
|
|
16664
|
+
var isSpecialCasedOS;
|
|
16665
|
+
|
|
16666
|
+
/* Detectable layout engines (order is important). */
|
|
16667
|
+
var layout = getLayout([{
|
|
16668
|
+
'label': 'EdgeHTML',
|
|
16669
|
+
'pattern': 'Edge'
|
|
16670
|
+
}, 'Trident', {
|
|
16671
|
+
'label': 'WebKit',
|
|
16672
|
+
'pattern': 'AppleWebKit'
|
|
16673
|
+
}, 'iCab', 'Presto', 'NetFront', 'Tasman', 'KHTML', 'Gecko']);
|
|
16674
|
+
|
|
16675
|
+
/* Detectable browser names (order is important). */
|
|
16676
|
+
var name = getName(['Adobe AIR', 'Arora', 'Avant Browser', 'Breach', 'Camino', 'Electron', 'Epiphany', 'Fennec', 'Flock', 'Galeon', 'GreenBrowser', 'iCab', 'Iceweasel', 'K-Meleon', 'Konqueror', 'Lunascape', 'Maxthon', {
|
|
16677
|
+
'label': 'Microsoft Edge',
|
|
16678
|
+
'pattern': '(?:Edge|Edg|EdgA|EdgiOS)'
|
|
16679
|
+
}, 'Midori', 'Nook Browser', 'PaleMoon', 'PhantomJS', 'Raven', 'Rekonq', 'RockMelt', {
|
|
16680
|
+
'label': 'Samsung Internet',
|
|
16681
|
+
'pattern': 'SamsungBrowser'
|
|
16682
|
+
}, 'SeaMonkey', {
|
|
16683
|
+
'label': 'Silk',
|
|
16684
|
+
'pattern': '(?:Cloud9|Silk-Accelerated)'
|
|
16685
|
+
}, 'Sleipnir', 'SlimBrowser', {
|
|
16686
|
+
'label': 'SRWare Iron',
|
|
16687
|
+
'pattern': 'Iron'
|
|
16688
|
+
}, 'Sunrise', 'Swiftfox', 'Vivaldi', 'Waterfox', 'WebPositive', {
|
|
16689
|
+
'label': 'Yandex Browser',
|
|
16690
|
+
'pattern': 'YaBrowser'
|
|
16691
|
+
}, {
|
|
16692
|
+
'label': 'UC Browser',
|
|
16693
|
+
'pattern': 'UCBrowser'
|
|
16694
|
+
}, 'Opera Mini', {
|
|
16695
|
+
'label': 'Opera Mini',
|
|
16696
|
+
'pattern': 'OPiOS'
|
|
16697
|
+
}, 'Opera', {
|
|
16698
|
+
'label': 'Opera',
|
|
16699
|
+
'pattern': 'OPR'
|
|
16700
|
+
}, 'Chromium', 'Chrome', {
|
|
16701
|
+
'label': 'Chrome',
|
|
16702
|
+
'pattern': '(?:HeadlessChrome)'
|
|
16703
|
+
}, {
|
|
16704
|
+
'label': 'Chrome Mobile',
|
|
16705
|
+
'pattern': '(?:CriOS|CrMo)'
|
|
16706
|
+
}, {
|
|
16707
|
+
'label': 'Firefox',
|
|
16708
|
+
'pattern': '(?:Firefox|Minefield)'
|
|
16709
|
+
}, {
|
|
16710
|
+
'label': 'Firefox for iOS',
|
|
16711
|
+
'pattern': 'FxiOS'
|
|
16712
|
+
}, {
|
|
16713
|
+
'label': 'IE',
|
|
16714
|
+
'pattern': 'IEMobile'
|
|
16715
|
+
}, {
|
|
16716
|
+
'label': 'IE',
|
|
16717
|
+
'pattern': 'MSIE'
|
|
16718
|
+
}, 'Safari']);
|
|
16719
|
+
|
|
16720
|
+
/* Detectable products (order is important). */
|
|
16721
|
+
var product = getProduct([{
|
|
16722
|
+
'label': 'BlackBerry',
|
|
16723
|
+
'pattern': 'BB10'
|
|
16724
|
+
}, 'BlackBerry', {
|
|
16725
|
+
'label': 'Galaxy S',
|
|
16726
|
+
'pattern': 'GT-I9000'
|
|
16727
|
+
}, {
|
|
16728
|
+
'label': 'Galaxy S2',
|
|
16729
|
+
'pattern': 'GT-I9100'
|
|
16730
|
+
}, {
|
|
16731
|
+
'label': 'Galaxy S3',
|
|
16732
|
+
'pattern': 'GT-I9300'
|
|
16733
|
+
}, {
|
|
16734
|
+
'label': 'Galaxy S4',
|
|
16735
|
+
'pattern': 'GT-I9500'
|
|
16736
|
+
}, {
|
|
16737
|
+
'label': 'Galaxy S5',
|
|
16738
|
+
'pattern': 'SM-G900'
|
|
16739
|
+
}, {
|
|
16740
|
+
'label': 'Galaxy S6',
|
|
16741
|
+
'pattern': 'SM-G920'
|
|
16742
|
+
}, {
|
|
16743
|
+
'label': 'Galaxy S6 Edge',
|
|
16744
|
+
'pattern': 'SM-G925'
|
|
16745
|
+
}, {
|
|
16746
|
+
'label': 'Galaxy S7',
|
|
16747
|
+
'pattern': 'SM-G930'
|
|
16748
|
+
}, {
|
|
16749
|
+
'label': 'Galaxy S7 Edge',
|
|
16750
|
+
'pattern': 'SM-G935'
|
|
16751
|
+
}, 'Google TV', 'Lumia', 'iPad', 'iPod', 'iPhone', 'Kindle', {
|
|
16752
|
+
'label': 'Kindle Fire',
|
|
16753
|
+
'pattern': '(?:Cloud9|Silk-Accelerated)'
|
|
16754
|
+
}, 'Nexus', 'Nook', 'PlayBook', 'PlayStation Vita', 'PlayStation', 'TouchPad', 'Transformer', {
|
|
16755
|
+
'label': 'Wii U',
|
|
16756
|
+
'pattern': 'WiiU'
|
|
16757
|
+
}, 'Wii', 'Xbox One', {
|
|
16758
|
+
'label': 'Xbox 360',
|
|
16759
|
+
'pattern': 'Xbox'
|
|
16760
|
+
}, 'Xoom']);
|
|
16761
|
+
|
|
16762
|
+
/* Detectable manufacturers. */
|
|
16763
|
+
var manufacturer = getManufacturer({
|
|
16764
|
+
'Apple': {
|
|
16765
|
+
'iPad': 1,
|
|
16766
|
+
'iPhone': 1,
|
|
16767
|
+
'iPod': 1
|
|
16768
|
+
},
|
|
16769
|
+
'Alcatel': {},
|
|
16770
|
+
'Archos': {},
|
|
16771
|
+
'Amazon': {
|
|
16772
|
+
'Kindle': 1,
|
|
16773
|
+
'Kindle Fire': 1
|
|
16774
|
+
},
|
|
16775
|
+
'Asus': {
|
|
16776
|
+
'Transformer': 1
|
|
16777
|
+
},
|
|
16778
|
+
'Barnes & Noble': {
|
|
16779
|
+
'Nook': 1
|
|
16780
|
+
},
|
|
16781
|
+
'BlackBerry': {
|
|
16782
|
+
'PlayBook': 1
|
|
16783
|
+
},
|
|
16784
|
+
'Google': {
|
|
16785
|
+
'Google TV': 1,
|
|
16786
|
+
'Nexus': 1
|
|
16787
|
+
},
|
|
16788
|
+
'HP': {
|
|
16789
|
+
'TouchPad': 1
|
|
16790
|
+
},
|
|
16791
|
+
'HTC': {},
|
|
16792
|
+
'Huawei': {},
|
|
16793
|
+
'Lenovo': {},
|
|
16794
|
+
'LG': {},
|
|
16795
|
+
'Microsoft': {
|
|
16796
|
+
'Xbox': 1,
|
|
16797
|
+
'Xbox One': 1
|
|
16798
|
+
},
|
|
16799
|
+
'Motorola': {
|
|
16800
|
+
'Xoom': 1
|
|
16801
|
+
},
|
|
16802
|
+
'Nintendo': {
|
|
16803
|
+
'Wii U': 1,
|
|
16804
|
+
'Wii': 1
|
|
16805
|
+
},
|
|
16806
|
+
'Nokia': {
|
|
16807
|
+
'Lumia': 1
|
|
16808
|
+
},
|
|
16809
|
+
'Oppo': {},
|
|
16810
|
+
'Samsung': {
|
|
16811
|
+
'Galaxy S': 1,
|
|
16812
|
+
'Galaxy S2': 1,
|
|
16813
|
+
'Galaxy S3': 1,
|
|
16814
|
+
'Galaxy S4': 1
|
|
16815
|
+
},
|
|
16816
|
+
'Sony': {
|
|
16817
|
+
'PlayStation': 1,
|
|
16818
|
+
'PlayStation Vita': 1
|
|
16819
|
+
},
|
|
16820
|
+
'Xiaomi': {
|
|
16821
|
+
'Mi': 1,
|
|
16822
|
+
'Redmi': 1
|
|
16823
|
+
}
|
|
16824
|
+
});
|
|
16825
|
+
|
|
16826
|
+
/* Detectable operating systems (order is important). */
|
|
16827
|
+
var os = getOS(['Windows Phone', 'KaiOS', 'Android', 'CentOS', {
|
|
16828
|
+
'label': 'Chrome OS',
|
|
16829
|
+
'pattern': 'CrOS'
|
|
16830
|
+
}, 'Debian', {
|
|
16831
|
+
'label': 'DragonFly BSD',
|
|
16832
|
+
'pattern': 'DragonFly'
|
|
16833
|
+
}, 'Fedora', 'FreeBSD', 'Gentoo', 'Haiku', 'Kubuntu', 'Linux Mint', 'OpenBSD', 'Red Hat', 'SuSE', 'Ubuntu', 'Xubuntu', 'Cygwin', 'Symbian OS', 'hpwOS', 'webOS ', 'webOS', 'Tablet OS', 'Tizen', 'Linux', 'Mac OS X', 'Macintosh', 'Mac', 'Windows 98;', 'Windows ']);
|
|
16834
|
+
|
|
16835
|
+
/*------------------------------------------------------------------------*/
|
|
16836
|
+
|
|
16837
|
+
/**
|
|
16838
|
+
* Picks the layout engine from an array of guesses.
|
|
16839
|
+
*
|
|
16840
|
+
* @private
|
|
16841
|
+
* @param {Array} guesses An array of guesses.
|
|
16842
|
+
* @returns {null|string} The detected layout engine.
|
|
16843
|
+
*/
|
|
16844
|
+
function getLayout(guesses) {
|
|
16845
|
+
return reduce(guesses, function (result, guess) {
|
|
16846
|
+
return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
|
16847
|
+
});
|
|
16848
|
+
}
|
|
16849
|
+
|
|
16850
|
+
/**
|
|
16851
|
+
* Picks the manufacturer from an array of guesses.
|
|
16852
|
+
*
|
|
16853
|
+
* @private
|
|
16854
|
+
* @param {Array} guesses An object of guesses.
|
|
16855
|
+
* @returns {null|string} The detected manufacturer.
|
|
16856
|
+
*/
|
|
16857
|
+
function getManufacturer(guesses) {
|
|
16858
|
+
return reduce(guesses, function (result, value, key) {
|
|
16859
|
+
// Lookup the manufacturer by product or scan the UA for the manufacturer.
|
|
16860
|
+
return result || (value[product] || value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] || RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)) && key;
|
|
16861
|
+
});
|
|
16862
|
+
}
|
|
16863
|
+
|
|
16864
|
+
/**
|
|
16865
|
+
* Picks the browser name from an array of guesses.
|
|
16866
|
+
*
|
|
16867
|
+
* @private
|
|
16868
|
+
* @param {Array} guesses An array of guesses.
|
|
16869
|
+
* @returns {null|string} The detected browser name.
|
|
16870
|
+
*/
|
|
16871
|
+
function getName(guesses) {
|
|
16872
|
+
return reduce(guesses, function (result, guess) {
|
|
16873
|
+
return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
|
16874
|
+
});
|
|
16875
|
+
}
|
|
16876
|
+
|
|
16877
|
+
/**
|
|
16878
|
+
* Picks the OS name from an array of guesses.
|
|
16879
|
+
*
|
|
16880
|
+
* @private
|
|
16881
|
+
* @param {Array} guesses An array of guesses.
|
|
16882
|
+
* @returns {null|string} The detected OS name.
|
|
16883
|
+
*/
|
|
16884
|
+
function getOS(guesses) {
|
|
16885
|
+
return reduce(guesses, function (result, guess) {
|
|
16886
|
+
var pattern = guess.pattern || qualify(guess);
|
|
16887
|
+
if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua))) {
|
|
16888
|
+
result = cleanupOS(result, pattern, guess.label || guess);
|
|
16889
|
+
}
|
|
16890
|
+
return result;
|
|
16891
|
+
});
|
|
16892
|
+
}
|
|
16893
|
+
|
|
16894
|
+
/**
|
|
16895
|
+
* Picks the product name from an array of guesses.
|
|
16896
|
+
*
|
|
16897
|
+
* @private
|
|
16898
|
+
* @param {Array} guesses An array of guesses.
|
|
16899
|
+
* @returns {null|string} The detected product name.
|
|
16900
|
+
*/
|
|
16901
|
+
function getProduct(guesses) {
|
|
16902
|
+
return reduce(guesses, function (result, guess) {
|
|
16903
|
+
var pattern = guess.pattern || qualify(guess);
|
|
16904
|
+
if (!result && (result = RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) || RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) || RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua))) {
|
|
16905
|
+
// Split by forward slash and append product version if needed.
|
|
16906
|
+
if ((result = String(guess.label && !RegExp(pattern, 'i').test(guess.label) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
|
|
16907
|
+
result[0] += ' ' + result[1];
|
|
16908
|
+
}
|
|
16909
|
+
// Correct character case and cleanup string.
|
|
16910
|
+
guess = guess.label || guess;
|
|
16911
|
+
result = format(result[0].replace(RegExp(pattern, 'i'), guess).replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ').replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
|
|
16912
|
+
}
|
|
16913
|
+
return result;
|
|
16914
|
+
});
|
|
16915
|
+
}
|
|
16916
|
+
|
|
16917
|
+
/**
|
|
16918
|
+
* Resolves the version using an array of UA patterns.
|
|
16919
|
+
*
|
|
16920
|
+
* @private
|
|
16921
|
+
* @param {Array} patterns An array of UA patterns.
|
|
16922
|
+
* @returns {null|string} The detected version.
|
|
16923
|
+
*/
|
|
16924
|
+
function getVersion(patterns) {
|
|
16925
|
+
return reduce(patterns, function (result, pattern) {
|
|
16926
|
+
return result || (RegExp(pattern + '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
|
|
16927
|
+
});
|
|
16928
|
+
}
|
|
16929
|
+
|
|
16930
|
+
/**
|
|
16931
|
+
* Returns `platform.description` when the platform object is coerced to a string.
|
|
16932
|
+
*
|
|
16933
|
+
* @name toString
|
|
16934
|
+
* @memberOf platform
|
|
16935
|
+
* @returns {string} Returns `platform.description` if available, else an empty string.
|
|
16936
|
+
*/
|
|
16937
|
+
function toStringPlatform() {
|
|
16938
|
+
return this.description || '';
|
|
16939
|
+
}
|
|
16940
|
+
|
|
16941
|
+
/*------------------------------------------------------------------------*/
|
|
16942
|
+
|
|
16943
|
+
// Convert layout to an array so we can add extra details.
|
|
16944
|
+
layout && (layout = [layout]);
|
|
16945
|
+
|
|
16946
|
+
// Detect Android products.
|
|
16947
|
+
// Browsers on Android devices typically provide their product IDS after "Android;"
|
|
16948
|
+
// up to "Build" or ") AppleWebKit".
|
|
16949
|
+
// Example:
|
|
16950
|
+
// "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
|
|
16951
|
+
// (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
|
|
16952
|
+
if (/\bAndroid\b/.test(os) && !product && (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
|
|
16953
|
+
product = trim(data[1])
|
|
16954
|
+
// Replace any language codes (eg. "en-US").
|
|
16955
|
+
.replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') || null;
|
|
16956
|
+
}
|
|
16957
|
+
// Detect product names that contain their manufacturer's name.
|
|
16958
|
+
if (manufacturer && !product) {
|
|
16959
|
+
product = getProduct([manufacturer]);
|
|
16960
|
+
} else if (manufacturer && product) {
|
|
16961
|
+
product = product.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ').replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
|
|
16962
|
+
}
|
|
16963
|
+
// Clean up Google TV.
|
|
16964
|
+
if (data = /\bGoogle TV\b/.exec(product)) {
|
|
16965
|
+
product = data[0];
|
|
16966
|
+
}
|
|
16967
|
+
// Detect simulators.
|
|
16968
|
+
if (/\bSimulator\b/i.test(ua)) {
|
|
16969
|
+
product = (product ? product + ' ' : '') + 'Simulator';
|
|
16970
|
+
}
|
|
16971
|
+
// Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
|
|
16972
|
+
if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
|
|
16973
|
+
description.push('running in Turbo/Uncompressed mode');
|
|
16974
|
+
}
|
|
16975
|
+
// Detect IE Mobile 11.
|
|
16976
|
+
if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
|
|
16977
|
+
data = parse(ua.replace(/like iPhone OS/, ''));
|
|
16978
|
+
manufacturer = data.manufacturer;
|
|
16979
|
+
product = data.product;
|
|
16980
|
+
}
|
|
16981
|
+
// Detect iOS.
|
|
16982
|
+
else if (/^iP/.test(product)) {
|
|
16983
|
+
name || (name = 'Safari');
|
|
16984
|
+
os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) ? ' ' + data[1].replace(/_/g, '.') : '');
|
|
16985
|
+
}
|
|
16986
|
+
// Detect Kubuntu.
|
|
16987
|
+
else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
|
|
16988
|
+
os = 'Kubuntu';
|
|
16989
|
+
}
|
|
16990
|
+
// Detect Android browsers.
|
|
16991
|
+
else if (manufacturer && manufacturer != 'Google' && (/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua) || /\bVita\b/.test(product)) || /\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua)) {
|
|
16992
|
+
name = 'Android Browser';
|
|
16993
|
+
os = /\bAndroid\b/.test(os) ? os : 'Android';
|
|
16994
|
+
}
|
|
16995
|
+
// Detect Silk desktop/accelerated modes.
|
|
16996
|
+
else if (name == 'Silk') {
|
|
16997
|
+
if (!/\bMobi/i.test(ua)) {
|
|
16998
|
+
os = 'Android';
|
|
16999
|
+
description.unshift('desktop mode');
|
|
17000
|
+
}
|
|
17001
|
+
if (/Accelerated *= *true/i.test(ua)) {
|
|
17002
|
+
description.unshift('accelerated');
|
|
17003
|
+
}
|
|
17004
|
+
}
|
|
17005
|
+
// Detect UC Browser speed mode.
|
|
17006
|
+
else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
|
|
17007
|
+
description.push('speed mode');
|
|
17008
|
+
}
|
|
17009
|
+
// Detect PaleMoon identifying as Firefox.
|
|
17010
|
+
else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
|
|
17011
|
+
description.push('identifying as Firefox ' + data[1]);
|
|
17012
|
+
}
|
|
17013
|
+
// Detect Firefox OS and products running Firefox.
|
|
17014
|
+
else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
|
|
17015
|
+
os || (os = 'Firefox OS');
|
|
17016
|
+
product || (product = data[1]);
|
|
17017
|
+
}
|
|
17018
|
+
// Detect false positives for Firefox/Safari.
|
|
17019
|
+
else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
|
|
17020
|
+
// Escape the `/` for Firefox 1.
|
|
17021
|
+
if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
|
|
17022
|
+
// Clear name of false positives.
|
|
17023
|
+
name = null;
|
|
17024
|
+
}
|
|
17025
|
+
// Reassign a generic name.
|
|
17026
|
+
if ((data = product || manufacturer || os) && (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
|
|
17027
|
+
name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
// Add Chrome version to description for Electron.
|
|
17031
|
+
else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
|
|
17032
|
+
description.push('Chromium ' + data);
|
|
17033
|
+
}
|
|
17034
|
+
// Detect non-Opera (Presto-based) versions (order is important).
|
|
17035
|
+
if (!version) {
|
|
17036
|
+
version = getVersion(['(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)']);
|
|
17037
|
+
}
|
|
17038
|
+
// Detect stubborn layout engines.
|
|
17039
|
+
if (data = layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' || /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' || !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') || layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront') {
|
|
17040
|
+
layout = [data];
|
|
17041
|
+
}
|
|
17042
|
+
// Detect Windows Phone 7 desktop mode.
|
|
17043
|
+
if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
|
|
17044
|
+
name += ' Mobile';
|
|
17045
|
+
os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
|
|
17046
|
+
description.unshift('desktop mode');
|
|
17047
|
+
}
|
|
17048
|
+
// Detect Windows Phone 8.x desktop mode.
|
|
17049
|
+
else if (/\bWPDesktop\b/i.test(ua)) {
|
|
17050
|
+
name = 'IE Mobile';
|
|
17051
|
+
os = 'Windows Phone 8.x';
|
|
17052
|
+
description.unshift('desktop mode');
|
|
17053
|
+
version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
|
|
17054
|
+
}
|
|
17055
|
+
// Detect IE 11 identifying as other browsers.
|
|
17056
|
+
else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
|
|
17057
|
+
if (name) {
|
|
17058
|
+
description.push('identifying as ' + name + (version ? ' ' + version : ''));
|
|
17059
|
+
}
|
|
17060
|
+
name = 'IE';
|
|
17061
|
+
version = data[1];
|
|
17062
|
+
}
|
|
17063
|
+
// Leverage environment features.
|
|
17064
|
+
if (useFeatures) {
|
|
17065
|
+
// Detect server-side environments.
|
|
17066
|
+
// Rhino has a global function while others have a global object.
|
|
17067
|
+
if (isHostType(context, 'global')) {
|
|
17068
|
+
if (java) {
|
|
17069
|
+
data = java.lang.System;
|
|
17070
|
+
arch = data.getProperty('os.arch');
|
|
17071
|
+
os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
|
|
17072
|
+
}
|
|
17073
|
+
if (rhino) {
|
|
17074
|
+
try {
|
|
17075
|
+
version = context.require('ringo/engine').version.join('.');
|
|
17076
|
+
name = 'RingoJS';
|
|
17077
|
+
} catch (e) {
|
|
17078
|
+
if ((data = context.system) && data.global.system == context.system) {
|
|
17079
|
+
name = 'Narwhal';
|
|
17080
|
+
os || (os = data[0].os || null);
|
|
17081
|
+
}
|
|
17082
|
+
}
|
|
17083
|
+
if (!name) {
|
|
17084
|
+
name = 'Rhino';
|
|
17085
|
+
}
|
|
17086
|
+
} else if (_typeof$2(context.process) == 'object' && !context.process.browser && (data = context.process)) {
|
|
17087
|
+
if (_typeof$2(data.versions) == 'object') {
|
|
17088
|
+
if (typeof data.versions.electron == 'string') {
|
|
17089
|
+
description.push('Node ' + data.versions.node);
|
|
17090
|
+
name = 'Electron';
|
|
17091
|
+
version = data.versions.electron;
|
|
17092
|
+
} else if (typeof data.versions.nw == 'string') {
|
|
17093
|
+
description.push('Chromium ' + version, 'Node ' + data.versions.node);
|
|
17094
|
+
name = 'NW.js';
|
|
17095
|
+
version = data.versions.nw;
|
|
17096
|
+
}
|
|
17097
|
+
}
|
|
17098
|
+
if (!name) {
|
|
17099
|
+
name = 'Node.js';
|
|
17100
|
+
arch = data.arch;
|
|
17101
|
+
os = data.platform;
|
|
17102
|
+
version = /[\d.]+/.exec(data.version);
|
|
17103
|
+
version = version ? version[0] : null;
|
|
17104
|
+
}
|
|
17105
|
+
}
|
|
17106
|
+
}
|
|
17107
|
+
// Detect Adobe AIR.
|
|
17108
|
+
else if (getClassOf(data = context.runtime) == airRuntimeClass) {
|
|
17109
|
+
name = 'Adobe AIR';
|
|
17110
|
+
os = data.flash.system.Capabilities.os;
|
|
17111
|
+
}
|
|
17112
|
+
// Detect PhantomJS.
|
|
17113
|
+
else if (getClassOf(data = context.phantom) == phantomClass) {
|
|
17114
|
+
name = 'PhantomJS';
|
|
17115
|
+
version = (data = data.version || null) && data.major + '.' + data.minor + '.' + data.patch;
|
|
17116
|
+
}
|
|
17117
|
+
// Detect IE compatibility modes.
|
|
17118
|
+
else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
|
|
17119
|
+
// We're in compatibility mode when the Trident version + 4 doesn't
|
|
17120
|
+
// equal the document mode.
|
|
17121
|
+
version = [version, doc.documentMode];
|
|
17122
|
+
if ((data = +data[1] + 4) != version[1]) {
|
|
17123
|
+
description.push('IE ' + version[1] + ' mode');
|
|
17124
|
+
layout && (layout[1] = '');
|
|
17125
|
+
version[1] = data;
|
|
17126
|
+
}
|
|
17127
|
+
version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
|
|
17128
|
+
}
|
|
17129
|
+
// Detect IE 11 masking as other browsers.
|
|
17130
|
+
else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
|
|
17131
|
+
description.push('masking as ' + name + ' ' + version);
|
|
17132
|
+
name = 'IE';
|
|
17133
|
+
version = '11.0';
|
|
17134
|
+
layout = ['Trident'];
|
|
17135
|
+
os = 'Windows';
|
|
17136
|
+
}
|
|
17137
|
+
os = os && format(os);
|
|
17138
|
+
}
|
|
17139
|
+
// Detect prerelease phases.
|
|
17140
|
+
if (version && (data = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || /\bMinefield\b/i.test(ua) && 'a')) {
|
|
17141
|
+
prerelease = /b/i.test(data) ? 'beta' : 'alpha';
|
|
17142
|
+
version = version.replace(RegExp(data + '\\+?$'), '') + (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
|
|
17143
|
+
}
|
|
17144
|
+
// Detect Firefox Mobile.
|
|
17145
|
+
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
|
|
17146
|
+
name = 'Firefox Mobile';
|
|
17147
|
+
}
|
|
17148
|
+
// Obscure Maxthon's unreliable version.
|
|
17149
|
+
else if (name == 'Maxthon' && version) {
|
|
17150
|
+
version = version.replace(/\.[\d.]+/, '.x');
|
|
17151
|
+
}
|
|
17152
|
+
// Detect Xbox 360 and Xbox One.
|
|
17153
|
+
else if (/\bXbox\b/i.test(product)) {
|
|
17154
|
+
if (product == 'Xbox 360') {
|
|
17155
|
+
os = null;
|
|
17156
|
+
}
|
|
17157
|
+
if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
|
|
17158
|
+
description.unshift('mobile mode');
|
|
17159
|
+
}
|
|
17160
|
+
}
|
|
17161
|
+
// Add mobile postfix.
|
|
17162
|
+
else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) {
|
|
17163
|
+
name += ' Mobile';
|
|
17164
|
+
}
|
|
17165
|
+
// Detect IE platform preview.
|
|
17166
|
+
else if (name == 'IE' && useFeatures) {
|
|
17167
|
+
try {
|
|
17168
|
+
if (context.external === null) {
|
|
17169
|
+
description.unshift('platform preview');
|
|
17170
|
+
}
|
|
17171
|
+
} catch (e) {
|
|
17172
|
+
description.unshift('embedded');
|
|
17173
|
+
}
|
|
17174
|
+
}
|
|
17175
|
+
// Detect BlackBerry OS version.
|
|
17176
|
+
// http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
|
|
17177
|
+
else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || version)) {
|
|
17178
|
+
data = [data, /BB10/.test(ua)];
|
|
17179
|
+
os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
|
|
17180
|
+
version = null;
|
|
17181
|
+
}
|
|
17182
|
+
// Detect Opera identifying/masking itself as another browser.
|
|
17183
|
+
// http://www.opera.com/support/kb/view/843/
|
|
17184
|
+
else if (this != forOwn && product != 'Wii' && (useFeatures && opera || /Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua) || name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os) || name == 'IE' && (os && !/^Win/.test(os) && version > 5.5 || /\bWindows XP\b/.test(os) && version > 8 || version == 8 && !/\bTrident\b/.test(ua))) && !reOpera.test(data = parse.call(forOwn, ua.replace(reOpera, '') + ';')) && data.name) {
|
|
17185
|
+
// When "identifying", the UA contains both Opera and the other browser's name.
|
|
17186
|
+
data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
|
|
17187
|
+
if (reOpera.test(name)) {
|
|
17188
|
+
if (/\bIE\b/.test(data) && os == 'Mac OS') {
|
|
17189
|
+
os = null;
|
|
17190
|
+
}
|
|
17191
|
+
data = 'identify' + data;
|
|
17192
|
+
}
|
|
17193
|
+
// When "masking", the UA contains only the other browser's name.
|
|
17194
|
+
else {
|
|
17195
|
+
data = 'mask' + data;
|
|
17196
|
+
if (operaClass) {
|
|
17197
|
+
name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
|
|
17198
|
+
} else {
|
|
17199
|
+
name = 'Opera';
|
|
17200
|
+
}
|
|
17201
|
+
if (/\bIE\b/.test(data)) {
|
|
17202
|
+
os = null;
|
|
17203
|
+
}
|
|
17204
|
+
if (!useFeatures) {
|
|
17205
|
+
version = null;
|
|
17206
|
+
}
|
|
17207
|
+
}
|
|
17208
|
+
layout = ['Presto'];
|
|
17209
|
+
description.push(data);
|
|
17210
|
+
}
|
|
17211
|
+
// Detect WebKit Nightly and approximate Chrome/Safari versions.
|
|
17212
|
+
if (data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1]) {
|
|
17213
|
+
// Correct build number for numeric comparison.
|
|
17214
|
+
// (e.g. "532.5" becomes "532.05")
|
|
17215
|
+
data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
|
|
17216
|
+
// Nightly builds are postfixed with a "+".
|
|
17217
|
+
if (name == 'Safari' && data[1].slice(-1) == '+') {
|
|
17218
|
+
name = 'WebKit Nightly';
|
|
17219
|
+
prerelease = 'alpha';
|
|
17220
|
+
version = data[1].slice(0, -1);
|
|
17221
|
+
}
|
|
17222
|
+
// Clear incorrect browser versions.
|
|
17223
|
+
else if (version == data[1] || version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
|
|
17224
|
+
version = null;
|
|
17225
|
+
}
|
|
17226
|
+
// Use the full Chrome version when available.
|
|
17227
|
+
data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
|
|
17228
|
+
// Detect Blink layout engine.
|
|
17229
|
+
if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
|
|
17230
|
+
layout = ['Blink'];
|
|
17231
|
+
}
|
|
17232
|
+
// Detect JavaScriptCore.
|
|
17233
|
+
// http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
|
|
17234
|
+
if (!useFeatures || !likeChrome && !data[1]) {
|
|
17235
|
+
layout && (layout[1] = 'like Safari');
|
|
17236
|
+
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12');
|
|
17237
|
+
} else {
|
|
17238
|
+
layout && (layout[1] = 'like Chrome');
|
|
17239
|
+
data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
|
|
17240
|
+
}
|
|
17241
|
+
// Add the postfix of ".x" or "+" for approximate versions.
|
|
17242
|
+
layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
|
|
17243
|
+
// Obscure version for some Safari 1-2 releases.
|
|
17244
|
+
if (name == 'Safari' && (!version || parseInt(version) > 45)) {
|
|
17245
|
+
version = data;
|
|
17246
|
+
} else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
|
|
17247
|
+
description.unshift('headless');
|
|
17248
|
+
}
|
|
17249
|
+
}
|
|
17250
|
+
// Detect Opera desktop modes.
|
|
17251
|
+
if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
|
|
17252
|
+
name += ' ';
|
|
17253
|
+
description.unshift('desktop mode');
|
|
17254
|
+
if (data == 'zvav') {
|
|
17255
|
+
name += 'Mini';
|
|
17256
|
+
version = null;
|
|
17257
|
+
} else {
|
|
17258
|
+
name += 'Mobile';
|
|
17259
|
+
}
|
|
17260
|
+
os = os.replace(RegExp(' *' + data + '$'), '');
|
|
17261
|
+
}
|
|
17262
|
+
// Detect Chrome desktop mode.
|
|
17263
|
+
else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
|
|
17264
|
+
description.unshift('desktop mode');
|
|
17265
|
+
name = 'Chrome Mobile';
|
|
17266
|
+
version = null;
|
|
17267
|
+
if (/\bOS X\b/.test(os)) {
|
|
17268
|
+
manufacturer = 'Apple';
|
|
17269
|
+
os = 'iOS 4.3+';
|
|
17270
|
+
} else {
|
|
17271
|
+
os = null;
|
|
17272
|
+
}
|
|
17273
|
+
}
|
|
17274
|
+
// Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
|
|
17275
|
+
else if (/\bSRWare Iron\b/.test(name) && !version) {
|
|
17276
|
+
version = getVersion('Chrome');
|
|
17277
|
+
}
|
|
17278
|
+
// Strip incorrect OS versions.
|
|
17279
|
+
if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 && ua.indexOf('/' + data + '-') > -1) {
|
|
17280
|
+
os = trim(os.replace(data, ''));
|
|
17281
|
+
}
|
|
17282
|
+
// Ensure OS does not include the browser name.
|
|
17283
|
+
if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
|
|
17284
|
+
os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
|
|
17285
|
+
}
|
|
17286
|
+
// Add layout engine.
|
|
17287
|
+
if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (/Browser|Lunascape|Maxthon/.test(name) || name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
|
|
17288
|
+
// Don't add layout details to description if they are falsey.
|
|
17289
|
+
(data = layout[layout.length - 1]) && description.push(data);
|
|
17290
|
+
}
|
|
17291
|
+
// Combine contextual information.
|
|
17292
|
+
if (description.length) {
|
|
17293
|
+
description = ['(' + description.join('; ') + ')'];
|
|
17294
|
+
}
|
|
17295
|
+
// Append manufacturer to description.
|
|
17296
|
+
if (manufacturer && product && product.indexOf(manufacturer) < 0) {
|
|
17297
|
+
description.push('on ' + manufacturer);
|
|
17298
|
+
}
|
|
17299
|
+
// Append product to description.
|
|
17300
|
+
if (product) {
|
|
17301
|
+
description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
|
|
17302
|
+
}
|
|
17303
|
+
// Parse the OS into an object.
|
|
17304
|
+
if (os) {
|
|
17305
|
+
data = / ([\d.+]+)$/.exec(os);
|
|
17306
|
+
isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
|
|
17307
|
+
os = {
|
|
17308
|
+
'architecture': 32,
|
|
17309
|
+
'family': data && !isSpecialCasedOS ? os.replace(data[0], '') : os,
|
|
17310
|
+
'version': data ? data[1] : null,
|
|
17311
|
+
'toString': function toString() {
|
|
17312
|
+
var version = this.version;
|
|
17313
|
+
return this.family + (version && !isSpecialCasedOS ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
|
|
17314
|
+
}
|
|
17315
|
+
};
|
|
17316
|
+
}
|
|
17317
|
+
// Add browser/OS architecture.
|
|
17318
|
+
if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
|
|
17319
|
+
if (os) {
|
|
17320
|
+
os.architecture = 64;
|
|
17321
|
+
os.family = os.family.replace(RegExp(' *' + data), '');
|
|
17322
|
+
}
|
|
17323
|
+
if (name && (/\bWOW64\b/i.test(ua) || useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) {
|
|
17324
|
+
description.unshift('32-bit');
|
|
17325
|
+
}
|
|
17326
|
+
}
|
|
17327
|
+
// Chrome 39 and above on OS X is always 64-bit.
|
|
17328
|
+
else if (os && /^OS X/.test(os.family) && name == 'Chrome' && parseFloat(version) >= 39) {
|
|
17329
|
+
os.architecture = 64;
|
|
17330
|
+
}
|
|
17331
|
+
ua || (ua = null);
|
|
17332
|
+
|
|
17333
|
+
/*------------------------------------------------------------------------*/
|
|
17334
|
+
|
|
17335
|
+
/**
|
|
17336
|
+
* The platform object.
|
|
17337
|
+
*
|
|
17338
|
+
* @name platform
|
|
17339
|
+
* @type Object
|
|
17340
|
+
*/
|
|
17341
|
+
var platform = {};
|
|
17342
|
+
|
|
17343
|
+
/**
|
|
17344
|
+
* The platform description.
|
|
17345
|
+
*
|
|
17346
|
+
* @memberOf platform
|
|
17347
|
+
* @type string|null
|
|
17348
|
+
*/
|
|
17349
|
+
platform.description = ua;
|
|
17350
|
+
|
|
17351
|
+
/**
|
|
17352
|
+
* The name of the browser's layout engine.
|
|
17353
|
+
*
|
|
17354
|
+
* The list of common layout engines include:
|
|
17355
|
+
* "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
|
|
17356
|
+
*
|
|
17357
|
+
* @memberOf platform
|
|
17358
|
+
* @type string|null
|
|
17359
|
+
*/
|
|
17360
|
+
platform.layout = layout && layout[0];
|
|
17361
|
+
|
|
17362
|
+
/**
|
|
17363
|
+
* The name of the product's manufacturer.
|
|
17364
|
+
*
|
|
17365
|
+
* The list of manufacturers include:
|
|
17366
|
+
* "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
|
|
17367
|
+
* "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
|
|
17368
|
+
* "Nokia", "Samsung" and "Sony"
|
|
17369
|
+
*
|
|
17370
|
+
* @memberOf platform
|
|
17371
|
+
* @type string|null
|
|
17372
|
+
*/
|
|
17373
|
+
platform.manufacturer = manufacturer;
|
|
17374
|
+
|
|
17375
|
+
/**
|
|
17376
|
+
* The name of the browser/environment.
|
|
17377
|
+
*
|
|
17378
|
+
* The list of common browser names include:
|
|
17379
|
+
* "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
|
|
17380
|
+
* "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
|
|
17381
|
+
* "Opera Mini" and "Opera"
|
|
17382
|
+
*
|
|
17383
|
+
* Mobile versions of some browsers have "Mobile" appended to their name:
|
|
17384
|
+
* eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
|
|
17385
|
+
*
|
|
17386
|
+
* @memberOf platform
|
|
17387
|
+
* @type string|null
|
|
17388
|
+
*/
|
|
17389
|
+
platform.name = name;
|
|
17390
|
+
|
|
17391
|
+
/**
|
|
17392
|
+
* The alpha/beta release indicator.
|
|
17393
|
+
*
|
|
17394
|
+
* @memberOf platform
|
|
17395
|
+
* @type string|null
|
|
17396
|
+
*/
|
|
17397
|
+
platform.prerelease = prerelease;
|
|
17398
|
+
|
|
17399
|
+
/**
|
|
17400
|
+
* The name of the product hosting the browser.
|
|
17401
|
+
*
|
|
17402
|
+
* The list of common products include:
|
|
17403
|
+
*
|
|
17404
|
+
* "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
|
|
17405
|
+
* "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
|
|
17406
|
+
*
|
|
17407
|
+
* @memberOf platform
|
|
17408
|
+
* @type string|null
|
|
17409
|
+
*/
|
|
17410
|
+
platform.product = product;
|
|
17411
|
+
|
|
17412
|
+
/**
|
|
17413
|
+
* The browser's user agent string.
|
|
17414
|
+
*
|
|
17415
|
+
* @memberOf platform
|
|
17416
|
+
* @type string|null
|
|
17417
|
+
*/
|
|
17418
|
+
platform.ua = ua;
|
|
17419
|
+
|
|
17420
|
+
/**
|
|
17421
|
+
* The browser/environment version.
|
|
17422
|
+
*
|
|
17423
|
+
* @memberOf platform
|
|
17424
|
+
* @type string|null
|
|
17425
|
+
*/
|
|
17426
|
+
platform.version = name && version;
|
|
17427
|
+
|
|
17428
|
+
/**
|
|
17429
|
+
* The name of the operating system.
|
|
17430
|
+
*
|
|
17431
|
+
* @memberOf platform
|
|
17432
|
+
* @type Object
|
|
17433
|
+
*/
|
|
17434
|
+
platform.os = os || {
|
|
17435
|
+
/**
|
|
17436
|
+
* The CPU architecture the OS is built for.
|
|
17437
|
+
*
|
|
17438
|
+
* @memberOf platform.os
|
|
17439
|
+
* @type number|null
|
|
17440
|
+
*/
|
|
17441
|
+
'architecture': null,
|
|
17442
|
+
/**
|
|
17443
|
+
* The family of the OS.
|
|
17444
|
+
*
|
|
17445
|
+
* Common values include:
|
|
17446
|
+
* "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
|
|
17447
|
+
* "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
|
|
17448
|
+
* "SuSE", "Android", "iOS" and "Windows Phone"
|
|
17449
|
+
*
|
|
17450
|
+
* @memberOf platform.os
|
|
17451
|
+
* @type string|null
|
|
17452
|
+
*/
|
|
17453
|
+
'family': null,
|
|
17454
|
+
/**
|
|
17455
|
+
* The version of the OS.
|
|
17456
|
+
*
|
|
17457
|
+
* @memberOf platform.os
|
|
17458
|
+
* @type string|null
|
|
17459
|
+
*/
|
|
17460
|
+
'version': null,
|
|
17461
|
+
/**
|
|
17462
|
+
* Returns the OS string.
|
|
17463
|
+
*
|
|
17464
|
+
* @memberOf platform.os
|
|
17465
|
+
* @returns {string} The OS string.
|
|
17466
|
+
*/
|
|
17467
|
+
'toString': function toString() {
|
|
17468
|
+
return 'null';
|
|
17469
|
+
}
|
|
17470
|
+
};
|
|
17471
|
+
platform.parse = parse;
|
|
17472
|
+
platform.toString = toStringPlatform;
|
|
17473
|
+
if (platform.version) {
|
|
17474
|
+
description.unshift(version);
|
|
17475
|
+
}
|
|
17476
|
+
if (platform.name) {
|
|
17477
|
+
description.unshift(name);
|
|
17478
|
+
}
|
|
17479
|
+
if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
|
|
17480
|
+
description.push(product ? '(' + os + ')' : 'on ' + os);
|
|
17481
|
+
}
|
|
17482
|
+
if (description.length) {
|
|
17483
|
+
platform.description = description.join(' ');
|
|
17484
|
+
}
|
|
17485
|
+
return platform;
|
|
17486
|
+
}
|
|
17487
|
+
|
|
17488
|
+
/*--------------------------------------------------------------------------*/
|
|
17489
|
+
|
|
17490
|
+
// Export platform.
|
|
17491
|
+
var platform = parse();
|
|
17492
|
+
|
|
17493
|
+
// Some AMD build optimizers, like r.js, check for condition patterns like the following:
|
|
17494
|
+
if (freeExports && freeModule) {
|
|
17495
|
+
// Export for CommonJS support.
|
|
17496
|
+
forOwn(platform, function (value, key) {
|
|
17497
|
+
freeExports[key] = value;
|
|
17498
|
+
});
|
|
17499
|
+
} else {
|
|
17500
|
+
// Export to the global object.
|
|
17501
|
+
root.platform = platform;
|
|
17502
|
+
}
|
|
17503
|
+
}).call(commonjsGlobal);
|
|
17504
|
+
})(platform$1, platform$1.exports);
|
|
17505
|
+
var platformExports = platform$1.exports;
|
|
17506
|
+
var platform = /*@__PURE__*/getDefaultExportFromCjs(platformExports);
|
|
17507
|
+
|
|
17508
|
+
var isMultipleHotkey = Array.isArray;
|
|
17509
|
+
var replaceKeys = function replaceKeys(hotkey, keyName, replaceWith) {
|
|
17510
|
+
return isMultipleHotkey(hotkey) ? hotkey.map(function (item) {
|
|
17511
|
+
return item.replaceAll(keyName, replaceWith);
|
|
17512
|
+
}) : hotkey.replaceAll(keyName, replaceWith);
|
|
17513
|
+
};
|
|
17514
|
+
var convertHotKeyToWindows = function convertHotKeyToWindows(hotkey) {
|
|
17515
|
+
ramda.toPairs(MAC_TO_WINDOWS_KEYS_MAP).forEach(function (_ref) {
|
|
17516
|
+
var _ref2 = _slicedToArray$1(_ref, 2),
|
|
17517
|
+
macKey = _ref2[0],
|
|
17518
|
+
windowsKey = _ref2[1];
|
|
17519
|
+
hotkey = replaceKeys(hotkey, macKey, windowsKey);
|
|
17520
|
+
});
|
|
17521
|
+
return hotkey;
|
|
17522
|
+
};
|
|
17523
|
+
var convertHotkeyToUsersPlatform = function convertHotkeyToUsersPlatform(hotkey) {
|
|
17524
|
+
var _platformInfo$os;
|
|
17525
|
+
var platformInfo = platform.parse(navigator.userAgent);
|
|
17526
|
+
var isOSX = (_platformInfo$os = platformInfo.os) === null || _platformInfo$os === void 0 || (_platformInfo$os = _platformInfo$os.family) === null || _platformInfo$os === void 0 ? void 0 : _platformInfo$os.includes(OS.mac);
|
|
17527
|
+
if (isOSX) return replaceKeys(hotkey, KEY_NAMES["delete"], KEY_NAMES.backspace);
|
|
17528
|
+
return convertHotKeyToWindows(hotkey);
|
|
17529
|
+
};
|
|
17530
|
+
var bindHotKey = function bindHotKey(_ref3) {
|
|
17531
|
+
var mode = _ref3.mode,
|
|
17532
|
+
hotkey = _ref3.hotkey,
|
|
17533
|
+
handler = _ref3.handler,
|
|
17534
|
+
ref = _ref3.ref;
|
|
17535
|
+
var mousetrapInstance;
|
|
17536
|
+
switch (mode) {
|
|
17537
|
+
case MODES.global:
|
|
17538
|
+
Mousetrap$1.bindGlobal(hotkey, handler);
|
|
17539
|
+
break;
|
|
17540
|
+
case MODES.scoped:
|
|
17541
|
+
mousetrapInstance = Mousetrap$1(ref.current).bind(hotkey, handler);
|
|
17542
|
+
break;
|
|
17543
|
+
default:
|
|
17544
|
+
mousetrapInstance = Mousetrap$1.bind(hotkey, handler);
|
|
17545
|
+
}
|
|
17546
|
+
return mousetrapInstance;
|
|
17547
|
+
};
|
|
17548
|
+
var unBindHotKey = function unBindHotKey(_ref4) {
|
|
17549
|
+
var mousetrapInstance = _ref4.mousetrapInstance,
|
|
17550
|
+
mode = _ref4.mode,
|
|
17551
|
+
hotkey = _ref4.hotkey;
|
|
17552
|
+
return mode === MODES.global ? Mousetrap$1.unbindGlobal(hotkey) : mousetrapInstance === null || mousetrapInstance === void 0 ? void 0 : mousetrapInstance.unbind(hotkey);
|
|
17553
|
+
};
|
|
17554
|
+
|
|
17555
|
+
var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
|
|
17556
|
+
var ref = React.useRef(null);
|
|
17557
|
+
var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
|
|
17558
|
+
var config = ramda.mergeLeft(userConfig, DEFAULT_CONFIG);
|
|
17559
|
+
if (!handler) {
|
|
17560
|
+
throw new Error("You must provide a handler function to useHotKeys");
|
|
17561
|
+
}
|
|
17562
|
+
React.useEffect(function () {
|
|
17563
|
+
if (!config.enabled) return undefined;
|
|
17564
|
+
var mousetrapInstance = bindHotKey({
|
|
17565
|
+
mode: config.mode,
|
|
17566
|
+
hotkey: convertedHotkey,
|
|
17567
|
+
handler: handler,
|
|
17568
|
+
ref: ref
|
|
17569
|
+
});
|
|
15840
17570
|
return function () {
|
|
15841
|
-
|
|
17571
|
+
unBindHotKey({
|
|
17572
|
+
mousetrapInstance: mousetrapInstance,
|
|
17573
|
+
mode: config.mode,
|
|
17574
|
+
hotkey: convertedHotkey
|
|
17575
|
+
});
|
|
15842
17576
|
};
|
|
15843
|
-
}, [
|
|
15844
|
-
return ref;
|
|
15845
|
-
}
|
|
17577
|
+
}, [handler, config.mode, convertedHotkey, config]);
|
|
17578
|
+
return config.mode === MODES.scoped ? ref : null;
|
|
17579
|
+
};
|
|
15846
17580
|
|
|
15847
17581
|
function _classCallCheck$1(instance, Constructor) {
|
|
15848
17582
|
if (!(instance instanceof Constructor)) {
|
|
@@ -15946,7 +17680,7 @@ var manager = new OverlayManager();
|
|
|
15946
17680
|
var dayjs_min = {exports: {}};
|
|
15947
17681
|
|
|
15948
17682
|
(function (module, exports) {
|
|
15949
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
17683
|
+
!function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
15950
17684
|
} (dayjs_min));
|
|
15951
17685
|
|
|
15952
17686
|
var dayjs = dayjs_min.exports;
|
|
@@ -15954,7 +17688,7 @@ var dayjs = dayjs_min.exports;
|
|
|
15954
17688
|
var localeData$1 = {exports: {}};
|
|
15955
17689
|
|
|
15956
17690
|
(function (module, exports) {
|
|
15957
|
-
!function(n,e){module.exports=e();}(commonjsGlobal,(function(){return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.slice(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return {months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return {firstDayOfWeek:function(){return n.weekStart||0},weekdays:function(){return t.weekdays()},weekdaysShort:function(){return t.weekdaysShort()},weekdaysMin:function(){return t.weekdaysMin()},months:function(){return t.months()},monthsShort:function(){return t.monthsShort()},longDateFormat:function(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)};}}));
|
|
17691
|
+
!function(n,e){module.exports=e();}(commonjsGlobal$1,(function(){return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.slice(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return {months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return {firstDayOfWeek:function(){return n.weekStart||0},weekdays:function(){return t.weekdays()},weekdaysShort:function(){return t.weekdaysShort()},weekdaysMin:function(){return t.weekdaysMin()},months:function(){return t.months()},monthsShort:function(){return t.monthsShort()},longDateFormat:function(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)};}}));
|
|
15958
17692
|
} (localeData$1));
|
|
15959
17693
|
|
|
15960
17694
|
var localeData = localeData$1.exports;
|
|
@@ -15962,7 +17696,7 @@ var localeData = localeData$1.exports;
|
|
|
15962
17696
|
var utc$1 = {exports: {}};
|
|
15963
17697
|
|
|
15964
17698
|
(function (module, exports) {
|
|
15965
|
-
!function(t,i){module.exports=i();}(commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
|
|
17699
|
+
!function(t,i){module.exports=i();}(commonjsGlobal$1,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
|
|
15966
17700
|
} (utc$1));
|
|
15967
17701
|
|
|
15968
17702
|
var utc = utc$1.exports;
|
|
@@ -15970,7 +17704,7 @@ var utc = utc$1.exports;
|
|
|
15970
17704
|
var weekday$1 = {exports: {}};
|
|
15971
17705
|
|
|
15972
17706
|
(function (module, exports) {
|
|
15973
|
-
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i<t?i+7:i)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day")};}}));
|
|
17707
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i<t?i+7:i)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day")};}}));
|
|
15974
17708
|
} (weekday$1));
|
|
15975
17709
|
|
|
15976
17710
|
var weekday = weekday$1.exports;
|
|
@@ -15978,7 +17712,7 @@ var weekday = weekday$1.exports;
|
|
|
15978
17712
|
var weekOfYear$1 = {exports: {}};
|
|
15979
17713
|
|
|
15980
17714
|
(function (module, exports) {
|
|
15981
|
-
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)};}}));
|
|
17715
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)};}}));
|
|
15982
17716
|
} (weekOfYear$1));
|
|
15983
17717
|
|
|
15984
17718
|
var weekOfYear = weekOfYear$1.exports;
|
|
@@ -16634,14 +18368,13 @@ var useOverlay = function useOverlay(_ref) {
|
|
|
16634
18368
|
}
|
|
16635
18369
|
};
|
|
16636
18370
|
var focusRequiredElementInOverlay = function focusRequiredElementInOverlay() {
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
}
|
|
18371
|
+
var _initialFocusRef;
|
|
18372
|
+
if (!hasTransitionCompleted) return;
|
|
18373
|
+
if ((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current) {
|
|
18374
|
+
var _initialFocusRef2;
|
|
18375
|
+
(_initialFocusRef2 = initialFocusRef) === null || _initialFocusRef2 === void 0 || (_initialFocusRef2 = _initialFocusRef2.current) === null || _initialFocusRef2 === void 0 || _initialFocusRef2.focus();
|
|
18376
|
+
} else {
|
|
18377
|
+
focusFirstFocusableElement(overlayWrapper);
|
|
16645
18378
|
}
|
|
16646
18379
|
};
|
|
16647
18380
|
var handleOverlayClose = React.useCallback(function () {
|
|
@@ -16653,9 +18386,9 @@ var useOverlay = function useOverlay(_ref) {
|
|
|
16653
18386
|
var isTopOverlay = React.useSyncExternalStore(manager.subscribe, function () {
|
|
16654
18387
|
return manager.isTopOverlay(overlayWrapper);
|
|
16655
18388
|
});
|
|
16656
|
-
|
|
16657
|
-
closeOnEsc
|
|
16658
|
-
}
|
|
18389
|
+
useHotKeys("escape", handleOverlayClose, {
|
|
18390
|
+
enabled: closeOnEsc
|
|
18391
|
+
});
|
|
16659
18392
|
React.useEffect(function () {
|
|
16660
18393
|
var cleanUp = noop$1;
|
|
16661
18394
|
if (isOpen) {
|
|
@@ -16911,7 +18644,7 @@ var Modal = function Modal(_ref) {
|
|
|
16911
18644
|
closeOnOutsideClick = _ref$closeOnOutsideCl === void 0 ? true : _ref$closeOnOutsideCl,
|
|
16912
18645
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$t);
|
|
16913
18646
|
var _useState = React.useState(false),
|
|
16914
|
-
_useState2 = _slicedToArray$
|
|
18647
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
16915
18648
|
hasTransitionCompleted = _useState2[0],
|
|
16916
18649
|
setHasTransitionCompleted = _useState2[1];
|
|
16917
18650
|
var modalWrapper = React.useRef(null);
|
|
@@ -17560,7 +19293,7 @@ try {
|
|
|
17560
19293
|
}
|
|
17561
19294
|
|
|
17562
19295
|
function _arrayWithoutHoles$1(arr) {
|
|
17563
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
19296
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
|
|
17564
19297
|
}
|
|
17565
19298
|
|
|
17566
19299
|
function _iterableToArray$1(iter) {
|
|
@@ -17572,14 +19305,14 @@ function _nonIterableSpread$1() {
|
|
|
17572
19305
|
}
|
|
17573
19306
|
|
|
17574
19307
|
function _toConsumableArray$1(arr) {
|
|
17575
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$
|
|
19308
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$1();
|
|
17576
19309
|
}
|
|
17577
19310
|
|
|
17578
19311
|
var transformObjectToDotNotation = function transformObjectToDotNotation(object) {
|
|
17579
19312
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
17580
19313
|
var result = [];
|
|
17581
19314
|
Object.entries(object).forEach(function (_ref) {
|
|
17582
|
-
var _ref2 = _slicedToArray$
|
|
19315
|
+
var _ref2 = _slicedToArray$2(_ref, 2),
|
|
17583
19316
|
key = _ref2[0],
|
|
17584
19317
|
value = _ref2[1];
|
|
17585
19318
|
if (value) {
|
|
@@ -17799,7 +19532,7 @@ var Input$2 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
17799
19532
|
disableTrimOnBlur = _ref$disableTrimOnBlu === void 0 ? false : _ref$disableTrimOnBlu,
|
|
17800
19533
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$n);
|
|
17801
19534
|
var _useState = React.useState(otherProps.value),
|
|
17802
|
-
_useState2 = _slicedToArray$
|
|
19535
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
17803
19536
|
valueInternal = _useState2[0],
|
|
17804
19537
|
setValueInternal = _useState2[1];
|
|
17805
19538
|
var id = useId(otherProps.id);
|
|
@@ -24552,7 +26285,7 @@ var CreatableSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
24552
26285
|
});
|
|
24553
26286
|
|
|
24554
26287
|
function _toArray(arr) {
|
|
24555
|
-
return _arrayWithHoles$
|
|
26288
|
+
return _arrayWithHoles$2(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
|
|
24556
26289
|
}
|
|
24557
26290
|
|
|
24558
26291
|
var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -24794,11 +26527,11 @@ var MultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24794
26527
|
visibleEmailsCount = _ref$visibleEmailsCou === void 0 ? 3 : _ref$visibleEmailsCou,
|
|
24795
26528
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$f);
|
|
24796
26529
|
var _useState = React.useState(""),
|
|
24797
|
-
_useState2 = _slicedToArray$
|
|
26530
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
24798
26531
|
inputValue = _useState2[0],
|
|
24799
26532
|
setInputValue = _useState2[1];
|
|
24800
26533
|
var _useState3 = React.useState(false),
|
|
24801
|
-
_useState4 = _slicedToArray$
|
|
26534
|
+
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
24802
26535
|
isFocused = _useState4[0],
|
|
24803
26536
|
setIsFocused = _useState4[1];
|
|
24804
26537
|
var isCounterVisible = !!counter && (!counter.startsFrom || getValidEmailsCount(value) >= counter.startsFrom);
|
|
@@ -24869,10 +26602,9 @@ var MultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24869
26602
|
required: required,
|
|
24870
26603
|
className: "neeto-ui-email-input__label",
|
|
24871
26604
|
"data-cy": "".concat(hyphenize(label), "-input-label")
|
|
24872
|
-
}, labelProps), label), isCounterVisible && /*#__PURE__*/React__default["default"].createElement(
|
|
26605
|
+
}, labelProps), label), isCounterVisible && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
24873
26606
|
className: "neeto-ui-email-input__counter",
|
|
24874
|
-
"data-cy": "".concat(hyphenize(label), "-email-counter")
|
|
24875
|
-
style: "body2"
|
|
26607
|
+
"data-cy": "".concat(hyphenize(label), "-email-counter")
|
|
24876
26608
|
}, getValidEmailsCount(value), " ", counter.label ? counter.label : renderDefaultText(getValidEmailsCount(value)))), /*#__PURE__*/React__default["default"].createElement(CreatableSelect, _extends$2({
|
|
24877
26609
|
isMulti: true,
|
|
24878
26610
|
required: true,
|
|
@@ -24906,20 +26638,15 @@ var MultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24906
26638
|
visibleEmailsCount: visibleEmailsCount
|
|
24907
26639
|
}, !isOptionsPresent && {
|
|
24908
26640
|
menuIsOpen: false
|
|
24909
|
-
}), otherProps), overrideProps))), !!error && /*#__PURE__*/React__default["default"].createElement(
|
|
26641
|
+
}), otherProps), overrideProps))), !!error && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
24910
26642
|
className: "neeto-ui-input__error",
|
|
24911
|
-
"data-cy": "".concat(hyphenize(label), "-input-error")
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
className: "cursor-pointer",
|
|
24915
|
-
component: "span",
|
|
24916
|
-
style: "body3",
|
|
24917
|
-
weight: "semibold",
|
|
26643
|
+
"data-cy": "".concat(hyphenize(label), "-input-error")
|
|
26644
|
+
}, error, isFilterEmailsLinkVisible && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
26645
|
+
className: "neeto-ui-font-semibold cursor-pointer",
|
|
24918
26646
|
onClick: handleFilterEmails
|
|
24919
|
-
}, "\xA0", filterInvalidEmails.label ? filterInvalidEmails.label : "Click here to remove invalid emails.")), !!helpText && /*#__PURE__*/React__default["default"].createElement(
|
|
26647
|
+
}, "\xA0", filterInvalidEmails.label ? filterInvalidEmails.label : "Click here to remove invalid emails.")), !!helpText && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
24920
26648
|
className: "neeto-ui-input__help-text",
|
|
24921
|
-
"data-cy": "".concat(hyphenize(label), "-input-help")
|
|
24922
|
-
style: "body3"
|
|
26649
|
+
"data-cy": "".concat(hyphenize(label), "-input-help")
|
|
24923
26650
|
}, helpText));
|
|
24924
26651
|
});
|
|
24925
26652
|
MultiEmailInput.displayName = "MultiEmailInput";
|
|
@@ -24929,7 +26656,7 @@ var FormikMultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24929
26656
|
var name = _ref.name,
|
|
24930
26657
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$e);
|
|
24931
26658
|
var _useField = formik.useField(name),
|
|
24932
|
-
_useField2 = _slicedToArray$
|
|
26659
|
+
_useField2 = _slicedToArray$2(_useField, 3),
|
|
24933
26660
|
field = _useField2[0],
|
|
24934
26661
|
meta = _useField2[1],
|
|
24935
26662
|
_useField2$ = _useField2[2],
|
|
@@ -24994,7 +26721,7 @@ var Radio = function Radio(_ref) {
|
|
|
24994
26721
|
labelProps = _ref.labelProps,
|
|
24995
26722
|
props = _objectWithoutProperties$1(_ref, _excluded$c);
|
|
24996
26723
|
var _useState = React.useState(""),
|
|
24997
|
-
_useState2 = _slicedToArray$
|
|
26724
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
24998
26725
|
internalValue = _useState2[0],
|
|
24999
26726
|
setInternalValue = _useState2[1];
|
|
25000
26727
|
var id = useId(props.id);
|
|
@@ -25038,7 +26765,7 @@ var RadioGroup = function RadioGroup(_ref) {
|
|
|
25038
26765
|
var _useField = formik.useField({
|
|
25039
26766
|
name: name
|
|
25040
26767
|
}),
|
|
25041
|
-
_useField2 = _slicedToArray$
|
|
26768
|
+
_useField2 = _slicedToArray$2(_useField, 2),
|
|
25042
26769
|
field = _useField2[0],
|
|
25043
26770
|
meta = _useField2[1];
|
|
25044
26771
|
return /*#__PURE__*/React__default["default"].createElement(Radio, _extends$2({
|
|
@@ -25489,7 +27216,7 @@ var SelectField = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25489
27216
|
isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
|
|
25490
27217
|
otherProps = _objectWithoutProperties$1(props, _excluded$8);
|
|
25491
27218
|
var _useField = formik.useField(name),
|
|
25492
|
-
_useField2 = _slicedToArray$
|
|
27219
|
+
_useField2 = _slicedToArray$2(_useField, 3),
|
|
25493
27220
|
field = _useField2[0],
|
|
25494
27221
|
meta = _useField2[1],
|
|
25495
27222
|
_useField2$ = _useField2[2],
|
|
@@ -25503,7 +27230,7 @@ var SelectField = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25503
27230
|
return getOptionValue(option);
|
|
25504
27231
|
};
|
|
25505
27232
|
var buildValueObj = function buildValueObj(value, options) {
|
|
25506
|
-
if (_typeof$
|
|
27233
|
+
if (_typeof$3(value) === "object") return value;
|
|
25507
27234
|
return options.filter(function (option) {
|
|
25508
27235
|
return getRealOptionValue(option) === value;
|
|
25509
27236
|
})[0];
|
|
@@ -25619,16 +27346,14 @@ var Slider = function Slider(_ref) {
|
|
|
25619
27346
|
value: value
|
|
25620
27347
|
}, otherProps), {}, {
|
|
25621
27348
|
id: id
|
|
25622
|
-
}))), !!error && /*#__PURE__*/React__default["default"].createElement(
|
|
27349
|
+
}))), !!error && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
25623
27350
|
className: "neeto-ui-input__error",
|
|
25624
27351
|
"data-cy": "".concat(hyphenize(label), "-input-error"),
|
|
25625
|
-
id: errorId
|
|
25626
|
-
|
|
25627
|
-
}, error), helpText && /*#__PURE__*/React__default["default"].createElement(Typography, {
|
|
27352
|
+
id: errorId
|
|
27353
|
+
}, error), helpText && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
25628
27354
|
className: "neeto-ui-input__help-text",
|
|
25629
27355
|
"data-cy": "".concat(hyphenize(label), "-input-help"),
|
|
25630
|
-
id: helpTextId
|
|
25631
|
-
style: "body3"
|
|
27356
|
+
id: helpTextId
|
|
25632
27357
|
}, helpText)));
|
|
25633
27358
|
};
|
|
25634
27359
|
|
|
@@ -25637,7 +27362,7 @@ var FormikSlider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25637
27362
|
var name = _ref.name,
|
|
25638
27363
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$6);
|
|
25639
27364
|
var _useField = formik.useField(name),
|
|
25640
|
-
_useField2 = _slicedToArray$
|
|
27365
|
+
_useField2 = _slicedToArray$2(_useField, 3),
|
|
25641
27366
|
field = _useField2[0],
|
|
25642
27367
|
meta = _useField2[1],
|
|
25643
27368
|
_useField2$ = _useField2[2],
|
|
@@ -25769,7 +27494,7 @@ var Textarea = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25769
27494
|
labelProps = _ref.labelProps,
|
|
25770
27495
|
otherProps = _objectWithoutProperties$1(_ref, _excluded$3);
|
|
25771
27496
|
var _useState = React.useState(""),
|
|
25772
|
-
_useState2 = _slicedToArray$
|
|
27497
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
25773
27498
|
valueInternal = _useState2[0],
|
|
25774
27499
|
setValueInternal = _useState2[1];
|
|
25775
27500
|
var value = (_ref2 = (_otherProps$value = otherProps.value) !== null && _otherProps$value !== void 0 ? _otherProps$value : valueInternal) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
@@ -25903,24 +27628,25 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25903
27628
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
25904
27629
|
className: "neeto-ui-input__wrapper"
|
|
25905
27630
|
}, label && /*#__PURE__*/React__default["default"].createElement(Label, {
|
|
25906
|
-
|
|
25907
|
-
|
|
27631
|
+
required: required,
|
|
27632
|
+
"data-testid": "treeselect-label"
|
|
25908
27633
|
}, label), /*#__PURE__*/React__default["default"].createElement(_TreeSelect__default["default"], _extends$2({
|
|
25909
27634
|
allowClear: allowClear,
|
|
25910
|
-
"data-cy": "neeto-ui-tree-select-wrapper",
|
|
25911
27635
|
disabled: disabled,
|
|
25912
|
-
dropdownStyle: {
|
|
25913
|
-
zIndex: 100000
|
|
25914
|
-
},
|
|
25915
27636
|
fieldNames: fieldNames,
|
|
27637
|
+
onChange: onChange,
|
|
25916
27638
|
placeholder: placeholder,
|
|
25917
|
-
popupClassName: "neeto-ui-tree-select-dropdown",
|
|
25918
27639
|
ref: ref,
|
|
25919
27640
|
showSearch: showSearch,
|
|
25920
27641
|
size: size,
|
|
25921
|
-
suffixIcon: /*#__PURE__*/React__default["default"].createElement(SuffixIcon, null),
|
|
25922
27642
|
treeData: treeData,
|
|
25923
27643
|
treeDataSimpleMode: treeDataSimpleMode,
|
|
27644
|
+
"data-cy": "neeto-ui-tree-select-wrapper",
|
|
27645
|
+
dropdownStyle: {
|
|
27646
|
+
zIndex: 100000
|
|
27647
|
+
},
|
|
27648
|
+
popupClassName: "neeto-ui-tree-select-dropdown",
|
|
27649
|
+
suffixIcon: /*#__PURE__*/React__default["default"].createElement(SuffixIcon, null),
|
|
25924
27650
|
treeNodeFilterProp: (_fieldNames$label = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) !== null && _fieldNames$label !== void 0 ? _fieldNames$label : "label",
|
|
25925
27651
|
value: value || undefined,
|
|
25926
27652
|
className: classnames$1("neeto-ui-tree-select__wrapper", className, {
|
|
@@ -25934,12 +27660,10 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25934
27660
|
}, "No options"),
|
|
25935
27661
|
switcherIcon: function switcherIcon(props) {
|
|
25936
27662
|
return /*#__PURE__*/React__default["default"].createElement("div", props, /*#__PURE__*/React__default["default"].createElement(SwitcherIcon, null));
|
|
25937
|
-
}
|
|
25938
|
-
|
|
25939
|
-
}, otherProps)), error && /*#__PURE__*/React__default["default"].createElement(Typography, {
|
|
27663
|
+
}
|
|
27664
|
+
}, otherProps)), error && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
25940
27665
|
className: "neeto-ui-input__error",
|
|
25941
|
-
"data-testid": "treeselect-error"
|
|
25942
|
-
style: "body3"
|
|
27666
|
+
"data-testid": "treeselect-error"
|
|
25943
27667
|
}, error)));
|
|
25944
27668
|
});
|
|
25945
27669
|
TreeSelect.displayName = "TreeSelect";
|
|
@@ -25949,7 +27673,7 @@ var FormikTreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25949
27673
|
var name = _ref.name,
|
|
25950
27674
|
otherProps = _objectWithoutProperties$1(_ref, _excluded);
|
|
25951
27675
|
var _useField = formik.useField(name),
|
|
25952
|
-
_useField2 = _slicedToArray$
|
|
27676
|
+
_useField2 = _slicedToArray$2(_useField, 3),
|
|
25953
27677
|
field = _useField2[0],
|
|
25954
27678
|
meta = _useField2[1],
|
|
25955
27679
|
_useField2$ = _useField2[2],
|