@bigbinary/neeto-molecules 1.5.0 → 1.6.1-beta

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.
@@ -0,0 +1,1849 @@
1
+ import React, { useState, useEffect, forwardRef } from 'react';
2
+ import { capitalize, isNotPresent, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
3
+ import { useFetchNeetoApps } from '@bigbinary/neeto-commons-frontend/react-utils';
4
+ import KeyboardShortcuts from '@bigbinary/neeto-molecules/KeyboardShortcuts';
5
+ import { Typography, Input, Dropdown, Spinner, Avatar } from '@bigbinary/neetoui';
6
+ import { NeetoIcon, Search, Right, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow } from '@bigbinary/neeto-icons';
7
+ import { useTranslation } from 'react-i18next';
8
+ import classnames from 'classnames';
9
+ import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
10
+ import { t as t$1 } from 'i18next';
11
+ import { toLower, mergeDeepLeft } from 'ramda';
12
+ import { resetAuthTokens, removeFromLocalStorage } from '@bigbinary/neeto-commons-frontend/utils';
13
+
14
+ function _extends() {
15
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i];
18
+ for (var key in source) {
19
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20
+ target[key] = source[key];
21
+ }
22
+ }
23
+ }
24
+ return target;
25
+ };
26
+ return _extends.apply(this, arguments);
27
+ }
28
+
29
+ function _objectWithoutPropertiesLoose(source, excluded) {
30
+ if (source == null) return {};
31
+ var target = {};
32
+ var sourceKeys = Object.keys(source);
33
+ var key, i;
34
+ for (i = 0; i < sourceKeys.length; i++) {
35
+ key = sourceKeys[i];
36
+ if (excluded.indexOf(key) >= 0) continue;
37
+ target[key] = source[key];
38
+ }
39
+ return target;
40
+ }
41
+
42
+ function _objectWithoutProperties(source, excluded) {
43
+ if (source == null) return {};
44
+ var target = _objectWithoutPropertiesLoose(source, excluded);
45
+ var key, i;
46
+ if (Object.getOwnPropertySymbols) {
47
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
48
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
49
+ key = sourceSymbolKeys[i];
50
+ if (excluded.indexOf(key) >= 0) continue;
51
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
52
+ target[key] = source[key];
53
+ }
54
+ }
55
+ return target;
56
+ }
57
+
58
+ var propTypes = {exports: {}};
59
+
60
+ var reactIs = {exports: {}};
61
+
62
+ var reactIs_production_min = {};
63
+
64
+ /** @license React v16.13.1
65
+ * react-is.production.min.js
66
+ *
67
+ * Copyright (c) Facebook, Inc. and its affiliates.
68
+ *
69
+ * This source code is licensed under the MIT license found in the
70
+ * LICENSE file in the root directory of this source tree.
71
+ */
72
+
73
+ var hasRequiredReactIs_production_min;
74
+
75
+ function requireReactIs_production_min () {
76
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
77
+ hasRequiredReactIs_production_min = 1;
78
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
79
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
80
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
81
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
82
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
83
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
84
+ return reactIs_production_min;
85
+ }
86
+
87
+ var reactIs_development = {};
88
+
89
+ /** @license React v16.13.1
90
+ * react-is.development.js
91
+ *
92
+ * Copyright (c) Facebook, Inc. and its affiliates.
93
+ *
94
+ * This source code is licensed under the MIT license found in the
95
+ * LICENSE file in the root directory of this source tree.
96
+ */
97
+
98
+ var hasRequiredReactIs_development;
99
+
100
+ function requireReactIs_development () {
101
+ if (hasRequiredReactIs_development) return reactIs_development;
102
+ hasRequiredReactIs_development = 1;
103
+
104
+
105
+
106
+ if (process.env.NODE_ENV !== "production") {
107
+ (function() {
108
+
109
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
110
+ // nor polyfill, then a plain number is used for performance.
111
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
112
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
113
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
114
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
115
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
116
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
117
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
118
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
119
+ // (unstable) APIs that have been removed. Can we remove the symbols?
120
+
121
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
122
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
123
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
124
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
125
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
126
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
127
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
128
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
129
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
130
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
131
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
132
+
133
+ function isValidElementType(type) {
134
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
135
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
136
+ }
137
+
138
+ function typeOf(object) {
139
+ if (typeof object === 'object' && object !== null) {
140
+ var $$typeof = object.$$typeof;
141
+
142
+ switch ($$typeof) {
143
+ case REACT_ELEMENT_TYPE:
144
+ var type = object.type;
145
+
146
+ switch (type) {
147
+ case REACT_ASYNC_MODE_TYPE:
148
+ case REACT_CONCURRENT_MODE_TYPE:
149
+ case REACT_FRAGMENT_TYPE:
150
+ case REACT_PROFILER_TYPE:
151
+ case REACT_STRICT_MODE_TYPE:
152
+ case REACT_SUSPENSE_TYPE:
153
+ return type;
154
+
155
+ default:
156
+ var $$typeofType = type && type.$$typeof;
157
+
158
+ switch ($$typeofType) {
159
+ case REACT_CONTEXT_TYPE:
160
+ case REACT_FORWARD_REF_TYPE:
161
+ case REACT_LAZY_TYPE:
162
+ case REACT_MEMO_TYPE:
163
+ case REACT_PROVIDER_TYPE:
164
+ return $$typeofType;
165
+
166
+ default:
167
+ return $$typeof;
168
+ }
169
+
170
+ }
171
+
172
+ case REACT_PORTAL_TYPE:
173
+ return $$typeof;
174
+ }
175
+ }
176
+
177
+ return undefined;
178
+ } // AsyncMode is deprecated along with isAsyncMode
179
+
180
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
181
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
182
+ var ContextConsumer = REACT_CONTEXT_TYPE;
183
+ var ContextProvider = REACT_PROVIDER_TYPE;
184
+ var Element = REACT_ELEMENT_TYPE;
185
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
186
+ var Fragment = REACT_FRAGMENT_TYPE;
187
+ var Lazy = REACT_LAZY_TYPE;
188
+ var Memo = REACT_MEMO_TYPE;
189
+ var Portal = REACT_PORTAL_TYPE;
190
+ var Profiler = REACT_PROFILER_TYPE;
191
+ var StrictMode = REACT_STRICT_MODE_TYPE;
192
+ var Suspense = REACT_SUSPENSE_TYPE;
193
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
194
+
195
+ function isAsyncMode(object) {
196
+ {
197
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
198
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
199
+
200
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
201
+ }
202
+ }
203
+
204
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
205
+ }
206
+ function isConcurrentMode(object) {
207
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
208
+ }
209
+ function isContextConsumer(object) {
210
+ return typeOf(object) === REACT_CONTEXT_TYPE;
211
+ }
212
+ function isContextProvider(object) {
213
+ return typeOf(object) === REACT_PROVIDER_TYPE;
214
+ }
215
+ function isElement(object) {
216
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
217
+ }
218
+ function isForwardRef(object) {
219
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
220
+ }
221
+ function isFragment(object) {
222
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
223
+ }
224
+ function isLazy(object) {
225
+ return typeOf(object) === REACT_LAZY_TYPE;
226
+ }
227
+ function isMemo(object) {
228
+ return typeOf(object) === REACT_MEMO_TYPE;
229
+ }
230
+ function isPortal(object) {
231
+ return typeOf(object) === REACT_PORTAL_TYPE;
232
+ }
233
+ function isProfiler(object) {
234
+ return typeOf(object) === REACT_PROFILER_TYPE;
235
+ }
236
+ function isStrictMode(object) {
237
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
238
+ }
239
+ function isSuspense(object) {
240
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
241
+ }
242
+
243
+ reactIs_development.AsyncMode = AsyncMode;
244
+ reactIs_development.ConcurrentMode = ConcurrentMode;
245
+ reactIs_development.ContextConsumer = ContextConsumer;
246
+ reactIs_development.ContextProvider = ContextProvider;
247
+ reactIs_development.Element = Element;
248
+ reactIs_development.ForwardRef = ForwardRef;
249
+ reactIs_development.Fragment = Fragment;
250
+ reactIs_development.Lazy = Lazy;
251
+ reactIs_development.Memo = Memo;
252
+ reactIs_development.Portal = Portal;
253
+ reactIs_development.Profiler = Profiler;
254
+ reactIs_development.StrictMode = StrictMode;
255
+ reactIs_development.Suspense = Suspense;
256
+ reactIs_development.isAsyncMode = isAsyncMode;
257
+ reactIs_development.isConcurrentMode = isConcurrentMode;
258
+ reactIs_development.isContextConsumer = isContextConsumer;
259
+ reactIs_development.isContextProvider = isContextProvider;
260
+ reactIs_development.isElement = isElement;
261
+ reactIs_development.isForwardRef = isForwardRef;
262
+ reactIs_development.isFragment = isFragment;
263
+ reactIs_development.isLazy = isLazy;
264
+ reactIs_development.isMemo = isMemo;
265
+ reactIs_development.isPortal = isPortal;
266
+ reactIs_development.isProfiler = isProfiler;
267
+ reactIs_development.isStrictMode = isStrictMode;
268
+ reactIs_development.isSuspense = isSuspense;
269
+ reactIs_development.isValidElementType = isValidElementType;
270
+ reactIs_development.typeOf = typeOf;
271
+ })();
272
+ }
273
+ return reactIs_development;
274
+ }
275
+
276
+ var hasRequiredReactIs;
277
+
278
+ function requireReactIs () {
279
+ if (hasRequiredReactIs) return reactIs.exports;
280
+ hasRequiredReactIs = 1;
281
+ (function (module) {
282
+
283
+ if (process.env.NODE_ENV === 'production') {
284
+ module.exports = requireReactIs_production_min();
285
+ } else {
286
+ module.exports = requireReactIs_development();
287
+ }
288
+ } (reactIs));
289
+ return reactIs.exports;
290
+ }
291
+
292
+ /*
293
+ object-assign
294
+ (c) Sindre Sorhus
295
+ @license MIT
296
+ */
297
+
298
+ var objectAssign;
299
+ var hasRequiredObjectAssign;
300
+
301
+ function requireObjectAssign () {
302
+ if (hasRequiredObjectAssign) return objectAssign;
303
+ hasRequiredObjectAssign = 1;
304
+ /* eslint-disable no-unused-vars */
305
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
306
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
307
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
308
+
309
+ function toObject(val) {
310
+ if (val === null || val === undefined) {
311
+ throw new TypeError('Object.assign cannot be called with null or undefined');
312
+ }
313
+
314
+ return Object(val);
315
+ }
316
+
317
+ function shouldUseNative() {
318
+ try {
319
+ if (!Object.assign) {
320
+ return false;
321
+ }
322
+
323
+ // Detect buggy property enumeration order in older V8 versions.
324
+
325
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
326
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
327
+ test1[5] = 'de';
328
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
329
+ return false;
330
+ }
331
+
332
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
333
+ var test2 = {};
334
+ for (var i = 0; i < 10; i++) {
335
+ test2['_' + String.fromCharCode(i)] = i;
336
+ }
337
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
338
+ return test2[n];
339
+ });
340
+ if (order2.join('') !== '0123456789') {
341
+ return false;
342
+ }
343
+
344
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
345
+ var test3 = {};
346
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
347
+ test3[letter] = letter;
348
+ });
349
+ if (Object.keys(Object.assign({}, test3)).join('') !==
350
+ 'abcdefghijklmnopqrst') {
351
+ return false;
352
+ }
353
+
354
+ return true;
355
+ } catch (err) {
356
+ // We don't expect any of the above to throw, but better to be safe.
357
+ return false;
358
+ }
359
+ }
360
+
361
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
362
+ var from;
363
+ var to = toObject(target);
364
+ var symbols;
365
+
366
+ for (var s = 1; s < arguments.length; s++) {
367
+ from = Object(arguments[s]);
368
+
369
+ for (var key in from) {
370
+ if (hasOwnProperty.call(from, key)) {
371
+ to[key] = from[key];
372
+ }
373
+ }
374
+
375
+ if (getOwnPropertySymbols) {
376
+ symbols = getOwnPropertySymbols(from);
377
+ for (var i = 0; i < symbols.length; i++) {
378
+ if (propIsEnumerable.call(from, symbols[i])) {
379
+ to[symbols[i]] = from[symbols[i]];
380
+ }
381
+ }
382
+ }
383
+ }
384
+
385
+ return to;
386
+ };
387
+ return objectAssign;
388
+ }
389
+
390
+ /**
391
+ * Copyright (c) 2013-present, Facebook, Inc.
392
+ *
393
+ * This source code is licensed under the MIT license found in the
394
+ * LICENSE file in the root directory of this source tree.
395
+ */
396
+
397
+ var ReactPropTypesSecret_1;
398
+ var hasRequiredReactPropTypesSecret;
399
+
400
+ function requireReactPropTypesSecret () {
401
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
402
+ hasRequiredReactPropTypesSecret = 1;
403
+
404
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
405
+
406
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
407
+ return ReactPropTypesSecret_1;
408
+ }
409
+
410
+ var has;
411
+ var hasRequiredHas;
412
+
413
+ function requireHas () {
414
+ if (hasRequiredHas) return has;
415
+ hasRequiredHas = 1;
416
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
417
+ return has;
418
+ }
419
+
420
+ /**
421
+ * Copyright (c) 2013-present, Facebook, Inc.
422
+ *
423
+ * This source code is licensed under the MIT license found in the
424
+ * LICENSE file in the root directory of this source tree.
425
+ */
426
+
427
+ var checkPropTypes_1;
428
+ var hasRequiredCheckPropTypes;
429
+
430
+ function requireCheckPropTypes () {
431
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
432
+ hasRequiredCheckPropTypes = 1;
433
+
434
+ var printWarning = function() {};
435
+
436
+ if (process.env.NODE_ENV !== 'production') {
437
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
438
+ var loggedTypeFailures = {};
439
+ var has = requireHas();
440
+
441
+ printWarning = function(text) {
442
+ var message = 'Warning: ' + text;
443
+ if (typeof console !== 'undefined') {
444
+ console.error(message);
445
+ }
446
+ try {
447
+ // --- Welcome to debugging React ---
448
+ // This error was thrown as a convenience so that you can use this stack
449
+ // to find the callsite that caused this warning to fire.
450
+ throw new Error(message);
451
+ } catch (x) { /**/ }
452
+ };
453
+ }
454
+
455
+ /**
456
+ * Assert that the values match with the type specs.
457
+ * Error messages are memorized and will only be shown once.
458
+ *
459
+ * @param {object} typeSpecs Map of name to a ReactPropType
460
+ * @param {object} values Runtime values that need to be type-checked
461
+ * @param {string} location e.g. "prop", "context", "child context"
462
+ * @param {string} componentName Name of the component for error messages.
463
+ * @param {?Function} getStack Returns the component stack.
464
+ * @private
465
+ */
466
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
467
+ if (process.env.NODE_ENV !== 'production') {
468
+ for (var typeSpecName in typeSpecs) {
469
+ if (has(typeSpecs, typeSpecName)) {
470
+ var error;
471
+ // Prop type validation may throw. In case they do, we don't want to
472
+ // fail the render phase where it didn't fail before. So we log it.
473
+ // After these have been cleaned up, we'll let them throw.
474
+ try {
475
+ // This is intentionally an invariant that gets caught. It's the same
476
+ // behavior as without this statement except with a better message.
477
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
478
+ var err = Error(
479
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
480
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
481
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
482
+ );
483
+ err.name = 'Invariant Violation';
484
+ throw err;
485
+ }
486
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
487
+ } catch (ex) {
488
+ error = ex;
489
+ }
490
+ if (error && !(error instanceof Error)) {
491
+ printWarning(
492
+ (componentName || 'React class') + ': type specification of ' +
493
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
494
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
495
+ 'You may have forgotten to pass an argument to the type checker ' +
496
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
497
+ 'shape all require an argument).'
498
+ );
499
+ }
500
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
501
+ // Only monitor this failure once because there tends to be a lot of the
502
+ // same error.
503
+ loggedTypeFailures[error.message] = true;
504
+
505
+ var stack = getStack ? getStack() : '';
506
+
507
+ printWarning(
508
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
509
+ );
510
+ }
511
+ }
512
+ }
513
+ }
514
+ }
515
+
516
+ /**
517
+ * Resets warning cache when testing.
518
+ *
519
+ * @private
520
+ */
521
+ checkPropTypes.resetWarningCache = function() {
522
+ if (process.env.NODE_ENV !== 'production') {
523
+ loggedTypeFailures = {};
524
+ }
525
+ };
526
+
527
+ checkPropTypes_1 = checkPropTypes;
528
+ return checkPropTypes_1;
529
+ }
530
+
531
+ /**
532
+ * Copyright (c) 2013-present, Facebook, Inc.
533
+ *
534
+ * This source code is licensed under the MIT license found in the
535
+ * LICENSE file in the root directory of this source tree.
536
+ */
537
+
538
+ var factoryWithTypeCheckers;
539
+ var hasRequiredFactoryWithTypeCheckers;
540
+
541
+ function requireFactoryWithTypeCheckers () {
542
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
543
+ hasRequiredFactoryWithTypeCheckers = 1;
544
+
545
+ var ReactIs = requireReactIs();
546
+ var assign = requireObjectAssign();
547
+
548
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
549
+ var has = requireHas();
550
+ var checkPropTypes = requireCheckPropTypes();
551
+
552
+ var printWarning = function() {};
553
+
554
+ if (process.env.NODE_ENV !== 'production') {
555
+ printWarning = function(text) {
556
+ var message = 'Warning: ' + text;
557
+ if (typeof console !== 'undefined') {
558
+ console.error(message);
559
+ }
560
+ try {
561
+ // --- Welcome to debugging React ---
562
+ // This error was thrown as a convenience so that you can use this stack
563
+ // to find the callsite that caused this warning to fire.
564
+ throw new Error(message);
565
+ } catch (x) {}
566
+ };
567
+ }
568
+
569
+ function emptyFunctionThatReturnsNull() {
570
+ return null;
571
+ }
572
+
573
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
574
+ /* global Symbol */
575
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
576
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
577
+
578
+ /**
579
+ * Returns the iterator method function contained on the iterable object.
580
+ *
581
+ * Be sure to invoke the function with the iterable as context:
582
+ *
583
+ * var iteratorFn = getIteratorFn(myIterable);
584
+ * if (iteratorFn) {
585
+ * var iterator = iteratorFn.call(myIterable);
586
+ * ...
587
+ * }
588
+ *
589
+ * @param {?object} maybeIterable
590
+ * @return {?function}
591
+ */
592
+ function getIteratorFn(maybeIterable) {
593
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
594
+ if (typeof iteratorFn === 'function') {
595
+ return iteratorFn;
596
+ }
597
+ }
598
+
599
+ /**
600
+ * Collection of methods that allow declaration and validation of props that are
601
+ * supplied to React components. Example usage:
602
+ *
603
+ * var Props = require('ReactPropTypes');
604
+ * var MyArticle = React.createClass({
605
+ * propTypes: {
606
+ * // An optional string prop named "description".
607
+ * description: Props.string,
608
+ *
609
+ * // A required enum prop named "category".
610
+ * category: Props.oneOf(['News','Photos']).isRequired,
611
+ *
612
+ * // A prop named "dialog" that requires an instance of Dialog.
613
+ * dialog: Props.instanceOf(Dialog).isRequired
614
+ * },
615
+ * render: function() { ... }
616
+ * });
617
+ *
618
+ * A more formal specification of how these methods are used:
619
+ *
620
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
621
+ * decl := ReactPropTypes.{type}(.isRequired)?
622
+ *
623
+ * Each and every declaration produces a function with the same signature. This
624
+ * allows the creation of custom validation functions. For example:
625
+ *
626
+ * var MyLink = React.createClass({
627
+ * propTypes: {
628
+ * // An optional string or URI prop named "href".
629
+ * href: function(props, propName, componentName) {
630
+ * var propValue = props[propName];
631
+ * if (propValue != null && typeof propValue !== 'string' &&
632
+ * !(propValue instanceof URI)) {
633
+ * return new Error(
634
+ * 'Expected a string or an URI for ' + propName + ' in ' +
635
+ * componentName
636
+ * );
637
+ * }
638
+ * }
639
+ * },
640
+ * render: function() {...}
641
+ * });
642
+ *
643
+ * @internal
644
+ */
645
+
646
+ var ANONYMOUS = '<<anonymous>>';
647
+
648
+ // Important!
649
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
650
+ var ReactPropTypes = {
651
+ array: createPrimitiveTypeChecker('array'),
652
+ bigint: createPrimitiveTypeChecker('bigint'),
653
+ bool: createPrimitiveTypeChecker('boolean'),
654
+ func: createPrimitiveTypeChecker('function'),
655
+ number: createPrimitiveTypeChecker('number'),
656
+ object: createPrimitiveTypeChecker('object'),
657
+ string: createPrimitiveTypeChecker('string'),
658
+ symbol: createPrimitiveTypeChecker('symbol'),
659
+
660
+ any: createAnyTypeChecker(),
661
+ arrayOf: createArrayOfTypeChecker,
662
+ element: createElementTypeChecker(),
663
+ elementType: createElementTypeTypeChecker(),
664
+ instanceOf: createInstanceTypeChecker,
665
+ node: createNodeChecker(),
666
+ objectOf: createObjectOfTypeChecker,
667
+ oneOf: createEnumTypeChecker,
668
+ oneOfType: createUnionTypeChecker,
669
+ shape: createShapeTypeChecker,
670
+ exact: createStrictShapeTypeChecker,
671
+ };
672
+
673
+ /**
674
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
675
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
676
+ */
677
+ /*eslint-disable no-self-compare*/
678
+ function is(x, y) {
679
+ // SameValue algorithm
680
+ if (x === y) {
681
+ // Steps 1-5, 7-10
682
+ // Steps 6.b-6.e: +0 != -0
683
+ return x !== 0 || 1 / x === 1 / y;
684
+ } else {
685
+ // Step 6.a: NaN == NaN
686
+ return x !== x && y !== y;
687
+ }
688
+ }
689
+ /*eslint-enable no-self-compare*/
690
+
691
+ /**
692
+ * We use an Error-like object for backward compatibility as people may call
693
+ * PropTypes directly and inspect their output. However, we don't use real
694
+ * Errors anymore. We don't inspect their stack anyway, and creating them
695
+ * is prohibitively expensive if they are created too often, such as what
696
+ * happens in oneOfType() for any type before the one that matched.
697
+ */
698
+ function PropTypeError(message, data) {
699
+ this.message = message;
700
+ this.data = data && typeof data === 'object' ? data: {};
701
+ this.stack = '';
702
+ }
703
+ // Make `instanceof Error` still work for returned errors.
704
+ PropTypeError.prototype = Error.prototype;
705
+
706
+ function createChainableTypeChecker(validate) {
707
+ if (process.env.NODE_ENV !== 'production') {
708
+ var manualPropTypeCallCache = {};
709
+ var manualPropTypeWarningCount = 0;
710
+ }
711
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
712
+ componentName = componentName || ANONYMOUS;
713
+ propFullName = propFullName || propName;
714
+
715
+ if (secret !== ReactPropTypesSecret) {
716
+ if (throwOnDirectAccess) {
717
+ // New behavior only for users of `prop-types` package
718
+ var err = new Error(
719
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
720
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
721
+ 'Read more at http://fb.me/use-check-prop-types'
722
+ );
723
+ err.name = 'Invariant Violation';
724
+ throw err;
725
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
726
+ // Old behavior for people using React.PropTypes
727
+ var cacheKey = componentName + ':' + propName;
728
+ if (
729
+ !manualPropTypeCallCache[cacheKey] &&
730
+ // Avoid spamming the console because they are often not actionable except for lib authors
731
+ manualPropTypeWarningCount < 3
732
+ ) {
733
+ printWarning(
734
+ 'You are manually calling a React.PropTypes validation ' +
735
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
736
+ 'and will throw in the standalone `prop-types` package. ' +
737
+ 'You may be seeing this warning due to a third-party PropTypes ' +
738
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
739
+ );
740
+ manualPropTypeCallCache[cacheKey] = true;
741
+ manualPropTypeWarningCount++;
742
+ }
743
+ }
744
+ }
745
+ if (props[propName] == null) {
746
+ if (isRequired) {
747
+ if (props[propName] === null) {
748
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
749
+ }
750
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
751
+ }
752
+ return null;
753
+ } else {
754
+ return validate(props, propName, componentName, location, propFullName);
755
+ }
756
+ }
757
+
758
+ var chainedCheckType = checkType.bind(null, false);
759
+ chainedCheckType.isRequired = checkType.bind(null, true);
760
+
761
+ return chainedCheckType;
762
+ }
763
+
764
+ function createPrimitiveTypeChecker(expectedType) {
765
+ function validate(props, propName, componentName, location, propFullName, secret) {
766
+ var propValue = props[propName];
767
+ var propType = getPropType(propValue);
768
+ if (propType !== expectedType) {
769
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
770
+ // check, but we can offer a more precise error message here rather than
771
+ // 'of type `object`'.
772
+ var preciseType = getPreciseType(propValue);
773
+
774
+ return new PropTypeError(
775
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
776
+ {expectedType: expectedType}
777
+ );
778
+ }
779
+ return null;
780
+ }
781
+ return createChainableTypeChecker(validate);
782
+ }
783
+
784
+ function createAnyTypeChecker() {
785
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
786
+ }
787
+
788
+ function createArrayOfTypeChecker(typeChecker) {
789
+ function validate(props, propName, componentName, location, propFullName) {
790
+ if (typeof typeChecker !== 'function') {
791
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
792
+ }
793
+ var propValue = props[propName];
794
+ if (!Array.isArray(propValue)) {
795
+ var propType = getPropType(propValue);
796
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
797
+ }
798
+ for (var i = 0; i < propValue.length; i++) {
799
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
800
+ if (error instanceof Error) {
801
+ return error;
802
+ }
803
+ }
804
+ return null;
805
+ }
806
+ return createChainableTypeChecker(validate);
807
+ }
808
+
809
+ function createElementTypeChecker() {
810
+ function validate(props, propName, componentName, location, propFullName) {
811
+ var propValue = props[propName];
812
+ if (!isValidElement(propValue)) {
813
+ var propType = getPropType(propValue);
814
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
815
+ }
816
+ return null;
817
+ }
818
+ return createChainableTypeChecker(validate);
819
+ }
820
+
821
+ function createElementTypeTypeChecker() {
822
+ function validate(props, propName, componentName, location, propFullName) {
823
+ var propValue = props[propName];
824
+ if (!ReactIs.isValidElementType(propValue)) {
825
+ var propType = getPropType(propValue);
826
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
827
+ }
828
+ return null;
829
+ }
830
+ return createChainableTypeChecker(validate);
831
+ }
832
+
833
+ function createInstanceTypeChecker(expectedClass) {
834
+ function validate(props, propName, componentName, location, propFullName) {
835
+ if (!(props[propName] instanceof expectedClass)) {
836
+ var expectedClassName = expectedClass.name || ANONYMOUS;
837
+ var actualClassName = getClassName(props[propName]);
838
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
839
+ }
840
+ return null;
841
+ }
842
+ return createChainableTypeChecker(validate);
843
+ }
844
+
845
+ function createEnumTypeChecker(expectedValues) {
846
+ if (!Array.isArray(expectedValues)) {
847
+ if (process.env.NODE_ENV !== 'production') {
848
+ if (arguments.length > 1) {
849
+ printWarning(
850
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
851
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
852
+ );
853
+ } else {
854
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
855
+ }
856
+ }
857
+ return emptyFunctionThatReturnsNull;
858
+ }
859
+
860
+ function validate(props, propName, componentName, location, propFullName) {
861
+ var propValue = props[propName];
862
+ for (var i = 0; i < expectedValues.length; i++) {
863
+ if (is(propValue, expectedValues[i])) {
864
+ return null;
865
+ }
866
+ }
867
+
868
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
869
+ var type = getPreciseType(value);
870
+ if (type === 'symbol') {
871
+ return String(value);
872
+ }
873
+ return value;
874
+ });
875
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
876
+ }
877
+ return createChainableTypeChecker(validate);
878
+ }
879
+
880
+ function createObjectOfTypeChecker(typeChecker) {
881
+ function validate(props, propName, componentName, location, propFullName) {
882
+ if (typeof typeChecker !== 'function') {
883
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
884
+ }
885
+ var propValue = props[propName];
886
+ var propType = getPropType(propValue);
887
+ if (propType !== 'object') {
888
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
889
+ }
890
+ for (var key in propValue) {
891
+ if (has(propValue, key)) {
892
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
893
+ if (error instanceof Error) {
894
+ return error;
895
+ }
896
+ }
897
+ }
898
+ return null;
899
+ }
900
+ return createChainableTypeChecker(validate);
901
+ }
902
+
903
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
904
+ if (!Array.isArray(arrayOfTypeCheckers)) {
905
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
906
+ return emptyFunctionThatReturnsNull;
907
+ }
908
+
909
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
910
+ var checker = arrayOfTypeCheckers[i];
911
+ if (typeof checker !== 'function') {
912
+ printWarning(
913
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
914
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
915
+ );
916
+ return emptyFunctionThatReturnsNull;
917
+ }
918
+ }
919
+
920
+ function validate(props, propName, componentName, location, propFullName) {
921
+ var expectedTypes = [];
922
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
923
+ var checker = arrayOfTypeCheckers[i];
924
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
925
+ if (checkerResult == null) {
926
+ return null;
927
+ }
928
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
929
+ expectedTypes.push(checkerResult.data.expectedType);
930
+ }
931
+ }
932
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
933
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
934
+ }
935
+ return createChainableTypeChecker(validate);
936
+ }
937
+
938
+ function createNodeChecker() {
939
+ function validate(props, propName, componentName, location, propFullName) {
940
+ if (!isNode(props[propName])) {
941
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
942
+ }
943
+ return null;
944
+ }
945
+ return createChainableTypeChecker(validate);
946
+ }
947
+
948
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
949
+ return new PropTypeError(
950
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
951
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
952
+ );
953
+ }
954
+
955
+ function createShapeTypeChecker(shapeTypes) {
956
+ function validate(props, propName, componentName, location, propFullName) {
957
+ var propValue = props[propName];
958
+ var propType = getPropType(propValue);
959
+ if (propType !== 'object') {
960
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
961
+ }
962
+ for (var key in shapeTypes) {
963
+ var checker = shapeTypes[key];
964
+ if (typeof checker !== 'function') {
965
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
966
+ }
967
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
968
+ if (error) {
969
+ return error;
970
+ }
971
+ }
972
+ return null;
973
+ }
974
+ return createChainableTypeChecker(validate);
975
+ }
976
+
977
+ function createStrictShapeTypeChecker(shapeTypes) {
978
+ function validate(props, propName, componentName, location, propFullName) {
979
+ var propValue = props[propName];
980
+ var propType = getPropType(propValue);
981
+ if (propType !== 'object') {
982
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
983
+ }
984
+ // We need to check all keys in case some are required but missing from props.
985
+ var allKeys = assign({}, props[propName], shapeTypes);
986
+ for (var key in allKeys) {
987
+ var checker = shapeTypes[key];
988
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
989
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
990
+ }
991
+ if (!checker) {
992
+ return new PropTypeError(
993
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
994
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
995
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
996
+ );
997
+ }
998
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
999
+ if (error) {
1000
+ return error;
1001
+ }
1002
+ }
1003
+ return null;
1004
+ }
1005
+
1006
+ return createChainableTypeChecker(validate);
1007
+ }
1008
+
1009
+ function isNode(propValue) {
1010
+ switch (typeof propValue) {
1011
+ case 'number':
1012
+ case 'string':
1013
+ case 'undefined':
1014
+ return true;
1015
+ case 'boolean':
1016
+ return !propValue;
1017
+ case 'object':
1018
+ if (Array.isArray(propValue)) {
1019
+ return propValue.every(isNode);
1020
+ }
1021
+ if (propValue === null || isValidElement(propValue)) {
1022
+ return true;
1023
+ }
1024
+
1025
+ var iteratorFn = getIteratorFn(propValue);
1026
+ if (iteratorFn) {
1027
+ var iterator = iteratorFn.call(propValue);
1028
+ var step;
1029
+ if (iteratorFn !== propValue.entries) {
1030
+ while (!(step = iterator.next()).done) {
1031
+ if (!isNode(step.value)) {
1032
+ return false;
1033
+ }
1034
+ }
1035
+ } else {
1036
+ // Iterator will provide entry [k,v] tuples rather than values.
1037
+ while (!(step = iterator.next()).done) {
1038
+ var entry = step.value;
1039
+ if (entry) {
1040
+ if (!isNode(entry[1])) {
1041
+ return false;
1042
+ }
1043
+ }
1044
+ }
1045
+ }
1046
+ } else {
1047
+ return false;
1048
+ }
1049
+
1050
+ return true;
1051
+ default:
1052
+ return false;
1053
+ }
1054
+ }
1055
+
1056
+ function isSymbol(propType, propValue) {
1057
+ // Native Symbol.
1058
+ if (propType === 'symbol') {
1059
+ return true;
1060
+ }
1061
+
1062
+ // falsy value can't be a Symbol
1063
+ if (!propValue) {
1064
+ return false;
1065
+ }
1066
+
1067
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1068
+ if (propValue['@@toStringTag'] === 'Symbol') {
1069
+ return true;
1070
+ }
1071
+
1072
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1073
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1074
+ return true;
1075
+ }
1076
+
1077
+ return false;
1078
+ }
1079
+
1080
+ // Equivalent of `typeof` but with special handling for array and regexp.
1081
+ function getPropType(propValue) {
1082
+ var propType = typeof propValue;
1083
+ if (Array.isArray(propValue)) {
1084
+ return 'array';
1085
+ }
1086
+ if (propValue instanceof RegExp) {
1087
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1088
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1089
+ // passes PropTypes.object.
1090
+ return 'object';
1091
+ }
1092
+ if (isSymbol(propType, propValue)) {
1093
+ return 'symbol';
1094
+ }
1095
+ return propType;
1096
+ }
1097
+
1098
+ // This handles more types than `getPropType`. Only used for error messages.
1099
+ // See `createPrimitiveTypeChecker`.
1100
+ function getPreciseType(propValue) {
1101
+ if (typeof propValue === 'undefined' || propValue === null) {
1102
+ return '' + propValue;
1103
+ }
1104
+ var propType = getPropType(propValue);
1105
+ if (propType === 'object') {
1106
+ if (propValue instanceof Date) {
1107
+ return 'date';
1108
+ } else if (propValue instanceof RegExp) {
1109
+ return 'regexp';
1110
+ }
1111
+ }
1112
+ return propType;
1113
+ }
1114
+
1115
+ // Returns a string that is postfixed to a warning about an invalid type.
1116
+ // For example, "undefined" or "of type array"
1117
+ function getPostfixForTypeWarning(value) {
1118
+ var type = getPreciseType(value);
1119
+ switch (type) {
1120
+ case 'array':
1121
+ case 'object':
1122
+ return 'an ' + type;
1123
+ case 'boolean':
1124
+ case 'date':
1125
+ case 'regexp':
1126
+ return 'a ' + type;
1127
+ default:
1128
+ return type;
1129
+ }
1130
+ }
1131
+
1132
+ // Returns class name of the object, if any.
1133
+ function getClassName(propValue) {
1134
+ if (!propValue.constructor || !propValue.constructor.name) {
1135
+ return ANONYMOUS;
1136
+ }
1137
+ return propValue.constructor.name;
1138
+ }
1139
+
1140
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1141
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1142
+ ReactPropTypes.PropTypes = ReactPropTypes;
1143
+
1144
+ return ReactPropTypes;
1145
+ };
1146
+ return factoryWithTypeCheckers;
1147
+ }
1148
+
1149
+ /**
1150
+ * Copyright (c) 2013-present, Facebook, Inc.
1151
+ *
1152
+ * This source code is licensed under the MIT license found in the
1153
+ * LICENSE file in the root directory of this source tree.
1154
+ */
1155
+
1156
+ var factoryWithThrowingShims;
1157
+ var hasRequiredFactoryWithThrowingShims;
1158
+
1159
+ function requireFactoryWithThrowingShims () {
1160
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1161
+ hasRequiredFactoryWithThrowingShims = 1;
1162
+
1163
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
1164
+
1165
+ function emptyFunction() {}
1166
+ function emptyFunctionWithReset() {}
1167
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1168
+
1169
+ factoryWithThrowingShims = function() {
1170
+ function shim(props, propName, componentName, location, propFullName, secret) {
1171
+ if (secret === ReactPropTypesSecret) {
1172
+ // It is still safe when called from React.
1173
+ return;
1174
+ }
1175
+ var err = new Error(
1176
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1177
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1178
+ 'Read more at http://fb.me/use-check-prop-types'
1179
+ );
1180
+ err.name = 'Invariant Violation';
1181
+ throw err;
1182
+ } shim.isRequired = shim;
1183
+ function getShim() {
1184
+ return shim;
1185
+ } // Important!
1186
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1187
+ var ReactPropTypes = {
1188
+ array: shim,
1189
+ bigint: shim,
1190
+ bool: shim,
1191
+ func: shim,
1192
+ number: shim,
1193
+ object: shim,
1194
+ string: shim,
1195
+ symbol: shim,
1196
+
1197
+ any: shim,
1198
+ arrayOf: getShim,
1199
+ element: shim,
1200
+ elementType: shim,
1201
+ instanceOf: getShim,
1202
+ node: shim,
1203
+ objectOf: getShim,
1204
+ oneOf: getShim,
1205
+ oneOfType: getShim,
1206
+ shape: getShim,
1207
+ exact: getShim,
1208
+
1209
+ checkPropTypes: emptyFunctionWithReset,
1210
+ resetWarningCache: emptyFunction
1211
+ };
1212
+
1213
+ ReactPropTypes.PropTypes = ReactPropTypes;
1214
+
1215
+ return ReactPropTypes;
1216
+ };
1217
+ return factoryWithThrowingShims;
1218
+ }
1219
+
1220
+ /**
1221
+ * Copyright (c) 2013-present, Facebook, Inc.
1222
+ *
1223
+ * This source code is licensed under the MIT license found in the
1224
+ * LICENSE file in the root directory of this source tree.
1225
+ */
1226
+
1227
+ if (process.env.NODE_ENV !== 'production') {
1228
+ var ReactIs = requireReactIs();
1229
+
1230
+ // By explicitly using `prop-types` you are opting into new development behavior.
1231
+ // http://fb.me/prop-types-in-prod
1232
+ var throwOnDirectAccess = true;
1233
+ propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1234
+ } else {
1235
+ // By explicitly using `prop-types` you are opting into new production behavior.
1236
+ // http://fb.me/prop-types-in-prod
1237
+ propTypes.exports = requireFactoryWithThrowingShims()();
1238
+ }
1239
+
1240
+ function _typeof(o) {
1241
+ "@babel/helpers - typeof";
1242
+
1243
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
1244
+ return typeof o;
1245
+ } : function (o) {
1246
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1247
+ }, _typeof(o);
1248
+ }
1249
+
1250
+ function _toPrimitive(input, hint) {
1251
+ if (_typeof(input) !== "object" || input === null) return input;
1252
+ var prim = input[Symbol.toPrimitive];
1253
+ if (prim !== undefined) {
1254
+ var res = prim.call(input, hint || "default");
1255
+ if (_typeof(res) !== "object") return res;
1256
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1257
+ }
1258
+ return (hint === "string" ? String : Number)(input);
1259
+ }
1260
+
1261
+ function _toPropertyKey(arg) {
1262
+ var key = _toPrimitive(arg, "string");
1263
+ return _typeof(key) === "symbol" ? key : String(key);
1264
+ }
1265
+
1266
+ function _defineProperty(obj, key, value) {
1267
+ key = _toPropertyKey(key);
1268
+ if (key in obj) {
1269
+ Object.defineProperty(obj, key, {
1270
+ value: value,
1271
+ enumerable: true,
1272
+ configurable: true,
1273
+ writable: true
1274
+ });
1275
+ } else {
1276
+ obj[key] = value;
1277
+ }
1278
+ return obj;
1279
+ }
1280
+
1281
+ function _arrayWithHoles(arr) {
1282
+ if (Array.isArray(arr)) return arr;
1283
+ }
1284
+
1285
+ function _iterableToArrayLimit(r, l) {
1286
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1287
+ if (null != t) {
1288
+ var e,
1289
+ n,
1290
+ i,
1291
+ u,
1292
+ a = [],
1293
+ f = !0,
1294
+ o = !1;
1295
+ try {
1296
+ if (i = (t = t.call(r)).next, 0 === l) {
1297
+ if (Object(t) !== t) return;
1298
+ f = !1;
1299
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
1300
+ } catch (r) {
1301
+ o = !0, n = r;
1302
+ } finally {
1303
+ try {
1304
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
1305
+ } finally {
1306
+ if (o) throw n;
1307
+ }
1308
+ }
1309
+ return a;
1310
+ }
1311
+ }
1312
+
1313
+ function _arrayLikeToArray(arr, len) {
1314
+ if (len == null || len > arr.length) len = arr.length;
1315
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1316
+ return arr2;
1317
+ }
1318
+
1319
+ function _unsupportedIterableToArray(o, minLen) {
1320
+ if (!o) return;
1321
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1322
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1323
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1324
+ if (n === "Map" || n === "Set") return Array.from(o);
1325
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1326
+ }
1327
+
1328
+ function _nonIterableRest() {
1329
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1330
+ }
1331
+
1332
+ function _slicedToArray(arr, i) {
1333
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1334
+ }
1335
+
1336
+ function _arrayWithoutHoles(arr) {
1337
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1338
+ }
1339
+
1340
+ function _iterableToArray(iter) {
1341
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1342
+ }
1343
+
1344
+ function _nonIterableSpread() {
1345
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1346
+ }
1347
+
1348
+ function _toConsumableArray(arr) {
1349
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1350
+ }
1351
+
1352
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
1353
+
1354
+ var css$1 = ".neeto-molecules-app-switcher__wrapper{align-items:flex-start;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:column;justify-content:flex-start;max-width:100%;overflow-y:auto;padding:40px;position:relative;transition:all .3s;width:100%}@media only screen and (max-width:992px){.neeto-molecules-app-switcher__wrapper{padding:32px}}@media screen and (max-width:768px){.neeto-molecules-app-switcher__wrapper{padding:16px}}.neeto-molecules-app-switcher__grid{grid-gap:24px;display:grid;gap:24px;grid-template-columns:repeat(auto-fill,minmax(288px,1fr))}@media only screen and (max-width:992px){.neeto-molecules-app-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr))}}@media only screen and (max-width:640px){.neeto-molecules-app-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(100%,1fr))}}.neeto-molecules-app-switcher__header{align-items:center;display:flex;gap:32px;justify-content:space-between;margin-bottom:32px;position:relative;width:100%}@media only screen and (max-width:768px){.neeto-molecules-app-switcher__header{align-items:flex-start;flex-direction:column-reverse;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-app-switcher__header h1{font-size:24px}}.neeto-molecules-app-switcher__close-btn{position:absolute;right:12px;top:12px}.neeto-molecules-app-switcher__search-wrapper{flex-grow:1}@media only screen and (min-width:992px){.neeto-molecules-app-switcher__search-wrapper{flex-grow:0;width:296px}}.neeto-molecules-app-switcher__body{display:flex;flex-direction:column;font-size:var(--neeto-ui-text-sm);gap:12px;margin-bottom:24px;width:100%}.neeto-molecules-app-switcher-link{align-items:center;background-color:rgb(var(--neeto-ui-gray-100));border-color:rgb(var(--neeto-ui-gray-100));border-radius:var(--neeto-ui-rounded-lg);border-style:solid;border-width:2px;cursor:pointer;display:flex;gap:12px;max-width:100%;padding:12px 16px;text-decoration:none;transition:background-color .3s ease-in-out;width:100%}.neeto-molecules-app-switcher-link:focus,.neeto-molecules-app-switcher-link:focus-visible{outline:none}.neeto-molecules-app-switcher-link:focus-visible{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-app-switcher-link:not(.neeto-molecules-app-switcher-link--active):hover{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-app-switcher-link--active{background:rgb(var(--neeto-ui-primary-100));border-color:rgb(var(--neeto-ui-primary-600))}.neeto-molecules-app-switcher-link__icon-holder{align-items:center;border-radius:var(--neeto-ui-rounded-lg);display:flex;flex-shrink:0;height:42px;justify-content:center;width:42px}.neeto-molecules-app-switcher-link__content{flex-grow:1}.neeto-molecules-app-switcher-link__content span{display:block}";
1355
+ n(css$1,{});
1356
+
1357
+ var AppLink = function AppLink(_ref) {
1358
+ var name = _ref.name,
1359
+ description = _ref.description,
1360
+ url = _ref.url;
1361
+ var appName = "Neeto".concat(name.charAt(0)).concat(name.slice(1).toLowerCase());
1362
+ var AppIcon = AppIcons[appName];
1363
+ return /*#__PURE__*/React.createElement("a", {
1364
+ "data-cy": "".concat(name, "-app-link"),
1365
+ "data-test-id": "neetoapp-link-".concat(name),
1366
+ href: url,
1367
+ rel: "noreferrer",
1368
+ target: "_blank",
1369
+ className: classnames("neeto-molecules-app-switcher-link", {
1370
+ "neeto-molecules-app-switcher-link--active": capitalize(globalProps.appName) === appName
1371
+ })
1372
+ }, /*#__PURE__*/React.createElement("div", {
1373
+ className: classnames("neeto-molecules-app-switcher-link__icon-holder", {
1374
+ "neeto-ui-bg-primary-500": !AppIcon
1375
+ })
1376
+ }, AppIcon ? /*#__PURE__*/React.createElement(AppIcon, {
1377
+ size: 42
1378
+ }) : /*#__PURE__*/React.createElement(NeetoIcon, {
1379
+ color: "white",
1380
+ size: 42
1381
+ })), /*#__PURE__*/React.createElement("div", {
1382
+ className: "neeto-molecules-app-switcher-link__content"
1383
+ }, /*#__PURE__*/React.createElement(Typography, {
1384
+ component: "span",
1385
+ lineHeight: "relaxed",
1386
+ style: "h4",
1387
+ weight: "medium"
1388
+ }, name), /*#__PURE__*/React.createElement(Typography, {
1389
+ component: "span",
1390
+ style: "body3",
1391
+ weight: "normal"
1392
+ }, description)));
1393
+ };
1394
+ var AppLink$1 = /*#__PURE__*/React.memo(AppLink);
1395
+
1396
+ var Body = function Body() {
1397
+ var _useTranslation = useTranslation(),
1398
+ t = _useTranslation.t;
1399
+ var _useState = useState(""),
1400
+ _useState2 = _slicedToArray(_useState, 2),
1401
+ searchTerm = _useState2[0],
1402
+ setSearchTerm = _useState2[1];
1403
+ var _useFetchNeetoApps = useFetchNeetoApps({
1404
+ enabled: false
1405
+ }),
1406
+ data = _useFetchNeetoApps.data;
1407
+ var substring = searchTerm.replace(/ /g, "").toLowerCase();
1408
+ var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref) {
1409
+ var name = _ref.name;
1410
+ return name.toLowerCase().includes(substring);
1411
+ });
1412
+ var handleSearch = function handleSearch(e) {
1413
+ return setSearchTerm(e.target.value);
1414
+ };
1415
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1416
+ className: "neeto-molecules-app-switcher__header",
1417
+ "data-cy": "app-switcher-body-wrapper"
1418
+ }, /*#__PURE__*/React.createElement(Typography, {
1419
+ style: "h1"
1420
+ }, t("neetoMolecules.appSwitcher.chooseNeetoProduct")), /*#__PURE__*/React.createElement("div", {
1421
+ className: "neeto-molecules-app-switcher__search-wrapper"
1422
+ }, /*#__PURE__*/React.createElement(Input, {
1423
+ autoFocus: true,
1424
+ "data-cy": "app-switcher-search-input",
1425
+ placeholder: t("neetoMolecules.appSwitcher.searchProducts"),
1426
+ prefix: /*#__PURE__*/React.createElement(Search, null),
1427
+ type: "search",
1428
+ value: searchTerm,
1429
+ onChange: handleSearch
1430
+ }))), /*#__PURE__*/React.createElement("div", {
1431
+ className: "neeto-molecules-app-switcher__body"
1432
+ }, (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/React.createElement("div", {
1433
+ className: "neeto-molecules-app-switcher__grid"
1434
+ }, filteredApps.map(function (app) {
1435
+ return /*#__PURE__*/React.createElement(AppLink$1, _extends({
1436
+ key: app.name
1437
+ }, app));
1438
+ })) : /*#__PURE__*/React.createElement(Typography, {
1439
+ className: "neeto-ui-text-center",
1440
+ style: "body1"
1441
+ }, t("neetoMolecules.appSwitcher.noApps"))));
1442
+ };
1443
+
1444
+ var AppSwitcher = function AppSwitcher() {
1445
+ return /*#__PURE__*/React.createElement("div", {
1446
+ className: "neeto-molecules-app-switcher__wrapper",
1447
+ "data-cy": "switcher-wrapper",
1448
+ "data-testid": "switcher-wrapper",
1449
+ key: "switcher-wrapper"
1450
+ }, /*#__PURE__*/React.createElement(Body, null));
1451
+ };
1452
+
1453
+ var _excluded$2 = ["showLoading"];
1454
+ var ProductSwitcherIcon = function ProductSwitcherIcon(_ref) {
1455
+ var showLoading = _ref.showLoading,
1456
+ otherProps = _objectWithoutProperties(_ref, _excluded$2);
1457
+ return showLoading ? /*#__PURE__*/React.createElement("span", {
1458
+ "data-testid": "app-switcher-button-loader"
1459
+ }, /*#__PURE__*/React.createElement(Spinner, _extends({
1460
+ size: 18
1461
+ }, otherProps))) : /*#__PURE__*/React.createElement(AppSwitcher$1, _extends({
1462
+ size: 18
1463
+ }, otherProps));
1464
+ };
1465
+ var AppSwitcherMenu = function AppSwitcherMenu() {
1466
+ var _useTranslation = useTranslation(),
1467
+ t = _useTranslation.t;
1468
+ var Menu = Dropdown.Menu,
1469
+ MenuItem = Dropdown.MenuItem;
1470
+ var _useState = useState(false),
1471
+ _useState2 = _slicedToArray(_useState, 2),
1472
+ hasHovered = _useState2[0],
1473
+ setHasHovered = _useState2[1];
1474
+ var _useFetchNeetoApps = useFetchNeetoApps({
1475
+ enabled: false
1476
+ }),
1477
+ data = _useFetchNeetoApps.data,
1478
+ refetchNeetoApps = _useFetchNeetoApps.refetch,
1479
+ isStale = _useFetchNeetoApps.isStale;
1480
+ return /*#__PURE__*/React.createElement(Dropdown, {
1481
+ className: "neeto-molecules-app-switcher-menu-popup-wrapper",
1482
+ disabled: !data,
1483
+ interactiveDebounce: 30,
1484
+ isOpen: !data ? false : undefined,
1485
+ offset: [0, 5],
1486
+ position: "right",
1487
+ trigger: "hover",
1488
+ zIndex: 99999,
1489
+ customTarget: /*#__PURE__*/React.createElement(MenuItem.Button, {
1490
+ className: "neeto-molecules-menu-sublist__item-btn",
1491
+ "data-cy": "app-switcher-button",
1492
+ "data-testid": "app-switcher-button",
1493
+ label: t("neetoMolecules.sidebar.productSwitcher"),
1494
+ style: "text",
1495
+ suffix: /*#__PURE__*/React.createElement(Right, {
1496
+ size: 18
1497
+ }),
1498
+ prefix: /*#__PURE__*/React.createElement(ProductSwitcherIcon, {
1499
+ showLoading: !data && hasHovered,
1500
+ size: 18
1501
+ }),
1502
+ onMouseEnter: function onMouseEnter() {
1503
+ if (!isStale) return;
1504
+ refetchNeetoApps();
1505
+ setHasHovered(true);
1506
+ }
1507
+ }, t("neetoMolecules.sidebar.productSwitcher")),
1508
+ dropdownProps: {
1509
+ classNames: "neeto-molecules-floating-action-button__dropdown"
1510
+ }
1511
+ }, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, null, /*#__PURE__*/React.createElement(AppSwitcher, null))));
1512
+ };
1513
+
1514
+ var _excluded$1 = ["label", "icon", "changesCount"];
1515
+ var LinkSection = function LinkSection(_ref) {
1516
+ var links = _ref.links;
1517
+ var MenuItem = Dropdown.MenuItem;
1518
+ if (isNotPresent(links)) return null;
1519
+ return links.map(function (_ref2, idx) {
1520
+ var label = _ref2.label,
1521
+ Icon = _ref2.icon,
1522
+ changesCount = _ref2.changesCount,
1523
+ otherProps = _objectWithoutProperties(_ref2, _excluded$1);
1524
+ return /*#__PURE__*/React.createElement(MenuItem.Button, _extends({
1525
+ className: "neeto-molecules-menu-sublist__item-btn",
1526
+ "data-cy": "floating-action-menu-link-section",
1527
+ key: idx,
1528
+ prefix: /*#__PURE__*/React.createElement(Icon, {
1529
+ size: 18
1530
+ }),
1531
+ style: "text"
1532
+ }, otherProps), label, isPresent(changesCount) && /*#__PURE__*/React.createElement("span", {
1533
+ className: "neeto-molecules-menu-list__item-btn-count",
1534
+ "data-cy": "help-section-menu-changes-count",
1535
+ "data-testid": "help-section-menu-changes-count"
1536
+ }, changesCount));
1537
+ });
1538
+ };
1539
+
1540
+ var ProfileHeader = function ProfileHeader(_ref) {
1541
+ var profileInfo = _ref.profileInfo;
1542
+ var name = profileInfo.name,
1543
+ email = profileInfo.email;
1544
+ return /*#__PURE__*/React.createElement("div", {
1545
+ className: "neeto-ui-relative neeto-ui-flex neeto-ui-items-center neeto-ui-p-3 neeto-ui-bg-primary-100 neeto-molecules-profile-popup__top-section",
1546
+ "data-cy": "floating-action-menu-profile-header"
1547
+ }, /*#__PURE__*/React.createElement("div", {
1548
+ className: "top-0 left-0"
1549
+ }, /*#__PURE__*/React.createElement(Avatar, {
1550
+ "data-cy": "floating-action-menu-header-profile-icon",
1551
+ size: "large",
1552
+ user: profileInfo
1553
+ })), /*#__PURE__*/React.createElement("div", {
1554
+ className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-flex-grow neeto-ui-min-w-0 neeto-ui-pl-3"
1555
+ }, /*#__PURE__*/React.createElement(Typography, {
1556
+ className: "neeto-ui-m-0",
1557
+ component: "h2",
1558
+ "data-cy": "floating-action-menu-header-user-name",
1559
+ lineHeight: "tight",
1560
+ style: "h5",
1561
+ title: name,
1562
+ weight: "semibold"
1563
+ }, truncate(name, 18)), email && /*#__PURE__*/React.createElement(Typography, {
1564
+ className: "neeto-ui-w-full neeto-ui-truncate neeto-ui-text-gray-700",
1565
+ "data-cy": "floating-action-menu-header-user-email",
1566
+ lineHeight: "tight",
1567
+ style: "body3"
1568
+ }, email)));
1569
+ };
1570
+
1571
+ var ProfileMenu = function ProfileMenu(_ref) {
1572
+ var profileInfo = _ref.profileInfo,
1573
+ showAppSwitcher = _ref.showAppSwitcher,
1574
+ helpLinks = _ref.helpLinks,
1575
+ topLinks = _ref.topLinks,
1576
+ bottomLinks = _ref.bottomLinks,
1577
+ customContent = _ref.customContent;
1578
+ var Menu = Dropdown.Menu,
1579
+ MenuItem = Dropdown.MenuItem,
1580
+ Divider = Dropdown.Divider;
1581
+ return /*#__PURE__*/React.createElement(Menu, {
1582
+ className: "pb-1"
1583
+ }, /*#__PURE__*/React.createElement(MenuItem, {
1584
+ className: "neeto-molecules-profile-popup mb-1",
1585
+ "data-cy": "profile-popup",
1586
+ "data-testid": "profile-popup"
1587
+ }, /*#__PURE__*/React.createElement(ProfileHeader, {
1588
+ profileInfo: profileInfo
1589
+ })), showAppSwitcher && /*#__PURE__*/React.createElement(AppSwitcherMenu, null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(LinkSection, {
1590
+ links: topLinks
1591
+ }), isPresent(customContent) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(MenuItem, {
1592
+ className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content"
1593
+ }, customContent)), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(LinkSection, {
1594
+ links: helpLinks
1595
+ }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(LinkSection, {
1596
+ links: bottomLinks
1597
+ }));
1598
+ };
1599
+
1600
+ var shouldShowWhatsNew = function shouldShowWhatsNew() {
1601
+ var _window$globalProps, _window$globalProps$u;
1602
+ var currentUserEmail = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : (_window$globalProps$u = _window$globalProps.user) === null || _window$globalProps$u === void 0 ? void 0 : _window$globalProps$u.email;
1603
+ return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
1604
+ };
1605
+ var MY_PROFILE_URL = "/auth/profile/edit";
1606
+ var MY_ORGANIZATION_URL = "/auth/organization/edit";
1607
+ var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
1608
+ var DEFAULT_HELP_LINK_PROPS = {
1609
+ liveChatProps: {
1610
+ label: t$1("neetoMolecules.sidebar.helpLinks.liveChat"),
1611
+ icon: ChatEmpty,
1612
+ "data-cy": "help-link-live-chat-button",
1613
+ onClick: function onClick() {
1614
+ var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
1615
+ (_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
1616
+ (_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
1617
+ }
1618
+ },
1619
+ helpCenterProps: {
1620
+ label: t$1("neetoMolecules.sidebar.helpLinks.helpArticles"),
1621
+ icon: Book,
1622
+ "data-cy": "help-link-help-center-button",
1623
+ href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
1624
+ target: "_blank"
1625
+ },
1626
+ changelogProps: {
1627
+ id: CHANGELOG_WIDGET_TRIGGER_ID,
1628
+ label: t$1("neetoMolecules.sidebar.helpLinks.whatsNew"),
1629
+ icon: Gift,
1630
+ "data-cy": "help-link-changelog-button",
1631
+ isVisible: shouldShowWhatsNew
1632
+ },
1633
+ keyboardShortcutProps: {
1634
+ label: t$1("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
1635
+ icon: Keyboard,
1636
+ "data-cy": "help-link-keyboard-shortcut-button"
1637
+ }
1638
+ };
1639
+
1640
+ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
1641
+ var _globalProps$user, _globalProps$user2;
1642
+ var user = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || ((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.phoneNumber);
1643
+ return "sidebarState-".concat(user);
1644
+ };
1645
+ var getDefaultTopLinks = function getDefaultTopLinks(isOwner) {
1646
+ return [{
1647
+ label: t$1("neetoMolecules.sidebar.myProfile"),
1648
+ icon: User,
1649
+ onClick: function onClick() {
1650
+ return window.open(MY_PROFILE_URL, "_blank");
1651
+ },
1652
+ "data-cy": "my-profile-button"
1653
+ }, isOwner && {
1654
+ label: t$1("neetoMolecules.sidebar.myOrganization"),
1655
+ icon: Settings,
1656
+ onClick: function onClick() {
1657
+ return window.open(MY_ORGANIZATION_URL, "_blank");
1658
+ },
1659
+ "data-cy": "profile-organization-settings-button"
1660
+ }].filter(Boolean);
1661
+ };
1662
+ var getDefaultBottomLinks = function getDefaultBottomLinks() {
1663
+ return [{
1664
+ icon: LeftArrow,
1665
+ label: t$1("neetoMolecules.sidebar.logout"),
1666
+ onClick: function onClick() {
1667
+ resetAuthTokens();
1668
+ removeFromLocalStorage(getSidebarStateLocalStorageKey());
1669
+ // eslint-disable-next-line xss/no-location-href-assign
1670
+ window.location.href = "/logout";
1671
+ },
1672
+ "data-cy": "profile-logout-button"
1673
+ }];
1674
+ };
1675
+ var getProfileInfo = function getProfileInfo(profileInfoOverrides) {
1676
+ var _globalProps$user3, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
1677
+ return mergeDeepLeft(profileInfoOverrides, {
1678
+ name: "".concat((_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName, " ").concat((_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName),
1679
+ imageUrl: (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl,
1680
+ email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber)
1681
+ });
1682
+ };
1683
+
1684
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1685
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1686
+ var ProfileButton = function ProfileButton(_ref) {
1687
+ var helpLinkOverrides = _ref.helpLinkOverrides,
1688
+ profileInfoOverrides = _ref.profileInfoOverrides,
1689
+ showAppSwitcher = _ref.showAppSwitcher,
1690
+ bottomLinks = _ref.bottomLinks,
1691
+ topLinks = _ref.topLinks,
1692
+ customContent = _ref.customContent;
1693
+ var _useFetchNeetoApps = useFetchNeetoApps({
1694
+ enabled: false
1695
+ }),
1696
+ data = _useFetchNeetoApps.data;
1697
+ var profileInfo = getProfileInfo(profileInfoOverrides);
1698
+ var newTopLinks = [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner)), _toConsumableArray(topLinks));
1699
+ var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks()), _toConsumableArray(bottomLinks));
1700
+ var _useState = useState(null),
1701
+ _useState2 = _slicedToArray(_useState, 2),
1702
+ changesCount = _useState2[0],
1703
+ setChangesCount = _useState2[1];
1704
+ useEffect(function () {
1705
+ var Nv = {
1706
+ onReceiveData: function onReceiveData(data) {
1707
+ if (!data.unreadCount) return;
1708
+ setChangesCount(data.unreadCount);
1709
+ },
1710
+ onShow: function onShow() {
1711
+ setChangesCount(null);
1712
+ }
1713
+ };
1714
+ window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
1715
+ }, []);
1716
+ var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
1717
+ _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
1718
+ setIsOpen = _KeyboardShortcuts$us2[1];
1719
+ var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).filter(function (key) {
1720
+ var _DEFAULT_HELP_LINK_PR, _DEFAULT_HELP_LINK_PR2, _DEFAULT_HELP_LINK_PR3;
1721
+ return (_DEFAULT_HELP_LINK_PR = (_DEFAULT_HELP_LINK_PR2 = (_DEFAULT_HELP_LINK_PR3 = DEFAULT_HELP_LINK_PROPS[key]).isVisible) === null || _DEFAULT_HELP_LINK_PR2 === void 0 ? void 0 : _DEFAULT_HELP_LINK_PR2.call(_DEFAULT_HELP_LINK_PR3)) !== null && _DEFAULT_HELP_LINK_PR !== void 0 ? _DEFAULT_HELP_LINK_PR : true;
1722
+ }).map(function (key) {
1723
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_HELP_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
1724
+ onClick: function onClick() {
1725
+ return setIsOpen(function (prev) {
1726
+ return !prev;
1727
+ });
1728
+ }
1729
+ }), key === "changelogProps" && changesCount && {
1730
+ changesCount: changesCount
1731
+ });
1732
+ }).filter(function (_ref2) {
1733
+ var hide = _ref2.hide;
1734
+ return !hide;
1735
+ });
1736
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
1737
+ isMultiLevel: true,
1738
+ appendTo: function appendTo() {
1739
+ return document.body;
1740
+ },
1741
+ buttonStyle: "link",
1742
+ closeOnSelect: isNotPresent(customContent),
1743
+ "data-cy": "floating-action-button",
1744
+ "data-testid": "floating-action-button",
1745
+ icon: noop,
1746
+ interactiveDebounce: 30,
1747
+ offset: [15, 10],
1748
+ position: "right-end",
1749
+ strategy: "fixed",
1750
+ theme: "light",
1751
+ trigger: "hover",
1752
+ zIndex: 99999,
1753
+ customTarget: /*#__PURE__*/React.createElement(Avatar, {
1754
+ className: "neeto-ui-flex-shrink-0 neeto-molecules-floating-action-button__profile-avatar",
1755
+ "data-cy": "profile-avatar",
1756
+ "data-testid": "profile-avatar",
1757
+ size: "medium",
1758
+ user: profileInfo
1759
+ }),
1760
+ dropdownProps: {
1761
+ classNames: "neeto-molecules-floating-action-button__dropdown"
1762
+ }
1763
+ }, /*#__PURE__*/React.createElement(ProfileMenu, {
1764
+ customContent: customContent,
1765
+ helpLinks: helpLinks,
1766
+ profileInfo: profileInfo,
1767
+ showAppSwitcher: showAppSwitcher,
1768
+ bottomLinks: newBottomLinks,
1769
+ topLinks: newTopLinks
1770
+ })), isPresent(changesCount) && /*#__PURE__*/React.createElement("span", {
1771
+ className: "neeto-molecules-menu__notif-count",
1772
+ "data-cy": "help-icon-changes-count",
1773
+ "data-testid": "help-icon-changes-count"
1774
+ }, changesCount));
1775
+ };
1776
+
1777
+ var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{align-items:center;background-color:rgb(var(--neeto-ui-white));border-bottom-right-radius:30px;border-top-right-radius:30px;bottom:20px;box-shadow:0 1px 1px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);display:flex;justify-content:center;left:0;padding:6px;position:fixed;z-index:10000000}.neeto-molecules-floating-action-button__dropdown{max-height:none!important;max-width:none;min-width:220px;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-menu__notif-count{position:absolute;right:3px;top:3px;z-index:1}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);height:15px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:15px}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2)!important;min-width:240px}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-top-left-radius:var(--neeto-ui-rounded);border-top-right-radius:var(--neeto-ui-rounded)}.neeto-molecules-menu-sublist__item-btn{font-weight:500!important;height:40px}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-app-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 400px)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}";
1778
+ n(css,{});
1779
+
1780
+ var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showAppSwitcher", "customContent"];
1781
+ var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
1782
+ var _ref$profileInfoOverr = _ref.profileInfoOverrides,
1783
+ profileInfoOverrides = _ref$profileInfoOverr === void 0 ? {} : _ref$profileInfoOverr,
1784
+ _ref$helpLinkOverride = _ref.helpLinkOverrides,
1785
+ helpLinkOverrides = _ref$helpLinkOverride === void 0 ? {} : _ref$helpLinkOverride,
1786
+ _ref$topLinks = _ref.topLinks,
1787
+ topLinks = _ref$topLinks === void 0 ? [] : _ref$topLinks,
1788
+ _ref$bottomLinks = _ref.bottomLinks,
1789
+ bottomLinks = _ref$bottomLinks === void 0 ? [] : _ref$bottomLinks,
1790
+ _ref$showAppSwitcher = _ref.showAppSwitcher,
1791
+ showAppSwitcher = _ref$showAppSwitcher === void 0 ? true : _ref$showAppSwitcher,
1792
+ customContent = _ref.customContent,
1793
+ otherProps = _objectWithoutProperties(_ref, _excluded);
1794
+ return /*#__PURE__*/React.createElement("div", _extends({
1795
+ ref: ref,
1796
+ className: "neeto-molecules-floating-action-menu__container",
1797
+ "data-cy": "floating-action-menu-container",
1798
+ "data-testid": "floating-action-menu-container"
1799
+ }, otherProps), /*#__PURE__*/React.createElement(ProfileButton, {
1800
+ bottomLinks: bottomLinks,
1801
+ customContent: customContent,
1802
+ helpLinkOverrides: helpLinkOverrides,
1803
+ profileInfoOverrides: profileInfoOverrides,
1804
+ showAppSwitcher: showAppSwitcher,
1805
+ topLinks: topLinks
1806
+ }));
1807
+ });
1808
+ FloatingActionMenu.displayName = "FloatingActionMenu";
1809
+ FloatingActionMenu.propTypes = {
1810
+ /**
1811
+ * To specify the profile info to be rendered in the menu
1812
+ */
1813
+ profileInfoOverrides: propTypes.exports.shape({
1814
+ name: propTypes.exports.string,
1815
+ email: propTypes.exports.string,
1816
+ imageUrl: propTypes.exports.string
1817
+ }),
1818
+ /**
1819
+ * Custom content to be rendered in the menu between the top and bottom links if any
1820
+ */
1821
+ customContent: propTypes.exports.element,
1822
+ /**
1823
+ * Any extra links to be rendered at the top of the menu.
1824
+ */
1825
+ topLinks: propTypes.exports.arrayOf(propTypes.exports.shape({
1826
+ onClick: propTypes.exports.func,
1827
+ label: propTypes.exports.string,
1828
+ icon: propTypes.exports.oneOfType([propTypes.exports.element, propTypes.exports.func])
1829
+ })),
1830
+ /**
1831
+ * Any extra links to be rendered at the bottom of the menu.
1832
+ */
1833
+ bottomLinks: propTypes.exports.arrayOf(propTypes.exports.shape({
1834
+ onClick: propTypes.exports.func,
1835
+ label: propTypes.exports.string,
1836
+ icon: propTypes.exports.oneOfType([propTypes.exports.element, propTypes.exports.func])
1837
+ })),
1838
+ /**
1839
+ * To override the values in the help links section in the menu.
1840
+ */
1841
+ helpLinkOverrides: propTypes.exports.object,
1842
+ /**
1843
+ * To display the app switcher menu option.
1844
+ */
1845
+ showAppSwitcher: propTypes.exports.bool
1846
+ };
1847
+
1848
+ export { FloatingActionMenu as default };
1849
+ //# sourceMappingURL=FloatingActionMenu.js.map