@vidispine/vdt-react 21.4.0-pre.2 → 22.1.0-pre.1

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.es.js CHANGED
@@ -1,366 +1,27 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
3
  import React, { useCallback } from 'react';
2
4
  import { utils, search, vsimport, collection, ChunkedUpload, access, metadatafield, fieldgroup, item, library, user, group, storage, job, file, metadata, noauth } from '@vidispine/vdt-api';
5
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
7
+ import _typeof from '@babel/runtime/helpers/typeof';
3
8
  import { createMetadataType, formatTimeCodeText, formatSeconds, parseMetadataType, roles } from '@vidispine/vdt-js';
4
9
  import { decompressFromEncodedURIComponent, compressToEncodedURIComponent } from 'lz-string';
10
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
11
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
5
12
  import useDeepCompareEffect from 'use-deep-compare-effect';
6
- import debounce from 'lodash.debounce';
13
+ import _debounce from 'lodash.debounce';
14
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
15
+ import _createClass from '@babel/runtime/helpers/createClass';
16
+ import _inherits from '@babel/runtime/helpers/inherits';
17
+ import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
18
+ import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
19
+ import _extends from '@babel/runtime/helpers/extends';
7
20
  import { useCookies } from 'react-cookie';
8
21
 
9
- function ownKeys(object, enumerableOnly) {
10
- var keys = Object.keys(object);
22
+ function ownKeys$i(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; }
11
23
 
12
- if (Object.getOwnPropertySymbols) {
13
- var symbols = Object.getOwnPropertySymbols(object);
14
-
15
- if (enumerableOnly) {
16
- symbols = symbols.filter(function (sym) {
17
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
18
- });
19
- }
20
-
21
- keys.push.apply(keys, symbols);
22
- }
23
-
24
- return keys;
25
- }
26
-
27
- function _objectSpread2(target) {
28
- for (var i = 1; i < arguments.length; i++) {
29
- var source = arguments[i] != null ? arguments[i] : {};
30
-
31
- if (i % 2) {
32
- ownKeys(Object(source), true).forEach(function (key) {
33
- _defineProperty(target, key, source[key]);
34
- });
35
- } else if (Object.getOwnPropertyDescriptors) {
36
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
37
- } else {
38
- ownKeys(Object(source)).forEach(function (key) {
39
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
40
- });
41
- }
42
- }
43
-
44
- return target;
45
- }
46
-
47
- function _typeof(obj) {
48
- "@babel/helpers - typeof";
49
-
50
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
51
- _typeof = function (obj) {
52
- return typeof obj;
53
- };
54
- } else {
55
- _typeof = function (obj) {
56
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
57
- };
58
- }
59
-
60
- return _typeof(obj);
61
- }
62
-
63
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
64
- try {
65
- var info = gen[key](arg);
66
- var value = info.value;
67
- } catch (error) {
68
- reject(error);
69
- return;
70
- }
71
-
72
- if (info.done) {
73
- resolve(value);
74
- } else {
75
- Promise.resolve(value).then(_next, _throw);
76
- }
77
- }
78
-
79
- function _asyncToGenerator(fn) {
80
- return function () {
81
- var self = this,
82
- args = arguments;
83
- return new Promise(function (resolve, reject) {
84
- var gen = fn.apply(self, args);
85
-
86
- function _next(value) {
87
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
88
- }
89
-
90
- function _throw(err) {
91
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
92
- }
93
-
94
- _next(undefined);
95
- });
96
- };
97
- }
98
-
99
- function _classCallCheck(instance, Constructor) {
100
- if (!(instance instanceof Constructor)) {
101
- throw new TypeError("Cannot call a class as a function");
102
- }
103
- }
104
-
105
- function _defineProperties(target, props) {
106
- for (var i = 0; i < props.length; i++) {
107
- var descriptor = props[i];
108
- descriptor.enumerable = descriptor.enumerable || false;
109
- descriptor.configurable = true;
110
- if ("value" in descriptor) descriptor.writable = true;
111
- Object.defineProperty(target, descriptor.key, descriptor);
112
- }
113
- }
114
-
115
- function _createClass(Constructor, protoProps, staticProps) {
116
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
117
- if (staticProps) _defineProperties(Constructor, staticProps);
118
- return Constructor;
119
- }
120
-
121
- function _defineProperty(obj, key, value) {
122
- if (key in obj) {
123
- Object.defineProperty(obj, key, {
124
- value: value,
125
- enumerable: true,
126
- configurable: true,
127
- writable: true
128
- });
129
- } else {
130
- obj[key] = value;
131
- }
132
-
133
- return obj;
134
- }
135
-
136
- function _extends() {
137
- _extends = Object.assign || function (target) {
138
- for (var i = 1; i < arguments.length; i++) {
139
- var source = arguments[i];
140
-
141
- for (var key in source) {
142
- if (Object.prototype.hasOwnProperty.call(source, key)) {
143
- target[key] = source[key];
144
- }
145
- }
146
- }
147
-
148
- return target;
149
- };
150
-
151
- return _extends.apply(this, arguments);
152
- }
153
-
154
- function _inherits(subClass, superClass) {
155
- if (typeof superClass !== "function" && superClass !== null) {
156
- throw new TypeError("Super expression must either be null or a function");
157
- }
158
-
159
- subClass.prototype = Object.create(superClass && superClass.prototype, {
160
- constructor: {
161
- value: subClass,
162
- writable: true,
163
- configurable: true
164
- }
165
- });
166
- if (superClass) _setPrototypeOf(subClass, superClass);
167
- }
168
-
169
- function _getPrototypeOf(o) {
170
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
171
- return o.__proto__ || Object.getPrototypeOf(o);
172
- };
173
- return _getPrototypeOf(o);
174
- }
175
-
176
- function _setPrototypeOf(o, p) {
177
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
178
- o.__proto__ = p;
179
- return o;
180
- };
181
-
182
- return _setPrototypeOf(o, p);
183
- }
184
-
185
- function _isNativeReflectConstruct() {
186
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
187
- if (Reflect.construct.sham) return false;
188
- if (typeof Proxy === "function") return true;
189
-
190
- try {
191
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
192
- return true;
193
- } catch (e) {
194
- return false;
195
- }
196
- }
197
-
198
- function _objectWithoutPropertiesLoose(source, excluded) {
199
- if (source == null) return {};
200
- var target = {};
201
- var sourceKeys = Object.keys(source);
202
- var key, i;
203
-
204
- for (i = 0; i < sourceKeys.length; i++) {
205
- key = sourceKeys[i];
206
- if (excluded.indexOf(key) >= 0) continue;
207
- target[key] = source[key];
208
- }
209
-
210
- return target;
211
- }
212
-
213
- function _objectWithoutProperties(source, excluded) {
214
- if (source == null) return {};
215
-
216
- var target = _objectWithoutPropertiesLoose(source, excluded);
217
-
218
- var key, i;
219
-
220
- if (Object.getOwnPropertySymbols) {
221
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
222
-
223
- for (i = 0; i < sourceSymbolKeys.length; i++) {
224
- key = sourceSymbolKeys[i];
225
- if (excluded.indexOf(key) >= 0) continue;
226
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
227
- target[key] = source[key];
228
- }
229
- }
230
-
231
- return target;
232
- }
233
-
234
- function _assertThisInitialized(self) {
235
- if (self === void 0) {
236
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
237
- }
238
-
239
- return self;
240
- }
241
-
242
- function _possibleConstructorReturn(self, call) {
243
- if (call && (typeof call === "object" || typeof call === "function")) {
244
- return call;
245
- } else if (call !== void 0) {
246
- throw new TypeError("Derived constructors may only return object or undefined");
247
- }
248
-
249
- return _assertThisInitialized(self);
250
- }
251
-
252
- function _createSuper(Derived) {
253
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
254
-
255
- return function _createSuperInternal() {
256
- var Super = _getPrototypeOf(Derived),
257
- result;
258
-
259
- if (hasNativeReflectConstruct) {
260
- var NewTarget = _getPrototypeOf(this).constructor;
261
-
262
- result = Reflect.construct(Super, arguments, NewTarget);
263
- } else {
264
- result = Super.apply(this, arguments);
265
- }
266
-
267
- return _possibleConstructorReturn(this, result);
268
- };
269
- }
270
-
271
- function _slicedToArray(arr, i) {
272
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
273
- }
274
-
275
- function _toConsumableArray(arr) {
276
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
277
- }
278
-
279
- function _arrayWithoutHoles(arr) {
280
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
281
- }
282
-
283
- function _arrayWithHoles(arr) {
284
- if (Array.isArray(arr)) return arr;
285
- }
286
-
287
- function _iterableToArray(iter) {
288
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
289
- }
290
-
291
- function _iterableToArrayLimit(arr, i) {
292
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
293
-
294
- if (_i == null) return;
295
- var _arr = [];
296
- var _n = true;
297
- var _d = false;
298
-
299
- var _s, _e;
300
-
301
- try {
302
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
303
- _arr.push(_s.value);
304
-
305
- if (i && _arr.length === i) break;
306
- }
307
- } catch (err) {
308
- _d = true;
309
- _e = err;
310
- } finally {
311
- try {
312
- if (!_n && _i["return"] != null) _i["return"]();
313
- } finally {
314
- if (_d) throw _e;
315
- }
316
- }
317
-
318
- return _arr;
319
- }
320
-
321
- function _unsupportedIterableToArray(o, minLen) {
322
- if (!o) return;
323
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
324
- var n = Object.prototype.toString.call(o).slice(8, -1);
325
- if (n === "Object" && o.constructor) n = o.constructor.name;
326
- if (n === "Map" || n === "Set") return Array.from(o);
327
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
328
- }
329
-
330
- function _arrayLikeToArray(arr, len) {
331
- if (len == null || len > arr.length) len = arr.length;
332
-
333
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
334
-
335
- return arr2;
336
- }
337
-
338
- function _nonIterableSpread() {
339
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
340
- }
341
-
342
- function _nonIterableRest() {
343
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
344
- }
345
-
346
- function _toPrimitive(input, hint) {
347
- if (typeof input !== "object" || input === null) return input;
348
- var prim = input[Symbol.toPrimitive];
349
-
350
- if (prim !== undefined) {
351
- var res = prim.call(input, hint || "default");
352
- if (typeof res !== "object") return res;
353
- throw new TypeError("@@toPrimitive must return a primitive value.");
354
- }
355
-
356
- return (hint === "string" ? String : Number)(input);
357
- }
358
-
359
- function _toPropertyKey(arg) {
360
- var key = _toPrimitive(arg, "string");
361
-
362
- return typeof key === "symbol" ? key : String(key);
363
- }
24
+ function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$i(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
364
25
 
365
26
  var setDefaultState = function setDefaultState() {
366
27
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
@@ -375,7 +36,7 @@ var setDefaultState = function setDefaultState() {
375
36
  _ref$data = _ref.data,
376
37
  data = _ref$data === void 0 ? undefined : _ref$data;
377
38
 
378
- var responseRef = arguments.length > 1 ? arguments[1] : undefined;
39
+ var responseRef = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
379
40
  return {
380
41
  isLoading: isLoading,
381
42
  hasLoaded: hasLoaded,
@@ -389,7 +50,7 @@ var apiReducer = function apiReducer(state, action) {
389
50
  switch (action.type) {
390
51
  case 'START':
391
52
  {
392
- return _objectSpread2(_objectSpread2({}, state), {}, {
53
+ return _objectSpread$i(_objectSpread$i({}, state), {}, {
393
54
  isLoading: true,
394
55
  isError: false
395
56
  });
@@ -422,7 +83,7 @@ var apiReducer = function apiReducer(state, action) {
422
83
 
423
84
  case 'RESET':
424
85
  {
425
- return _objectSpread2({}, action.initialState);
86
+ return _objectSpread$i({}, action.initialState);
426
87
  }
427
88
 
428
89
  default:
@@ -432,8 +93,10 @@ var apiReducer = function apiReducer(state, action) {
432
93
  }
433
94
  };
434
95
 
435
- var canceltoken = utils.CancelToken.source();
436
96
  function useApi(apiHandler, initialState, responseRef) {
97
+ var cancelToken = React.useRef(function () {
98
+ return null;
99
+ });
437
100
  var initialDefaultState = setDefaultState(initialState, responseRef);
438
101
  var initialStateRef = React.useRef(initialDefaultState);
439
102
 
@@ -447,8 +110,10 @@ function useApi(apiHandler, initialState, responseRef) {
447
110
  type: 'START'
448
111
  });
449
112
  return new Promise(function (resolve, reject) {
450
- apiHandler(_objectSpread2({
451
- canceltoken: canceltoken
113
+ apiHandler(_objectSpread$i({
114
+ canceltoken: new utils.CancelToken(function (c) {
115
+ cancelToken.current = c;
116
+ })
452
117
  }, props)).then(function (response) {
453
118
  resolve(response);
454
119
  dispatch({
@@ -472,19 +137,30 @@ function useApi(apiHandler, initialState, responseRef) {
472
137
  initialState: initialStateRef.current
473
138
  });
474
139
  }, []);
475
- React.useEffect(function () {
476
- return canceltoken.cancel;
140
+ var cancel = React.useCallback(function () {
141
+ return cancelToken.current();
477
142
  }, []);
478
- return _objectSpread2({
143
+ React.useEffect(function () {
144
+ return function () {
145
+ cancel();
146
+ reset();
147
+ };
148
+ }, [cancel, reset]);
149
+ return _objectSpread$i({
479
150
  request: request,
480
- reset: reset
151
+ reset: reset,
152
+ cancel: cancel
481
153
  }, state);
482
154
  }
483
155
 
484
- var _excluded = ["queryParams", "matrixParams", "itemSearchDocument", "rowsPerPage", "page"];
485
- var CHANGE_PAGE = 'CHANGE_PAGE';
486
- var CHANGE_ROWS = 'CHANGE_ROWS';
487
- var CHANGE_SORT = 'CHANGE_SORT';
156
+ var _excluded$9 = ["queryParams", "matrixParams", "itemSearchDocument", "rowsPerPage", "page"];
157
+
158
+ function ownKeys$h(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; }
159
+
160
+ function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
161
+ var CHANGE_PAGE$3 = 'CHANGE_PAGE';
162
+ var CHANGE_ROWS$3 = 'CHANGE_ROWS';
163
+ var CHANGE_SORT$3 = 'CHANGE_SORT';
488
164
  var CHANGE_SEARCHTEXT = 'CHANGE_SEARCHTEXT';
489
165
  var CHANGE_SEARCHFIELD = 'CHANGE_SEARCHFIELD';
490
166
  var CHANGE_SEARCHFIELDFACET = 'CHANGE_SEARCHFIELDFACET';
@@ -496,10 +172,10 @@ var CHANGE_ITEMSEARCHDOCUMENT = 'CHANGE_ITEMSEARCHDOCUMENT';
496
172
  var CHANGE_QUERYPARAMS = 'CHANGE_QUERYPARAMS';
497
173
  var CHANGE_MATRIXPARAMS = 'CHANGE_MATRIXPARAMS';
498
174
  var CHANGE_SUGGESTION = 'CHANGE_SUGGESTION';
499
- var ACTION_TYPE = {
500
- CHANGE_PAGE: CHANGE_PAGE,
501
- CHANGE_ROWS: CHANGE_ROWS,
502
- CHANGE_SORT: CHANGE_SORT,
175
+ var ACTION_TYPE$3 = {
176
+ CHANGE_PAGE: CHANGE_PAGE$3,
177
+ CHANGE_ROWS: CHANGE_ROWS$3,
178
+ CHANGE_SORT: CHANGE_SORT$3,
503
179
  CHANGE_SEARCHTEXT: CHANGE_SEARCHTEXT,
504
180
  CHANGE_SEARCHFIELD: CHANGE_SEARCHFIELD,
505
181
  CHANGE_SEARCHFIELDFACET: CHANGE_SEARCHFIELDFACET,
@@ -513,7 +189,7 @@ var ACTION_TYPE = {
513
189
  CHANGE_SUGGESTION: CHANGE_SUGGESTION
514
190
  };
515
191
 
516
- var setInitialDefaultState = function setInitialDefaultState() {
192
+ var setInitialDefaultState$4 = function setInitialDefaultState() {
517
193
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
518
194
  _ref$queryParams = _ref.queryParams,
519
195
  queryParams = _ref$queryParams === void 0 ? {} : _ref$queryParams,
@@ -525,18 +201,18 @@ var setInitialDefaultState = function setInitialDefaultState() {
525
201
  rowsPerPage = _ref$rowsPerPage === void 0 ? 10 : _ref$rowsPerPage,
526
202
  _ref$page = _ref.page,
527
203
  page = _ref$page === void 0 ? 0 : _ref$page,
528
- state = _objectWithoutProperties(_ref, _excluded);
204
+ state = _objectWithoutProperties(_ref, _excluded$9);
529
205
 
530
- return _objectSpread2(_objectSpread2({}, state), {}, {
531
- queryParams: _objectSpread2({
206
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
207
+ queryParams: _objectSpread$h({
532
208
  content: 'metadata',
533
209
  interval: 'generic'
534
210
  }, queryParams),
535
- matrixParams: _objectSpread2({
211
+ matrixParams: _objectSpread$h({
536
212
  first: page * rowsPerPage + 1,
537
213
  number: rowsPerPage
538
214
  }, matrixParams),
539
- itemSearchDocument: _objectSpread2({
215
+ itemSearchDocument: _objectSpread$h({
540
216
  intervals: 'generic',
541
217
  filter: []
542
218
  }, itemSearchDocument),
@@ -545,178 +221,178 @@ var setInitialDefaultState = function setInitialDefaultState() {
545
221
  });
546
222
  };
547
223
 
548
- var searchReducer = function searchReducer(state, action) {
224
+ var searchReducer$3 = function searchReducer(state, action) {
549
225
  switch (action.type) {
550
- case ACTION_TYPE.CHANGE_ITEMSEARCHDOCUMENT:
226
+ case ACTION_TYPE$3.CHANGE_ITEMSEARCHDOCUMENT:
551
227
  {
552
- return _objectSpread2(_objectSpread2({}, state), {}, {
228
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
553
229
  itemSearchDocument: action.itemSearchDocument
554
230
  });
555
231
  }
556
232
 
557
- case ACTION_TYPE.CHANGE_QUERYPARAMS:
233
+ case ACTION_TYPE$3.CHANGE_QUERYPARAMS:
558
234
  {
559
- return _objectSpread2(_objectSpread2({}, state), {}, {
235
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
560
236
  queryParams: action.queryParams
561
237
  });
562
238
  }
563
239
 
564
- case ACTION_TYPE.CHANGE_MATRIXPARAMS:
240
+ case ACTION_TYPE$3.CHANGE_MATRIXPARAMS:
565
241
  {
566
- return _objectSpread2(_objectSpread2({}, state), {}, {
242
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
567
243
  matrixParams: action.matrixParams
568
244
  });
569
245
  }
570
246
 
571
- case ACTION_TYPE.CHANGE_PAGE:
247
+ case ACTION_TYPE$3.CHANGE_PAGE:
572
248
  {
573
- return _objectSpread2(_objectSpread2({}, state), {}, {
249
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
574
250
  page: action.page,
575
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
251
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
576
252
  first: action.page * state.rowsPerPage + 1
577
253
  })
578
254
  });
579
255
  }
580
256
 
581
- case ACTION_TYPE.CHANGE_ROWS:
257
+ case ACTION_TYPE$3.CHANGE_ROWS:
582
258
  {
583
- return _objectSpread2(_objectSpread2({}, state), {}, {
259
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
584
260
  rowsPerPage: action.rowsPerPage,
585
261
  page: 0,
586
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
262
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
587
263
  first: 1,
588
264
  number: action.rowsPerPage
589
265
  })
590
266
  });
591
267
  }
592
268
 
593
- case ACTION_TYPE.CHANGE_SORT:
269
+ case ACTION_TYPE$3.CHANGE_SORT:
594
270
  {
595
- return _objectSpread2(_objectSpread2({}, state), {}, {
271
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
596
272
  page: 0,
597
273
  searchText: action.value,
598
274
  sort: action.value,
599
- itemSearchDocument: _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
275
+ itemSearchDocument: _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
600
276
  sort: action.field ? [{
601
277
  field: action.field,
602
278
  order: action.order || 'descending'
603
279
  }] : []
604
280
  }),
605
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
281
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
606
282
  first: 1
607
283
  })
608
284
  });
609
285
  }
610
286
 
611
- case ACTION_TYPE.CHANGE_SEARCHTEXT:
287
+ case ACTION_TYPE$3.CHANGE_SEARCHTEXT:
612
288
  {
613
- return _objectSpread2(_objectSpread2({}, state), {}, {
289
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
614
290
  page: 0,
615
291
  searchText: action.value,
616
- itemSearchDocument: action.value ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
292
+ itemSearchDocument: action.value ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
617
293
  text: [{
618
294
  value: "".concat(action.value)
619
295
  }]
620
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
296
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
621
297
  text: []
622
298
  }),
623
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
299
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
624
300
  first: 1
625
301
  })
626
302
  });
627
303
  }
628
304
 
629
- case ACTION_TYPE.CHANGE_SEARCHFIELD:
305
+ case ACTION_TYPE$3.CHANGE_SEARCHFIELD:
630
306
  {
631
- return _objectSpread2(_objectSpread2({}, state), {}, {
307
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
632
308
  page: 0,
633
309
  field: action.field,
634
- itemSearchDocument: action.field ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
310
+ itemSearchDocument: action.field ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
635
311
  field: action.field
636
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
312
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
637
313
  field: []
638
314
  }),
639
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
315
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
640
316
  first: 1
641
317
  })
642
318
  });
643
319
  }
644
320
 
645
- case ACTION_TYPE.CHANGE_SEARCHFIELDFACET:
321
+ case ACTION_TYPE$3.CHANGE_SEARCHFIELDFACET:
646
322
  {
647
- return _objectSpread2(_objectSpread2({}, state), {}, {
323
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
648
324
  page: 0,
649
325
  field: action.field,
650
326
  facet: action.facet,
651
- itemSearchDocument: action.field ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
327
+ itemSearchDocument: action.field ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
652
328
  field: action.field,
653
329
  facet: action.facet
654
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
330
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
655
331
  field: [],
656
332
  facet: []
657
333
  }),
658
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
334
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
659
335
  first: 1
660
336
  })
661
337
  });
662
338
  }
663
339
 
664
- case ACTION_TYPE.CHANGE_SEARCHFILTER:
340
+ case ACTION_TYPE$3.CHANGE_SEARCHFILTER:
665
341
  {
666
- return _objectSpread2(_objectSpread2({}, state), {}, {
342
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
667
343
  page: 0,
668
344
  filter: action.filter,
669
- itemSearchDocument: action.filter ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
345
+ itemSearchDocument: action.filter ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
670
346
  filter: action.filter
671
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
347
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
672
348
  filter: []
673
349
  }),
674
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
350
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
675
351
  first: 1
676
352
  })
677
353
  });
678
354
  }
679
355
 
680
- case ACTION_TYPE.CHANGE_SEARCHFILTERFACET:
356
+ case ACTION_TYPE$3.CHANGE_SEARCHFILTERFACET:
681
357
  {
682
- return _objectSpread2(_objectSpread2({}, state), {}, {
358
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
683
359
  page: 0,
684
360
  filter: action.filter,
685
- itemSearchDocument: action.filter ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
361
+ itemSearchDocument: action.filter ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
686
362
  filter: action.filter,
687
363
  facet: action.facet
688
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
364
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
689
365
  filter: [],
690
366
  facet: []
691
367
  }),
692
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
368
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
693
369
  first: 1
694
370
  })
695
371
  });
696
372
  }
697
373
 
698
- case ACTION_TYPE.CHANGE_FACET:
374
+ case ACTION_TYPE$3.CHANGE_FACET:
699
375
  {
700
- return _objectSpread2(_objectSpread2({}, state), {}, {
376
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
701
377
  page: 0,
702
378
  facet: action.facet,
703
- itemSearchDocument: action.facet ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
379
+ itemSearchDocument: action.facet ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
704
380
  facet: action.facet
705
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
381
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
706
382
  facet: []
707
383
  }),
708
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
384
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
709
385
  first: 1
710
386
  })
711
387
  });
712
388
  }
