react-tooltip 4.5.1 → 5.0.0-beta.0

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.
Files changed (90) hide show
  1. package/.editorconfig +25 -0
  2. package/.eslintrc.json +94 -0
  3. package/.gitattributes +3 -0
  4. package/.github/FUNDING.yml +13 -0
  5. package/.github/workflows/lint.yaml +35 -0
  6. package/.github/workflows/pull-request.yaml +11 -0
  7. package/.github/workflows/release.yaml +30 -0
  8. package/.husky/pre-commit +6 -0
  9. package/.prettierrc.json +10 -0
  10. package/.stylelintrc.json +19 -0
  11. package/.vscode/settings.json +27 -0
  12. package/bower.json +26 -0
  13. package/build/dist/react-tooltip.cjs.js +2909 -0
  14. package/build/dist/react-tooltip.cjs.min.js +6 -0
  15. package/build/dist/react-tooltip.css +73 -0
  16. package/build/dist/react-tooltip.esm.js +2901 -0
  17. package/build/dist/react-tooltip.esm.min.js +6 -0
  18. package/build/dist/react-tooltip.min.css +1 -0
  19. package/build/dist/react-tooltip.umd.js +2913 -0
  20. package/build/dist/react-tooltip.umd.min.js +6 -0
  21. package/build/index.css +79 -0
  22. package/build/index.html +19 -0
  23. package/build/index.js +36190 -0
  24. package/cli.js +30 -0
  25. package/contributing.md +40 -0
  26. package/dist/react-tooltip.cjs.js +2932 -0
  27. package/dist/react-tooltip.cjs.min.js +6 -0
  28. package/dist/react-tooltip.css +73 -0
  29. package/dist/react-tooltip.esm.js +2924 -0
  30. package/dist/react-tooltip.esm.min.js +6 -0
  31. package/dist/react-tooltip.min.css +1 -0
  32. package/dist/react-tooltip.umd.js +2936 -0
  33. package/dist/react-tooltip.umd.min.js +6 -0
  34. package/docs/README.md +50 -0
  35. package/docs/babel.config.js +3 -0
  36. package/docs/docs/examples/_category_.json +7 -0
  37. package/docs/docs/examples/basic-examples.mdx +68 -0
  38. package/docs/docs/examples/children.mdx +67 -0
  39. package/docs/docs/examples/content.mdx +80 -0
  40. package/docs/docs/examples/delay.mdx +84 -0
  41. package/docs/docs/examples/events.mdx +85 -0
  42. package/docs/docs/examples/get-content.mdx +58 -0
  43. package/docs/docs/examples/html.mdx +75 -0
  44. package/docs/docs/examples/multiline.mdx +91 -0
  45. package/docs/docs/examples/offset.mdx +69 -0
  46. package/docs/docs/examples/place.mdx +55 -0
  47. package/docs/docs/examples/state.mdx +331 -0
  48. package/docs/docs/examples/styling.mdx +388 -0
  49. package/docs/docs/examples/variant.mdx +100 -0
  50. package/docs/docs/getting-started.md +70 -0
  51. package/docs/docs/options.mdx +105 -0
  52. package/docs/docs/upgrade-guide/_category_.json +7 -0
  53. package/docs/docs/upgrade-guide/basic-examples-v4-v5.mdx +119 -0
  54. package/docs/docs/upgrade-guide/changelog-v4-v5.md +85 -0
  55. package/docs/docusaurus.config.js +126 -0
  56. package/docs/package.json +47 -0
  57. package/docs/sidebars.js +33 -0
  58. package/docs/src/components/HomepageFeatures/index.tsx +70 -0
  59. package/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  60. package/docs/src/css/custom.css +74 -0
  61. package/docs/src/pages/index.module.css +35 -0
  62. package/docs/src/pages/index.tsx +42 -0
  63. package/docs/src/pages/markdown-page.md +7 -0
  64. package/docs/static/.nojekyll +0 -0
  65. package/docs/static/img/docusaurus.png +0 -0
  66. package/docs/static/img/favicon.ico +0 -0
  67. package/docs/static/img/logo.svg +1 -0
  68. package/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  69. package/docs/static/img/undraw_docusaurus_react.svg +170 -0
  70. package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  71. package/docs/tsconfig.json +7 -0
  72. package/docs/yarn.lock +7579 -0
  73. package/example-v5/package.json +21 -0
  74. package/example-v5/public/index.html +20 -0
  75. package/example-v5/public/manifest.json +8 -0
  76. package/example-v5/src/App.jsx +908 -0
  77. package/example-v5/src/index.css +238 -0
  78. package/example-v5/src/index.js +15 -0
  79. package/example-v5/src/index.scss +251 -0
  80. package/package.json +94 -146
  81. package/public/index.html +19 -0
  82. package/rollup.config.dev.js +88 -0
  83. package/rollup.config.prod.js +104 -0
  84. package/rollup.config.types.js +7 -0
  85. package/tsconfig.json +109 -0
  86. package/dist/index.es.js +0 -3185
  87. package/dist/index.es.js.map +0 -1
  88. package/dist/index.js +0 -3192
  89. package/dist/index.js.map +0 -1
  90. package/dist/react-tooltip.d.ts +0 -124
