@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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { createContext, useLayoutEffect, useEffect, useContext, useRef, useInsertionEffect as useInsertionEffect$1, useCallback, useMemo, forwardRef as forwardRef$1, createElement, useId as useId$1, useState, cloneElement, Children, isValidElement, useSyncExternalStore, Fragment, Component, startTransition } from 'react';
3
3
  import { useFormikContext, Field, Form as Form$1, Formik, useField } from 'formik';
4
- import { isEmpty, equals, is, replace as replace$1, assoc, pluck, mergeLeft, prop, flatten, either, isNil } from 'ramda';
4
+ import { isEmpty, equals, mergeLeft, toPairs, is, replace as replace$1, assoc, pluck, prop, flatten, either, isNil } from 'ramda';
5
5
  import { Link, useHistory } from 'react-router-dom';
6
6
  import ReactDOM, { createPortal } from 'react-dom';
7
7
  import { Close, Info, Down, Check } from '@bigbinary/neeto-icons';
@@ -25,7 +25,7 @@ function _extends$2() {
25
25
  return _extends$2.apply(this, arguments);
26
26
  }
27
27
 
28
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
28
+ var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
29
29
 
30
30
  var classnames$2 = {exports: {}};
31
31
 
@@ -81,22 +81,22 @@ var classnames$2 = {exports: {}};
81
81
 
82
82
  var classnames$1 = classnames$2.exports;
83
83
 
84
- function _typeof$2(obj) {
84
+ function _typeof$3(obj) {
85
85
  "@babel/helpers - typeof";
86
86
 
87
- return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
87
+ return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
88
88
  return typeof obj;
89
89
  } : function (obj) {
90
90
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
91
- }, _typeof$2(obj);
91
+ }, _typeof$3(obj);
92
92
  }
93
93
 