713
389
 
714
- case ACTION_TYPE.CHANGE_PARENT_COLLECTION:
390
+ case ACTION_TYPE$3.CHANGE_PARENT_COLLECTION:
715
391
  {
716
- return _objectSpread2(_objectSpread2({}, state), {}, {
392
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
717
393
  page: 0,
718
394
  parentCollection: action.value,
719
- itemSearchDocument: action.value ? _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
395
+ itemSearchDocument: action.value ? _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
720
396
  operator: {
721
397
  field: [{
722
398
  name: '__parent_collection',
@@ -731,19 +407,19 @@ var searchReducer = function searchReducer(state, action) {
731
407
  }],
732
408
  operation: 'OR'
733
409
  }
734
- }) : _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
410
+ }) : _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
735
411
  operator: undefined
736
412
  }),
737
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
413
+ matrixParams: _objectSpread$h(_objectSpread$h({}, state.matrixParams), {}, {
738
414
  first: 1
739
415
  })
740
416
  });
741
417
  }
742
418
 
743
- case ACTION_TYPE.CHANGE_SUGGESTION:
419
+ case ACTION_TYPE$3.CHANGE_SUGGESTION:
744
420
  {
745
- return _objectSpread2(_objectSpread2({}, state), {}, {
746
- itemSearchDocument: _objectSpread2(_objectSpread2({}, state.itemSearchDocument), {}, {
421
+ return _objectSpread$h(_objectSpread$h({}, state), {}, {
422
+ itemSearchDocument: _objectSpread$h(_objectSpread$h({}, state.itemSearchDocument), {}, {
747
423
  suggestion: action.suggestion
748
424
  })
749
425
  });
@@ -757,9 +433,9 @@ var searchReducer = function searchReducer(state, action) {
757
433
  };
758
434
 
759
435
  function useSearch(initialState) {
760
- var initialDefaultState = setInitialDefaultState(initialState);
436
+ var initialDefaultState = setInitialDefaultState$4(initialState);
761
437
 
762
- var _React$useReducer = React.useReducer(searchReducer, initialDefaultState),
438
+ var _React$useReducer = React.useReducer(searchReducer$3, initialDefaultState),
763
439
  _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
764
440
  state = _React$useReducer2[0],
765
441
  dispatch = _React$useReducer2[1];
@@ -769,7 +445,7 @@ function useSearch(initialState) {
769
445
  newRows = _ref2.target.value;
770
446
 
771
447
  return dispatch({
772
- type: ACTION_TYPE.CHANGE_ROWS,
448
+ type: ACTION_TYPE$3.CHANGE_ROWS,
773
449
  rowsPerPage: newRows
774
450
  });
775
451
  };
@@ -777,14 +453,14 @@ function useSearch(initialState) {
777
453
  var onChangePage = function onChangePage(_ref3) {
778
454
  var newPage = _ref3.page;
779
455
  return dispatch({
780
- type: ACTION_TYPE.CHANGE_PAGE,
456
+ type: ACTION_TYPE$3.CHANGE_PAGE,
781
457
  page: newPage
782
458
  });
783
459
  };
784
460
 
785
461
  var onChangeSort = function onChangeSort(event, field, order) {
786
462
  return dispatch({
787
- type: ACTION_TYPE.CHANGE_SORT,
463
+ type: ACTION_TYPE$3.CHANGE_SORT,
788
464
  field: field,
789
465
  order: order
790
466
  });
@@ -792,31 +468,31 @@ function useSearch(initialState) {
792
468
 
793
469
  var setSearchText = React.useCallback(function (value) {
794
470
  return dispatch({
795
- type: ACTION_TYPE.CHANGE_SEARCHTEXT,
471
+ type: ACTION_TYPE$3.CHANGE_SEARCHTEXT,
796
472
  value: value
797
473
  });
798
474
  }, []);
799
475
  var setItemSearchDocument = React.useCallback(function (itemSearchDocument) {
800
476
  return dispatch({
801
- type: ACTION_TYPE.CHANGE_ITEMSEARCHDOCUMENT,
477
+ type: ACTION_TYPE$3.CHANGE_ITEMSEARCHDOCUMENT,
802
478
  itemSearchDocument: itemSearchDocument
803
479
  });
804
480
  }, []);
805
481
  var setQueryParams = React.useCallback(function (queryParams) {
806
482
  return dispatch({
807
- type: ACTION_TYPE.CHANGE_ITEMQUERYPARAMS,
483
+ type: ACTION_TYPE$3.CHANGE_ITEMQUERYPARAMS,
808
484
  queryParams: queryParams
809
485
  });
810
486
  }, []);
811
487
  var setMatrixParams = React.useCallback(function (matrixParams) {
812
488
  return dispatch({
813
- type: ACTION_TYPE.CHANGE_ITEMMATRIXPARAMS,
489
+ type: ACTION_TYPE$3.CHANGE_ITEMMATRIXPARAMS,
814
490
  matrixParams: matrixParams
815
491
  });
816
492
  }, []);
817
493
  var setSearchField = React.useCallback(function (field) {
818
494
  return dispatch({
819
- type: ACTION_TYPE.CHANGE_SEARCHFIELD,
495
+ type: ACTION_TYPE$3.CHANGE_SEARCHFIELD,
820
496
  field: field
821
497
  });
822
498
  }, []);
@@ -829,14 +505,14 @@ function useSearch(initialState) {
829
505
  };
830
506
  });
831
507
  dispatch({
832
- type: ACTION_TYPE.CHANGE_SEARCHFIELDFACET,
508
+ type: ACTION_TYPE$3.CHANGE_SEARCHFIELDFACET,
833
509
  field: field,
834
510
  facet: facet
835
511
  });
836
512
  }, []);
837
513
  var setSearchFilter = React.useCallback(function (filter) {
838
514
  return dispatch({
839
- type: ACTION_TYPE.CHANGE_SEARCHFILTER,
515
+ type: ACTION_TYPE$3.CHANGE_SEARCHFILTER,
840
516
  filter: filter
841
517
  });
842
518
  }, []);
@@ -856,26 +532,26 @@ function useSearch(initialState) {
856
532
  };
857
533
  });
858
534
  dispatch({
859
- type: ACTION_TYPE.CHANGE_SEARCHFILTERFACET,
535
+ type: ACTION_TYPE$3.CHANGE_SEARCHFILTERFACET,
860
536
  filter: filter,
861
537
  facet: facet
862
538
  });
863
539
  }, [dispatch]);
864
540
  var setFacet = React.useCallback(function (facet) {
865
541
  dispatch({
866
- type: ACTION_TYPE.CHANGE_FACET,
542
+ type: ACTION_TYPE$3.CHANGE_FACET,
867
543
  facet: facet
868
544
  });
869
545
  }, [dispatch]);
870
546
  var setParentCollection = React.useCallback(function (value) {
871
547
  return dispatch({
872
- type: ACTION_TYPE.CHANGE_PARENT_COLLECTION,
548
+ type: ACTION_TYPE$3.CHANGE_PARENT_COLLECTION,
873
549
  value: value
874
550
  });
875
551
  }, []);
876
552
  var setSuggestion = React.useCallback(function (suggestion) {
877
553
  dispatch({
878
- type: ACTION_TYPE.CHANGE_SUGGESTION,
554
+ type: ACTION_TYPE$3.CHANGE_SUGGESTION,
879
555
  suggestion: suggestion
880
556
  });
881
557
  }, []);
@@ -910,7 +586,11 @@ function useUpdateEffect(fn, inputs) {
910
586
  }, inputs);
911
587
  }
912
588
 