package/dist/index.es.js DELETED
@@ -1,3185 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { v4 } from 'uuid';
4
-
5
- function ownKeys$2(object, enumerableOnly) {
6
- var keys = Object.keys(object);
7
- if (Object.getOwnPropertySymbols) {
8
- var symbols = Object.getOwnPropertySymbols(object);
9
- enumerableOnly && (symbols = symbols.filter(function (sym) {
10
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
11
- })), keys.push.apply(keys, symbols);
12
- }
13
- return keys;
14
- }
15
- function _objectSpread2(target) {
16
- for (var i = 1; i < arguments.length; i++) {
17
- var source = null != arguments[i] ? arguments[i] : {};
18
- i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
19
- _defineProperty(target, key, source[key]);
20
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
21
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22
- });
23
- }
24
- return target;
25
- }
26
- function _classCallCheck(instance, Constructor) {
27
- if (!(instance instanceof Constructor)) {
28
- throw new TypeError("Cannot call a class as a function");
29
- }
30
- }
31
- function _defineProperties(target, props) {
32
- for (var i = 0; i < props.length; i++) {
33
- var descriptor = props[i];
34
- descriptor.enumerable = descriptor.enumerable || false;
35
- descriptor.configurable = true;
36
- if ("value" in descriptor) descriptor.writable = true;
37
- Object.defineProperty(target, descriptor.key, descriptor);
38
- }
39
- }
40
- function _createClass(Constructor, protoProps, staticProps) {
41
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
42
- if (staticProps) _defineProperties(Constructor, staticProps);
43
- Object.defineProperty(Constructor, "prototype", {
44
- writable: false
45
- });
46
- return Constructor;
47
- }
48
- function _defineProperty(obj, key, value) {
49
- if (key in obj) {
50
- Object.defineProperty(obj, key, {
51
- value: value,
52
- enumerable: true,
53
- configurable: true,
54
- writable: true
55
- });
56
- } else {
57
- obj[key] = value;
58
- }
59
- return obj;
60
- }
61
- function _extends() {
62
- _extends = Object.assign ? Object.assign.bind() : function (target) {
63
- for (var i = 1; i < arguments.length; i++) {
64
- var source = arguments[i];
65
- for (var key in source) {
66
- if (Object.prototype.hasOwnProperty.call(source, key)) {
67
- target[key] = source[key];
68
- }
69
- }
70
- }
71
- return target;
72
- };
73
- return _extends.apply(this, arguments);
74
- }
75
- function _inherits(subClass, superClass) {
76
- if (typeof superClass !== "function" && superClass !== null) {
77
- throw new TypeError("Super expression must either be null or a function");
78
- }
79
- subClass.prototype = Object.create(superClass && superClass.prototype, {
80
- constructor: {
81
- value: subClass,
82
- writable: true,
83
- configurable: true
84
- }
85
- });
86
- Object.defineProperty(subClass, "prototype", {
87
- writable: false
88
- });
89
- if (superClass) _setPrototypeOf(subClass, superClass);
90
- }
91
- function _getPrototypeOf(o) {
92
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
93
- return o.__proto__ || Object.getPrototypeOf(o);
94
- };
95
- return _getPrototypeOf(o);
96
- }
97
- function _setPrototypeOf(o, p) {
98
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
99
- o.__proto__ = p;
100
- return o;
101
- };
102
- return _setPrototypeOf(o, p);
103
- }
104
- function _isNativeReflectConstruct() {
105
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
106
- if (Reflect.construct.sham) return false;
107
- if (typeof Proxy === "function") return true;
108
- try {
109
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
110
- return true;
111
- } catch (e) {
112
- return false;
113
- }
114
- }
115
- function _assertThisInitialized(self) {
116
- if (self === void 0) {
117
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
118
- }
119
- return self;
120
- }
121
- function _possibleConstructorReturn(self, call) {
122
- if (call && (typeof call === "object" || typeof call === "function")) {
123
- return call;
124
- } else if (call !== void 0) {
125
- throw new TypeError("Derived constructors may only return object or undefined");
126
- }
127
- return _assertThisInitialized(self);
128
- }
129
- function _createSuper(Derived) {
130
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
131
- return function _createSuperInternal() {
132
- var Super = _getPrototypeOf(Derived),
133
- result;
134
- if (hasNativeReflectConstruct) {
135
- var NewTarget = _getPrototypeOf(this).constructor;
136
- result = Reflect.construct(Super, arguments, NewTarget);
137
- } else {
138
- result = Super.apply(this, arguments);
139
- }
140
- return _possibleConstructorReturn(this, result);
141
- };
142
- }
143
- function _unsupportedIterableToArray(o, minLen) {
144
- if (!o) return;
145
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
146
- var n = Object.prototype.toString.call(o).slice(8, -1);
147
- if (n === "Object" && o.constructor) n = o.constructor.name;
148
- if (n === "Map" || n === "Set") return Array.from(o);
149
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
150
- }
151
- function _arrayLikeToArray(arr, len) {
152
- if (len == null || len > arr.length) len = arr.length;
153
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
154
- return arr2;
155
- }
156
- function _createForOfIteratorHelper(o, allowArrayLike) {
157
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
158
- if (!it) {
159
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
160
- if (it) o = it;
161
- var i = 0;
162
- var F = function () {};
163
- return {
164
- s: F,
165
- n: function () {
166
- if (i >= o.length) return {
167
- done: true
168
- };
169
- return {
170
- done: false,
171
- value: o[i++]
172
- };
173
- },
174
- e: function (e) {
175
- throw e;
176
- },
177
- f: F
178
- };
179
- }
180
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
181
- }
182
- var normalCompletion = true,
183
- didErr = false,
184
- err;
185
- return {
186
- s: function () {
187
- it = it.call(o);
188
- },
189
- n: function () {
190
- var step = it.next();
191
- normalCompletion = step.done;
192
- return step;
193
- },
194
- e: function (e) {
195
- didErr = true;
196
- err = e;
197
- },
198
- f: function () {
199
- try {
200
- if (!normalCompletion && it.return != null) it.return();
201
- } finally {
202
- if (didErr) throw err;
203
- }
204
- }
205
- };
206
- }
207
-
208
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
209
-
210
- var check = function (it) {
211
- return it && it.Math == Math && it;
212
- };
213
-
214
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
215
- var global$a =
216
- // eslint-disable-next-line es/no-global-this -- safe
217
- check(typeof globalThis == 'object' && globalThis) ||
218
- check(typeof window == 'object' && window) ||
219
- // eslint-disable-next-line no-restricted-globals -- safe
220
- check(typeof self == 'object' && self) ||
221
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
222
- // eslint-disable-next-line no-new-func -- fallback
223
- (function () { return this; })() || Function('return this')();
224
-
225
- var objectGetOwnPropertyDescriptor = {};
226
-
227
- var fails$9 = function (exec) {
228
- try {
229
- return !!exec();
230
- } catch (error) {
231
- return true;
232
- }
233
- };
234
-
235
- var fails$8 = fails$9;
236
-
237
- // Detect IE8's incomplete defineProperty implementation
238
- var descriptors = !fails$8(function () {
239
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
240
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
241
- });
242
-
243
- var fails$7 = fails$9;
244
-
245
- var functionBindNative = !fails$7(function () {
246
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
247
- var test = (function () { /* empty */ }).bind();
248
- // eslint-disable-next-line no-prototype-builtins -- safe
249
- return typeof test != 'function' || test.hasOwnProperty('prototype');
250
- });
251
-
252
- var NATIVE_BIND$2 = functionBindNative;
253
-
254
- var call$4 = Function.prototype.call;
255
-
256
- var functionCall = NATIVE_BIND$2 ? call$4.bind(call$4) : function () {
257
- return call$4.apply(call$4, arguments);
258
- };
259
-
260
- var objectPropertyIsEnumerable = {};
261
-
262
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
263
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
264
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
265
-
266
- // Nashorn ~ JDK8 bug
267
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
268
-
269
- // `Object.prototype.propertyIsEnumerable` method implementation
270
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
271
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
272
- var descriptor = getOwnPropertyDescriptor$1(this, V);
273
- return !!descriptor && descriptor.enumerable;
274
- } : $propertyIsEnumerable;
275
-
276
- var createPropertyDescriptor$2 = function (bitmap, value) {
277
- return {
278
- enumerable: !(bitmap & 1),
279
- configurable: !(bitmap & 2),
280
- writable: !(bitmap & 4),
281
- value: value
282
- };
283
- };
284
-
285
- var NATIVE_BIND$1 = functionBindNative;
286
-
287
- var FunctionPrototype$1 = Function.prototype;
288
- var call$3 = FunctionPrototype$1.call;
289
- var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$3, call$3);
290
-
291
- var functionUncurryThisRaw = function (fn) {
292
- return NATIVE_BIND$1 ? uncurryThisWithBind(fn) : function () {
293
- return call$3.apply(fn, arguments);
294
- };
295
- };
296
-
297
- var uncurryThisRaw$1 = functionUncurryThisRaw;
298
-
299
- var toString$1 = uncurryThisRaw$1({}.toString);
300
- var stringSlice = uncurryThisRaw$1(''.slice);
301
-
302
- var classofRaw$2 = function (it) {
303
- return stringSlice(toString$1(it), 8, -1);
304
- };
305
-
306
- var classofRaw$1 = classofRaw$2;
307
- var uncurryThisRaw = functionUncurryThisRaw;
308
-
309
- var functionUncurryThis = function (fn) {
310
- // Nashorn bug:
311
- // https://github.com/zloirock/core-js/issues/1128
312
- // https://github.com/zloirock/core-js/issues/1130
313
- if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
314
- };
315
-
316
- var uncurryThis$9 = functionUncurryThis;
317
- var fails$6 = fails$9;
318
- var classof$3 = classofRaw$2;
319
-
320
- var $Object$3 = Object;
321
- var split = uncurryThis$9(''.split);
322
-
323
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
324
- var indexedObject = fails$6(function () {
325
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
326
- // eslint-disable-next-line no-prototype-builtins -- safe
327
- return !$Object$3('z').propertyIsEnumerable(0);
328
- }) ? function (it) {
329
- return classof$3(it) == 'String' ? split(it, '') : $Object$3(it);
330
- } : $Object$3;
331
-
332
- // we can't use just `it == null` since of `document.all` special case
333
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
334
- var isNullOrUndefined$2 = function (it) {
335
- return it === null || it === undefined;
336
- };
337
-
338
- var isNullOrUndefined$1 = isNullOrUndefined$2;
339
-
340
- var $TypeError$5 = TypeError;
341
-
342
- // `RequireObjectCoercible` abstract operation
343
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
344
- var requireObjectCoercible$2 = function (it) {
345
- if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
346
- return it;
347
- };
348
-
349
- // toObject with fallback for non-array-like ES3 strings
350
- var IndexedObject$1 = indexedObject;
351
- var requireObjectCoercible$1 = requireObjectCoercible$2;
352
-
353
- var toIndexedObject$4 = function (it) {
354
- return IndexedObject$1(requireObjectCoercible$1(it));
355
- };
356
-
357
- var documentAll$2 = typeof document == 'object' && document.all;
358
-
359
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
360
- var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
361
-
362
- var documentAll_1 = {
363
- all: documentAll$2,
364
- IS_HTMLDDA: IS_HTMLDDA
365
- };
366
-
367
- var $documentAll$1 = documentAll_1;
368
-
369
- var documentAll$1 = $documentAll$1.all;
370
-
371
- // `IsCallable` abstract operation
372
- // https://tc39.es/ecma262/#sec-iscallable
373
- var isCallable$c = $documentAll$1.IS_HTMLDDA ? function (argument) {
374
- return typeof argument == 'function' || argument === documentAll$1;
375
- } : function (argument) {
376
- return typeof argument == 'function';
377
- };
378
-
379
- var isCallable$b = isCallable$c;
380
- var $documentAll = documentAll_1;
381
-
382
- var documentAll = $documentAll.all;
383
-
384
- var isObject$6 = $documentAll.IS_HTMLDDA ? function (it) {
385
- return typeof it == 'object' ? it !== null : isCallable$b(it) || it === documentAll;
386
- } : function (it) {
387
- return typeof it == 'object' ? it !== null : isCallable$b(it);
388
- };
389
-
390
- var global$9 = global$a;
391
- var isCallable$a = isCallable$c;
392
-
393
- var aFunction = function (argument) {
394
- return isCallable$a(argument) ? argument : undefined;
395
- };
396
-
397
- var getBuiltIn$5 = function (namespace, method) {
398
- return arguments.length < 2 ? aFunction(global$9[namespace]) : global$9[namespace] && global$9[namespace][method];
399
- };
400
-
401
- var uncurryThis$8 = functionUncurryThis;
402
-
403
- var objectIsPrototypeOf = uncurryThis$8({}.isPrototypeOf);
404
-
405
- var getBuiltIn$4 = getBuiltIn$5;
406
-
407
- var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
408
-
409
- var global$8 = global$a;
410
- var userAgent = engineUserAgent;
411
-
412
- var process = global$8.process;
413
- var Deno = global$8.Deno;
414
- var versions = process && process.versions || Deno && Deno.version;
415
- var v8 = versions && versions.v8;
416
- var match, version;
417
-
418
- if (v8) {
419
- match = v8.split('.');
420
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
421
- // but their correct versions are not interesting for us
422
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
423
- }
424
-
425
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
426
- // so check `userAgent` even if `.v8` exists, but 0
427
- if (!version && userAgent) {
428
- match = userAgent.match(/Edge\/(\d+)/);
429
- if (!match || match[1] >= 74) {
430
- match = userAgent.match(/Chrome\/(\d+)/);
431
- if (match) version = +match[1];
432
- }
433
- }
434
-
435
- var engineV8Version = version;
436
-
437
- /* eslint-disable es/no-symbol -- required for testing */
438
-
439
- var V8_VERSION = engineV8Version;
440
- var fails$5 = fails$9;
441
-
442
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
443
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
444
- var symbol = Symbol();
445
- // Chrome 38 Symbol has incorrect toString conversion
446
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
447
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
448
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
449
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
450
- });
451
-
452
- /* eslint-disable es/no-symbol -- required for testing */
453
-
454
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
455
-
456
- var useSymbolAsUid = NATIVE_SYMBOL$1
457
- && !Symbol.sham
458
- && typeof Symbol.iterator == 'symbol';
459
-
460
- var getBuiltIn$3 = getBuiltIn$5;
461
- var isCallable$9 = isCallable$c;
462
- var isPrototypeOf = objectIsPrototypeOf;
463
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
464
-
465
- var $Object$2 = Object;
466
-
467
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
468
- return typeof it == 'symbol';
469
- } : function (it) {
470
- var $Symbol = getBuiltIn$3('Symbol');
471
- return isCallable$9($Symbol) && isPrototypeOf($Symbol.prototype, $Object$2(it));
472
- };
473
-
474
- var $String$1 = String;
475
-
476
- var tryToString$1 = function (argument) {
477
- try {
478
- return $String$1(argument);
479
- } catch (error) {
480
- return 'Object';
481
- }
482
- };
483
-
484
- var isCallable$8 = isCallable$c;
485
- var tryToString = tryToString$1;
486
-
487
- var $TypeError$4 = TypeError;
488
-
489
- // `Assert: IsCallable(argument) is true`
490
- var aCallable$2 = function (argument) {
491
- if (isCallable$8(argument)) return argument;
492
- throw $TypeError$4(tryToString(argument) + ' is not a function');
493
- };
494
-
495
- var aCallable$1 = aCallable$2;
496
- var isNullOrUndefined = isNullOrUndefined$2;
497
-
498
- // `GetMethod` abstract operation
499
- // https://tc39.es/ecma262/#sec-getmethod
500
- var getMethod$1 = function (V, P) {
501
- var func = V[P];
502
- return isNullOrUndefined(func) ? undefined : aCallable$1(func);
503
- };
504
-
505
- var call$2 = functionCall;
506
- var isCallable$7 = isCallable$c;
507
- var isObject$5 = isObject$6;
508
-
509
- var $TypeError$3 = TypeError;
510
-
511
- // `OrdinaryToPrimitive` abstract operation
512
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
513
- var ordinaryToPrimitive$1 = function (input, pref) {
514
- var fn, val;
515
- if (pref === 'string' && isCallable$7(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
516
- if (isCallable$7(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
517
- if (pref !== 'string' && isCallable$7(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
518
- throw $TypeError$3("Can't convert object to primitive value");
519
- };
520
-
521
- var shared$3 = {exports: {}};
522
-
523
- var global$7 = global$a;
524
-
525
- // eslint-disable-next-line es/no-object-defineproperty -- safe
526
- var defineProperty$2 = Object.defineProperty;
527
-
528
- var defineGlobalProperty$3 = function (key, value) {
529
- try {
530
- defineProperty$2(global$7, key, { value: value, configurable: true, writable: true });
531
- } catch (error) {
532
- global$7[key] = value;
533
- } return value;
534
- };
535
-
536
- var global$6 = global$a;
537
- var defineGlobalProperty$2 = defineGlobalProperty$3;
538
-
539
- var SHARED = '__core-js_shared__';
540
- var store$3 = global$6[SHARED] || defineGlobalProperty$2(SHARED, {});
541
-
542
- var sharedStore = store$3;
543
-
544
- var store$2 = sharedStore;
545
-
546
- (shared$3.exports = function (key, value) {
547
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
548
- })('versions', []).push({
549
- version: '3.25.5',
550
- mode: 'global',
551
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
552
- license: 'https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE',
553
- source: 'https://github.com/zloirock/core-js'
554
- });
555
-
556
- var requireObjectCoercible = requireObjectCoercible$2;
557
-
558
- var $Object$1 = Object;
559
-
560
- // `ToObject` abstract operation
561
- // https://tc39.es/ecma262/#sec-toobject
562
- var toObject$2 = function (argument) {
563
- return $Object$1(requireObjectCoercible(argument));
564
- };
565
-
566
- var uncurryThis$7 = functionUncurryThis;
567
- var toObject$1 = toObject$2;
568
-
569
- var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
570
-
571
- // `HasOwnProperty` abstract operation
572
- // https://tc39.es/ecma262/#sec-hasownproperty
573
- // eslint-disable-next-line es/no-object-hasown -- safe
574
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
575
- return hasOwnProperty(toObject$1(it), key);
576
- };
577
-
578
- var uncurryThis$6 = functionUncurryThis;
579
-
580
- var id = 0;
581
- var postfix = Math.random();
582
- var toString = uncurryThis$6(1.0.toString);
583
-
584
- var uid$2 = function (key) {
585
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
586
- };
587
-
588
- var global$5 = global$a;
589
- var shared$2 = shared$3.exports;
590
- var hasOwn$6 = hasOwnProperty_1;
591
- var uid$1 = uid$2;
592
- var NATIVE_SYMBOL = symbolConstructorDetection;
593
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
594
-
595
- var WellKnownSymbolsStore = shared$2('wks');
596
- var Symbol$1 = global$5.Symbol;
597
- var symbolFor = Symbol$1 && Symbol$1['for'];
598
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
599
-
600
- var wellKnownSymbol$5 = function (name) {
601
- if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
602
- var description = 'Symbol.' + name;
603
- if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
604
- WellKnownSymbolsStore[name] = Symbol$1[name];
605
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
606
- WellKnownSymbolsStore[name] = symbolFor(description);
607
- } else {
608
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
609
- }
610
- } return WellKnownSymbolsStore[name];
611
- };
612
-
613
- var call$1 = functionCall;
614
- var isObject$4 = isObject$6;
615
- var isSymbol$1 = isSymbol$2;
616
- var getMethod = getMethod$1;
617
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
618
- var wellKnownSymbol$4 = wellKnownSymbol$5;
619
-
620
- var $TypeError$2 = TypeError;
621
- var TO_PRIMITIVE = wellKnownSymbol$4('toPrimitive');
622
-
623
- // `ToPrimitive` abstract operation
624
- // https://tc39.es/ecma262/#sec-toprimitive
625
- var toPrimitive$1 = function (input, pref) {
626
- if (!isObject$4(input) || isSymbol$1(input)) return input;
627
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
628
- var result;
629
- if (exoticToPrim) {
630
- if (pref === undefined) pref = 'default';
631
- result = call$1(exoticToPrim, input, pref);
632
- if (!isObject$4(result) || isSymbol$1(result)) return result;
633
- throw $TypeError$2("Can't convert object to primitive value");
634
- }
635
- if (pref === undefined) pref = 'number';
636
- return ordinaryToPrimitive(input, pref);
637
- };
638
-
639
- var toPrimitive = toPrimitive$1;
640
- var isSymbol = isSymbol$2;
641
-
642
- // `ToPropertyKey` abstract operation
643
- // https://tc39.es/ecma262/#sec-topropertykey
644
- var toPropertyKey$2 = function (argument) {
645
- var key = toPrimitive(argument, 'string');
646
- return isSymbol(key) ? key : key + '';
647
- };
648
-
649
- var global$4 = global$a;
650
- var isObject$3 = isObject$6;
651
-
652
- var document$1 = global$4.document;
653
- // typeof document.createElement is 'object' in old IE
654
- var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
655
-
656
- var documentCreateElement$1 = function (it) {
657
- return EXISTS$1 ? document$1.createElement(it) : {};
658
- };
659
-
660
- var DESCRIPTORS$7 = descriptors;
661
- var fails$4 = fails$9;
662
- var createElement = documentCreateElement$1;
663
-
664
- // Thanks to IE8 for its funny defineProperty
665
- var ie8DomDefine = !DESCRIPTORS$7 && !fails$4(function () {
666
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
667
- return Object.defineProperty(createElement('div'), 'a', {
668
- get: function () { return 7; }
669
- }).a != 7;
670
- });
671
-
672
- var DESCRIPTORS$6 = descriptors;
673
- var call = functionCall;
674
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
675
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
676
- var toIndexedObject$3 = toIndexedObject$4;
677
- var toPropertyKey$1 = toPropertyKey$2;
678
- var hasOwn$5 = hasOwnProperty_1;
679
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
680
-
681
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
682
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
683
-
684
- // `Object.getOwnPropertyDescriptor` method
685
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
686
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
687
- O = toIndexedObject$3(O);
688
- P = toPropertyKey$1(P);
689
- if (IE8_DOM_DEFINE$1) try {
690
- return $getOwnPropertyDescriptor$1(O, P);
691
- } catch (error) { /* empty */ }
692
- if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
693
- };
694
-
695
- var objectDefineProperty = {};
696
-
697
- var DESCRIPTORS$5 = descriptors;
698
- var fails$3 = fails$9;
699
-
700
- // V8 ~ Chrome 36-
701
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
702
- var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$3(function () {
703
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
704
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
705
- value: 42,
706
- writable: false
707
- }).prototype != 42;
708
- });
709
-
710
- var isObject$2 = isObject$6;
711
-
712
- var $String = String;
713
- var $TypeError$1 = TypeError;
714
-
715
- // `Assert: Type(argument) is Object`
716
- var anObject$4 = function (argument) {
717
- if (isObject$2(argument)) return argument;
718
- throw $TypeError$1($String(argument) + ' is not an object');
719
- };
720
-
721
- var DESCRIPTORS$4 = descriptors;
722
- var IE8_DOM_DEFINE = ie8DomDefine;
723
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
724
- var anObject$3 = anObject$4;
725
- var toPropertyKey = toPropertyKey$2;
726
-
727
- var $TypeError = TypeError;
728
- // eslint-disable-next-line es/no-object-defineproperty -- safe
729
- var $defineProperty = Object.defineProperty;
730
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
731
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
732
- var ENUMERABLE = 'enumerable';
733
- var CONFIGURABLE$1 = 'configurable';
734
- var WRITABLE = 'writable';
735
-
736
- // `Object.defineProperty` method
737
- // https://tc39.es/ecma262/#sec-object.defineproperty
738
- objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
739
- anObject$3(O);
740
- P = toPropertyKey(P);
741
- anObject$3(Attributes);
742
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
743
- var current = $getOwnPropertyDescriptor(O, P);
744
- if (current && current[WRITABLE]) {
745
- O[P] = Attributes.value;
746
- Attributes = {
747
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
748
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
749
- writable: false
750
- };
751
- }
752
- } return $defineProperty(O, P, Attributes);
753
- } : $defineProperty : function defineProperty(O, P, Attributes) {
754
- anObject$3(O);
755
- P = toPropertyKey(P);
756
- anObject$3(Attributes);
757
- if (IE8_DOM_DEFINE) try {
758
- return $defineProperty(O, P, Attributes);
759
- } catch (error) { /* empty */ }
760
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
761
- if ('value' in Attributes) O[P] = Attributes.value;
762
- return O;
763
- };
764
-
765
- var DESCRIPTORS$3 = descriptors;
766
- var definePropertyModule$3 = objectDefineProperty;
767
- var createPropertyDescriptor = createPropertyDescriptor$2;
768
-
769
- var createNonEnumerableProperty$2 = DESCRIPTORS$3 ? function (object, key, value) {
770
- return definePropertyModule$3.f(object, key, createPropertyDescriptor(1, value));
771
- } : function (object, key, value) {
772
- object[key] = value;
773
- return object;
774
- };
775
-
776
- var makeBuiltIn$2 = {exports: {}};
777
-
778
- var DESCRIPTORS$2 = descriptors;
779
- var hasOwn$4 = hasOwnProperty_1;
780
-
781
- var FunctionPrototype = Function.prototype;
782
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
783
- var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
784
-
785
- var EXISTS = hasOwn$4(FunctionPrototype, 'name');
786
- // additional protection from minified / mangled / dropped function names
787
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
788
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype, 'name').configurable));
789
-
790
- var functionName = {
791
- EXISTS: EXISTS,
792
- PROPER: PROPER,
793
- CONFIGURABLE: CONFIGURABLE
794
- };
795
-
796
- var uncurryThis$5 = functionUncurryThis;
797
- var isCallable$6 = isCallable$c;
798
- var store$1 = sharedStore;
799
-
800
- var functionToString = uncurryThis$5(Function.toString);
801
-
802
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
803
- if (!isCallable$6(store$1.inspectSource)) {
804
- store$1.inspectSource = function (it) {
805
- return functionToString(it);
806
- };
807
- }
808
-
809
- var inspectSource$2 = store$1.inspectSource;
810
-
811
- var global$3 = global$a;
812
- var isCallable$5 = isCallable$c;
813
-
814
- var WeakMap$1 = global$3.WeakMap;
815
-
816
- var weakMapBasicDetection = isCallable$5(WeakMap$1) && /native code/.test(String(WeakMap$1));
817
-
818
- var shared$1 = shared$3.exports;
819
- var uid = uid$2;
820
-
821
- var keys = shared$1('keys');
822
-
823
- var sharedKey$2 = function (key) {
824
- return keys[key] || (keys[key] = uid(key));
825
- };
826
-
827
- var hiddenKeys$4 = {};
828
-
829
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
830
- var global$2 = global$a;
831
- var isObject$1 = isObject$6;
832
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
833
- var hasOwn$3 = hasOwnProperty_1;
834
- var shared = sharedStore;
835
- var sharedKey$1 = sharedKey$2;
836
- var hiddenKeys$3 = hiddenKeys$4;
837
-
838
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
839
- var TypeError$1 = global$2.TypeError;
840
- var WeakMap = global$2.WeakMap;
841
- var set, get, has;
842
-
843
- var enforce = function (it) {
844
- return has(it) ? get(it) : set(it, {});
845
- };
846
-
847
- var getterFor = function (TYPE) {
848
- return function (it) {
849
- var state;
850
- if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
851
- throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
852
- } return state;
853
- };
854
- };
855
-
856
- if (NATIVE_WEAK_MAP || shared.state) {
857
- var store = shared.state || (shared.state = new WeakMap());
858
- /* eslint-disable no-self-assign -- prototype methods protection */
859
- store.get = store.get;
860
- store.has = store.has;
861
- store.set = store.set;
862
- /* eslint-enable no-self-assign -- prototype methods protection */
863
- set = function (it, metadata) {
864
- if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
865
- metadata.facade = it;
866
- store.set(it, metadata);
867
- return metadata;
868
- };
869
- get = function (it) {
870
- return store.get(it) || {};
871
- };
872
- has = function (it) {
873
- return store.has(it);
874
- };
875
- } else {
876
- var STATE = sharedKey$1('state');
877
- hiddenKeys$3[STATE] = true;
878
- set = function (it, metadata) {
879
- if (hasOwn$3(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
880
- metadata.facade = it;
881
- createNonEnumerableProperty$1(it, STATE, metadata);
882
- return metadata;
883
- };
884
- get = function (it) {
885
- return hasOwn$3(it, STATE) ? it[STATE] : {};
886
- };
887
- has = function (it) {
888
- return hasOwn$3(it, STATE);
889
- };
890
- }
891
-
892
- var internalState = {
893
- set: set,
894
- get: get,
895
- has: has,
896
- enforce: enforce,
897
- getterFor: getterFor
898
- };
899
-
900
- var fails$2 = fails$9;
901
- var isCallable$4 = isCallable$c;
902
- var hasOwn$2 = hasOwnProperty_1;
903
- var DESCRIPTORS$1 = descriptors;
904
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
905
- var inspectSource$1 = inspectSource$2;
906
- var InternalStateModule = internalState;
907
-
908
- var enforceInternalState = InternalStateModule.enforce;
909
- var getInternalState = InternalStateModule.get;
910
- // eslint-disable-next-line es/no-object-defineproperty -- safe
911
- var defineProperty$1 = Object.defineProperty;
912
-
913
- var CONFIGURABLE_LENGTH = DESCRIPTORS$1 && !fails$2(function () {
914
- return defineProperty$1(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
915
- });
916
-
917
- var TEMPLATE = String(String).split('String');
918
-
919
- var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
920
- if (String(name).slice(0, 7) === 'Symbol(') {
921
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
922
- }
923
- if (options && options.getter) name = 'get ' + name;
924
- if (options && options.setter) name = 'set ' + name;
925
- if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
926
- if (DESCRIPTORS$1) defineProperty$1(value, 'name', { value: name, configurable: true });
927
- else value.name = name;
928
- }
929
- if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
930
- defineProperty$1(value, 'length', { value: options.arity });
931
- }
932
- try {
933
- if (options && hasOwn$2(options, 'constructor') && options.constructor) {
934
- if (DESCRIPTORS$1) defineProperty$1(value, 'prototype', { writable: false });
935
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
936
- } else if (value.prototype) value.prototype = undefined;
937
- } catch (error) { /* empty */ }
938
- var state = enforceInternalState(value);
939
- if (!hasOwn$2(state, 'source')) {
940
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
941
- } return value;
942
- };
943
-
944
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
945
- // eslint-disable-next-line no-extend-native -- required
946
- Function.prototype.toString = makeBuiltIn$1(function toString() {
947
- return isCallable$4(this) && getInternalState(this).source || inspectSource$1(this);
948
- }, 'toString');
949
-
950
- var isCallable$3 = isCallable$c;
951
- var definePropertyModule$2 = objectDefineProperty;
952
- var makeBuiltIn = makeBuiltIn$2.exports;
953
- var defineGlobalProperty$1 = defineGlobalProperty$3;
954
-
955
- var defineBuiltIn$1 = function (O, key, value, options) {
956
- if (!options) options = {};
957
- var simple = options.enumerable;
958
- var name = options.name !== undefined ? options.name : key;
959
- if (isCallable$3(value)) makeBuiltIn(value, name, options);
960
- if (options.global) {
961
- if (simple) O[key] = value;
962
- else defineGlobalProperty$1(key, value);
963
- } else {
964
- try {
965
- if (!options.unsafe) delete O[key];
966
- else if (O[key]) simple = true;
967
- } catch (error) { /* empty */ }
968
- if (simple) O[key] = value;
969
- else definePropertyModule$2.f(O, key, {
970
- value: value,
971
- enumerable: false,
972
- configurable: !options.nonConfigurable,
973
- writable: !options.nonWritable
974
- });
975
- } return O;
976
- };
977
-
978
- var objectGetOwnPropertyNames = {};
979
-
980
- var ceil = Math.ceil;
981
- var floor = Math.floor;
982
-
983
- // `Math.trunc` method
984
- // https://tc39.es/ecma262/#sec-math.trunc
985
- // eslint-disable-next-line es/no-math-trunc -- safe
986
- var mathTrunc = Math.trunc || function trunc(x) {
987
- var n = +x;
988
- return (n > 0 ? floor : ceil)(n);
989
- };
990
-
991
- var trunc = mathTrunc;
992
-
993
- // `ToIntegerOrInfinity` abstract operation
994
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
995
- var toIntegerOrInfinity$2 = function (argument) {
996
- var number = +argument;
997
- // eslint-disable-next-line no-self-compare -- NaN check
998
- return number !== number || number === 0 ? 0 : trunc(number);
999
- };
1000
-
1001
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
1002
-
1003
- var max = Math.max;
1004
- var min$1 = Math.min;
1005
-
1006
- // Helper for a popular repeating case of the spec:
1007
- // Let integer be ? ToInteger(index).
1008
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1009
- var toAbsoluteIndex$1 = function (index, length) {
1010
- var integer = toIntegerOrInfinity$1(index);
1011
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1012
- };
1013
-
1014
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
1015
-
1016
- var min = Math.min;
1017
-
1018
- // `ToLength` abstract operation
1019
- // https://tc39.es/ecma262/#sec-tolength
1020
- var toLength$1 = function (argument) {
1021
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
1022
- };
1023
-
1024
- var toLength = toLength$1;
1025
-
1026
- // `LengthOfArrayLike` abstract operation
1027
- // https://tc39.es/ecma262/#sec-lengthofarraylike
1028
- var lengthOfArrayLike$2 = function (obj) {
1029
- return toLength(obj.length);
1030
- };
1031
-
1032
- var toIndexedObject$2 = toIndexedObject$4;
1033
- var toAbsoluteIndex = toAbsoluteIndex$1;
1034
- var lengthOfArrayLike$1 = lengthOfArrayLike$2;
1035
-
1036
- // `Array.prototype.{ indexOf, includes }` methods implementation
1037
- var createMethod$1 = function (IS_INCLUDES) {
1038
- return function ($this, el, fromIndex) {
1039
- var O = toIndexedObject$2($this);
1040
- var length = lengthOfArrayLike$1(O);
1041
- var index = toAbsoluteIndex(fromIndex, length);
1042
- var value;
1043
- // Array#includes uses SameValueZero equality algorithm
1044
- // eslint-disable-next-line no-self-compare -- NaN check
1045
- if (IS_INCLUDES && el != el) while (length > index) {
1046
- value = O[index++];
1047
- // eslint-disable-next-line no-self-compare -- NaN check
1048
- if (value != value) return true;
1049
- // Array#indexOf ignores holes, Array#includes - not
1050
- } else for (;length > index; index++) {
1051
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1052
- } return !IS_INCLUDES && -1;
1053
- };
1054
- };
1055
-
1056
- var arrayIncludes = {
1057
- // `Array.prototype.includes` method
1058
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1059
- includes: createMethod$1(true),
1060
- // `Array.prototype.indexOf` method
1061
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
1062
- indexOf: createMethod$1(false)
1063
- };
1064
-
1065
- var uncurryThis$4 = functionUncurryThis;
1066
- var hasOwn$1 = hasOwnProperty_1;
1067
- var toIndexedObject$1 = toIndexedObject$4;
1068
- var indexOf = arrayIncludes.indexOf;
1069
- var hiddenKeys$2 = hiddenKeys$4;
1070
-
1071
- var push$1 = uncurryThis$4([].push);
1072
-
1073
- var objectKeysInternal = function (object, names) {
1074
- var O = toIndexedObject$1(object);
1075
- var i = 0;
1076
- var result = [];
1077
- var key;
1078
- for (key in O) !hasOwn$1(hiddenKeys$2, key) && hasOwn$1(O, key) && push$1(result, key);
1079
- // Don't enum bug & hidden keys
1080
- while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
1081
- ~indexOf(result, key) || push$1(result, key);
1082
- }
1083
- return result;
1084
- };
1085
-
1086
- // IE8- don't enum bug keys
1087
- var enumBugKeys$3 = [
1088
- 'constructor',
1089
- 'hasOwnProperty',
1090
- 'isPrototypeOf',
1091
- 'propertyIsEnumerable',
1092
- 'toLocaleString',
1093
- 'toString',
1094
- 'valueOf'
1095
- ];
1096
-
1097
- var internalObjectKeys$1 = objectKeysInternal;
1098
- var enumBugKeys$2 = enumBugKeys$3;
1099
-
1100
- var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
1101
-
1102
- // `Object.getOwnPropertyNames` method
1103
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
1104
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1105
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1106
- return internalObjectKeys$1(O, hiddenKeys$1);
1107
- };
1108
-
1109
- var objectGetOwnPropertySymbols = {};
1110
-
1111
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1112
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1113
-
1114
- var getBuiltIn$2 = getBuiltIn$5;
1115
- var uncurryThis$3 = functionUncurryThis;
1116
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1117
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1118
- var anObject$2 = anObject$4;
1119
-
1120
- var concat = uncurryThis$3([].concat);
1121
-
1122
- // all object keys, includes non-enumerable and symbols
1123
- var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
1124
- var keys = getOwnPropertyNamesModule.f(anObject$2(it));
1125
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1126
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
1127
- };
1128
-
1129
- var hasOwn = hasOwnProperty_1;
1130
- var ownKeys = ownKeys$1;
1131
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1132
- var definePropertyModule$1 = objectDefineProperty;
1133
-
1134
- var copyConstructorProperties$1 = function (target, source, exceptions) {
1135
- var keys = ownKeys(source);
1136
- var defineProperty = definePropertyModule$1.f;
1137
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1138
- for (var i = 0; i < keys.length; i++) {
1139
- var key = keys[i];
1140
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
1141
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1142
- }
1143
- }
1144
- };
1145
-
1146
- var fails$1 = fails$9;
1147
- var isCallable$2 = isCallable$c;
1148
-
1149
- var replacement = /#|\.prototype\./;
1150
-
1151
- var isForced$1 = function (feature, detection) {
1152
- var value = data[normalize(feature)];
1153
- return value == POLYFILL ? true
1154
- : value == NATIVE ? false
1155
- : isCallable$2(detection) ? fails$1(detection)
1156
- : !!detection;
1157
- };
1158
-
1159
- var normalize = isForced$1.normalize = function (string) {
1160
- return String(string).replace(replacement, '.').toLowerCase();
1161
- };
1162
-
1163
- var data = isForced$1.data = {};
1164
- var NATIVE = isForced$1.NATIVE = 'N';
1165
- var POLYFILL = isForced$1.POLYFILL = 'P';
1166
-
1167
- var isForced_1 = isForced$1;
1168
-
1169
- var global$1 = global$a;
1170
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1171
- var createNonEnumerableProperty = createNonEnumerableProperty$2;
1172
- var defineBuiltIn = defineBuiltIn$1;
1173
- var defineGlobalProperty = defineGlobalProperty$3;
1174
- var copyConstructorProperties = copyConstructorProperties$1;
1175
- var isForced = isForced_1;
1176
-
1177
- /*
1178
- options.target - name of the target object
1179
- options.global - target is the global object
1180
- options.stat - export as static methods of target
1181
- options.proto - export as prototype methods of target
1182
- options.real - real prototype method for the `pure` version
1183
- options.forced - export even if the native feature is available
1184
- options.bind - bind methods to the target, required for the `pure` version
1185
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1186
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
1187
- options.sham - add a flag to not completely full polyfills
1188
- options.enumerable - export as enumerable property
1189
- options.dontCallGetSet - prevent calling a getter on target
1190
- options.name - the .name of the function if it does not match the key
1191
- */
1192
- var _export = function (options, source) {
1193
- var TARGET = options.target;
1194
- var GLOBAL = options.global;
1195
- var STATIC = options.stat;
1196
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1197
- if (GLOBAL) {
1198
- target = global$1;
1199
- } else if (STATIC) {
1200
- target = global$1[TARGET] || defineGlobalProperty(TARGET, {});
1201
- } else {
1202
- target = (global$1[TARGET] || {}).prototype;
1203
- }
1204
- if (target) for (key in source) {
1205
- sourceProperty = source[key];
1206
- if (options.dontCallGetSet) {
1207
- descriptor = getOwnPropertyDescriptor(target, key);
1208
- targetProperty = descriptor && descriptor.value;
1209
- } else targetProperty = target[key];
1210
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1211
- // contained in target
1212
- if (!FORCED && targetProperty !== undefined) {
1213
- if (typeof sourceProperty == typeof targetProperty) continue;
1214
- copyConstructorProperties(sourceProperty, targetProperty);
1215
- }
1216
- // add a flag to not completely full polyfills
1217
- if (options.sham || (targetProperty && targetProperty.sham)) {
1218
- createNonEnumerableProperty(sourceProperty, 'sham', true);
1219
- }
1220
- defineBuiltIn(target, key, sourceProperty, options);
1221
- }
1222
- };
1223
-
1224
- var uncurryThis$2 = functionUncurryThis;
1225
- var aCallable = aCallable$2;
1226
- var NATIVE_BIND = functionBindNative;
1227
-
1228
- var bind$1 = uncurryThis$2(uncurryThis$2.bind);
1229
-
1230
- // optional / simple context binding
1231
- var functionBindContext = function (fn, that) {
1232
- aCallable(fn);
1233
- return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
1234
- return fn.apply(that, arguments);
1235
- };
1236
- };
1237
-
1238
- var classof$2 = classofRaw$2;
1239
-
1240
- // `IsArray` abstract operation
1241
- // https://tc39.es/ecma262/#sec-isarray
1242
- // eslint-disable-next-line es/no-array-isarray -- safe
1243
- var isArray$1 = Array.isArray || function isArray(argument) {
1244
- return classof$2(argument) == 'Array';
1245
- };
1246
-
1247
- var wellKnownSymbol$3 = wellKnownSymbol$5;
1248
-
1249
- var TO_STRING_TAG$1 = wellKnownSymbol$3('toStringTag');
1250
- var test = {};
1251
-
1252
- test[TO_STRING_TAG$1] = 'z';
1253
-
1254
- var toStringTagSupport = String(test) === '[object z]';
1255
-
1256
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1257
- var isCallable$1 = isCallable$c;
1258
- var classofRaw = classofRaw$2;
1259
- var wellKnownSymbol$2 = wellKnownSymbol$5;
1260
-
1261
- var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
1262
- var $Object = Object;
1263
-
1264
- // ES3 wrong here
1265
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1266
-
1267
- // fallback for IE11 Script Access Denied error
1268
- var tryGet = function (it, key) {
1269
- try {
1270
- return it[key];
1271
- } catch (error) { /* empty */ }
1272
- };
1273
-
1274
- // getting tag from ES6+ `Object.prototype.toString`
1275
- var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1276
- var O, tag, result;
1277
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1278
- // @@toStringTag case
1279
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1280
- // builtinTag case
1281
- : CORRECT_ARGUMENTS ? classofRaw(O)
1282
- // ES3 arguments fallback
1283
- : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1284
- };
1285
-
1286
- var uncurryThis$1 = functionUncurryThis;
1287
- var fails = fails$9;
1288
- var isCallable = isCallable$c;
1289
- var classof = classof$1;
1290
- var getBuiltIn$1 = getBuiltIn$5;
1291
- var inspectSource = inspectSource$2;
1292
-
1293
- var noop = function () { /* empty */ };
1294
- var empty = [];
1295
- var construct = getBuiltIn$1('Reflect', 'construct');
1296
- var constructorRegExp = /^\s*(?:class|function)\b/;
1297
- var exec = uncurryThis$1(constructorRegExp.exec);
1298
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1299
-
1300
- var isConstructorModern = function isConstructor(argument) {
1301
- if (!isCallable(argument)) return false;
1302
- try {
1303
- construct(noop, empty, argument);
1304
- return true;
1305
- } catch (error) {
1306
- return false;
1307
- }
1308
- };
1309
-
1310
- var isConstructorLegacy = function isConstructor(argument) {
1311
- if (!isCallable(argument)) return false;
1312
- switch (classof(argument)) {
1313
- case 'AsyncFunction':
1314
- case 'GeneratorFunction':
1315
- case 'AsyncGeneratorFunction': return false;
1316
- }
1317
- try {
1318
- // we can't check .prototype since constructors produced by .bind haven't it
1319
- // `Function#toString` throws on some built-it function in some legacy engines
1320
- // (for example, `DOMQuad` and similar in FF41-)
1321
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
1322
- } catch (error) {
1323
- return true;
1324
- }
1325
- };
1326
-
1327
- isConstructorLegacy.sham = true;
1328
-
1329
- // `IsConstructor` abstract operation
1330
- // https://tc39.es/ecma262/#sec-isconstructor
1331
- var isConstructor$1 = !construct || fails(function () {
1332
- var called;
1333
- return isConstructorModern(isConstructorModern.call)
1334
- || !isConstructorModern(Object)
1335
- || !isConstructorModern(function () { called = true; })
1336
- || called;
1337
- }) ? isConstructorLegacy : isConstructorModern;
1338
-
1339
- var isArray = isArray$1;
1340
- var isConstructor = isConstructor$1;
1341
- var isObject = isObject$6;
1342
- var wellKnownSymbol$1 = wellKnownSymbol$5;
1343
-
1344
- var SPECIES = wellKnownSymbol$1('species');
1345
- var $Array = Array;
1346
-
1347
- // a part of `ArraySpeciesCreate` abstract operation
1348
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
1349
- var arraySpeciesConstructor$1 = function (originalArray) {
1350
- var C;
1351
- if (isArray(originalArray)) {
1352
- C = originalArray.constructor;
1353
- // cross-realm fallback
1354
- if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
1355
- else if (isObject(C)) {
1356
- C = C[SPECIES];
1357
- if (C === null) C = undefined;
1358
- }
1359
- } return C === undefined ? $Array : C;
1360
- };
1361
-
1362
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
1363
-
1364
- // `ArraySpeciesCreate` abstract operation
1365
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
1366
- var arraySpeciesCreate$1 = function (originalArray, length) {
1367
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1368
- };
1369
-
1370
- var bind = functionBindContext;
1371
- var uncurryThis = functionUncurryThis;
1372
- var IndexedObject = indexedObject;
1373
- var toObject = toObject$2;
1374
- var lengthOfArrayLike = lengthOfArrayLike$2;
1375
- var arraySpeciesCreate = arraySpeciesCreate$1;
1376
-
1377
- var push = uncurryThis([].push);
1378
-
1379
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1380
- var createMethod = function (TYPE) {
1381
- var IS_MAP = TYPE == 1;
1382
- var IS_FILTER = TYPE == 2;
1383
- var IS_SOME = TYPE == 3;
1384
- var IS_EVERY = TYPE == 4;
1385
- var IS_FIND_INDEX = TYPE == 6;
1386
- var IS_FILTER_REJECT = TYPE == 7;
1387
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
1388
- return function ($this, callbackfn, that, specificCreate) {
1389
- var O = toObject($this);
1390
- var self = IndexedObject(O);
1391
- var boundFunction = bind(callbackfn, that);
1392
- var length = lengthOfArrayLike(self);
1393
- var index = 0;
1394
- var create = specificCreate || arraySpeciesCreate;
1395
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
1396
- var value, result;
1397
- for (;length > index; index++) if (NO_HOLES || index in self) {
1398
- value = self[index];
1399
- result = boundFunction(value, index, O);
1400
- if (TYPE) {
1401
- if (IS_MAP) target[index] = result; // map
1402
- else if (result) switch (TYPE) {
1403
- case 3: return true; // some
1404
- case 5: return value; // find
1405
- case 6: return index; // findIndex
1406
- case 2: push(target, value); // filter
1407
- } else switch (TYPE) {
1408
- case 4: return false; // every
1409
- case 7: push(target, value); // filterReject
1410
- }
1411
- }
1412
- }
1413
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
1414
- };
1415
- };
1416
-
1417
- var arrayIteration = {
1418
- // `Array.prototype.forEach` method
1419
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
1420
- forEach: createMethod(0),
1421
- // `Array.prototype.map` method
1422
- // https://tc39.es/ecma262/#sec-array.prototype.map
1423
- map: createMethod(1),
1424
- // `Array.prototype.filter` method
1425
- // https://tc39.es/ecma262/#sec-array.prototype.filter
1426
- filter: createMethod(2),
1427
- // `Array.prototype.some` method
1428
- // https://tc39.es/ecma262/#sec-array.prototype.some
1429
- some: createMethod(3),
1430
- // `Array.prototype.every` method
1431
- // https://tc39.es/ecma262/#sec-array.prototype.every
1432
- every: createMethod(4),
1433
- // `Array.prototype.find` method
1434
- // https://tc39.es/ecma262/#sec-array.prototype.find
1435
- find: createMethod(5),
1436
- // `Array.prototype.findIndex` method
1437
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
1438
- findIndex: createMethod(6),
1439
- // `Array.prototype.filterReject` method
1440
- // https://github.com/tc39/proposal-array-filtering
1441
- filterReject: createMethod(7)
1442
- };
1443
-
1444
- var objectDefineProperties = {};
1445
-
1446
- var internalObjectKeys = objectKeysInternal;
1447
- var enumBugKeys$1 = enumBugKeys$3;
1448
-
1449
- // `Object.keys` method
1450
- // https://tc39.es/ecma262/#sec-object.keys
1451
- // eslint-disable-next-line es/no-object-keys -- safe
1452
- var objectKeys$1 = Object.keys || function keys(O) {
1453
- return internalObjectKeys(O, enumBugKeys$1);
1454
- };
1455
-
1456
- var DESCRIPTORS = descriptors;
1457
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1458
- var definePropertyModule = objectDefineProperty;
1459
- var anObject$1 = anObject$4;
1460
- var toIndexedObject = toIndexedObject$4;
1461
- var objectKeys = objectKeys$1;
1462
-
1463
- // `Object.defineProperties` method
1464
- // https://tc39.es/ecma262/#sec-object.defineproperties
1465
- // eslint-disable-next-line es/no-object-defineproperties -- safe
1466
- objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1467
- anObject$1(O);
1468
- var props = toIndexedObject(Properties);
1469
- var keys = objectKeys(Properties);
1470
- var length = keys.length;
1471
- var index = 0;
1472
- var key;
1473
- while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1474
- return O;
1475
- };
1476
-
1477
- var getBuiltIn = getBuiltIn$5;
1478
-
1479
- var html$1 = getBuiltIn('document', 'documentElement');
1480
-
1481
- /* global ActiveXObject -- old IE, WSH */
1482
-
1483
- var anObject = anObject$4;
1484
- var definePropertiesModule = objectDefineProperties;
1485
- var enumBugKeys = enumBugKeys$3;
1486
- var hiddenKeys = hiddenKeys$4;
1487
- var html = html$1;
1488
- var documentCreateElement = documentCreateElement$1;
1489
- var sharedKey = sharedKey$2;
1490
-
1491
- var GT = '>';
1492
- var LT = '<';
1493
- var PROTOTYPE = 'prototype';
1494
- var SCRIPT = 'script';
1495
- var IE_PROTO = sharedKey('IE_PROTO');
1496
-
1497
- var EmptyConstructor = function () { /* empty */ };
1498
-
1499
- var scriptTag = function (content) {
1500
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1501
- };
1502
-
1503
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1504
- var NullProtoObjectViaActiveX = function (activeXDocument) {
1505
- activeXDocument.write(scriptTag(''));
1506
- activeXDocument.close();
1507
- var temp = activeXDocument.parentWindow.Object;
1508
- activeXDocument = null; // avoid memory leak
1509
- return temp;
1510
- };
1511
-
1512
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
1513
- var NullProtoObjectViaIFrame = function () {
1514
- // Thrash, waste and sodomy: IE GC bug
1515
- var iframe = documentCreateElement('iframe');
1516
- var JS = 'java' + SCRIPT + ':';
1517
- var iframeDocument;
1518
- iframe.style.display = 'none';
1519
- html.appendChild(iframe);
1520
- // https://github.com/zloirock/core-js/issues/475
1521
- iframe.src = String(JS);
1522
- iframeDocument = iframe.contentWindow.document;
1523
- iframeDocument.open();
1524
- iframeDocument.write(scriptTag('document.F=Object'));
1525
- iframeDocument.close();
1526
- return iframeDocument.F;
1527
- };
1528
-
1529
- // Check for document.domain and active x support
1530
- // No need to use active x approach when document.domain is not set
1531
- // see https://github.com/es-shims/es5-shim/issues/150
1532
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1533
- // avoid IE GC bug
1534
- var activeXDocument;
1535
- var NullProtoObject = function () {
1536
- try {
1537
- activeXDocument = new ActiveXObject('htmlfile');
1538
- } catch (error) { /* ignore */ }
1539
- NullProtoObject = typeof document != 'undefined'
1540
- ? document.domain && activeXDocument
1541
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1542
- : NullProtoObjectViaIFrame()
1543
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
1544
- var length = enumBugKeys.length;
1545
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1546
- return NullProtoObject();
1547
- };
1548
-
1549
- hiddenKeys[IE_PROTO] = true;
1550
-
1551
- // `Object.create` method
1552
- // https://tc39.es/ecma262/#sec-object.create
1553
- // eslint-disable-next-line es/no-object-create -- safe
1554
- var objectCreate = Object.create || function create(O, Properties) {
1555
- var result;
1556
- if (O !== null) {
1557
- EmptyConstructor[PROTOTYPE] = anObject(O);
1558
- result = new EmptyConstructor();
1559
- EmptyConstructor[PROTOTYPE] = null;
1560
- // add "__proto__" for Object.getPrototypeOf polyfill
1561
- result[IE_PROTO] = O;
1562
- } else result = NullProtoObject();
1563
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1564
- };
1565
-
1566
- var wellKnownSymbol = wellKnownSymbol$5;
1567
- var create = objectCreate;
1568
- var defineProperty = objectDefineProperty.f;
1569
-
1570
- var UNSCOPABLES = wellKnownSymbol('unscopables');
1571
- var ArrayPrototype = Array.prototype;
1572
-
1573
- // Array.prototype[@@unscopables]
1574
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1575
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
1576
- defineProperty(ArrayPrototype, UNSCOPABLES, {
1577
- configurable: true,
1578
- value: create(null)
1579
- });
1580
- }
1581
-
1582
- // add a key to Array.prototype[@@unscopables]
1583
- var addToUnscopables$1 = function (key) {
1584
- ArrayPrototype[UNSCOPABLES][key] = true;
1585
- };
1586
-
1587
- var $ = _export;
1588
- var $find = arrayIteration.find;
1589
- var addToUnscopables = addToUnscopables$1;
1590
-
1591
- var FIND = 'find';
1592
- var SKIPS_HOLES = true;
1593
-
1594
- // Shouldn't skip holes
1595
- if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
1596
-
1597
- // `Array.prototype.find` method
1598
- // https://tc39.es/ecma262/#sec-array.prototype.find
1599
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
1600
- find: function find(callbackfn /* , that = undefined */) {
1601
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1602
- }
1603
- });
1604
-
1605
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1606
- addToUnscopables(FIND);
1607
-
1608
- var CONSTANT = {
1609
- GLOBAL: {
1610
- HIDE: '__react_tooltip_hide_event',
1611
- REBUILD: '__react_tooltip_rebuild_event',
1612
- SHOW: '__react_tooltip_show_event'
1613
- }
1614
- };
1615
-
1616
- /**
1617
- * Static methods for react-tooltip
1618
- */
1619
- var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
1620
- // Compatible with IE
1621
- // @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
1622
- // @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
1623
- var event;
1624
- if (typeof window.CustomEvent === 'function') {
1625
- event = new window.CustomEvent(eventName, {
1626
- detail: opts
1627
- });
1628
- } else {
1629
- event = document.createEvent('Event');
1630
- event.initEvent(eventName, false, true, opts);
1631
- }
1632
- window.dispatchEvent(event);
1633
- };
1634
- function staticMethods (target) {
1635
- /**
1636
- * Hide all tooltip
1637
- * @trigger ReactTooltip.hide()
1638
- */
1639
- target.hide = function (target) {
1640
- dispatchGlobalEvent(CONSTANT.GLOBAL.HIDE, {
1641
- target: target
1642
- });
1643
- };
1644
-
1645
- /**
1646
- * Rebuild all tooltip
1647
- * @trigger ReactTooltip.rebuild()
1648
- */
1649
- target.rebuild = function () {
1650
- dispatchGlobalEvent(CONSTANT.GLOBAL.REBUILD);
1651
- };
1652
-
1653
- /**
1654
- * Show specific tooltip
1655
- * @trigger ReactTooltip.show()
1656
- */
1657
- target.show = function (target) {
1658
- dispatchGlobalEvent(CONSTANT.GLOBAL.SHOW, {
1659
- target: target
1660
- });
1661
- };
1662
- target.prototype.globalRebuild = function () {
1663
- if (this.mount) {
1664
- this.unbindListener();
1665
- this.bindListener();
1666
- }
1667
- };
1668
- target.prototype.globalShow = function (event) {
1669
- if (this.mount) {
1670
- var hasTarget = event && event.detail && event.detail.target && true || false;
1671
- // Create a fake event, specific show will limit the type to `solid`
1672
- // only `float` type cares e.clientX e.clientY
1673
- this.showTooltip({
1674
- currentTarget: hasTarget && event.detail.target
1675
- }, true);
1676
- }
1677
- };
1678
- target.prototype.globalHide = function (event) {
1679
- if (this.mount) {
1680
- var hasTarget = event && event.detail && event.detail.target && true || false;
1681
- this.hideTooltip({
1682
- currentTarget: hasTarget && event.detail.target
1683
- }, hasTarget);
1684
- }
1685
- };
1686
- }
1687
-
1688
- /**
1689
- * Events that should be bound to the window
1690
- */
1691
- function windowListener (target) {
1692
- target.prototype.bindWindowEvents = function (resizeHide) {
1693
- // ReactTooltip.hide
1694
- window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
1695
- window.addEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide, false);
1696
-
1697
- // ReactTooltip.rebuild
1698
- window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
1699
- window.addEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild, false);
1700
-
1701
- // ReactTooltip.show
1702
- window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
1703
- window.addEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow, false);
1704
-
1705
- // Resize
1706
- if (resizeHide) {
1707
- window.removeEventListener('resize', this.onWindowResize);
1708
- window.addEventListener('resize', this.onWindowResize, false);
1709
- }
1710
- };
1711
- target.prototype.unbindWindowEvents = function () {
1712
- window.removeEventListener(CONSTANT.GLOBAL.HIDE, this.globalHide);
1713
- window.removeEventListener(CONSTANT.GLOBAL.REBUILD, this.globalRebuild);
1714
- window.removeEventListener(CONSTANT.GLOBAL.SHOW, this.globalShow);
1715
- window.removeEventListener('resize', this.onWindowResize);
1716
- };
1717
-
1718
- /**
1719
- * invoked by resize event of window
1720
- */
1721
- target.prototype.onWindowResize = function () {
1722
- if (!this.mount) return;
1723
- this.hideTooltip();
1724
- };
1725
- }
1726
-
1727
- /**
1728
- * Custom events to control showing and hiding of tooltip
1729
- *
1730
- * @attributes
1731
- * - `event` {String}
1732
- * - `eventOff` {String}
1733
- */
1734
-
1735
- var checkStatus = function checkStatus(dataEventOff, e) {
1736
- var show = this.state.show;
1737
- var id = this.props.id;
1738
- var isCapture = this.isCapture(e.currentTarget);
1739
- var currentItem = e.currentTarget.getAttribute('currentItem');
1740
- if (!isCapture) e.stopPropagation();
1741
- if (show && currentItem === 'true') {
1742
- if (!dataEventOff) this.hideTooltip(e);
1743
- } else {
1744
- e.currentTarget.setAttribute('currentItem', 'true');
1745
- setUntargetItems(e.currentTarget, this.getTargetArray(id));
1746
- this.showTooltip(e);
1747
- }
1748
- };
1749
- var setUntargetItems = function setUntargetItems(currentTarget, targetArray) {
1750
- for (var i = 0; i < targetArray.length; i++) {
1751
- if (currentTarget !== targetArray[i]) {
1752
- targetArray[i].setAttribute('currentItem', 'false');
1753
- } else {
1754
- targetArray[i].setAttribute('currentItem', 'true');
1755
- }
1756
- }
1757
- };
1758
- var customListeners = {
1759
- id: '9b69f92e-d3fe-498b-b1b4-c5e63a51b0cf',
1760
- set: function set(target, event, listener) {
1761
- if (this.id in target) {
1762
- var map = target[this.id];
1763
- map[event] = listener;
1764
- } else {
1765
- // this is workaround for WeakMap, which is not supported in older browsers, such as IE
1766
- Object.defineProperty(target, this.id, {
1767
- configurable: true,
1768
- value: _defineProperty({}, event, listener)
1769
- });
1770
- }
1771
- },
1772
- get: function get(target, event) {
1773
- var map = target[this.id];
1774
- if (map !== undefined) {
1775
- return map[event];
1776
- }
1777
- }
1778
- };
1779
- function customEvent (target) {
1780
- target.prototype.isCustomEvent = function (ele) {
1781
- var event = this.state.event;
1782
- return event || !!ele.getAttribute('data-event');
1783
- };
1784
-
1785
- /* Bind listener for custom event */
1786
- target.prototype.customBindListener = function (ele) {
1787
- var _this = this;
1788
- var _this$state = this.state,
1789
- event = _this$state.event,
1790
- eventOff = _this$state.eventOff;
1791
- var dataEvent = ele.getAttribute('data-event') || event;
1792
- var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
1793
- dataEvent.split(' ').forEach(function (event) {
1794
- ele.removeEventListener(event, customListeners.get(ele, event));
1795
- var customListener = checkStatus.bind(_this, dataEventOff);
1796
- customListeners.set(ele, event, customListener);
1797
- ele.addEventListener(event, customListener, false);
1798
- });
1799
- if (dataEventOff) {
1800
- dataEventOff.split(' ').forEach(function (event) {
1801
- ele.removeEventListener(event, _this.hideTooltip);
1802
- ele.addEventListener(event, _this.hideTooltip, false);
1803
- });
1804
- }
1805
- };
1806
-
1807
- /* Unbind listener for custom event */
1808
- target.prototype.customUnbindListener = function (ele) {
1809
- var _this$state2 = this.state,
1810
- event = _this$state2.event,
1811
- eventOff = _this$state2.eventOff;
1812
- var dataEvent = event || ele.getAttribute('data-event');
1813
- var dataEventOff = eventOff || ele.getAttribute('data-event-off');
1814
- ele.removeEventListener(dataEvent, customListeners.get(ele, event));
1815
- if (dataEventOff) ele.removeEventListener(dataEventOff, this.hideTooltip);
1816
- };
1817
- }
1818
-
1819
- /**
1820
- * Util method to judge if it should follow capture model
1821
- */
1822
-
1823
- function isCapture (target) {
1824
- target.prototype.isCapture = function (currentTarget) {
1825
- return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
1826
- };
1827
- }
1828
-
1829
- /**
1830
- * Util method to get effect
1831
- */
1832
-
1833
- function getEffect (target) {
1834
- target.prototype.getEffect = function (currentTarget) {
1835
- var dataEffect = currentTarget.getAttribute('data-effect');
1836
- return dataEffect || this.props.effect || 'float';
1837
- };
1838
- }
1839
-
1840
- /**
1841
- * Util method to get effect
1842
- */
1843
- var makeProxy = function makeProxy(e) {
1844
- var proxy = {};
1845
- for (var key in e) {
1846
- if (typeof e[key] === 'function') {
1847
- proxy[key] = e[key].bind(e);
1848
- } else {
1849
- proxy[key] = e[key];
1850
- }
1851
- }
1852
- return proxy;
1853
- };
1854
- var bodyListener = function bodyListener(callback, options, e) {
1855
- var _options$respectEffec = options.respectEffect,
1856
- respectEffect = _options$respectEffec === void 0 ? false : _options$respectEffec,
1857
- _options$customEvent = options.customEvent,
1858
- customEvent = _options$customEvent === void 0 ? false : _options$customEvent;
1859
- var id = this.props.id;
1860
- var tip = null;
1861
- var forId;
1862
- var target = e.target;
1863
- var lastTarget;
1864
- // walk up parent chain until tip is found
1865
- // there is no match if parent visible area is matched by mouse position, so some corner cases might not work as expected
1866
- while (tip === null && target !== null) {
1867
- lastTarget = target;
1868
- tip = target.getAttribute('data-tip') || null;
1869
- forId = target.getAttribute('data-for') || null;
1870
- target = target.parentElement;
1871
- }
1872
- target = lastTarget || e.target;
1873
- if (this.isCustomEvent(target) && !customEvent) {
1874
- return;
1875
- }
1876
- var isTargetBelongsToTooltip = id == null && forId == null || forId === id;
1877
- if (tip != null && (!respectEffect || this.getEffect(target) === 'float') && isTargetBelongsToTooltip) {
1878
- var proxy = makeProxy(e);
1879
- proxy.currentTarget = target;
1880
- callback(proxy);
1881
- }
1882
- };
1883
- var findCustomEvents = function findCustomEvents(targetArray, dataAttribute) {
1884
- var events = {};
1885
- targetArray.forEach(function (target) {
1886
- var event = target.getAttribute(dataAttribute);
1887
- if (event) event.split(' ').forEach(function (event) {
1888
- return events[event] = true;
1889
- });
1890
- });
1891
- return events;
1892
- };
1893
- var getBody = function getBody() {
1894
- return document.getElementsByTagName('body')[0];
1895
- };
1896
- function bodyMode (target) {
1897
- target.prototype.isBodyMode = function () {
1898
- return !!this.props.bodyMode;
1899
- };
1900
- target.prototype.bindBodyListener = function (targetArray) {
1901
- var _this = this;
1902
- var _this$state = this.state,
1903
- event = _this$state.event,
1904
- eventOff = _this$state.eventOff,
1905
- possibleCustomEvents = _this$state.possibleCustomEvents,
1906
- possibleCustomEventsOff = _this$state.possibleCustomEventsOff;
1907
- var body = getBody();
1908
- var customEvents = findCustomEvents(targetArray, 'data-event');
1909
- var customEventsOff = findCustomEvents(targetArray, 'data-event-off');
1910
- if (event != null) customEvents[event] = true;
1911
- if (eventOff != null) customEventsOff[eventOff] = true;
1912
- possibleCustomEvents.split(' ').forEach(function (event) {
1913
- return customEvents[event] = true;
1914
- });
1915
- possibleCustomEventsOff.split(' ').forEach(function (event) {
1916
- return customEventsOff[event] = true;
1917
- });
1918
- this.unbindBodyListener(body);
1919
- var listeners = this.bodyModeListeners = {};
1920
- if (event == null) {
1921
- listeners.mouseover = bodyListener.bind(this, this.showTooltip, {});
1922
- listeners.mousemove = bodyListener.bind(this, this.updateTooltip, {
1923
- respectEffect: true
1924
- });
1925
- listeners.mouseout = bodyListener.bind(this, this.hideTooltip, {});
1926
- }
1927
- for (var _event in customEvents) {
1928
- listeners[_event] = bodyListener.bind(this, function (e) {
1929
- var targetEventOff = e.currentTarget.getAttribute('data-event-off') || eventOff;
1930
- checkStatus.call(_this, targetEventOff, e);
1931
- }, {
1932
- customEvent: true
1933
- });
1934
- }
1935
- for (var _event2 in customEventsOff) {
1936
- listeners[_event2] = bodyListener.bind(this, this.hideTooltip, {
1937
- customEvent: true
1938
- });
1939
- }
1940
- for (var _event3 in listeners) {
1941
- body.addEventListener(_event3, listeners[_event3]);
1942
- }
1943
- };
1944
- target.prototype.unbindBodyListener = function (body) {
1945
- body = body || getBody();
1946
- var listeners = this.bodyModeListeners;
1947
- for (var event in listeners) {
1948
- body.removeEventListener(event, listeners[event]);
1949
- }
1950
- };
1951
- }
1952
-
1953
- /**
1954
- * Tracking target removing from DOM.
1955
- * It's necessary to hide tooltip when it's target disappears.
1956
- * Otherwise, the tooltip would be shown forever until another target
1957
- * is triggered.
1958
- *
1959
- * If MutationObserver is not available, this feature just doesn't work.
1960
- */
1961
-
1962
- // https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/
1963
- var getMutationObserverClass = function getMutationObserverClass() {
1964
- return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
1965
- };
1966
- function trackRemoval (target) {
1967
- target.prototype.bindRemovalTracker = function () {
1968
- var _this = this;
1969
- var MutationObserver = getMutationObserverClass();
1970
- if (MutationObserver == null) return;
1971
- var observer = new MutationObserver(function (mutations) {
1972
- for (var m1 = 0; m1 < mutations.length; m1++) {
1973
- var mutation = mutations[m1];
1974
- for (var m2 = 0; m2 < mutation.removedNodes.length; m2++) {
1975
- var element = mutation.removedNodes[m2];
1976
- if (element === _this.state.currentTarget) {
1977
- _this.hideTooltip();
1978
- return;
1979
- }
1980
- }
1981
- }
1982
- });
1983
- observer.observe(window.document, {
1984
- childList: true,
1985
- subtree: true
1986
- });
1987
- this.removalTracker = observer;
1988
- };
1989
- target.prototype.unbindRemovalTracker = function () {
1990
- if (this.removalTracker) {
1991
- this.removalTracker.disconnect();
1992
- this.removalTracker = null;
1993
- }
1994
- };
1995
- }
1996
-
1997
- /**
1998
- * Calculate the position of tooltip
1999
- *
2000
- * @params
2001
- * - `e` {Event} the event of current mouse
2002
- * - `target` {Element} the currentTarget of the event
2003
- * - `node` {DOM} the react-tooltip object
2004
- * - `place` {String} top / right / bottom / left
2005
- * - `effect` {String} float / solid
2006
- * - `offset` {Object} the offset to default position
2007
- *
2008
- * @return {Object}
2009
- * - `isNewState` {Bool} required
2010
- * - `newState` {Object}
2011
- * - `position` {Object} {left: {Number}, top: {Number}}
2012
- */
2013
- function getPosition (e, target, node, place, desiredPlace, effect, offset) {
2014
- var _getDimensions = getDimensions(node),
2015
- tipWidth = _getDimensions.width,
2016
- tipHeight = _getDimensions.height;
2017
- var _getDimensions2 = getDimensions(target),
2018
- targetWidth = _getDimensions2.width,
2019
- targetHeight = _getDimensions2.height;
2020
- var _getCurrentOffset = getCurrentOffset(e, target, effect),
2021
- mouseX = _getCurrentOffset.mouseX,
2022
- mouseY = _getCurrentOffset.mouseY;
2023
- var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
2024
- var _calculateOffset = calculateOffset(offset),
2025
- extraOffsetX = _calculateOffset.extraOffsetX,
2026
- extraOffsetY = _calculateOffset.extraOffsetY;
2027
- var windowWidth = window.innerWidth;
2028
- var windowHeight = window.innerHeight;
2029
- var _getParent = getParent(node),
2030
- parentTop = _getParent.parentTop,
2031
- parentLeft = _getParent.parentLeft;
2032
-
2033
- // Get the edge offset of the tooltip
2034
- var getTipOffsetLeft = function getTipOffsetLeft(place) {
2035
- var offsetX = defaultOffset[place].l;
2036
- return mouseX + offsetX + extraOffsetX;
2037
- };
2038
- var getTipOffsetRight = function getTipOffsetRight(place) {
2039
- var offsetX = defaultOffset[place].r;
2040
- return mouseX + offsetX + extraOffsetX;
2041
- };
2042
- var getTipOffsetTop = function getTipOffsetTop(place) {
2043
- var offsetY = defaultOffset[place].t;
2044
- return mouseY + offsetY + extraOffsetY;
2045
- };
2046
- var getTipOffsetBottom = function getTipOffsetBottom(place) {
2047
- var offsetY = defaultOffset[place].b;
2048
- return mouseY + offsetY + extraOffsetY;
2049
- };
2050
-
2051
- //
2052
- // Functions to test whether the tooltip's sides are inside
2053
- // the client window for a given orientation p
2054
- //
2055
- // _____________
2056
- // | | <-- Right side
2057
- // | p = 'left' |\
2058
- // | |/ |\
2059
- // |_____________| |_\ <-- Mouse
2060
- // / \ |
2061
- // |
2062
- // |
2063
- // Bottom side
2064
- //
2065
- var outsideLeft = function outsideLeft(p) {
2066
- return getTipOffsetLeft(p) < 0;
2067
- };
2068
- var outsideRight = function outsideRight(p) {
2069
- return getTipOffsetRight(p) > windowWidth;
2070
- };
2071
- var outsideTop = function outsideTop(p) {
2072
- return getTipOffsetTop(p) < 0;
2073
- };
2074
- var outsideBottom = function outsideBottom(p) {
2075
- return getTipOffsetBottom(p) > windowHeight;
2076
- };
2077
-
2078
- // Check whether the tooltip with orientation p is completely inside the client window
2079
- var outside = function outside(p) {
2080
- return outsideLeft(p) || outsideRight(p) || outsideTop(p) || outsideBottom(p);
2081
- };
2082
- var inside = function inside(p) {
2083
- return !outside(p);
2084
- };
2085
- var placeIsInside = {
2086
- top: inside('top'),
2087
- bottom: inside('bottom'),
2088
- left: inside('left'),
2089
- right: inside('right')
2090
- };
2091
- function choose() {
2092
- var allPlaces = desiredPlace.split(',').concat(place, ['top', 'bottom', 'left', 'right']);
2093
- var _iterator = _createForOfIteratorHelper(allPlaces),
2094
- _step;
2095
- try {
2096
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2097
- var d = _step.value;
2098
- if (placeIsInside[d]) return d;
2099
- }
2100
- // if nothing is inside, just use the old place.
2101
- } catch (err) {
2102
- _iterator.e(err);
2103
- } finally {
2104
- _iterator.f();
2105
- }
2106
- return place;
2107
- }
2108
- var chosen = choose();
2109
- var isNewState = false;
2110
- var newPlace;
2111
- if (chosen && chosen !== place) {
2112
- isNewState = true;
2113
- newPlace = chosen;
2114
- }
2115
- if (isNewState) {
2116
- return {
2117
- isNewState: true,
2118
- newState: {
2119
- place: newPlace
2120
- }
2121
- };
2122
- }
2123
- return {
2124
- isNewState: false,
2125
- position: {
2126
- left: parseInt(getTipOffsetLeft(place) - parentLeft, 10),
2127
- top: parseInt(getTipOffsetTop(place) - parentTop, 10)
2128
- }
2129
- };
2130
- }
2131
- var getDimensions = function getDimensions(node) {
2132
- var _node$getBoundingClie = node.getBoundingClientRect(),
2133
- height = _node$getBoundingClie.height,
2134
- width = _node$getBoundingClie.width;
2135
- return {
2136
- height: parseInt(height, 10),
2137
- width: parseInt(width, 10)
2138
- };
2139
- };
2140
-
2141
- // Get current mouse offset
2142
- var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
2143
- var boundingClientRect = currentTarget.getBoundingClientRect();
2144
- var targetTop = boundingClientRect.top;
2145
- var targetLeft = boundingClientRect.left;
2146
- var _getDimensions3 = getDimensions(currentTarget),
2147
- targetWidth = _getDimensions3.width,
2148
- targetHeight = _getDimensions3.height;
2149
- if (effect === 'float') {
2150
- return {
2151
- mouseX: e.clientX,
2152
- mouseY: e.clientY
2153
- };
2154
- }
2155
- return {
2156
- mouseX: targetLeft + targetWidth / 2,
2157
- mouseY: targetTop + targetHeight / 2
2158
- };
2159
- };
2160
-
2161
- // List all possibility of tooltip final offset
2162
- // This is useful in judging if it is necessary for tooltip to switch position when out of window
2163
- var getDefaultPosition = function getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight) {
2164
- var top;
2165
- var right;
2166
- var bottom;
2167
- var left;
2168
- var disToMouse = 3;
2169
- var triangleHeight = 2;
2170
- var cursorHeight = 12; // Optimize for float bottom only, cause the cursor will hide the tooltip
2171
-
2172
- if (effect === 'float') {
2173
- top = {
2174
- l: -(tipWidth / 2),
2175
- r: tipWidth / 2,
2176
- t: -(tipHeight + disToMouse + triangleHeight),
2177
- b: -disToMouse
2178
- };
2179
- bottom = {
2180
- l: -(tipWidth / 2),
2181
- r: tipWidth / 2,
2182
- t: disToMouse + cursorHeight,
2183
- b: tipHeight + disToMouse + triangleHeight + cursorHeight
2184
- };
2185
- left = {
2186
- l: -(tipWidth + disToMouse + triangleHeight),
2187
- r: -disToMouse,
2188
- t: -(tipHeight / 2),
2189
- b: tipHeight / 2
2190
- };
2191
- right = {
2192
- l: disToMouse,
2193
- r: tipWidth + disToMouse + triangleHeight,
2194
- t: -(tipHeight / 2),
2195
- b: tipHeight / 2
2196
- };
2197
- } else if (effect === 'solid') {
2198
- top = {
2199
- l: -(tipWidth / 2),
2200
- r: tipWidth / 2,
2201
- t: -(targetHeight / 2 + tipHeight + triangleHeight),
2202
- b: -(targetHeight / 2)
2203
- };
2204
- bottom = {
2205
- l: -(tipWidth / 2),
2206
- r: tipWidth / 2,
2207
- t: targetHeight / 2,
2208
- b: targetHeight / 2 + tipHeight + triangleHeight
2209
- };
2210
- left = {
2211
- l: -(tipWidth + targetWidth / 2 + triangleHeight),
2212
- r: -(targetWidth / 2),
2213
- t: -(tipHeight / 2),
2214
- b: tipHeight / 2
2215
- };
2216
- right = {
2217
- l: targetWidth / 2,
2218
- r: tipWidth + targetWidth / 2 + triangleHeight,
2219
- t: -(tipHeight / 2),
2220
- b: tipHeight / 2
2221
- };
2222
- }
2223
- return {
2224
- top: top,
2225
- bottom: bottom,
2226
- left: left,
2227
- right: right
2228
- };
2229
- };
2230
-
2231
- // Consider additional offset into position calculation
2232
- var calculateOffset = function calculateOffset(offset) {
2233
- var extraOffsetX = 0;
2234
- var extraOffsetY = 0;
2235
- if (Object.prototype.toString.apply(offset) === '[object String]') {
2236
- offset = JSON.parse(offset.toString().replace(/'/g, '"'));
2237
- }
2238
- for (var key in offset) {
2239
- if (key === 'top') {
2240
- extraOffsetY -= parseInt(offset[key], 10);
2241
- } else if (key === 'bottom') {
2242
- extraOffsetY += parseInt(offset[key], 10);
2243
- } else if (key === 'left') {
2244
- extraOffsetX -= parseInt(offset[key], 10);
2245
- } else if (key === 'right') {
2246
- extraOffsetX += parseInt(offset[key], 10);
2247
- }
2248
- }
2249
- return {
2250
- extraOffsetX: extraOffsetX,
2251
- extraOffsetY: extraOffsetY
2252
- };
2253
- };
2254
-
2255
- // Get the offset of the parent elements
2256
- var getParent = function getParent(currentTarget) {
2257
- var currentParent = currentTarget;
2258
- while (currentParent) {
2259
- var computedStyle = window.getComputedStyle(currentParent);
2260
- // transform and will-change: transform change the containing block
2261
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block
2262
- if (computedStyle.getPropertyValue('transform') !== 'none' || computedStyle.getPropertyValue('will-change') === 'transform') break;
2263
- currentParent = currentParent.parentElement;
2264
- }
2265
- var parentTop = currentParent && currentParent.getBoundingClientRect().top || 0;
2266
- var parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0;
2267
- return {
2268
- parentTop: parentTop,
2269
- parentLeft: parentLeft
2270
- };
2271
- };
2272
-
2273
- /**
2274
- * To get the tooltip content
2275
- * it may comes from data-tip or this.props.children
2276
- * it should support multiline
2277
- *
2278
- * @params
2279
- * - `tip` {String} value of data-tip
2280
- * - `children` {ReactElement} this.props.children
2281
- * - `multiline` {Any} could be Bool(true/false) or String('true'/'false')
2282
- *
2283
- * @return
2284
- * - String or react component
2285
- */
2286
- function TipContent(tip, children, getContent, multiline) {
2287
- if (children) return children;
2288
- if (getContent !== undefined && getContent !== null) return getContent; // getContent can be 0, '', etc.
2289
- if (getContent === null) return null; // Tip not exist and children is null or undefined
2290
-
2291
- var regexp = /<br\s*\/?>/;
2292
- if (!multiline || multiline === 'false' || !regexp.test(tip)) {
2293
- // No trim(), so that user can keep their input
2294
- return tip;
2295
- }
2296
-
2297
- // Multiline tooltip content
2298
- return tip.split(regexp).map(function (d, i) {
2299
- return /*#__PURE__*/React.createElement("span", {
2300
- key: i,
2301
- className: "multi-line"
2302
- }, d);
2303
- });
2304
- }
2305
-
2306
- /**
2307
- * Support aria- and role in ReactTooltip
2308
- *
2309
- * @params props {Object}
2310
- * @return {Object}
2311
- */
2312
- function parseAria(props) {
2313
- var ariaObj = {};
2314
- Object.keys(props).filter(function (prop) {
2315
- // aria-xxx and role is acceptable
2316
- return /(^aria-\w+$|^role$)/.test(prop);
2317
- }).forEach(function (prop) {
2318
- ariaObj[prop] = props[prop];
2319
- });
2320
- return ariaObj;
2321
- }
2322
-
2323
- /**
2324
- * Convert nodelist to array
2325
- * @see https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/core/createArrayFromMixed.js#L24
2326
- * NodeLists are functions in Safari
2327
- */
2328
-
2329
- function nodeListToArray (nodeList) {
2330
- var length = nodeList.length;
2331
- if (nodeList.hasOwnProperty) {
2332
- return Array.prototype.slice.call(nodeList);
2333
- }
2334
- return new Array(length).fill().map(function (index) {
2335
- return nodeList[index];
2336
- });
2337
- }
2338
-
2339
- function generateUUID() {
2340
- return 't' + v4();
2341
- }
2342
-
2343
- var baseCss = ".__react_component_tooltip {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n left: -999em;\n opacity: 0;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n top: -999em;\n visibility: hidden;\n z-index: 999;\n}\n.__react_component_tooltip.allow_hover, .__react_component_tooltip.allow_click {\n pointer-events: auto;\n}\n.__react_component_tooltip::before, .__react_component_tooltip::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n}\n.__react_component_tooltip.show {\n opacity: 0.9;\n margin-top: 0;\n margin-left: 0;\n visibility: visible;\n}\n.__react_component_tooltip.place-top::before {\n bottom: 0;\n left: 50%;\n margin-left: -11px;\n}\n.__react_component_tooltip.place-bottom::before {\n top: 0;\n left: 50%;\n margin-left: -11px;\n}\n.__react_component_tooltip.place-left::before {\n right: 0;\n top: 50%;\n margin-top: -9px;\n}\n.__react_component_tooltip.place-right::before {\n left: 0;\n top: 50%;\n margin-top: -9px;\n}\n.__react_component_tooltip .multi-line {\n display: block;\n padding: 2px 0;\n text-align: center;\n}";
2344
-
2345
- /**
2346
- * Default pop-up style values (text color, background color).
2347
- */
2348
- var defaultColors = {
2349
- dark: {
2350
- text: '#fff',
2351
- background: '#222',
2352
- border: 'transparent',
2353
- arrow: '#222'
2354
- },
2355
- success: {
2356
- text: '#fff',
2357
- background: '#8DC572',
2358
- border: 'transparent',
2359
- arrow: '#8DC572'
2360
- },
2361
- warning: {
2362
- text: '#fff',
2363
- background: '#F0AD4E',
2364
- border: 'transparent',
2365
- arrow: '#F0AD4E'
2366
- },
2367
- error: {
2368
- text: '#fff',
2369
- background: '#BE6464',
2370
- border: 'transparent',
2371
- arrow: '#BE6464'
2372
- },
2373
- info: {
2374
- text: '#fff',
2375
- background: '#337AB7',
2376
- border: 'transparent',
2377
- arrow: '#337AB7'
2378
- },
2379
- light: {
2380
- text: '#222',
2381
- background: '#fff',
2382
- border: 'transparent',
2383
- arrow: '#fff'
2384
- }
2385
- };
2386
- function getDefaultPopupColors(type) {
2387
- return defaultColors[type] ? _objectSpread2({}, defaultColors[type]) : undefined;
2388
- }
2389
- var DEFAULT_PADDING = '8px 21px';
2390
- var DEFAULT_RADIUS = {
2391
- tooltip: 3,
2392
- arrow: 0
2393
- };
2394
-
2395
- /**
2396
- * Generates the specific tooltip style for use on render.
2397
- */
2398
- function generateTooltipStyle(uuid, customColors, type, hasBorder, padding, radius) {
2399
- return generateStyle(uuid, getPopupColors(customColors, type, hasBorder), padding, radius);
2400
- }
2401
-
2402
- /**
2403
- * Generates the tooltip style rules based on the element-specified "data-type" property.
2404
- */
2405
- function generateStyle(uuid, colors) {
2406
- var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_PADDING;
2407
- var radius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_RADIUS;
2408
- var textColor = colors.text;
2409
- var backgroundColor = colors.background;
2410
- var borderColor = colors.border;
2411
- var arrowColor = colors.arrow;
2412
- var arrowRadius = radius.arrow;
2413
- var tooltipRadius = radius.tooltip;
2414
- return "\n \t.".concat(uuid, " {\n\t color: ").concat(textColor, ";\n\t background: ").concat(backgroundColor, ";\n\t border: 1px solid ").concat(borderColor, ";\n\t border-radius: ").concat(tooltipRadius, "px;\n\t padding: ").concat(padding, ";\n \t}\n\n \t.").concat(uuid, ".place-top {\n margin-top: -10px;\n }\n .").concat(uuid, ".place-top::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: 2;\n width: 20px;\n height: 12px;\n }\n .").concat(uuid, ".place-top::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n bottom: -6px;\n left: 50%;\n margin-left: -6px;\n transform: rotate(135deg);\n }\n\n .").concat(uuid, ".place-bottom {\n margin-top: 10px;\n }\n .").concat(uuid, ".place-bottom::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 18px;\n height: 10px;\n }\n .").concat(uuid, ".place-bottom::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n top: -6px;\n left: 50%;\n margin-left: -6px;\n transform: rotate(45deg);\n }\n\n .").concat(uuid, ".place-left {\n margin-left: -10px;\n }\n .").concat(uuid, ".place-left::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 10px;\n height: 18px;\n }\n .").concat(uuid, ".place-left::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n right: -6px;\n top: 50%;\n margin-top: -6px;\n transform: rotate(45deg);\n }\n\n .").concat(uuid, ".place-right {\n margin-left: 10px;\n }\n .").concat(uuid, ".place-right::before {\n content: \"\";\n background-color: inherit;\n position: absolute;\n z-index: -1;\n width: 10px;\n height: 18px;\n }\n .").concat(uuid, ".place-right::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-top-right-radius: ").concat(arrowRadius, "px;\n border: 1px solid ").concat(borderColor, ";\n background-color: ").concat(arrowColor, ";\n z-index: -2;\n left: -6px;\n top: 50%;\n margin-top: -6px;\n transform: rotate(-135deg);\n }\n ");
2415
- }
2416
- function getPopupColors(customColors, type, hasBorder) {
2417
- var textColor = customColors.text;
2418
- var backgroundColor = customColors.background;
2419
- var borderColor = customColors.border;
2420
- var arrowColor = customColors.arrow ? customColors.arrow : customColors.background;
2421
- var colors = getDefaultPopupColors(type);
2422
- if (textColor) {
2423
- colors.text = textColor;
2424
- }
2425
- if (backgroundColor) {
2426
- colors.background = backgroundColor;
2427
- }
2428
- if (hasBorder) {
2429
- if (borderColor) {
2430
- colors.border = borderColor;
2431
- } else {
2432
- colors.border = type === 'light' ? 'black' : 'white';
2433
- }
2434
- }
2435
- if (arrowColor) {
2436
- colors.arrow = arrowColor;
2437
- }
2438
- return colors;
2439
- }
2440
-
2441
- var _class, _class2;
2442
-
2443
- /* Polyfill */
2444
- var ReactTooltip = staticMethods(_class = windowListener(_class = customEvent(_class = isCapture(_class = getEffect(_class = bodyMode(_class = trackRemoval(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
2445
- _inherits(ReactTooltip, _React$Component);
2446
- var _super = _createSuper(ReactTooltip);
2447
- function ReactTooltip(props) {
2448
- var _this;
2449
- _classCallCheck(this, ReactTooltip);
2450
- _this = _super.call(this, props);
2451
- _this.state = {
2452
- uuid: props.uuid || generateUUID(),
2453
- place: props.place || 'top',
2454
- // Direction of tooltip
2455
- desiredPlace: props.place || 'top',
2456
- type: props.type || 'dark',
2457
- // Color theme of tooltip
2458
- effect: props.effect || 'float',
2459
- // float or fixed
2460
- show: false,
2461
- border: false,
2462
- borderClass: 'border',
2463
- customColors: {},
2464
- customRadius: {},
2465
- offset: {},
2466
- padding: props.padding,
2467
- extraClass: '',
2468
- html: false,
2469
- delayHide: 0,
2470
- delayShow: 0,
2471
- event: props.event || null,
2472
- eventOff: props.eventOff || null,
2473
- currentEvent: null,
2474
- // Current mouse event
2475
- currentTarget: null,
2476
- // Current target of mouse event
2477
- ariaProps: parseAria(props),
2478
- // aria- and role attributes
2479
- isEmptyTip: false,
2480
- disable: false,
2481
- possibleCustomEvents: props.possibleCustomEvents || '',
2482
- possibleCustomEventsOff: props.possibleCustomEventsOff || '',
2483
- originTooltip: null,
2484
- isMultiline: false
2485
- };
2486
- _this.bind(['showTooltip', 'updateTooltip', 'hideTooltip', 'hideTooltipOnScroll', 'getTooltipContent', 'globalRebuild', 'globalShow', 'globalHide', 'onWindowResize', 'mouseOnToolTip']);
2487
- _this.mount = true;
2488
- _this.delayShowLoop = null;
2489
- _this.delayHideLoop = null;
2490
- _this.delayReshow = null;
2491
- _this.intervalUpdateContent = null;
2492
- return _this;
2493
- }
2494
-
2495
- /**
2496
- * For unify the bind and unbind listener
2497
- */
2498
- _createClass(ReactTooltip, [{
2499
- key: "bind",
2500
- value: function bind(methodArray) {
2501
- var _this2 = this;
2502
- methodArray.forEach(function (method) {
2503
- _this2[method] = _this2[method].bind(_this2);
2504
- });
2505
- }
2506
- }, {
2507
- key: "componentDidMount",
2508
- value: function componentDidMount() {
2509
- var _this$props = this.props;
2510
- _this$props.insecure;
2511
- var resizeHide = _this$props.resizeHide,
2512
- disableInternalStyle = _this$props.disableInternalStyle;
2513
- this.mount = true;
2514
- this.bindListener(); // Bind listener for tooltip
2515
- this.bindWindowEvents(resizeHide); // Bind global event for static method
2516
-
2517
- if (!disableInternalStyle) {
2518
- this.injectStyles(); // Inject styles for each DOM root having tooltip.
2519
- }
2520
- }
2521
- }, {
2522
- key: "componentWillUnmount",
2523
- value: function componentWillUnmount() {
2524
- this.mount = false;
2525
- this.clearTimer();
2526
- this.unbindListener();
2527
- this.removeScrollListener(this.state.currentTarget);
2528
- this.unbindWindowEvents();
2529
- }
2530
-
2531
- /* Look for the closest DOM root having tooltip and inject styles. */
2532
- }, {
2533
- key: "injectStyles",
2534
- value: function injectStyles() {
2535
- var tooltipRef = this.tooltipRef;
2536
- if (!tooltipRef) {
2537
- return;
2538
- }
2539
- var parentNode = tooltipRef.parentNode;
2540
- while (parentNode.parentNode) {
2541
- parentNode = parentNode.parentNode;
2542
- }
2543
- var domRoot;
2544
- switch (parentNode.constructor.name) {
2545
- case 'Document':
2546
- case 'HTMLDocument':
2547
- case undefined:
2548
- domRoot = parentNode.head;
2549
- break;
2550
- case 'ShadowRoot':
2551
- default:
2552
- domRoot = parentNode;
2553
- break;
2554
- }
2555
-
2556
- // Prevent styles duplication.
2557
- if (!domRoot.querySelector('style[data-react-tooltip]')) {
2558
- var style = document.createElement('style');
2559
- style.textContent = baseCss;
2560
- style.setAttribute('data-react-tooltip', 'true');
2561
- domRoot.appendChild(style);
2562
- }
2563
- }
2564
-
2565
- /**
2566
- * Return if the mouse is on the tooltip.
2567
- * @returns {boolean} true - mouse is on the tooltip
2568
- */
2569
- }, {
2570
- key: "mouseOnToolTip",
2571
- value: function mouseOnToolTip() {
2572
- var show = this.state.show;
2573
- if (show && this.tooltipRef) {
2574
- /* old IE or Firefox work around */
2575
- if (!this.tooltipRef.matches) {
2576
- /* old IE work around */
2577
- if (this.tooltipRef.msMatchesSelector) {
2578
- this.tooltipRef.matches = this.tooltipRef.msMatchesSelector;
2579
- } else {
2580
- /* old Firefox work around */
2581
- this.tooltipRef.matches = this.tooltipRef.mozMatchesSelector;
2582
- }
2583
- }
2584
- return this.tooltipRef.matches(':hover');
2585
- }
2586
- return false;
2587
- }
2588
-
2589
- /**
2590
- * Pick out corresponded target elements
2591
- */
2592
- }, {
2593
- key: "getTargetArray",
2594
- value: function getTargetArray(id) {
2595
- var targetArray = [];
2596
- var selector;
2597
- if (!id) {
2598
- selector = '[data-tip]:not([data-for])';
2599
- } else {
2600
- var escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
2601
- selector = "[data-tip][data-for=\"".concat(escaped, "\"]");
2602
- }
2603
-
2604
- // Scan document for shadow DOM elements
2605
- nodeListToArray(document.getElementsByTagName('*')).filter(function (element) {
2606
- return element.shadowRoot;
2607
- }).forEach(function (element) {
2608
- targetArray = targetArray.concat(nodeListToArray(element.shadowRoot.querySelectorAll(selector)));
2609
- });
2610
- return targetArray.concat(nodeListToArray(document.querySelectorAll(selector)));
2611
- }
2612
-
2613
- /**
2614
- * Bind listener to the target elements
2615
- * These listeners used to trigger showing or hiding the tooltip
2616
- */
2617
- }, {
2618
- key: "bindListener",
2619
- value: function bindListener() {
2620
- var _this3 = this;
2621
- var _this$props2 = this.props,
2622
- id = _this$props2.id,
2623
- globalEventOff = _this$props2.globalEventOff,
2624
- isCapture = _this$props2.isCapture;
2625
- var targetArray = this.getTargetArray(id);
2626
- targetArray.forEach(function (target) {
2627
- if (target.getAttribute('currentItem') === null) {
2628
- target.setAttribute('currentItem', 'false');
2629
- }
2630
- _this3.unbindBasicListener(target);
2631
- if (_this3.isCustomEvent(target)) {
2632
- _this3.customUnbindListener(target);
2633
- }
2634
- });
2635
- if (this.isBodyMode()) {
2636
- this.bindBodyListener(targetArray);
2637
- } else {
2638
- targetArray.forEach(function (target) {
2639
- var isCaptureMode = _this3.isCapture(target);
2640
- var effect = _this3.getEffect(target);
2641
- if (_this3.isCustomEvent(target)) {
2642
- _this3.customBindListener(target);
2643
- return;
2644
- }
2645
- target.addEventListener('mouseenter', _this3.showTooltip, isCaptureMode);
2646
- target.addEventListener('focus', _this3.showTooltip, isCaptureMode);
2647
- if (effect === 'float') {
2648
- target.addEventListener('mousemove', _this3.updateTooltip, isCaptureMode);
2649
- }
2650
- target.addEventListener('mouseleave', _this3.hideTooltip, isCaptureMode);
2651
- target.addEventListener('blur', _this3.hideTooltip, isCaptureMode);
2652
- });
2653
- }
2654
-
2655
- // Global event to hide tooltip
2656
- if (globalEventOff) {
2657
- window.removeEventListener(globalEventOff, this.hideTooltip);
2658
- window.addEventListener(globalEventOff, this.hideTooltip, isCapture);
2659
- }
2660
-
2661
- // Track removal of targetArray elements from DOM
2662
- this.bindRemovalTracker();
2663
- }
2664
-
2665
- /**
2666
- * Unbind listeners on target elements
2667
- */
2668
- }, {
2669
- key: "unbindListener",
2670
- value: function unbindListener() {
2671
- var _this4 = this;
2672
- var _this$props3 = this.props,
2673
- id = _this$props3.id,
2674
- globalEventOff = _this$props3.globalEventOff;
2675
- if (this.isBodyMode()) {
2676
- this.unbindBodyListener();
2677
- } else {
2678
- var targetArray = this.getTargetArray(id);
2679
- targetArray.forEach(function (target) {
2680
- _this4.unbindBasicListener(target);
2681
- if (_this4.isCustomEvent(target)) _this4.customUnbindListener(target);
2682
- });
2683
- }
2684
- if (globalEventOff) window.removeEventListener(globalEventOff, this.hideTooltip);
2685
- this.unbindRemovalTracker();
2686
- }
2687
-
2688
- /**
2689
- * Invoke this before bind listener and unmount the component
2690
- * it is necessary to invoke this even when binding custom event
2691
- * so that the tooltip can switch between custom and default listener
2692
- */
2693
- }, {
2694
- key: "unbindBasicListener",
2695
- value: function unbindBasicListener(target) {
2696
- var isCaptureMode = this.isCapture(target);
2697
- target.removeEventListener('mouseenter', this.showTooltip, isCaptureMode);
2698
- target.removeEventListener('mousemove', this.updateTooltip, isCaptureMode);
2699
- target.removeEventListener('mouseleave', this.hideTooltip, isCaptureMode);
2700
- }
2701
- }, {
2702
- key: "getTooltipContent",
2703
- value: function getTooltipContent() {
2704
- var _this$props4 = this.props,
2705
- getContent = _this$props4.getContent,
2706
- children = _this$props4.children;
2707
-
2708
- // Generate tooltip content
2709
- var content;
2710
- if (getContent) {
2711
- if (Array.isArray(getContent)) {
2712
- content = getContent[0] && getContent[0](this.state.originTooltip);
2713
- } else {
2714
- content = getContent(this.state.originTooltip);
2715
- }
2716
- }
2717
- return TipContent(this.state.originTooltip, children, content, this.state.isMultiline);
2718
- }
2719
- }, {
2720
- key: "isEmptyTip",
2721
- value: function isEmptyTip(placeholder) {
2722
- return typeof placeholder === 'string' && placeholder === '' || placeholder === null;
2723
- }
2724
-
2725
- /**
2726
- * When mouse enter, show the tooltip
2727
- */
2728
- }, {
2729
- key: "showTooltip",
2730
- value: function showTooltip(e, isGlobalCall) {
2731
- if (!this.tooltipRef) {
2732
- return;
2733
- }
2734
- if (isGlobalCall) {
2735
- // Don't trigger other elements belongs to other ReactTooltip
2736
- var targetArray = this.getTargetArray(this.props.id);
2737
- var isMyElement = targetArray.some(function (ele) {
2738
- return ele === e.currentTarget;
2739
- });
2740
- if (!isMyElement) return;
2741
- }
2742
- // Get the tooltip content
2743
- // calculate in this phrase so that tip width height can be detected
2744
- var _this$props5 = this.props,
2745
- multiline = _this$props5.multiline,
2746
- getContent = _this$props5.getContent;
2747
- var originTooltip = e.currentTarget.getAttribute('data-tip');
2748
- var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
2749
-
2750
- // If it is focus event or called by ReactTooltip.show, switch to `solid` effect
2751
- var switchToSolid = e instanceof window.FocusEvent || isGlobalCall;
2752
-
2753
- // if it needs to skip adding hide listener to scroll
2754
- var scrollHide = true;
2755
- if (e.currentTarget.getAttribute('data-scroll-hide')) {
2756
- scrollHide = e.currentTarget.getAttribute('data-scroll-hide') === 'true';
2757
- } else if (this.props.scrollHide != null) {
2758
- scrollHide = this.props.scrollHide;
2759
- }
2760
-
2761
- // adding aria-describedby to target to make tooltips read by screen readers
2762
- if (e && e.currentTarget && e.currentTarget.setAttribute) {
2763
- e.currentTarget.setAttribute('aria-describedby', this.props.id || this.state.uuid);
2764
- }
2765
-
2766
- // Make sure the correct place is set
2767
- var desiredPlace = e.currentTarget.getAttribute('data-place') || this.props.place || 'top';
2768
- var effect = switchToSolid && 'solid' || this.getEffect(e.currentTarget);
2769
- var offset = e.currentTarget.getAttribute('data-offset') || this.props.offset || {};
2770
- var result = getPosition(e, e.currentTarget, this.tooltipRef, desiredPlace.split(',')[0], desiredPlace, effect, offset);
2771
- if (result.position && this.props.overridePosition) {
2772
- result.position = this.props.overridePosition(result.position, e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
2773
- }
2774
- var place = result.isNewState ? result.newState.place : desiredPlace.split(',')[0];
2775
-
2776
- // To prevent previously created timers from triggering
2777
- this.clearTimer();
2778
- var target = e.currentTarget;
2779
- var reshowDelay = this.state.show ? target.getAttribute('data-delay-update') || this.props.delayUpdate : 0;
2780
- var self = this;
2781
- var updateState = function updateState() {
2782
- self.setState({
2783
- originTooltip: originTooltip,
2784
- isMultiline: isMultiline,
2785
- desiredPlace: desiredPlace,
2786
- place: place,
2787
- type: target.getAttribute('data-type') || self.props.type || 'dark',
2788
- customColors: {
2789
- text: target.getAttribute('data-text-color') || self.props.textColor || null,
2790
- background: target.getAttribute('data-background-color') || self.props.backgroundColor || null,
2791
- border: target.getAttribute('data-border-color') || self.props.borderColor || null,
2792
- arrow: target.getAttribute('data-arrow-color') || self.props.arrowColor || null
2793
- },
2794
- customRadius: {
2795
- tooltip: target.getAttribute('data-tooltip-radius') || self.props.tooltipRadius || '3',
2796
- arrow: target.getAttribute('data-arrow-radius') || self.props.arrowRadius || '0'
2797
- },
2798
- effect: effect,
2799
- offset: offset,
2800
- padding: target.getAttribute('data-padding') || self.props.padding,
2801
- html: (target.getAttribute('data-html') ? target.getAttribute('data-html') === 'true' : self.props.html) || false,
2802
- delayShow: target.getAttribute('data-delay-show') || self.props.delayShow || 0,
2803
- delayHide: target.getAttribute('data-delay-hide') || self.props.delayHide || 0,
2804
- delayUpdate: target.getAttribute('data-delay-update') || self.props.delayUpdate || 0,
2805
- border: (target.getAttribute('data-border') ? target.getAttribute('data-border') === 'true' : self.props.border) || false,
2806
- borderClass: target.getAttribute('data-border-class') || self.props.borderClass || 'border',
2807
- extraClass: target.getAttribute('data-class') || self.props["class"] || self.props.className || '',
2808
- disable: (target.getAttribute('data-tip-disable') ? target.getAttribute('data-tip-disable') === 'true' : self.props.disable) || false,
2809
- currentTarget: target
2810
- }, function () {
2811
- if (scrollHide) {
2812
- self.addScrollListener(self.state.currentTarget);
2813
- }
2814
- self.updateTooltip(e);
2815
- if (getContent && Array.isArray(getContent)) {
2816
- self.intervalUpdateContent = setInterval(function () {
2817
- if (self.mount) {
2818
- var _getContent = self.props.getContent;
2819
- var placeholder = TipContent(originTooltip, '', _getContent[0](), isMultiline);
2820
- var isEmptyTip = self.isEmptyTip(placeholder);
2821
- self.setState({
2822
- isEmptyTip: isEmptyTip
2823
- });
2824
- self.updatePosition();
2825
- }
2826
- }, getContent[1]);
2827
- }
2828
- });
2829
- };
2830
-
2831
- // If there is no delay call immediately, don't allow events to get in first.
2832
- if (reshowDelay) {
2833
- this.delayReshow = setTimeout(updateState, reshowDelay);
2834
- } else {
2835
- updateState();
2836
- }
2837
- }
2838
-
2839
- /**
2840
- * When mouse hover, update tool tip
2841
- */
2842
- }, {
2843
- key: "updateTooltip",
2844
- value: function updateTooltip(e) {
2845
- var _this5 = this;
2846
- var _this$state = this.state,
2847
- delayShow = _this$state.delayShow,
2848
- disable = _this$state.disable;
2849
- var _this$props6 = this.props,
2850
- afterShow = _this$props6.afterShow,
2851
- disableProp = _this$props6.disable;
2852
- var placeholder = this.getTooltipContent();
2853
- var eventTarget = e.currentTarget || e.target;
2854
-
2855
- // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2856
- if (this.mouseOnToolTip()) {
2857
- return;
2858
- }
2859
-
2860
- // if the tooltip is empty, disable the tooltip
2861
- if (this.isEmptyTip(placeholder) || disable || disableProp) {
2862
- return;
2863
- }
2864
- var delayTime = !this.state.show ? parseInt(delayShow, 10) : 0;
2865
- var updateState = function updateState() {
2866
- if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
2867
- var isInvisible = !_this5.state.show;
2868
- _this5.setState({
2869
- currentEvent: e,
2870
- currentTarget: eventTarget,
2871
- show: true
2872
- }, function () {
2873
- _this5.updatePosition(function () {
2874
- if (isInvisible && afterShow) {
2875
- afterShow(e);
2876
- }
2877
- });
2878
- });
2879
- }
2880
- };
2881
- if (this.delayShowLoop) {
2882
- clearTimeout(this.delayShowLoop);
2883
- }
2884
- if (delayTime) {
2885
- this.delayShowLoop = setTimeout(updateState, delayTime);
2886
- } else {
2887
- this.delayShowLoop = null;
2888
- updateState();
2889
- }
2890
- }
2891
-
2892
- /*
2893
- * If we're mousing over the tooltip remove it when we leave.
2894
- */
2895
- }, {
2896
- key: "listenForTooltipExit",
2897
- value: function listenForTooltipExit() {
2898
- var show = this.state.show;
2899
- if (show && this.tooltipRef) {
2900
- this.tooltipRef.addEventListener('mouseleave', this.hideTooltip);
2901
- }
2902
- }
2903
- }, {
2904
- key: "removeListenerForTooltipExit",
2905
- value: function removeListenerForTooltipExit() {
2906
- var show = this.state.show;
2907
- if (show && this.tooltipRef) {
2908
- this.tooltipRef.removeEventListener('mouseleave', this.hideTooltip);
2909
- }
2910
- }
2911
-
2912
- /**
2913
- * When mouse leave, hide tooltip
2914
- */
2915
- }, {
2916
- key: "hideTooltip",
2917
- value: function hideTooltip(e, hasTarget) {
2918
- var _this6 = this;
2919
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2920
- isScroll: false
2921
- };
2922
- var disable = this.state.disable;
2923
- var isScroll = options.isScroll;
2924
- var delayHide = isScroll ? 0 : this.state.delayHide;
2925
- var _this$props7 = this.props,
2926
- afterHide = _this$props7.afterHide,
2927
- disableProp = _this$props7.disable;
2928
- var placeholder = this.getTooltipContent();
2929
- if (!this.mount) return;
2930
- if (this.isEmptyTip(placeholder) || disable || disableProp) return; // if the tooltip is empty, disable the tooltip
2931
- if (hasTarget) {
2932
- // Don't trigger other elements belongs to other ReactTooltip
2933
- var targetArray = this.getTargetArray(this.props.id);
2934
- var isMyElement = targetArray.some(function (ele) {
2935
- return ele === e.currentTarget;
2936
- });
2937
- if (!isMyElement || !this.state.show) return;
2938
- }
2939
-
2940
- // clean up aria-describedby when hiding tooltip
2941
- if (e && e.currentTarget && e.currentTarget.removeAttribute) {
2942
- e.currentTarget.removeAttribute('aria-describedby');
2943
- }
2944
- var resetState = function resetState() {
2945
- var isVisible = _this6.state.show;
2946
- // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
2947
- if (_this6.mouseOnToolTip()) {
2948
- _this6.listenForTooltipExit();
2949
- return;
2950
- }
2951
- _this6.removeListenerForTooltipExit();
2952
- _this6.setState({
2953
- show: false
2954
- }, function () {
2955
- _this6.removeScrollListener(_this6.state.currentTarget);
2956
- if (isVisible && afterHide) {
2957
- afterHide(e);
2958
- }
2959
- });
2960
- };
2961
- this.clearTimer();
2962
- if (delayHide) {
2963
- this.delayHideLoop = setTimeout(resetState, parseInt(delayHide, 10));
2964
- } else {
2965
- resetState();
2966
- }
2967
- }
2968
-
2969
- /**
2970
- * When scroll, hide tooltip
2971
- */
2972
- }, {
2973
- key: "hideTooltipOnScroll",
2974
- value: function hideTooltipOnScroll(event, hasTarget) {
2975
- this.hideTooltip(event, hasTarget, {
2976
- isScroll: true
2977
- });
2978
- }
2979
-
2980
- /**
2981
- * Add scroll event listener when tooltip show
2982
- * automatically hide the tooltip when scrolling
2983
- */
2984
- }, {
2985
- key: "addScrollListener",
2986
- value: function addScrollListener(currentTarget) {
2987
- var isCaptureMode = this.isCapture(currentTarget);
2988
- window.addEventListener('scroll', this.hideTooltipOnScroll, isCaptureMode);
2989
- }
2990
- }, {
2991
- key: "removeScrollListener",
2992
- value: function removeScrollListener(currentTarget) {
2993
- var isCaptureMode = this.isCapture(currentTarget);
2994
- window.removeEventListener('scroll', this.hideTooltipOnScroll, isCaptureMode);
2995
- }
2996
-
2997
- // Calculation the position
2998
- }, {
2999
- key: "updatePosition",
3000
- value: function updatePosition(callbackAfter) {
3001
- var _this7 = this;
3002
- var _this$state2 = this.state,
3003
- currentEvent = _this$state2.currentEvent,
3004
- currentTarget = _this$state2.currentTarget,
3005
- place = _this$state2.place,
3006
- desiredPlace = _this$state2.desiredPlace,
3007
- effect = _this$state2.effect,
3008
- offset = _this$state2.offset;
3009
- var node = this.tooltipRef;
3010
- var result = getPosition(currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
3011
- if (result.position && this.props.overridePosition) {
3012
- result.position = this.props.overridePosition(result.position, currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
3013
- }
3014
- if (result.isNewState) {
3015
- // Switch to reverse placement
3016
- return this.setState(result.newState, function () {
3017
- _this7.updatePosition(callbackAfter);
3018
- });
3019
- }
3020
- if (callbackAfter && typeof callbackAfter === 'function') {
3021
- callbackAfter();
3022
- }
3023
-
3024
- // Set tooltip position
3025
- node.style.left = result.position.left + 'px';
3026
- node.style.top = result.position.top + 'px';
3027
- }
3028
-
3029
- /**
3030
- * CLear all kinds of timeout of interval
3031
- */
3032
- }, {
3033
- key: "clearTimer",
3034
- value: function clearTimer() {
3035
- if (this.delayShowLoop) {
3036
- clearTimeout(this.delayShowLoop);
3037
- this.delayShowLoop = null;
3038
- }
3039
- if (this.delayHideLoop) {
3040
- clearTimeout(this.delayHideLoop);
3041
- this.delayHideLoop = null;
3042
- }
3043
- if (this.delayReshow) {
3044
- clearTimeout(this.delayReshow);
3045
- this.delayReshow = null;
3046
- }
3047
- if (this.intervalUpdateContent) {
3048
- clearInterval(this.intervalUpdateContent);
3049
- this.intervalUpdateContent = null;
3050
- }
3051
- }
3052
- }, {
3053
- key: "hasCustomColors",
3054
- value: function hasCustomColors() {
3055
- var _this8 = this;
3056
- return Boolean(Object.keys(this.state.customColors).find(function (color) {
3057
- return color !== 'border' && _this8.state.customColors[color];
3058
- }) || this.state.border && this.state.customColors['border']);
3059
- }
3060
- }, {
3061
- key: "render",
3062
- value: function render() {
3063
- var _this9 = this;
3064
- var _this$state3 = this.state,
3065
- extraClass = _this$state3.extraClass,
3066
- html = _this$state3.html,
3067
- ariaProps = _this$state3.ariaProps,
3068
- disable = _this$state3.disable,
3069
- uuid = _this$state3.uuid;
3070
- var content = this.getTooltipContent();
3071
- var isEmptyTip = this.isEmptyTip(content);
3072
- var style = this.props.disableInternalStyle ? '' : generateTooltipStyle(this.state.uuid, this.state.customColors, this.state.type, this.state.border, this.state.padding, this.state.customRadius);
3073
- var tooltipClass = '__react_component_tooltip' + " ".concat(this.state.uuid) + (this.state.show && !disable && !isEmptyTip ? ' show' : '') + (this.state.border ? ' ' + this.state.borderClass : '') + " place-".concat(this.state.place) + // top, bottom, left, right
3074
- " type-".concat(this.hasCustomColors() ? 'custom' : this.state.type) + (
3075
- // dark, success, warning, error, info, light, custom
3076
- this.props.delayUpdate ? ' allow_hover' : '') + (this.props.clickable ? ' allow_click' : '');
3077
- var Wrapper = this.props.wrapper;
3078
- if (ReactTooltip.supportedWrappers.indexOf(Wrapper) < 0) {
3079
- Wrapper = ReactTooltip.defaultProps.wrapper;
3080
- }
3081
- var wrapperClassName = [tooltipClass, extraClass].filter(Boolean).join(' ');
3082
- if (html) {
3083
- var htmlContent = "".concat(content).concat(style ? "\n<style aria-hidden=\"true\">".concat(style, "</style>") : '');
3084
- return /*#__PURE__*/React.createElement(Wrapper, _extends({
3085
- className: "".concat(wrapperClassName),
3086
- id: this.props.id || uuid,
3087
- ref: function ref(_ref) {
3088
- return _this9.tooltipRef = _ref;
3089
- }
3090
- }, ariaProps, {
3091
- "data-id": "tooltip",
3092
- dangerouslySetInnerHTML: {
3093
- __html: htmlContent
3094
- }
3095
- }));
3096
- } else {
3097
- return /*#__PURE__*/React.createElement(Wrapper, _extends({
3098
- className: "".concat(wrapperClassName),
3099
- id: this.props.id || uuid
3100
- }, ariaProps, {
3101
- ref: function ref(_ref2) {
3102
- return _this9.tooltipRef = _ref2;
3103
- },
3104
- "data-id": "tooltip"
3105
- }), style && /*#__PURE__*/React.createElement("style", {
3106
- dangerouslySetInnerHTML: {
3107
- __html: style
3108
- },
3109
- "aria-hidden": "true"
3110
- }), content);
3111
- }
3112
- }
3113
- }], [{
3114
- key: "propTypes",
3115
- get: function get() {
3116
- return {
3117
- uuid: PropTypes.string,
3118
- children: PropTypes.any,
3119
- place: PropTypes.string,
3120
- type: PropTypes.string,
3121
- effect: PropTypes.string,
3122
- offset: PropTypes.object,
3123
- padding: PropTypes.string,
3124
- multiline: PropTypes.bool,
3125
- border: PropTypes.bool,
3126
- borderClass: PropTypes.string,
3127
- textColor: PropTypes.string,
3128
- backgroundColor: PropTypes.string,
3129
- borderColor: PropTypes.string,
3130
- arrowColor: PropTypes.string,
3131
- arrowRadius: PropTypes.string,
3132
- tooltipRadius: PropTypes.string,
3133
- insecure: PropTypes.bool,
3134
- "class": PropTypes.string,
3135
- className: PropTypes.string,
3136
- id: PropTypes.string,
3137
- html: PropTypes.bool,
3138
- delayHide: PropTypes.number,
3139
- delayUpdate: PropTypes.number,
3140
- delayShow: PropTypes.number,
3141
- event: PropTypes.string,
3142
- eventOff: PropTypes.string,
3143
- isCapture: PropTypes.bool,
3144
- globalEventOff: PropTypes.string,
3145
- getContent: PropTypes.any,
3146
- afterShow: PropTypes.func,
3147
- afterHide: PropTypes.func,
3148
- overridePosition: PropTypes.func,
3149
- disable: PropTypes.bool,
3150
- scrollHide: PropTypes.bool,
3151
- resizeHide: PropTypes.bool,
3152
- wrapper: PropTypes.string,
3153
- bodyMode: PropTypes.bool,
3154
- possibleCustomEvents: PropTypes.string,
3155
- possibleCustomEventsOff: PropTypes.string,
3156
- clickable: PropTypes.bool,
3157
- disableInternalStyle: PropTypes.bool
3158
- };
3159
- }
3160
- }, {
3161
- key: "getDerivedStateFromProps",
3162
- value: function getDerivedStateFromProps(nextProps, prevState) {
3163
- var ariaProps = prevState.ariaProps;
3164
- var newAriaProps = parseAria(nextProps);
3165
- var isChanged = Object.keys(newAriaProps).some(function (props) {
3166
- return newAriaProps[props] !== ariaProps[props];
3167
- });
3168
- if (!isChanged) {
3169
- return null;
3170
- }
3171
- return _objectSpread2(_objectSpread2({}, prevState), {}, {
3172
- ariaProps: newAriaProps
3173
- });
3174
- }
3175
- }]);
3176
- return ReactTooltip;
3177
- }(React.Component), _defineProperty(_class2, "defaultProps", {
3178
- insecure: true,
3179
- resizeHide: true,
3180
- wrapper: 'div',
3181
- clickable: false
3182
- }), _defineProperty(_class2, "supportedWrappers", ['div', 'span']), _defineProperty(_class2, "displayName", 'ReactTooltip'), _class2)) || _class) || _class) || _class) || _class) || _class) || _class) || _class;
3183
-
3184
- export { ReactTooltip as default };
3185
- //# sourceMappingURL=index.es.js.map