94
94
  function _toPrimitive(input, hint) {
95
- if (_typeof$2(input) !== "object" || input === null) return input;
95
+ if (_typeof$3(input) !== "object" || input === null) return input;
96
96
  var prim = input[Symbol.toPrimitive];
97
97
  if (prim !== undefined) {
98
98
  var res = prim.call(input, hint || "default");
99
- if (_typeof$2(res) !== "object") return res;
99
+ if (_typeof$3(res) !== "object") return res;
100
100
  throw new TypeError("@@toPrimitive must return a primitive value.");
101
101
  }
102
102
  return (hint === "string" ? String : Number)(input);
@@ -104,7 +104,7 @@ function _toPrimitive(input, hint) {
104
104
 
105
105
  function _toPropertyKey(arg) {
106
106
  var key = _toPrimitive(arg, "string");
107
- return _typeof$2(key) === "symbol" ? key : String(key);
107
+ return _typeof$3(key) === "symbol" ? key : String(key);
108
108
  }
109
109
 
110
110
  function _defineProperty$1(obj, key, value) {
@@ -3646,7 +3646,7 @@ function applyDefaultFilter(v) {
3646
3646
  return name + "(" + defaultValue + unit + ")";
3647
3647
  }
3648
3648
  const functionRegex = /([a-z-]*)\(.*?\)/g;
3649
- const filter$1 = {
3649
+ const filter = {
3650
3650
  ...complex,
3651
3651
  getAnimatableNone: (v) => {
3652
3652
  const functions = v.match(functionRegex);
@@ -3671,8 +3671,8 @@ const defaultValueTypes = {
3671
3671
  borderRightColor: color,
3672
3672
  borderBottomColor: color,
3673
3673
  borderLeftColor: color,
3674
- filter: filter$1,
3675
- WebkitFilter: filter$1,
3674
+ filter,
3675
+ WebkitFilter: filter,
3676
3676
  };
3677
3677
  /**
3678
3678
  * Gets the default ValueType for the provided value key
@@ -3681,7 +3681,7 @@ const getDefaultValueType = (key) => defaultValueTypes[key];
3681
3681
 
3682
3682
  function getAnimatableNone(key, value) {
3683
3683
  let defaultValueType = getDefaultValueType(key);
3684
- if (defaultValueType !== filter$1)
3684
+ if (defaultValueType !== filter)
3685
3685
  defaultValueType = complex;
3686
3686
  // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
3687
3687
  return defaultValueType.getAnimatableNone
@@ -9398,11 +9398,11 @@ Spinner$1.defaultProps = {
9398
9398
  size: 14
9399
9399
  };
9400
9400
 
9401
- function _arrayWithHoles$1(arr) {
9401
+ function _arrayWithHoles$2(arr) {
9402
9402
  if (Array.isArray(arr)) return arr;
9403
9403
  }
9404
9404
 
9405
- function _iterableToArrayLimit$1(arr, i) {
9405
+ function _iterableToArrayLimit$2(arr, i) {
9406
9406
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
9407
9407
  if (null != _i) {
9408
9408
  var _s,
@@ -9430,27 +9430,27 @@ function _iterableToArrayLimit$1(arr, i) {
9430
9430
  }
9431
9431
  }
9432
9432
 
9433
- function _arrayLikeToArray$1(arr, len) {
9433
+ function _arrayLikeToArray$2(arr, len) {
9434
9434
  if (len == null || len > arr.length) len = arr.length;
9435
9435
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
9436
9436
  return arr2;
9437
9437
  }
9438
9438
 
9439
- function _unsupportedIterableToArray$1(o, minLen) {
9439
+ function _unsupportedIterableToArray$2(o, minLen) {
9440
9440
  if (!o) return;
9441
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
9441
+ if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
9442
9442
  var n = Object.prototype.toString.call(o).slice(8, -1);
9443
9443
  if (n === "Object" && o.constructor) n = o.constructor.name;
9444
9444
  if (n === "Map" || n === "Set") return Array.from(o);
9445
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
9445
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
9446
9446
  }
9447
9447
 
9448
- function _nonIterableRest$1() {
9448
+ function _nonIterableRest$2() {
9449
9449
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9450
9450
  }
9451
9451
 
9452
- function _slicedToArray$1(arr, i) {
9453
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
9452
+ function _slicedToArray$2(arr, i) {
9453
+ return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
9454
9454
  }
9455
9455
 
9456
9456
  var top = 'top';
@@ -13327,7 +13327,7 @@ var Tooltip = function Tooltip(_ref) {
13327
13327
  hideOnTargetExit = _ref$hideOnTargetExit === void 0 ? false : _ref$hideOnTargetExit,
13328
13328
  otherProps = _objectWithoutProperties$1(_ref, _excluded$x);
13329
13329
  var _useState = useState(null),
13330
- _useState2 = _slicedToArray$1(_useState, 2),
13330
+ _useState2 = _slicedToArray$2(_useState, 2),
13331
13331
  instance = _useState2[0],
13332
13332
  setInstance = _useState2[1];
13333
13333
  var localProps = {};
@@ -15087,7 +15087,7 @@ var useNavPrompt = function useNavPrompt(_ref) {
15087
15087
  var _ref$shouldBlock = _ref.shouldBlock,
15088
15088
  shouldBlock = _ref$shouldBlock === void 0 ? true : _ref$shouldBlock;
15089
15089
  var _useState = useState(false),
15090
- _useState2 = _slicedToArray$1(_useState, 2),
15090
+ _useState2 = _slicedToArray$2(_useState, 2),
15091
15091
  isBlocked = _useState2[0],
15092
15092
  setIsBlocked = _useState2[1];
15093
15093
  var history = useHistory();
@@ -15172,647 +15172,2381 @@ var useOnClickOutside = function useOnClickOutside(insideRef, outsideRef, handle
15172
15172
  }, [insideRef, outsideRef, handler]);
15173
15173
  };
15174
15174
 
15175
- /*!
15176
- * hotkeys-js v3.8.7
15177
- * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
15178
- *
15179
- * Copyright (c) 2021 kenny wong <wowohoo@qq.com>
15180
- * http://jaywcjlove.github.io/hotkeys
15181
- *
15182
- * Licensed under the MIT license.
15183
- */
15184
-
15185
- var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
15186
-
15187
- function addEvent(object, event, method) {
15188
- if (object.addEventListener) {
15189
- object.addEventListener(event, method, false);
15190
- } else if (object.attachEvent) {
15191
- object.attachEvent("on".concat(event), function () {
15192
- method(window.event);
15193
- });
15194
- }
15195
- } // 修饰键转换成对应的键码
15196
-
15175
+ var MODES = {
15176
+ "default": "default",
15177
+ global: "global",
15178
+ scoped: "scoped"
15179
+ };
15180
+ var DEFAULT_CONFIG = {
15181
+ mode: MODES["default"],
15182
+ unbindOnUnmount: true,
15183
+ enabled: true
15184
+ };
15185
+ var MAC_TO_WINDOWS_KEYS_MAP = {
15186
+ option: "alt",
15187
+ command: "ctrl",
15188
+ "return": "enter",
15189
+ "delete": "backspace"
15190
+ };
15191
+ var OS = {
15192
+ mac: "OS X",
15193
+ windows: "Windows"
15194
+ };
15195
+ var KEY_NAMES = {
15196
+ "delete": "delete",
15197
+ backspace: "backspace"
15198
+ };
15197
15199
 
15198
- function getMods(modifier, key) {
15199
- var mods = key.slice(0, key.length - 1);
15200
+ function _arrayWithHoles$1(arr) {
15201
+ if (Array.isArray(arr)) return arr;
15202
+ }
15200
15203
 
15201
- for (var i = 0; i < mods.length; i++) {
15202
- mods[i] = modifier[mods[i].toLowerCase()];
15204
+ function _iterableToArrayLimit$1(r, l) {
15205
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15206
+ if (null != t) {
15207
+ var e,
15208
+ n,
15209
+ i,
15210
+ u,
15211
+ a = [],
15212
+ f = !0,
15213
+ o = !1;
15214
+ try {
15215
+ if (i = (t = t.call(r)).next, 0 === l) {
15216
+ if (Object(t) !== t) return;
15217
+ f = !1;
15218
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
15219
+ } catch (r) {
15220
+ o = !0, n = r;
15221
+ } finally {
15222
+ try {
15223
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
15224
+ } finally {
15225
+ if (o) throw n;
15226
+ }
15227
+ }
15228
+ return a;
15203
15229
  }
15230
+ }
15204
15231
 
15205
- return mods;
15206
- } // 处理传的key字符串转换成数组
15207
-
15208
-
15209
- function getKeys(key) {
15210
- if (typeof key !== 'string') key = '';
15211
- key = key.replace(/\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等
15212
-
15213
- var keys = key.split(','); // 同时设置多个快捷键,以','分割
15214
-
15215
- var index = keys.lastIndexOf(''); // 快捷键可能包含',',需特殊处理
15232
+ function _arrayLikeToArray$1(arr, len) {
15233
+ if (len == null || len > arr.length) len = arr.length;
15234
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
15235
+ return arr2;
15236
+ }
15216
15237
 
15217
- for (; index >= 0;) {
15218
- keys[index - 1] += ',';
15219
- keys.splice(index, 1);
15220
- index = keys.lastIndexOf('');
15221
- }
15238
+ function _unsupportedIterableToArray$1(o, minLen) {
15239
+ if (!o) return;
15240
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
15241
+ var n = Object.prototype.toString.call(o).slice(8, -1);
15242
+ if (n === "Object" && o.constructor) n = o.constructor.name;
15243
+ if (n === "Map" || n === "Set") return Array.from(o);
15244
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
15245
+ }
15222
15246
 
15223
- return keys;
15224
- } // 比较修饰键的数组
15247
+ function _nonIterableRest$1() {
15248
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15249
+ }
15225
15250
 
15251
+ function _slicedToArray$1(arr, i) {
15252
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
15253
+ }
15226
15254
 
15227
- function compareArray(a1, a2) {
15228
- var arr1 = a1.length >= a2.length ? a1 : a2;
15229
- var arr2 = a1.length >= a2.length ? a2 : a1;
15230
- var isIndex = true;
15255
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15231
15256
 
15232
- for (var i = 0; i < arr1.length; i++) {
15233
- if (arr2.indexOf(arr1[i]) === -1) isIndex = false;
15234
- }
15257
+ function getDefaultExportFromCjs (x) {
15258
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
15259
+ }
15235
15260
 
15236
- return isIndex;
15237
- }
15238
-
15239
- var _keyMap = {
15240
- backspace: 8,
15241
- tab: 9,
15242
- clear: 12,
15243
- enter: 13,
15244
- return: 13,
15245
- esc: 27,
15246
- escape: 27,
15247
- space: 32,
15248
- left: 37,
15249
- up: 38,
15250
- right: 39,
15251
- down: 40,
15252
- del: 46,
15253
- delete: 46,
15254
- ins: 45,
15255
- insert: 45,
15256
- home: 36,
15257
- end: 35,
15258
- pageup: 33,
15259
- pagedown: 34,
15260
- capslock: 20,
15261
- num_0: 96,
15262
- num_1: 97,
15263
- num_2: 98,
15264
- num_3: 99,
15265
- num_4: 100,
15266
- num_5: 101,
15267
- num_6: 102,
15268
- num_7: 103,
15269
- num_8: 104,
15270
- num_9: 105,
15271
- num_multiply: 106,
15272
- num_add: 107,
15273
- num_enter: 108,
15274
- num_subtract: 109,
15275
- num_decimal: 110,
15276
- num_divide: 111,
15277
- '⇪': 20,
15278
- ',': 188,
15279
- '.': 190,
15280
- '/': 191,
15281
- '`': 192,
15282
- '-': isff ? 173 : 189,
15283
- '=': isff ? 61 : 187,
15284
- ';': isff ? 59 : 186,
15285
- '\'': 222,
15286
- '[': 219,
15287
- ']': 221,
15288
- '\\': 220
15289
- }; // Modifier Keys
15290
-
15291
- var _modifier = {
15292
- // shiftKey
15293
- '⇧': 16,
15294
- shift: 16,
15295
- // altKey
15296
- '⌥': 18,
15297
- alt: 18,
15298
- option: 18,
15299
- // ctrlKey
15300
- '⌃': 17,
15301
- ctrl: 17,
15302
- control: 17,
15303
- // metaKey
15304
- '⌘': 91,
15305
- cmd: 91,
15306
- command: 91
15307
- };
15308
- var modifierMap = {
15309
- 16: 'shiftKey',
15310
- 18: 'altKey',
15311
- 17: 'ctrlKey',
15312
- 91: 'metaKey',
15313
- shiftKey: 16,
15314
- ctrlKey: 17,
15315
- altKey: 18,
15316
- metaKey: 91
15317
- };
15318
- var _mods = {
15319
- 16: false,
15320
- 18: false,
15321
- 17: false,
15322
- 91: false
15323
- };
15324
- var _handlers = {}; // F1~F12 special key
15325
-
15326
- for (var k$1 = 1; k$1 < 20; k$1++) {
15327
- _keyMap["f".concat(k$1)] = 111 + k$1;
15328
- }
15329
-
15330
- var _downKeys = []; // 记录摁下的绑定键
15331
-
15332
- var _scope = 'all'; // 默认热键范围
15333
-
15334
- var elementHasBindEvent = []; // 已绑定事件的节点记录
15335
- // 返回键码
15336
-
15337
- var code = function code(x) {
15338
- return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
15339
- }; // 设置获取当前范围(默认为'所有')
15340
-
15341
-
15342
- function setScope(scope) {
15343
- _scope = scope || 'all';
15344
- } // 获取当前范围
15345
-
15346
-
15347
- function getScope() {
15348
- return _scope || 'all';
15349
- } // 获取摁下绑定键的键值
15350
-
15351
-
15352
- function getPressedKeyCodes() {
15353
- return _downKeys.slice(0);
15354
- } // 表单控件控件判断 返回 Boolean
15355
- // hotkey is effective only when filter return true
15356
-
15357
-
15358
- function filter(event) {
15359
- var target = event.target || event.srcElement;
15360
- var tagName = target.tagName;
15361
- var flag = true; // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
15362
-
15363
- if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
15364
- flag = false;
15365
- }
15261
+ var mousetrap = {exports: {}};
15366
15262
 
15367
- return flag;
15368
- } // 判断摁下的键是否为某个键,返回true或者false
15263
+ /*global define:false */
15264
+ mousetrap.exports;
15265
+ (function (module) {
15266
+ /**
15267
+ * Copyright 2012-2017 Craig Campbell
15268
+ *
15269
+ * Licensed under the Apache License, Version 2.0 (the "License");
15270
+ * you may not use this file except in compliance with the License.
15271
+ * You may obtain a copy of the License at
15272
+ *
15273
+ * http://www.apache.org/licenses/LICENSE-2.0
15274
+ *
15275
+ * Unless required by applicable law or agreed to in writing, software
15276
+ * distributed under the License is distributed on an "AS IS" BASIS,
15277
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15278
+ * See the License for the specific language governing permissions and
15279
+ * limitations under the License.
15280
+ *
15281
+ * Mousetrap is a simple keyboard shortcut library for Javascript with
15282
+ * no external dependencies
15283
+ *
15284
+ * @version 1.6.5
15285
+ * @url craig.is/killing/mice
15286
+ */
15287
+ (function (window, document, undefined$1) {
15288
+ // Check if mousetrap is used inside browser, if not, return
15289
+ if (!window) {
15290
+ return;
15291
+ }
15369
15292
 
15293
+ /**
15294
+ * mapping of special keycodes to their corresponding keys
15295
+ *
15296
+ * everything in this dictionary cannot use keypress events
15297
+ * so it has to be here to map to the correct keycodes for
15298
+ * keyup/keydown events
15299
+ *
15300
+ * @type {Object}
15301
+ */
15302
+ var _MAP = {
15303
+ 8: 'backspace',
15304
+ 9: 'tab',
15305
+ 13: 'enter',
15306
+ 16: 'shift',
15307
+ 17: 'ctrl',
15308
+ 18: 'alt',
15309
+ 20: 'capslock',
15310
+ 27: 'esc',
15311
+ 32: 'space',
15312
+ 33: 'pageup',
15313
+ 34: 'pagedown',
15314
+ 35: 'end',
15315
+ 36: 'home',
15316
+ 37: 'left',
15317
+ 38: 'up',
15318
+ 39: 'right',
15319
+ 40: 'down',
15320
+ 45: 'ins',
15321
+ 46: 'del',
15322
+ 91: 'meta',
15323
+ 93: 'meta',
15324
+ 224: 'meta'
15325
+ };
15370
15326
 
15371
- function isPressed(keyCode) {
15372
- if (typeof keyCode === 'string') {
15373
- keyCode = code(keyCode); // 转换成键码
15374
- }
15327
+ /**
15328
+ * mapping for special characters so they can support
15329
+ *
15330
+ * this dictionary is only used incase you want to bind a
15331
+ * keyup or keydown event to one of these keys
15332
+ *
15333
+ * @type {Object}
15334
+ */
15335
+ var _KEYCODE_MAP = {
15336
+ 106: '*',
15337
+ 107: '+',
15338
+ 109: '-',
15339
+ 110: '.',
15340
+ 111: '/',
15341
+ 186: ';',
15342
+ 187: '=',
15343
+ 188: ',',
15344
+ 189: '-',
15345
+ 190: '.',
15346
+ 191: '/',
15347
+ 192: '`',
15348
+ 219: '[',
15349
+ 220: '\\',
15350
+ 221: ']',
15351
+ 222: '\''
15352
+ };
15375
15353
 
15376
- return _downKeys.indexOf(keyCode) !== -1;
15377
- } // 循环删除handlers中的所有 scope(范围)
15354
+ /**
15355
+ * this is a mapping of keys that require shift on a US keypad
15356
+ * back to the non shift equivelents
15357
+ *
15358
+ * this is so you can use keyup events with these keys
15359
+ *
15360
+ * note that this will only work reliably on US keyboards
15361
+ *
15362
+ * @type {Object}
15363
+ */
15364
+ var _SHIFT_MAP = {
15365
+ '~': '`',
15366
+ '!': '1',
15367
+ '@': '2',
15368
+ '#': '3',
15369
+ '$': '4',
15370
+ '%': '5',
15371
+ '^': '6',
15372
+ '&': '7',
15373
+ '*': '8',
15374
+ '(': '9',
15375
+ ')': '0',
15376
+ '_': '-',
15377
+ '+': '=',
15378
+ ':': ';',
15379
+ '\"': '\'',
15380
+ '<': ',',
15381
+ '>': '.',
15382
+ '?': '/',
15383
+ '|': '\\'
15384
+ };
15378
15385
 
15386
+ /**
15387
+ * this is a list of special strings you can use to map
15388
+ * to modifier keys when you specify your keyboard shortcuts
15389
+ *
15390
+ * @type {Object}
15391
+ */
15392
+ var _SPECIAL_ALIASES = {
15393
+ 'option': 'alt',
15394
+ 'command': 'meta',
15395
+ 'return': 'enter',
15396
+ 'escape': 'esc',
15397
+ 'plus': '+',
15398
+ 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
15399
+ };
15379
15400
 
15380
- function deleteScope(scope, newScope) {
15381
- var handlers;
15382
- var i; // 没有指定scope,获取scope
15401
+ /**
15402
+ * variable to store the flipped version of _MAP from above
15403
+ * needed to check if we should use keypress or not when no action
15404
+ * is specified
15405
+ *
15406
+ * @type {Object|undefined}
15407
+ */
15408
+ var _REVERSE_MAP;
15383
15409
 
15384
- if (!scope) scope = getScope();
15410
+ /**
15411
+ * loop through the f keys, f1 to f19 and add them to the map
15412
+ * programatically
15413
+ */
15414
+ for (var i = 1; i < 20; ++i) {
15415
+ _MAP[111 + i] = 'f' + i;
15416
+ }
15385
15417
 
15386
- for (var key in _handlers) {
15387
- if (Object.prototype.hasOwnProperty.call(_handlers, key)) {
15388
- handlers = _handlers[key];
15418
+ /**
15419
+ * loop through to map numbers on the numeric keypad
15420
+ */
15421
+ for (i = 0; i <= 9; ++i) {
15422
+ // This needs to use a string cause otherwise since 0 is falsey
15423
+ // mousetrap will never fire for numpad 0 pressed as part of a keydown
15424
+ // event.
15425
+ //
15426
+ // @see https://github.com/ccampbell/mousetrap/pull/258
15427
+ _MAP[i + 96] = i.toString();
15428
+ }
15389
15429
 
15390
- for (i = 0; i < handlers.length;) {
15391
- if (handlers[i].scope === scope) handlers.splice(i, 1);else i++;
15430
+ /**
15431
+ * cross browser add event method
15432
+ *
15433
+ * @param {Element|HTMLDocument} object
15434
+ * @param {string} type
15435
+ * @param {Function} callback
15436
+ * @returns void
15437
+ */
15438
+ function _addEvent(object, type, callback) {
15439
+ if (object.addEventListener) {
15440
+ object.addEventListener(type, callback, false);
15441
+ return;
15392
15442
  }
15443
+ object.attachEvent('on' + type, callback);
15393
15444
  }
15394
- } // 如果scope被删除,将scope重置为all
15395
-
15396
-
15397
- if (getScope() === scope) setScope(newScope || 'all');
15398
- } // 清除修饰键
15399
15445
 
15446
+ /**
15447
+ * takes the event and returns the key character
15448
+ *
15449
+ * @param {Event} e
15450
+ * @return {string}
15451
+ */
15452
+ function _characterFromEvent(e) {
15453
+ // for keypress events we should return the character as is
15454
+ if (e.type == 'keypress') {
15455
+ var character = String.fromCharCode(e.which);
15456
+
15457
+ // if the shift key is not pressed then it is safe to assume
15458
+ // that we want the character to be lowercase. this means if
15459
+ // you accidentally have caps lock on then your key bindings
15460
+ // will continue to work
15461
+ //
15462
+ // the only side effect that might not be desired is if you
15463
+ // bind something like 'A' cause you want to trigger an
15464
+ // event when capital A is pressed caps lock will no longer
15465
+ // trigger the event. shift+a will though.
15466
+ if (!e.shiftKey) {
15467
+ character = character.toLowerCase();
15468
+ }
15469
+ return character;
15470
+ }
15400
15471
 
15401
- function clearModifier(event) {
15402
- var key = event.keyCode || event.which || event.charCode;
15403
-
15404
- var i = _downKeys.indexOf(key); // 从列表中清除按压过的键
15405
-
15472
+ // for non keypress events the special maps are needed
15473
+ if (_MAP[e.which]) {
15474
+ return _MAP[e.which];
15475
+ }
15476
+ if (_KEYCODE_MAP[e.which]) {
15477
+ return _KEYCODE_MAP[e.which];
15478
+ }
15406
15479
 
15407
- if (i >= 0) {
15408
- _downKeys.splice(i, 1);
15409
- } // 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
15480
+ // if it is not in the special map
15410
15481
 
15482
+ // with keydown and keyup events the character seems to always
15483
+ // come in as an uppercase character whether you are pressing shift
15484
+ // or not. we should make sure it is always lowercase for comparisons
15485
+ return String.fromCharCode(e.which).toLowerCase();
15486
+ }
15411
15487
 
15412
- if (event.key && event.key.toLowerCase() === 'meta') {
15413
- _downKeys.splice(0, _downKeys.length);
15414
- } // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除
15488
+ /**
15489
+ * checks if two arrays are equal
15490
+ *
15491
+ * @param {Array} modifiers1
15492
+ * @param {Array} modifiers2
15493
+ * @returns {boolean}
15494
+ */
15495
+ function _modifiersMatch(modifiers1, modifiers2) {
15496
+ return modifiers1.sort().join(',') === modifiers2.sort().join(',');
15497
+ }
15415
15498
 
15499
+ /**
15500
+ * takes a key event and figures out what the modifiers are
15501
+ *
15502
+ * @param {Event} e
15503
+ * @returns {Array}
15504
+ */
15505
+ function _eventModifiers(e) {
15506
+ var modifiers = [];
15507
+ if (e.shiftKey) {
15508
+ modifiers.push('shift');
15509
+ }
15510
+ if (e.altKey) {
15511
+ modifiers.push('alt');
15512
+ }
15513
+ if (e.ctrlKey) {
15514
+ modifiers.push('ctrl');
15515
+ }
15516
+ if (e.metaKey) {
15517
+ modifiers.push('meta');
15518
+ }
15519
+ return modifiers;
15520
+ }
15416
15521
 
15417
- if (key === 93 || key === 224) key = 91;
15522
+ /**
15523
+ * prevents default for this event
15524
+ *
15525
+ * @param {Event} e
15526
+ * @returns void
15527
+ */
15528
+ function _preventDefault(e) {
15529
+ if (e.preventDefault) {
15530
+ e.preventDefault();
15531
+ return;
15532
+ }
15533
+ e.returnValue = false;
15534
+ }
15418
15535
 
15419
- if (key in _mods) {
15420
- _mods[key] = false; // 将修饰键重置为false
15536
+ /**
15537
+ * stops propogation for this event
15538
+ *
15539
+ * @param {Event} e
15540
+ * @returns void
15541
+ */
15542
+ function _stopPropagation(e) {
15543
+ if (e.stopPropagation) {
15544
+ e.stopPropagation();
15545
+ return;
15546
+ }
15547
+ e.cancelBubble = true;
15548
+ }
15421
15549
 
15422
- for (var k in _modifier) {
15423
- if (_modifier[k] === key) hotkeys[k] = false;
15550
+ /**
15551
+ * determines if the keycode specified is a modifier key or not
15552
+ *
15553
+ * @param {string} key
15554
+ * @returns {boolean}
15555
+ */
15556
+ function _isModifier(key) {
15557
+ return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
15424
15558
  }
15425
- }
15426
- }
15427
15559
 
15428
- function unbind(keysInfo) {
15429
- // unbind(), unbind all keys
15430
- if (!keysInfo) {
15431
- Object.keys(_handlers).forEach(function (key) {
15432
- return delete _handlers[key];
15433
- });
15434
- } else if (Array.isArray(keysInfo)) {
15435
- // support like : unbind([{key: 'ctrl+a', scope: 's1'}, {key: 'ctrl-a', scope: 's2', splitKey: '-'}])
15436
- keysInfo.forEach(function (info) {
15437
- if (info.key) eachUnbind(info);
15438
- });
15439
- } else if (typeof keysInfo === 'object') {
15440
- // support like unbind({key: 'ctrl+a, ctrl+b', scope:'abc'})
15441
- if (keysInfo.key) eachUnbind(keysInfo);
15442
- } else if (typeof keysInfo === 'string') {
15443
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
15444
- args[_key - 1] = arguments[_key];
15560
+ /**
15561
+ * reverses the map lookup so that we can look for specific keys
15562
+ * to see what can and can't use keypress
15563
+ *
15564
+ * @return {Object}
15565
+ */
15566
+ function _getReverseMap() {
15567
+ if (!_REVERSE_MAP) {
15568
+ _REVERSE_MAP = {};
15569
+ for (var key in _MAP) {
15570
+ // pull out the numeric keypad from here cause keypress should
15571
+ // be able to detect the keys from the character
15572
+ if (key > 95 && key < 112) {
15573
+ continue;
15574
+ }
15575
+ if (_MAP.hasOwnProperty(key)) {
15576
+ _REVERSE_MAP[_MAP[key]] = key;
15577
+ }
15578
+ }
15579
+ }
15580
+ return _REVERSE_MAP;
15445
15581
  }
15446
15582
 
15447
- // support old method
15448
- // eslint-disable-line
15449
- var scope = args[0],
15450
- method = args[1];
15583
+ /**
15584
+ * picks the best action based on the key combination
15585
+ *
15586
+ * @param {string} key - character for key
15587
+ * @param {Array} modifiers
15588
+ * @param {string=} action passed in
15589
+ */
15590
+ function _pickBestAction(key, modifiers, action) {
15591
+ // if no action was picked in we should try to pick the one
15592
+ // that we think would work best for this key
15593
+ if (!action) {
15594
+ action = _getReverseMap()[key] ? 'keydown' : 'keypress';
15595
+ }
15451
15596
 
15452
- if (typeof scope === 'function') {
15453
- method = scope;
15454
- scope = '';
15597
+ // modifier keys don't work as expected with keypress,
15598
+ // switch to keydown
15599
+ if (action == 'keypress' && modifiers.length) {
15600
+ action = 'keydown';
15601
+ }
15602
+ return action;
15455
15603
  }
15456
15604
 
15457
- eachUnbind({
15458
- key: keysInfo,
15459
- scope: scope,
15460
- method: method,
15461
- splitKey: '+'
15462
- });
15463
- }
15464
- } // 解除绑定某个范围的快捷键
15465
-
15466
-
15467
- var eachUnbind = function eachUnbind(_ref) {
15468
- var key = _ref.key,
15469
- scope = _ref.scope,
15470
- method = _ref.method,
15471
- _ref$splitKey = _ref.splitKey,
15472
- splitKey = _ref$splitKey === void 0 ? '+' : _ref$splitKey;
15473
- var multipleKeys = getKeys(key);
15474
- multipleKeys.forEach(function (originKey) {
15475
- var unbindKeys = originKey.split(splitKey);
15476
- var len = unbindKeys.length;
15477
- var lastKey = unbindKeys[len - 1];
15478
- var keyCode = lastKey === '*' ? '*' : code(lastKey);
15479
- if (!_handlers[keyCode]) return; // 判断是否传入范围,没有就获取范围
15480
-
15481
- if (!scope) scope = getScope();
15482
- var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
15483
- _handlers[keyCode] = _handlers[keyCode].map(function (record) {
15484
- // 通过函数判断,是否解除绑定,函数相等直接返回
15485
- var isMatchingMethod = method ? record.method === method : true;
15486
-
15487
- if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) {
15488
- return {};
15605
+ /**
15606
+ * Converts from a string key combination to an array
15607
+ *
15608
+ * @param {string} combination like "command+shift+l"
15609
+ * @return {Array}
15610
+ */
15611
+ function _keysFromString(combination) {
15612
+ if (combination === '+') {
15613
+ return ['+'];
15489
15614
  }
15615
+ combination = combination.replace(/\+{2}/g, '+plus');
15616
+ return combination.split('+');
15617
+ }
15490
15618
 
15491
- return record;
15492
- });
15493
- });
15494
- }; // 对监听对应快捷键的回调函数进行处理
15619
+ /**
15620
+ * Gets info for a specific key combination
15621
+ *
15622
+ * @param {string} combination key combination ("command+s" or "a" or "*")
15623
+ * @param {string=} action
15624
+ * @returns {Object}
15625
+ */
15626
+ function _getKeyInfo(combination, action) {
15627
+ var keys;
15628
+ var key;
15629
+ var i;
15630
+ var modifiers = [];
15495
15631
 
15632
+ // take the keys from this pattern and figure out what the actual
15633
+ // pattern is all about
15634
+ keys = _keysFromString(combination);
15635
+ for (i = 0; i < keys.length; ++i) {
15636
+ key = keys[i];
15496
15637
 
15497
- function eventHandler(event, handler, scope) {
15498
- var modifiersMatch; // 看它是否在当前范围
15638
+ // normalize key names
15639
+ if (_SPECIAL_ALIASES[key]) {
15640
+ key = _SPECIAL_ALIASES[key];
15641
+ }
15499
15642
 
15500
- if (handler.scope === scope || handler.scope === 'all') {
15501
- // 检查是否匹配修饰符(如果有返回true)
15502
- modifiersMatch = handler.mods.length > 0;
15643
+ // if this is not a keypress event then we should
15644
+ // be smart about using shift keys
15645
+ // this will only work for US keyboards however
15646
+ if (action && action != 'keypress' && _SHIFT_MAP[key]) {
15647
+ key = _SHIFT_MAP[key];
15648
+ modifiers.push('shift');
15649
+ }
15503
15650
 
15504
- for (var y in _mods) {
15505
- if (Object.prototype.hasOwnProperty.call(_mods, y)) {
15506
- if (!_mods[y] && handler.mods.indexOf(+y) > -1 || _mods[y] && handler.mods.indexOf(+y) === -1) {
15507
- modifiersMatch = false;
15651
+ // if this key is a modifier then add it to the list of modifiers
15652
+ if (_isModifier(key)) {
15653
+ modifiers.push(key);
15508
15654
  }
15509
15655
  }
15510
- } // 调用处理程序,如果是修饰键不做处理
15511
15656
 
15512
-
15513
- if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
15514
- if (handler.method(event, handler) === false) {
15515
- if (event.preventDefault) event.preventDefault();else event.returnValue = false;
15516
- if (event.stopPropagation) event.stopPropagation();
15517
- if (event.cancelBubble) event.cancelBubble = true;
15657
+ // depending on what the key combination is
15658
+ // we will try to pick the best event for it
15659
+ action = _pickBestAction(key, modifiers, action);
15660
+ return {
15661
+ key: key,
15662
+ modifiers: modifiers,
15663
+ action: action
15664
+ };
15665
+ }
15666
+ function _belongsTo(element, ancestor) {
15667
+ if (element === null || element === document) {
15668
+ return false;
15669
+ }
15670
+ if (element === ancestor) {
15671
+ return true;
15518
15672
  }
15673
+ return _belongsTo(element.parentNode, ancestor);
15519
15674
  }
15520
- }
15521
- } // 处理keydown事件
15675
+ function Mousetrap(targetElement) {
15676
+ var self = this;
15677
+ targetElement = targetElement || document;
15678
+ if (!(self instanceof Mousetrap)) {
15679
+ return new Mousetrap(targetElement);
15680
+ }
15522
15681
 
15682
+ /**
15683
+ * element to attach key events to
15684
+ *
15685
+ * @type {Element}
15686
+ */
15687
+ self.target = targetElement;
15523
15688
 
15524
- function dispatch(event) {
15525
- var asterisk = _handlers['*'];
15526
- var key = event.keyCode || event.which || event.charCode; // 表单控件过滤 默认表单控件不触发快捷键
15689
+ /**
15690
+ * a list of all the callbacks setup via Mousetrap.bind()
15691
+ *
15692
+ * @type {Object}
15693
+ */
15694
+ self._callbacks = {};
15527
15695
 
15528
- if (!hotkeys.filter.call(this, event)) return; // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致
15529
- // Webkit左右 command 键值不一样
15696
+ /**
15697
+ * direct map of string combinations to callbacks used for trigger()
15698
+ *
15699
+ * @type {Object}
15700
+ */
15701
+ self._directMap = {};
15530
15702
 
15531
- if (key === 93 || key === 224) key = 91;
15532
- /**
15533
- * Collect bound keys
15534
- * If an Input Method Editor is processing key input and the event is keydown, return 229.
15535
- * https://stackoverflow.com/questions/25043934/is-it-ok-to-ignore-keydown-events-with-keycode-229
15536
- * http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
15537
- */
15703
+ /**
15704
+ * keeps track of what level each sequence is at since multiple
15705
+ * sequences can start out with the same sequence
15706
+ *
15707
+ * @type {Object}
15708
+ */
15709
+ var _sequenceLevels = {};
15538
15710
 
15539
- if (_downKeys.indexOf(key) === -1 && key !== 229) _downKeys.push(key);
15540
- /**
15541
- * Jest test cases are required.
15542
- * ===============================
15543
- */
15711
+ /**
15712
+ * variable to store the setTimeout call
15713
+ *
15714
+ * @type {null|number}
15715
+ */
15716
+ var _resetTimer;
15544
15717
 
15545
- ['ctrlKey', 'altKey', 'shiftKey', 'metaKey'].forEach(function (keyName) {
15546
- var keyNum = modifierMap[keyName];
15718
+ /**
15719
+ * temporary state where we will ignore the next keyup
15720
+ *
15721
+ * @type {boolean|string}
15722
+ */
15723
+ var _ignoreNextKeyup = false;
15547
15724
 
15548
- if (event[keyName] && _downKeys.indexOf(keyNum) === -1) {
15549
- _downKeys.push(keyNum);
15550
- } else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
15551
- _downKeys.splice(_downKeys.indexOf(keyNum), 1);
15552
- } else if (keyName === 'metaKey' && event[keyName] && _downKeys.length === 3) {
15553
15725
  /**
15554
- * Fix if Command is pressed:
15555
- * ===============================
15726
+ * temporary state where we will ignore the next keypress
15727
+ *
15728
+ * @type {boolean}
15556
15729
  */
15557
- if (!(event.ctrlKey || event.shiftKey || event.altKey)) {
15558
- _downKeys = _downKeys.slice(_downKeys.indexOf(keyNum));
15559
- }
15560
- }
15561
- });
15562
- /**
15563
- * -------------------------------
15564
- */
15730
+ var _ignoreNextKeypress = false;
15565
15731
 
15566
- if (key in _mods) {
15567
- _mods[key] = true; // 将特殊字符的key注册到 hotkeys
15732
+ /**
15733
+ * are we currently inside of a sequence?
15734
+ * type of action ("keyup" or "keydown" or "keypress") or false
15735
+ *
15736
+ * @type {boolean|string}
15737
+ */
15738
+ var _nextExpectedAction = false;
15568
15739
 
15569
- for (var k in _modifier) {
15570
- if (_modifier[k] === key) hotkeys[k] = true;
15571
- }
15740
+ /**
15741
+ * resets all sequence counters except for the ones passed in
15742
+ *
15743
+ * @param {Object} doNotReset
15744
+ * @returns void
15745
+ */
15746
+ function _resetSequences(doNotReset) {
15747
+ doNotReset = doNotReset || {};
15748
+ var activeSequences = false,
15749
+ key;
15750
+ for (key in _sequenceLevels) {
15751
+ if (doNotReset[key]) {
15752
+ activeSequences = true;
15753
+ continue;
15754
+ }
15755
+ _sequenceLevels[key] = 0;
15756
+ }
15757
+ if (!activeSequences) {
15758
+ _nextExpectedAction = false;
15759
+ }
15760
+ }
15572
15761
 
15573
- if (!asterisk) return;
15574
- } // modifierMap 里面的修饰键绑定到 event
15762
+ /**
15763
+ * finds all callbacks that match based on the keycode, modifiers,
15764
+ * and action
15765
+ *
15766
+ * @param {string} character
15767
+ * @param {Array} modifiers
15768
+ * @param {Event|Object} e
15769
+ * @param {string=} sequenceName - name of the sequence we are looking for
15770
+ * @param {string=} combination
15771
+ * @param {number=} level
15772
+ * @returns {Array}
15773
+ */
15774
+ function _getMatches(character, modifiers, e, sequenceName, combination, level) {
15775
+ var i;
15776
+ var callback;
15777
+ var matches = [];
15778
+ var action = e.type;
15575
15779
 
15780
+ // if there are no events related to this keycode
15781
+ if (!self._callbacks[character]) {
15782
+ return [];
15783
+ }
15576
15784
 
15577
- for (var e in _mods) {
15578
- if (Object.prototype.hasOwnProperty.call(_mods, e)) {
15579
- _mods[e] = event[modifierMap[e]];
15580
- }
15581
- }
15582
- /**
15583
- * https://github.com/jaywcjlove/hotkeys/pull/129
15584
- * This solves the issue in Firefox on Windows where hotkeys corresponding to special characters would not trigger.
15585
- * An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
15586
- * Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
15587
- */
15785
+ // if a modifier key is coming up on its own we should allow it
15786
+ if (action == 'keyup' && _isModifier(character)) {
15787
+ modifiers = [character];
15788
+ }
15588
15789
 
15790
+ // loop through all callbacks for the key that was pressed
15791
+ // and see if any of them match
15792
+ for (i = 0; i < self._callbacks[character].length; ++i) {
15793
+ callback = self._callbacks[character][i];
15589
15794
 
15590
- if (event.getModifierState && !(event.altKey && !event.ctrlKey) && event.getModifierState('AltGraph')) {
15591
- if (_downKeys.indexOf(17) === -1) {
15592
- _downKeys.push(17);
15593
- }
15795
+ // if a sequence name is not specified, but this is a sequence at
15796
+ // the wrong level then move onto the next match
15797
+ if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
15798
+ continue;
15799
+ }
15594
15800
 
15595
- if (_downKeys.indexOf(18) === -1) {
15596
- _downKeys.push(18);
15597
- }
15801
+ // if the action we are looking for doesn't match the action we got
15802
+ // then we should keep going
15803
+ if (action != callback.action) {
15804
+ continue;
15805
+ }
15806
+
15807
+ // if this is a keypress event and the meta key and control key
15808
+ // are not pressed that means that we need to only look at the
15809
+ // character, otherwise check the modifiers as well
15810
+ //
15811
+ // chrome will not fire a keypress if meta or control is down
15812
+ // safari will fire a keypress if meta or meta+shift is down
15813
+ // firefox will fire a keypress if meta or control is down
15814
+ if (action == 'keypress' && !e.metaKey && !e.ctrlKey || _modifiersMatch(modifiers, callback.modifiers)) {
15815
+ // when you bind a combination or sequence a second time it
15816
+ // should overwrite the first one. if a sequenceName or
15817
+ // combination is specified in this call it does just that
15818
+ //
15819
+ // @todo make deleting its own method?
15820
+ var deleteCombo = !sequenceName && callback.combo == combination;
15821
+ var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
15822
+ if (deleteCombo || deleteSequence) {
15823
+ self._callbacks[character].splice(i, 1);
15824
+ }
15825
+ matches.push(callback);
15826
+ }
15827
+ }
15828
+ return matches;
15829
+ }
15598
15830
 
15599
- _mods[17] = true;
15600
- _mods[18] = true;
15601
- } // 获取范围 默认为 `all`
15831
+ /**
15832
+ * actually calls the callback function
15833
+ *
15834
+ * if your callback function returns false this will use the jquery
15835
+ * convention - prevent default and stop propogation on the event
15836
+ *
15837
+ * @param {Function} callback
15838
+ * @param {Event} e
15839
+ * @returns void
15840
+ */
15841
+ function _fireCallback(callback, e, combo, sequence) {
15842
+ // if this event should not happen stop here
15843
+ if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
15844
+ return;
15845
+ }
15846
+ if (callback(e, combo) === false) {
15847
+ _preventDefault(e);
15848
+ _stopPropagation(e);
15849
+ }
15850
+ }
15602
15851
 
15852
+ /**
15853
+ * handles a character key event
15854
+ *
15855
+ * @param {string} character
15856
+ * @param {Array} modifiers
15857
+ * @param {Event} e
15858
+ * @returns void
15859
+ */
15860
+ self._handleKey = function (character, modifiers, e) {
15861
+ var callbacks = _getMatches(character, modifiers, e);
15862
+ var i;
15863
+ var doNotReset = {};
15864
+ var maxLevel = 0;
15865
+ var processedSequenceCallback = false;
15866
+
15867
+ // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
15868
+ for (i = 0; i < callbacks.length; ++i) {
15869
+ if (callbacks[i].seq) {
15870
+ maxLevel = Math.max(maxLevel, callbacks[i].level);
15871
+ }
15872
+ }
15603
15873
 
15604
- var scope = getScope(); // 对任何快捷键都需要做的处理
15874
+ // loop through matching callbacks for this key event
15875
+ for (i = 0; i < callbacks.length; ++i) {
15876
+ // fire for all sequence callbacks
15877
+ // this is because if for example you have multiple sequences
15878
+ // bound such as "g i" and "g t" they both need to fire the
15879
+ // callback for matching g cause otherwise you can only ever
15880
+ // match the first one
15881
+ if (callbacks[i].seq) {
15882
+ // only fire callbacks for the maxLevel to prevent
15883
+ // subsequences from also firing
15884
+ //
15885
+ // for example 'a option b' should not cause 'option b' to fire
15886
+ // even though 'option b' is part of the other sequence
15887
+ //
15888
+ // any sequences that do not match here will be discarded
15889
+ // below by the _resetSequences call
15890
+ if (callbacks[i].level != maxLevel) {
15891
+ continue;
15892
+ }
15893
+ processedSequenceCallback = true;
15605
15894
 
15606
- if (asterisk) {
15607
- for (var i = 0; i < asterisk.length; i++) {
15608
- if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
15609
- eventHandler(event, asterisk[i], scope);
15610
- }
15611
- }
15612
- } // key 不在 _handlers 中返回
15895
+ // keep a list of which sequences were matches for later
15896
+ doNotReset[callbacks[i].seq] = 1;
15897
+ _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
15898
+ continue;
15899
+ }
15613
15900
 
15901
+ // if there were no sequence matches but we are still here
15902
+ // that means this is a regular match so we should fire that
15903
+ if (!processedSequenceCallback) {
15904
+ _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
15905
+ }
15906
+ }
15614
15907
 
15615
- if (!(key in _handlers)) return;
15908
+ // if the key you pressed matches the type of sequence without
15909
+ // being a modifier (ie "keyup" or "keypress") then we should
15910
+ // reset all sequences that were not matched by this event
15911
+ //
15912
+ // this is so, for example, if you have the sequence "h a t" and you
15913
+ // type "h e a r t" it does not match. in this case the "e" will
15914
+ // cause the sequence to reset
15915
+ //
15916
+ // modifier keys are ignored because you can have a sequence
15917
+ // that contains modifiers such as "enter ctrl+space" and in most
15918
+ // cases the modifier key will be pressed before the next key
15919
+ //
15920
+ // also if you have a sequence such as "ctrl+b a" then pressing the
15921
+ // "b" key will trigger a "keypress" and a "keydown"
15922
+ //
15923
+ // the "keydown" is expected when there is a modifier, but the
15924
+ // "keypress" ends up matching the _nextExpectedAction since it occurs
15925
+ // after and that causes the sequence to reset
15926
+ //
15927
+ // we ignore keypresses in a sequence that directly follow a keydown
15928
+ // for the same character
15929
+ var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
15930
+ if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
15931
+ _resetSequences(doNotReset);
15932
+ }
15933
+ _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
15934
+ };
15616
15935
 
15617
- for (var _i = 0; _i < _handlers[key].length; _i++) {
15618
- if (event.type === 'keydown' && _handlers[key][_i].keydown || event.type === 'keyup' && _handlers[key][_i].keyup) {
15619
- if (_handlers[key][_i].key) {
15620
- var record = _handlers[key][_i];
15621
- var splitKey = record.splitKey;
15622
- var keyShortcut = record.key.split(splitKey);
15623
- var _downKeysCurrent = []; // 记录当前按键键值
15936
+ /**
15937
+ * handles a keydown event
15938
+ *
15939
+ * @param {Event} e
15940
+ * @returns void
15941
+ */
15942
+ function _handleKeyEvent(e) {
15943
+ // normalize e.which for key events
15944
+ // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
15945
+ if (typeof e.which !== 'number') {
15946
+ e.which = e.keyCode;
15947
+ }
15948
+ var character = _characterFromEvent(e);
15624
15949
 
15625
- for (var a = 0; a < keyShortcut.length; a++) {
15626
- _downKeysCurrent.push(code(keyShortcut[a]));
15950
+ // no character found then stop
15951
+ if (!character) {
15952
+ return;
15627
15953
  }
15628
15954
 
15629
- if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
15630
- // 找到处理内容
15631
- eventHandler(event, record, scope);
15955
+ // need to use === for the character check because the character can be 0
15956
+ if (e.type == 'keyup' && _ignoreNextKeyup === character) {
15957
+ _ignoreNextKeyup = false;
15958
+ return;
15632
15959
  }
15960
+ self.handleKey(character, _eventModifiers(e), e);
15633
15961
  }
15634
- }
15635
- }
15636
- } // 判断 element 是否已经绑定事件
15637
15962
 
15963
+ /**
15964
+ * called to set a 1 second timeout on the specified sequence
15965
+ *
15966
+ * this is so after each key press in the sequence you have 1 second
15967
+ * to press the next key before you have to start over
15968
+ *
15969
+ * @returns void
15970
+ */
15971
+ function _resetSequenceTimer() {
15972
+ clearTimeout(_resetTimer);
15973
+ _resetTimer = setTimeout(_resetSequences, 1000);
15974
+ }
15638
15975
 
15639
- function isElementBind(element) {
15640
- return elementHasBindEvent.indexOf(element) > -1;
15641
- }
15976
+ /**
15977
+ * binds a key sequence to an event
15978
+ *
15979
+ * @param {string} combo - combo specified in bind call
15980
+ * @param {Array} keys
15981
+ * @param {Function} callback
15982
+ * @param {string=} action
15983
+ * @returns void
15984
+ */
15985
+ function _bindSequence(combo, keys, callback, action) {
15986
+ // start off by adding a sequence level record for this combination
15987
+ // and setting the level to 0
15988
+ _sequenceLevels[combo] = 0;
15642
15989
 
15643
- function hotkeys(key, option, method) {
15644
- _downKeys = [];
15645
- var keys = getKeys(key); // 需要处理的快捷键列表
15990
+ /**
15991
+ * callback to increase the sequence level for this sequence and reset
15992
+ * all other sequences that were active
15993
+ *
15994
+ * @param {string} nextAction
15995
+ * @returns {Function}
15996
+ */
15997
+ function _increaseSequence(nextAction) {
15998
+ return function () {
15999
+ _nextExpectedAction = nextAction;
16000
+ ++_sequenceLevels[combo];
16001
+ _resetSequenceTimer();
16002
+ };
16003
+ }
15646
16004
 
15647
- var mods = [];
15648
- var scope = 'all'; // scope默认为all,所有范围都有效
16005
+ /**
16006
+ * wraps the specified callback inside of another function in order
16007
+ * to reset all sequence counters as soon as this sequence is done
16008
+ *
16009
+ * @param {Event} e
16010
+ * @returns void
16011
+ */
16012
+ function _callbackAndReset(e) {
16013
+ _fireCallback(callback, e, combo);
16014
+
16015
+ // we should ignore the next key up if the action is key down
16016
+ // or keypress. this is so if you finish a sequence and
16017
+ // release the key the final key will not trigger a keyup
16018
+ if (action !== 'keyup') {
16019
+ _ignoreNextKeyup = _characterFromEvent(e);
16020
+ }
15649
16021
 
15650
- var element = document; // 快捷键事件绑定节点
16022
+ // weird race condition if a sequence ends with the key
16023
+ // another sequence begins with
16024
+ setTimeout(_resetSequences, 10);
16025
+ }
16026
+
16027
+ // loop through keys one at a time and bind the appropriate callback
16028
+ // function. for any key leading up to the final one it should
16029
+ // increase the sequence. after the final, it should reset all sequences
16030
+ //
16031
+ // if an action is specified in the original bind call then that will
16032
+ // be used throughout. otherwise we will pass the action that the
16033
+ // next key in the sequence should match. this allows a sequence
16034
+ // to mix and match keypress and keydown events depending on which
16035
+ // ones are better suited to the key provided
16036
+ for (var i = 0; i < keys.length; ++i) {
16037
+ var isFinal = i + 1 === keys.length;
16038
+ var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
16039
+ _bindSingle(keys[i], wrappedCallback, action, combo, i);
16040
+ }
16041
+ }
15651
16042
 
15652
- var i = 0;
15653
- var keyup = false;
15654
- var keydown = true;
15655
- var splitKey = '+'; // 对为设定范围的判断
16043
+ /**
16044
+ * binds a single keyboard combination
16045
+ *
16046
+ * @param {string} combination
16047
+ * @param {Function} callback
16048
+ * @param {string=} action
16049
+ * @param {string=} sequenceName - name of sequence if part of sequence
16050
+ * @param {number=} level - what part of the sequence the command is
16051
+ * @returns void
16052
+ */
16053
+ function _bindSingle(combination, callback, action, sequenceName, level) {
16054
+ // store a direct mapped reference for use with Mousetrap.trigger
16055
+ self._directMap[combination + ':' + action] = callback;
16056
+
16057
+ // make sure multiple spaces in a row become a single space
16058
+ combination = combination.replace(/\s+/g, ' ');
16059
+ var sequence = combination.split(' ');
16060
+ var info;
16061
+
16062
+ // if this pattern is a sequence of keys then run through this method
16063
+ // to reprocess each pattern one key at a time
16064
+ if (sequence.length > 1) {
16065
+ _bindSequence(combination, sequence, callback, action);
16066
+ return;
16067
+ }
16068
+ info = _getKeyInfo(combination, action);
16069
+
16070
+ // make sure to initialize array if this is the first time
16071
+ // a callback is added for this key
16072
+ self._callbacks[info.key] = self._callbacks[info.key] || [];
16073
+
16074
+ // remove an existing match if there is one
16075
+ _getMatches(info.key, info.modifiers, {
16076
+ type: info.action
16077
+ }, sequenceName, combination, level);
16078
+
16079
+ // add this call back to the array
16080
+ // if it is a sequence put it at the beginning
16081
+ // if not put it at the end
16082
+ //
16083
+ // this is important because the way these are processed expects
16084
+ // the sequence ones to come first
16085
+ self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
16086
+ callback: callback,
16087
+ modifiers: info.modifiers,
16088
+ action: info.action,
16089
+ seq: sequenceName,
16090
+ level: level,
16091
+ combo: combination
16092
+ });
16093
+ }
15656
16094
 
15657
- if (method === undefined && typeof option === 'function') {
15658
- method = option;
15659
- }
16095
+ /**
16096
+ * binds multiple combinations to the same callback
16097
+ *
16098
+ * @param {Array} combinations
16099
+ * @param {Function} callback
16100
+ * @param {string|undefined} action
16101
+ * @returns void
16102
+ */
16103
+ self._bindMultiple = function (combinations, callback, action) {
16104
+ for (var i = 0; i < combinations.length; ++i) {
16105
+ _bindSingle(combinations[i], callback, action);
16106
+ }
16107
+ };
16108
+
16109
+ // start!
16110
+ _addEvent(targetElement, 'keypress', _handleKeyEvent);
16111
+ _addEvent(targetElement, 'keydown', _handleKeyEvent);
16112
+ _addEvent(targetElement, 'keyup', _handleKeyEvent);
16113
+ }
15660
16114
 
15661
- if (Object.prototype.toString.call(option) === '[object Object]') {
15662
- if (option.scope) scope = option.scope; // eslint-disable-line
16115
+ /**
16116
+ * binds an event to mousetrap
16117
+ *
16118
+ * can be a single key, a combination of keys separated with +,
16119
+ * an array of keys, or a sequence of keys separated by spaces
16120
+ *
16121
+ * be sure to list the modifier keys first to make sure that the
16122
+ * correct key ends up getting bound (the last key in the pattern)
16123
+ *
16124
+ * @param {string|Array} keys
16125
+ * @param {Function} callback
16126
+ * @param {string=} action - 'keypress', 'keydown', or 'keyup'
16127
+ * @returns void
16128
+ */
16129
+ Mousetrap.prototype.bind = function (keys, callback, action) {
16130
+ var self = this;
16131
+ keys = keys instanceof Array ? keys : [keys];
16132
+ self._bindMultiple.call(self, keys, callback, action);
16133
+ return self;
16134
+ };
15663
16135
 
15664
- if (option.element) element = option.element; // eslint-disable-line
16136
+ /**
16137
+ * unbinds an event to mousetrap
16138
+ *
16139
+ * the unbinding sets the callback function of the specified key combo
16140
+ * to an empty function and deletes the corresponding key in the
16141
+ * _directMap dict.
16142
+ *
16143
+ * TODO: actually remove this from the _callbacks dictionary instead
16144
+ * of binding an empty function
16145
+ *
16146
+ * the keycombo+action has to be exactly the same as
16147
+ * it was defined in the bind method
16148
+ *
16149
+ * @param {string|Array} keys
16150
+ * @param {string} action
16151
+ * @returns void
16152
+ */
16153
+ Mousetrap.prototype.unbind = function (keys, action) {
16154
+ var self = this;
16155
+ return self.bind.call(self, keys, function () {}, action);
16156
+ };
15665
16157
 
15666
- if (option.keyup) keyup = option.keyup; // eslint-disable-line
16158
+ /**
16159
+ * triggers an event that has already been bound
16160
+ *
16161
+ * @param {string} keys
16162
+ * @param {string=} action
16163
+ * @returns void
16164
+ */
16165
+ Mousetrap.prototype.trigger = function (keys, action) {
16166
+ var self = this;
16167
+ if (self._directMap[keys + ':' + action]) {
16168
+ self._directMap[keys + ':' + action]({}, keys);
16169
+ }
16170
+ return self;
16171
+ };
15667
16172
 
15668
- if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
16173
+ /**
16174
+ * resets the library back to its initial state. this is useful
16175
+ * if you want to clear out the current keyboard shortcuts and bind
16176
+ * new ones - for example if you switch to another page
16177
+ *
16178
+ * @returns void
16179
+ */
16180
+ Mousetrap.prototype.reset = function () {
16181
+ var self = this;
16182
+ self._callbacks = {};
16183
+ self._directMap = {};
16184
+ return self;
16185
+ };
15669
16186
 
15670
- if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
15671
- }
16187
+ /**
16188
+ * should we stop this event before firing off callbacks
16189
+ *
16190
+ * @param {Event} e
16191
+ * @param {Element} element
16192
+ * @return {boolean}
16193
+ */
16194
+ Mousetrap.prototype.stopCallback = function (e, element) {
16195
+ var self = this;
15672
16196
 
15673
- if (typeof option === 'string') scope = option; // 对于每个快捷键进行处理
16197
+ // if the element has the class "mousetrap" then no need to stop
16198
+ if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
16199
+ return false;
16200
+ }
16201
+ if (_belongsTo(element, self.target)) {
16202
+ return false;
16203
+ }
15674
16204
 
15675
- for (; i < keys.length; i++) {
15676
- key = keys[i].split(splitKey); // 按键列表
16205
+ // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,
16206
+ // not the initial event target in the shadow tree. Note that not all events cross the
16207
+ // shadow boundary.
16208
+ // For shadow trees with `mode: 'open'`, the initial event target is the first element in
16209
+ // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event
16210
+ // target cannot be obtained.
16211
+ if ('composedPath' in e && typeof e.composedPath === 'function') {
16212
+ // For open shadow trees, update `element` so that the following check works.
16213
+ var initialEventTarget = e.composedPath()[0];
16214
+ if (initialEventTarget !== e.target) {
16215
+ element = initialEventTarget;
16216
+ }
16217
+ }
15677
16218
 
15678
- mods = []; // 如果是组合快捷键取得组合快捷键
16219
+ // stop for input, select, and textarea
16220
+ return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
16221
+ };
15679
16222
 
15680
- if (key.length > 1) mods = getMods(_modifier, key); // 将非修饰键转化为键码
16223
+ /**
16224
+ * exposes _handleKey publicly so it can be overwritten by extensions
16225
+ */
16226
+ Mousetrap.prototype.handleKey = function () {
16227
+ var self = this;
16228
+ return self._handleKey.apply(self, arguments);
16229
+ };
15681
16230
 
15682
- key = key[key.length - 1];
15683
- key = key === '*' ? '*' : code(key); // *表示匹配所有快捷键
15684
- // 判断key是否在_handlers中,不在就赋一个空数组
16231
+ /**
16232
+ * allow custom key mappings
16233
+ */
16234
+ Mousetrap.addKeycodes = function (object) {
16235
+ for (var key in object) {
16236
+ if (object.hasOwnProperty(key)) {
16237
+ _MAP[key] = object[key];
16238
+ }
16239
+ }
16240
+ _REVERSE_MAP = null;
16241
+ };
15685
16242
 
15686
- if (!(key in _handlers)) _handlers[key] = [];
16243
+ /**
16244
+ * Init the global mousetrap functions
16245
+ *
16246
+ * This method is needed to allow the global mousetrap functions to work
16247
+ * now that mousetrap is a constructor function.
16248
+ */
16249
+ Mousetrap.init = function () {
16250
+ var documentMousetrap = Mousetrap(document);
16251
+ for (var method in documentMousetrap) {
16252
+ if (method.charAt(0) !== '_') {
16253
+ Mousetrap[method] = function (method) {
16254
+ return function () {
16255
+ return documentMousetrap[method].apply(documentMousetrap, arguments);
16256
+ };
16257
+ }(method);
16258
+ }
16259
+ }
16260
+ };
16261
+ Mousetrap.init();
15687
16262
 
15688
- _handlers[key].push({
15689
- keyup: keyup,
15690
- keydown: keydown,
15691
- scope: scope,
15692
- mods: mods,
15693
- shortcut: keys[i],
15694
- method: method,
15695
- key: keys[i],
15696
- splitKey: splitKey
15697
- });
15698
- } // 在全局document上设置快捷键
16263
+ // expose mousetrap to the global object
16264
+ window.Mousetrap = Mousetrap;
15699
16265
 
16266
+ // expose as a common js module
16267
+ if (module.exports) {
16268
+ module.exports = Mousetrap;
16269
+ }
15700
16270
 
15701
- if (typeof element !== 'undefined' && !isElementBind(element) && window) {
15702
- elementHasBindEvent.push(element);
15703
- addEvent(element, 'keydown', function (e) {
15704
- dispatch(e);
15705
- });
15706
- addEvent(window, 'focus', function () {
15707
- _downKeys = [];
15708
- });
15709
- addEvent(element, 'keyup', function (e) {
15710
- dispatch(e);
15711
- clearModifier(e);
15712
- });
15713
- }
15714
- }
16271
+ // expose mousetrap as an AMD module
16272
+ if (typeof undefined$1 === 'function' && undefined$1.amd) {
16273
+ undefined$1(function () {
16274
+ return Mousetrap;
16275
+ });
16276
+ }
16277
+ })(typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);
16278
+ })(mousetrap);
16279
+ var mousetrapExports = mousetrap.exports;
16280
+ var Mousetrap$1 = /*@__PURE__*/getDefaultExportFromCjs(mousetrapExports);
16281
+
16282
+ /**
16283
+ * adds a bindGlobal method to Mousetrap that allows you to
16284
+ * bind specific keyboard shortcuts that will still work
16285
+ * inside a text input field
16286
+ *
16287
+ * usage:
16288
+ * Mousetrap.bindGlobal('ctrl+s', _saveChanges);
16289
+ */
16290
+ /* global Mousetrap:true */
16291
+ (function (Mousetrap) {
16292
+ var _globalCallbacks = {};
16293
+ var _originalStopCallback = Mousetrap.prototype.stopCallback;
16294
+ Mousetrap.prototype.stopCallback = function (e, element, combo, sequence) {
16295
+ var self = this;
16296
+ if (self.paused) {
16297
+ return true;
16298
+ }
16299
+ if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
16300
+ return false;
16301
+ }
16302
+ return _originalStopCallback.call(self, e, element, combo);
16303
+ };
16304
+ Mousetrap.prototype.bindGlobal = function (keys, callback, action) {
16305
+ var self = this;
16306
+ self.bind(keys, callback, action);
16307
+ if (keys instanceof Array) {
16308
+ for (var i = 0; i < keys.length; i++) {
16309
+ _globalCallbacks[keys[i]] = true;
16310
+ }
16311
+ return;
16312
+ }
16313
+ _globalCallbacks[keys] = true;
16314
+ };
16315
+ Mousetrap.prototype.unbindGlobal = function (keys, action) {
16316
+ var self = this;
16317
+ self.unbind(keys, action);
16318
+ if (keys instanceof Array) {
16319
+ for (var i = 0; i < keys.length; i++) {
16320
+ _globalCallbacks[keys[i]] = false;
16321
+ }
16322
+ return;
16323
+ }
16324
+ _globalCallbacks[keys] = false;
16325
+ };
16326
+ Mousetrap.init();
16327
+ })(Mousetrap);
15715
16328
 
15716
- var _api = {
15717
- setScope: setScope,
15718
- getScope: getScope,
15719
- deleteScope: deleteScope,
15720
- getPressedKeyCodes: getPressedKeyCodes,
15721
- isPressed: isPressed,
15722
- filter: filter,
15723
- unbind: unbind
15724
- };
16329
+ function _typeof$2(o) {
16330
+ "@babel/helpers - typeof";
15725
16331
 
15726
- for (var a in _api) {
15727
- if (Object.prototype.hasOwnProperty.call(_api, a)) {
15728
- hotkeys[a] = _api[a];
15729
- }
16332
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
16333
+ return typeof o;
16334
+ } : function (o) {
16335
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
16336
+ }, _typeof$2(o);
15730
16337
  }
15731
16338
 
15732
- if (typeof window !== 'undefined') {
15733
- var _hotkeys = window.hotkeys;
16339
+ var platform$1 = {exports: {}};
16340
+
16341
+ platform$1.exports;
16342
+ (function (module, exports) {
16343
+ (function () {
16344
+
16345
+ /** Used to determine if values are of the language type `Object`. */
16346
+ var objectTypes = {
16347
+ 'function': true,
16348
+ 'object': true
16349
+ };
16350
+
16351
+ /** Used as a reference to the global object. */
16352
+ var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$2(window)] && window || this;
16353
+
16354
+ /** Detect free variable `exports`. */
16355
+ var freeExports = exports;
16356
+
16357
+ /** Detect free variable `module`. */
16358
+ var freeModule = module && !module.nodeType && module;
15734
16359
 
15735
- hotkeys.noConflict = function (deep) {
15736
- if (deep && window.hotkeys === hotkeys) {
15737
- window.hotkeys = _hotkeys;
16360
+ /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
16361
+ var freeGlobal = freeExports && freeModule && _typeof$2(commonjsGlobal) == 'object' && commonjsGlobal;
16362
+ if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
16363
+ root = freeGlobal;
15738
16364
  }
15739
16365
 
15740
- return hotkeys;
15741
- };
16366
+ /**
16367
+ * Used as the maximum length of an array-like object.
16368
+ * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
16369
+ * for more details.
16370
+ */
16371
+ var maxSafeInteger = Math.pow(2, 53) - 1;
15742
16372
 
15743
- window.hotkeys = hotkeys;
15744
- }
16373
+ /** Regular expression to detect Opera. */
16374
+ var reOpera = /\bOpera/;
15745
16375
 
15746
- hotkeys.filter = function () {
15747
- return true;
15748
- };
16376
+ /** Used for native method references. */
16377
+ var objectProto = Object.prototype;
15749
16378
 
15750
- var tagFilter = function tagFilter(_ref, enableOnTags) {
15751
- var target = _ref.target;
15752
- var targetTagName = target && target.tagName;
15753
- return Boolean(targetTagName && enableOnTags && enableOnTags.includes(targetTagName));
15754
- };
16379
+ /** Used to check for own properties of an object. */
16380
+ var hasOwnProperty = objectProto.hasOwnProperty;
15755
16381
 
15756
- var isKeyboardEventTriggeredByInput = function isKeyboardEventTriggeredByInput(ev) {
15757
- return tagFilter(ev, ['INPUT', 'TEXTAREA', 'SELECT']);
15758
- };
16382
+ /** Used to resolve the internal `[[Class]]` of values. */
16383
+ var toString = objectProto.toString;
15759
16384
 
15760
- function useHotkeys(keys, callback, options, deps) {
15761
- if (options instanceof Array) {
15762
- deps = options;
15763
- options = undefined;
15764
- }
16385
+ /*--------------------------------------------------------------------------*/
15765
16386
 
15766
- var _ref2 = options || {},
15767
- enableOnTags = _ref2.enableOnTags,
15768
- filter = _ref2.filter,
15769
- keyup = _ref2.keyup,
15770
- keydown = _ref2.keydown,
15771
- _ref2$filterPreventDe = _ref2.filterPreventDefault,
15772
- filterPreventDefault = _ref2$filterPreventDe === void 0 ? true : _ref2$filterPreventDe,
15773
- _ref2$enabled = _ref2.enabled,
15774
- enabled = _ref2$enabled === void 0 ? true : _ref2$enabled,
15775
- _ref2$enableOnContent = _ref2.enableOnContentEditable,
15776
- enableOnContentEditable = _ref2$enableOnContent === void 0 ? false : _ref2$enableOnContent;
16387
+ /**
16388
+ * Capitalizes a string value.
16389
+ *
16390
+ * @private
16391
+ * @param {string} string The string to capitalize.
16392
+ * @returns {string} The capitalized string.
16393
+ */
16394
+ function capitalize(string) {
16395
+ string = String(string);
16396
+ return string.charAt(0).toUpperCase() + string.slice(1);
16397
+ }
15777
16398
 
15778
- var ref = useRef(null); // The return value of this callback determines if the browsers default behavior is prevented.
16399
+ /**
16400
+ * A utility function to clean up the OS name.
16401
+ *
16402
+ * @private
16403
+ * @param {string} os The OS name to clean up.
16404
+ * @param {string} [pattern] A `RegExp` pattern matching the OS name.
16405
+ * @param {string} [label] A label for the OS.
16406
+ */
16407
+ function cleanupOS(os, pattern, label) {
16408
+ // Platform tokens are defined at:
16409
+ // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
16410
+ // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
16411
+ var data = {
16412
+ '10.0': '10',
16413
+ '6.4': '10 Technical Preview',
16414
+ '6.3': '8.1',
16415
+ '6.2': '8',
16416
+ '6.1': 'Server 2008 R2 / 7',
16417
+ '6.0': 'Server 2008 / Vista',
16418
+ '5.2': 'Server 2003 / XP 64-bit',
16419
+ '5.1': 'XP',
16420
+ '5.01': '2000 SP1',
16421
+ '5.0': '2000',
16422
+ '4.0': 'NT',
16423
+ '4.90': 'ME'
16424
+ };
16425
+ // Detect Windows version from platform tokens.
16426
+ if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) && (data = data[/[\d.]+$/.exec(os)])) {
16427
+ os = 'Windows ' + data;
16428
+ }
16429
+ // Correct character case and cleanup string.
16430
+ os = String(os);
16431
+ if (pattern && label) {
16432
+ os = os.replace(RegExp(pattern, 'i'), label);
16433
+ }
16434
+ 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]);
16435
+ return os;
16436
+ }
15779
16437
 
15780
- var memoisedCallback = useCallback(function (keyboardEvent, hotkeysEvent) {
15781
- var _keyboardEvent$target;
16438
+ /**
16439
+ * An iteration utility for arrays and objects.
16440
+ *
16441
+ * @private
16442
+ * @param {Array|Object} object The object to iterate over.
16443
+ * @param {Function} callback The function called per iteration.
16444
+ */
16445
+ function each(object, callback) {
16446
+ var index = -1,
16447
+ length = object ? object.length : 0;
16448
+ if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
16449
+ while (++index < length) {
16450
+ callback(object[index], index, object);
16451
+ }
16452
+ } else {
16453
+ forOwn(object, callback);
16454
+ }
16455
+ }
15782
16456
 
15783
- if (filter && !filter(keyboardEvent)) {
15784
- return !filterPreventDefault;
15785
- } // Check whether the hotkeys was triggered inside an input and that input is enabled or if it was triggered by a content editable tag and it is enabled.
16457
+ /**
16458
+ * Trim and conditionally capitalize string values.
16459
+ *
16460
+ * @private
16461
+ * @param {string} string The string to format.
16462
+ * @returns {string} The formatted string.
16463
+ */
16464
+ function format(string) {
16465
+ string = trim(string);
16466
+ return /^(?:webOS|i(?:OS|P))/.test(string) ? string : capitalize(string);
16467
+ }
15786
16468
 
16469
+ /**
16470
+ * Iterates over an object's own properties, executing the `callback` for each.
16471
+ *
16472
+ * @private
16473
+ * @param {Object} object The object to iterate over.
16474
+ * @param {Function} callback The function executed per own property.
16475
+ */
16476
+ function forOwn(object, callback) {
16477
+ for (var key in object) {
16478
+ if (hasOwnProperty.call(object, key)) {
16479
+ callback(object[key], key, object);
16480
+ }
16481
+ }
16482
+ }
15787
16483
 
15788
- if (isKeyboardEventTriggeredByInput(keyboardEvent) && !tagFilter(keyboardEvent, enableOnTags) || (_keyboardEvent$target = keyboardEvent.target) != null && _keyboardEvent$target.isContentEditable && !enableOnContentEditable) {
15789
- return true;
16484
+ /**
16485
+ * Gets the internal `[[Class]]` of a value.
16486
+ *
16487
+ * @private
16488
+ * @param {*} value The value.
16489
+ * @returns {string} The `[[Class]]`.
16490
+ */
16491
+ function getClassOf(value) {
16492
+ return value == null ? capitalize(value) : toString.call(value).slice(8, -1);
15790
16493
  }
15791
16494
 
15792
- if (ref.current === null || document.activeElement === ref.current) {
15793
- callback(keyboardEvent, hotkeysEvent);
15794
- return true;
16495
+ /**
16496
+ * Host objects can return type values that are different from their actual
16497
+ * data type. The objects we are concerned with usually return non-primitive
16498
+ * types of "object", "function", or "unknown".
16499
+ *
16500
+ * @private
16501
+ * @param {*} object The owner of the property.
16502
+ * @param {string} property The property to check.
16503
+ * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
16504
+ */
16505
+ function isHostType(object, property) {
16506
+ var type = object != null ? _typeof$2(object[property]) : 'number';
16507
+ return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true);
15795
16508
  }
15796
16509
 
15797
- return false;
15798
- }, deps ? [ref, enableOnTags, filter].concat(deps) : [ref, enableOnTags, filter]);
15799
- useEffect(function () {
15800
- if (!enabled) {
15801
- return;
15802
- } // In this case keydown is likely undefined, so we set it to false, since hotkeys needs the `keydown` key to have a value.
16510
+ /**
16511
+ * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
16512
+ *
16513
+ * @private
16514
+ * @param {string} string The string to qualify.
16515
+ * @returns {string} The qualified string.
16516
+ */
16517
+ function qualify(string) {
16518
+ return String(string).replace(/([ -])(?!$)/g, '$1?');
16519
+ }
15803
16520
 
16521
+ /**
16522
+ * A bare-bones `Array#reduce` like utility function.
16523
+ *
16524
+ * @private
16525
+ * @param {Array} array The array to iterate over.
16526
+ * @param {Function} callback The function called per iteration.
16527
+ * @returns {*} The accumulated result.
16528
+ */
16529
+ function reduce(array, callback) {
16530
+ var accumulator = null;
16531
+ each(array, function (value, index) {
16532
+ accumulator = callback(accumulator, value, index, array);
16533
+ });
16534
+ return accumulator;
16535
+ }
15804
16536
 
15805
- if (keyup && keydown !== true) {
15806
- options.keydown = false;
16537
+ /**
16538
+ * Removes leading and trailing whitespace from a string.
16539
+ *
16540
+ * @private
16541
+ * @param {string} string The string to trim.
16542
+ * @returns {string} The trimmed string.
16543
+ */
16544
+ function trim(string) {
16545
+ return String(string).replace(/^ +| +$/g, '');
15807
16546
  }
15808
16547
 
15809
- hotkeys(keys, options || {}, memoisedCallback);
16548
+ /*--------------------------------------------------------------------------*/
16549
+
16550
+ /**
16551
+ * Creates a new platform object.
16552
+ *
16553
+ * @memberOf platform
16554
+ * @param {Object|string} [ua=navigator.userAgent] The user agent string or
16555
+ * context object.
16556
+ * @returns {Object} A platform object.
16557
+ */
16558
+ function parse(ua) {
16559
+ /** The environment context object. */
16560
+ var context = root;
16561
+
16562
+ /** Used to flag when a custom context is provided. */
16563
+ var isCustomContext = ua && _typeof$2(ua) == 'object' && getClassOf(ua) != 'String';
16564
+
16565
+ // Juggle arguments.
16566
+ if (isCustomContext) {
16567
+ context = ua;
16568
+ ua = null;
16569
+ }
16570
+
16571
+ /** Browser navigator object. */
16572
+ var nav = context.navigator || {};
16573
+
16574
+ /** Browser user agent string. */
16575
+ var userAgent = nav.userAgent || '';
16576
+ ua || (ua = userAgent);
16577
+
16578
+ /** Used to detect if browser is like Chrome. */
16579
+ var likeChrome = isCustomContext ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
16580
+
16581
+ /** Internal `[[Class]]` value shortcuts. */
16582
+ var objectClass = 'Object',
16583
+ airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
16584
+ enviroClass = isCustomContext ? objectClass : 'Environment',
16585
+ javaClass = isCustomContext && context.java ? 'JavaPackage' : getClassOf(context.java),
16586
+ phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
16587
+
16588
+ /** Detect Java environments. */
16589
+ var java = /\bJava/.test(javaClass) && context.java;
16590
+
16591
+ /** Detect Rhino. */
16592
+ var rhino = java && getClassOf(context.environment) == enviroClass;
16593
+
16594
+ /** A character to represent alpha. */
16595
+ var alpha = java ? 'a' : "\u03B1";
16596
+
16597
+ /** A character to represent beta. */
16598
+ var beta = java ? 'b' : "\u03B2";
16599
+
16600
+ /** Browser document object. */
16601
+ var doc = context.document || {};
16602
+
16603
+ /**
16604
+ * Detect Opera browser (Presto-based).
16605
+ * http://www.howtocreate.co.uk/operaStuff/operaObject.html
16606
+ * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
16607
+ */
16608
+ var opera = context.operamini || context.opera;
16609
+
16610
+ /** Opera `[[Class]]`. */
16611
+ var operaClass = reOpera.test(operaClass = isCustomContext && opera ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : opera = null;
16612
+
16613
+ /*------------------------------------------------------------------------*/
16614
+
16615
+ /** Temporary variable used over the script's lifetime. */
16616
+ var data;
16617
+
16618
+ /** The CPU architecture. */
16619
+ var arch = ua;
16620
+
16621
+ /** Platform description array. */
16622
+ var description = [];
16623
+
16624
+ /** Platform alpha/beta indicator. */
16625
+ var prerelease = null;
16626
+
16627
+ /** A flag to indicate that environment features should be used to resolve the platform. */
16628
+ var useFeatures = ua == userAgent;
16629
+
16630
+ /** The browser/environment version. */
16631
+ var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
16632
+
16633
+ /** A flag to indicate if the OS ends with "/ Version" */
16634
+ var isSpecialCasedOS;
16635
+
16636
+ /* Detectable layout engines (order is important). */
16637
+ var layout = getLayout([{
16638
+ 'label': 'EdgeHTML',
16639
+ 'pattern': 'Edge'
16640
+ }, 'Trident', {
16641
+ 'label': 'WebKit',
16642
+ 'pattern': 'AppleWebKit'
16643
+ }, 'iCab', 'Presto', 'NetFront', 'Tasman', 'KHTML', 'Gecko']);
16644
+
16645
+ /* Detectable browser names (order is important). */
16646
+ var name = getName(['Adobe AIR', 'Arora', 'Avant Browser', 'Breach', 'Camino', 'Electron', 'Epiphany', 'Fennec', 'Flock', 'Galeon', 'GreenBrowser', 'iCab', 'Iceweasel', 'K-Meleon', 'Konqueror', 'Lunascape', 'Maxthon', {
16647
+ 'label': 'Microsoft Edge',
16648
+ 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)'
16649
+ }, 'Midori', 'Nook Browser', 'PaleMoon', 'PhantomJS', 'Raven', 'Rekonq', 'RockMelt', {
16650
+ 'label': 'Samsung Internet',
16651
+ 'pattern': 'SamsungBrowser'
16652
+ }, 'SeaMonkey', {
16653
+ 'label': 'Silk',
16654
+ 'pattern': '(?:Cloud9|Silk-Accelerated)'
16655
+ }, 'Sleipnir', 'SlimBrowser', {
16656
+ 'label': 'SRWare Iron',
16657
+ 'pattern': 'Iron'
16658
+ }, 'Sunrise', 'Swiftfox', 'Vivaldi', 'Waterfox', 'WebPositive', {
16659
+ 'label': 'Yandex Browser',
16660
+ 'pattern': 'YaBrowser'
16661
+ }, {
16662
+ 'label': 'UC Browser',
16663
+ 'pattern': 'UCBrowser'
16664
+ }, 'Opera Mini', {
16665
+ 'label': 'Opera Mini',
16666
+ 'pattern': 'OPiOS'
16667
+ }, 'Opera', {
16668
+ 'label': 'Opera',
16669
+ 'pattern': 'OPR'
16670
+ }, 'Chromium', 'Chrome', {
16671
+ 'label': 'Chrome',
16672
+ 'pattern': '(?:HeadlessChrome)'
16673
+ }, {
16674
+ 'label': 'Chrome Mobile',
16675
+ 'pattern': '(?:CriOS|CrMo)'
16676
+ }, {
16677
+ 'label': 'Firefox',
16678
+ 'pattern': '(?:Firefox|Minefield)'
16679
+ }, {
16680
+ 'label': 'Firefox for iOS',
16681
+ 'pattern': 'FxiOS'
16682
+ }, {
16683
+ 'label': 'IE',
16684
+ 'pattern': 'IEMobile'
16685
+ }, {
16686
+ 'label': 'IE',
16687
+ 'pattern': 'MSIE'
16688
+ }, 'Safari']);
16689
+
16690
+ /* Detectable products (order is important). */
16691
+ var product = getProduct([{
16692
+ 'label': 'BlackBerry',
16693
+ 'pattern': 'BB10'
16694
+ }, 'BlackBerry', {
16695
+ 'label': 'Galaxy S',
16696
+ 'pattern': 'GT-I9000'
16697
+ }, {
16698
+ 'label': 'Galaxy S2',
16699
+ 'pattern': 'GT-I9100'
16700
+ }, {
16701
+ 'label': 'Galaxy S3',
16702
+ 'pattern': 'GT-I9300'
16703
+ }, {
16704
+ 'label': 'Galaxy S4',
16705
+ 'pattern': 'GT-I9500'
16706
+ }, {
16707
+ 'label': 'Galaxy S5',
16708
+ 'pattern': 'SM-G900'
16709
+ }, {
16710
+ 'label': 'Galaxy S6',
16711
+ 'pattern': 'SM-G920'
16712
+ }, {
16713
+ 'label': 'Galaxy S6 Edge',
16714
+ 'pattern': 'SM-G925'
16715
+ }, {
16716
+ 'label': 'Galaxy S7',
16717
+ 'pattern': 'SM-G930'
16718
+ }, {
16719
+ 'label': 'Galaxy S7 Edge',
16720
+ 'pattern': 'SM-G935'
16721
+ }, 'Google TV', 'Lumia', 'iPad', 'iPod', 'iPhone', 'Kindle', {
16722
+ 'label': 'Kindle Fire',
16723
+ 'pattern': '(?:Cloud9|Silk-Accelerated)'
16724
+ }, 'Nexus', 'Nook', 'PlayBook', 'PlayStation Vita', 'PlayStation', 'TouchPad', 'Transformer', {
16725
+ 'label': 'Wii U',
16726
+ 'pattern': 'WiiU'
16727
+ }, 'Wii', 'Xbox One', {
16728
+ 'label': 'Xbox 360',
16729
+ 'pattern': 'Xbox'
16730
+ }, 'Xoom']);
16731
+
16732
+ /* Detectable manufacturers. */
16733
+ var manufacturer = getManufacturer({
16734
+ 'Apple': {
16735
+ 'iPad': 1,
16736
+ 'iPhone': 1,
16737
+ 'iPod': 1
16738
+ },
16739
+ 'Alcatel': {},
16740
+ 'Archos': {},
16741
+ 'Amazon': {
16742
+ 'Kindle': 1,
16743
+ 'Kindle Fire': 1
16744
+ },
16745
+ 'Asus': {
16746
+ 'Transformer': 1
16747
+ },
16748
+ 'Barnes & Noble': {
16749
+ 'Nook': 1
16750
+ },
16751
+ 'BlackBerry': {
16752
+ 'PlayBook': 1
16753
+ },
16754
+ 'Google': {
16755
+ 'Google TV': 1,
16756
+ 'Nexus': 1
16757
+ },
16758
+ 'HP': {
16759
+ 'TouchPad': 1
16760
+ },
16761
+ 'HTC': {},
16762
+ 'Huawei': {},
16763
+ 'Lenovo': {},
16764
+ 'LG': {},
16765
+ 'Microsoft': {
16766
+ 'Xbox': 1,
16767
+ 'Xbox One': 1
16768
+ },
16769
+ 'Motorola': {
16770
+ 'Xoom': 1
16771
+ },
16772
+ 'Nintendo': {
16773
+ 'Wii U': 1,
16774
+ 'Wii': 1
16775
+ },
16776
+ 'Nokia': {
16777
+ 'Lumia': 1
16778
+ },
16779
+ 'Oppo': {},
16780
+ 'Samsung': {
16781
+ 'Galaxy S': 1,
16782
+ 'Galaxy S2': 1,
16783
+ 'Galaxy S3': 1,
16784
+ 'Galaxy S4': 1
16785
+ },
16786
+ 'Sony': {
16787
+ 'PlayStation': 1,
16788
+ 'PlayStation Vita': 1
16789
+ },
16790
+ 'Xiaomi': {
16791
+ 'Mi': 1,
16792
+ 'Redmi': 1
16793
+ }
16794
+ });
16795
+
16796
+ /* Detectable operating systems (order is important). */
16797
+ var os = getOS(['Windows Phone', 'KaiOS', 'Android', 'CentOS', {
16798
+ 'label': 'Chrome OS',
16799
+ 'pattern': 'CrOS'
16800
+ }, 'Debian', {
16801
+ 'label': 'DragonFly BSD',
16802
+ 'pattern': 'DragonFly'
16803
+ }, '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 ']);
16804
+
16805
+ /*------------------------------------------------------------------------*/
16806
+
16807
+ /**
16808
+ * Picks the layout engine from an array of guesses.
16809
+ *
16810
+ * @private
16811
+ * @param {Array} guesses An array of guesses.
16812
+ * @returns {null|string} The detected layout engine.
16813
+ */
16814
+ function getLayout(guesses) {
16815
+ return reduce(guesses, function (result, guess) {
16816
+ return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess);
16817
+ });
16818
+ }
16819
+
16820
+ /**
16821
+ * Picks the manufacturer from an array of guesses.
16822
+ *
16823
+ * @private
16824
+ * @param {Array} guesses An object of guesses.
16825
+ * @returns {null|string} The detected manufacturer.
16826
+ */
16827
+ function getManufacturer(guesses) {
16828
+ return reduce(guesses, function (result, value, key) {
16829
+ // Lookup the manufacturer by product or scan the UA for the manufacturer.
16830
+ return result || (value[product] || value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] || RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)) && key;
16831
+ });
16832
+ }
16833
+
16834
+ /**
16835
+ * Picks the browser name from an array of guesses.
16836
+ *
16837
+ * @private
16838
+ * @param {Array} guesses An array of guesses.
16839
+ * @returns {null|string} The detected browser name.
16840
+ */
16841
+ function getName(guesses) {
16842
+ return reduce(guesses, function (result, guess) {
16843
+ return result || RegExp('\\b' + (guess.pattern || qualify(guess)) + '\\b', 'i').exec(ua) && (guess.label || guess);
16844
+ });
16845
+ }
16846
+
16847
+ /**
16848
+ * Picks the OS name from an array of guesses.
16849
+ *
16850
+ * @private
16851
+ * @param {Array} guesses An array of guesses.
16852
+ * @returns {null|string} The detected OS name.
16853
+ */
16854
+ function getOS(guesses) {
16855
+ return reduce(guesses, function (result, guess) {
16856
+ var pattern = guess.pattern || qualify(guess);
16857
+ if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua))) {
16858
+ result = cleanupOS(result, pattern, guess.label || guess);
16859
+ }
16860
+ return result;
16861
+ });
16862
+ }
16863
+
16864
+ /**
16865
+ * Picks the product name from an array of guesses.
16866
+ *
16867
+ * @private
16868
+ * @param {Array} guesses An array of guesses.
16869
+ * @returns {null|string} The detected product name.
16870
+ */
16871
+ function getProduct(guesses) {
16872
+ return reduce(guesses, function (result, guess) {
16873
+ var pattern = guess.pattern || qualify(guess);
16874
+ 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))) {
16875
+ // Split by forward slash and append product version if needed.
16876
+ if ((result = String(guess.label && !RegExp(pattern, 'i').test(guess.label) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
16877
+ result[0] += ' ' + result[1];
16878
+ }
16879
+ // Correct character case and cleanup string.
16880
+ guess = guess.label || guess;
16881
+ result = format(result[0].replace(RegExp(pattern, 'i'), guess).replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ').replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
16882
+ }
16883
+ return result;
16884
+ });
16885
+ }
16886
+
16887
+ /**
16888
+ * Resolves the version using an array of UA patterns.
16889
+ *
16890
+ * @private
16891
+ * @param {Array} patterns An array of UA patterns.
16892
+ * @returns {null|string} The detected version.
16893
+ */
16894
+ function getVersion(patterns) {
16895
+ return reduce(patterns, function (result, pattern) {
16896
+ return result || (RegExp(pattern + '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
16897
+ });
16898
+ }
16899
+
16900
+ /**
16901
+ * Returns `platform.description` when the platform object is coerced to a string.
16902
+ *
16903
+ * @name toString
16904
+ * @memberOf platform
16905
+ * @returns {string} Returns `platform.description` if available, else an empty string.
16906
+ */
16907
+ function toStringPlatform() {
16908
+ return this.description || '';
16909
+ }
16910
+
16911
+ /*------------------------------------------------------------------------*/
16912
+
16913
+ // Convert layout to an array so we can add extra details.
16914
+ layout && (layout = [layout]);
16915
+
16916
+ // Detect Android products.
16917
+ // Browsers on Android devices typically provide their product IDS after "Android;"
16918
+ // up to "Build" or ") AppleWebKit".
16919
+ // Example:
16920
+ // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
16921
+ // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
16922
+ if (/\bAndroid\b/.test(os) && !product && (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
16923
+ product = trim(data[1])
16924
+ // Replace any language codes (eg. "en-US").
16925
+ .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') || null;
16926
+ }
16927
+ // Detect product names that contain their manufacturer's name.
16928
+ if (manufacturer && !product) {
16929
+ product = getProduct([manufacturer]);
16930
+ } else if (manufacturer && product) {
16931
+ product = product.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ').replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
16932
+ }
16933
+ // Clean up Google TV.
16934
+ if (data = /\bGoogle TV\b/.exec(product)) {
16935
+ product = data[0];
16936
+ }
16937
+ // Detect simulators.
16938
+ if (/\bSimulator\b/i.test(ua)) {
16939
+ product = (product ? product + ' ' : '') + 'Simulator';
16940
+ }
16941
+ // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
16942
+ if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
16943
+ description.push('running in Turbo/Uncompressed mode');
16944
+ }
16945
+ // Detect IE Mobile 11.
16946
+ if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
16947
+ data = parse(ua.replace(/like iPhone OS/, ''));
16948
+ manufacturer = data.manufacturer;
16949
+ product = data.product;
16950
+ }
16951
+ // Detect iOS.
16952
+ else if (/^iP/.test(product)) {
16953
+ name || (name = 'Safari');
16954
+ os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) ? ' ' + data[1].replace(/_/g, '.') : '');
16955
+ }
16956
+ // Detect Kubuntu.
16957
+ else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
16958
+ os = 'Kubuntu';
16959
+ }
16960
+ // Detect Android browsers.
16961
+ 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)) {
16962
+ name = 'Android Browser';
16963
+ os = /\bAndroid\b/.test(os) ? os : 'Android';
16964
+ }
16965
+ // Detect Silk desktop/accelerated modes.
16966
+ else if (name == 'Silk') {
16967
+ if (!/\bMobi/i.test(ua)) {
16968
+ os = 'Android';
16969
+ description.unshift('desktop mode');
16970
+ }
16971
+ if (/Accelerated *= *true/i.test(ua)) {
16972
+ description.unshift('accelerated');
16973
+ }
16974
+ }
16975
+ // Detect UC Browser speed mode.
16976
+ else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
16977
+ description.push('speed mode');
16978
+ }
16979
+ // Detect PaleMoon identifying as Firefox.
16980
+ else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
16981
+ description.push('identifying as Firefox ' + data[1]);
16982
+ }
16983
+ // Detect Firefox OS and products running Firefox.
16984
+ else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
16985
+ os || (os = 'Firefox OS');
16986
+ product || (product = data[1]);
16987
+ }
16988
+ // Detect false positives for Firefox/Safari.
16989
+ else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
16990
+ // Escape the `/` for Firefox 1.
16991
+ if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
16992
+ // Clear name of false positives.
16993
+ name = null;
16994
+ }
16995
+ // Reassign a generic name.
16996
+ if ((data = product || manufacturer || os) && (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
16997
+ name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
16998
+ }
16999
+ }
17000
+ // Add Chrome version to description for Electron.
17001
+ else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
17002
+ description.push('Chromium ' + data);
17003
+ }
17004
+ // Detect non-Opera (Presto-based) versions (order is important).
17005
+ if (!version) {
17006
+ 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)']);
17007
+ }
17008
+ // Detect stubborn layout engines.
17009
+ 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') {
17010
+ layout = [data];
17011
+ }
17012
+ // Detect Windows Phone 7 desktop mode.
17013
+ if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
17014
+ name += ' Mobile';
17015
+ os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
17016
+ description.unshift('desktop mode');
17017
+ }
17018
+ // Detect Windows Phone 8.x desktop mode.
17019
+ else if (/\bWPDesktop\b/i.test(ua)) {
17020
+ name = 'IE Mobile';
17021
+ os = 'Windows Phone 8.x';
17022
+ description.unshift('desktop mode');
17023
+ version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
17024
+ }
17025
+ // Detect IE 11 identifying as other browsers.
17026
+ else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
17027
+ if (name) {
17028
+ description.push('identifying as ' + name + (version ? ' ' + version : ''));
17029
+ }
17030
+ name = 'IE';
17031
+ version = data[1];
17032
+ }
17033
+ // Leverage environment features.
17034
+ if (useFeatures) {
17035
+ // Detect server-side environments.
17036
+ // Rhino has a global function while others have a global object.
17037
+ if (isHostType(context, 'global')) {
17038
+ if (java) {
17039
+ data = java.lang.System;
17040
+ arch = data.getProperty('os.arch');
17041
+ os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
17042
+ }
17043
+ if (rhino) {
17044
+ try {
17045
+ version = context.require('ringo/engine').version.join('.');
17046
+ name = 'RingoJS';
17047
+ } catch (e) {
17048
+ if ((data = context.system) && data.global.system == context.system) {
17049
+ name = 'Narwhal';
17050
+ os || (os = data[0].os || null);
17051
+ }
17052
+ }
17053
+ if (!name) {
17054
+ name = 'Rhino';
17055
+ }
17056
+ } else if (_typeof$2(context.process) == 'object' && !context.process.browser && (data = context.process)) {
17057
+ if (_typeof$2(data.versions) == 'object') {
17058
+ if (typeof data.versions.electron == 'string') {
17059
+ description.push('Node ' + data.versions.node);
17060
+ name = 'Electron';
17061
+ version = data.versions.electron;
17062
+ } else if (typeof data.versions.nw == 'string') {
17063
+ description.push('Chromium ' + version, 'Node ' + data.versions.node);
17064
+ name = 'NW.js';
17065
+ version = data.versions.nw;
17066
+ }
17067
+ }
17068
+ if (!name) {
17069
+ name = 'Node.js';
17070
+ arch = data.arch;
17071
+ os = data.platform;
17072
+ version = /[\d.]+/.exec(data.version);
17073
+ version = version ? version[0] : null;
17074
+ }
17075
+ }
17076
+ }
17077
+ // Detect Adobe AIR.
17078
+ else if (getClassOf(data = context.runtime) == airRuntimeClass) {
17079
+ name = 'Adobe AIR';
17080
+ os = data.flash.system.Capabilities.os;
17081
+ }
17082
+ // Detect PhantomJS.
17083
+ else if (getClassOf(data = context.phantom) == phantomClass) {
17084
+ name = 'PhantomJS';
17085
+ version = (data = data.version || null) && data.major + '.' + data.minor + '.' + data.patch;
17086
+ }
17087
+ // Detect IE compatibility modes.
17088
+ else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
17089
+ // We're in compatibility mode when the Trident version + 4 doesn't
17090
+ // equal the document mode.
17091
+ version = [version, doc.documentMode];
17092
+ if ((data = +data[1] + 4) != version[1]) {
17093
+ description.push('IE ' + version[1] + ' mode');
17094
+ layout && (layout[1] = '');
17095
+ version[1] = data;
17096
+ }
17097
+ version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
17098
+ }
17099
+ // Detect IE 11 masking as other browsers.
17100
+ else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
17101
+ description.push('masking as ' + name + ' ' + version);
17102
+ name = 'IE';
17103
+ version = '11.0';
17104
+ layout = ['Trident'];
17105
+ os = 'Windows';
17106
+ }
17107
+ os = os && format(os);
17108
+ }
17109
+ // Detect prerelease phases.
17110
+ 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')) {
17111
+ prerelease = /b/i.test(data) ? 'beta' : 'alpha';
17112
+ version = version.replace(RegExp(data + '\\+?$'), '') + (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
17113
+ }
17114
+ // Detect Firefox Mobile.
17115
+ if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
17116
+ name = 'Firefox Mobile';
17117
+ }
17118
+ // Obscure Maxthon's unreliable version.
17119
+ else if (name == 'Maxthon' && version) {
17120
+ version = version.replace(/\.[\d.]+/, '.x');
17121
+ }
17122
+ // Detect Xbox 360 and Xbox One.
17123
+ else if (/\bXbox\b/i.test(product)) {
17124
+ if (product == 'Xbox 360') {
17125
+ os = null;
17126
+ }
17127
+ if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
17128
+ description.unshift('mobile mode');
17129
+ }
17130
+ }
17131
+ // Add mobile postfix.
17132
+ else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) {
17133
+ name += ' Mobile';
17134
+ }
17135
+ // Detect IE platform preview.
17136
+ else if (name == 'IE' && useFeatures) {
17137
+ try {
17138
+ if (context.external === null) {
17139
+ description.unshift('platform preview');
17140
+ }
17141
+ } catch (e) {
17142
+ description.unshift('embedded');
17143
+ }
17144
+ }
17145
+ // Detect BlackBerry OS version.
17146
+ // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
17147
+ else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || version)) {
17148
+ data = [data, /BB10/.test(ua)];
17149
+ os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
17150
+ version = null;
17151
+ }
17152
+ // Detect Opera identifying/masking itself as another browser.
17153
+ // http://www.opera.com/support/kb/view/843/
17154
+ 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) {
17155
+ // When "identifying", the UA contains both Opera and the other browser's name.
17156
+ data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
17157
+ if (reOpera.test(name)) {
17158
+ if (/\bIE\b/.test(data) && os == 'Mac OS') {
17159
+ os = null;
17160
+ }
17161
+ data = 'identify' + data;
17162
+ }
17163
+ // When "masking", the UA contains only the other browser's name.
17164
+ else {
17165
+ data = 'mask' + data;
17166
+ if (operaClass) {
17167
+ name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
17168
+ } else {
17169
+ name = 'Opera';
17170
+ }
17171
+ if (/\bIE\b/.test(data)) {
17172
+ os = null;
17173
+ }
17174
+ if (!useFeatures) {
17175
+ version = null;
17176
+ }
17177
+ }
17178
+ layout = ['Presto'];
17179
+ description.push(data);
17180
+ }
17181
+ // Detect WebKit Nightly and approximate Chrome/Safari versions.
17182
+ if (data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1]) {
17183
+ // Correct build number for numeric comparison.
17184
+ // (e.g. "532.5" becomes "532.05")
17185
+ data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
17186
+ // Nightly builds are postfixed with a "+".
17187
+ if (name == 'Safari' && data[1].slice(-1) == '+') {
17188
+ name = 'WebKit Nightly';
17189
+ prerelease = 'alpha';
17190
+ version = data[1].slice(0, -1);
17191
+ }
17192
+ // Clear incorrect browser versions.
17193
+ else if (version == data[1] || version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
17194
+ version = null;
17195
+ }
17196
+ // Use the full Chrome version when available.
17197
+ data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
17198
+ // Detect Blink layout engine.
17199
+ if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
17200
+ layout = ['Blink'];
17201
+ }
17202
+ // Detect JavaScriptCore.
17203
+ // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
17204
+ if (!useFeatures || !likeChrome && !data[1]) {
17205
+ layout && (layout[1] = 'like Safari');
17206
+ 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');
17207
+ } else {
17208
+ layout && (layout[1] = 'like Chrome');
17209
+ 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');
17210
+ }
17211
+ // Add the postfix of ".x" or "+" for approximate versions.
17212
+ layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
17213
+ // Obscure version for some Safari 1-2 releases.
17214
+ if (name == 'Safari' && (!version || parseInt(version) > 45)) {
17215
+ version = data;
17216
+ } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
17217
+ description.unshift('headless');
17218
+ }
17219
+ }
17220
+ // Detect Opera desktop modes.
17221
+ if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
17222
+ name += ' ';
17223
+ description.unshift('desktop mode');
17224
+ if (data == 'zvav') {
17225
+ name += 'Mini';
17226
+ version = null;
17227
+ } else {
17228
+ name += 'Mobile';
17229
+ }
17230
+ os = os.replace(RegExp(' *' + data + '$'), '');
17231
+ }
17232
+ // Detect Chrome desktop mode.
17233
+ else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
17234
+ description.unshift('desktop mode');
17235
+ name = 'Chrome Mobile';
17236
+ version = null;
17237
+ if (/\bOS X\b/.test(os)) {
17238
+ manufacturer = 'Apple';
17239
+ os = 'iOS 4.3+';
17240
+ } else {
17241
+ os = null;
17242
+ }
17243
+ }
17244
+ // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
17245
+ else if (/\bSRWare Iron\b/.test(name) && !version) {
17246
+ version = getVersion('Chrome');
17247
+ }
17248
+ // Strip incorrect OS versions.
17249
+ if (version && version.indexOf(data = /[\d.]+$/.exec(os)) == 0 && ua.indexOf('/' + data + '-') > -1) {
17250
+ os = trim(os.replace(data, ''));
17251
+ }
17252
+ // Ensure OS does not include the browser name.
17253
+ if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
17254
+ os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
17255
+ }
17256
+ // Add layout engine.
17257
+ 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])) {
17258
+ // Don't add layout details to description if they are falsey.
17259
+ (data = layout[layout.length - 1]) && description.push(data);
17260
+ }
17261
+ // Combine contextual information.
17262
+ if (description.length) {
17263
+ description = ['(' + description.join('; ') + ')'];
17264
+ }
17265
+ // Append manufacturer to description.
17266
+ if (manufacturer && product && product.indexOf(manufacturer) < 0) {
17267
+ description.push('on ' + manufacturer);
17268
+ }
17269
+ // Append product to description.
17270
+ if (product) {
17271
+ description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
17272
+ }
17273
+ // Parse the OS into an object.
17274
+ if (os) {
17275
+ data = / ([\d.+]+)$/.exec(os);
17276
+ isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
17277
+ os = {
17278
+ 'architecture': 32,
17279
+ 'family': data && !isSpecialCasedOS ? os.replace(data[0], '') : os,
17280
+ 'version': data ? data[1] : null,
17281
+ 'toString': function toString() {
17282
+ var version = this.version;
17283
+ return this.family + (version && !isSpecialCasedOS ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
17284
+ }
17285
+ };
17286
+ }
17287
+ // Add browser/OS architecture.
17288
+ if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
17289
+ if (os) {
17290
+ os.architecture = 64;
17291
+ os.family = os.family.replace(RegExp(' *' + data), '');
17292
+ }
17293
+ if (name && (/\bWOW64\b/i.test(ua) || useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) {
17294
+ description.unshift('32-bit');
17295
+ }
17296
+ }
17297
+ // Chrome 39 and above on OS X is always 64-bit.
17298
+ else if (os && /^OS X/.test(os.family) && name == 'Chrome' && parseFloat(version) >= 39) {
17299
+ os.architecture = 64;
17300
+ }
17301
+ ua || (ua = null);
17302
+
17303
+ /*------------------------------------------------------------------------*/
17304
+
17305
+ /**
17306
+ * The platform object.
17307
+ *
17308
+ * @name platform
17309
+ * @type Object
17310
+ */
17311
+ var platform = {};
17312
+
17313
+ /**
17314
+ * The platform description.
17315
+ *
17316
+ * @memberOf platform
17317
+ * @type string|null
17318
+ */
17319
+ platform.description = ua;
17320
+
17321
+ /**
17322
+ * The name of the browser's layout engine.
17323
+ *
17324
+ * The list of common layout engines include:
17325
+ * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
17326
+ *
17327
+ * @memberOf platform
17328
+ * @type string|null
17329
+ */
17330
+ platform.layout = layout && layout[0];
17331
+
17332
+ /**
17333
+ * The name of the product's manufacturer.
17334
+ *
17335
+ * The list of manufacturers include:
17336
+ * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
17337
+ * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
17338
+ * "Nokia", "Samsung" and "Sony"
17339
+ *
17340
+ * @memberOf platform
17341
+ * @type string|null
17342
+ */
17343
+ platform.manufacturer = manufacturer;
17344
+
17345
+ /**
17346
+ * The name of the browser/environment.
17347
+ *
17348
+ * The list of common browser names include:
17349
+ * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
17350
+ * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
17351
+ * "Opera Mini" and "Opera"
17352
+ *
17353
+ * Mobile versions of some browsers have "Mobile" appended to their name:
17354
+ * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
17355
+ *
17356
+ * @memberOf platform
17357
+ * @type string|null
17358
+ */
17359
+ platform.name = name;
17360
+
17361
+ /**
17362
+ * The alpha/beta release indicator.
17363
+ *
17364
+ * @memberOf platform
17365
+ * @type string|null
17366
+ */
17367
+ platform.prerelease = prerelease;
17368
+
17369
+ /**
17370
+ * The name of the product hosting the browser.
17371
+ *
17372
+ * The list of common products include:
17373
+ *
17374
+ * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
17375
+ * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
17376
+ *
17377
+ * @memberOf platform
17378
+ * @type string|null
17379
+ */
17380
+ platform.product = product;
17381
+
17382
+ /**
17383
+ * The browser's user agent string.
17384
+ *
17385
+ * @memberOf platform
17386
+ * @type string|null
17387
+ */
17388
+ platform.ua = ua;
17389
+
17390
+ /**
17391
+ * The browser/environment version.
17392
+ *
17393
+ * @memberOf platform
17394
+ * @type string|null
17395
+ */
17396
+ platform.version = name && version;
17397
+
17398
+ /**
17399
+ * The name of the operating system.
17400
+ *
17401
+ * @memberOf platform
17402
+ * @type Object
17403
+ */
17404
+ platform.os = os || {
17405
+ /**
17406
+ * The CPU architecture the OS is built for.
17407
+ *
17408
+ * @memberOf platform.os
17409
+ * @type number|null
17410
+ */
17411
+ 'architecture': null,
17412
+ /**
17413
+ * The family of the OS.
17414
+ *
17415
+ * Common values include:
17416
+ * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
17417
+ * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
17418
+ * "SuSE", "Android", "iOS" and "Windows Phone"
17419
+ *
17420
+ * @memberOf platform.os
17421
+ * @type string|null
17422
+ */
17423
+ 'family': null,
17424
+ /**
17425
+ * The version of the OS.
17426
+ *
17427
+ * @memberOf platform.os
17428
+ * @type string|null
17429
+ */
17430
+ 'version': null,
17431
+ /**
17432
+ * Returns the OS string.
17433
+ *
17434
+ * @memberOf platform.os
17435
+ * @returns {string} The OS string.
17436
+ */
17437
+ 'toString': function toString() {
17438
+ return 'null';
17439
+ }
17440
+ };
17441
+ platform.parse = parse;
17442
+ platform.toString = toStringPlatform;
17443
+ if (platform.version) {
17444
+ description.unshift(version);
17445
+ }
17446
+ if (platform.name) {
17447
+ description.unshift(name);
17448
+ }
17449
+ if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
17450
+ description.push(product ? '(' + os + ')' : 'on ' + os);
17451
+ }
17452
+ if (description.length) {
17453
+ platform.description = description.join(' ');
17454
+ }
17455
+ return platform;
17456
+ }
17457
+
17458
+ /*--------------------------------------------------------------------------*/
17459
+
17460
+ // Export platform.
17461
+ var platform = parse();
17462
+
17463
+ // Some AMD build optimizers, like r.js, check for condition patterns like the following:
17464
+ if (freeExports && freeModule) {
17465
+ // Export for CommonJS support.
17466
+ forOwn(platform, function (value, key) {
17467
+ freeExports[key] = value;
17468
+ });
17469
+ } else {
17470
+ // Export to the global object.
17471
+ root.platform = platform;
17472
+ }
17473
+ }).call(commonjsGlobal);
17474
+ })(platform$1, platform$1.exports);
17475
+ var platformExports = platform$1.exports;
17476
+ var platform = /*@__PURE__*/getDefaultExportFromCjs(platformExports);
17477
+
17478
+ var isMultipleHotkey = Array.isArray;
17479
+ var replaceKeys = function replaceKeys(hotkey, keyName, replaceWith) {
17480
+ return isMultipleHotkey(hotkey) ? hotkey.map(function (item) {
17481
+ return item.replaceAll(keyName, replaceWith);
17482
+ }) : hotkey.replaceAll(keyName, replaceWith);
17483
+ };
17484
+ var convertHotKeyToWindows = function convertHotKeyToWindows(hotkey) {
17485
+ toPairs(MAC_TO_WINDOWS_KEYS_MAP).forEach(function (_ref) {
17486
+ var _ref2 = _slicedToArray$1(_ref, 2),
17487
+ macKey = _ref2[0],
17488
+ windowsKey = _ref2[1];
17489
+ hotkey = replaceKeys(hotkey, macKey, windowsKey);
17490
+ });
17491
+ return hotkey;
17492
+ };
17493
+ var convertHotkeyToUsersPlatform = function convertHotkeyToUsersPlatform(hotkey) {
17494
+ var _platformInfo$os;
17495
+ var platformInfo = platform.parse(navigator.userAgent);
17496
+ 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);
17497
+ if (isOSX) return replaceKeys(hotkey, KEY_NAMES["delete"], KEY_NAMES.backspace);
17498
+ return convertHotKeyToWindows(hotkey);
17499
+ };
17500
+ var bindHotKey = function bindHotKey(_ref3) {
17501
+ var mode = _ref3.mode,
17502
+ hotkey = _ref3.hotkey,
17503
+ handler = _ref3.handler,
17504
+ ref = _ref3.ref;
17505
+ var mousetrapInstance;
17506
+ switch (mode) {
17507
+ case MODES.global:
17508
+ Mousetrap$1.bindGlobal(hotkey, handler);
17509
+ break;
17510
+ case MODES.scoped:
17511
+ mousetrapInstance = Mousetrap$1(ref.current).bind(hotkey, handler);
17512
+ break;
17513
+ default:
17514
+ mousetrapInstance = Mousetrap$1.bind(hotkey, handler);
17515
+ }
17516
+ return mousetrapInstance;
17517
+ };
17518
+ var unBindHotKey = function unBindHotKey(_ref4) {
17519
+ var mousetrapInstance = _ref4.mousetrapInstance,
17520
+ mode = _ref4.mode,
17521
+ hotkey = _ref4.hotkey;
17522
+ return mode === MODES.global ? Mousetrap$1.unbindGlobal(hotkey) : mousetrapInstance === null || mousetrapInstance === void 0 ? void 0 : mousetrapInstance.unbind(hotkey);
17523
+ };
17524
+
17525
+ var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
17526
+ var ref = useRef(null);
17527
+ var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
17528
+ var config = mergeLeft(userConfig, DEFAULT_CONFIG);
17529
+ if (!handler) {
17530
+ throw new Error("You must provide a handler function to useHotKeys");
17531
+ }
17532
+ useEffect(function () {
17533
+ if (!config.enabled) return undefined;
17534
+ var mousetrapInstance = bindHotKey({
17535
+ mode: config.mode,
17536
+ hotkey: convertedHotkey,
17537
+ handler: handler,
17538
+ ref: ref
17539
+ });
15810
17540
  return function () {
15811
- hotkeys.unbind(keys, memoisedCallback);
17541
+ unBindHotKey({
17542
+ mousetrapInstance: mousetrapInstance,
17543
+ mode: config.mode,
17544
+ hotkey: convertedHotkey
17545
+ });
15812
17546
  };
15813
- }, [memoisedCallback, keys, enabled]);
15814
- return ref;
15815
- }
17547
+ }, [handler, config.mode, convertedHotkey, config]);
17548
+ return config.mode === MODES.scoped ? ref : null;
17549
+ };
15816
17550
 