913
- var setInitialDefaultState$1 = function setInitialDefaultState() {
589
+ function ownKeys$g(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; }
590
+
591
+ function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
592
+
593
+ var setInitialDefaultState$3 = function setInitialDefaultState() {
914
594
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
915
595
  _ref$field = _ref.field,
916
596
  field = _ref$field === void 0 ? undefined : _ref$field,
@@ -927,7 +607,7 @@ var setInitialDefaultState$1 = function setInitialDefaultState() {
927
607
  };
928
608
 
929
609
  function useAutocomplete(initialState) {
930
- var initialDefaultState = setInitialDefaultState$1(initialState);
610
+ var initialDefaultState = setInitialDefaultState$3(initialState);
931
611
 
932
612
  var _React$useState = React.useState(initialDefaultState),
933
613
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -937,7 +617,7 @@ function useAutocomplete(initialState) {
937
617
  var setAutocompleteField = React.useCallback(function (field) {
938
618
  var text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
939
619
  setAutocompleteDoc(function (state) {
940
- return _objectSpread2(_objectSpread2({}, state), {}, {
620
+ return _objectSpread$g(_objectSpread$g({}, state), {}, {
941
621
  field: field,
942
622
  text: text
943
623
  });
@@ -945,14 +625,14 @@ function useAutocomplete(initialState) {
945
625
  }, []);
946
626
  var setAutocompleteText = React.useCallback(function (text) {
947
627
  setAutocompleteDoc(function (state) {
948
- return _objectSpread2(_objectSpread2({}, state), {}, {
628
+ return _objectSpread$g(_objectSpread$g({}, state), {}, {
949
629
  text: text
950
630
  });
951
631
  });
952
632
  }, []);
953
633
  var setAutocompleteMaxSuggestions = React.useCallback(function (maximumSuggestions) {
954
634
  setAutocompleteDoc(function (state) {
955
- return _objectSpread2(_objectSpread2({}, state), {}, {
635
+ return _objectSpread$g(_objectSpread$g({}, state), {}, {
956
636
  maximumSuggestions: maximumSuggestions
957
637
  });
958
638
  });
@@ -1112,19 +792,27 @@ function useThumbnailScrub() {
1112
792
  };
1113
793
  }
1114
794
 
1115
- var _excluded$1 = ["type"];
1116
- var CHANGE_PAGE$1 = 'CHANGE_PAGE';
1117
- var CHANGE_ROWS$1 = 'CHANGE_ROWS';
1118
- var CHANGE_SORT$1 = 'CHANGE_SORT';
795
+ var _excluded$8 = ["type"];
796
+
797
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
798
+
799
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
800
+
801
+ function ownKeys$f(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; }
802
+
803
+ function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
804
+ var CHANGE_PAGE$2 = 'CHANGE_PAGE';
805
+ var CHANGE_ROWS$2 = 'CHANGE_ROWS';
806
+ var CHANGE_SORT$2 = 'CHANGE_SORT';
1119
807
  var CHANGE_TYPE = 'CHANGE_TYPE';
1120
808
  var CHANGE_STATE = 'CHANGE_STATE';
1121
809
  var CHANGE_PRIORITY = 'CHANGE_PRIORITY';
1122
810
  var CHANGE_STARTTIME = 'CHANGE_STARTTIME';
1123
811
  var CHANGE_FINISHTIME = 'CHANGE_FINISHTIME';
1124
- var ACTION_TYPE$1 = {
1125
- CHANGE_PAGE: CHANGE_PAGE$1,
1126
- CHANGE_ROWS: CHANGE_ROWS$1,
1127
- CHANGE_SORT: CHANGE_SORT$1,
812
+ var ACTION_TYPE$2 = {
813
+ CHANGE_PAGE: CHANGE_PAGE$2,
814
+ CHANGE_ROWS: CHANGE_ROWS$2,
815
+ CHANGE_SORT: CHANGE_SORT$2,
1128
816
  CHANGE_TYPE: CHANGE_TYPE,
1129
817
  CHANGE_STATE: CHANGE_STATE,
1130
818
  CHANGE_PRIORITY: CHANGE_PRIORITY,
@@ -1141,7 +829,7 @@ var setInitialDefaultState$2 = function setInitialDefaultState() {
1141
829
 
1142
830
  return {
1143
831
  queryParams: queryParams,
1144
- matrixParams: _objectSpread2({
832
+ matrixParams: _objectSpread$f({
1145
833
  first: 1,
1146
834
  number: 10
1147
835
  }, matrixParams),
@@ -1151,55 +839,55 @@ var setInitialDefaultState$2 = function setInitialDefaultState() {
1151
839
  };
1152
840
  };
1153
841
 
1154
- var searchReducer$1 = function searchReducer(state, action) {
842
+ var searchReducer$2 = function searchReducer(state, action) {
1155
843
  var type = action.type,
1156
- rest = _objectWithoutProperties(action, _excluded$1);
844
+ rest = _objectWithoutProperties(action, _excluded$8);
1157
845
 
1158
846
  switch (type) {
1159
- case ACTION_TYPE$1.CHANGE_PAGE:
847
+ case ACTION_TYPE$2.CHANGE_PAGE:
1160
848
  {
1161
849
  var _action$page = action.page,
1162
850
  page = _action$page === void 0 ? 0 : _action$page;
1163
851
  var _state$rowsPerPage = state.rowsPerPage,
1164
852
  rowsPerPage = _state$rowsPerPage === void 0 ? 10 : _state$rowsPerPage;
1165
- return _objectSpread2(_objectSpread2({}, state), {}, {
853
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1166
854
  page: page,
1167
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
855
+ matrixParams: _objectSpread$f(_objectSpread$f({}, state.matrixParams), {}, {
1168
856
  first: page * rowsPerPage + 1
1169
857
  })
1170
858
  });
1171
859
  }
1172
860
 
1173
- case ACTION_TYPE$1.CHANGE_ROWS:
861
+ case ACTION_TYPE$2.CHANGE_ROWS:
1174
862
  {
1175
863
  var _rowsPerPage = action.rowsPerPage;
1176
- return _objectSpread2(_objectSpread2({}, state), {}, {
864
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1177
865
  rowsPerPage: _rowsPerPage,
1178
866
  page: 0,
1179
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
867
+ matrixParams: _objectSpread$f(_objectSpread$f({}, state.matrixParams), {}, {
1180
868
  first: 1,
1181
869
  number: _rowsPerPage
1182
870
  })
1183
871
  });
1184
872
  }
1185
873
 
1186
- case ACTION_TYPE$1.CHANGE_SORT:
874
+ case ACTION_TYPE$2.CHANGE_SORT:
1187
875
  {
1188
876
  var field = action.field,
1189
877
  _action$order = action.order,
1190
878
  order = _action$order === void 0 ? 'desc' : _action$order;
1191
- return _objectSpread2(_objectSpread2({}, state), {}, {
879
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1192
880
  page: 0,
1193
- matrixParams: _objectSpread2(_objectSpread2({}, state.matrixParams), {}, {
881
+ matrixParams: _objectSpread$f(_objectSpread$f({}, state.matrixParams), {}, {
1194
882
  first: 1,
1195
883
  sort: "".concat(field, " ").concat(order)
1196
884
  })
1197
885
  });
1198
886
  }
1199
887
 
1200
- case ACTION_TYPE$1.CHANGE_TYPE:
1201
- case ACTION_TYPE$1.CHANGE_STATE:
1202
- case ACTION_TYPE$1.CHANGE_PRIORITY:
888
+ case ACTION_TYPE$2.CHANGE_TYPE:
889
+ case ACTION_TYPE$2.CHANGE_STATE:
890
+ case ACTION_TYPE$2.CHANGE_PRIORITY:
1203
891
  {
1204
892
  var _field = rest.field,
1205
893
  _rest$value = rest.value,
@@ -1207,27 +895,27 @@ var searchReducer$1 = function searchReducer(state, action) {
1207
895
  var matrixParams;
1208
896
 
1209
897
  if (!value) {
1210
- var _state$matrixParams = state.matrixParams,
1211
- deleteField = _state$matrixParams[_field],
1212
- newMatrixParams = _objectWithoutProperties(_state$matrixParams, [_field].map(_toPropertyKey));
898
+ var _state$matrixParams = state.matrixParams;
899
+ _state$matrixParams[_field];
900
+ var newMatrixParams = _objectWithoutProperties(_state$matrixParams, [_field].map(_toPropertyKey));
1213
901
 
1214
- matrixParams = _objectSpread2(_objectSpread2({}, newMatrixParams), {}, {
902
+ matrixParams = _objectSpread$f(_objectSpread$f({}, newMatrixParams), {}, {
1215
903
  first: 1
1216
904
  });
1217
905
  } else {
1218
- matrixParams = _objectSpread2(_objectSpread2({}, state.matrixParams), {}, _defineProperty({
906
+ matrixParams = _objectSpread$f(_objectSpread$f({}, state.matrixParams), {}, _defineProperty({
1219
907
  first: 1
1220
908
  }, _field, Array.isArray(value) ? value.join(',') : value));
1221
909
  }
1222
910
 
1223
- return _objectSpread2(_objectSpread2({}, state), {}, {
911
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1224
912
  page: 0,
1225
913
  matrixParams: matrixParams
1226
914
  });
1227
915
  }
1228
916
 
1229
- case ACTION_TYPE$1.CHANGE_STARTTIME:
1230
- case ACTION_TYPE$1.CHANGE_FINISHTIME:
917
+ case ACTION_TYPE$2.CHANGE_STARTTIME:
918
+ case ACTION_TYPE$2.CHANGE_FINISHTIME:
1231
919
  {
1232
920
  var _field2 = rest.field,
1233
921
  _rest$value2 = rest.value,
@@ -1236,26 +924,26 @@ var searchReducer$1 = function searchReducer(state, action) {
1236
924
  var queryParams;
1237
925
 
1238
926
  if (!_value) {
1239
- var _state$queryParams = state.queryParams,
1240
- _deleteField = _state$queryParams[_field2],
1241
- newQueryParams = _objectWithoutProperties(_state$queryParams, [_field2].map(_toPropertyKey));
927
+ var _state$queryParams = state.queryParams;
928
+ _state$queryParams[_field2];
929
+ var newQueryParams = _objectWithoutProperties(_state$queryParams, [_field2].map(_toPropertyKey));
1242
930
 
1243
- queryParams = _objectSpread2(_objectSpread2({}, newQueryParams), {}, {
931
+ queryParams = _objectSpread$f(_objectSpread$f({}, newQueryParams), {}, {
1244
932
  first: 1
1245
933
  });
1246
934
  } else {
1247
- queryParams = _objectSpread2(_objectSpread2({}, state.queryParams), {}, _defineProperty({
935
+ queryParams = _objectSpread$f(_objectSpread$f({}, state.queryParams), {}, _defineProperty({
1248
936
  first: 1
1249
937
  }, _field2, _value));
1250
938
  }
1251
939
 
1252
- return _objectSpread2(_objectSpread2({}, state), {}, {
940
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1253
941
  page: 0,
1254
942
  queryParams: queryParams
1255
943
  });
1256
944
  }
1257
945
 
1258
- case ACTION_TYPE$1.CHANGE_JOBMETADATA:
946
+ case ACTION_TYPE$2.CHANGE_JOBMETADATA:
1259
947
  {
1260
948
  var _field3 = rest.field,
1261
949
  _rest$value3 = rest.value,
@@ -1264,20 +952,20 @@ var searchReducer$1 = function searchReducer(state, action) {
1264
952
  var _queryParams;
1265
953
 
1266
954
  if (!_value2.length) {
1267
- var _state$queryParams2 = state.queryParams,
1268
- _deleteField2 = _state$queryParams2[_field3],
1269
- _newQueryParams = _objectWithoutProperties(_state$queryParams2, [_field3].map(_toPropertyKey));
955
+ var _state$queryParams2 = state.queryParams;
956
+ _state$queryParams2[_field3];
957
+ var _newQueryParams = _objectWithoutProperties(_state$queryParams2, [_field3].map(_toPropertyKey));
1270
958
 
1271
- _queryParams = _objectSpread2(_objectSpread2({}, _newQueryParams), {}, {
959
+ _queryParams = _objectSpread$f(_objectSpread$f({}, _newQueryParams), {}, {
1272
960
  first: 1
1273
961
  });
1274
962
  } else {
1275
- _queryParams = _objectSpread2(_objectSpread2({}, state.queryParams), {}, _defineProperty({
963
+ _queryParams = _objectSpread$f(_objectSpread$f({}, state.queryParams), {}, _defineProperty({
1276
964
  first: 1
1277
965
  }, _field3, _value2));
1278
966
  }
1279
967
 
1280
- return _objectSpread2(_objectSpread2({}, state), {}, {
968
+ return _objectSpread$f(_objectSpread$f({}, state), {}, {
1281
969
  page: 0,
1282
970
  queryParams: _queryParams,
1283
971
  jobMetadata: _value2
@@ -1292,7 +980,7 @@ var searchReducer$1 = function searchReducer(state, action) {
1292
980
  function useJobSearch(initialState) {
1293
981
  var initialDefaultState = setInitialDefaultState$2(initialState);
1294
982
 
1295
- var _React$useReducer = React.useReducer(searchReducer$1, initialDefaultState),
983
+ var _React$useReducer = React.useReducer(searchReducer$2, initialDefaultState),
1296
984
  _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
1297
985
  state = _React$useReducer2[0],
1298
986
  dispatch = _React$useReducer2[1];
@@ -1302,7 +990,7 @@ function useJobSearch(initialState) {
1302
990
  rowsPerPage = _ref2.target.value;
1303
991
 
1304
992
  return dispatch({
1305
- type: ACTION_TYPE$1.CHANGE_ROWS,
993
+ type: ACTION_TYPE$2.CHANGE_ROWS,
1306
994
  rowsPerPage: rowsPerPage
1307
995
  });
1308
996
  };
@@ -1310,7 +998,7 @@ function useJobSearch(initialState) {
1310
998
  var onChangePage = function onChangePage(_ref3) {
1311
999
  var page = _ref3.page;
1312
1000
  return dispatch({
1313
- type: ACTION_TYPE$1.CHANGE_PAGE,
1001
+ type: ACTION_TYPE$2.CHANGE_PAGE,
1314
1002
  page: page
1315
1003
  });
1316
1004
  };
@@ -1318,7 +1006,7 @@ function useJobSearch(initialState) {
1318
1006
  var onChangeSort = function onChangeSort(event, field, order) {
1319
1007
  var fieldName = _typeof(field) === 'object' ? field.value : field;
1320
1008
  dispatch({
1321
- type: ACTION_TYPE$1.CHANGE_SORT,
1009
+ type: ACTION_TYPE$2.CHANGE_SORT,
1322
1010
  field: fieldName,
1323
1011
  order: order
1324
1012
  });
@@ -1336,7 +1024,7 @@ function useJobSearch(initialState) {
1336
1024
  value = _field4$$value === void 0 ? [] : _field4$$value;
1337
1025
 
1338
1026
  dispatch({
1339
- type: ACTION_TYPE$1.CHANGE_TYPE,
1027
+ type: ACTION_TYPE$2.CHANGE_TYPE,
1340
1028
  field: name,
1341
1029
  value: value.length ? value[0].value : null
1342
1030
  });
@@ -1354,7 +1042,7 @@ function useJobSearch(initialState) {
1354
1042
  value = _field5$$value === void 0 ? [] : _field5$$value;
1355
1043
 
1356
1044
  dispatch({
1357
- type: ACTION_TYPE$1.CHANGE_STATE,
1045
+ type: ACTION_TYPE$2.CHANGE_STATE,
1358
1046
  field: name,
1359
1047
  value: value.length ? value[0].value : null
1360
1048
  });
@@ -1372,7 +1060,7 @@ function useJobSearch(initialState) {
1372
1060
  value = _field6$$value === void 0 ? [] : _field6$$value;
1373
1061
 
1374
1062
  dispatch({
1375
- type: ACTION_TYPE$1.CHANGE_PRIORITY,
1063
+ type: ACTION_TYPE$2.CHANGE_PRIORITY,
1376
1064
  field: name,
1377
1065
  value: value.length ? value[0].value : null
1378
1066
  });
@@ -1390,7 +1078,7 @@ function useJobSearch(initialState) {
1390
1078
  value = _field7$$value === void 0 ? [] : _field7$$value;
1391
1079
 
1392
1080
  dispatch({
1393
- type: ACTION_TYPE$1.CHANGE_STARTTIME,
1081
+ type: ACTION_TYPE$2.CHANGE_STARTTIME,
1394
1082
  field: name,
1395
1083
  value: value.length ? value[0].value : null
1396
1084
  });
@@ -1408,7 +1096,7 @@ function useJobSearch(initialState) {
1408
1096
  value = _field8$$value === void 0 ? [] : _field8$$value;
1409
1097
 
1410
1098
  dispatch({
1411
- type: ACTION_TYPE$1.CHANGE_FINISHTIME,
1099
+ type: ACTION_TYPE$2.CHANGE_FINISHTIME,
1412
1100
  field: name,
1413
1101
  value: value.length ? value[0].value : null
1414
1102
  });
@@ -1416,7 +1104,7 @@ function useJobSearch(initialState) {
1416
1104
 
1417
1105
  var onChangeJobmetadata = function onChangeJobmetadata(value) {
1418
1106
  dispatch({
1419
- type: ACTION_TYPE$1.CHANGE_JOBMETADATA,
1107
+ type: ACTION_TYPE$2.CHANGE_JOBMETADATA,
1420
1108
  field: 'jobmetadata',
1421
1109
  value: value
1422
1110
  });
@@ -1470,7 +1158,11 @@ function b64DecodeUnicode(str) {
1470
1158
  }).join('')) : decompressFromEncodedURIComponent(str);
1471
1159
  }
1472
1160
 
1473
- var _excluded$2 = ["onUploadFile", "initialMetadata"];
1161
+ var _excluded$7 = ["onUploadFile", "initialMetadata"];
1162
+
1163
+ function ownKeys$e(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; }
1164
+
1165
+ function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1474
1166
  var DEFAULT_AUDIO_SHAPETAGS = ['__mp3_160k'];
1475
1167
  var DEFAULT_VIDEO_SHAPETAGS = ['__mp4'];
1476
1168
  var DEFAULT_IMAGE_SHAPETAGS = ['__png'];
@@ -1493,7 +1185,7 @@ var getDefaultShapeTags = function getDefaultShapeTags(file) {
1493
1185
  var chunkedUpload = function chunkedUpload(file) {
1494
1186
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1495
1187
  return new Promise(function (resolve, reject) {
1496
- var uploadInstance = new ChunkedUpload(file, _objectSpread2({
1188
+ var uploadInstance = new ChunkedUpload(file, _objectSpread$e({
1497
1189
  onFail: function onFail(error) {
1498
1190
  return reject(error);
1499
1191
  },
@@ -1533,7 +1225,7 @@ var onUploadFile = function onUploadFile(_ref) {
1533
1225
  _mimeType$split2 = _slicedToArray(_mimeType$split, 1),
1534
1226
  mediaType = _mimeType$split2[0];
1535
1227
 
1536
- var metadata = _objectSpread2({
1228
+ var metadata = _objectSpread$e({
1537
1229
  originalFilename: filename,
1538
1230
  mimeType: mimeType,
1539
1231
  mediaType: mediaType
@@ -1542,7 +1234,7 @@ var onUploadFile = function onUploadFile(_ref) {
1542
1234
  var metadataDocument = createMetadataType(metadata);
1543
1235
  vsimport.createImportPlaceholder({
1544
1236
  metadataDocument: metadataDocument,
1545
- queryParams: _objectSpread2({
1237
+ queryParams: _objectSpread$e({
1546
1238
  container: 1
1547
1239
  }, placeholderParams)
1548
1240
  }).then(function (_ref2) {
@@ -1559,13 +1251,13 @@ var onUploadFile = function onUploadFile(_ref) {
1559
1251
  }).then(function () {
1560
1252
  var transferId = generateTransferId();
1561
1253
 
1562
- var queryParams = _objectSpread2({
1254
+ var queryParams = _objectSpread$e({
1563
1255
  filename: filename,
1564
1256
  transferId: transferId,
1565
1257
  tag: shapeTags
1566
1258
  }, importParams);
1567
1259
 
1568
- return chunkedUpload(file, _objectSpread2({
1260
+ return chunkedUpload(file, _objectSpread$e({
1569
1261
  api: {
1570
1262
  method: vsimport.createImportComponentRaw,
1571
1263
  props: {
@@ -1577,7 +1269,7 @@ var onUploadFile = function onUploadFile(_ref) {
1577
1269
  onProgress: onProgress
1578
1270
  }, chunkedUploadProps));
1579
1271
  }).then(function (response) {
1580
- resolve(_objectSpread2(_objectSpread2({}, response), {}, {
1272
+ resolve(_objectSpread$e(_objectSpread$e({}, response), {}, {
1581
1273
  itemId: itemId,
1582
1274
  collectionId: collectionId
1583
1275
  }));
@@ -1597,7 +1289,7 @@ function useUploadFiles(_ref3) {
1597
1289
  handleUploadFile = _ref3$onUploadFile === void 0 ? onUploadFile : _ref3$onUploadFile,
1598
1290
  _ref3$initialMetadata = _ref3.initialMetadata,
1599
1291
  initialMetadata = _ref3$initialMetadata === void 0 ? {} : _ref3$initialMetadata,
1600
- props = _objectWithoutProperties(_ref3, _excluded$2);
1292
+ props = _objectWithoutProperties(_ref3, _excluded$7);
1601
1293
 
1602
1294
  var _React$useState = React.useState([]),
1603
1295
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -1617,7 +1309,7 @@ function useUploadFiles(_ref3) {
1617
1309
  var newFilesObj = newFiles.map(function (file) {
1618
1310
  return {
1619
1311
  file: file,
1620
- metadata: _objectSpread2({
1312
+ metadata: _objectSpread$e({
1621
1313
  title: file.name
1622
1314
  }, initialMetadata)
1623
1315
  };
@@ -1639,10 +1331,10 @@ function useUploadFiles(_ref3) {
1639
1331
 
1640
1332
  var newFilesList = _toConsumableArray(currentFilesList);
1641
1333
 
1642
- var newFile = _objectSpread2({}, currentFile);
1334
+ var newFile = _objectSpread$e({}, currentFile);
1643
1335
 
1644
- if (newMetadata) newFile.metadata = _objectSpread2(_objectSpread2({}, currentMetadata), newMetadata);
1645
- if (newProgress) newFile.progress = _objectSpread2(_objectSpread2({}, currentProgress), newProgress);
1336
+ if (newMetadata) newFile.metadata = _objectSpread$e(_objectSpread$e({}, currentMetadata), newMetadata);
1337
+ if (newProgress) newFile.progress = _objectSpread$e(_objectSpread$e({}, currentProgress), newProgress);
1646
1338
  newFilesList[idx] = newFile;
1647
1339
  return newFilesList;
1648
1340
  });
@@ -1670,7 +1362,7 @@ function useUploadFiles(_ref3) {
1670
1362
  return previousPromise;
1671
1363
  }
1672
1364
 
1673
- return handleUploadFile(_objectSpread2(_objectSpread2({
1365
+ return handleUploadFile(_objectSpread$e(_objectSpread$e({
1674
1366
  file: thisFile.file,
1675
1367
  onProgress: onChangeProgress(idx),
1676
1368
  metadata: thisFile.metadata
@@ -1706,15 +1398,23 @@ function useUploadFiles(_ref3) {
1706
1398
  };
1707
1399
  }
1708
1400
 
1401
+ // TODO: change to expose "onNavigate" and take in "path" and "search" strings
1402
+
1709
1403
  function useQueryInitialState(_ref) {
1710
1404
  var history = _ref.history,
1405
+ navigate = _ref.navigate,
1406
+ propLocation = _ref.location,
1711
1407
  _ref$queryName = _ref.queryName,
1712
1408
  queryName = _ref$queryName === void 0 ? 'q' : _ref$queryName,
1713
1409
  _ref$defaultState = _ref.defaultState,
1714
1410
  defaultState = _ref$defaultState === void 0 ? undefined : _ref$defaultState;
1715
1411
  var defaultStateRef = React.useRef(defaultState);
1716
1412
  var queryState = React.useMemo(function () {
1717
- var searchParams = new URLSearchParams(history.location.search);
1413
+ var _ref2 = history || {},
1414
+ _ref2$location = _ref2.location,
1415
+ location = _ref2$location === void 0 ? propLocation : _ref2$location;
1416
+
1417
+ var searchParams = new URLSearchParams(location.search);
1718
1418
  var encodedQuery = searchParams.get(queryName);
1719
1419
 
1720
1420
  if (!encodedQuery) {
@@ -1725,42 +1425,64 @@ function useQueryInitialState(_ref) {
1725
1425
  var decodedQuery = b64DecodeUnicode(encodedQuery);
1726
1426
  return JSON.parse(decodedQuery);
1727
1427
  } catch (error) {
1728
- // TODO: Show error snackbar: "Could not parse search query"
1729
- // eslint-disable-next-line no-console
1730
- console.error(error);
1731
- history.replace({
1732
- pathName: history.location.pathName,
1733
- search: ''
1734
- });
1428
+ if (history) {
1429
+ history.replace({
1430
+ pathName: history.location.pathName,
1431
+ search: ''
1432
+ });
1433
+ } else if (navigate) {
1434
+ navigate(location.pathName, {
1435
+ replace: true
1436
+ });
1437
+ }
1735
1438
  }
1736
1439
 
1737
1440
  return undefined;
1738
- }, [defaultStateRef, history, queryName]);
1441
+ }, [history, navigate, propLocation, queryName]);
1739
1442
  return {
1740
1443
  queryInitialState: queryState
1741
1444
  };
1742
1445
  }
1743
1446
 
1447
+ // TODO: change to expose "onNavigate" and take in "path" and "search" strings
1448
+
1744
1449
  function useUpdateQueryState(_ref) {
1745
1450
  var history = _ref.history,
1451
+ navigate = _ref.navigate,
1452
+ propLocation = _ref.location,
1746
1453
  state = _ref.state,
1747
1454
  _ref$queryName = _ref.queryName,
1748
1455
  queryName = _ref$queryName === void 0 ? 'q' : _ref$queryName;
1749
1456
  var onSearchStateChange = React.useCallback(function () {
1457
+ var _ref2 = history || {},
1458
+ _ref2$location = _ref2.location,
1459
+ location = _ref2$location === void 0 ? propLocation : _ref2$location;
1460
+
1750
1461
  var encodedQuery = b64EncodeUnicode(JSON.stringify(state));
1751
- history.replace({
1752
- pathName: history.location.pathName,
1753
- search: "?".concat(queryName, "=").concat(encodedQuery)
1754
- });
1755
- }, [history, queryName, state]); // Don't need to set query on mount
1462
+
1463
+ if (history) {
1464
+ history.replace({
1465
+ pathName: location.pathName,
1466
+ search: "?".concat(queryName, "=").concat(encodedQuery)
1467
+ });
1468
+ } else if (navigate) {
1469
+ navigate("".concat(location.pathName, "?").concat(queryName, "=").concat(encodedQuery), {
1470
+ replace: true
1471
+ });
1472
+ }
1473
+ }, [history, navigate, propLocation, queryName, state]); // Don't need to set query on mount
1756
1474
 
1757
1475
  useUpdateEffect(function () {
1758
1476
  onSearchStateChange(state);
1759
1477
  }, [onSearchStateChange, state]);
1760
1478
  }
1761
1479
 
1762
- var _excluded$3 = ["accessId"],
1763
- _excluded2 = ["accessControlDocument"];
1480
+ var _excluded$6 = ["accessId"],
1481
+ _excluded2$2 = ["accessControlDocument"];
1482
+
1483
+ function ownKeys$d(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; }
1484
+
1485
+ function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1764
1486
 
1765
1487
  var useEntityAccess = function useEntityAccess(_ref) {
1766
1488
  var entityId = _ref.entityId,
@@ -1774,7 +1496,7 @@ var useEntityAccess = function useEntityAccess(_ref) {
1774
1496
 
1775
1497
  var onList = useCallback(function () {
1776
1498
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1777
- return listEntityAccess(_objectSpread2({
1499
+ return listEntityAccess(_objectSpread$d({
1778
1500
  entityId: entityId,
1779
1501
  entityType: entityType
1780
1502
  }, props));
@@ -1782,9 +1504,9 @@ var useEntityAccess = function useEntityAccess(_ref) {
1782
1504
  [entityId, entityType]);
1783
1505
  var onRemove = useCallback(function (_ref2) {
1784
1506
  var accessId = _ref2.accessId,
1785
- props = _objectWithoutProperties(_ref2, _excluded$3);
1507
+ props = _objectWithoutProperties(_ref2, _excluded$6);
1786
1508
 
1787
- return access.removeEntityAccess(_objectSpread2({
1509
+ return access.removeEntityAccess(_objectSpread$d({
1788
1510
  accessId: accessId,
1789
1511
  entityId: entityId,
1790
1512
  entityType: entityType
@@ -1792,9 +1514,9 @@ var useEntityAccess = function useEntityAccess(_ref) {
1792
1514
  }, [entityId, entityType]);
1793
1515
  var onAdd = useCallback(function (_ref3) {
1794
1516
  var accessControlDocument = _ref3.accessControlDocument,
1795
- props = _objectWithoutProperties(_ref3, _excluded2);
1517
+ props = _objectWithoutProperties(_ref3, _excluded2$2);
1796
1518
 
1797
- return access.createEntityAccess(_objectSpread2({
1519
+ return access.createEntityAccess(_objectSpread$d({
1798
1520
  entityType: entityType,
1799
1521
  entityId: entityId,
1800
1522
  accessControlDocument: accessControlDocument
@@ -1809,17 +1531,21 @@ var useEntityAccess = function useEntityAccess(_ref) {
1809
1531
  };
1810
1532
  };
1811
1533
 
1812
- var _excluded$4 = ["name"],
1534
+ var _excluded$5 = ["name"],
1813
1535
  _excluded2$1 = ["label"],
1814
1536
  _excluded3 = ["name", "field", "group"],
1815
1537
  _excluded4 = ["label"];
1816
1538
 
1539
+ function ownKeys$c(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; }
1540
+
1541
+ function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$c(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1542
+
1817
1543
  var getValueFromData = function getValueFromData() {
1818
1544
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1819
1545
  _ref$data = _ref.data,
1820
1546
  data = _ref$data === void 0 ? [] : _ref$data;
1821
1547
 
1822
- var key = arguments.length > 1 ? arguments[1] : undefined;
1548
+ var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
1823
1549
  if (!key) return undefined;
1824
1550
 
1825
1551
  var _ref2 = data.find(function (d) {
@@ -1910,7 +1636,7 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
1910
1636
  var fieldsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1911
1637
  return fieldsArray.map(function (_ref6) {
1912
1638
  var name = _ref6.name,
1913
- overrides = _objectWithoutProperties(_ref6, _excluded$4);
1639
+ overrides = _objectWithoutProperties(_ref6, _excluded$5);
1914
1640
 
1915
1641
  var fieldAttributes = fieldsAttributes[name] || {};
1916
1642
 
@@ -1918,7 +1644,7 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
1918
1644
  label = _getDataAttributes.label,
1919
1645
  dataAttributes = _objectWithoutProperties(_getDataAttributes, _excluded2$1);
1920
1646
 
1921
- return _objectSpread2(_objectSpread2({
1647
+ return _objectSpread$c(_objectSpread$c({
1922
1648
  name: name,
1923
1649
  label: label || name,
1924
1650
  type: fieldAttributes.type,
@@ -1946,7 +1672,7 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
1946
1672
  label = _getDataAttributes2.label,
1947
1673
  dataAttributes = _objectWithoutProperties(_getDataAttributes2, _excluded4);
1948
1674
 
1949
- return _objectSpread2(_objectSpread2({
1675
+ return _objectSpread$c(_objectSpread$c({
1950
1676
  name: name,
1951
1677
  label: label || name,
1952
1678
  order: getValueFromData(groupAttributes, 'order'),
@@ -1963,10 +1689,10 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
1963
1689
  }
1964
1690
 
1965
1691
  function _fetchAttributesAsync() {
1966
- _fetchAttributesAsync = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
1692
+ _fetchAttributesAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
1967
1693
  var fieldsAttributes, groupsAttributes, fieldPromises, queryParams, groupPromises, groupsToFetch, _queryParams;
1968
1694
 
1969
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
1695
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
1970
1696
  while (1) {
1971
1697
  switch (_context3.prev = _context3.next) {
1972
1698
  case 0:
@@ -1976,14 +1702,14 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
1976
1702
  fieldPromises = [];
1977
1703
 
1978
1704
  if (fields) {
1979
- queryParams = _objectSpread2(_objectSpread2({}, fieldQueryParams), {}, {
1705
+ queryParams = _objectSpread$c(_objectSpread$c({}, fieldQueryParams), {}, {
1980
1706
  data: fieldDataToInclude
1981
1707
  });
1982
1708
  fieldPromises = fields.map( /*#__PURE__*/function () {
1983
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref8) {
1709
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref8) {
1984
1710
  var fieldName, _yield$MetadataFieldA, data;
1985
1711
 
1986
- return regeneratorRuntime.wrap(function _callee$(_context) {
1712
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1987
1713
  while (1) {
1988
1714
  switch (_context.prev = _context.next) {
1989
1715
  case 0:
@@ -2026,14 +1752,14 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
2026
1752
 
2027
1753
  if (groups) {
2028
1754
  groupsToFetch = _toConsumableArray(groups);
2029
- _queryParams = _objectSpread2(_objectSpread2({}, groupQueryParams), {}, {
1755
+ _queryParams = _objectSpread$c(_objectSpread$c({}, groupQueryParams), {}, {
2030
1756
  data: groupDataToInclude
2031
1757
  });
2032
1758
  groupPromises = groupsToFetch.map( /*#__PURE__*/function () {
2033
- var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref10) {
1759
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref10) {
2034
1760
  var groupName, _yield$FieldGroupApi$, data, _data$field, field, _data$group, group;
2035
1761
 
2036
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
1762
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
2037
1763
  while (1) {
2038
1764
  switch (_context2.prev = _context2.next) {
2039
1765
  case 0:
@@ -2056,7 +1782,7 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
2056
1782
 
2057
1783
  if (dataValues) {
2058
1784
  var jsonValues = convertValuesXmlToJson(dataValues.value);
2059
- fieldsAttributes[f.name] = _objectSpread2(_objectSpread2({}, f), {}, {
1785
+ fieldsAttributes[f.name] = _objectSpread$c(_objectSpread$c({}, f), {}, {
2060
1786
  values: jsonValues
2061
1787
  });
2062
1788
  }
@@ -2144,11 +1870,15 @@ var useAddMetadataFieldAttributes = function useAddMetadataFieldAttributes(_ref5
2144
1870
  };
2145
1871
  };
2146
1872
 
2147
- var _excluded$5 = ["setItemSearchDocument"];
1873
+ var _excluded$4 = ["setItemSearchDocument"];
2148
1874
 
2149
- var UPDATE_FREQUENCY = 1000; // Prevents access controls set on the library (i.e. saved search) from cascading down to items
1875
+ function ownKeys$b(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; }
2150
1876
 
2151
- var UPDATE_MODE = 'TRANSIENT';
1877
+ function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$b(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1878
+
1879
+ var UPDATE_FREQUENCY$1 = 1000; // Prevents access controls set on the library (i.e. saved search) from cascading down to items
1880
+
1881
+ var UPDATE_MODE$1 = 'TRANSIENT';
2152
1882
 
2153
1883
  function saveSearch(_ref) {
2154
1884
  var metadata = _ref.metadata,
@@ -2158,15 +1888,15 @@ function saveSearch(_ref) {
2158
1888
  return item.searchItem({
2159
1889
  queryParams: {
2160
1890
  result: 'library',
2161
- updateMode: UPDATE_MODE,
2162
- updateFrequency: UPDATE_FREQUENCY
1891
+ updateMode: UPDATE_MODE$1,
1892
+ updateFrequency: UPDATE_FREQUENCY$1
2163
1893
  },
2164
1894
  itemSearchDocument: itemSearchDocument
2165
1895
  }).then(function (_ref2) {
2166
1896
  var library = _ref2.data.library;
2167
1897
  return collection.createCollection({
2168
1898
  collectionDocument: {
2169
- metadata: markerField ? createMetadataType(_objectSpread2(_defineProperty({}, markerField, markerValue || library), metadata)) : metadata,
1899
+ metadata: markerField ? createMetadataType(_objectSpread$b(_defineProperty({}, markerField, markerValue || library), metadata)) : metadata,
2170
1900
  content: [{
2171
1901
  id: library,
2172
1902
  type: 'library'
@@ -2179,7 +1909,7 @@ function saveSearch(_ref) {
2179
1909
  var getLibraryFromCollection = function getLibraryFromCollection(_ref3) {
2180
1910
  var collectionId = _ref3.collectionId;
2181
1911
  return new Promise(function (resolve, reject) {
2182
- return collection.getCollection({
1912
+ collection.getCollection({
2183
1913
  collectionId: collectionId,
2184
1914
  queryParams: {
2185
1915
  children: 'library'
@@ -2215,7 +1945,7 @@ var deleteSearch = function deleteSearch(_ref5) {
2215
1945
  function getLibrarySettings(_ref7) {
2216
1946
  var libraryId = _ref7.libraryId;
2217
1947
  return new Promise(function (resolve) {
2218
- return library.getLibrarySettings({
1948
+ library.getLibrarySettings({
2219
1949
  libraryId: libraryId
2220
1950
  }).then(function (_ref8) {
2221
1951
  var query = _ref8.data.query;
@@ -2227,7 +1957,7 @@ function getLibrarySettings(_ref7) {
2227
1957
  var getSavedSearchSettings = function getSavedSearchSettings(_ref9) {
2228
1958
  var collectionId = _ref9.collectionId;
2229
1959
  return new Promise(function (resolve) {
2230
- return getLibraryFromCollection({
1960
+ getLibraryFromCollection({
2231
1961
  collectionId: collectionId
2232
1962
  }).then(function (_ref10) {
2233
1963
  var libraryId = _ref10.id;
@@ -2263,7 +1993,7 @@ function useSavedSearch(_ref11) {
2263
1993
 
2264
1994
  var mergeMarkerField = function mergeMarkerField() {
2265
1995
  var itemSearchDocument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2266
- return _objectSpread2(_objectSpread2({}, itemSearchDocument), {}, {
1996
+ return _objectSpread$b(_objectSpread$b({}, itemSearchDocument), {}, {
2267
1997
  operator: {
2268
1998
  field: [{
2269
1999
  name: markerField,
@@ -2277,19 +2007,19 @@ function useSavedSearch(_ref11) {
2277
2007
  });
2278
2008
  };
2279
2009
 
2280
- var searchProps = useSearch(_objectSpread2(_objectSpread2({}, initialSearchState), {}, {
2010
+ var searchProps = useSearch(_objectSpread$b(_objectSpread$b({}, initialSearchState), {}, {
2281
2011
  itemSearchDocument: mergeMarkerField()
2282
2012
  }));
2283
2013
 
2284
2014
  var _setItemSearchDocument = searchProps.setItemSearchDocument,
2285
- props = _objectWithoutProperties(searchProps, _excluded$5);
2015
+ props = _objectWithoutProperties(searchProps, _excluded$4);
2286
2016
 
2287
2017
  return {
2288
2018
  onSaveSearch: saveSearchWithMarker,
2289
2019
  onDeleteSearch: onDeleteSearch,
2290
2020
  onUpdateSearchMetadata: onUpdateSearchMetadata,
2291
2021
  onGetSavedSearchSettings: onGetSavedSearchSettings,
2292
- searchProps: _objectSpread2({
2022
+ searchProps: _objectSpread$b({
2293
2023
  setItemSearchDocument: function setItemSearchDocument(itemSearchDocument) {
2294
2024
  return _setItemSearchDocument(mergeMarkerField(itemSearchDocument));
2295
2025
  }
@@ -2353,7 +2083,7 @@ var useMouseDownPosition = function useMouseDownPosition() {
2353
2083
  return position;
2354
2084
  };
2355
2085
 
2356
- function useGetCollection(_ref) {
2086
+ function useGetCollection$1(_ref) {
2357
2087
  var collectionId = _ref.collectionId,
2358
2088
  _ref$queryParams = _ref.queryParams,
2359
2089
  queryParams = _ref$queryParams === void 0 ? {} : _ref$queryParams,
@@ -2385,7 +2115,7 @@ function useGetCollection(_ref) {
2385
2115
  };
2386
2116
  }
2387
2117
 
2388
- function useGetCollection$1(_ref) {
2118
+ function useGetCollection(_ref) {
2389
2119
  var collectionId = _ref.collectionId,
2390
2120
  _ref$queryParams = _ref.queryParams,
2391
2121
  queryParams = _ref$queryParams === void 0 ? {} : _ref$queryParams,
@@ -2413,7 +2143,19 @@ function useGetCollection$1(_ref) {
2413
2143
  };
2414
2144
  }
2415
2145
 
2416
- var _excluded$6 = ["request", "data"];
2146
+ var _excluded$3 = ["request", "data"];
2147
+
2148
+ function ownKeys$a(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; }
2149
+
2150
+ function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$a(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2151
+ /**
2152
+ * Get Entity by id and type
2153
+ * @param {Object} object - Entity information object
2154
+ * @param {string} object.entityId - Entity id
2155
+ * @param {string} object.entityType - Entity type, ["item", "collection", "library"]
2156
+ * @throws Throws error if unsupported type
2157
+ * @returns {Object} Entity retrieved from VS
2158
+ */
2417
2159
 
2418
2160
  var useGetEntity = function useGetEntity(_ref) {
2419
2161
  var _objectSpread3;
@@ -2444,20 +2186,23 @@ var useGetEntity = function useGetEntity(_ref) {
2444
2186
  break;
2445
2187
 
2446
2188
  default:
2447
- throw new Error("unknown entityType}");
2189
+ throw new Error("unknown entityType");
2448
2190
  }
2449
2191
 
2450
2192
  var _useApi = useApi(entityApi),
2451
2193
  request = _useApi.request,
2452
2194
  data = _useApi.data,
2453
- apiProps = _objectWithoutProperties(_useApi, _excluded$6);
2195
+ apiProps = _objectWithoutProperties(_useApi, _excluded$3);
2454
2196
 
2455
2197
  var onGetEntity = React.useCallback(function (props) {
2456
- return request(_objectSpread2(_defineProperty({}, entityTypeId, entityId), props));
2198
+ return request(_objectSpread$a(_defineProperty({}, entityTypeId, entityId), props));
2457
2199
  }, [entityId, entityTypeId, request]);
2458
- return _objectSpread2((_objectSpread3 = {}, _defineProperty(_objectSpread3, dataType, data), _defineProperty(_objectSpread3, entityTypeId, entityId), _defineProperty(_objectSpread3, "onGetEntity", onGetEntity), _objectSpread3), apiProps);
2200
+ return _objectSpread$a((_objectSpread3 = {}, _defineProperty(_objectSpread3, dataType, data), _defineProperty(_objectSpread3, entityTypeId, entityId), _defineProperty(_objectSpread3, "onGetEntity", onGetEntity), _objectSpread3), apiProps);
2459
2201
  };
2460
2202
 
2203
+ function ownKeys$9(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; }
2204
+
2205
+ function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2461
2206
  function useUser(initialState) {
2462
2207
  var _useApi = useApi(user.getUser, {
2463
2208
  data: initialState
@@ -2526,20 +2271,20 @@ function useUser(initialState) {
2526
2271
 
2527
2272
  return user.disableUser({
2528
2273
  userName: userName,
2529
- queryParams: _objectSpread2({
2274
+ queryParams: _objectSpread$9({
2530
2275
  hard: true
2531
2276
  }, queryParams)
2532
2277
  });
2533
2278
  };
2534
2279
 
2535
2280
  var disableUser = function disableUser(args) {
2536
- return user.disableUser(_objectSpread2({
2281
+ return user.disableUser(_objectSpread$9({
2537
2282
  userName: userName
2538
2283
  }, args)).then(getUser);
2539
2284
  };
2540
2285
 
2541
2286
  var enableUser = function enableUser(args) {
2542
- return user.enableUser(_objectSpread2({
2287
+ return user.enableUser(_objectSpread$9({
2543
2288
  userName: userName
2544
2289
  }, args)).then(getUser);
2545
2290
  };
@@ -2557,18 +2302,21 @@ function useUser(initialState) {
2557
2302
  };
2558
2303
  }
2559
2304
 
2560
- var CHANGE_PAGE$2 = 'CHANGE_PAGE';
2561
- var CHANGE_ROWS$2 = 'CHANGE_ROWS';
2562
- var CHANGE_SORT$2 = 'CHANGE_SORT';
2563
- var CHANGE_QUERY = 'CHANGE_QUERY';
2564
- var ACTION_TYPE$2 = {
2565
- CHANGE_PAGE: CHANGE_PAGE$2,
2566
- CHANGE_ROWS: CHANGE_ROWS$2,
2567
- CHANGE_SORT: CHANGE_SORT$2,
2568
- CHANGE_QUERY: CHANGE_QUERY
2305
+ 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; }
2306
+
2307
+ 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(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; }
2308
+ var CHANGE_PAGE$1 = 'CHANGE_PAGE';
2309
+ var CHANGE_ROWS$1 = 'CHANGE_ROWS';
2310
+ var CHANGE_SORT$1 = 'CHANGE_SORT';
2311
+ var CHANGE_QUERY$1 = 'CHANGE_QUERY';
2312
+ var ACTION_TYPE$1 = {
2313
+ CHANGE_PAGE: CHANGE_PAGE$1,
2314
+ CHANGE_ROWS: CHANGE_ROWS$1,
2315
+ CHANGE_SORT: CHANGE_SORT$1,
2316
+ CHANGE_QUERY: CHANGE_QUERY$1
2569
2317
  };
2570
2318
 
2571
- var setInitialDefaultState$3 = function setInitialDefaultState() {
2319
+ var setInitialDefaultState$1 = function setInitialDefaultState() {
2572
2320
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2573
2321
  _ref$queryParams = _ref.queryParams,
2574
2322
  queryParams = _ref$queryParams === void 0 ? {} : _ref$queryParams,
@@ -2578,7 +2326,7 @@ var setInitialDefaultState$3 = function setInitialDefaultState() {
2578
2326
  page = _ref$page === void 0 ? 0 : _ref$page;
2579
2327
 
2580
2328
  return {
2581
- queryParams: _objectSpread2({
2329
+ queryParams: _objectSpread$8({
2582
2330
  first: page * rowsPerPage + 1,
2583
2331
  number: rowsPerPage
2584
2332
  }, queryParams),
@@ -2593,45 +2341,45 @@ var setInitialDefaultState$3 = function setInitialDefaultState() {
2593
2341
  };
2594
2342
  };
2595
2343
 
2596
- var searchReducer$2 = function searchReducer(state, action) {
2344
+ var searchReducer$1 = function searchReducer(state, action) {
2597
2345
  var type = action.type;
2598
2346
 
2599
2347
  switch (type) {
2600
- case ACTION_TYPE$2.CHANGE_PAGE:
2348
+ case ACTION_TYPE$1.CHANGE_PAGE:
2601
2349
  {
2602
2350
  var page = action.page;
2603
- return _objectSpread2(_objectSpread2({}, state), {}, {
2351
+ return _objectSpread$8(_objectSpread$8({}, state), {}, {
2604
2352
  page: page,
2605
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2353
+ queryParams: _objectSpread$8(_objectSpread$8({}, state.queryParams), {}, {
2606
2354
  first: page * state.rowsPerPage + 1
2607
2355
  })
2608
2356
  });
2609
2357
  }
2610
2358
 
2611
- case ACTION_TYPE$2.CHANGE_ROWS:
2359
+ case ACTION_TYPE$1.CHANGE_ROWS:
2612
2360
  {
2613
2361
  var rowsPerPage = action.rowsPerPage;
2614
- return _objectSpread2(_objectSpread2({}, state), {}, {
2362
+ return _objectSpread$8(_objectSpread$8({}, state), {}, {
2615
2363
  rowsPerPage: rowsPerPage,
2616
2364
  page: 0,
2617
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2365
+ queryParams: _objectSpread$8(_objectSpread$8({}, state.queryParams), {}, {
2618
2366
  first: 1,
2619
2367
  number: rowsPerPage
2620
2368
  })
2621
2369
  });
2622
2370
  }
2623
2371
 
2624
- case ACTION_TYPE$2.CHANGE_QUERY:
2372
+ case ACTION_TYPE$1.CHANGE_QUERY:
2625
2373
  {
2626
- return _objectSpread2(_objectSpread2({}, state), {}, {
2374
+ return _objectSpread$8(_objectSpread$8({}, state), {}, {
2627
2375
  page: 0,
2628
- userSearchDocument: _objectSpread2(_objectSpread2({}, state.userSearchDocument), {}, {
2376
+ userSearchDocument: _objectSpread$8(_objectSpread$8({}, state.userSearchDocument), {}, {
2629
2377
  field: [{
2630
2378
  name: action.field || 'username',
2631
2379
  value: action.query || ''
2632
2380
  }]
2633
2381
  }),
2634
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2382
+ queryParams: _objectSpread$8(_objectSpread$8({}, state.queryParams), {}, {
2635
2383
  first: 1
2636
2384
  })
2637
2385
  });
@@ -2643,9 +2391,9 @@ var searchReducer$2 = function searchReducer(state, action) {
2643
2391
  };
2644
2392
 
2645
2393
  function useSearchUser(initialState) {
2646
- var initialDefaultState = setInitialDefaultState$3(initialState);
2394
+ var initialDefaultState = setInitialDefaultState$1(initialState);
2647
2395
 
2648
- var _React$useReducer = React.useReducer(searchReducer$2, initialDefaultState),
2396
+ var _React$useReducer = React.useReducer(searchReducer$1, initialDefaultState),
2649
2397
  _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
2650
2398
  state = _React$useReducer2[0],
2651
2399
  dispatch = _React$useReducer2[1];
@@ -2672,7 +2420,7 @@ function useSearchUser(initialState) {
2672
2420
  rowsPerPage = _ref2.target.value;
2673
2421
 
2674
2422
  return dispatch({
2675
- type: ACTION_TYPE$2.CHANGE_ROWS,
2423
+ type: ACTION_TYPE$1.CHANGE_ROWS,
2676
2424
  rowsPerPage: rowsPerPage
2677
2425
  });
2678
2426
  };
@@ -2680,7 +2428,7 @@ function useSearchUser(initialState) {
2680
2428
  var onChangePage = function onChangePage(_ref3) {
2681
2429
  var page = _ref3.page;
2682
2430
  return dispatch({
2683
- type: ACTION_TYPE$2.CHANGE_PAGE,
2431
+ type: ACTION_TYPE$1.CHANGE_PAGE,
2684
2432
  page: page
2685
2433
  });
2686
2434
  };
@@ -2688,7 +2436,7 @@ function useSearchUser(initialState) {
2688
2436
  var onChangeSort = function onChangeSort(event, field, order) {
2689
2437
  var fieldName = _typeof(field) === 'object' ? field.value : field;
2690
2438
  dispatch({
2691
- type: ACTION_TYPE$2.CHANGE_SORT,
2439
+ type: ACTION_TYPE$1.CHANGE_SORT,
2692
2440
  field: fieldName,
2693
2441
  order: order
2694
2442
  });
@@ -2696,13 +2444,13 @@ function useSearchUser(initialState) {
2696
2444
 
2697
2445
  var onChangeQuery = function onChangeQuery(field, query) {
2698
2446
  dispatch({
2699
- type: ACTION_TYPE$2.CHANGE_QUERY,
2447
+ type: ACTION_TYPE$1.CHANGE_QUERY,
2700
2448
  field: field,
2701
2449
  query: query
2702
2450
  });
2703
2451
  };
2704
2452
 
2705
- return _objectSpread2(_objectSpread2({}, state), {}, {
2453
+ return _objectSpread$8(_objectSpread$8({}, state), {}, {
2706
2454
  hasLoaded: hasLoaded,
2707
2455
  isError: isError,
2708
2456
  userListDocument: userListDocument,
@@ -2756,20 +2504,23 @@ var useListUser = function useListUser(args) {
2756
2504
  };
2757
2505
  };
2758
2506
 
2759
- var CHANGE_PAGE$3 = 'CHANGE_PAGE';
2760
- var CHANGE_ROWS$3 = 'CHANGE_ROWS';
2761
- var CHANGE_SORT$3 = 'CHANGE_SORT';
2762
- var CHANGE_QUERY$1 = 'CHANGE_QUERY';
2507
+ 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; }
2508
+
2509
+ 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(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; }
2510
+ var CHANGE_PAGE = 'CHANGE_PAGE';
2511
+ var CHANGE_ROWS = 'CHANGE_ROWS';
2512
+ var CHANGE_SORT = 'CHANGE_SORT';
2513
+ var CHANGE_QUERY = 'CHANGE_QUERY';
2763
2514
  var HIDE_ROLES = 'HIDE_ROLES';
2764
- var ACTION_TYPE$3 = {
2765
- CHANGE_PAGE: CHANGE_PAGE$3,
2766
- CHANGE_ROWS: CHANGE_ROWS$3,
2767
- CHANGE_SORT: CHANGE_SORT$3,
2768
- CHANGE_QUERY: CHANGE_QUERY$1,
2515
+ var ACTION_TYPE = {
2516
+ CHANGE_PAGE: CHANGE_PAGE,
2517
+ CHANGE_ROWS: CHANGE_ROWS,
2518
+ CHANGE_SORT: CHANGE_SORT,
2519
+ CHANGE_QUERY: CHANGE_QUERY,
2769
2520
  HIDE_ROLES: HIDE_ROLES
2770
2521
  };
2771
2522
 
2772
- var setInitialDefaultState$4 = function setInitialDefaultState() {
2523
+ var setInitialDefaultState = function setInitialDefaultState() {
2773
2524
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2774
2525
  _ref$queryParams = _ref.queryParams,
2775
2526
  queryParams = _ref$queryParams === void 0 ? {} : _ref$queryParams,
@@ -2779,7 +2530,7 @@ var setInitialDefaultState$4 = function setInitialDefaultState() {
2779
2530
  page = _ref$page === void 0 ? 0 : _ref$page;
2780
2531
 
2781
2532
  return {
2782
- queryParams: _objectSpread2({
2533
+ queryParams: _objectSpread$7({
2783
2534
  first: page * rowsPerPage + 1,
2784
2535
  number: rowsPerPage
2785
2536
  }, queryParams),
@@ -2789,58 +2540,58 @@ var setInitialDefaultState$4 = function setInitialDefaultState() {
2789
2540
  };
2790
2541
  };
2791
2542
 
2792
- var searchReducer$3 = function searchReducer(state, action) {
2543
+ var searchReducer = function searchReducer(state, action) {
2793
2544
  var type = action.type;
2794
2545
 
2795
2546
  switch (type) {
2796
- case ACTION_TYPE$3.CHANGE_PAGE:
2547
+ case ACTION_TYPE.CHANGE_PAGE:
2797
2548
  {
2798
2549
  var page = action.page;
2799
- return _objectSpread2(_objectSpread2({}, state), {}, {
2550
+ return _objectSpread$7(_objectSpread$7({}, state), {}, {
2800
2551
  page: page,
2801
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2552
+ queryParams: _objectSpread$7(_objectSpread$7({}, state.queryParams), {}, {
2802
2553
  first: page * state.rowsPerPage + 1
2803
2554
  })
2804
2555
  });
2805
2556
  }
2806
2557
 
2807
- case ACTION_TYPE$3.CHANGE_ROWS:
2558
+ case ACTION_TYPE.CHANGE_ROWS:
2808
2559
  {
2809
2560
  var rowsPerPage = action.rowsPerPage;
2810
- return _objectSpread2(_objectSpread2({}, state), {}, {
2561
+ return _objectSpread$7(_objectSpread$7({}, state), {}, {
2811
2562
  rowsPerPage: rowsPerPage,
2812
2563
  page: 0,
2813
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2564
+ queryParams: _objectSpread$7(_objectSpread$7({}, state.queryParams), {}, {
2814
2565
  first: 1,
2815
2566
  number: rowsPerPage
2816
2567
  })
2817
2568
  });
2818
2569
  }
2819
2570
 
2820
- case ACTION_TYPE$3.HIDE_ROLES:
2571
+ case ACTION_TYPE.HIDE_ROLES:
2821
2572
  {
2822
2573
  var hideRoles = action.hideRoles;
2823
2574
  var role = hideRoles === true ? false : undefined;
2824
- return _objectSpread2(_objectSpread2({}, state), {}, {
2575
+ return _objectSpread$7(_objectSpread$7({}, state), {}, {
2825
2576
  page: 0,
2826
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2577
+ queryParams: _objectSpread$7(_objectSpread$7({}, state.queryParams), {}, {
2827
2578
  first: 1,
2828
2579
  role: role
2829
2580
  })
2830
2581
  });
2831
2582
  }
2832
2583
 
2833
- case ACTION_TYPE$3.CHANGE_QUERY:
2584
+ case ACTION_TYPE.CHANGE_QUERY:
2834
2585
  {
2835
- return _objectSpread2(_objectSpread2({}, state), {}, {
2586
+ return _objectSpread$7(_objectSpread$7({}, state), {}, {
2836
2587
  page: 0,
2837
- groupSearchDocument: _objectSpread2(_objectSpread2({}, state.groupSearchDocument), {}, {
2588
+ groupSearchDocument: _objectSpread$7(_objectSpread$7({}, state.groupSearchDocument), {}, {
2838
2589
  field: [{
2839
2590
  name: action.field || 'groupname',
2840
2591
  value: action.query || ''
2841
2592
  }]
2842
2593
  }),
2843
- queryParams: _objectSpread2(_objectSpread2({}, state.queryParams), {}, {
2594
+ queryParams: _objectSpread$7(_objectSpread$7({}, state.queryParams), {}, {
2844
2595
  first: 1
2845
2596
  })
2846
2597
  });
@@ -2852,9 +2603,9 @@ var searchReducer$3 = function searchReducer(state, action) {
2852
2603
  };
2853
2604
 
2854
2605
  function useSearchGroup(initialState) {
2855
- var initialDefaultState = setInitialDefaultState$4(initialState);
2606
+ var initialDefaultState = setInitialDefaultState(initialState);
2856
2607
 
2857
- var _React$useReducer = React.useReducer(searchReducer$3, initialDefaultState),
2608
+ var _React$useReducer = React.useReducer(searchReducer, initialDefaultState),
2858
2609
  _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
2859
2610
  state = _React$useReducer2[0],
2860
2611
  dispatch = _React$useReducer2[1];
@@ -2881,7 +2632,7 @@ function useSearchGroup(initialState) {
2881
2632
  rowsPerPage = _ref2.target.value;
2882
2633
 
2883
2634
  return dispatch({
2884
- type: ACTION_TYPE$3.CHANGE_ROWS,
2635
+ type: ACTION_TYPE.CHANGE_ROWS,
2885
2636
  rowsPerPage: rowsPerPage
2886
2637
  });
2887
2638
  };
@@ -2889,7 +2640,7 @@ function useSearchGroup(initialState) {
2889
2640
  var onChangePage = function onChangePage(_ref3) {
2890
2641
  var page = _ref3.page;
2891
2642
  return dispatch({
2892
- type: ACTION_TYPE$3.CHANGE_PAGE,
2643
+ type: ACTION_TYPE.CHANGE_PAGE,
2893
2644
  page: page
2894
2645
  });
2895
2646
  };
@@ -2897,7 +2648,7 @@ function useSearchGroup(initialState) {
2897
2648
  var onHideRoles = function onHideRoles(_ref4) {
2898
2649
  var hideRoles = _ref4.hideRoles;
2899
2650
  return dispatch({
2900
- type: ACTION_TYPE$3.HIDE_ROLES,
2651
+ type: ACTION_TYPE.HIDE_ROLES,
2901
2652
  hideRoles: hideRoles
2902
2653
  });
2903
2654
  };
@@ -2905,7 +2656,7 @@ function useSearchGroup(initialState) {
2905
2656
  var onChangeSort = function onChangeSort(event, field, order) {
2906
2657
  var fieldName = _typeof(field) === 'object' ? field.value : field;
2907
2658
  dispatch({
2908
- type: ACTION_TYPE$3.CHANGE_SORT,
2659
+ type: ACTION_TYPE.CHANGE_SORT,
2909
2660
  field: fieldName,
2910
2661
  order: order
2911
2662
  });
@@ -2913,13 +2664,13 @@ function useSearchGroup(initialState) {
2913
2664
 
2914
2665
  var onChangeQuery = function onChangeQuery(field, query) {
2915
2666
  dispatch({
2916
- type: ACTION_TYPE$3.CHANGE_QUERY,
2667
+ type: ACTION_TYPE.CHANGE_QUERY,
2917
2668
  field: field,
2918
2669
  query: query
2919
2670
  });
2920
2671
  };
2921
2672
 
2922
- return _objectSpread2(_objectSpread2({}, state), {}, {
2673
+ return _objectSpread$7(_objectSpread$7({}, state), {}, {
2923
2674
  hasLoaded: hasLoaded,
2924
2675
  isError: isError,
2925
2676
  groupListDocument: groupListDocument,
@@ -3213,10 +2964,39 @@ var useCollectionAutoPlay = function useCollectionAutoPlay(_ref) {
3213
2964
  };
3214
2965
  };
3215
2966
 
2967
+ var defaultGetThumbnailTimeCodes = function defaultGetThumbnailTimeCodes(srcList) {
2968
+ var timeCodes = [];
2969
+
2970
+ for (var index = 0; index < srcList.length; index += 1) {
2971
+ var uri = srcList[index];
2972
+
2973
+ if (uri && typeof uri === 'string') {
2974
+ try {
2975
+ var timeCodeFromURI = uri.split('version')[1].split('/')[1].split('?')[0];
2976
+ var timecodeText = formatTimeCodeText(timeCodeFromURI);
2977
+ timeCodes.push(timecodeText);
2978
+ } catch (error) {// ignore
2979
+ }
2980
+ }
2981
+ }
2982
+
2983
+ return timeCodes;
2984
+ };
2985
+ /**
2986
+ * Display timecode correlating to mouse position when hovering over an element
2987
+ * @param {string[]} srcList - List of image/thumbnail urls.
2988
+ * @param {number} customOffset=0 - Add custom offset for the mouse position.
2989
+ * @param {number} durationSeconds - Total duration in seconds (of clip) that the thumbnails are scrubbed over.
2990
+ * @param {function} getThumbnailTimeCodes - Extracts timecodes from VidiCore thumbnail uris. Override for custom thumbnails.
2991
+ * @returns {Object}
2992
+ */
2993
+
2994
+
3216
2995
  function useHoverScrub() {
3217
2996
  var srcList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3218
2997
  var customOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3219
- var durationSeconds = arguments.length > 2 ? arguments[2] : undefined;
2998
+ var durationSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
2999
+ var getThumbnailTimeCodes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGetThumbnailTimeCodes;
3220
3000
 
3221
3001
  var _React$useState = React.useState(0),
3222
3002
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -3248,57 +3028,75 @@ function useHoverScrub() {
3248
3028
  thumbnailWidth = _React$useState12[0],
3249
3029
  setThumbnailWidth = _React$useState12[1];
3250
3030
 
3251
- var getInnerLeft = useCallback(function (e) {
3252
- var left = e.clientX - e.currentTarget.offsetLeft - customOffset;
3031
+ var debouncedSetNewThumbnail = React.useRef(_debounce(function (val) {
3032
+ setThumbnailIndex(val);
3033
+ }, 10)).current;
3034
+
3035
+ var getOffsetLeft = function getOffsetLeft(element) {
3036
+ try {
3037
+ return Math.round(element.getBoundingClientRect().left);
3038
+ } catch (error) {
3039
+ return 0;
3040
+ }
3041
+ };
3042
+
3043
+ var getMouseElementPosition = React.useCallback(function (e) {
3044
+ var mouseElementPosition = e.clientX - getOffsetLeft(e.currentTarget) - customOffset;
3045
+ var elementWidth = e.currentTarget.offsetWidth;
3253
3046
 
3254
- if (left < 0) {
3047
+ if (mouseElementPosition < 0) {
3255
3048
  return 0;
3256
3049
  }
3257
3050
 
3258
- if (left > e.currentTarget.offsetWidth) {
3259
- return e.currentTarget.offsetWidth;
3051
+ if (mouseElementPosition > elementWidth) {
3052
+ return elementWidth;
3260
3053
  }
3261
3054
 
3262
- return left;
3055
+ return mouseElementPosition;
3263
3056
  }, [customOffset]);
3264
3057
 
3265
- var onMouseMove = function onMouseMove(e) {
3266
- if (durationSeconds) {
3267
- var innerLeft = getInnerLeft(e);
3268
- setScrubPosition(innerLeft - 1);
3269
- setThumbnailWidth(e.currentTarget.offsetWidth);
3270
- var pxToSec = e.currentTarget.offsetWidth / +durationSeconds;
3271
- var pxAsTimeCode = innerLeft / pxToSec;
3272
- setThumbnailTimeCode(formatSeconds(pxAsTimeCode));
3273
-
3274
- for (var index = 0; index < thumbnailTimeCodeArray.length; index += 1) {
3275
- var timeCode = thumbnailTimeCodeArray[index];
3276
- var nextTimeCode = thumbnailTimeCodeArray[index + 1] || thumbnailTimeCodeArray[thumbnailTimeCodeArray.length - 1];
3277
-
3278
- if (timeCode && nextTimeCode && timeCode.toSeconds().toFixed(0) <= pxAsTimeCode && nextTimeCode.toSeconds().toFixed(0) >= pxAsTimeCode) {
3279
- setThumbnailIndex(index);
3280
- }
3058
+ var indexOfPrecededTimeCode = function indexOfPrecededTimeCode(num, arr) {
3059
+ var curr = arr[0];
3060
+ var diff = Math.abs(num - curr);
3061
+ var index = 0;
3062
+
3063
+ for (var val = 0; val < arr.length; val += 1) {
3064
+ var newDiff = Math.abs(num - arr[val]);
3065
+ var isPositiveDiff = num - arr[val] > 0;
3066
+
3067
+ if (newDiff < diff && isPositiveDiff) {
3068
+ diff = newDiff;
3069
+ curr = arr[val];
3070
+ index = val;
3281
3071
  }
3282
3072
  }
3073
+
3074
+ return index;
3283
3075
  };
3284
3076
 
3285
- useDeepCompareEffect(function () {
3286
- var timeCodes = [];
3077
+ var onMouseMove = function onMouseMove(e) {
3078
+ if (durationSeconds) {
3079
+ var mouseElementPosition = getMouseElementPosition(e);
3080
+ setScrubPosition(mouseElementPosition - 1);
3287
3081
 
3288
- for (var index = 0; index < srcList.length; index += 1) {
3289
- var uri = srcList[index];
3082
+ if (thumbnailWidth !== e.currentTarget.offsetWidth) {
3083
+ setThumbnailWidth(e.currentTarget.offsetWidth);
3084
+ }
3290
3085
 
3291
- if (uri && typeof uri === 'string') {
3292
- try {
3293
- var timeCodeFromURI = uri.split('version')[1].split('/')[1].split('?')[0];
3294
- var timecodeText = formatTimeCodeText(timeCodeFromURI);
3295
- timeCodes.push(timecodeText);
3296
- } catch (error) {
3297
- return;
3298
- }
3086
+ var mouseTimecodePosition = mouseElementPosition / (e.currentTarget.offsetWidth / +durationSeconds);
3087
+ setThumbnailTimeCode(formatSeconds(mouseTimecodePosition));
3088
+ var newIndex = indexOfPrecededTimeCode(mouseTimecodePosition, thumbnailTimeCodeArray.map(function (tc) {
3089
+ return tc.toSeconds().toFixed(0);
3090
+ }));
3091
+
3092
+ if (newIndex !== thumbnailIndex) {
3093
+ debouncedSetNewThumbnail(newIndex);
3299
3094
  }
3300
3095
  }
3096
+ };
3301
3097
 
3098
+ useDeepCompareEffect(function () {
3099
+ var timeCodes = getThumbnailTimeCodes(srcList);
3302
3100
  setThumbnailTimeCodeArray(timeCodes);
3303
3101
  }, [srcList]);
3304
3102
 
@@ -3321,6 +3119,9 @@ function useHoverScrub() {
3321
3119
  };
3322
3120
  }
3323
3121
 
3122
+ 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; }
3123
+
3124
+ 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(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; }
3324
3125
  function useDocSearchAutocomplete(_ref) {
3325
3126
  var searchDoc = _ref.searchDoc,
3326
3127
  queryParams = _ref.queryParams,
@@ -3340,7 +3141,7 @@ function useDocSearchAutocomplete(_ref) {
3340
3141
  textValue = _React$useState2[0],
3341
3142
  setTextValue = _React$useState2[1];
3342
3143
 
3343
- var handleAutocompleteChange = React.useRef(debounce(setTextValue, debounceTime)).current;
3144
+ var handleAutocompleteChange = React.useRef(_debounce(setTextValue, debounceTime)).current;
3344
3145
 
3345
3146
  var _useApi = useApi(apiCall),
3346
3147
  _useApi$data = _useApi.data;
@@ -3357,7 +3158,7 @@ function useDocSearchAutocomplete(_ref) {
3357
3158
  useDeepCompareEffect(function () {
3358
3159
  if (searchDoc && textValue && textValue.length >= triggerLength) {
3359
3160
  request({
3360
- body: _objectSpread2(_objectSpread2({}, searchDoc), {}, {
3161
+ body: _objectSpread$6(_objectSpread$6({}, searchDoc), {}, {
3361
3162
  suggestion: suggestionSettings,
3362
3163
  autocomplete: [{
3363
3164
  text: textValue
@@ -3366,7 +3167,7 @@ function useDocSearchAutocomplete(_ref) {
3366
3167
  value: textValue
3367
3168
  }]
3368
3169
  }),
3369
- queryParams: _objectSpread2({
3170
+ queryParams: _objectSpread$6({
3370
3171
  count: false,
3371
3172
  number: 0
3372
3173
  }, queryParams)
@@ -3412,9 +3213,9 @@ function useGetFieldMetadataDataset() {
3412
3213
  };
3413
3214
  }
3414
3215
 
3415
- var UPDATE_FREQUENCY$1 = 1000; // Prevents access controls set on the library (i.e. saved search) from cascading down to items
3216
+ var UPDATE_FREQUENCY = 1000; // Prevents access controls set on the library (i.e. saved search) from cascading down to items
3416
3217
 
3417
- var UPDATE_MODE$1 = 'TRANSIENT';
3218
+ var UPDATE_MODE = 'TRANSIENT';
3418
3219
 
3419
3220
  var getCollectionTitle = function getCollectionTitle(fields) {
3420
3221
  return fields.find(function (field) {
@@ -3453,10 +3254,10 @@ function useGetSavedSearchFolders(_ref) {
3453
3254
 
3454
3255
  var getSubFolders = React.useCallback(function () {
3455
3256
  Promise.all(currentFolders.map( /*#__PURE__*/function () {
3456
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(id) {
3257
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
3457
3258
  var _yield$CollectionApi$, _yield$CollectionApi$2, content, _yield$CollectionApi$3, metadata, field;
3458
3259
 
3459
- return regeneratorRuntime.wrap(function _callee$(_context) {
3260
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
3460
3261
  while (1) {
3461
3262
  switch (_context.prev = _context.next) {
3462
3263
  case 0:
@@ -3566,8 +3367,8 @@ function useGetSavedSearchFolders(_ref) {
3566
3367
  item.searchItem({
3567
3368
  queryParams: {
3568
3369
  result: 'library',
3569
- updateMode: UPDATE_MODE$1,
3570
- updateFrequency: UPDATE_FREQUENCY$1
3370
+ updateMode: UPDATE_MODE,
3371
+ updateFrequency: UPDATE_FREQUENCY
3571
3372
  },
3572
3373
  itemSearchDocument: itemSearchDocument
3573
3374
  }).then(function (_ref5) {
@@ -3671,10 +3472,10 @@ var useRepresentativeItems = function useRepresentativeItems(_ref) {
3671
3472
  setRepresentativeItems = _React$useState2[1];
3672
3473
 
3673
3474
  var asyncGetRepresentativeItems = /*#__PURE__*/function () {
3674
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
3475
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
3675
3476
  var _yield$CollectionApi$, _yield$CollectionApi$2, metadata, _parseMetadataType, _parseMetadataType$re, newRepresentativeItems;
3676
3477
 
3677
- return regeneratorRuntime.wrap(function _callee$(_context) {
3478
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
3678
3479
  while (1) {
3679
3480
  switch (_context.prev = _context.next) {
3680
3481
  case 0:
@@ -3734,9 +3535,9 @@ var useRepresentativeItems = function useRepresentativeItems(_ref) {
3734
3535
  var onRefresh = asyncGetRepresentativeItems;
3735
3536
 
3736
3537
  var updateAsRepresentativeItem = /*#__PURE__*/function () {
3737
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
3538
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values) {
3738
3539
  var metadataDocument, response;
3739
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
3540
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
3740
3541
  while (1) {
3741
3542
  switch (_context2.prev = _context2.next) {
3742
3543
  case 0:
@@ -3813,6 +3614,10 @@ var useRepresentativeItems = function useRepresentativeItems(_ref) {
3813
3614
  };
3814
3615
  };
3815
3616
 
3617
+ 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; }
3618
+
3619
+ 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(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; }
3620
+
3816
3621
  function defaultOnGetStorage() {
3817
3622
  var storageData = storage.listStorage().then(function (response) {
3818
3623
  var storage = {
@@ -3867,7 +3672,7 @@ function defaultOnList(response, storageInfo, queryParams) {
3867
3672
  var newUri = encodeURIComponent(createNewUri());
3868
3673
  return library.getLibraryBatch({
3869
3674
  libraryId: libraryId,
3870
- queryParams: _objectSpread2({
3675
+ queryParams: _objectSpread$5({
3871
3676
  destinationUri: newUri
3872
3677
  }, queryParams)
3873
3678
  });
@@ -3967,6 +3772,9 @@ var useCsvDownload = function useCsvDownload(_ref3) {
3967
3772
  };
3968
3773
  };
3969
3774
 
3775
+ 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; }
3776
+
3777
+ 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(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; }
3970
3778
  function useCompoundMetadata(itemId, values, groups, groupFields, setGroupFields, onRefresh, onSuccess, onError) {
3971
3779
  var isFamily = function isFamily(el) {
3972
3780
  return el.hasMultipleChild;
@@ -3985,7 +3793,7 @@ function useCompoundMetadata(itemId, values, groups, groupFields, setGroupFields
3985
3793
  });
3986
3794
  var newRows = newGroups[groupIndex].group.map(function (newRow, rowIndex) {
3987
3795
  if (rowIndex === editIndex) {
3988
- return _objectSpread2(_objectSpread2({}, row), {}, _defineProperty({}, name, value));
3796
+ return _objectSpread$4(_objectSpread$4({}, row), {}, _defineProperty({}, name, value));
3989
3797
  }
3990
3798
 
3991
3799
  return newRow;
@@ -3995,9 +3803,9 @@ function useCompoundMetadata(itemId, values, groups, groupFields, setGroupFields
3995
3803
  };
3996
3804
 
3997
3805
  var onSubmit = /*#__PURE__*/function () {
3998
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data) {
3806
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
3999
3807
  var groupNames, metadataDocument, newTimeSpan, uuid, newGroups;
4000
- return regeneratorRuntime.wrap(function _callee$(_context) {
3808
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
4001
3809
  while (1) {
4002
3810
  switch (_context.prev = _context.next) {
4003
3811
  case 0:
@@ -4078,7 +3886,11 @@ function useCompoundMetadata(itemId, values, groups, groupFields, setGroupFields
4078
3886
  };
4079
3887
  }
4080
3888
 
4081
- var _excluded$7 = ["itemType", "collectionType", "joinValue", "flat", "groupAsList", "children"];
3889
+ var _excluded$2 = ["itemType", "collectionType", "joinValue", "flat", "groupAsList", "children"];
3890
+
3891
+ 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; }
3892
+
3893
+ 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(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; }
4082
3894
  function MetadataType(_ref) {
4083
3895
  var itemType = _ref.itemType,
4084
3896
  collectionType = _ref.collectionType,
@@ -4089,7 +3901,7 @@ function MetadataType(_ref) {
4089
3901
  _ref$groupAsList = _ref.groupAsList,
4090
3902
  groupAsList = _ref$groupAsList === void 0 ? true : _ref$groupAsList,
4091
3903
  children = _ref.children,
4092
- props = _objectWithoutProperties(_ref, _excluded$7);
3904
+ props = _objectWithoutProperties(_ref, _excluded$2);
4093
3905
 
4094
3906
  var entityType = itemType || collectionType || {};
4095
3907
  var metadataType = entityType.metadata;
@@ -4101,7 +3913,7 @@ function MetadataType(_ref) {
4101
3913
  });
4102
3914
  }, [flat, groupAsList, joinValue, metadataType]);
4103
3915
 
4104
- var cloneProps = _objectSpread2(_objectSpread2(_objectSpread2({}, props), metadata), {}, {
3916
+ var cloneProps = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, props), metadata), {}, {
4105
3917
  itemType: itemType
4106
3918
  });
4107
3919
 
@@ -4269,7 +4081,7 @@ function GetCollectionContent(_ref) {
4269
4081
  refreshOnMount = _ref.refreshOnMount,
4270
4082
  children = _ref.children;
4271
4083
 
4272
- var _useGetCollection = useGetCollection({
4084
+ var _useGetCollection = useGetCollection$1({
4273
4085
  collectionId: collectionId,
4274
4086
  queryParams: queryParams,
4275
4087
  refreshOnMount: refreshOnMount
@@ -4373,10 +4185,14 @@ function ListEntityAccess(_ref) {
4373
4185
  return React.Children.map(children, cloneChild);
4374
4186
  }
4375
4187
 
4188
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
4189
+
4190
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4191
+
4376
4192
  var VidispineApi = /*#__PURE__*/function (_React$Component) {
4377
4193
  _inherits(VidispineApi, _React$Component);
4378
4194
 
4379
- var _super = _createSuper(VidispineApi);
4195
+ var _super = _createSuper$1(VidispineApi);
4380
4196
 
4381
4197
  function VidispineApi(props) {
4382
4198
  var _this;
@@ -4474,11 +4290,11 @@ var VidispineApi = /*#__PURE__*/function (_React$Component) {
4474
4290
  return VidispineApi;
4475
4291
  }(React.Component);
4476
4292
 
4477
- var _excluded$8 = ["LoginComponent", "LoginProps", "AppComponent", "AppProps", "onGetToken", "onSuccess", "onError", "cookieOptions"];
4478
- var VIDISPINE_TOKEN = 'VIDISPINE-TOKEN';
4479
- var VIDISPINE_USERNAME = 'VIDISPINE-USERNAME';
4480
- var VIDISPINE_SERVER_URL = 'VIDISPINE-SERVER-URL';
4481
- var VIDISPINE_REMEMBER_ME = 'VIDISPINE-REMEMBER-ME';
4293
+ var _excluded$1 = ["LoginComponent", "LoginProps", "AppComponent", "AppProps", "onGetToken", "onSuccess", "onError", "cookieOptions"];
4294
+ var VIDISPINE_TOKEN$1 = 'VIDISPINE-TOKEN';
4295
+ var VIDISPINE_USERNAME$1 = 'VIDISPINE-USERNAME';
4296
+ var VIDISPINE_SERVER_URL$1 = 'VIDISPINE-SERVER-URL';
4297
+ var VIDISPINE_REMEMBER_ME$1 = 'VIDISPINE-REMEMBER-ME';
4482
4298
 
4483
4299
  var handleOnGetToken = function handleOnGetToken(_ref) {
4484
4300
  var userName = _ref.userName,
@@ -4540,18 +4356,18 @@ function Auth(_ref4) {
4540
4356
  maxAge: 604800,
4541
4357
  path: '/'
4542
4358
  } : _ref4$cookieOptions,
4543
- props = _objectWithoutProperties(_ref4, _excluded$8);
4359
+ props = _objectWithoutProperties(_ref4, _excluded$1);
4544
4360
 
4545
- var _useCookies = useCookies([VIDISPINE_TOKEN, VIDISPINE_USERNAME, VIDISPINE_SERVER_URL, VIDISPINE_REMEMBER_ME]),
4361
+ var _useCookies = useCookies([VIDISPINE_TOKEN$1, VIDISPINE_USERNAME$1, VIDISPINE_SERVER_URL$1, VIDISPINE_REMEMBER_ME$1]),
4546
4362
  _useCookies2 = _slicedToArray(_useCookies, 3),
4547
4363
  cookies = _useCookies2[0],
4548
4364
  setCookie = _useCookies2[1],
4549
4365
  removeCookie = _useCookies2[2];
4550
4366
 
4551
- var token = cookies[VIDISPINE_TOKEN],
4552
- userName = cookies[VIDISPINE_USERNAME],
4553
- serverUrl = cookies[VIDISPINE_SERVER_URL];
4554
- var rememberMe = cookies[VIDISPINE_REMEMBER_ME] === 'true';
4367
+ var token = cookies[VIDISPINE_TOKEN$1],
4368
+ userName = cookies[VIDISPINE_USERNAME$1],
4369
+ serverUrl = cookies[VIDISPINE_SERVER_URL$1];
4370
+ var rememberMe = cookies[VIDISPINE_REMEMBER_ME$1] === 'true';
4555
4371
 
4556
4372
  var onLogin = function onLogin(values) {
4557
4373
  var submissionError;
@@ -4561,10 +4377,10 @@ function Auth(_ref4) {
4561
4377
  var newUserName = values.userName,
4562
4378
  newServerUrl = values.serverUrl,
4563
4379
  newRememberMe = values.rememberMe;
4564
- if (newUserName) setCookie(VIDISPINE_USERNAME, newUserName, cookieOptions);
4565
- if (newServerUrl) setCookie(VIDISPINE_SERVER_URL, newServerUrl, cookieOptions);
4566
- if (newRememberMe) setCookie(VIDISPINE_REMEMBER_ME, newRememberMe, cookieOptions);
4567
- if (newToken) setCookie(VIDISPINE_TOKEN, newToken, cookieOptions);
4380
+ if (newUserName) setCookie(VIDISPINE_USERNAME$1, newUserName, cookieOptions);
4381
+ if (newServerUrl) setCookie(VIDISPINE_SERVER_URL$1, newServerUrl, cookieOptions);
4382
+ if (newRememberMe) setCookie(VIDISPINE_REMEMBER_ME$1, newRememberMe, cookieOptions);
4383
+ if (newToken) setCookie(VIDISPINE_TOKEN$1, newToken, cookieOptions);
4568
4384
  if (onSuccess) onSuccess(values);
4569
4385
  })["catch"](function (error) {
4570
4386
  submissionError = error;
@@ -4580,16 +4396,16 @@ function Auth(_ref4) {
4580
4396
  };
4581
4397
 
4582
4398
  var onLogout = function onLogout() {
4583
- removeCookie(VIDISPINE_TOKEN, cookieOptions);
4399
+ removeCookie(VIDISPINE_TOKEN$1, cookieOptions);
4584
4400
 
4585
4401
  if (!rememberMe) {
4586
- removeCookie(VIDISPINE_USERNAME, cookieOptions);
4587
- removeCookie(VIDISPINE_SERVER_URL, cookieOptions);
4588
- removeCookie(VIDISPINE_REMEMBER_ME, cookieOptions);
4402
+ removeCookie(VIDISPINE_USERNAME$1, cookieOptions);
4403
+ removeCookie(VIDISPINE_SERVER_URL$1, cookieOptions);
4404
+ removeCookie(VIDISPINE_REMEMBER_ME$1, cookieOptions);
4589
4405
  }
4590
4406
  };
4591
4407
 
4592
- return /*#__PURE__*/React.createElement(React.Fragment, null, token ? /*#__PURE__*/React.createElement(VidispineApi, {
4408
+ return token ? /*#__PURE__*/React.createElement(VidispineApi, {
4593
4409
  token: token,
4594
4410
  username: userName,
4595
4411
  serverUrl: serverUrl
@@ -4600,10 +4416,14 @@ function Auth(_ref4) {
4600
4416
  userName: userName,
4601
4417
  serverUrl: serverUrl,
4602
4418
  rememberMe: rememberMe
4603
- }, props, LoginProps)));
4419
+ }, props, LoginProps));
4604
4420
  }
4605
4421
 
4606
- var ErrorBoundaryComponent = function ErrorBoundaryComponent(_ref) {
4422
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
4423
+
4424
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4425
+
4426
+ function ErrorBoundaryComponent(_ref) {
4607
4427
  var error = _ref.error,
4608
4428
  info = _ref.info;
4609
4429
  return /*#__PURE__*/React.createElement("div", {
@@ -4616,7 +4436,7 @@ var ErrorBoundaryComponent = function ErrorBoundaryComponent(_ref) {
4616
4436
  color: 'white'
4617
4437
  }
4618
4438
  }, error && /*#__PURE__*/React.createElement("div", null, error.toString()), info && /*#__PURE__*/React.createElement("div", null, info.componentStack));
4619
- };
4439
+ }
4620
4440
 
4621
4441
  var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
4622
4442
  _inherits(ErrorBoundary, _React$Component);
@@ -4836,30 +4656,26 @@ function HasRole(_ref) {
4836
4656
  return null;
4837
4657
  }
4838
4658
 
4839
- var _excluded$9 = ["providers", "children"],
4840
- _excluded2$2 = ["provider"];
4659
+ var _excluded = ["providers", "children"],
4660
+ _excluded2 = ["provider"];
4841
4661
  function ComposeProviders(_ref) {
4842
4662
  var _ref$providers = _ref.providers,
4843
4663
  providers = _ref$providers === void 0 ? [] : _ref$providers,
4844
4664
  children = _ref.children,
4845
- props = _objectWithoutProperties(_ref, _excluded$9);
4665
+ props = _objectWithoutProperties(_ref, _excluded);
4846
4666
 
4847
4667
  return providers.reduceRight(function (acc, Provider) {
4848
4668
  if (typeof Provider === 'function') {
4849
- return /*#__PURE__*/React.createElement(Provider // eslint-disable-next-line react/jsx-props-no-spreading
4850
- , props, acc);
4669
+ return /*#__PURE__*/React.createElement(Provider, props, acc);
4851
4670
  }
4852
4671
 
4853
4672
  var ProviderComponent = Provider.provider,
4854
- providerProps = _objectWithoutProperties(Provider, _excluded2$2);
4673
+ providerProps = _objectWithoutProperties(Provider, _excluded2);
4855
4674
 
4856
- return /*#__PURE__*/React.createElement(ProviderComponent // eslint-disable-next-line react/jsx-props-no-spreading
4857
- , _extends({}, props, providerProps), acc);
4675
+ return /*#__PURE__*/React.createElement(ProviderComponent, _extends({}, props, providerProps), acc);
4858
4676
  }, children);
4859
4677
  }
4860
4678
 
4861
- /* eslint-disable react/jsx-props-no-spreading */
4862
-
4863
4679
  var withErrorBoundary = function withErrorBoundary(WrappedComponent) {
4864
4680
  var errorBoundaryProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4865
4681
  return function (props) {
@@ -4881,6 +4697,9 @@ var compose = function compose() {
4881
4697
  });
4882
4698
  };
4883
4699
 
4700
+ 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; }
4701
+
4702
+ 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(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; }
4884
4703
  var BinContext = /*#__PURE__*/React.createContext();
4885
4704
 
4886
4705
  var defaultIsUniqueBinItem = function defaultIsUniqueBinItem(bin, _ref) {
@@ -4950,7 +4769,7 @@ function BinProvider(_ref3) {
4950
4769
  allowDuplicates = _React$useState4[0],
4951
4770
  setAllowDuplicates = _React$useState4[1];
4952
4771
 
4953
- var onDelete = function onDelete(binIdToDelete) {
4772
+ var onDelete = React.useCallback(function (binIdToDelete) {
4954
4773
  if (!binIdToDelete || !['string', 'number'].includes(_typeof(binIdToDelete))) {
4955
4774
  // eslint-disable-next-line no-console
4956
4775
  console.error('BinProvider onDelete called without a binId of the entity to delete');
@@ -4964,25 +4783,23 @@ function BinProvider(_ref3) {
4964
4783
  if (onChange) onChange(newState);
4965
4784
  return newState;
4966
4785
  });
4967
- };
4968
-
4969
- var onEmptyBin = function onEmptyBin() {
4970
- var newState = [];
4971
- setBinState(newState);
4972
- if (onChange) onChange(newState);
4973
- };
4786
+ }, [onChange]);
4787
+ var onEmptyBin = React.useCallback(function () {
4788
+ setBinState([]);
4789
+ if (onChange) onChange([]);
4790
+ }, [onChange]);
4974
4791
 
4975
4792
  var createBinObject = function createBinObject(binObject) {
4976
4793
  var _uuidv4$split = uuidv4().split('-'),
4977
4794
  _uuidv4$split2 = _slicedToArray(_uuidv4$split, 1),
4978
4795
  binId = _uuidv4$split2[0];
4979
4796
 
4980
- return _objectSpread2({
4797
+ return _objectSpread$2({
4981
4798
  binId: binId
4982
4799
  }, binObject);
4983
4800
  };
4984
4801
 
4985
- var handleDrop = function handleDrop() {
4802
+ var handleDrop = React.useCallback(function () {
4986
4803
  var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4987
4804
  _ref4$dragInfo = _ref4.dragInfo,
4988
4805
  dragInfo = _ref4$dragInfo === void 0 ? {} : _ref4$dragInfo;
@@ -5006,9 +4823,8 @@ function BinProvider(_ref3) {
5006
4823
 
5007
4824
  return state;
5008
4825
  });
5009
- };
5010
-
5011
- var handleSort = function handleSort(_ref5) {
4826
+ }, [allowDuplicates, isUniqueBinItem, onChange]);
4827
+ var handleSort = React.useCallback(function (_ref5) {
5012
4828
  var dragId = _ref5.dragId,
5013
4829
  hoverId = _ref5.hoverId,
5014
4830
  originalDragIndex = _ref5.originalDragIndex;
@@ -5029,10 +4845,9 @@ function BinProvider(_ref3) {
5029
4845
  if (onChange) onChange(newState);
5030
4846
  return newState;
5031
4847
  });
5032
- };
5033
-
5034
- return /*#__PURE__*/React.createElement(BinContext.Provider, {
5035
- value: {
4848
+ }, [binState, onChange]);
4849
+ var contextValue = React.useMemo(function () {
4850
+ return {
5036
4851
  setBin: setBinState,
5037
4852
  bin: binState,
5038
4853
  allowDuplicates: allowDuplicates,
@@ -5044,89 +4859,1197 @@ function BinProvider(_ref3) {
5044
4859
  },
5045
4860
  onEmptyBin: onEmptyBin,
5046
4861
  onDelete: onDelete
5047
- }
4862
+ };
4863
+ }, [allowDuplicates, binState, handleDrop, handleSort, onDelete, onEmptyBin]);
4864
+ return /*#__PURE__*/React.createElement(BinContext.Provider, {
4865
+ value: contextValue
5048
4866
  }, children);
5049
4867
  }
5050
4868
 
5051
- var SettingsDispatchContext = /*#__PURE__*/React.createContext();
5052
- var SettingsStateContext = /*#__PURE__*/React.createContext();
5053
- var UPDATE_ALL_SETTINGS = 'UPDATE_ALL_SETTINGS';
5054
- var UPDATE_SETTING = 'UPDATE_SETTING';
5055
- var UPDATE_USERNAME = 'UPDATE_USERNAME';
5056
- var REMOVE_SETTING = 'REMOVE_SETTING';
4869
+ var propTypes = {exports: {}};
4870
+
4871
+ var reactIs = {exports: {}};
4872
+
4873
+ var reactIs_production_min = {};
4874
+
4875
+ /** @license React v16.13.1
4876
+ * react-is.production.min.js
4877
+ *
4878
+ * Copyright (c) Facebook, Inc. and its affiliates.
4879
+ *
4880
+ * This source code is licensed under the MIT license found in the
4881
+ * LICENSE file in the root directory of this source tree.
4882
+ */
4883
+ 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?
4884
+ 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;
4885
+ 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;
4886
+ 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};
4887
+ 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};
4888
+ 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;
4889
+
4890
+ var reactIs_development = {};
4891
+
4892
+ /** @license React v16.13.1
4893
+ * react-is.development.js
4894
+ *
4895
+ * Copyright (c) Facebook, Inc. and its affiliates.
4896
+ *
4897
+ * This source code is licensed under the MIT license found in the
4898
+ * LICENSE file in the root directory of this source tree.
4899
+ */
4900
+
4901
+
4902
+
4903
+ if (process.env.NODE_ENV !== "production") {
4904
+ (function() {
4905
+
4906
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
4907
+ // nor polyfill, then a plain number is used for performance.
4908
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
4909
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
4910
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
4911
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
4912
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
4913
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
4914
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
4915
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
4916
+ // (unstable) APIs that have been removed. Can we remove the symbols?
4917
+
4918
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
4919
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
4920
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
4921
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
4922
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
4923
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
4924
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
4925
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
4926
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
4927
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
4928
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
4929
+
4930
+ function isValidElementType(type) {
4931
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
4932
+ 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);
4933
+ }
5057
4934
 
5058
- var reducer = function reducer(state, action) {
5059
- switch (action.type) {
5060
- case UPDATE_USERNAME:
5061
- {
5062
- return _objectSpread2(_objectSpread2({}, state), {}, {
5063
- userName: action.userName
5064
- });
5065
- }
4935
+ function typeOf(object) {
4936
+ if (typeof object === 'object' && object !== null) {
4937
+ var $$typeof = object.$$typeof;
4938
+
4939
+ switch ($$typeof) {
4940
+ case REACT_ELEMENT_TYPE:
4941
+ var type = object.type;
4942
+
4943
+ switch (type) {
4944
+ case REACT_ASYNC_MODE_TYPE:
4945
+ case REACT_CONCURRENT_MODE_TYPE:
4946
+ case REACT_FRAGMENT_TYPE:
4947
+ case REACT_PROFILER_TYPE:
4948
+ case REACT_STRICT_MODE_TYPE:
4949
+ case REACT_SUSPENSE_TYPE:
4950
+ return type;
4951
+
4952
+ default:
4953
+ var $$typeofType = type && type.$$typeof;
4954
+
4955
+ switch ($$typeofType) {
4956
+ case REACT_CONTEXT_TYPE:
4957
+ case REACT_FORWARD_REF_TYPE:
4958
+ case REACT_LAZY_TYPE:
4959
+ case REACT_MEMO_TYPE:
4960
+ case REACT_PROVIDER_TYPE:
4961
+ return $$typeofType;
4962
+
4963
+ default:
4964
+ return $$typeof;
4965
+ }
5066
4966
 
5067
- case UPDATE_ALL_SETTINGS:
5068
- {
5069
- return _objectSpread2(_objectSpread2({}, state), {}, {
5070
- settings: action.settings
5071
- });
5072
- }
4967
+ }
5073
4968
 
5074
- case UPDATE_SETTING:
5075
- {
5076
- var settings = _objectSpread2(_objectSpread2({}, state.settings), action.setting);
4969
+ case REACT_PORTAL_TYPE:
4970
+ return $$typeof;
4971
+ }
4972
+ }
5077
4973
 
5078
- return _objectSpread2(_objectSpread2({}, state), {}, {
5079
- settings: settings
5080
- });
5081
- }
4974
+ return undefined;
4975
+ } // AsyncMode is deprecated along with isAsyncMode
4976
+
4977
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
4978
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
4979
+ var ContextConsumer = REACT_CONTEXT_TYPE;
4980
+ var ContextProvider = REACT_PROVIDER_TYPE;
4981
+ var Element = REACT_ELEMENT_TYPE;
4982
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
4983
+ var Fragment = REACT_FRAGMENT_TYPE;
4984
+ var Lazy = REACT_LAZY_TYPE;
4985
+ var Memo = REACT_MEMO_TYPE;
4986
+ var Portal = REACT_PORTAL_TYPE;
4987
+ var Profiler = REACT_PROFILER_TYPE;
4988
+ var StrictMode = REACT_STRICT_MODE_TYPE;
4989
+ var Suspense = REACT_SUSPENSE_TYPE;
4990
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
4991
+
4992
+ function isAsyncMode(object) {
4993
+ {
4994
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
4995
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
4996
+
4997
+ 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.');
4998
+ }
4999
+ }
5082
5000
 
5083
- case REMOVE_SETTING:
5084
- {
5085
- var _settings = _objectSpread2({}, state.settings);
5001
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
5002
+ }
5003
+ function isConcurrentMode(object) {
5004
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
5005
+ }
5006
+ function isContextConsumer(object) {
5007
+ return typeOf(object) === REACT_CONTEXT_TYPE;
5008
+ }
5009
+ function isContextProvider(object) {
5010
+ return typeOf(object) === REACT_PROVIDER_TYPE;
5011
+ }
5012
+ function isElement(object) {
5013
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
5014
+ }
5015
+ function isForwardRef(object) {
5016
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
5017
+ }
5018
+ function isFragment(object) {
5019
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
5020
+ }
5021
+ function isLazy(object) {
5022
+ return typeOf(object) === REACT_LAZY_TYPE;
5023
+ }
5024
+ function isMemo(object) {
5025
+ return typeOf(object) === REACT_MEMO_TYPE;
5026
+ }
5027
+ function isPortal(object) {
5028
+ return typeOf(object) === REACT_PORTAL_TYPE;
5029
+ }
5030
+ function isProfiler(object) {
5031
+ return typeOf(object) === REACT_PROFILER_TYPE;
5032
+ }
5033
+ function isStrictMode(object) {
5034
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
5035
+ }
5036
+ function isSuspense(object) {
5037
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
5038
+ }
5086
5039
 
5087
- delete _settings[action.key];
5088
- return _objectSpread2(_objectSpread2({}, state), {}, {
5089
- settings: _settings
5090
- });
5091
- }
5040
+ reactIs_development.AsyncMode = AsyncMode;
5041
+ reactIs_development.ConcurrentMode = ConcurrentMode;
5042
+ reactIs_development.ContextConsumer = ContextConsumer;
5043
+ reactIs_development.ContextProvider = ContextProvider;
5044
+ reactIs_development.Element = Element;
5045
+ reactIs_development.ForwardRef = ForwardRef;
5046
+ reactIs_development.Fragment = Fragment;
5047
+ reactIs_development.Lazy = Lazy;
5048
+ reactIs_development.Memo = Memo;
5049
+ reactIs_development.Portal = Portal;
5050
+ reactIs_development.Profiler = Profiler;
5051
+ reactIs_development.StrictMode = StrictMode;
5052
+ reactIs_development.Suspense = Suspense;
5053
+ reactIs_development.isAsyncMode = isAsyncMode;
5054
+ reactIs_development.isConcurrentMode = isConcurrentMode;
5055
+ reactIs_development.isContextConsumer = isContextConsumer;
5056
+ reactIs_development.isContextProvider = isContextProvider;
5057
+ reactIs_development.isElement = isElement;
5058
+ reactIs_development.isForwardRef = isForwardRef;
5059
+ reactIs_development.isFragment = isFragment;
5060
+ reactIs_development.isLazy = isLazy;
5061
+ reactIs_development.isMemo = isMemo;
5062
+ reactIs_development.isPortal = isPortal;
5063
+ reactIs_development.isProfiler = isProfiler;
5064
+ reactIs_development.isStrictMode = isStrictMode;
5065
+ reactIs_development.isSuspense = isSuspense;
5066
+ reactIs_development.isValidElementType = isValidElementType;
5067
+ reactIs_development.typeOf = typeOf;
5068
+ })();
5069
+ }
5092
5070
 
5093
- default:
5094
- return state;
5095
- }
5071
+ if (process.env.NODE_ENV === 'production') {
5072
+ reactIs.exports = reactIs_production_min;
5073
+ } else {
5074
+ reactIs.exports = reactIs_development;
5075
+ }
5076
+
5077
+ /*
5078
+ object-assign
5079
+ (c) Sindre Sorhus
5080
+ @license MIT
5081
+ */
5082
+ /* eslint-disable no-unused-vars */
5083
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
5084
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
5085
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
5086
+
5087
+ function toObject(val) {
5088
+ if (val === null || val === undefined) {
5089
+ throw new TypeError('Object.assign cannot be called with null or undefined');
5090
+ }
5091
+
5092
+ return Object(val);
5093
+ }
5094
+
5095
+ function shouldUseNative() {
5096
+ try {
5097
+ if (!Object.assign) {
5098
+ return false;
5099
+ }
5100
+
5101
+ // Detect buggy property enumeration order in older V8 versions.
5102
+
5103
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
5104
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
5105
+ test1[5] = 'de';
5106
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
5107
+ return false;
5108
+ }
5109
+
5110
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
5111
+ var test2 = {};
5112
+ for (var i = 0; i < 10; i++) {
5113
+ test2['_' + String.fromCharCode(i)] = i;
5114
+ }
5115
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
5116
+ return test2[n];
5117
+ });
5118
+ if (order2.join('') !== '0123456789') {
5119
+ return false;
5120
+ }
5121
+
5122
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
5123
+ var test3 = {};
5124
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
5125
+ test3[letter] = letter;
5126
+ });
5127
+ if (Object.keys(Object.assign({}, test3)).join('') !==
5128
+ 'abcdefghijklmnopqrst') {
5129
+ return false;
5130
+ }
5131
+
5132
+ return true;
5133
+ } catch (err) {
5134
+ // We don't expect any of the above to throw, but better to be safe.
5135
+ return false;
5136
+ }
5137
+ }
5138
+
5139
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
5140
+ var from;
5141
+ var to = toObject(target);
5142
+ var symbols;
5143
+
5144
+ for (var s = 1; s < arguments.length; s++) {
5145
+ from = Object(arguments[s]);
5146
+
5147
+ for (var key in from) {
5148
+ if (hasOwnProperty.call(from, key)) {
5149
+ to[key] = from[key];
5150
+ }
5151
+ }
5152
+
5153
+ if (getOwnPropertySymbols) {
5154
+ symbols = getOwnPropertySymbols(from);
5155
+ for (var i = 0; i < symbols.length; i++) {
5156
+ if (propIsEnumerable.call(from, symbols[i])) {
5157
+ to[symbols[i]] = from[symbols[i]];
5158
+ }
5159
+ }
5160
+ }
5161
+ }
5162
+
5163
+ return to;
5096
5164
  };
5097
5165
 
5098
- var SettingsProvider = function SettingsProvider(_ref) {
5099
- var initialUsername = _ref.userName,
5100
- settingsKey = _ref.settingsKey,
5101
- children = _ref.children,
5102
- _ref$initialSettings = _ref.initialSettings,
5103
- initialSettings = _ref$initialSettings === void 0 ? {} : _ref$initialSettings,
5104
- onChange = _ref.onChange,
5105
- _ref$getSettingsApi = _ref.getSettingsApi,
5106
- getSettingsApi = _ref$getSettingsApi === void 0 ? metadata.getSimpleMetadataKey : _ref$getSettingsApi,
5107
- _ref$updateSettingsAp = _ref.updateSettingsApi,
5108
- updateSettingsApi = _ref$updateSettingsAp === void 0 ? metadata.updateSimpleMetadataKey : _ref$updateSettingsAp;
5166
+ /**
5167
+ * Copyright (c) 2013-present, Facebook, Inc.
5168
+ *
5169
+ * This source code is licensed under the MIT license found in the
5170
+ * LICENSE file in the root directory of this source tree.
5171
+ */
5109
5172
 
5110
- var _React$useReducer = React.useReducer(reducer, {
5111
- settings: initialSettings,
5112
- userName: initialUsername
5113
- }),
5114
- _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
5115
- state = _React$useReducer2[0],
5116
- dispatch = _React$useReducer2[1];
5173
+ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
5117
5174
 
5118
- var currentSettingsFromServer = React.useRef();
5119
- React.useEffect(function () {
5120
- var userName = state.userName;
5121
- if (!getSettingsApi || !userName) return;
5122
- getSettingsApi({
5123
- entityType: 'user',
5124
- entityId: userName,
5125
- key: settingsKey
5126
- }).then(function (_ref2) {
5127
- var settings = _ref2.data;
5128
- dispatch({
5129
- type: UPDATE_ALL_SETTINGS,
5175
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
5176
+
5177
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
5178
+
5179
+ /**
5180
+ * Copyright (c) 2013-present, Facebook, Inc.
5181
+ *
5182
+ * This source code is licensed under the MIT license found in the
5183
+ * LICENSE file in the root directory of this source tree.
5184
+ */
5185
+
5186
+ var printWarning$1 = function() {};
5187
+
5188
+ if (process.env.NODE_ENV !== 'production') {
5189
+ var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
5190
+ var loggedTypeFailures = {};
5191
+ var has$1 = has$2;
5192
+
5193
+ printWarning$1 = function(text) {
5194
+ var message = 'Warning: ' + text;
5195
+ if (typeof console !== 'undefined') {
5196
+ console.error(message);
5197
+ }
5198
+ try {
5199
+ // --- Welcome to debugging React ---
5200
+ // This error was thrown as a convenience so that you can use this stack
5201
+ // to find the callsite that caused this warning to fire.
5202
+ throw new Error(message);
5203
+ } catch (x) { /**/ }
5204
+ };
5205
+ }
5206
+
5207
+ /**
5208
+ * Assert that the values match with the type specs.
5209
+ * Error messages are memorized and will only be shown once.
5210
+ *
5211
+ * @param {object} typeSpecs Map of name to a ReactPropType
5212
+ * @param {object} values Runtime values that need to be type-checked
5213
+ * @param {string} location e.g. "prop", "context", "child context"
5214
+ * @param {string} componentName Name of the component for error messages.
5215
+ * @param {?Function} getStack Returns the component stack.
5216
+ * @private
5217
+ */
5218
+ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
5219
+ if (process.env.NODE_ENV !== 'production') {
5220
+ for (var typeSpecName in typeSpecs) {
5221
+ if (has$1(typeSpecs, typeSpecName)) {
5222
+ var error;
5223
+ // Prop type validation may throw. In case they do, we don't want to
5224
+ // fail the render phase where it didn't fail before. So we log it.
5225
+ // After these have been cleaned up, we'll let them throw.
5226
+ try {
5227
+ // This is intentionally an invariant that gets caught. It's the same
5228
+ // behavior as without this statement except with a better message.
5229
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
5230
+ var err = Error(
5231
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
5232
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
5233
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
5234
+ );
5235
+ err.name = 'Invariant Violation';
5236
+ throw err;
5237
+ }
5238
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
5239
+ } catch (ex) {
5240
+ error = ex;
5241
+ }
5242
+ if (error && !(error instanceof Error)) {
5243
+ printWarning$1(
5244
+ (componentName || 'React class') + ': type specification of ' +
5245
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
5246
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
5247
+ 'You may have forgotten to pass an argument to the type checker ' +
5248
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
5249
+ 'shape all require an argument).'
5250
+ );
5251
+ }
5252
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
5253
+ // Only monitor this failure once because there tends to be a lot of the
5254
+ // same error.
5255
+ loggedTypeFailures[error.message] = true;
5256
+
5257
+ var stack = getStack ? getStack() : '';
5258
+
5259
+ printWarning$1(
5260
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
5261
+ );
5262
+ }
5263
+ }
5264
+ }
5265
+ }
5266
+ }
5267
+
5268
+ /**
5269
+ * Resets warning cache when testing.
5270
+ *
5271
+ * @private
5272
+ */
5273
+ checkPropTypes$1.resetWarningCache = function() {
5274
+ if (process.env.NODE_ENV !== 'production') {
5275
+ loggedTypeFailures = {};
5276
+ }
5277
+ };
5278
+
5279
+ var checkPropTypes_1 = checkPropTypes$1;
5280
+
5281
+ /**
5282
+ * Copyright (c) 2013-present, Facebook, Inc.
5283
+ *
5284
+ * This source code is licensed under the MIT license found in the
5285
+ * LICENSE file in the root directory of this source tree.
5286
+ */
5287
+
5288
+ var ReactIs$1 = reactIs.exports;
5289
+ var assign = objectAssign;
5290
+
5291
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
5292
+ var has = has$2;
5293
+ var checkPropTypes = checkPropTypes_1;
5294
+
5295
+ var printWarning = function() {};
5296
+
5297
+ if (process.env.NODE_ENV !== 'production') {
5298
+ printWarning = function(text) {
5299
+ var message = 'Warning: ' + text;
5300
+ if (typeof console !== 'undefined') {
5301
+ console.error(message);
5302
+ }
5303
+ try {
5304
+ // --- Welcome to debugging React ---
5305
+ // This error was thrown as a convenience so that you can use this stack
5306
+ // to find the callsite that caused this warning to fire.
5307
+ throw new Error(message);
5308
+ } catch (x) {}
5309
+ };
5310
+ }
5311
+
5312
+ function emptyFunctionThatReturnsNull() {
5313
+ return null;
5314
+ }
5315
+
5316
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
5317
+ /* global Symbol */
5318
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
5319
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
5320
+
5321
+ /**
5322
+ * Returns the iterator method function contained on the iterable object.
5323
+ *
5324
+ * Be sure to invoke the function with the iterable as context:
5325
+ *
5326
+ * var iteratorFn = getIteratorFn(myIterable);
5327
+ * if (iteratorFn) {
5328
+ * var iterator = iteratorFn.call(myIterable);
5329
+ * ...
5330
+ * }
5331
+ *
5332
+ * @param {?object} maybeIterable
5333
+ * @return {?function}
5334
+ */
5335
+ function getIteratorFn(maybeIterable) {
5336
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
5337
+ if (typeof iteratorFn === 'function') {
5338
+ return iteratorFn;
5339
+ }
5340
+ }
5341
+
5342
+ /**
5343
+ * Collection of methods that allow declaration and validation of props that are
5344
+ * supplied to React components. Example usage:
5345
+ *
5346
+ * var Props = require('ReactPropTypes');
5347
+ * var MyArticle = React.createClass({
5348
+ * propTypes: {
5349
+ * // An optional string prop named "description".
5350
+ * description: Props.string,
5351
+ *
5352
+ * // A required enum prop named "category".
5353
+ * category: Props.oneOf(['News','Photos']).isRequired,
5354
+ *
5355
+ * // A prop named "dialog" that requires an instance of Dialog.
5356
+ * dialog: Props.instanceOf(Dialog).isRequired
5357
+ * },
5358
+ * render: function() { ... }
5359
+ * });
5360
+ *
5361
+ * A more formal specification of how these methods are used:
5362
+ *
5363
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
5364
+ * decl := ReactPropTypes.{type}(.isRequired)?
5365
+ *
5366
+ * Each and every declaration produces a function with the same signature. This
5367
+ * allows the creation of custom validation functions. For example:
5368
+ *
5369
+ * var MyLink = React.createClass({
5370
+ * propTypes: {
5371
+ * // An optional string or URI prop named "href".
5372
+ * href: function(props, propName, componentName) {
5373
+ * var propValue = props[propName];
5374
+ * if (propValue != null && typeof propValue !== 'string' &&
5375
+ * !(propValue instanceof URI)) {
5376
+ * return new Error(
5377
+ * 'Expected a string or an URI for ' + propName + ' in ' +
5378
+ * componentName
5379
+ * );
5380
+ * }
5381
+ * }
5382
+ * },
5383
+ * render: function() {...}
5384
+ * });
5385
+ *
5386
+ * @internal
5387
+ */
5388
+
5389
+ var ANONYMOUS = '<<anonymous>>';
5390
+
5391
+ // Important!
5392
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
5393
+ var ReactPropTypes = {
5394
+ array: createPrimitiveTypeChecker('array'),
5395
+ bigint: createPrimitiveTypeChecker('bigint'),
5396
+ bool: createPrimitiveTypeChecker('boolean'),
5397
+ func: createPrimitiveTypeChecker('function'),
5398
+ number: createPrimitiveTypeChecker('number'),
5399
+ object: createPrimitiveTypeChecker('object'),
5400
+ string: createPrimitiveTypeChecker('string'),
5401
+ symbol: createPrimitiveTypeChecker('symbol'),
5402
+
5403
+ any: createAnyTypeChecker(),
5404
+ arrayOf: createArrayOfTypeChecker,
5405
+ element: createElementTypeChecker(),
5406
+ elementType: createElementTypeTypeChecker(),
5407
+ instanceOf: createInstanceTypeChecker,
5408
+ node: createNodeChecker(),
5409
+ objectOf: createObjectOfTypeChecker,
5410
+ oneOf: createEnumTypeChecker,
5411
+ oneOfType: createUnionTypeChecker,
5412
+ shape: createShapeTypeChecker,
5413
+ exact: createStrictShapeTypeChecker,
5414
+ };
5415
+
5416
+ /**
5417
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
5418
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
5419
+ */
5420
+ /*eslint-disable no-self-compare*/
5421
+ function is(x, y) {
5422
+ // SameValue algorithm
5423
+ if (x === y) {
5424
+ // Steps 1-5, 7-10
5425
+ // Steps 6.b-6.e: +0 != -0
5426
+ return x !== 0 || 1 / x === 1 / y;
5427
+ } else {
5428
+ // Step 6.a: NaN == NaN
5429
+ return x !== x && y !== y;
5430
+ }
5431
+ }
5432
+ /*eslint-enable no-self-compare*/
5433
+
5434
+ /**
5435
+ * We use an Error-like object for backward compatibility as people may call
5436
+ * PropTypes directly and inspect their output. However, we don't use real
5437
+ * Errors anymore. We don't inspect their stack anyway, and creating them
5438
+ * is prohibitively expensive if they are created too often, such as what
5439
+ * happens in oneOfType() for any type before the one that matched.
5440
+ */
5441
+ function PropTypeError(message, data) {
5442
+ this.message = message;
5443
+ this.data = data && typeof data === 'object' ? data: {};
5444
+ this.stack = '';
5445
+ }
5446
+ // Make `instanceof Error` still work for returned errors.
5447
+ PropTypeError.prototype = Error.prototype;
5448
+
5449
+ function createChainableTypeChecker(validate) {
5450
+ if (process.env.NODE_ENV !== 'production') {
5451
+ var manualPropTypeCallCache = {};
5452
+ var manualPropTypeWarningCount = 0;
5453
+ }
5454
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
5455
+ componentName = componentName || ANONYMOUS;
5456
+ propFullName = propFullName || propName;
5457
+
5458
+ if (secret !== ReactPropTypesSecret$1) {
5459
+ if (throwOnDirectAccess) {
5460
+ // New behavior only for users of `prop-types` package
5461
+ var err = new Error(
5462
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
5463
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
5464
+ 'Read more at http://fb.me/use-check-prop-types'
5465
+ );
5466
+ err.name = 'Invariant Violation';
5467
+ throw err;
5468
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
5469
+ // Old behavior for people using React.PropTypes
5470
+ var cacheKey = componentName + ':' + propName;
5471
+ if (
5472
+ !manualPropTypeCallCache[cacheKey] &&
5473
+ // Avoid spamming the console because they are often not actionable except for lib authors
5474
+ manualPropTypeWarningCount < 3
5475
+ ) {
5476
+ printWarning(
5477
+ 'You are manually calling a React.PropTypes validation ' +
5478
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
5479
+ 'and will throw in the standalone `prop-types` package. ' +
5480
+ 'You may be seeing this warning due to a third-party PropTypes ' +
5481
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
5482
+ );
5483
+ manualPropTypeCallCache[cacheKey] = true;
5484
+ manualPropTypeWarningCount++;
5485
+ }
5486
+ }
5487
+ }
5488
+ if (props[propName] == null) {
5489
+ if (isRequired) {
5490
+ if (props[propName] === null) {
5491
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
5492
+ }
5493
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
5494
+ }
5495
+ return null;
5496
+ } else {
5497
+ return validate(props, propName, componentName, location, propFullName);
5498
+ }
5499
+ }
5500
+
5501
+ var chainedCheckType = checkType.bind(null, false);
5502
+ chainedCheckType.isRequired = checkType.bind(null, true);
5503
+
5504
+ return chainedCheckType;
5505
+ }
5506
+
5507
+ function createPrimitiveTypeChecker(expectedType) {
5508
+ function validate(props, propName, componentName, location, propFullName, secret) {
5509
+ var propValue = props[propName];
5510
+ var propType = getPropType(propValue);
5511
+ if (propType !== expectedType) {
5512
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
5513
+ // check, but we can offer a more precise error message here rather than
5514
+ // 'of type `object`'.
5515
+ var preciseType = getPreciseType(propValue);
5516
+
5517
+ return new PropTypeError(
5518
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
5519
+ {expectedType: expectedType}
5520
+ );
5521
+ }
5522
+ return null;
5523
+ }
5524
+ return createChainableTypeChecker(validate);
5525
+ }
5526
+
5527
+ function createAnyTypeChecker() {
5528
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
5529
+ }
5530
+
5531
+ function createArrayOfTypeChecker(typeChecker) {
5532
+ function validate(props, propName, componentName, location, propFullName) {
5533
+ if (typeof typeChecker !== 'function') {
5534
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
5535
+ }
5536
+ var propValue = props[propName];
5537
+ if (!Array.isArray(propValue)) {
5538
+ var propType = getPropType(propValue);
5539
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
5540
+ }
5541
+ for (var i = 0; i < propValue.length; i++) {
5542
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
5543
+ if (error instanceof Error) {
5544
+ return error;
5545
+ }
5546
+ }
5547
+ return null;
5548
+ }
5549
+ return createChainableTypeChecker(validate);
5550
+ }
5551
+
5552
+ function createElementTypeChecker() {
5553
+ function validate(props, propName, componentName, location, propFullName) {
5554
+ var propValue = props[propName];
5555
+ if (!isValidElement(propValue)) {
5556
+ var propType = getPropType(propValue);
5557
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
5558
+ }
5559
+ return null;
5560
+ }
5561
+ return createChainableTypeChecker(validate);
5562
+ }
5563
+
5564
+ function createElementTypeTypeChecker() {
5565
+ function validate(props, propName, componentName, location, propFullName) {
5566
+ var propValue = props[propName];
5567
+ if (!ReactIs$1.isValidElementType(propValue)) {
5568
+ var propType = getPropType(propValue);
5569
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
5570
+ }
5571
+ return null;
5572
+ }
5573
+ return createChainableTypeChecker(validate);
5574
+ }
5575
+
5576
+ function createInstanceTypeChecker(expectedClass) {
5577
+ function validate(props, propName, componentName, location, propFullName) {
5578
+ if (!(props[propName] instanceof expectedClass)) {
5579
+ var expectedClassName = expectedClass.name || ANONYMOUS;
5580
+ var actualClassName = getClassName(props[propName]);
5581
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
5582
+ }
5583
+ return null;
5584
+ }
5585
+ return createChainableTypeChecker(validate);
5586
+ }
5587
+
5588
+ function createEnumTypeChecker(expectedValues) {
5589
+ if (!Array.isArray(expectedValues)) {
5590
+ if (process.env.NODE_ENV !== 'production') {
5591
+ if (arguments.length > 1) {
5592
+ printWarning(
5593
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
5594
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
5595
+ );
5596
+ } else {
5597
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
5598
+ }
5599
+ }
5600
+ return emptyFunctionThatReturnsNull;
5601
+ }
5602
+
5603
+ function validate(props, propName, componentName, location, propFullName) {
5604
+ var propValue = props[propName];
5605
+ for (var i = 0; i < expectedValues.length; i++) {
5606
+ if (is(propValue, expectedValues[i])) {
5607
+ return null;
5608
+ }
5609
+ }
5610
+
5611
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
5612
+ var type = getPreciseType(value);
5613
+ if (type === 'symbol') {
5614
+ return String(value);
5615
+ }
5616
+ return value;
5617
+ });
5618
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
5619
+ }
5620
+ return createChainableTypeChecker(validate);
5621
+ }
5622
+
5623
+ function createObjectOfTypeChecker(typeChecker) {
5624
+ function validate(props, propName, componentName, location, propFullName) {
5625
+ if (typeof typeChecker !== 'function') {
5626
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
5627
+ }
5628
+ var propValue = props[propName];
5629
+ var propType = getPropType(propValue);
5630
+ if (propType !== 'object') {
5631
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
5632
+ }
5633
+ for (var key in propValue) {
5634
+ if (has(propValue, key)) {
5635
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
5636
+ if (error instanceof Error) {
5637
+ return error;
5638
+ }
5639
+ }
5640
+ }
5641
+ return null;
5642
+ }
5643
+ return createChainableTypeChecker(validate);
5644
+ }
5645
+
5646
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
5647
+ if (!Array.isArray(arrayOfTypeCheckers)) {
5648
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
5649
+ return emptyFunctionThatReturnsNull;
5650
+ }
5651
+
5652
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
5653
+ var checker = arrayOfTypeCheckers[i];
5654
+ if (typeof checker !== 'function') {
5655
+ printWarning(
5656
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
5657
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
5658
+ );
5659
+ return emptyFunctionThatReturnsNull;
5660
+ }
5661
+ }
5662
+
5663
+ function validate(props, propName, componentName, location, propFullName) {
5664
+ var expectedTypes = [];
5665
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
5666
+ var checker = arrayOfTypeCheckers[i];
5667
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
5668
+ if (checkerResult == null) {
5669
+ return null;
5670
+ }
5671
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
5672
+ expectedTypes.push(checkerResult.data.expectedType);
5673
+ }
5674
+ }
5675
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
5676
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
5677
+ }
5678
+ return createChainableTypeChecker(validate);
5679
+ }
5680
+
5681
+ function createNodeChecker() {
5682
+ function validate(props, propName, componentName, location, propFullName) {
5683
+ if (!isNode(props[propName])) {
5684
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
5685
+ }
5686
+ return null;
5687
+ }
5688
+ return createChainableTypeChecker(validate);
5689
+ }
5690
+
5691
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
5692
+ return new PropTypeError(
5693
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
5694
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
5695
+ );
5696
+ }
5697
+
5698
+ function createShapeTypeChecker(shapeTypes) {
5699
+ function validate(props, propName, componentName, location, propFullName) {
5700
+ var propValue = props[propName];
5701
+ var propType = getPropType(propValue);
5702
+ if (propType !== 'object') {
5703
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
5704
+ }
5705
+ for (var key in shapeTypes) {
5706
+ var checker = shapeTypes[key];
5707
+ if (typeof checker !== 'function') {
5708
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
5709
+ }
5710
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
5711
+ if (error) {
5712
+ return error;
5713
+ }
5714
+ }
5715
+ return null;
5716
+ }
5717
+ return createChainableTypeChecker(validate);
5718
+ }
5719
+
5720
+ function createStrictShapeTypeChecker(shapeTypes) {
5721
+ function validate(props, propName, componentName, location, propFullName) {
5722
+ var propValue = props[propName];
5723
+ var propType = getPropType(propValue);
5724
+ if (propType !== 'object') {
5725
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
5726
+ }
5727
+ // We need to check all keys in case some are required but missing from props.
5728
+ var allKeys = assign({}, props[propName], shapeTypes);
5729
+ for (var key in allKeys) {
5730
+ var checker = shapeTypes[key];
5731
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
5732
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
5733
+ }
5734
+ if (!checker) {
5735
+ return new PropTypeError(
5736
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
5737
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
5738
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
5739
+ );
5740
+ }
5741
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
5742
+ if (error) {
5743
+ return error;
5744
+ }
5745
+ }
5746
+ return null;
5747
+ }
5748
+
5749
+ return createChainableTypeChecker(validate);
5750
+ }
5751
+
5752
+ function isNode(propValue) {
5753
+ switch (typeof propValue) {
5754
+ case 'number':
5755
+ case 'string':
5756
+ case 'undefined':
5757
+ return true;
5758
+ case 'boolean':
5759
+ return !propValue;
5760
+ case 'object':
5761
+ if (Array.isArray(propValue)) {
5762
+ return propValue.every(isNode);
5763
+ }
5764
+ if (propValue === null || isValidElement(propValue)) {
5765
+ return true;
5766
+ }
5767
+
5768
+ var iteratorFn = getIteratorFn(propValue);
5769
+ if (iteratorFn) {
5770
+ var iterator = iteratorFn.call(propValue);
5771
+ var step;
5772
+ if (iteratorFn !== propValue.entries) {
5773
+ while (!(step = iterator.next()).done) {
5774
+ if (!isNode(step.value)) {
5775
+ return false;
5776
+ }
5777
+ }
5778
+ } else {
5779
+ // Iterator will provide entry [k,v] tuples rather than values.
5780
+ while (!(step = iterator.next()).done) {
5781
+ var entry = step.value;
5782
+ if (entry) {
5783
+ if (!isNode(entry[1])) {
5784
+ return false;
5785
+ }
5786
+ }
5787
+ }
5788
+ }
5789
+ } else {
5790
+ return false;
5791
+ }
5792
+
5793
+ return true;
5794
+ default:
5795
+ return false;
5796
+ }
5797
+ }
5798
+
5799
+ function isSymbol(propType, propValue) {
5800
+ // Native Symbol.
5801
+ if (propType === 'symbol') {
5802
+ return true;
5803
+ }
5804
+
5805
+ // falsy value can't be a Symbol
5806
+ if (!propValue) {
5807
+ return false;
5808
+ }
5809
+
5810
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
5811
+ if (propValue['@@toStringTag'] === 'Symbol') {
5812
+ return true;
5813
+ }
5814
+
5815
+ // Fallback for non-spec compliant Symbols which are polyfilled.
5816
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
5817
+ return true;
5818
+ }
5819
+
5820
+ return false;
5821
+ }
5822
+
5823
+ // Equivalent of `typeof` but with special handling for array and regexp.
5824
+ function getPropType(propValue) {
5825
+ var propType = typeof propValue;
5826
+ if (Array.isArray(propValue)) {
5827
+ return 'array';
5828
+ }
5829
+ if (propValue instanceof RegExp) {
5830
+ // Old webkits (at least until Android 4.0) return 'function' rather than
5831
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
5832
+ // passes PropTypes.object.
5833
+ return 'object';
5834
+ }
5835
+ if (isSymbol(propType, propValue)) {
5836
+ return 'symbol';
5837
+ }
5838
+ return propType;
5839
+ }
5840
+
5841
+ // This handles more types than `getPropType`. Only used for error messages.
5842
+ // See `createPrimitiveTypeChecker`.
5843
+ function getPreciseType(propValue) {
5844
+ if (typeof propValue === 'undefined' || propValue === null) {
5845
+ return '' + propValue;
5846
+ }
5847
+ var propType = getPropType(propValue);
5848
+ if (propType === 'object') {
5849
+ if (propValue instanceof Date) {
5850
+ return 'date';
5851
+ } else if (propValue instanceof RegExp) {
5852
+ return 'regexp';
5853
+ }
5854
+ }
5855
+ return propType;
5856
+ }
5857
+
5858
+ // Returns a string that is postfixed to a warning about an invalid type.
5859
+ // For example, "undefined" or "of type array"
5860
+ function getPostfixForTypeWarning(value) {
5861
+ var type = getPreciseType(value);
5862
+ switch (type) {
5863
+ case 'array':
5864
+ case 'object':
5865
+ return 'an ' + type;
5866
+ case 'boolean':
5867
+ case 'date':
5868
+ case 'regexp':
5869
+ return 'a ' + type;
5870
+ default:
5871
+ return type;
5872
+ }
5873
+ }
5874
+
5875
+ // Returns class name of the object, if any.
5876
+ function getClassName(propValue) {
5877
+ if (!propValue.constructor || !propValue.constructor.name) {
5878
+ return ANONYMOUS;
5879
+ }
5880
+ return propValue.constructor.name;
5881
+ }
5882
+
5883
+ ReactPropTypes.checkPropTypes = checkPropTypes;
5884
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
5885
+ ReactPropTypes.PropTypes = ReactPropTypes;
5886
+
5887
+ return ReactPropTypes;
5888
+ };
5889
+
5890
+ /**
5891
+ * Copyright (c) 2013-present, Facebook, Inc.
5892
+ *
5893
+ * This source code is licensed under the MIT license found in the
5894
+ * LICENSE file in the root directory of this source tree.
5895
+ */
5896
+
5897
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
5898
+
5899
+ function emptyFunction() {}
5900
+ function emptyFunctionWithReset() {}
5901
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
5902
+
5903
+ var factoryWithThrowingShims = function() {
5904
+ function shim(props, propName, componentName, location, propFullName, secret) {
5905
+ if (secret === ReactPropTypesSecret) {
5906
+ // It is still safe when called from React.
5907
+ return;
5908
+ }
5909
+ var err = new Error(
5910
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
5911
+ 'Use PropTypes.checkPropTypes() to call them. ' +
5912
+ 'Read more at http://fb.me/use-check-prop-types'
5913
+ );
5914
+ err.name = 'Invariant Violation';
5915
+ throw err;
5916
+ } shim.isRequired = shim;
5917
+ function getShim() {
5918
+ return shim;
5919
+ } // Important!
5920
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
5921
+ var ReactPropTypes = {
5922
+ array: shim,
5923
+ bigint: shim,
5924
+ bool: shim,
5925
+ func: shim,
5926
+ number: shim,
5927
+ object: shim,
5928
+ string: shim,
5929
+ symbol: shim,
5930
+
5931
+ any: shim,
5932
+ arrayOf: getShim,
5933
+ element: shim,
5934
+ elementType: shim,
5935
+ instanceOf: getShim,
5936
+ node: shim,
5937
+ objectOf: getShim,
5938
+ oneOf: getShim,
5939
+ oneOfType: getShim,
5940
+ shape: getShim,
5941
+ exact: getShim,
5942
+
5943
+ checkPropTypes: emptyFunctionWithReset,
5944
+ resetWarningCache: emptyFunction
5945
+ };
5946
+
5947
+ ReactPropTypes.PropTypes = ReactPropTypes;
5948
+
5949
+ return ReactPropTypes;
5950
+ };
5951
+
5952
+ /**
5953
+ * Copyright (c) 2013-present, Facebook, Inc.
5954
+ *
5955
+ * This source code is licensed under the MIT license found in the
5956
+ * LICENSE file in the root directory of this source tree.
5957
+ */
5958
+
5959
+ if (process.env.NODE_ENV !== 'production') {
5960
+ var ReactIs = reactIs.exports;
5961
+
5962
+ // By explicitly using `prop-types` you are opting into new development behavior.
5963
+ // http://fb.me/prop-types-in-prod
5964
+ var throwOnDirectAccess = true;
5965
+ propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
5966
+ } else {
5967
+ // By explicitly using `prop-types` you are opting into new production behavior.
5968
+ // http://fb.me/prop-types-in-prod
5969
+ propTypes.exports = factoryWithThrowingShims();
5970
+ }
5971
+
5972
+ var PropTypes = propTypes.exports;
5973
+
5974
+ 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; }
5975
+
5976
+ 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(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; }
5977
+ var SettingsDispatchContext = /*#__PURE__*/React.createContext();
5978
+ var SettingsStateContext = /*#__PURE__*/React.createContext();
5979
+ var UPDATE_ALL_SETTINGS = 'UPDATE_ALL_SETTINGS';
5980
+ var UPDATE_SETTING = 'UPDATE_SETTING';
5981
+ var UPDATE_USERNAME = 'UPDATE_USERNAME';
5982
+ var REMOVE_SETTING = 'REMOVE_SETTING';
5983
+
5984
+ var reducer = function reducer(state, action) {
5985
+ switch (action.type) {
5986
+ case UPDATE_USERNAME:
5987
+ {
5988
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
5989
+ userName: action.userName
5990
+ });
5991
+ }
5992
+
5993
+ case UPDATE_ALL_SETTINGS:
5994
+ {
5995
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
5996
+ settings: action.settings
5997
+ });
5998
+ }
5999
+
6000
+ case UPDATE_SETTING:
6001
+ {
6002
+ var settings = _objectSpread$1(_objectSpread$1({}, state.settings), action.setting);
6003
+
6004
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
6005
+ settings: settings
6006
+ });
6007
+ }
6008
+
6009
+ case REMOVE_SETTING:
6010
+ {
6011
+ var _settings = _objectSpread$1({}, state.settings);
6012
+
6013
+ delete _settings[action.key];
6014
+ return _objectSpread$1(_objectSpread$1({}, state), {}, {
6015
+ settings: _settings
6016
+ });
6017
+ }
6018
+
6019
+ default:
6020
+ return state;
6021
+ }
6022
+ };
6023
+
6024
+ function SettingsProvider(_ref) {
6025
+ var initialUsername = _ref.userName,
6026
+ settingsKey = _ref.settingsKey,
6027
+ children = _ref.children,
6028
+ initialSettings = _ref.initialSettings,
6029
+ onChange = _ref.onChange,
6030
+ getSettingsApi = _ref.getSettingsApi,
6031
+ updateSettingsApi = _ref.updateSettingsApi;
6032
+
6033
+ var _React$useReducer = React.useReducer(reducer, {
6034
+ settings: initialSettings,
6035
+ userName: initialUsername
6036
+ }),
6037
+ _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
6038
+ state = _React$useReducer2[0],
6039
+ dispatch = _React$useReducer2[1];
6040
+
6041
+ var currentSettingsFromServer = React.useRef();
6042
+ React.useEffect(function () {
6043
+ var userName = state.userName;
6044
+ if (!getSettingsApi || !userName) return;
6045
+ getSettingsApi({
6046
+ entityType: 'user',
6047
+ entityId: userName,
6048
+ key: settingsKey
6049
+ }).then(function (_ref2) {
6050
+ var settings = _ref2.data;
6051
+ dispatch({
6052
+ type: UPDATE_ALL_SETTINGS,
5130
6053
  settings: settings,
5131
6054
  userName: userName,
5132
6055
  settingsKey: settingsKey
@@ -5160,7 +6083,7 @@ var SettingsProvider = function SettingsProvider(_ref) {
5160
6083
  }, /*#__PURE__*/React.createElement(SettingsDispatchContext.Provider, {
5161
6084
  value: dispatch
5162
6085
  }, children));
5163
- };
6086
+ }
5164
6087
 
5165
6088
  var useSettingsState = function useSettingsState() {
5166
6089
  var state = React.useContext(SettingsStateContext);
@@ -5218,15 +6141,35 @@ var useSettings = function useSettings() {
5218
6141
  settings = _useSettingsState$set === void 0 ? {} : _useSettingsState$set;
5219
6142
 
5220
6143
  var actions = useSettingsActions();
5221
- return _objectSpread2(_objectSpread2({}, actions), {}, {
6144
+ return _objectSpread$1(_objectSpread$1({}, actions), {}, {
5222
6145
  settings: settings
5223
6146
  });
5224
6147
  };
5225
6148
 
5226
- var VIDISPINE_TOKEN$1 = 'VIDISPINE-TOKEN';
5227
- var VIDISPINE_USERNAME$1 = 'VIDISPINE-USERNAME';
5228
- var VIDISPINE_SERVER_URL$1 = 'VIDISPINE-SERVER-URL';
5229
- var VIDISPINE_REMEMBER_ME$1 = 'VIDISPINE-REMEMBER-ME';
6149
+ SettingsProvider.propTypes = {
6150
+ userName: PropTypes.string.isRequired,
6151
+ settingsKey: PropTypes.string.isRequired,
6152
+ children: PropTypes.objectOf(PropTypes.any),
6153
+ initialSettings: PropTypes.objectOf(PropTypes.any),
6154
+ onChange: PropTypes.func,
6155
+ getSettingsApi: PropTypes.func,
6156
+ updateSettingsApi: PropTypes.func
6157
+ };
6158
+ SettingsProvider.defaultProps = {
6159
+ children: null,
6160
+ initialSettings: {},
6161
+ onChange: null,
6162
+ getSettingsApi: metadata.getSimpleMetadataKey,
6163
+ updateSettingsApi: metadata.updateSimpleMetadataKey
6164
+ };
6165
+
6166
+ 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; }
6167
+
6168
+ 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(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; }
6169
+ var VIDISPINE_TOKEN = 'VIDISPINE-TOKEN';
6170
+ var VIDISPINE_USERNAME = 'VIDISPINE-USERNAME';
6171
+ var VIDISPINE_SERVER_URL = 'VIDISPINE-SERVER-URL';
6172
+ var VIDISPINE_REMEMBER_ME = 'VIDISPINE-REMEMBER-ME';
5230
6173
  var ERROR_CREDENTIALS = 'Incorrect username or password';
5231
6174
  var ERROR_OFFLINE = 'Offline or CORS not configured';
5232
6175
  var ERROR_TOKEN_EXPIRED = 'Session expired';
@@ -5283,7 +6226,7 @@ var defaultOnGetToken = function defaultOnGetToken(_ref) {
5283
6226
  var AuthContext = /*#__PURE__*/React.createContext({
5284
6227
  serverUrl: null,
5285
6228
  token: null,
5286
- user: null,
6229
+ userType: null,
5287
6230
  userName: null,
5288
6231
  onLogin: function onLogin() {
5289
6232
  return null;
@@ -5292,17 +6235,11 @@ var AuthContext = /*#__PURE__*/React.createContext({
5292
6235
  return null;
5293
6236
  }
5294
6237
  });
5295
- var AuthProvider = function AuthProvider(_ref3) {
5296
- var _ref3$cookieOptions = _ref3.cookieOptions,
5297
- cookieOptions = _ref3$cookieOptions === void 0 ? {
5298
- maxAge: 604800,
5299
- path: '/'
5300
- } : _ref3$cookieOptions,
6238
+ function AuthProvider(_ref3) {
6239
+ var cookieOptions = _ref3.cookieOptions,
5301
6240
  LoginComponent = _ref3.LoginComponent,
5302
- _ref3$LoginProps = _ref3.LoginProps,
5303
- LoginProps = _ref3$LoginProps === void 0 ? {} : _ref3$LoginProps,
5304
- _ref3$onGetToken = _ref3.onGetToken,
5305
- onGetToken = _ref3$onGetToken === void 0 ? defaultOnGetToken : _ref3$onGetToken,
6241
+ LoginProps = _ref3.LoginProps,
6242
+ onGetToken = _ref3.onGetToken,
5306
6243
  onSuccess = _ref3.onSuccess,
5307
6244
  onError = _ref3.onError,
5308
6245
  propsServerUrl = _ref3.serverUrl,
@@ -5314,35 +6251,34 @@ var AuthProvider = function AuthProvider(_ref3) {
5314
6251
  userType = _useApi.data,
5315
6252
  getUser = _useApi.request;
5316
6253
 
5317
- var _useCookies = useCookies([VIDISPINE_TOKEN$1, VIDISPINE_USERNAME$1, VIDISPINE_SERVER_URL$1, VIDISPINE_REMEMBER_ME$1]),
6254
+ var _useCookies = useCookies([VIDISPINE_TOKEN, VIDISPINE_USERNAME, VIDISPINE_SERVER_URL, VIDISPINE_REMEMBER_ME]),
5318
6255
  _useCookies2 = _slicedToArray(_useCookies, 3),
5319
6256
  cookies = _useCookies2[0],
5320
6257
  setCookie = _useCookies2[1],
5321
6258
  removeCookie = _useCookies2[2];
5322
6259
 
5323
- var _cookies$VIDISPINE_TO = cookies[VIDISPINE_TOKEN$1],
6260
+ var _cookies$VIDISPINE_TO = cookies[VIDISPINE_TOKEN],
5324
6261
  token = _cookies$VIDISPINE_TO === void 0 ? propsToken : _cookies$VIDISPINE_TO,
5325
- _cookies$VIDISPINE_US = cookies[VIDISPINE_USERNAME$1],
6262
+ _cookies$VIDISPINE_US = cookies[VIDISPINE_USERNAME],
5326
6263
  userName = _cookies$VIDISPINE_US === void 0 ? propsUserName : _cookies$VIDISPINE_US,
5327
- _cookies$VIDISPINE_SE = cookies[VIDISPINE_SERVER_URL$1],
6264
+ _cookies$VIDISPINE_SE = cookies[VIDISPINE_SERVER_URL],
5328
6265
  serverUrl = _cookies$VIDISPINE_SE === void 0 ? propsServerUrl : _cookies$VIDISPINE_SE;
5329
- var rememberMe = cookies[VIDISPINE_REMEMBER_ME$1] === 'true';
6266
+ var rememberMe = cookies[VIDISPINE_REMEMBER_ME] === 'true';
5330
6267
  var maxAge = cookieOptions.maxAge;
5331
-
5332
- var onLogin = function onLogin(values) {
6268
+ var onLogin = React.useCallback(function (values) {
5333
6269
  var submissionError;
5334
6270
 
5335
6271
  try {
5336
- return onGetToken(_objectSpread2({
6272
+ return onGetToken(_objectSpread({
5337
6273
  maxAge: maxAge
5338
6274
  }, values)).then(function (newToken) {
5339
6275
  var newUserName = values.userName,
5340
6276
  newServerUrl = values.serverUrl,
5341
6277
  newRememberMe = values.rememberMe;
5342
- if (newUserName) setCookie(VIDISPINE_USERNAME$1, newUserName, cookieOptions);
5343
- if (newServerUrl) setCookie(VIDISPINE_SERVER_URL$1, newServerUrl, cookieOptions);
5344
- if (newRememberMe) setCookie(VIDISPINE_REMEMBER_ME$1, newRememberMe, cookieOptions);
5345
- if (newToken) setCookie(VIDISPINE_TOKEN$1, newToken, cookieOptions);
6278
+ if (newUserName) setCookie(VIDISPINE_USERNAME, newUserName, cookieOptions);
6279
+ if (newServerUrl) setCookie(VIDISPINE_SERVER_URL, newServerUrl, cookieOptions);
6280
+ if (newRememberMe) setCookie(VIDISPINE_REMEMBER_ME, newRememberMe, cookieOptions);
6281
+ if (newToken) setCookie(VIDISPINE_TOKEN, newToken, cookieOptions);
5346
6282
  if (onSuccess) onSuccess(values);
5347
6283
  })["catch"](function (error) {
5348
6284
  submissionError = error;
@@ -5354,15 +6290,14 @@ var AuthProvider = function AuthProvider(_ref3) {
5354
6290
  }
5355
6291
 
5356
6292
  return submissionError;
5357
- };
5358
-
6293
+ }, [cookieOptions, maxAge, onError, onGetToken, onSuccess, setCookie]);
5359
6294
  var onLogout = React.useCallback(function () {
5360
- removeCookie(VIDISPINE_TOKEN$1, cookieOptions);
6295
+ removeCookie(VIDISPINE_TOKEN, cookieOptions);
5361
6296
 
5362
6297
  if (!rememberMe) {
5363
- removeCookie(VIDISPINE_USERNAME$1, cookieOptions);
5364
- removeCookie(VIDISPINE_SERVER_URL$1, cookieOptions);
5365
- removeCookie(VIDISPINE_REMEMBER_ME$1, cookieOptions);
6298
+ removeCookie(VIDISPINE_USERNAME, cookieOptions);
6299
+ removeCookie(VIDISPINE_SERVER_URL, cookieOptions);
6300
+ removeCookie(VIDISPINE_REMEMBER_ME, cookieOptions);
5366
6301
  }
5367
6302
  }, [cookieOptions, rememberMe, removeCookie]);
5368
6303
  var responseInterceptor = React.useRef();
@@ -5403,7 +6338,7 @@ var AuthProvider = function AuthProvider(_ref3) {
5403
6338
  if (token && userName === undefined) {
5404
6339
  user.whoAmI().then(function (_ref4) {
5405
6340
  var newUserName = _ref4.data;
5406
- return setCookie(VIDISPINE_USERNAME$1, newUserName, cookieOptions);
6341
+ return setCookie(VIDISPINE_USERNAME, newUserName, cookieOptions);
5407
6342
  });
5408
6343
  } // eslint-disable-next-line react-hooks/exhaustive-deps
5409
6344
 
@@ -5419,26 +6354,56 @@ var AuthProvider = function AuthProvider(_ref3) {
5419
6354
  if (onError) onError(Error(ERROR_SERVER_MISMATCH));
5420
6355
  }
5421
6356
  }, [token, serverUrl, propsServerUrl, onLogout, onError]);
5422
- return /*#__PURE__*/React.createElement(React.Fragment, null, token ? /*#__PURE__*/React.createElement(VidispineApi, {
5423
- token: token,
5424
- username: userName,
5425
- serverUrl: serverUrl
5426
- }, /*#__PURE__*/React.createElement(AuthContext.Provider, {
5427
- value: {
6357
+ var contextValue = React.useMemo(function () {
6358
+ return {
5428
6359
  serverUrl: serverUrl,
5429
6360
  token: token,
5430
6361
  userType: userType,
5431
6362
  userName: userName,
5432
6363
  onLogin: onLogin,
5433
6364
  onLogout: onLogout
5434
- }
6365
+ };
6366
+ }, [onLogin, onLogout, serverUrl, token, userName, userType]);
6367
+ return token ? /*#__PURE__*/React.createElement(VidispineApi, {
6368
+ token: token,
6369
+ username: userName,
6370
+ serverUrl: serverUrl
6371
+ }, /*#__PURE__*/React.createElement(AuthContext.Provider, {
6372
+ value: contextValue
5435
6373
  }, children)) : /*#__PURE__*/React.createElement(LoginComponent, _extends({
5436
6374
  onLogin: onLogin,
5437
6375
  userName: userName,
5438
6376
  serverUrl: serverUrl,
5439
- rememberMe: rememberMe // eslint-disable-next-line react/jsx-props-no-spreading
5440
-
5441
- }, LoginProps)));
6377
+ rememberMe: rememberMe
6378
+ }, LoginProps));
6379
+ }
6380
+ AuthProvider.propTypes = {
6381
+ cookieOptions: PropTypes.shape({
6382
+ maxAge: PropTypes.number,
6383
+ path: PropTypes.string
6384
+ }),
6385
+ LoginComponent: PropTypes.elementType.isRequired,
6386
+ LoginProps: PropTypes.objectOf(PropTypes.any),
6387
+ onGetToken: PropTypes.func,
6388
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element]),
6389
+ onSuccess: PropTypes.func,
6390
+ onError: PropTypes.func,
6391
+ serverUrl: PropTypes.string.isRequired,
6392
+ userName: PropTypes.string,
6393
+ token: PropTypes.string
6394
+ };
6395
+ AuthProvider.defaultProps = {
6396
+ cookieOptions: {
6397
+ maxAge: 604800,
6398
+ path: '/'
6399
+ },
6400
+ LoginProps: {},
6401
+ onGetToken: defaultOnGetToken,
6402
+ children: null,
6403
+ onSuccess: null,
6404
+ onError: null,
6405
+ userName: null,
6406
+ token: null
5442
6407
  };
5443
6408
  var useAuthContext = function useAuthContext() {
5444
6409
  var context = React.useContext(AuthContext);
@@ -5450,66 +6415,6 @@ var useAuthContext = function useAuthContext() {
5450
6415
  return context;
5451
6416
  };
5452
6417
 
5453
- var DropArea = (function (_ref) {
5454
- var children = _ref.children,
5455
- setDrag = _ref.setDrag,
5456
- onDropProp = _ref.onDrop,
5457
- onDragEnterProp = _ref.onDragEnter,
5458
- onDragOverProp = _ref.onDragOver,
5459
- onDragLeaveProp = _ref.onDragLeave,
5460
- style = _ref.style;
5461
-
5462
- var _React$useState = React.useState(0),
5463
- _React$useState2 = _slicedToArray(_React$useState, 2),
5464
- dragCounter = _React$useState2[0],
5465
- setDragCounter = _React$useState2[1];
5466
-
5467
- var _onDrop = function onDrop(e) {
5468
- e.preventDefault();
5469
- e.stopPropagation();
5470
- setDrag(false);
5471
- if (onDropProp) onDropProp(e);
5472
- };
5473
-
5474
- var _onDragEnter = function onDragEnter(e) {
5475
- e.preventDefault();
5476
- e.stopPropagation();
5477
- setDragCounter(dragCounter + 1);
5478
- if (dragCounter === 0) setDrag(true);
5479
- if (onDragEnterProp) onDragEnterProp(e);
5480
- };
5481
-
5482
- var _onDragOver = function onDragOver(e) {
5483
- e.preventDefault();
5484
- e.stopPropagation();
5485
- if (onDragOverProp) onDragOverProp(e);
5486
- };
5487
-
5488
- var _onDragLeave = function onDragLeave(e) {
5489
- e.preventDefault();
5490
- e.stopPropagation();
5491
- setDragCounter(dragCounter - 1);
5492
- if (dragCounter === 1) setDrag(false);
5493
- if (onDragLeaveProp) onDragLeaveProp(e);
5494
- };
5495
-
5496
- return /*#__PURE__*/React.createElement("div", {
5497
- onDragEnter: function onDragEnter(e) {
5498
- return _onDragEnter(e);
5499
- },
5500
- onDragOver: function onDragOver(e) {
5501
- return _onDragOver(e);
5502
- },
5503
- onDrop: function onDrop(e) {
5504
- return _onDrop(e);
5505
- },
5506
- onDragLeave: function onDragLeave(e) {
5507
- return _onDragLeave(e);
5508
- },
5509
- style: style
5510
- }, children);
5511
- });
5512
-
5513
6418
  var handleAddEntity = function handleAddEntity(_ref) {
5514
6419
  var entityId = _ref.entityId,
5515
6420
  entityType = _ref.entityType,
@@ -5696,5 +6601,65 @@ var handleMoveEntity = function handleMoveEntity(_ref3) {
5696
6601
  }
5697
6602
  };
5698
6603
 
5699
- export { Auth, AuthContext, AuthProvider, BinContext, BinProvider, ComposeProviders, DropArea, ErrorBoundary, GetCollectionContent as GetCollection, GetFieldGroup, GetItem, GetJobs, HasRole, ListEntityAccess, MetadataType, RolesProvider, SearchCollection, SearchItem, SearchItemCollection, SettingsProvider, VidispineApi, compose, handleAddEntity, handleMoveEntity, handleRemoveEntity, useAddMetadataFieldAttributes, useApi, useAuthContext, useAutocomplete, useCollectionAutoPlay, useCompoundMetadata, useCsvDownload, useDocSearchAutocomplete, useEntityAccess, useGetCollection, useGetCollection$1 as useGetCollectionItem, useGetEntity, useGetFieldMetadataDataset, useGetItem, useGetSavedSearchFolders, useGroup, useHoverScrub, useInterval, useJobSearch, useListGroup, useListUser, useLocalStorage, useMouseDownPosition, useQueryInitialState, useRepresentativeItems, useRoles, useSavedSearch, useSearch, useSearchGroup, useSearchItem, useSearchUser, useSelected, useSettings, useSettingsActions, useTab, useThumbnailScrub, useUpdateEffect, useUpdateQueryState, useUploadFiles, useUser, withErrorBoundary };
6604
+ function DropArea(_ref) {
6605
+ var children = _ref.children,
6606
+ setDrag = _ref.setDrag,
6607
+ onDropProp = _ref.onDrop,
6608
+ onDragEnterProp = _ref.onDragEnter,
6609
+ onDragOverProp = _ref.onDragOver,
6610
+ onDragLeaveProp = _ref.onDragLeave,
6611
+ style = _ref.style;
6612
+
6613
+ var _React$useState = React.useState(0),
6614
+ _React$useState2 = _slicedToArray(_React$useState, 2),
6615
+ dragCounter = _React$useState2[0],
6616
+ setDragCounter = _React$useState2[1];
6617
+
6618
+ var _onDrop = function onDrop(e) {
6619
+ e.preventDefault();
6620
+ e.stopPropagation();
6621
+ setDrag(false);
6622
+ if (onDropProp) onDropProp(e);
6623
+ };
6624
+
6625
+ var _onDragEnter = function onDragEnter(e) {
6626
+ e.preventDefault();
6627
+ e.stopPropagation();
6628
+ setDragCounter(dragCounter + 1);
6629
+ if (dragCounter === 0) setDrag(true);
6630
+ if (onDragEnterProp) onDragEnterProp(e);
6631
+ };
6632
+
6633
+ var _onDragOver = function onDragOver(e) {
6634
+ e.preventDefault();
6635
+ e.stopPropagation();
6636
+ if (onDragOverProp) onDragOverProp(e);
6637
+ };
6638
+
6639
+ var _onDragLeave = function onDragLeave(e) {
6640
+ e.preventDefault();
6641
+ e.stopPropagation();
6642
+ setDragCounter(dragCounter - 1);
6643
+ if (dragCounter === 1) setDrag(false);
6644
+ if (onDragLeaveProp) onDragLeaveProp(e);
6645
+ };
6646
+
6647
+ return /*#__PURE__*/React.createElement("div", {
6648
+ onDragEnter: function onDragEnter(e) {
6649
+ return _onDragEnter(e);
6650
+ },
6651
+ onDragOver: function onDragOver(e) {
6652
+ return _onDragOver(e);
6653
+ },
6654
+ onDrop: function onDrop(e) {
6655
+ return _onDrop(e);
6656
+ },
6657
+ onDragLeave: function onDragLeave(e) {
6658
+ return _onDragLeave(e);
6659
+ },
6660
+ style: style
6661
+ }, children);
6662
+ }
6663
+
6664
+ export { Auth, AuthContext, AuthProvider, BinContext, BinProvider, ComposeProviders, DropArea, ErrorBoundary, GetCollectionContent as GetCollection, GetFieldGroup, GetItem, GetJobs, HasRole, ListEntityAccess, MetadataType, RolesProvider, SearchCollection, SearchItem, SearchItemCollection, SettingsProvider, VidispineApi, compose, handleAddEntity, handleMoveEntity, handleRemoveEntity, useAddMetadataFieldAttributes, useApi, useAuthContext, useAutocomplete, useCollectionAutoPlay, useCompoundMetadata, useCsvDownload, useDocSearchAutocomplete, useEntityAccess, useGetCollection$1 as useGetCollection, useGetCollection as useGetCollectionItem, useGetEntity, useGetFieldMetadataDataset, useGetItem, useGetSavedSearchFolders, useGroup, useHoverScrub, useInterval, useJobSearch, useListGroup, useListUser, useLocalStorage, useMouseDownPosition, useQueryInitialState, useRepresentativeItems, useRoles, useSavedSearch, useSearch, useSearchGroup, useSearchItem, useSearchUser, useSelected, useSettings, useSettingsActions, useTab, useThumbnailScrub, useUpdateEffect, useUpdateQueryState, useUploadFiles, useUser, withErrorBoundary };
5700
6665
  //# sourceMappingURL=index.es.js.map