@vidispine/vdt-mui 22.2.0-pre.1 → 22.2.0-pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2438 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styles$8 = require('@mui/styles');
6
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
8
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
+ var clsx = require('clsx');
10
+ var List = require('@mui/material/List');
11
+ var VidispinePropTypes = require('@vidispine/proptypes');
12
+ var react = require('react');
13
+ var material = require('@mui/material');
14
+ var vdtJs = require('@vidispine/vdt-js');
15
+ var FolderIcon = require('@mui/icons-material/Folder');
16
+ var InsertDriveFileIcon = require('@mui/icons-material/InsertDriveFile');
17
+ var LibraryBooksIcon = require('@mui/icons-material/LibraryBooks');
18
+ var LibraryMusicIcon = require('@mui/icons-material/LibraryMusic');
19
+ var NoteAddIcon = require('@mui/icons-material/NoteAdd');
20
+ var PhotoLibraryIcon = require('@mui/icons-material/PhotoLibrary');
21
+ var VideoLibraryIcon = require('@mui/icons-material/VideoLibrary');
22
+ var AudioTrackIcon = require('@mui/icons-material/Audiotrack');
23
+ var ImageIcon = require('@mui/icons-material/Image');
24
+ var MovieIcon = require('@mui/icons-material/Movie');
25
+ var jsxRuntime = require('react/jsx-runtime');
26
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
27
+ var CssBaseline = require('@mui/material/CssBaseline');
28
+
29
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
30
+
31
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
32
+ var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
33
+ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
34
+ var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
35
+ var List__default = /*#__PURE__*/_interopDefaultLegacy(List);
36
+ var VidispinePropTypes__default = /*#__PURE__*/_interopDefaultLegacy(VidispinePropTypes);
37
+ var FolderIcon__default = /*#__PURE__*/_interopDefaultLegacy(FolderIcon);
38
+ var InsertDriveFileIcon__default = /*#__PURE__*/_interopDefaultLegacy(InsertDriveFileIcon);
39
+ var LibraryBooksIcon__default = /*#__PURE__*/_interopDefaultLegacy(LibraryBooksIcon);
40
+ var LibraryMusicIcon__default = /*#__PURE__*/_interopDefaultLegacy(LibraryMusicIcon);
41
+ var NoteAddIcon__default = /*#__PURE__*/_interopDefaultLegacy(NoteAddIcon);
42
+ var PhotoLibraryIcon__default = /*#__PURE__*/_interopDefaultLegacy(PhotoLibraryIcon);
43
+ var VideoLibraryIcon__default = /*#__PURE__*/_interopDefaultLegacy(VideoLibraryIcon);
44
+ var AudioTrackIcon__default = /*#__PURE__*/_interopDefaultLegacy(AudioTrackIcon);
45
+ var ImageIcon__default = /*#__PURE__*/_interopDefaultLegacy(ImageIcon);
46
+ var MovieIcon__default = /*#__PURE__*/_interopDefaultLegacy(MovieIcon);
47
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
48
+ var CssBaseline__default = /*#__PURE__*/_interopDefaultLegacy(CssBaseline);
49
+
50
+ var propTypes$5 = {exports: {}};
51
+
52
+ var reactIs = {exports: {}};
53
+
54
+ var reactIs_production_min = {};
55
+
56
+ /** @license React v16.13.1
57
+ * react-is.production.min.js
58
+ *
59
+ * Copyright (c) Facebook, Inc. and its affiliates.
60
+ *
61
+ * This source code is licensed under the MIT license found in the
62
+ * LICENSE file in the root directory of this source tree.
63
+ */
64
+ 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?
65
+ 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;
66
+ 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;
67
+ 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};
68
+ 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};
69
+ 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;
70
+
71
+ var reactIs_development = {};
72
+
73
+ /** @license React v16.13.1
74
+ * react-is.development.js
75
+ *
76
+ * Copyright (c) Facebook, Inc. and its affiliates.
77
+ *
78
+ * This source code is licensed under the MIT license found in the
79
+ * LICENSE file in the root directory of this source tree.
80
+ */
81
+
82
+
83
+
84
+ if (process.env.NODE_ENV !== "production") {
85
+ (function() {
86
+
87
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
88
+ // nor polyfill, then a plain number is used for performance.
89
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
90
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
91
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
92
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
93
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
94
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
95
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
96
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
97
+ // (unstable) APIs that have been removed. Can we remove the symbols?
98
+
99
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
100
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
101
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
102
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
103
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
104
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
105
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
106
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
107
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
108
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
109
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
110
+
111
+ function isValidElementType(type) {
112
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
113
+ 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);
114
+ }
115
+
116
+ function typeOf(object) {
117
+ if (typeof object === 'object' && object !== null) {
118
+ var $$typeof = object.$$typeof;
119
+
120
+ switch ($$typeof) {
121
+ case REACT_ELEMENT_TYPE:
122
+ var type = object.type;
123
+
124
+ switch (type) {
125
+ case REACT_ASYNC_MODE_TYPE:
126
+ case REACT_CONCURRENT_MODE_TYPE:
127
+ case REACT_FRAGMENT_TYPE:
128
+ case REACT_PROFILER_TYPE:
129
+ case REACT_STRICT_MODE_TYPE:
130
+ case REACT_SUSPENSE_TYPE:
131
+ return type;
132
+
133
+ default:
134
+ var $$typeofType = type && type.$$typeof;
135
+
136
+ switch ($$typeofType) {
137
+ case REACT_CONTEXT_TYPE:
138
+ case REACT_FORWARD_REF_TYPE:
139
+ case REACT_LAZY_TYPE:
140
+ case REACT_MEMO_TYPE:
141
+ case REACT_PROVIDER_TYPE:
142
+ return $$typeofType;
143
+
144
+ default:
145
+ return $$typeof;
146
+ }
147
+
148
+ }
149
+
150
+ case REACT_PORTAL_TYPE:
151
+ return $$typeof;
152
+ }
153
+ }
154
+
155
+ return undefined;
156
+ } // AsyncMode is deprecated along with isAsyncMode
157
+
158
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
159
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
160
+ var ContextConsumer = REACT_CONTEXT_TYPE;
161
+ var ContextProvider = REACT_PROVIDER_TYPE;
162
+ var Element = REACT_ELEMENT_TYPE;
163
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
164
+ var Fragment = REACT_FRAGMENT_TYPE;
165
+ var Lazy = REACT_LAZY_TYPE;
166
+ var Memo = REACT_MEMO_TYPE;
167
+ var Portal = REACT_PORTAL_TYPE;
168
+ var Profiler = REACT_PROFILER_TYPE;
169
+ var StrictMode = REACT_STRICT_MODE_TYPE;
170
+ var Suspense = REACT_SUSPENSE_TYPE;
171
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
172
+
173
+ function isAsyncMode(object) {
174
+ {
175
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
176
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
177
+
178
+ 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.');
179
+ }
180
+ }
181
+
182
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
183
+ }
184
+ function isConcurrentMode(object) {
185
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
186
+ }
187
+ function isContextConsumer(object) {
188
+ return typeOf(object) === REACT_CONTEXT_TYPE;
189
+ }
190
+ function isContextProvider(object) {
191
+ return typeOf(object) === REACT_PROVIDER_TYPE;
192
+ }
193
+ function isElement(object) {
194
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
195
+ }
196
+ function isForwardRef(object) {
197
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
198
+ }
199
+ function isFragment(object) {
200
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
201
+ }
202
+ function isLazy(object) {
203
+ return typeOf(object) === REACT_LAZY_TYPE;
204
+ }
205
+ function isMemo(object) {
206
+ return typeOf(object) === REACT_MEMO_TYPE;
207
+ }
208
+ function isPortal(object) {
209
+ return typeOf(object) === REACT_PORTAL_TYPE;
210
+ }
211
+ function isProfiler(object) {
212
+ return typeOf(object) === REACT_PROFILER_TYPE;
213
+ }
214
+ function isStrictMode(object) {
215
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
216
+ }
217
+ function isSuspense(object) {
218
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
219
+ }
220
+
221
+ reactIs_development.AsyncMode = AsyncMode;
222
+ reactIs_development.ConcurrentMode = ConcurrentMode;
223
+ reactIs_development.ContextConsumer = ContextConsumer;
224
+ reactIs_development.ContextProvider = ContextProvider;
225
+ reactIs_development.Element = Element;
226
+ reactIs_development.ForwardRef = ForwardRef;
227
+ reactIs_development.Fragment = Fragment;
228
+ reactIs_development.Lazy = Lazy;
229
+ reactIs_development.Memo = Memo;
230
+ reactIs_development.Portal = Portal;
231
+ reactIs_development.Profiler = Profiler;
232
+ reactIs_development.StrictMode = StrictMode;
233
+ reactIs_development.Suspense = Suspense;
234
+ reactIs_development.isAsyncMode = isAsyncMode;
235
+ reactIs_development.isConcurrentMode = isConcurrentMode;
236
+ reactIs_development.isContextConsumer = isContextConsumer;
237
+ reactIs_development.isContextProvider = isContextProvider;
238
+ reactIs_development.isElement = isElement;
239
+ reactIs_development.isForwardRef = isForwardRef;
240
+ reactIs_development.isFragment = isFragment;
241
+ reactIs_development.isLazy = isLazy;
242
+ reactIs_development.isMemo = isMemo;
243
+ reactIs_development.isPortal = isPortal;
244
+ reactIs_development.isProfiler = isProfiler;
245
+ reactIs_development.isStrictMode = isStrictMode;
246
+ reactIs_development.isSuspense = isSuspense;
247
+ reactIs_development.isValidElementType = isValidElementType;
248
+ reactIs_development.typeOf = typeOf;
249
+ })();
250
+ }
251
+
252
+ if (process.env.NODE_ENV === 'production') {
253
+ reactIs.exports = reactIs_production_min;
254
+ } else {
255
+ reactIs.exports = reactIs_development;
256
+ }
257
+
258
+ /*
259
+ object-assign
260
+ (c) Sindre Sorhus
261
+ @license MIT
262
+ */
263
+ /* eslint-disable no-unused-vars */
264
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
265
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
266
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
267
+
268
+ function toObject(val) {
269
+ if (val === null || val === undefined) {
270
+ throw new TypeError('Object.assign cannot be called with null or undefined');
271
+ }
272
+
273
+ return Object(val);
274
+ }
275
+
276
+ function shouldUseNative() {
277
+ try {
278
+ if (!Object.assign) {
279
+ return false;
280
+ }
281
+
282
+ // Detect buggy property enumeration order in older V8 versions.
283
+
284
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
285
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
286
+ test1[5] = 'de';
287
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
288
+ return false;
289
+ }
290
+
291
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
292
+ var test2 = {};
293
+ for (var i = 0; i < 10; i++) {
294
+ test2['_' + String.fromCharCode(i)] = i;
295
+ }
296
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
297
+ return test2[n];
298
+ });
299
+ if (order2.join('') !== '0123456789') {
300
+ return false;
301
+ }
302
+
303
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
304
+ var test3 = {};
305
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
306
+ test3[letter] = letter;
307
+ });
308
+ if (Object.keys(Object.assign({}, test3)).join('') !==
309
+ 'abcdefghijklmnopqrst') {
310
+ return false;
311
+ }
312
+
313
+ return true;
314
+ } catch (err) {
315
+ // We don't expect any of the above to throw, but better to be safe.
316
+ return false;
317
+ }
318
+ }
319
+
320
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
321
+ var from;
322
+ var to = toObject(target);
323
+ var symbols;
324
+
325
+ for (var s = 1; s < arguments.length; s++) {
326
+ from = Object(arguments[s]);
327
+
328
+ for (var key in from) {
329
+ if (hasOwnProperty.call(from, key)) {
330
+ to[key] = from[key];
331
+ }
332
+ }
333
+
334
+ if (getOwnPropertySymbols) {
335
+ symbols = getOwnPropertySymbols(from);
336
+ for (var i = 0; i < symbols.length; i++) {
337
+ if (propIsEnumerable.call(from, symbols[i])) {
338
+ to[symbols[i]] = from[symbols[i]];
339
+ }
340
+ }
341
+ }
342
+ }
343
+
344
+ return to;
345
+ };
346
+
347
+ /**
348
+ * Copyright (c) 2013-present, Facebook, Inc.
349
+ *
350
+ * This source code is licensed under the MIT license found in the
351
+ * LICENSE file in the root directory of this source tree.
352
+ */
353
+
354
+ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
355
+
356
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
357
+
358
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
359
+
360
+ /**
361
+ * Copyright (c) 2013-present, Facebook, Inc.
362
+ *
363
+ * This source code is licensed under the MIT license found in the
364
+ * LICENSE file in the root directory of this source tree.
365
+ */
366
+
367
+ var printWarning$1 = function() {};
368
+
369
+ if (process.env.NODE_ENV !== 'production') {
370
+ var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
371
+ var loggedTypeFailures = {};
372
+ var has$1 = has$2;
373
+
374
+ printWarning$1 = function(text) {
375
+ var message = 'Warning: ' + text;
376
+ if (typeof console !== 'undefined') {
377
+ console.error(message);
378
+ }
379
+ try {
380
+ // --- Welcome to debugging React ---
381
+ // This error was thrown as a convenience so that you can use this stack
382
+ // to find the callsite that caused this warning to fire.
383
+ throw new Error(message);
384
+ } catch (x) { /**/ }
385
+ };
386
+ }
387
+
388
+ /**
389
+ * Assert that the values match with the type specs.
390
+ * Error messages are memorized and will only be shown once.
391
+ *
392
+ * @param {object} typeSpecs Map of name to a ReactPropType
393
+ * @param {object} values Runtime values that need to be type-checked
394
+ * @param {string} location e.g. "prop", "context", "child context"
395
+ * @param {string} componentName Name of the component for error messages.
396
+ * @param {?Function} getStack Returns the component stack.
397
+ * @private
398
+ */
399
+ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
400
+ if (process.env.NODE_ENV !== 'production') {
401
+ for (var typeSpecName in typeSpecs) {
402
+ if (has$1(typeSpecs, typeSpecName)) {
403
+ var error;
404
+ // Prop type validation may throw. In case they do, we don't want to
405
+ // fail the render phase where it didn't fail before. So we log it.
406
+ // After these have been cleaned up, we'll let them throw.
407
+ try {
408
+ // This is intentionally an invariant that gets caught. It's the same
409
+ // behavior as without this statement except with a better message.
410
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
411
+ var err = Error(
412
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
413
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
414
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
415
+ );
416
+ err.name = 'Invariant Violation';
417
+ throw err;
418
+ }
419
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
420
+ } catch (ex) {
421
+ error = ex;
422
+ }
423
+ if (error && !(error instanceof Error)) {
424
+ printWarning$1(
425
+ (componentName || 'React class') + ': type specification of ' +
426
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
427
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
428
+ 'You may have forgotten to pass an argument to the type checker ' +
429
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
430
+ 'shape all require an argument).'
431
+ );
432
+ }
433
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
434
+ // Only monitor this failure once because there tends to be a lot of the
435
+ // same error.
436
+ loggedTypeFailures[error.message] = true;
437
+
438
+ var stack = getStack ? getStack() : '';
439
+
440
+ printWarning$1(
441
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
442
+ );
443
+ }
444
+ }
445
+ }
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Resets warning cache when testing.
451
+ *
452
+ * @private
453
+ */
454
+ checkPropTypes$1.resetWarningCache = function() {
455
+ if (process.env.NODE_ENV !== 'production') {
456
+ loggedTypeFailures = {};
457
+ }
458
+ };
459
+
460
+ var checkPropTypes_1 = checkPropTypes$1;
461
+
462
+ /**
463
+ * Copyright (c) 2013-present, Facebook, Inc.
464
+ *
465
+ * This source code is licensed under the MIT license found in the
466
+ * LICENSE file in the root directory of this source tree.
467
+ */
468
+
469
+ var ReactIs$1 = reactIs.exports;
470
+ var assign = objectAssign;
471
+
472
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
473
+ var has = has$2;
474
+ var checkPropTypes = checkPropTypes_1;
475
+
476
+ var printWarning = function() {};
477
+
478
+ if (process.env.NODE_ENV !== 'production') {
479
+ printWarning = function(text) {
480
+ var message = 'Warning: ' + text;
481
+ if (typeof console !== 'undefined') {
482
+ console.error(message);
483
+ }
484
+ try {
485
+ // --- Welcome to debugging React ---
486
+ // This error was thrown as a convenience so that you can use this stack
487
+ // to find the callsite that caused this warning to fire.
488
+ throw new Error(message);
489
+ } catch (x) {}
490
+ };
491
+ }
492
+
493
+ function emptyFunctionThatReturnsNull() {
494
+ return null;
495
+ }
496
+
497
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
498
+ /* global Symbol */
499
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
500
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
501
+
502
+ /**
503
+ * Returns the iterator method function contained on the iterable object.
504
+ *
505
+ * Be sure to invoke the function with the iterable as context:
506
+ *
507
+ * var iteratorFn = getIteratorFn(myIterable);
508
+ * if (iteratorFn) {
509
+ * var iterator = iteratorFn.call(myIterable);
510
+ * ...
511
+ * }
512
+ *
513
+ * @param {?object} maybeIterable
514
+ * @return {?function}
515
+ */
516
+ function getIteratorFn(maybeIterable) {
517
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
518
+ if (typeof iteratorFn === 'function') {
519
+ return iteratorFn;
520
+ }
521
+ }
522
+
523
+ /**
524
+ * Collection of methods that allow declaration and validation of props that are
525
+ * supplied to React components. Example usage:
526
+ *
527
+ * var Props = require('ReactPropTypes');
528
+ * var MyArticle = React.createClass({
529
+ * propTypes: {
530
+ * // An optional string prop named "description".
531
+ * description: Props.string,
532
+ *
533
+ * // A required enum prop named "category".
534
+ * category: Props.oneOf(['News','Photos']).isRequired,
535
+ *
536
+ * // A prop named "dialog" that requires an instance of Dialog.
537
+ * dialog: Props.instanceOf(Dialog).isRequired
538
+ * },
539
+ * render: function() { ... }
540
+ * });
541
+ *
542
+ * A more formal specification of how these methods are used:
543
+ *
544
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
545
+ * decl := ReactPropTypes.{type}(.isRequired)?
546
+ *
547
+ * Each and every declaration produces a function with the same signature. This
548
+ * allows the creation of custom validation functions. For example:
549
+ *
550
+ * var MyLink = React.createClass({
551
+ * propTypes: {
552
+ * // An optional string or URI prop named "href".
553
+ * href: function(props, propName, componentName) {
554
+ * var propValue = props[propName];
555
+ * if (propValue != null && typeof propValue !== 'string' &&
556
+ * !(propValue instanceof URI)) {
557
+ * return new Error(
558
+ * 'Expected a string or an URI for ' + propName + ' in ' +
559
+ * componentName
560
+ * );
561
+ * }
562
+ * }
563
+ * },
564
+ * render: function() {...}
565
+ * });
566
+ *
567
+ * @internal
568
+ */
569
+
570
+ var ANONYMOUS = '<<anonymous>>';
571
+
572
+ // Important!
573
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
574
+ var ReactPropTypes = {
575
+ array: createPrimitiveTypeChecker('array'),
576
+ bigint: createPrimitiveTypeChecker('bigint'),
577
+ bool: createPrimitiveTypeChecker('boolean'),
578
+ func: createPrimitiveTypeChecker('function'),
579
+ number: createPrimitiveTypeChecker('number'),
580
+ object: createPrimitiveTypeChecker('object'),
581
+ string: createPrimitiveTypeChecker('string'),
582
+ symbol: createPrimitiveTypeChecker('symbol'),
583
+
584
+ any: createAnyTypeChecker(),
585
+ arrayOf: createArrayOfTypeChecker,
586
+ element: createElementTypeChecker(),
587
+ elementType: createElementTypeTypeChecker(),
588
+ instanceOf: createInstanceTypeChecker,
589
+ node: createNodeChecker(),
590
+ objectOf: createObjectOfTypeChecker,
591
+ oneOf: createEnumTypeChecker,
592
+ oneOfType: createUnionTypeChecker,
593
+ shape: createShapeTypeChecker,
594
+ exact: createStrictShapeTypeChecker,
595
+ };
596
+
597
+ /**
598
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
599
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
600
+ */
601
+ /*eslint-disable no-self-compare*/
602
+ function is(x, y) {
603
+ // SameValue algorithm
604
+ if (x === y) {
605
+ // Steps 1-5, 7-10
606
+ // Steps 6.b-6.e: +0 != -0
607
+ return x !== 0 || 1 / x === 1 / y;
608
+ } else {
609
+ // Step 6.a: NaN == NaN
610
+ return x !== x && y !== y;
611
+ }
612
+ }
613
+ /*eslint-enable no-self-compare*/
614
+
615
+ /**
616
+ * We use an Error-like object for backward compatibility as people may call
617
+ * PropTypes directly and inspect their output. However, we don't use real
618
+ * Errors anymore. We don't inspect their stack anyway, and creating them
619
+ * is prohibitively expensive if they are created too often, such as what
620
+ * happens in oneOfType() for any type before the one that matched.
621
+ */
622
+ function PropTypeError(message, data) {
623
+ this.message = message;
624
+ this.data = data && typeof data === 'object' ? data: {};
625
+ this.stack = '';
626
+ }
627
+ // Make `instanceof Error` still work for returned errors.
628
+ PropTypeError.prototype = Error.prototype;
629
+
630
+ function createChainableTypeChecker(validate) {
631
+ if (process.env.NODE_ENV !== 'production') {
632
+ var manualPropTypeCallCache = {};
633
+ var manualPropTypeWarningCount = 0;
634
+ }
635
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
636
+ componentName = componentName || ANONYMOUS;
637
+ propFullName = propFullName || propName;
638
+
639
+ if (secret !== ReactPropTypesSecret$1) {
640
+ if (throwOnDirectAccess) {
641
+ // New behavior only for users of `prop-types` package
642
+ var err = new Error(
643
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
644
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
645
+ 'Read more at http://fb.me/use-check-prop-types'
646
+ );
647
+ err.name = 'Invariant Violation';
648
+ throw err;
649
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
650
+ // Old behavior for people using React.PropTypes
651
+ var cacheKey = componentName + ':' + propName;
652
+ if (
653
+ !manualPropTypeCallCache[cacheKey] &&
654
+ // Avoid spamming the console because they are often not actionable except for lib authors
655
+ manualPropTypeWarningCount < 3
656
+ ) {
657
+ printWarning(
658
+ 'You are manually calling a React.PropTypes validation ' +
659
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
660
+ 'and will throw in the standalone `prop-types` package. ' +
661
+ 'You may be seeing this warning due to a third-party PropTypes ' +
662
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
663
+ );
664
+ manualPropTypeCallCache[cacheKey] = true;
665
+ manualPropTypeWarningCount++;
666
+ }
667
+ }
668
+ }
669
+ if (props[propName] == null) {
670
+ if (isRequired) {
671
+ if (props[propName] === null) {
672
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
673
+ }
674
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
675
+ }
676
+ return null;
677
+ } else {
678
+ return validate(props, propName, componentName, location, propFullName);
679
+ }
680
+ }
681
+
682
+ var chainedCheckType = checkType.bind(null, false);
683
+ chainedCheckType.isRequired = checkType.bind(null, true);
684
+
685
+ return chainedCheckType;
686
+ }
687
+
688
+ function createPrimitiveTypeChecker(expectedType) {
689
+ function validate(props, propName, componentName, location, propFullName, secret) {
690
+ var propValue = props[propName];
691
+ var propType = getPropType(propValue);
692
+ if (propType !== expectedType) {
693
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
694
+ // check, but we can offer a more precise error message here rather than
695
+ // 'of type `object`'.
696
+ var preciseType = getPreciseType(propValue);
697
+
698
+ return new PropTypeError(
699
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
700
+ {expectedType: expectedType}
701
+ );
702
+ }
703
+ return null;
704
+ }
705
+ return createChainableTypeChecker(validate);
706
+ }
707
+
708
+ function createAnyTypeChecker() {
709
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
710
+ }
711
+
712
+ function createArrayOfTypeChecker(typeChecker) {
713
+ function validate(props, propName, componentName, location, propFullName) {
714
+ if (typeof typeChecker !== 'function') {
715
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
716
+ }
717
+ var propValue = props[propName];
718
+ if (!Array.isArray(propValue)) {
719
+ var propType = getPropType(propValue);
720
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
721
+ }
722
+ for (var i = 0; i < propValue.length; i++) {
723
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
724
+ if (error instanceof Error) {
725
+ return error;
726
+ }
727
+ }
728
+ return null;
729
+ }
730
+ return createChainableTypeChecker(validate);
731
+ }
732
+
733
+ function createElementTypeChecker() {
734
+ function validate(props, propName, componentName, location, propFullName) {
735
+ var propValue = props[propName];
736
+ if (!isValidElement(propValue)) {
737
+ var propType = getPropType(propValue);
738
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
739
+ }
740
+ return null;
741
+ }
742
+ return createChainableTypeChecker(validate);
743
+ }
744
+
745
+ function createElementTypeTypeChecker() {
746
+ function validate(props, propName, componentName, location, propFullName) {
747
+ var propValue = props[propName];
748
+ if (!ReactIs$1.isValidElementType(propValue)) {
749
+ var propType = getPropType(propValue);
750
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
751
+ }
752
+ return null;
753
+ }
754
+ return createChainableTypeChecker(validate);
755
+ }
756
+
757
+ function createInstanceTypeChecker(expectedClass) {
758
+ function validate(props, propName, componentName, location, propFullName) {
759
+ if (!(props[propName] instanceof expectedClass)) {
760
+ var expectedClassName = expectedClass.name || ANONYMOUS;
761
+ var actualClassName = getClassName(props[propName]);
762
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
763
+ }
764
+ return null;
765
+ }
766
+ return createChainableTypeChecker(validate);
767
+ }
768
+
769
+ function createEnumTypeChecker(expectedValues) {
770
+ if (!Array.isArray(expectedValues)) {
771
+ if (process.env.NODE_ENV !== 'production') {
772
+ if (arguments.length > 1) {
773
+ printWarning(
774
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
775
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
776
+ );
777
+ } else {
778
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
779
+ }
780
+ }
781
+ return emptyFunctionThatReturnsNull;
782
+ }
783
+
784
+ function validate(props, propName, componentName, location, propFullName) {
785
+ var propValue = props[propName];
786
+ for (var i = 0; i < expectedValues.length; i++) {
787
+ if (is(propValue, expectedValues[i])) {
788
+ return null;
789
+ }
790
+ }
791
+
792
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
793
+ var type = getPreciseType(value);
794
+ if (type === 'symbol') {
795
+ return String(value);
796
+ }
797
+ return value;
798
+ });
799
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
800
+ }
801
+ return createChainableTypeChecker(validate);
802
+ }
803
+
804
+ function createObjectOfTypeChecker(typeChecker) {
805
+ function validate(props, propName, componentName, location, propFullName) {
806
+ if (typeof typeChecker !== 'function') {
807
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
808
+ }
809
+ var propValue = props[propName];
810
+ var propType = getPropType(propValue);
811
+ if (propType !== 'object') {
812
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
813
+ }
814
+ for (var key in propValue) {
815
+ if (has(propValue, key)) {
816
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
817
+ if (error instanceof Error) {
818
+ return error;
819
+ }
820
+ }
821
+ }
822
+ return null;
823
+ }
824
+ return createChainableTypeChecker(validate);
825
+ }
826
+
827
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
828
+ if (!Array.isArray(arrayOfTypeCheckers)) {
829
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
830
+ return emptyFunctionThatReturnsNull;
831
+ }
832
+
833
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
834
+ var checker = arrayOfTypeCheckers[i];
835
+ if (typeof checker !== 'function') {
836
+ printWarning(
837
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
838
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
839
+ );
840
+ return emptyFunctionThatReturnsNull;
841
+ }
842
+ }
843
+
844
+ function validate(props, propName, componentName, location, propFullName) {
845
+ var expectedTypes = [];
846
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
847
+ var checker = arrayOfTypeCheckers[i];
848
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
849
+ if (checkerResult == null) {
850
+ return null;
851
+ }
852
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
853
+ expectedTypes.push(checkerResult.data.expectedType);
854
+ }
855
+ }
856
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
857
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
858
+ }
859
+ return createChainableTypeChecker(validate);
860
+ }
861
+
862
+ function createNodeChecker() {
863
+ function validate(props, propName, componentName, location, propFullName) {
864
+ if (!isNode(props[propName])) {
865
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
866
+ }
867
+ return null;
868
+ }
869
+ return createChainableTypeChecker(validate);
870
+ }
871
+
872
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
873
+ return new PropTypeError(
874
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
875
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
876
+ );
877
+ }
878
+
879
+ function createShapeTypeChecker(shapeTypes) {
880
+ function validate(props, propName, componentName, location, propFullName) {
881
+ var propValue = props[propName];
882
+ var propType = getPropType(propValue);
883
+ if (propType !== 'object') {
884
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
885
+ }
886
+ for (var key in shapeTypes) {
887
+ var checker = shapeTypes[key];
888
+ if (typeof checker !== 'function') {
889
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
890
+ }
891
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
892
+ if (error) {
893
+ return error;
894
+ }
895
+ }
896
+ return null;
897
+ }
898
+ return createChainableTypeChecker(validate);
899
+ }
900
+
901
+ function createStrictShapeTypeChecker(shapeTypes) {
902
+ function validate(props, propName, componentName, location, propFullName) {
903
+ var propValue = props[propName];
904
+ var propType = getPropType(propValue);
905
+ if (propType !== 'object') {
906
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
907
+ }
908
+ // We need to check all keys in case some are required but missing from props.
909
+ var allKeys = assign({}, props[propName], shapeTypes);
910
+ for (var key in allKeys) {
911
+ var checker = shapeTypes[key];
912
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
913
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
914
+ }
915
+ if (!checker) {
916
+ return new PropTypeError(
917
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
918
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
919
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
920
+ );
921
+ }
922
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
923
+ if (error) {
924
+ return error;
925
+ }
926
+ }
927
+ return null;
928
+ }
929
+
930
+ return createChainableTypeChecker(validate);
931
+ }
932
+
933
+ function isNode(propValue) {
934
+ switch (typeof propValue) {
935
+ case 'number':
936
+ case 'string':
937
+ case 'undefined':
938
+ return true;
939
+ case 'boolean':
940
+ return !propValue;
941
+ case 'object':
942
+ if (Array.isArray(propValue)) {
943
+ return propValue.every(isNode);
944
+ }
945
+ if (propValue === null || isValidElement(propValue)) {
946
+ return true;
947
+ }
948
+
949
+ var iteratorFn = getIteratorFn(propValue);
950
+ if (iteratorFn) {
951
+ var iterator = iteratorFn.call(propValue);
952
+ var step;
953
+ if (iteratorFn !== propValue.entries) {
954
+ while (!(step = iterator.next()).done) {
955
+ if (!isNode(step.value)) {
956
+ return false;
957
+ }
958
+ }
959
+ } else {
960
+ // Iterator will provide entry [k,v] tuples rather than values.
961
+ while (!(step = iterator.next()).done) {
962
+ var entry = step.value;
963
+ if (entry) {
964
+ if (!isNode(entry[1])) {
965
+ return false;
966
+ }
967
+ }
968
+ }
969
+ }
970
+ } else {
971
+ return false;
972
+ }
973
+
974
+ return true;
975
+ default:
976
+ return false;
977
+ }
978
+ }
979
+
980
+ function isSymbol(propType, propValue) {
981
+ // Native Symbol.
982
+ if (propType === 'symbol') {
983
+ return true;
984
+ }
985
+
986
+ // falsy value can't be a Symbol
987
+ if (!propValue) {
988
+ return false;
989
+ }
990
+
991
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
992
+ if (propValue['@@toStringTag'] === 'Symbol') {
993
+ return true;
994
+ }
995
+
996
+ // Fallback for non-spec compliant Symbols which are polyfilled.
997
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
998
+ return true;
999
+ }
1000
+
1001
+ return false;
1002
+ }
1003
+
1004
+ // Equivalent of `typeof` but with special handling for array and regexp.
1005
+ function getPropType(propValue) {
1006
+ var propType = typeof propValue;
1007
+ if (Array.isArray(propValue)) {
1008
+ return 'array';
1009
+ }
1010
+ if (propValue instanceof RegExp) {
1011
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1012
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1013
+ // passes PropTypes.object.
1014
+ return 'object';
1015
+ }
1016
+ if (isSymbol(propType, propValue)) {
1017
+ return 'symbol';
1018
+ }
1019
+ return propType;
1020
+ }
1021
+
1022
+ // This handles more types than `getPropType`. Only used for error messages.
1023
+ // See `createPrimitiveTypeChecker`.
1024
+ function getPreciseType(propValue) {
1025
+ if (typeof propValue === 'undefined' || propValue === null) {
1026
+ return '' + propValue;
1027
+ }
1028
+ var propType = getPropType(propValue);
1029
+ if (propType === 'object') {
1030
+ if (propValue instanceof Date) {
1031
+ return 'date';
1032
+ } else if (propValue instanceof RegExp) {
1033
+ return 'regexp';
1034
+ }
1035
+ }
1036
+ return propType;
1037
+ }
1038
+
1039
+ // Returns a string that is postfixed to a warning about an invalid type.
1040
+ // For example, "undefined" or "of type array"
1041
+ function getPostfixForTypeWarning(value) {
1042
+ var type = getPreciseType(value);
1043
+ switch (type) {
1044
+ case 'array':
1045
+ case 'object':
1046
+ return 'an ' + type;
1047
+ case 'boolean':
1048
+ case 'date':
1049
+ case 'regexp':
1050
+ return 'a ' + type;
1051
+ default:
1052
+ return type;
1053
+ }
1054
+ }
1055
+
1056
+ // Returns class name of the object, if any.
1057
+ function getClassName(propValue) {
1058
+ if (!propValue.constructor || !propValue.constructor.name) {
1059
+ return ANONYMOUS;
1060
+ }
1061
+ return propValue.constructor.name;
1062
+ }
1063
+
1064
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1065
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1066
+ ReactPropTypes.PropTypes = ReactPropTypes;
1067
+
1068
+ return ReactPropTypes;
1069
+ };
1070
+
1071
+ /**
1072
+ * Copyright (c) 2013-present, Facebook, Inc.
1073
+ *
1074
+ * This source code is licensed under the MIT license found in the
1075
+ * LICENSE file in the root directory of this source tree.
1076
+ */
1077
+
1078
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
1079
+
1080
+ function emptyFunction() {}
1081
+ function emptyFunctionWithReset() {}
1082
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1083
+
1084
+ var factoryWithThrowingShims = function() {
1085
+ function shim(props, propName, componentName, location, propFullName, secret) {
1086
+ if (secret === ReactPropTypesSecret) {
1087
+ // It is still safe when called from React.
1088
+ return;
1089
+ }
1090
+ var err = new Error(
1091
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1092
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1093
+ 'Read more at http://fb.me/use-check-prop-types'
1094
+ );
1095
+ err.name = 'Invariant Violation';
1096
+ throw err;
1097
+ } shim.isRequired = shim;
1098
+ function getShim() {
1099
+ return shim;
1100
+ } // Important!
1101
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1102
+ var ReactPropTypes = {
1103
+ array: shim,
1104
+ bigint: shim,
1105
+ bool: shim,
1106
+ func: shim,
1107
+ number: shim,
1108
+ object: shim,
1109
+ string: shim,
1110
+ symbol: shim,
1111
+
1112
+ any: shim,
1113
+ arrayOf: getShim,
1114
+ element: shim,
1115
+ elementType: shim,
1116
+ instanceOf: getShim,
1117
+ node: shim,
1118
+ objectOf: getShim,
1119
+ oneOf: getShim,
1120
+ oneOfType: getShim,
1121
+ shape: getShim,
1122
+ exact: getShim,
1123
+
1124
+ checkPropTypes: emptyFunctionWithReset,
1125
+ resetWarningCache: emptyFunction
1126
+ };
1127
+
1128
+ ReactPropTypes.PropTypes = ReactPropTypes;
1129
+
1130
+ return ReactPropTypes;
1131
+ };
1132
+
1133
+ /**
1134
+ * Copyright (c) 2013-present, Facebook, Inc.
1135
+ *
1136
+ * This source code is licensed under the MIT license found in the
1137
+ * LICENSE file in the root directory of this source tree.
1138
+ */
1139
+
1140
+ if (process.env.NODE_ENV !== 'production') {
1141
+ var ReactIs = reactIs.exports;
1142
+
1143
+ // By explicitly using `prop-types` you are opting into new development behavior.
1144
+ // http://fb.me/prop-types-in-prod
1145
+ var throwOnDirectAccess = true;
1146
+ propTypes$5.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
1147
+ } else {
1148
+ // By explicitly using `prop-types` you are opting into new production behavior.
1149
+ // http://fb.me/prop-types-in-prod
1150
+ propTypes$5.exports = factoryWithThrowingShims();
1151
+ }
1152
+
1153
+ var PropTypes = propTypes$5.exports;
1154
+
1155
+ var uuidv4 = function uuidv4() {
1156
+ return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
1157
+ return (// eslint-disable-next-line
1158
+ (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
1159
+ );
1160
+ });
1161
+ };
1162
+
1163
+ var ENTITY_TYPES = {
1164
+ ITEM: 'item',
1165
+ COLLECTION: 'collection',
1166
+ LIBRARY: 'library'
1167
+ };
1168
+
1169
+ var _excluded$8 = ["className", "classes", "mimeType", "audioIcon", "videoIcon", "imageIcon", "fileIcon", "placeholderIcon"];
1170
+
1171
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1172
+
1173
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1174
+ var AUDIO_MIMETYPE_PREFIX = 'audio';
1175
+ var VIDEO_MIMETYPE_PREFIX = 'video';
1176
+ var IMAGE_MIMETYPE_PREFIX = 'image';
1177
+ var styles$7 = function styles() {
1178
+ return {
1179
+ root: {}
1180
+ };
1181
+ };
1182
+ function MimeTypeIcon(_ref) {
1183
+ var className = _ref.className,
1184
+ classes = _ref.classes,
1185
+ mimeType = _ref.mimeType,
1186
+ audioIcon = _ref.audioIcon,
1187
+ videoIcon = _ref.videoIcon,
1188
+ imageIcon = _ref.imageIcon,
1189
+ fileIcon = _ref.fileIcon,
1190
+ placeholderIcon = _ref.placeholderIcon,
1191
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$8);
1192
+
1193
+ var IconComponent = placeholderIcon;
1194
+
1195
+ if (mimeType && typeof mimeType === 'string') {
1196
+ if (mimeType.toLowerCase().startsWith(AUDIO_MIMETYPE_PREFIX)) IconComponent = audioIcon;else if (mimeType.toLowerCase().startsWith(VIDEO_MIMETYPE_PREFIX)) IconComponent = videoIcon;else if (mimeType.toLowerCase().startsWith(IMAGE_MIMETYPE_PREFIX)) IconComponent = imageIcon;else {
1197
+ IconComponent = fileIcon;
1198
+ }
1199
+ }
1200
+
1201
+ return /*#__PURE__*/jsxRuntime.jsx(IconComponent, _objectSpread$8({
1202
+ className: clsx__default["default"](className, classes.root, 'VdtMimeTypeIcon-root')
1203
+ }, props));
1204
+ }
1205
+ MimeTypeIcon.propTypes = {
1206
+ /**
1207
+ * Override styles with className
1208
+ */
1209
+ className: PropTypes.string,
1210
+
1211
+ /**
1212
+ * Override or extend the styles applied to the component
1213
+ */
1214
+ classes: PropTypes.instanceOf(Object),
1215
+
1216
+ /**
1217
+ *
1218
+ * `fileIcon` is shown if mimetype is not any beginning with [`audio`, `video`, `image`]
1219
+ */
1220
+ mimeType: PropTypes.string,
1221
+
1222
+ /**
1223
+ * Audio icon
1224
+ */
1225
+ audioIcon: PropTypes.elementType,
1226
+
1227
+ /**
1228
+ * Video icon
1229
+ */
1230
+ videoIcon: PropTypes.elementType,
1231
+
1232
+ /**
1233
+ * Image icon
1234
+ */
1235
+ imageIcon: PropTypes.elementType,
1236
+
1237
+ /**
1238
+ * File icon - shown if mimetype is not any of `audio`, `video` or `image`
1239
+ */
1240
+ fileIcon: PropTypes.elementType,
1241
+
1242
+ /**
1243
+ * Placeholder icon - shown if mimetype is undefined or not a string
1244
+ */
1245
+ placeholderIcon: PropTypes.elementType
1246
+ };
1247
+ MimeTypeIcon.defaultProps = {
1248
+ className: undefined,
1249
+ classes: {},
1250
+ mimeType: undefined,
1251
+ audioIcon: AudioTrackIcon__default["default"],
1252
+ videoIcon: MovieIcon__default["default"],
1253
+ imageIcon: ImageIcon__default["default"],
1254
+ fileIcon: InsertDriveFileIcon__default["default"],
1255
+ placeholderIcon: NoteAddIcon__default["default"]
1256
+ };
1257
+
1258
+ var Component$7 = styles$8.withStyles(styles$7, {
1259
+ name: 'VdtMimeTypeIcon'
1260
+ })(MimeTypeIcon);
1261
+ Component$7.displayName = 'MimeTypeIcon';
1262
+
1263
+ var _excluded$7 = ["mediaType"],
1264
+ _excluded2 = ["className", "classes", "entityType", "mediaType", "itemIcon", "collectionIcon", "libraryIcon", "libraryAudioIcon", "libraryVideoIcon", "libraryImageIcon", "placeholderIcon", "MediaTypeComponent", "MediaTypeProps"];
1265
+
1266
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1267
+
1268
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1269
+ var ITEM = 'item';
1270
+ var COLLECTION = 'collection';
1271
+ var LIBRARY = 'library';
1272
+
1273
+ function MediaTypeIcon(_ref) {
1274
+ var mediaType = _ref.mediaType,
1275
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$7);
1276
+
1277
+ return /*#__PURE__*/jsxRuntime.jsx(Component$7, _objectSpread$7({
1278
+ mimeType: mediaType
1279
+ }, props));
1280
+ }
1281
+
1282
+ var styles$6 = function styles() {
1283
+ return {
1284
+ root: {},
1285
+ mediaType: {}
1286
+ };
1287
+ };
1288
+ function EntityIcon(_ref2) {
1289
+ var className = _ref2.className,
1290
+ classes = _ref2.classes,
1291
+ entityType = _ref2.entityType,
1292
+ mediaType = _ref2.mediaType,
1293
+ itemIcon = _ref2.itemIcon,
1294
+ collectionIcon = _ref2.collectionIcon,
1295
+ libraryIcon = _ref2.libraryIcon,
1296
+ libraryAudioIcon = _ref2.libraryAudioIcon,
1297
+ libraryVideoIcon = _ref2.libraryVideoIcon,
1298
+ libraryImageIcon = _ref2.libraryImageIcon,
1299
+ placeholderIcon = _ref2.placeholderIcon,
1300
+ MediaTypeComponent = _ref2.MediaTypeComponent,
1301
+ MediaTypeProps = _ref2.MediaTypeProps,
1302
+ props = _objectWithoutProperties__default["default"](_ref2, _excluded2);
1303
+
1304
+ var IconComponent = placeholderIcon;
1305
+
1306
+ if (entityType && typeof entityType === 'string') {
1307
+ switch (entityType.toLowerCase()) {
1308
+ case ITEM:
1309
+ {
1310
+ IconComponent = itemIcon;
1311
+
1312
+ if (mediaType && typeof mediaType === 'string') {
1313
+ IconComponent = /*#__PURE__*/react.memo(function (iconProps) {
1314
+ return /*#__PURE__*/jsxRuntime.jsx(MediaTypeComponent, _objectSpread$7(_objectSpread$7({
1315
+ className: clsx__default["default"](classes.mediaType, 'VdtEntityIcon-mediaType'),
1316
+ mediaType: mediaType
1317
+ }, MediaTypeProps), iconProps));
1318
+ }, [mediaType, MediaTypeProps]);
1319
+ }
1320
+
1321
+ break;
1322
+ }
1323
+
1324
+ case COLLECTION:
1325
+ {
1326
+ IconComponent = collectionIcon;
1327
+ break;
1328
+ }
1329
+
1330
+ case LIBRARY:
1331
+ {
1332
+ IconComponent = libraryIcon;
1333
+
1334
+ if (mediaType && typeof mediaType === 'string') {
1335
+ var mediaTypeLowerCase = mediaType.toLowerCase();
1336
+ if (mediaTypeLowerCase === 'audio') IconComponent = libraryAudioIcon;else if (mediaTypeLowerCase === 'video') IconComponent = libraryVideoIcon;else if (mediaTypeLowerCase === 'image') IconComponent = libraryImageIcon;
1337
+ }
1338
+
1339
+ break;
1340
+ }
1341
+ }
1342
+ }
1343
+
1344
+ return /*#__PURE__*/jsxRuntime.jsx(IconComponent, _objectSpread$7({
1345
+ className: clsx__default["default"](className, classes.root, 'VdtEntityIcon-root')
1346
+ }, props));
1347
+ }
1348
+ EntityIcon.propTypes = {
1349
+ /**
1350
+ * Override styles with className
1351
+ */
1352
+ className: PropTypes.string,
1353
+
1354
+ /**
1355
+ * Override or extend the styles applied to the component
1356
+ */
1357
+ classes: PropTypes.instanceOf(Object),
1358
+
1359
+ /**
1360
+ * `placeholderIcon` is shown if entityType is undefined or not a string
1361
+ */
1362
+ entityType: PropTypes.oneOf(['item', 'collection', 'library']),
1363
+
1364
+ /**
1365
+ * Optional, use mediaType icon for item and library
1366
+ */
1367
+ mediaType: PropTypes.oneOf(['audio', 'video', 'image']),
1368
+
1369
+ /**
1370
+ * Icon for item (if not using `mediaType`)
1371
+ */
1372
+ itemIcon: PropTypes.elementType,
1373
+
1374
+ /**
1375
+ * Icon for collection
1376
+ */
1377
+ collectionIcon: PropTypes.elementType,
1378
+
1379
+ /**
1380
+ * Icon for library
1381
+ */
1382
+ libraryIcon: PropTypes.elementType,
1383
+
1384
+ /**
1385
+ * Icon for library with mediaType audio
1386
+ */
1387
+ libraryAudioIcon: PropTypes.elementType,
1388
+
1389
+ /**
1390
+ * Icon for library with mediaType video
1391
+ */
1392
+ libraryVideoIcon: PropTypes.elementType,
1393
+
1394
+ /**
1395
+ * Icon for library with mediaType image
1396
+ */
1397
+ libraryImageIcon: PropTypes.elementType,
1398
+
1399
+ /**
1400
+ * Placeholder icon shown when entityType is undefined
1401
+ */
1402
+ placeholderIcon: PropTypes.elementType,
1403
+
1404
+ /**
1405
+ * MediaTypeComponent to use when mediaType is set
1406
+ */
1407
+ MediaTypeComponent: PropTypes.elementType,
1408
+
1409
+ /**
1410
+ * Props for MediaTypeComponent
1411
+ */
1412
+ MediaTypeProps: PropTypes.instanceOf(Object)
1413
+ };
1414
+ EntityIcon.defaultProps = {
1415
+ className: undefined,
1416
+ classes: {},
1417
+ entityType: undefined,
1418
+ mediaType: undefined,
1419
+ itemIcon: InsertDriveFileIcon__default["default"],
1420
+ collectionIcon: FolderIcon__default["default"],
1421
+ libraryIcon: LibraryBooksIcon__default["default"],
1422
+ libraryAudioIcon: LibraryMusicIcon__default["default"],
1423
+ libraryVideoIcon: VideoLibraryIcon__default["default"],
1424
+ libraryImageIcon: PhotoLibraryIcon__default["default"],
1425
+ placeholderIcon: NoteAddIcon__default["default"],
1426
+ MediaTypeComponent: MediaTypeIcon,
1427
+ MediaTypeProps: {}
1428
+ };
1429
+
1430
+ var Component$6 = styles$8.withStyles(styles$6, {
1431
+ name: 'VdtEntityIcon'
1432
+ })(EntityIcon);
1433
+ Component$6.displayName = 'EntityIcon';
1434
+
1435
+ var _excluded$6 = ["className", "classes", "isLoading", "entityType", "mediaType", "variant", "IconComponent", "IconProps", "SkeletonProps"];
1436
+
1437
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1438
+
1439
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1440
+ var styles$5 = function styles() {
1441
+ return {
1442
+ root: {
1443
+ transition: 'background-color .2s ease-out'
1444
+ },
1445
+ rootLoading: {
1446
+ backgroundColor: 'unset !important'
1447
+ },
1448
+ skeleton: {
1449
+ height: '100% !important',
1450
+ width: '100%'
1451
+ },
1452
+ icon: {}
1453
+ };
1454
+ };
1455
+ function EntityAvatar(_ref) {
1456
+ var className = _ref.className,
1457
+ classes = _ref.classes,
1458
+ isLoading = _ref.isLoading,
1459
+ entityType = _ref.entityType,
1460
+ mediaType = _ref.mediaType,
1461
+ variant = _ref.variant,
1462
+ IconComponent = _ref.IconComponent,
1463
+ _ref$IconProps = _ref.IconProps,
1464
+ IconProps = _ref$IconProps === void 0 ? {} : _ref$IconProps,
1465
+ _ref$SkeletonProps = _ref.SkeletonProps,
1466
+ SkeletonProps = _ref$SkeletonProps === void 0 ? {} : _ref$SkeletonProps,
1467
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$6);
1468
+
1469
+ return /*#__PURE__*/jsxRuntime.jsx(material.Avatar, _objectSpread$6(_objectSpread$6({
1470
+ className: clsx__default["default"](className, classes.root, 'VdtEntityAvatar-root', _defineProperty__default["default"]({}, classes.rootLoading, isLoading)),
1471
+ variant: variant
1472
+ }, props), {}, {
1473
+ children: isLoading ? /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, _objectSpread$6({
1474
+ className: clsx__default["default"](classes.skeleton, 'VdtEntityAvatar-skeleton'),
1475
+ variant: variant === 'square' ? 'rect' : variant,
1476
+ "data-testid": "skeleton"
1477
+ }, SkeletonProps)) : /*#__PURE__*/jsxRuntime.jsx(IconComponent, _objectSpread$6({
1478
+ className: clsx__default["default"](classes.icon, 'VdtEntityAvatar-icon'),
1479
+ entityType: entityType,
1480
+ mediaType: mediaType
1481
+ }, IconProps))
1482
+ }));
1483
+ }
1484
+ EntityAvatar.propTypes = {
1485
+ /**
1486
+ * Override styles with className
1487
+ */
1488
+ className: PropTypes.string,
1489
+
1490
+ /**
1491
+ * Override or extend the styles applied to the component
1492
+ */
1493
+ classes: PropTypes.instanceOf(Object),
1494
+
1495
+ /**
1496
+ * Variant/shapes for the Avatar
1497
+ */
1498
+ entityType: PropTypes.oneOf(['item', 'collection', 'library']),
1499
+
1500
+ /**
1501
+ * Optional, use mediaType icon for item and library
1502
+ */
1503
+ mediaType: PropTypes.oneOf(['audio', 'video', 'image']),
1504
+
1505
+ /**
1506
+ * Variant/shapes for the Avatar
1507
+ */
1508
+ variant: PropTypes.oneOf(['circular', 'rounded', 'square']),
1509
+
1510
+ /**
1511
+ * Show loading skeleton
1512
+ */
1513
+ isLoading: PropTypes.bool,
1514
+
1515
+ /**
1516
+ * IconComponent displayed inside Avatar
1517
+ */
1518
+ IconComponent: PropTypes.elementType,
1519
+
1520
+ /**
1521
+ * Props for IconComponent
1522
+ */
1523
+ IconProps: PropTypes.instanceOf(Object),
1524
+
1525
+ /**
1526
+ * Props for (MUI) Skeleton component
1527
+ */
1528
+ SkeletonProps: PropTypes.instanceOf(Object)
1529
+ };
1530
+ EntityAvatar.defaultProps = {
1531
+ className: undefined,
1532
+ classes: {},
1533
+ entityType: undefined,
1534
+ mediaType: undefined,
1535
+ variant: 'square',
1536
+ isLoading: false,
1537
+ IconComponent: Component$6,
1538
+ IconProps: {},
1539
+ SkeletonProps: {}
1540
+ };
1541
+
1542
+ var Component$5 = styles$8.withStyles(styles$5, {
1543
+ name: 'VdtEntityAvatar'
1544
+ })(EntityAvatar);
1545
+ Component$5.displayName = 'EntityAvatar';
1546
+
1547
+ var _excluded$5 = ["className", "classes", "collectionType", "onClick", "parseMetadataOptions", "primaryFieldName", "primaryFunction", "secondaryFieldName", "secondaryFunction", "isLoading", "AvatarComponent", "AvatarProps", "ActionComponent", "ActionProps"];
1548
+
1549
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1550
+
1551
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1552
+ var styles$4 = function styles() {
1553
+ return {
1554
+ root: {
1555
+ '&:hover .VdtCollectionListItem-secondaryAction': {
1556
+ visibility: 'visible'
1557
+ }
1558
+ },
1559
+ avatar: {},
1560
+ text: {},
1561
+ secondaryAction: {
1562
+ visibility: 'hidden'
1563
+ }
1564
+ };
1565
+ };
1566
+
1567
+ var getText$1 = function getText(fieldName, func, parsedMetadata, entityType, entityId) {
1568
+ if (func && typeof func === 'function') {
1569
+ return func(_objectSpread$5(_objectSpread$5({}, parsedMetadata), {}, {
1570
+ entityType: entityType,
1571
+ entityId: entityId
1572
+ }));
1573
+ }
1574
+
1575
+ if (fieldName) {
1576
+ return parsedMetadata[fieldName];
1577
+ }
1578
+
1579
+ return undefined;
1580
+ };
1581
+
1582
+ function CollectionListItem(_ref) {
1583
+ var className = _ref.className,
1584
+ classes = _ref.classes,
1585
+ collectionType = _ref.collectionType,
1586
+ onClick = _ref.onClick,
1587
+ parseMetadataOptions = _ref.parseMetadataOptions,
1588
+ primaryFieldName = _ref.primaryFieldName,
1589
+ primaryFunction = _ref.primaryFunction,
1590
+ secondaryFieldName = _ref.secondaryFieldName,
1591
+ secondaryFunction = _ref.secondaryFunction,
1592
+ isLoading = _ref.isLoading,
1593
+ AvatarComponent = _ref.AvatarComponent,
1594
+ AvatarProps = _ref.AvatarProps,
1595
+ ActionComponent = _ref.ActionComponent,
1596
+ ActionProps = _ref.ActionProps,
1597
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
1598
+
1599
+ var id = collectionType.id,
1600
+ metadataType = collectionType.metadata;
1601
+ var parsedMetadata = vdtJs.parseMetadataType(metadataType, parseMetadataOptions);
1602
+ var primaryText = react.useMemo(function () {
1603
+ return getText$1(primaryFieldName, primaryFunction, parsedMetadata, collectionType, id) || id;
1604
+ }, [primaryFieldName, primaryFunction, parsedMetadata, collectionType, id]);
1605
+ var secondaryText = react.useMemo(function () {
1606
+ return getText$1(secondaryFieldName, secondaryFunction, parsedMetadata, collectionType, id);
1607
+ }, [secondaryFieldName, secondaryFunction, parsedMetadata, collectionType, id]);
1608
+ return /*#__PURE__*/jsxRuntime.jsxs(material.ListItem, _objectSpread$5(_objectSpread$5({
1609
+ className: clsx__default["default"](className, classes.root, 'VdtCollectionListItem-root'),
1610
+ onClick: !isLoading && onClick ? function (event) {
1611
+ return onClick(collectionType, event);
1612
+ } : undefined,
1613
+ button: onClick ? true : undefined
1614
+ }, props), {}, {
1615
+ children: [AvatarComponent && /*#__PURE__*/jsxRuntime.jsx(material.ListItemAvatar, {
1616
+ className: clsx__default["default"](classes.avatar, 'VdtCollectionListItem-avatar'),
1617
+ children: /*#__PURE__*/jsxRuntime.jsx(AvatarComponent, _objectSpread$5({
1618
+ entityType: ENTITY_TYPES.COLLECTION,
1619
+ isLoading: isLoading
1620
+ }, AvatarProps))
1621
+ }), /*#__PURE__*/jsxRuntime.jsx(material.ListItemText, {
1622
+ className: clsx__default["default"](classes.text, 'VdtCollectionListItem-text'),
1623
+ primary: isLoading ? /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, {
1624
+ width: 120
1625
+ }) : primaryText,
1626
+ secondary: isLoading ? /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, {
1627
+ width: 60
1628
+ }) : secondaryText
1629
+ }), !!ActionComponent && !isLoading && /*#__PURE__*/jsxRuntime.jsx(material.ListItemSecondaryAction, {
1630
+ className: clsx__default["default"](classes.secondaryAction, 'VdtCollectionListItem-secondaryAction'),
1631
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionComponent, _objectSpread$5({
1632
+ collectionType: collectionType,
1633
+ isLoading: isLoading
1634
+ }, ActionProps))
1635
+ })]
1636
+ }));
1637
+ }
1638
+ var propTypes$4 = {
1639
+ /**
1640
+ * Override styles with className
1641
+ */
1642
+ className: PropTypes.string,
1643
+
1644
+ /**
1645
+ * Override or extend the styles applied to the component
1646
+ */
1647
+ classes: PropTypes.instanceOf(Object),
1648
+
1649
+ /**
1650
+ * The collectionType to display as a list item
1651
+ */
1652
+ collectionType: VidispinePropTypes__default["default"].CollectionType,
1653
+
1654
+ /**
1655
+ * Set primary text to value of entered metadata field name.
1656
+ *
1657
+ * _Not used if `primaryFunction` is added_
1658
+ */
1659
+ primaryFieldName: PropTypes.string,
1660
+
1661
+ /**
1662
+ * Extract primary text using function getting metadata values as props
1663
+ */
1664
+ primaryFunction: PropTypes.func,
1665
+
1666
+ /**
1667
+ * Set secondary text to value of entered metadata field name.
1668
+ *
1669
+ * _Not used if `secondaryFunction` is added_
1670
+ */
1671
+ secondaryFieldName: PropTypes.string,
1672
+
1673
+ /**
1674
+ * Select primary text using function getting metadata values as props
1675
+ */
1676
+ secondaryFunction: PropTypes.func,
1677
+
1678
+ /**
1679
+ Triggered when the list item is clicked
1680
+ */
1681
+ onClick: PropTypes.func,
1682
+
1683
+ /**
1684
+ Add an action component to put actions on the list item
1685
+ */
1686
+ ActionComponent: PropTypes.elementType,
1687
+
1688
+ /**
1689
+ Add props for the ActionComponent
1690
+ */
1691
+ ActionProps: PropTypes.instanceOf(Object),
1692
+
1693
+ /**
1694
+ Add an avatar component to put an avatar on the list item
1695
+ */
1696
+ AvatarComponent: PropTypes.elementType,
1697
+
1698
+ /**
1699
+ Add props for the AvatarComponent
1700
+ */
1701
+ AvatarProps: PropTypes.instanceOf(Object),
1702
+
1703
+ /**
1704
+ Pass in options for how to parse the list item metadata
1705
+ */
1706
+ parseMetadataOptions: PropTypes.instanceOf(Object),
1707
+
1708
+ /**
1709
+ Set true to show a skeleton placeholder
1710
+ */
1711
+ isLoading: PropTypes.bool
1712
+ };
1713
+ var defaultProps$4 = {
1714
+ className: undefined,
1715
+ classes: {},
1716
+ collectionType: {},
1717
+ primaryFieldName: undefined,
1718
+ secondaryFieldName: undefined,
1719
+ primaryFunction: undefined,
1720
+ secondaryFunction: undefined,
1721
+ onClick: undefined,
1722
+ ActionComponent: undefined,
1723
+ ActionProps: {},
1724
+ AvatarComponent: Component$5,
1725
+ AvatarProps: {},
1726
+ parseMetadataOptions: {
1727
+ flat: true,
1728
+ arrayOnSingle: false
1729
+ },
1730
+ isLoading: false
1731
+ };
1732
+ CollectionListItem.propTypes = propTypes$4;
1733
+ CollectionListItem.defaultProps = defaultProps$4;
1734
+
1735
+ var Component$4 = styles$8.withStyles(styles$4, {
1736
+ name: 'VdtCollectionListItem'
1737
+ })(CollectionListItem);
1738
+ Component$4.displayName = 'CollectionListItem';
1739
+
1740
+ var _excluded$4 = ["className", "classes", "collectionListType", "emptyText", "isLoading", "loadingAmount", "onListItemClick", "ListItemComponent", "ListItemProps"];
1741
+
1742
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1743
+
1744
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1745
+ var styles$3 = function styles() {
1746
+ return {
1747
+ root: {
1748
+ width: '100%'
1749
+ },
1750
+ item: {}
1751
+ };
1752
+ };
1753
+ function CollectionList(_ref) {
1754
+ var className = _ref.className,
1755
+ classes = _ref.classes,
1756
+ collectionListType = _ref.collectionListType,
1757
+ emptyText = _ref.emptyText,
1758
+ isLoading = _ref.isLoading,
1759
+ loadingAmount = _ref.loadingAmount,
1760
+ onListItemClick = _ref.onListItemClick,
1761
+ ListItemComponent = _ref.ListItemComponent,
1762
+ ListItemProps = _ref.ListItemProps,
1763
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
1764
+
1765
+ var _ref2 = collectionListType || {},
1766
+ _ref2$collection = _ref2.collection,
1767
+ collections = _ref2$collection === void 0 ? [] : _ref2$collection;
1768
+
1769
+ return /*#__PURE__*/jsxRuntime.jsx(List__default["default"], _objectSpread$4(_objectSpread$4({
1770
+ className: clsx__default["default"](className, classes.root, 'VdtCollectionList-root')
1771
+ }, props), {}, {
1772
+ children: isLoading ? _toConsumableArray__default["default"](Array(Math.max(loadingAmount, 0)).keys()).map(function () {
1773
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemComponent, _objectSpread$4({
1774
+ isLoading: true
1775
+ }, ListItemProps), uuidv4());
1776
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1777
+ children: [collections.length > 0 && collections.map(function (collectionType) {
1778
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemComponent, _objectSpread$4({
1779
+ className: clsx__default["default"](classes.item, 'VdtCollectionList-item'),
1780
+ collectionType: collectionType,
1781
+ onClick: onListItemClick
1782
+ }, ListItemProps), uuidv4());
1783
+ }), collections.length === 0 && emptyText]
1784
+ })
1785
+ }));
1786
+ }
1787
+ var propTypes$3 = {
1788
+ /**
1789
+ * Override styles with className
1790
+ */
1791
+ className: PropTypes.string,
1792
+
1793
+ /**
1794
+ * Override or extend the styles applied to the component
1795
+ */
1796
+ classes: PropTypes.instanceOf(Object),
1797
+
1798
+ /**
1799
+ * The `CollectionListType` to show in the list
1800
+ */
1801
+ collectionListType: VidispinePropTypes__default["default"].CollectionListType,
1802
+
1803
+ /**
1804
+ * Text shown when list is empty
1805
+ */
1806
+ emptyText: PropTypes.string,
1807
+
1808
+ /**
1809
+ * Show skeleton list items as loading state
1810
+ */
1811
+ isLoading: PropTypes.bool,
1812
+
1813
+ /**
1814
+ * Amount of skeletons to show when loading
1815
+ */
1816
+ loadingAmount: PropTypes.number,
1817
+
1818
+ /**
1819
+ * Callback for ListItem click event
1820
+ */
1821
+ onListItemClick: PropTypes.func,
1822
+
1823
+ /**
1824
+ * Component used to as ListItem
1825
+ */
1826
+ ListItemComponent: PropTypes.elementType,
1827
+
1828
+ /**
1829
+ * Props for `ListItemComponent`
1830
+ */
1831
+ ListItemProps: PropTypes.instanceOf(Object)
1832
+ };
1833
+ var defaultProps$3 = {
1834
+ className: undefined,
1835
+ classes: {},
1836
+ collectionListType: {},
1837
+ emptyText: 'No collections found...',
1838
+ isLoading: false,
1839
+ loadingAmount: 3,
1840
+ onListItemClick: undefined,
1841
+ ListItemComponent: Component$4,
1842
+ ListItemProps: {}
1843
+ };
1844
+ CollectionList.propTypes = propTypes$3;
1845
+ CollectionList.defaultProps = defaultProps$3;
1846
+
1847
+ var Component$3 = styles$8.withStyles(styles$3, {
1848
+ name: 'VdtCollectionList'
1849
+ })(CollectionList);
1850
+ Component$3.displayName = 'CollectionList';
1851
+
1852
+ var _excluded$3 = ["className", "classes", "itemType", "onClick", "parseMetadataOptions", "primaryFieldName", "primaryFunction", "secondaryFieldName", "secondaryFunction", "isLoading", "AvatarComponent", "AvatarProps", "ActionComponent", "ActionProps"];
1853
+
1854
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1855
+
1856
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1857
+ var styles$2 = function styles() {
1858
+ return {
1859
+ root: {
1860
+ '&:hover .VdtCollectionListItem-secondaryAction': {
1861
+ visibility: 'visible'
1862
+ }
1863
+ },
1864
+ avatar: {},
1865
+ text: {},
1866
+ secondaryAction: {
1867
+ visibility: 'hidden'
1868
+ }
1869
+ };
1870
+ };
1871
+
1872
+ var getText = function getText(fieldName, func, parsedMetadata, entityType, entityId) {
1873
+ if (func && typeof func === 'function') {
1874
+ return func(_objectSpread$3(_objectSpread$3({}, parsedMetadata), {}, {
1875
+ entityType: entityType,
1876
+ entityId: entityId
1877
+ }));
1878
+ }
1879
+
1880
+ if (fieldName) {
1881
+ return parsedMetadata[fieldName];
1882
+ }
1883
+
1884
+ return undefined;
1885
+ };
1886
+
1887
+ function ItemListItem(_ref) {
1888
+ var className = _ref.className,
1889
+ classes = _ref.classes,
1890
+ itemType = _ref.itemType,
1891
+ onClick = _ref.onClick,
1892
+ parseMetadataOptions = _ref.parseMetadataOptions,
1893
+ primaryFieldName = _ref.primaryFieldName,
1894
+ primaryFunction = _ref.primaryFunction,
1895
+ secondaryFieldName = _ref.secondaryFieldName,
1896
+ secondaryFunction = _ref.secondaryFunction,
1897
+ isLoading = _ref.isLoading,
1898
+ AvatarComponent = _ref.AvatarComponent,
1899
+ AvatarProps = _ref.AvatarProps,
1900
+ ActionComponent = _ref.ActionComponent,
1901
+ ActionProps = _ref.ActionProps,
1902
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
1903
+
1904
+ var id = itemType.id,
1905
+ metadataType = itemType.metadata;
1906
+ var parsedMetadata = vdtJs.parseMetadataType(metadataType, parseMetadataOptions);
1907
+ var primaryText = react.useMemo(function () {
1908
+ return getText(primaryFieldName, primaryFunction, parsedMetadata, itemType, id) || id;
1909
+ }, [primaryFieldName, primaryFunction, parsedMetadata, itemType, id]);
1910
+ var secondaryText = react.useMemo(function () {
1911
+ return getText(secondaryFieldName, secondaryFunction, parsedMetadata, itemType, id);
1912
+ }, [secondaryFieldName, secondaryFunction, parsedMetadata, itemType, id]);
1913
+ var mimeType = parsedMetadata.mimeType;
1914
+ var mediaType = typeof mimeType === 'string' ? mimeType.split('/')[0] : undefined;
1915
+ return /*#__PURE__*/jsxRuntime.jsxs(material.ListItem, _objectSpread$3(_objectSpread$3({
1916
+ className: clsx__default["default"](className, classes.root, 'VdtItemListItem-root'),
1917
+ onClick: !isLoading && onClick ? function (event) {
1918
+ return onClick(itemType, event);
1919
+ } : undefined,
1920
+ button: onClick ? true : undefined
1921
+ }, props), {}, {
1922
+ children: [AvatarComponent && /*#__PURE__*/jsxRuntime.jsx(material.ListItemAvatar, {
1923
+ className: clsx__default["default"](classes.avatar, 'VdtItemListItem-avatar'),
1924
+ children: /*#__PURE__*/jsxRuntime.jsx(AvatarComponent, _objectSpread$3({
1925
+ entityType: ENTITY_TYPES.ITEM,
1926
+ mediaType: mediaType,
1927
+ isLoading: isLoading
1928
+ }, AvatarProps))
1929
+ }), /*#__PURE__*/jsxRuntime.jsx(material.ListItemText, {
1930
+ className: clsx__default["default"](classes.text, 'VdtItemListItem-text'),
1931
+ primary: isLoading ? /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, {
1932
+ width: 120
1933
+ }) : primaryText,
1934
+ secondary: isLoading ? /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, {
1935
+ width: 60
1936
+ }) : secondaryText
1937
+ }), !!ActionComponent && !isLoading && /*#__PURE__*/jsxRuntime.jsx(material.ListItemSecondaryAction, {
1938
+ className: clsx__default["default"](classes.secondaryAction, 'VdtItemListItem-secondaryAction'),
1939
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionComponent, _objectSpread$3({
1940
+ itemType: itemType
1941
+ }, ActionProps))
1942
+ })]
1943
+ }));
1944
+ }
1945
+ var propTypes$2 = {
1946
+ /**
1947
+ * Override styles with className
1948
+ */
1949
+ className: PropTypes.string,
1950
+
1951
+ /**
1952
+ * Override or extend the styles applied to the component
1953
+ */
1954
+ classes: PropTypes.instanceOf(Object),
1955
+
1956
+ /**
1957
+ * The `ItemType` to display as a list item
1958
+ */
1959
+ itemType: VidispinePropTypes__default["default"].ItemType,
1960
+
1961
+ /**
1962
+ * Set primary text to value of entered metadata field name.
1963
+ *
1964
+ * _Not used if `primaryFunction` is added_
1965
+ */
1966
+ primaryFieldName: PropTypes.string,
1967
+
1968
+ /**
1969
+ * Extract primary text using function getting metadata values as props
1970
+ */
1971
+ primaryFunction: PropTypes.func,
1972
+
1973
+ /**
1974
+ * Set secondary text to value of entered metadata field name.
1975
+ *
1976
+ * _Not used if `secondaryFunction` is added_
1977
+ */
1978
+ secondaryFieldName: PropTypes.string,
1979
+
1980
+ /**
1981
+ * Select primary text using function getting metadata values as props
1982
+ */
1983
+ secondaryFunction: PropTypes.func,
1984
+
1985
+ /**
1986
+ Triggered when the list item is clicked
1987
+ */
1988
+ onClick: PropTypes.func,
1989
+
1990
+ /**
1991
+ Add an action component to put actions on the list item
1992
+ */
1993
+ ActionComponent: PropTypes.elementType,
1994
+
1995
+ /**
1996
+ Add props for the ActionComponent
1997
+ */
1998
+ ActionProps: PropTypes.instanceOf(Object),
1999
+
2000
+ /**
2001
+ Add an avatar component to put an avatar on the list item
2002
+ */
2003
+ AvatarComponent: PropTypes.elementType,
2004
+
2005
+ /**
2006
+ Add props for the AvatarComponent
2007
+ */
2008
+ AvatarProps: PropTypes.instanceOf(Object),
2009
+
2010
+ /**
2011
+ Pass in options for how to parse the list item metadata
2012
+ */
2013
+ parseMetadataOptions: PropTypes.instanceOf(Object),
2014
+
2015
+ /**
2016
+ Set true to show a skeleton placeholder
2017
+ */
2018
+ isLoading: PropTypes.bool
2019
+ };
2020
+ var defaultProps$2 = {
2021
+ className: undefined,
2022
+ classes: {},
2023
+ itemType: {},
2024
+ primaryFieldName: undefined,
2025
+ secondaryFieldName: undefined,
2026
+ primaryFunction: undefined,
2027
+ secondaryFunction: undefined,
2028
+ onClick: undefined,
2029
+ ActionComponent: undefined,
2030
+ ActionProps: {},
2031
+ AvatarComponent: Component$5,
2032
+ AvatarProps: {},
2033
+ parseMetadataOptions: {
2034
+ flat: true,
2035
+ arrayOnSingle: false
2036
+ },
2037
+ isLoading: false
2038
+ };
2039
+ ItemListItem.propTypes = propTypes$2;
2040
+ ItemListItem.defaultProps = defaultProps$2;
2041
+
2042
+ var Component$2 = styles$8.withStyles(styles$2, {
2043
+ name: 'VdtItemListItem'
2044
+ })(ItemListItem);
2045
+ Component$2.displayName = 'ItemListItem';
2046
+
2047
+ var _excluded$2 = ["className", "classes", "itemListType", "emptyText", "isLoading", "loadingAmount", "onListItemClick", "ListItemComponent", "ListItemProps"];
2048
+
2049
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2050
+
2051
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2052
+ var styles$1 = function styles() {
2053
+ return {
2054
+ root: {
2055
+ width: '100%'
2056
+ }
2057
+ };
2058
+ };
2059
+ function ItemList(_ref) {
2060
+ var className = _ref.className,
2061
+ classes = _ref.classes,
2062
+ itemListType = _ref.itemListType,
2063
+ emptyText = _ref.emptyText,
2064
+ isLoading = _ref.isLoading,
2065
+ loadingAmount = _ref.loadingAmount,
2066
+ onListItemClick = _ref.onListItemClick,
2067
+ ListItemComponent = _ref.ListItemComponent,
2068
+ ListItemProps = _ref.ListItemProps,
2069
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
2070
+
2071
+ var _ref2 = itemListType || {},
2072
+ _ref2$item = _ref2.item,
2073
+ items = _ref2$item === void 0 ? [] : _ref2$item;
2074
+
2075
+ return /*#__PURE__*/jsxRuntime.jsx(List__default["default"], _objectSpread$2(_objectSpread$2({
2076
+ className: clsx__default["default"](className, classes.root, 'VdtItemList-root')
2077
+ }, props), {}, {
2078
+ children: isLoading ? _toConsumableArray__default["default"](Array(Math.max(loadingAmount, 0)).keys()).map(function () {
2079
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemComponent, _objectSpread$2({
2080
+ isLoading: true
2081
+ }, ListItemProps), uuidv4());
2082
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2083
+ children: [items.length > 0 && items.map(function (itemType) {
2084
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemComponent, _objectSpread$2({
2085
+ className: clsx__default["default"](classes.item, 'VdtItemList-item'),
2086
+ itemType: itemType,
2087
+ onClick: onListItemClick
2088
+ }, ListItemProps), uuidv4());
2089
+ }), items.length === 0 && emptyText]
2090
+ })
2091
+ }));
2092
+ }
2093
+ var propTypes$1 = {
2094
+ /**
2095
+ * Override styles with className
2096
+ */
2097
+ className: PropTypes.string,
2098
+
2099
+ /**
2100
+ * Override or extend the styles applied to the component
2101
+ */
2102
+ classes: PropTypes.instanceOf(Object),
2103
+
2104
+ /**
2105
+ * The `ItemListType` to show in the list
2106
+ */
2107
+ itemListType: VidispinePropTypes__default["default"].ItemListType,
2108
+
2109
+ /**
2110
+ * Text shown when list is empty
2111
+ */
2112
+ emptyText: PropTypes.string,
2113
+
2114
+ /**
2115
+ * Show skeleton list items as loading state
2116
+ */
2117
+ isLoading: PropTypes.bool,
2118
+
2119
+ /**
2120
+ * Amount of skeletons to show when loading
2121
+ */
2122
+ loadingAmount: PropTypes.number,
2123
+
2124
+ /**
2125
+ * Callback for ListItem click event
2126
+ */
2127
+ onListItemClick: PropTypes.func,
2128
+
2129
+ /**
2130
+ * Component used to as ListItem
2131
+ */
2132
+ ListItemComponent: PropTypes.elementType,
2133
+
2134
+ /**
2135
+ * Props for `ListItemComponent`
2136
+ */
2137
+ ListItemProps: PropTypes.instanceOf(Object)
2138
+ };
2139
+ var defaultProps$1 = {
2140
+ className: undefined,
2141
+ classes: {},
2142
+ itemListType: {},
2143
+ emptyText: 'No items found...',
2144
+ isLoading: false,
2145
+ loadingAmount: 3,
2146
+ onListItemClick: undefined,
2147
+ ListItemComponent: Component$2,
2148
+ ListItemProps: {}
2149
+ };
2150
+ ItemList.propTypes = propTypes$1;
2151
+ ItemList.defaultProps = defaultProps$1;
2152
+
2153
+ var Component$1 = styles$8.withStyles(styles$1, {
2154
+ name: 'VdtItemList'
2155
+ })(ItemList);
2156
+ Component$1.displayName = 'ItemList';
2157
+
2158
+ var _excluded$1 = ["className", "classes", "entities", "emptyText", "isLoading", "loadingAmount", "onItemListItemClick", "onCollectionListItemClick", "onListItemClick", "ItemListItemComponent", "ItemListItemProps", "CollectionListItemComponent", "CollectionListItemProps", "ListItemProps"];
2159
+
2160
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2161
+
2162
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2163
+ var styles = function styles() {
2164
+ return {
2165
+ root: {
2166
+ width: '100%'
2167
+ },
2168
+ item: {},
2169
+ collection: {}
2170
+ };
2171
+ };
2172
+ function EntityList(_ref) {
2173
+ var className = _ref.className,
2174
+ classes = _ref.classes,
2175
+ entities = _ref.entities,
2176
+ emptyText = _ref.emptyText,
2177
+ isLoading = _ref.isLoading,
2178
+ loadingAmount = _ref.loadingAmount,
2179
+ onItemListItemClick = _ref.onItemListItemClick,
2180
+ onCollectionListItemClick = _ref.onCollectionListItemClick,
2181
+ onListItemClick = _ref.onListItemClick,
2182
+ ItemListItemComponent = _ref.ItemListItemComponent,
2183
+ ItemListItemProps = _ref.ItemListItemProps,
2184
+ CollectionListItemComponent = _ref.CollectionListItemComponent,
2185
+ CollectionListItemProps = _ref.CollectionListItemProps,
2186
+ ListItemProps = _ref.ListItemProps,
2187
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
2188
+
2189
+ var handleItemListItemClick = onItemListItemClick || onListItemClick;
2190
+ var handleCollectionListItemClick = onCollectionListItemClick || onListItemClick;
2191
+ return /*#__PURE__*/jsxRuntime.jsx(List__default["default"], _objectSpread$1(_objectSpread$1({
2192
+ className: clsx__default["default"](className, classes.root, 'VdtEntityList-root')
2193
+ }, props), {}, {
2194
+ children: isLoading ? _toConsumableArray__default["default"](Array(Math.max(loadingAmount, 0)).keys()).map(function () {
2195
+ return /*#__PURE__*/jsxRuntime.jsx(ItemListItemComponent, _objectSpread$1({
2196
+ isLoading: isLoading
2197
+ }, ListItemProps), uuidv4());
2198
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2199
+ children: [entities.length > 0 && entities.map(function (_ref2) {
2200
+ var item = _ref2.item,
2201
+ collection = _ref2.collection;
2202
+ return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
2203
+ children: [!!item && /*#__PURE__*/jsxRuntime.jsx(ItemListItemComponent, _objectSpread$1(_objectSpread$1({
2204
+ className: clsx__default["default"](className, classes.root, 'VdtEntityList-item'),
2205
+ itemType: item,
2206
+ onClick: handleItemListItemClick
2207
+ }, ListItemProps), ItemListItemProps)), !!collection && /*#__PURE__*/jsxRuntime.jsx(CollectionListItemComponent, _objectSpread$1(_objectSpread$1({
2208
+ className: clsx__default["default"](className, classes.root, 'VdtEntityList-collection'),
2209
+ collectionType: collection,
2210
+ onClick: handleCollectionListItemClick
2211
+ }, ListItemProps), CollectionListItemProps))]
2212
+ }, uuidv4());
2213
+ }), entities.length === 0 && emptyText]
2214
+ })
2215
+ }));
2216
+ }
2217
+ var propTypes = {
2218
+ /**
2219
+ * Override styles with className
2220
+ */
2221
+ className: PropTypes.string,
2222
+
2223
+ /**
2224
+ * Override or extend the styles applied to the component
2225
+ */
2226
+ classes: PropTypes.instanceOf(Object),
2227
+
2228
+ /**
2229
+ * The `CollectionType` and/or `ItemType` entities to show in the list
2230
+ */
2231
+ entities: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
2232
+ item: VidispinePropTypes__default["default"].ItemType
2233
+ }), PropTypes.shape({
2234
+ collection: VidispinePropTypes__default["default"].CollectionType
2235
+ })])),
2236
+
2237
+ /**
2238
+ * Callback for ListItem click event
2239
+ */
2240
+ onItemListItemClick: PropTypes.func,
2241
+
2242
+ /**
2243
+ * Callback for ListItem click event
2244
+ */
2245
+ onCollectionListItemClick: PropTypes.func,
2246
+
2247
+ /**
2248
+ * Callback for ListItem click event
2249
+ *
2250
+ * _`onItemListItemClick` and `onCollectionListItemClick` has precedence_
2251
+ */
2252
+ onListItemClick: PropTypes.func,
2253
+
2254
+ /**
2255
+ * Text shown when list is empty
2256
+ */
2257
+ emptyText: PropTypes.string,
2258
+
2259
+ /**
2260
+ * Show skeleton list items as loading state
2261
+ */
2262
+ isLoading: PropTypes.bool,
2263
+
2264
+ /**
2265
+ * Amount of skeletons to show when loading
2266
+ */
2267
+ loadingAmount: PropTypes.number,
2268
+
2269
+ /**
2270
+ * Component used to as ListItem for items
2271
+ */
2272
+ ItemListItemComponent: PropTypes.elementType,
2273
+
2274
+ /**
2275
+ * Props for `ItemListItemComponent`
2276
+ */
2277
+ ItemListItemProps: PropTypes.instanceOf(Object),
2278
+
2279
+ /**
2280
+ * Component used to as ListItem for collections
2281
+ */
2282
+ CollectionListItemComponent: PropTypes.elementType,
2283
+
2284
+ /**
2285
+ * Props for `CollectionListItemComponent`
2286
+ */
2287
+ CollectionListItemProps: PropTypes.instanceOf(Object),
2288
+
2289
+ /**
2290
+ * Props for both `ItemListItemComponent` and `CollectionListItemComponent`
2291
+ *
2292
+ * _`ItemListItemProps` and `CollectionListItemProps` override these_
2293
+ */
2294
+ ListItemProps: PropTypes.instanceOf(Object)
2295
+ };
2296
+ var defaultProps = {
2297
+ className: undefined,
2298
+ classes: {},
2299
+ entities: [],
2300
+ emptyText: 'No entities found...',
2301
+ isLoading: false,
2302
+ loadingAmount: 3,
2303
+ onItemListItemClick: undefined,
2304
+ onCollectionListItemClick: undefined,
2305
+ onListItemClick: undefined,
2306
+ ItemListItemComponent: Component$2,
2307
+ ItemListItemProps: {},
2308
+ CollectionListItemComponent: Component$4,
2309
+ CollectionListItemProps: {},
2310
+ ListItemProps: {}
2311
+ };
2312
+ EntityList.propTypes = propTypes;
2313
+ EntityList.defaultProps = defaultProps;
2314
+
2315
+ var Component = styles$8.withStyles(styles, {
2316
+ name: 'VdtEntityList'
2317
+ })(EntityList);
2318
+ Component.displayName = 'EntityList';
2319
+
2320
+ var _excluded = ["themes", "defaultPaletteKey", "localStoragePaletteKey", "MuiThemeProviderProps", "CssBaselineProps", "children"];
2321
+
2322
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2323
+
2324
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2325
+ var light = material.createTheme({
2326
+ palette: {
2327
+ type: 'light'
2328
+ }
2329
+ });
2330
+ var dark = material.createTheme({
2331
+ palette: {
2332
+ type: 'dark'
2333
+ }
2334
+ });
2335
+ var ThemeContext = /*#__PURE__*/react.createContext({
2336
+ theme: undefined,
2337
+ palette: undefined,
2338
+ togglePalette: function togglePalette() {
2339
+ return null;
2340
+ }
2341
+ });
2342
+ function ThemeProvider(_ref) {
2343
+ var _ref$themes = _ref.themes,
2344
+ themes = _ref$themes === void 0 ? {
2345
+ light: light,
2346
+ dark: dark
2347
+ } : _ref$themes,
2348
+ _ref$defaultPaletteKe = _ref.defaultPaletteKey,
2349
+ defaultPaletteKey = _ref$defaultPaletteKe === void 0 ? 'light' : _ref$defaultPaletteKe,
2350
+ _ref$localStoragePale = _ref.localStoragePaletteKey,
2351
+ localStoragePaletteKey = _ref$localStoragePale === void 0 ? 'DEFAULT_PALETTE' : _ref$localStoragePale,
2352
+ _ref$MuiThemeProvider = _ref.MuiThemeProviderProps,
2353
+ MuiThemeProviderProps = _ref$MuiThemeProvider === void 0 ? {} : _ref$MuiThemeProvider,
2354
+ _ref$CssBaselineProps = _ref.CssBaselineProps,
2355
+ CssBaselineProps = _ref$CssBaselineProps === void 0 ? {} : _ref$CssBaselineProps,
2356
+ children = _ref.children,
2357
+ props = _objectWithoutProperties__default["default"](_ref, _excluded);
2358
+
2359
+ var initialPaletteKey = localStorage.getItem(localStoragePaletteKey) || defaultPaletteKey;
2360
+
2361
+ var _useState = react.useState(initialPaletteKey),
2362
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
2363
+ palette = _useState2[0],
2364
+ setPalette = _useState2[1];
2365
+
2366
+ var initialPalette = themes[initialPaletteKey];
2367
+
2368
+ var _useState3 = react.useState(initialPalette),
2369
+ _useState4 = _slicedToArray__default["default"](_useState3, 2),
2370
+ theme = _useState4[0],
2371
+ setTheme = _useState4[1];
2372
+
2373
+ var updatePalette = react.useCallback(function (newPaletteKey) {
2374
+ if (!Object.keys(themes).includes(newPaletteKey)) {
2375
+ throw new Error("Invalid theme (".concat(newPaletteKey, ") selected"));
2376
+ }
2377
+
2378
+ var newTheme = themes[newPaletteKey];
2379
+ setTheme(newTheme);
2380
+ setPalette(newPaletteKey);
2381
+ localStorage.setItem(localStoragePaletteKey, newPaletteKey);
2382
+ }, [localStoragePaletteKey, themes]);
2383
+ var togglePalette = react.useCallback(function () {
2384
+ var paletteKeys = Object.keys(themes);
2385
+ var newPaletteKey = paletteKeys[0];
2386
+
2387
+ if (paletteKeys.length > 0 && palette === paletteKeys[0]) {
2388
+ var _paletteKeys = _slicedToArray__default["default"](paletteKeys, 2);
2389
+
2390
+ newPaletteKey = _paletteKeys[1];
2391
+ }
2392
+
2393
+ updatePalette(newPaletteKey);
2394
+ }, [palette, themes, updatePalette]);
2395
+ var isDefaultPalette = palette === defaultPaletteKey;
2396
+ var contextValue = react.useMemo(function () {
2397
+ return _objectSpread({
2398
+ theme: theme,
2399
+ palette: palette,
2400
+ updatePalette: updatePalette,
2401
+ isDefaultPalette: isDefaultPalette,
2402
+ themes: themes
2403
+ }, Object.keys(themes).length === 2 ? {
2404
+ togglePalette: togglePalette
2405
+ } : {});
2406
+ }, [isDefaultPalette, palette, theme, themes, togglePalette, updatePalette]);
2407
+ return /*#__PURE__*/jsxRuntime.jsx(ThemeContext.Provider, {
2408
+ value: contextValue,
2409
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.ThemeProvider, _objectSpread(_objectSpread({
2410
+ theme: material.createTheme(_objectSpread(_objectSpread({}, theme), props))
2411
+ }, MuiThemeProviderProps), {}, {
2412
+ children: [/*#__PURE__*/jsxRuntime.jsx(CssBaseline__default["default"], _objectSpread({
2413
+ enableColorScheme: true
2414
+ }, CssBaselineProps)), children]
2415
+ }))
2416
+ });
2417
+ }
2418
+ function useThemeContext() {
2419
+ var context = react.useContext(ThemeContext);
2420
+
2421
+ if (context === undefined) {
2422
+ throw new Error('useThemeContext must be used within a ThemeProvider');
2423
+ }
2424
+
2425
+ return context;
2426
+ }
2427
+
2428
+ exports.CollectionList = Component$3;
2429
+ exports.CollectionListItem = Component$4;
2430
+ exports.EntityAvatar = Component$5;
2431
+ exports.EntityIcon = Component$6;
2432
+ exports.EntityList = Component;
2433
+ exports.ItemList = Component$1;
2434
+ exports.ItemListItem = Component$2;
2435
+ exports.MimeTypeIcon = Component$7;
2436
+ exports.ThemeContext = ThemeContext;
2437
+ exports.ThemeProvider = ThemeProvider;
2438
+ exports.useThemeContext = useThemeContext;