15817
17551
  function _classCallCheck$1(instance, Constructor) {
15818
17552
  if (!(instance instanceof Constructor)) {
@@ -15916,7 +17650,7 @@ var manager = new OverlayManager();
15916
17650
  var dayjs_min = {exports: {}};
15917
17651
 
15918
17652
  (function (module, exports) {
15919
- !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}));
17653
+ !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}));
15920
17654
  } (dayjs_min));
15921
17655
 
15922
17656
  var dayjs = dayjs_min.exports;
@@ -15924,7 +17658,7 @@ var dayjs = dayjs_min.exports;
15924
17658
  var localeData$1 = {exports: {}};
15925
17659
 
15926
17660
  (function (module, exports) {
15927
- !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)};}}));
17661
+ !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)};}}));
15928
17662
  } (localeData$1));
15929
17663
 
15930
17664
  var localeData = localeData$1.exports;
@@ -15932,7 +17666,7 @@ var localeData = localeData$1.exports;
15932
17666
  var utc$1 = {exports: {}};
15933
17667
 
15934
17668
  (function (module, exports) {
15935
- !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)};}}));
17669
+ !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)};}}));
15936
17670
  } (utc$1));
15937
17671
 
15938
17672
  var utc = utc$1.exports;
@@ -15940,7 +17674,7 @@ var utc = utc$1.exports;
15940
17674
  var weekday$1 = {exports: {}};
15941
17675
 
15942
17676
  (function (module, exports) {
15943
- !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")};}}));
17677
+ !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")};}}));
15944
17678
  } (weekday$1));
15945
17679
 
15946
17680
  var weekday = weekday$1.exports;
@@ -15948,7 +17682,7 @@ var weekday = weekday$1.exports;
15948
17682
  var weekOfYear$1 = {exports: {}};
15949
17683
 
15950
17684
  (function (module, exports) {
15951
- !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)};}}));
17685
+ !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)};}}));
15952
17686
  } (weekOfYear$1));
15953
17687
 
15954
17688
  var weekOfYear = weekOfYear$1.exports;
@@ -16604,14 +18338,13 @@ var useOverlay = function useOverlay(_ref) {
16604
18338
  }
16605
18339
  };
16606
18340
  var focusRequiredElementInOverlay = function focusRequiredElementInOverlay() {
16607
- if (hasTransitionCompleted) {
16608
- var _initialFocusRef;
16609
- if ((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current) {
16610
- var _initialFocusRef2;
16611
- (_initialFocusRef2 = initialFocusRef) === null || _initialFocusRef2 === void 0 || (_initialFocusRef2 = _initialFocusRef2.current) === null || _initialFocusRef2 === void 0 || _initialFocusRef2.focus();
16612
- } else {
16613
- focusFirstFocusableElement(overlayWrapper);
16614
- }
18341
+ var _initialFocusRef;
18342
+ if (!hasTransitionCompleted) return;
18343
+ if ((_initialFocusRef = initialFocusRef) !== null && _initialFocusRef !== void 0 && _initialFocusRef.current) {
18344
+ var _initialFocusRef2;
18345
+ (_initialFocusRef2 = initialFocusRef) === null || _initialFocusRef2 === void 0 || (_initialFocusRef2 = _initialFocusRef2.current) === null || _initialFocusRef2 === void 0 || _initialFocusRef2.focus();
18346
+ } else {
18347
+ focusFirstFocusableElement(overlayWrapper);
16615
18348
  }
16616
18349
  };
16617
18350
  var handleOverlayClose = useCallback(function () {
@@ -16623,9 +18356,9 @@ var useOverlay = function useOverlay(_ref) {
16623
18356
  var isTopOverlay = useSyncExternalStore(manager.subscribe, function () {
16624
18357
  return manager.isTopOverlay(overlayWrapper);
16625
18358
  });
16626
- useHotkeys("esc", function () {
16627
- closeOnEsc && handleOverlayClose();
16628
- }, [handleOverlayClose, closeOnEsc]);
18359
+ useHotKeys("escape", handleOverlayClose, {
18360
+ enabled: closeOnEsc
18361
+ });
16629
18362
  useEffect(function () {
16630
18363
  var cleanUp = noop$1;
16631
18364
  if (isOpen) {
@@ -16881,7 +18614,7 @@ var Modal = function Modal(_ref) {
16881
18614
  closeOnOutsideClick = _ref$closeOnOutsideCl === void 0 ? true : _ref$closeOnOutsideCl,
16882
18615
  otherProps = _objectWithoutProperties$1(_ref, _excluded$t);
16883
18616
  var _useState = useState(false),
16884
- _useState2 = _slicedToArray$1(_useState, 2),
18617
+ _useState2 = _slicedToArray$2(_useState, 2),
16885
18618
  hasTransitionCompleted = _useState2[0],
16886
18619
  setHasTransitionCompleted = _useState2[1];
16887
18620
  var modalWrapper = useRef(null);
@@ -17530,7 +19263,7 @@ try {
17530
19263
  }
17531
19264
 
17532
19265
  function _arrayWithoutHoles$1(arr) {
17533
- if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
19266
+ if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
17534
19267
  }
17535
19268
 
17536
19269
  function _iterableToArray$1(iter) {
@@ -17542,14 +19275,14 @@ function _nonIterableSpread$1() {
17542
19275
  }
17543
19276
 
17544
19277
  function _toConsumableArray$1(arr) {
17545
- return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
19278
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$1();
17546
19279
  }
17547
19280
 
17548
19281
  var transformObjectToDotNotation = function transformObjectToDotNotation(object) {
17549
19282
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
17550
19283
  var result = [];
17551
19284
  Object.entries(object).forEach(function (_ref) {
17552
- var _ref2 = _slicedToArray$1(_ref, 2),
19285
+ var _ref2 = _slicedToArray$2(_ref, 2),
17553
19286
  key = _ref2[0],
17554
19287
  value = _ref2[1];
17555
19288
  if (value) {
@@ -17769,7 +19502,7 @@ var Input$2 = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
17769
19502
  disableTrimOnBlur = _ref$disableTrimOnBlu === void 0 ? false : _ref$disableTrimOnBlu,
17770
19503
  otherProps = _objectWithoutProperties$1(_ref, _excluded$n);
17771
19504
  var _useState = useState(otherProps.value),
17772
- _useState2 = _slicedToArray$1(_useState, 2),
19505
+ _useState2 = _slicedToArray$2(_useState, 2),
17773
19506
  valueInternal = _useState2[0],
17774
19507
  setValueInternal = _useState2[1];
17775
19508
  var id = useId(otherProps.id);
@@ -24522,7 +26255,7 @@ var CreatableSelect = /*#__PURE__*/forwardRef$1(function (props, ref) {
24522
26255
  });
24523
26256
 
24524
26257
  function _toArray(arr) {
24525
- return _arrayWithHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableRest$1();
26258
+ return _arrayWithHoles$2(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
24526
26259
  }
24527
26260
 
24528
26261
  var StateManagedSelect = /*#__PURE__*/forwardRef$1(function (props, ref) {
@@ -24764,11 +26497,11 @@ var MultiEmailInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
24764
26497
  visibleEmailsCount = _ref$visibleEmailsCou === void 0 ? 3 : _ref$visibleEmailsCou,
24765
26498
  otherProps = _objectWithoutProperties$1(_ref, _excluded$f);
24766
26499
  var _useState = useState(""),
24767
- _useState2 = _slicedToArray$1(_useState, 2),
26500
+ _useState2 = _slicedToArray$2(_useState, 2),
24768
26501
  inputValue = _useState2[0],
24769
26502
  setInputValue = _useState2[1];
24770
26503
  var _useState3 = useState(false),
24771
- _useState4 = _slicedToArray$1(_useState3, 2),
26504
+ _useState4 = _slicedToArray$2(_useState3, 2),
24772
26505
  isFocused = _useState4[0],
24773
26506
  setIsFocused = _useState4[1];
24774
26507
  var isCounterVisible = !!counter && (!counter.startsFrom || getValidEmailsCount(value) >= counter.startsFrom);
@@ -24839,10 +26572,9 @@ var MultiEmailInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
24839
26572
  required: required,
24840
26573
  className: "neeto-ui-email-input__label",
24841
26574
  "data-cy": "".concat(hyphenize(label), "-input-label")
24842
- }, labelProps), label), isCounterVisible && /*#__PURE__*/React__default.createElement(Typography, {
26575
+ }, labelProps), label), isCounterVisible && /*#__PURE__*/React__default.createElement("p", {
24843
26576
  className: "neeto-ui-email-input__counter",
24844
- "data-cy": "".concat(hyphenize(label), "-email-counter"),
24845
- style: "body2"
26577
+ "data-cy": "".concat(hyphenize(label), "-email-counter")
24846
26578
  }, getValidEmailsCount(value), " ", counter.label ? counter.label : renderDefaultText(getValidEmailsCount(value)))), /*#__PURE__*/React__default.createElement(CreatableSelect, _extends$2({
24847
26579
  isMulti: true,
24848
26580
  required: true,
@@ -24876,20 +26608,15 @@ var MultiEmailInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
24876
26608
  visibleEmailsCount: visibleEmailsCount
24877
26609
  }, !isOptionsPresent && {
24878
26610
  menuIsOpen: false
24879
- }), otherProps), overrideProps))), !!error && /*#__PURE__*/React__default.createElement(Typography, {
26611
+ }), otherProps), overrideProps))), !!error && /*#__PURE__*/React__default.createElement("p", {
24880
26612
  className: "neeto-ui-input__error",
24881
- "data-cy": "".concat(hyphenize(label), "-input-error"),
24882
- style: "body3"
24883
- }, error, isFilterEmailsLinkVisible && /*#__PURE__*/React__default.createElement(Typography, {
24884
- className: "cursor-pointer",
24885
- component: "span",
24886
- style: "body3",
24887
- weight: "semibold",
26613
+ "data-cy": "".concat(hyphenize(label), "-input-error")
26614
+ }, error, isFilterEmailsLinkVisible && /*#__PURE__*/React__default.createElement("span", {
26615
+ className: "neeto-ui-font-semibold cursor-pointer",
24888
26616
  onClick: handleFilterEmails
24889
- }, "\xA0", filterInvalidEmails.label ? filterInvalidEmails.label : "Click here to remove invalid emails.")), !!helpText && /*#__PURE__*/React__default.createElement(Typography, {
26617
+ }, "\xA0", filterInvalidEmails.label ? filterInvalidEmails.label : "Click here to remove invalid emails.")), !!helpText && /*#__PURE__*/React__default.createElement("p", {
24890
26618
  className: "neeto-ui-input__help-text",
24891
- "data-cy": "".concat(hyphenize(label), "-input-help"),
24892
- style: "body3"
26619
+ "data-cy": "".concat(hyphenize(label), "-input-help")
24893
26620
  }, helpText));
24894
26621
  });
24895
26622
  MultiEmailInput.displayName = "MultiEmailInput";
@@ -24899,7 +26626,7 @@ var FormikMultiEmailInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
24899
26626
  var name = _ref.name,
24900
26627
  otherProps = _objectWithoutProperties$1(_ref, _excluded$e);
24901
26628
  var _useField = useField(name),
24902
- _useField2 = _slicedToArray$1(_useField, 3),
26629
+ _useField2 = _slicedToArray$2(_useField, 3),
24903
26630
  field = _useField2[0],
24904
26631
  meta = _useField2[1],
24905
26632
  _useField2$ = _useField2[2],
@@ -24964,7 +26691,7 @@ var Radio = function Radio(_ref) {
24964
26691
  labelProps = _ref.labelProps,
24965
26692
  props = _objectWithoutProperties$1(_ref, _excluded$c);
24966
26693
  var _useState = useState(""),
24967
- _useState2 = _slicedToArray$1(_useState, 2),
26694
+ _useState2 = _slicedToArray$2(_useState, 2),
24968
26695
  internalValue = _useState2[0],
24969
26696
  setInternalValue = _useState2[1];
24970
26697
  var id = useId(props.id);
@@ -25008,7 +26735,7 @@ var RadioGroup = function RadioGroup(_ref) {
25008
26735
  var _useField = useField({
25009
26736
  name: name
25010
26737
  }),
25011
- _useField2 = _slicedToArray$1(_useField, 2),
26738
+ _useField2 = _slicedToArray$2(_useField, 2),
25012
26739
  field = _useField2[0],
25013
26740
  meta = _useField2[1];
25014
26741
  return /*#__PURE__*/React__default.createElement(Radio, _extends$2({
@@ -25459,7 +27186,7 @@ var SelectField = /*#__PURE__*/forwardRef$1(function (props, ref) {
25459
27186
  isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
25460
27187
  otherProps = _objectWithoutProperties$1(props, _excluded$8);
25461
27188
  var _useField = useField(name),
25462
- _useField2 = _slicedToArray$1(_useField, 3),
27189
+ _useField2 = _slicedToArray$2(_useField, 3),
25463
27190
  field = _useField2[0],
25464
27191
  meta = _useField2[1],
25465
27192
  _useField2$ = _useField2[2],
@@ -25473,7 +27200,7 @@ var SelectField = /*#__PURE__*/forwardRef$1(function (props, ref) {
25473
27200
  return getOptionValue(option);
25474
27201
  };
25475
27202
  var buildValueObj = function buildValueObj(value, options) {
25476
- if (_typeof$2(value) === "object") return value;
27203
+ if (_typeof$3(value) === "object") return value;
25477
27204
  return options.filter(function (option) {
25478
27205
  return getRealOptionValue(option) === value;
25479
27206
  })[0];
@@ -25589,16 +27316,14 @@ var Slider = function Slider(_ref) {
25589
27316
  value: value
25590
27317
  }, otherProps), {}, {
25591
27318
  id: id
25592
- }))), !!error && /*#__PURE__*/React__default.createElement(Typography, {
27319
+ }))), !!error && /*#__PURE__*/React__default.createElement("p", {
25593
27320
  className: "neeto-ui-input__error",
25594
27321
  "data-cy": "".concat(hyphenize(label), "-input-error"),
25595
- id: errorId,
25596
- style: "body3"
25597
- }, error), helpText && /*#__PURE__*/React__default.createElement(Typography, {
27322
+ id: errorId
27323
+ }, error), helpText && /*#__PURE__*/React__default.createElement("p", {
25598
27324
  className: "neeto-ui-input__help-text",
25599
27325
  "data-cy": "".concat(hyphenize(label), "-input-help"),
25600
- id: helpTextId,
25601
- style: "body3"
27326
+ id: helpTextId
25602
27327
  }, helpText)));
25603
27328
  };
25604
27329
 
@@ -25607,7 +27332,7 @@ var FormikSlider = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25607
27332
  var name = _ref.name,
25608
27333
  otherProps = _objectWithoutProperties$1(_ref, _excluded$6);
25609
27334
  var _useField = useField(name),
25610
- _useField2 = _slicedToArray$1(_useField, 3),
27335
+ _useField2 = _slicedToArray$2(_useField, 3),
25611
27336
  field = _useField2[0],
25612
27337
  meta = _useField2[1],
25613
27338
  _useField2$ = _useField2[2],
@@ -25739,7 +27464,7 @@ var Textarea = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25739
27464
  labelProps = _ref.labelProps,
25740
27465
  otherProps = _objectWithoutProperties$1(_ref, _excluded$3);
25741
27466
  var _useState = useState(""),
25742
- _useState2 = _slicedToArray$1(_useState, 2),
27467
+ _useState2 = _slicedToArray$2(_useState, 2),
25743
27468
  valueInternal = _useState2[0],
25744
27469
  setValueInternal = _useState2[1];
25745
27470
  var value = (_ref2 = (_otherProps$value = otherProps.value) !== null && _otherProps$value !== void 0 ? _otherProps$value : valueInternal) !== null && _ref2 !== void 0 ? _ref2 : "";
@@ -25873,24 +27598,25 @@ var TreeSelect = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25873
27598
  }, /*#__PURE__*/React__default.createElement("div", {
25874
27599
  className: "neeto-ui-input__wrapper"
25875
27600
  }, label && /*#__PURE__*/React__default.createElement(Label, {
25876
- "data-testid": "treeselect-label",
25877
- required: required
27601
+ required: required,
27602
+ "data-testid": "treeselect-label"
25878
27603
  }, label), /*#__PURE__*/React__default.createElement(_TreeSelect, _extends$2({
25879
27604
  allowClear: allowClear,
25880
- "data-cy": "neeto-ui-tree-select-wrapper",
25881
27605
  disabled: disabled,
25882
- dropdownStyle: {
25883
- zIndex: 100000
25884
- },
25885
27606
  fieldNames: fieldNames,
27607
+ onChange: onChange,
25886
27608
  placeholder: placeholder,
25887
- popupClassName: "neeto-ui-tree-select-dropdown",
25888
27609
  ref: ref,
25889
27610
  showSearch: showSearch,
25890
27611
  size: size,
25891
- suffixIcon: /*#__PURE__*/React__default.createElement(SuffixIcon, null),
25892
27612
  treeData: treeData,
25893
27613
  treeDataSimpleMode: treeDataSimpleMode,
27614
+ "data-cy": "neeto-ui-tree-select-wrapper",
27615
+ dropdownStyle: {
27616
+ zIndex: 100000
27617
+ },
27618
+ popupClassName: "neeto-ui-tree-select-dropdown",
27619
+ suffixIcon: /*#__PURE__*/React__default.createElement(SuffixIcon, null),
25894
27620
  treeNodeFilterProp: (_fieldNames$label = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) !== null && _fieldNames$label !== void 0 ? _fieldNames$label : "label",
25895
27621
  value: value || undefined,
25896
27622
  className: classnames$1("neeto-ui-tree-select__wrapper", className, {
@@ -25904,12 +27630,10 @@ var TreeSelect = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25904
27630
  }, "No options"),
25905
27631
  switcherIcon: function switcherIcon(props) {
25906
27632
  return /*#__PURE__*/React__default.createElement("div", props, /*#__PURE__*/React__default.createElement(SwitcherIcon, null));
25907
- },
25908
- onChange: onChange
25909
- }, otherProps)), error && /*#__PURE__*/React__default.createElement(Typography, {
27633
+ }
27634
+ }, otherProps)), error && /*#__PURE__*/React__default.createElement("p", {
25910
27635
  className: "neeto-ui-input__error",
25911
- "data-testid": "treeselect-error",
25912
- style: "body3"
27636
+ "data-testid": "treeselect-error"
25913
27637
  }, error)));
25914
27638
  });
25915
27639
  TreeSelect.displayName = "TreeSelect";
@@ -25919,7 +27643,7 @@ var FormikTreeSelect = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25919
27643
  var name = _ref.name,
25920
27644
  otherProps = _objectWithoutProperties$1(_ref, _excluded);
25921
27645
  var _useField = useField(name),
25922
- _useField2 = _slicedToArray$1(_useField, 3),
27646
+ _useField2 = _slicedToArray$2(_useField, 3),
25923
27647
  field = _useField2[0],
25924
27648
  meta = _useField2[1],
25925
27649
  _useField2$ = _useField2[2],