use-tus 0.4.0 → 0.6.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/README.md +73 -33
- package/dist/TusClientProvider/TusClientProvider.d.ts +7 -4
- package/dist/TusClientProvider/constants.d.ts +4 -0
- package/dist/TusClientProvider/index.d.ts +3 -2
- package/dist/{core → TusClientProvider/store}/contexts.d.ts +7 -7
- package/dist/{core → TusClientProvider/store}/tucClientActions.d.ts +49 -50
- package/dist/{core → TusClientProvider/store}/tusClientReducer.d.ts +18 -18
- package/dist/TusClientProvider/types.d.ts +2 -0
- package/dist/__stories__/Basic.stories.d.ts +5 -0
- package/dist/__stories__/CacheKey.stories.d.ts +5 -0
- package/dist/__stories__/DefaultOptions.stories.d.ts +5 -0
- package/dist/__stories__/components/BasicButton/BasicButton.d.ts +9 -0
- package/dist/__stories__/components/BasicButton/index.d.ts +1 -0
- package/dist/__stories__/components/LoadingCircle/LoadingCircle.d.ts +2 -0
- package/dist/__stories__/components/LoadingCircle/index.d.ts +1 -0
- package/dist/__stories__/components/ProgressBar/ProgressBar.d.ts +7 -0
- package/dist/__stories__/components/ProgressBar/index.d.ts +1 -0
- package/dist/__stories__/components/UploadIcon/UploadIcon.d.ts +2 -0
- package/dist/__stories__/components/UploadIcon/index.d.ts +1 -0
- package/dist/__stories__/constants.d.ts +1 -0
- package/dist/__tests__/TusClientProvider.test.d.ts +1 -0
- package/dist/__tests__/useTus.test.d.ts +1 -0
- package/dist/__tests__/useTusStore.test.d.ts +1 -0
- package/dist/__tests__/utils/getBlob.d.ts +1 -0
- package/dist/__tests__/utils/getDefaultOptions.d.ts +2 -0
- package/dist/__tests__/utils/mock.d.ts +6 -0
- package/dist/index.cjs.js +289 -1759
- package/dist/index.d.ts +3 -4
- package/dist/index.esm.js +280 -1727
- package/dist/index.js +345 -0
- package/dist/useTus/index.d.ts +3 -2
- package/dist/useTus/types.d.ts +14 -15
- package/dist/useTus/useTus.d.ts +2 -2
- package/dist/useTus/useTusStore.d.ts +2 -0
- package/dist/useTus/utils/createUpload.d.ts +3 -0
- package/dist/useTus/utils/startOrResumeUpload.d.ts +2 -0
- package/dist/useTus/utils/useAutoAbort.d.ts +2 -0
- package/dist/useTus/utils/useMergeTusOptions.d.ts +6 -0
- package/dist/useTusClient/index.d.ts +1 -1
- package/dist/useTusClient/useTusClient.d.ts +7 -7
- package/package.json +9 -9
- package/dist/TusClientProvider/TusController.d.ts +0 -4
- package/dist/core/constants.d.ts +0 -4
- package/dist/core/tusHandler.d.ts +0 -17
- package/dist/core/types.d.ts +0 -8
- package/dist/useTus/utils.d.ts +0 -16
- package/dist/utils/uid.d.ts +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2,49 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
function _interopNamespace(e) {
|
|
11
|
-
if (e && e.__esModule) return e;
|
|
12
|
-
var n = Object.create(null);
|
|
13
|
-
if (e) {
|
|
14
|
-
Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default') {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return e[k];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
n['default'] = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var f__default = /*#__PURE__*/_interopDefaultLegacy(f);
|
|
31
|
-
var tus__namespace = /*#__PURE__*/_interopNamespace(tus);
|
|
32
|
-
|
|
33
|
-
function _typeof(obj) {
|
|
34
|
-
"@babel/helpers - typeof";
|
|
35
|
-
|
|
36
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
37
|
-
_typeof = function (obj) {
|
|
38
|
-
return typeof obj;
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
_typeof = function (obj) {
|
|
42
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return _typeof(obj);
|
|
47
|
-
}
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var tusJsClient = require('tus-js-client');
|
|
48
7
|
|
|
49
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
50
9
|
try {
|
|
@@ -82,28 +41,6 @@ function _asyncToGenerator(fn) {
|
|
|
82
41
|
};
|
|
83
42
|
}
|
|
84
43
|
|
|
85
|
-
function _classCallCheck(instance, Constructor) {
|
|
86
|
-
if (!(instance instanceof Constructor)) {
|
|
87
|
-
throw new TypeError("Cannot call a class as a function");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _defineProperties(target, props) {
|
|
92
|
-
for (var i = 0; i < props.length; i++) {
|
|
93
|
-
var descriptor = props[i];
|
|
94
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
95
|
-
descriptor.configurable = true;
|
|
96
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
97
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
102
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
103
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
104
|
-
return Constructor;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
44
|
function _defineProperty(obj, key, value) {
|
|
108
45
|
if (key in obj) {
|
|
109
46
|
Object.defineProperty(obj, key, {
|
|
@@ -209,39 +146,226 @@ function _nonIterableRest() {
|
|
|
209
146
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
210
147
|
}
|
|
211
148
|
|
|
149
|
+
var createUpload = function createUpload(file, options, dispatchIsAborted) {
|
|
150
|
+
var upload = new tusJsClient.Upload(file, options);
|
|
151
|
+
var originalStart = upload.start.bind(upload);
|
|
152
|
+
var originalAbort = upload.abort.bind(upload);
|
|
153
|
+
|
|
154
|
+
var start = function start() {
|
|
155
|
+
originalStart();
|
|
156
|
+
dispatchIsAborted(false);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var abort = function () {
|
|
160
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
161
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
162
|
+
while (1) {
|
|
163
|
+
switch (_context.prev = _context.next) {
|
|
164
|
+
case 0:
|
|
165
|
+
originalAbort();
|
|
166
|
+
dispatchIsAborted(true);
|
|
167
|
+
|
|
168
|
+
case 2:
|
|
169
|
+
case "end":
|
|
170
|
+
return _context.stop();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, _callee);
|
|
174
|
+
}));
|
|
175
|
+
|
|
176
|
+
return function abort() {
|
|
177
|
+
return _ref.apply(this, arguments);
|
|
178
|
+
};
|
|
179
|
+
}();
|
|
180
|
+
|
|
181
|
+
upload.start = start;
|
|
182
|
+
upload.abort = abort;
|
|
183
|
+
return upload;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var startOrResumeUpload = function startOrResumeUpload(upload) {
|
|
187
|
+
upload.findPreviousUploads().then(function (previousUploads) {
|
|
188
|
+
if (previousUploads.length) {
|
|
189
|
+
upload.resumeFromPreviousUpload(previousUploads[0]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
upload.start();
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var useAutoAbort = function useAutoAbort(upload, autoAbort) {
|
|
197
|
+
react.useEffect(function () {
|
|
198
|
+
var abortUploading = function () {
|
|
199
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
200
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
201
|
+
while (1) {
|
|
202
|
+
switch (_context.prev = _context.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
if (upload) {
|
|
205
|
+
_context.next = 2;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return _context.abrupt("return");
|
|
210
|
+
|
|
211
|
+
case 2:
|
|
212
|
+
_context.next = 4;
|
|
213
|
+
return upload.abort();
|
|
214
|
+
|
|
215
|
+
case 4:
|
|
216
|
+
case "end":
|
|
217
|
+
return _context.stop();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}, _callee);
|
|
221
|
+
}));
|
|
222
|
+
|
|
223
|
+
return function abortUploading() {
|
|
224
|
+
return _ref.apply(this, arguments);
|
|
225
|
+
};
|
|
226
|
+
}();
|
|
227
|
+
|
|
228
|
+
return function () {
|
|
229
|
+
if (!autoAbort) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
abortUploading();
|
|
234
|
+
};
|
|
235
|
+
}, [autoAbort, upload]);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
var defaultUseTusOptionsValue = Object.freeze({
|
|
239
|
+
autoAbort: true,
|
|
240
|
+
autoStart: false
|
|
241
|
+
});
|
|
242
|
+
var useMergeTusOptions = function useMergeTusOptions(options) {
|
|
243
|
+
return react.useMemo(function () {
|
|
244
|
+
return _objectSpread2(_objectSpread2({}, defaultUseTusOptionsValue), options || {});
|
|
245
|
+
}, [options]);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
var initialUseTusState = Object.freeze({
|
|
249
|
+
upload: undefined,
|
|
250
|
+
isSuccess: false,
|
|
251
|
+
isAborted: false,
|
|
252
|
+
error: undefined
|
|
253
|
+
});
|
|
254
|
+
var useTus = function useTus(baseOption) {
|
|
255
|
+
var _useMergeTusOptions = useMergeTusOptions(baseOption),
|
|
256
|
+
autoAbort = _useMergeTusOptions.autoAbort,
|
|
257
|
+
autoStart = _useMergeTusOptions.autoStart,
|
|
258
|
+
uploadOptions = _useMergeTusOptions.uploadOptions;
|
|
259
|
+
|
|
260
|
+
var _useState = react.useState(initialUseTusState),
|
|
261
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
262
|
+
tusState = _useState2[0],
|
|
263
|
+
setTusState = _useState2[1];
|
|
264
|
+
|
|
265
|
+
var updateTusState = react.useCallback(function (newOptions) {
|
|
266
|
+
setTusState(function (tus) {
|
|
267
|
+
return _objectSpread2(_objectSpread2({}, tus), newOptions);
|
|
268
|
+
});
|
|
269
|
+
}, []);
|
|
270
|
+
var setUpload = react.useCallback(function (file) {
|
|
271
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
272
|
+
|
|
273
|
+
var targetOptions = _objectSpread2(_objectSpread2({}, uploadOptions), options);
|
|
274
|
+
|
|
275
|
+
var onSuccess = function onSuccess() {
|
|
276
|
+
var _targetOptions$onSucc;
|
|
277
|
+
|
|
278
|
+
updateTusState({
|
|
279
|
+
isSuccess: true
|
|
280
|
+
});
|
|
281
|
+
targetOptions === null || targetOptions === void 0 ? void 0 : (_targetOptions$onSucc = targetOptions.onSuccess) === null || _targetOptions$onSucc === void 0 ? void 0 : _targetOptions$onSucc.call(targetOptions);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
var onError = function onError(error) {
|
|
285
|
+
var _targetOptions$onErro;
|
|
286
|
+
|
|
287
|
+
updateTusState({
|
|
288
|
+
error: error
|
|
289
|
+
});
|
|
290
|
+
targetOptions === null || targetOptions === void 0 ? void 0 : (_targetOptions$onErro = targetOptions.onError) === null || _targetOptions$onErro === void 0 ? void 0 : _targetOptions$onErro.call(targetOptions, error);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
var mergedUploadOptions = _objectSpread2(_objectSpread2({}, targetOptions), {}, {
|
|
294
|
+
onSuccess: onSuccess,
|
|
295
|
+
onError: onError
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
var dispatchIsAborted = function dispatchIsAborted(isAborted) {
|
|
299
|
+
updateTusState({
|
|
300
|
+
isAborted: isAborted
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
var upload = createUpload(file, mergedUploadOptions, dispatchIsAborted);
|
|
305
|
+
|
|
306
|
+
if (autoStart) {
|
|
307
|
+
startOrResumeUpload(upload);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
updateTusState({
|
|
311
|
+
upload: upload
|
|
312
|
+
});
|
|
313
|
+
}, [autoStart, updateTusState, uploadOptions]);
|
|
314
|
+
var remove = react.useCallback(function () {
|
|
315
|
+
var _tusState$upload;
|
|
316
|
+
|
|
317
|
+
tusState === null || tusState === void 0 ? void 0 : (_tusState$upload = tusState.upload) === null || _tusState$upload === void 0 ? void 0 : _tusState$upload.abort();
|
|
318
|
+
setTusState(initialUseTusState);
|
|
319
|
+
}, [tusState === null || tusState === void 0 ? void 0 : tusState.upload]);
|
|
320
|
+
var tusResult = react.useMemo(function () {
|
|
321
|
+
var _tusState$isSuccess, _tusState$isAborted;
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
upload: tusState === null || tusState === void 0 ? void 0 : tusState.upload,
|
|
325
|
+
isSuccess: (_tusState$isSuccess = tusState === null || tusState === void 0 ? void 0 : tusState.isSuccess) !== null && _tusState$isSuccess !== void 0 ? _tusState$isSuccess : false,
|
|
326
|
+
error: tusState === null || tusState === void 0 ? void 0 : tusState.error,
|
|
327
|
+
isAborted: (_tusState$isAborted = tusState === null || tusState === void 0 ? void 0 : tusState.isAborted) !== null && _tusState$isAborted !== void 0 ? _tusState$isAborted : false,
|
|
328
|
+
setUpload: setUpload,
|
|
329
|
+
remove: remove
|
|
330
|
+
};
|
|
331
|
+
}, [tusState, setUpload, remove]);
|
|
332
|
+
useAutoAbort(tusResult.upload, autoAbort !== null && autoAbort !== void 0 ? autoAbort : false);
|
|
333
|
+
return tusResult;
|
|
334
|
+
};
|
|
335
|
+
|
|
212
336
|
var ERROR_MESSAGES = {
|
|
213
|
-
tusClientHasNotFounded:
|
|
214
|
-
tusIsNotSupported:
|
|
337
|
+
tusClientHasNotFounded: "No TusClient set, use TusClientProvider to set one",
|
|
338
|
+
tusIsNotSupported: "This browser does not support uploads. Please use a modern browser instead."
|
|
215
339
|
};
|
|
216
340
|
|
|
217
|
-
var TusClientStateContext =
|
|
218
|
-
var TusClientDispatchContext =
|
|
341
|
+
var TusClientStateContext = react.createContext(undefined);
|
|
342
|
+
var TusClientDispatchContext = react.createContext(undefined);
|
|
219
343
|
var useTusClientState = function useTusClientState() {
|
|
220
|
-
var tusClientState =
|
|
344
|
+
var tusClientState = react.useContext(TusClientStateContext);
|
|
221
345
|
|
|
222
|
-
if (!tusClientState && process.env.NODE_ENV !==
|
|
346
|
+
if (!tusClientState && process.env.NODE_ENV !== "production") {
|
|
223
347
|
throw new Error(ERROR_MESSAGES.tusClientHasNotFounded);
|
|
224
348
|
}
|
|
225
349
|
|
|
226
|
-
return
|
|
350
|
+
return react.useMemo(function () {
|
|
227
351
|
return tusClientState;
|
|
228
352
|
}, [tusClientState]);
|
|
229
353
|
};
|
|
230
354
|
var useTusClientDispatch = function useTusClientDispatch() {
|
|
231
|
-
var tusClientDispatch =
|
|
355
|
+
var tusClientDispatch = react.useContext(TusClientDispatchContext);
|
|
232
356
|
|
|
233
|
-
if (!tusClientDispatch && process.env.NODE_ENV !==
|
|
357
|
+
if (!tusClientDispatch && process.env.NODE_ENV !== "production") {
|
|
234
358
|
throw new Error(ERROR_MESSAGES.tusClientHasNotFounded);
|
|
235
359
|
}
|
|
236
360
|
|
|
237
|
-
return
|
|
361
|
+
return react.useMemo(function () {
|
|
238
362
|
return tusClientDispatch;
|
|
239
363
|
}, [tusClientDispatch]);
|
|
240
364
|
};
|
|
241
365
|
|
|
242
366
|
var insertUploadInstance = function insertUploadInstance(cacheKey, upload) {
|
|
243
367
|
return {
|
|
244
|
-
type:
|
|
368
|
+
type: "INSERT_UPLOAD_INSTANCE",
|
|
245
369
|
payload: {
|
|
246
370
|
cacheKey: cacheKey,
|
|
247
371
|
uploadState: {
|
|
@@ -254,7 +378,7 @@ var insertUploadInstance = function insertUploadInstance(cacheKey, upload) {
|
|
|
254
378
|
};
|
|
255
379
|
var updateSuccessUpload = function updateSuccessUpload(cacheKey) {
|
|
256
380
|
return {
|
|
257
|
-
type:
|
|
381
|
+
type: "UPDATE_SUCCESS_UPLOAD",
|
|
258
382
|
payload: {
|
|
259
383
|
cacheKey: cacheKey
|
|
260
384
|
}
|
|
@@ -262,7 +386,7 @@ var updateSuccessUpload = function updateSuccessUpload(cacheKey) {
|
|
|
262
386
|
};
|
|
263
387
|
var updateErrorUpload = function updateErrorUpload(cacheKey, error) {
|
|
264
388
|
return {
|
|
265
|
-
type:
|
|
389
|
+
type: "UPDATE_ERROR_UPLOAD",
|
|
266
390
|
payload: {
|
|
267
391
|
cacheKey: cacheKey,
|
|
268
392
|
error: error
|
|
@@ -271,7 +395,7 @@ var updateErrorUpload = function updateErrorUpload(cacheKey, error) {
|
|
|
271
395
|
};
|
|
272
396
|
var updateIsAbortedUpload = function updateIsAbortedUpload(cacheKey, isAborted) {
|
|
273
397
|
return {
|
|
274
|
-
type:
|
|
398
|
+
type: "UPDATE_IS_ABORTED_UPLOAD",
|
|
275
399
|
payload: {
|
|
276
400
|
cacheKey: cacheKey,
|
|
277
401
|
isAborted: isAborted
|
|
@@ -280,205 +404,78 @@ var updateIsAbortedUpload = function updateIsAbortedUpload(cacheKey, isAborted)
|
|
|
280
404
|
};
|
|
281
405
|
var removeUploadInstance = function removeUploadInstance(cacheKey) {
|
|
282
406
|
return {
|
|
283
|
-
type:
|
|
407
|
+
type: "REMOVE_UPLOAD_INSTANCE",
|
|
284
408
|
payload: {
|
|
285
409
|
cacheKey: cacheKey
|
|
286
410
|
}
|
|
287
411
|
};
|
|
288
412
|
};
|
|
289
|
-
var
|
|
413
|
+
var updateDefaultOptions = function updateDefaultOptions(defaultOptions) {
|
|
290
414
|
return {
|
|
291
|
-
type:
|
|
292
|
-
payload:
|
|
293
|
-
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
var createOptionHandler = function createOptionHandler(handlers, _ref) {
|
|
297
|
-
var dispatch = _ref.dispatch,
|
|
298
|
-
internalDispatch = _ref.internalDispatch,
|
|
299
|
-
cacheKey = _ref.cacheKey;
|
|
300
|
-
|
|
301
|
-
var onSuccess = function onSuccess() {
|
|
302
|
-
if (cacheKey) {
|
|
303
|
-
dispatch(updateSuccessUpload(cacheKey));
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (!cacheKey) {
|
|
307
|
-
internalDispatch(function (internalTusState) {
|
|
308
|
-
return _objectSpread2(_objectSpread2({}, internalTusState), {}, {
|
|
309
|
-
isSuccess: true
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (handlers.onSuccess) {
|
|
315
|
-
handlers.onSuccess();
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
var onError = function onError(err) {
|
|
320
|
-
if (cacheKey) {
|
|
321
|
-
dispatch(updateErrorUpload(cacheKey, err));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (!cacheKey) {
|
|
325
|
-
internalDispatch(function (internalTusState) {
|
|
326
|
-
return _objectSpread2(_objectSpread2({}, internalTusState), {}, {
|
|
327
|
-
error: err
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (handlers.onError) {
|
|
333
|
-
handlers.onError(err);
|
|
415
|
+
type: "UPDATE_DEFAULT_OPTIONS",
|
|
416
|
+
payload: {
|
|
417
|
+
defaultOptions: defaultOptions
|
|
334
418
|
}
|
|
335
419
|
};
|
|
336
|
-
|
|
337
|
-
return {
|
|
338
|
-
onSuccess: onSuccess,
|
|
339
|
-
onError: onError
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
var startOrResumeUpload = function startOrResumeUpload(upload) {
|
|
343
|
-
upload.findPreviousUploads().then(function (previousUploads) {
|
|
344
|
-
if (previousUploads.length) {
|
|
345
|
-
upload.resumeFromPreviousUpload(previousUploads[0]);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
upload.start();
|
|
349
|
-
});
|
|
350
420
|
};
|
|
351
|
-
var createUpload = function createUpload(file, options, _ref2) {
|
|
352
|
-
var dispatch = _ref2.dispatch,
|
|
353
|
-
internalDispatch = _ref2.internalDispatch,
|
|
354
|
-
cacheKey = _ref2.cacheKey;
|
|
355
|
-
var upload = new tus.Upload(file, options);
|
|
356
|
-
var originalStart = upload.start.bind(upload);
|
|
357
|
-
var originalAbort = upload.abort.bind(upload);
|
|
358
421
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
422
|
+
var useTusStore = function useTusStore(cacheKey, baseOption) {
|
|
423
|
+
var _useMergeTusOptions = useMergeTusOptions(baseOption),
|
|
424
|
+
autoAbort = _useMergeTusOptions.autoAbort,
|
|
425
|
+
autoStart = _useMergeTusOptions.autoStart,
|
|
426
|
+
uploadOptions = _useMergeTusOptions.uploadOptions;
|
|
364
427
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
};
|
|
428
|
+
var _useTusClientState = useTusClientState(),
|
|
429
|
+
defaultOptions = _useTusClientState.defaultOptions,
|
|
430
|
+
uploads = _useTusClientState.uploads;
|
|
371
431
|
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
};
|
|
432
|
+
var tusClientDispatch = useTusClientDispatch();
|
|
433
|
+
var setUpload = react.useCallback(function (file) {
|
|
434
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
376
435
|
|
|
377
|
-
|
|
378
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
379
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
380
|
-
while (1) {
|
|
381
|
-
switch (_context.prev = _context.next) {
|
|
382
|
-
case 0:
|
|
383
|
-
originalAbort();
|
|
384
|
-
dispatchIsAborted(true);
|
|
436
|
+
var targetOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions(file)), uploadOptions), options);
|
|
385
437
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
return _context.stop();
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}, _callee);
|
|
392
|
-
}));
|
|
438
|
+
var onSuccess = function onSuccess() {
|
|
439
|
+
var _targetOptions$onSucc;
|
|
393
440
|
|
|
394
|
-
|
|
395
|
-
|
|
441
|
+
tusClientDispatch(updateSuccessUpload(cacheKey));
|
|
442
|
+
targetOptions === null || targetOptions === void 0 ? void 0 : (_targetOptions$onSucc = targetOptions.onSuccess) === null || _targetOptions$onSucc === void 0 ? void 0 : _targetOptions$onSucc.call(targetOptions);
|
|
396
443
|
};
|
|
397
|
-
}();
|
|
398
|
-
|
|
399
|
-
upload.start = start;
|
|
400
|
-
upload.abort = abort;
|
|
401
|
-
return upload;
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
var defaultUseTusOptionsValue = Object.freeze({
|
|
405
|
-
cacheKey: undefined,
|
|
406
|
-
autoAbort: true,
|
|
407
|
-
autoStart: false
|
|
408
|
-
});
|
|
409
|
-
var initialUseTusState = Object.freeze({
|
|
410
|
-
upload: undefined,
|
|
411
|
-
isSuccess: false,
|
|
412
|
-
isAborted: false,
|
|
413
|
-
error: undefined
|
|
414
|
-
});
|
|
415
|
-
var useTus = function useTus(useTusOptions) {
|
|
416
|
-
var _defaultUseTusOptions = _objectSpread2(_objectSpread2({}, defaultUseTusOptionsValue), useTusOptions || {}),
|
|
417
|
-
cacheKey = _defaultUseTusOptions.cacheKey,
|
|
418
|
-
autoAbort = _defaultUseTusOptions.autoAbort,
|
|
419
|
-
autoStart = _defaultUseTusOptions.autoStart;
|
|
420
444
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
internalTusState = _useState2[0],
|
|
424
|
-
setInternalTusState = _useState2[1];
|
|
445
|
+
var onError = function onError(error) {
|
|
446
|
+
var _targetOptions$onErro;
|
|
425
447
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
var tus = tusClientState.tusHandler.getTus;
|
|
429
|
-
var setUpload = f.useCallback(function (file) {
|
|
430
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
431
|
-
var dispatcher = {
|
|
432
|
-
cacheKey: cacheKey,
|
|
433
|
-
dispatch: tusClientDispatch,
|
|
434
|
-
internalDispatch: setInternalTusState
|
|
448
|
+
tusClientDispatch(updateErrorUpload(cacheKey, error));
|
|
449
|
+
targetOptions === null || targetOptions === void 0 ? void 0 : (_targetOptions$onErro = targetOptions.onError) === null || _targetOptions$onErro === void 0 ? void 0 : _targetOptions$onErro.call(targetOptions, error);
|
|
435
450
|
};
|
|
436
451
|
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
var _createOptionHandler = createOptionHandler({
|
|
440
|
-
onError: targetOptions.onError,
|
|
441
|
-
onSuccess: targetOptions.onSuccess
|
|
442
|
-
}, dispatcher),
|
|
443
|
-
onSuccess = _createOptionHandler.onSuccess,
|
|
444
|
-
onError = _createOptionHandler.onError;
|
|
445
|
-
|
|
446
|
-
var uploadOptions = _objectSpread2(_objectSpread2({}, targetOptions), {}, {
|
|
452
|
+
var mergedUploadOptions = _objectSpread2(_objectSpread2({}, targetOptions), {}, {
|
|
447
453
|
onSuccess: onSuccess,
|
|
448
454
|
onError: onError
|
|
449
455
|
});
|
|
450
456
|
|
|
451
|
-
var
|
|
457
|
+
var dispatchIsAborted = function dispatchIsAborted(isAborted) {
|
|
458
|
+
tusClientDispatch(updateIsAbortedUpload(cacheKey, isAborted));
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
var upload = createUpload(file, mergedUploadOptions, dispatchIsAborted);
|
|
452
462
|
|
|
453
463
|
if (autoStart) {
|
|
454
464
|
startOrResumeUpload(upload);
|
|
455
465
|
}
|
|
456
466
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
upload: upload
|
|
464
|
-
}));
|
|
465
|
-
}, [tusClientDispatch, cacheKey, tus, autoStart]);
|
|
466
|
-
var targetTusState = f.useMemo(function () {
|
|
467
|
-
return cacheKey ? tusClientState.uploads[cacheKey] : internalTusState;
|
|
468
|
-
}, [cacheKey, tusClientState, internalTusState]);
|
|
469
|
-
var remove = f.useCallback(function () {
|
|
467
|
+
tusClientDispatch(insertUploadInstance(cacheKey, upload));
|
|
468
|
+
}, [autoStart, cacheKey, defaultOptions, tusClientDispatch, uploadOptions]);
|
|
469
|
+
var targetTusState = react.useMemo(function () {
|
|
470
|
+
return uploads[cacheKey];
|
|
471
|
+
}, [cacheKey, uploads]);
|
|
472
|
+
var remove = react.useCallback(function () {
|
|
470
473
|
var _targetTusState$uploa;
|
|
471
474
|
|
|
472
475
|
targetTusState === null || targetTusState === void 0 ? void 0 : (_targetTusState$uploa = targetTusState.upload) === null || _targetTusState$uploa === void 0 ? void 0 : _targetTusState$uploa.abort();
|
|
473
|
-
|
|
474
|
-
if (!cacheKey) {
|
|
475
|
-
setInternalTusState(initialUseTusState);
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
476
|
tusClientDispatch(removeUploadInstance(cacheKey));
|
|
480
477
|
}, [targetTusState, tusClientDispatch, cacheKey]);
|
|
481
|
-
var tusResult =
|
|
478
|
+
var tusResult = react.useMemo(function () {
|
|
482
479
|
var _targetTusState$isSuc, _targetTusState$isAbo;
|
|
483
480
|
|
|
484
481
|
return {
|
|
@@ -489,1526 +486,90 @@ var useTus = function useTus(useTusOptions) {
|
|
|
489
486
|
setUpload: setUpload,
|
|
490
487
|
remove: remove
|
|
491
488
|
};
|
|
492
|
-
}, [targetTusState, setUpload, remove]);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
497
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
498
|
-
while (1) {
|
|
499
|
-
switch (_context.prev = _context.next) {
|
|
500
|
-
case 0:
|
|
501
|
-
if (tusResult.upload) {
|
|
502
|
-
_context.next = 2;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
return _context.abrupt("return");
|
|
507
|
-
|
|
508
|
-
case 2:
|
|
509
|
-
_context.next = 4;
|
|
510
|
-
return tusResult.upload.abort();
|
|
511
|
-
|
|
512
|
-
case 4:
|
|
513
|
-
case "end":
|
|
514
|
-
return _context.stop();
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}, _callee);
|
|
518
|
-
}));
|
|
519
|
-
|
|
520
|
-
return function abortUploading() {
|
|
521
|
-
return _ref.apply(this, arguments);
|
|
522
|
-
};
|
|
523
|
-
}();
|
|
524
|
-
|
|
525
|
-
return function () {
|
|
526
|
-
if (!autoAbort) {
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
abortUploading();
|
|
531
|
-
};
|
|
532
|
-
}, [autoAbort, tusResult.upload]);
|
|
533
|
-
return tusResult;
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
function createCommonjsModule(fn) {
|
|
537
|
-
var module = { exports: {} };
|
|
538
|
-
return fn(module, module.exports), module.exports;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/*
|
|
542
|
-
object-assign
|
|
543
|
-
(c) Sindre Sorhus
|
|
544
|
-
@license MIT
|
|
545
|
-
*/
|
|
546
|
-
/* eslint-disable no-unused-vars */
|
|
547
|
-
|
|
548
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
549
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
550
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
551
|
-
|
|
552
|
-
function toObject(val) {
|
|
553
|
-
if (val === null || val === undefined) {
|
|
554
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
return Object(val);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
function shouldUseNative() {
|
|
561
|
-
try {
|
|
562
|
-
if (!Object.assign) {
|
|
563
|
-
return false;
|
|
564
|
-
} // Detect buggy property enumeration order in older V8 versions.
|
|
565
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
569
|
-
|
|
570
|
-
test1[5] = 'de';
|
|
571
|
-
|
|
572
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
573
|
-
return false;
|
|
574
|
-
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
var test2 = {};
|
|
578
|
-
|
|
579
|
-
for (var i = 0; i < 10; i++) {
|
|
580
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
584
|
-
return test2[n];
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
if (order2.join('') !== '0123456789') {
|
|
588
|
-
return false;
|
|
589
|
-
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
var test3 = {};
|
|
593
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
594
|
-
test3[letter] = letter;
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
return true;
|
|
602
|
-
} catch (err) {
|
|
603
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
604
|
-
return false;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
609
|
-
var from;
|
|
610
|
-
var to = toObject(target);
|
|
611
|
-
var symbols;
|
|
612
|
-
|
|
613
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
614
|
-
from = Object(arguments[s]);
|
|
615
|
-
|
|
616
|
-
for (var key in from) {
|
|
617
|
-
if (hasOwnProperty.call(from, key)) {
|
|
618
|
-
to[key] = from[key];
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (getOwnPropertySymbols) {
|
|
623
|
-
symbols = getOwnPropertySymbols(from);
|
|
624
|
-
|
|
625
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
626
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
627
|
-
to[symbols[i]] = from[symbols[i]];
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
return to;
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
/** @license React v17.0.2
|
|
637
|
-
* react-jsx-runtime.production.min.js
|
|
638
|
-
*
|
|
639
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
640
|
-
*
|
|
641
|
-
* This source code is licensed under the MIT license found in the
|
|
642
|
-
* LICENSE file in the root directory of this source tree.
|
|
643
|
-
*/
|
|
644
|
-
var reactJsxRuntime_production_min = createCommonjsModule(function (module, exports) {
|
|
645
|
-
|
|
646
|
-
var g = 60103;
|
|
647
|
-
exports.Fragment = 60107;
|
|
648
|
-
|
|
649
|
-
if ("function" === typeof Symbol && Symbol["for"]) {
|
|
650
|
-
var h = Symbol["for"];
|
|
651
|
-
g = h("react.element");
|
|
652
|
-
exports.Fragment = h("react.fragment");
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
var m = f__default['default'].__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
656
|
-
n = Object.prototype.hasOwnProperty,
|
|
657
|
-
p = {
|
|
658
|
-
key: !0,
|
|
659
|
-
ref: !0,
|
|
660
|
-
__self: !0,
|
|
661
|
-
__source: !0
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
function q(c, a, k) {
|
|
665
|
-
var b,
|
|
666
|
-
d = {},
|
|
667
|
-
e = null,
|
|
668
|
-
l = null;
|
|
669
|
-
void 0 !== k && (e = "" + k);
|
|
670
|
-
void 0 !== a.key && (e = "" + a.key);
|
|
671
|
-
void 0 !== a.ref && (l = a.ref);
|
|
672
|
-
|
|
673
|
-
for (b in a) {
|
|
674
|
-
n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
if (c && c.defaultProps) for (b in a = c.defaultProps, a) {
|
|
678
|
-
void 0 === d[b] && (d[b] = a[b]);
|
|
679
|
-
}
|
|
680
|
-
return {
|
|
681
|
-
$$typeof: g,
|
|
682
|
-
type: c,
|
|
683
|
-
key: e,
|
|
684
|
-
ref: l,
|
|
685
|
-
props: d,
|
|
686
|
-
_owner: m.current
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
exports.jsx = q;
|
|
691
|
-
exports.jsxs = q;
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
var reactJsxRuntime_development = createCommonjsModule(function (module, exports) {
|
|
695
|
-
|
|
696
|
-
if (process.env.NODE_ENV !== "production") {
|
|
697
|
-
(function () {
|
|
698
|
-
|
|
699
|
-
var React = f__default['default'];
|
|
700
|
-
var _assign = objectAssign; // ATTENTION
|
|
701
|
-
// When adding new symbols to this file,
|
|
702
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
703
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
704
|
-
// nor polyfill, then a plain number is used for performance.
|
|
705
|
-
|
|
706
|
-
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
707
|
-
var REACT_PORTAL_TYPE = 0xeaca;
|
|
708
|
-
exports.Fragment = 0xeacb;
|
|
709
|
-
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
710
|
-
var REACT_PROFILER_TYPE = 0xead2;
|
|
711
|
-
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
712
|
-
var REACT_CONTEXT_TYPE = 0xeace;
|
|
713
|
-
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
714
|
-
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
715
|
-
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
716
|
-
var REACT_MEMO_TYPE = 0xead3;
|
|
717
|
-
var REACT_LAZY_TYPE = 0xead4;
|
|
718
|
-
var REACT_BLOCK_TYPE = 0xead9;
|
|
719
|
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
720
|
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
721
|
-
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
722
|
-
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
723
|
-
|
|
724
|
-
if (typeof Symbol === 'function' && Symbol["for"]) {
|
|
725
|
-
var symbolFor = Symbol["for"];
|
|
726
|
-
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
727
|
-
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
728
|
-
exports.Fragment = symbolFor('react.fragment');
|
|
729
|
-
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
|
730
|
-
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
731
|
-
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
732
|
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
733
|
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
734
|
-
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
735
|
-
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
736
|
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
737
|
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
738
|
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
739
|
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
740
|
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
741
|
-
symbolFor('react.scope');
|
|
742
|
-
symbolFor('react.opaque.id');
|
|
743
|
-
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
744
|
-
symbolFor('react.offscreen');
|
|
745
|
-
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
749
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
750
|
-
|
|
751
|
-
function getIteratorFn(maybeIterable) {
|
|
752
|
-
if (maybeIterable === null || _typeof(maybeIterable) !== 'object') {
|
|
753
|
-
return null;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
757
|
-
|
|
758
|
-
if (typeof maybeIterator === 'function') {
|
|
759
|
-
return maybeIterator;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
return null;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
766
|
-
|
|
767
|
-
function error(format) {
|
|
768
|
-
{
|
|
769
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
770
|
-
args[_key2 - 1] = arguments[_key2];
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
printWarning('error', format, args);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
function printWarning(level, format, args) {
|
|
778
|
-
// When changing this logic, you might want to also
|
|
779
|
-
// update consoleWithStackDev.www.js as well.
|
|
780
|
-
{
|
|
781
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
782
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
783
|
-
|
|
784
|
-
if (stack !== '') {
|
|
785
|
-
format += '%s';
|
|
786
|
-
args = args.concat([stack]);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
var argsWithFormat = args.map(function (item) {
|
|
790
|
-
return '' + item;
|
|
791
|
-
}); // Careful: RN currently depends on this prefix
|
|
792
|
-
|
|
793
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
794
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
795
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
796
|
-
|
|
797
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
798
|
-
}
|
|
799
|
-
} // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
803
|
-
|
|
804
|
-
function isValidElementType(type) {
|
|
805
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
806
|
-
return true;
|
|
807
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
|
|
811
|
-
return true;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
if (_typeof(type) === 'object' && type !== null) {
|
|
815
|
-
if (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_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
|
816
|
-
return true;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
return false;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
824
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
825
|
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
function getContextName(type) {
|
|
829
|
-
return type.displayName || 'Context';
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function getComponentName(type) {
|
|
833
|
-
if (type == null) {
|
|
834
|
-
// Host root, text node or just invalid type.
|
|
835
|
-
return null;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
{
|
|
839
|
-
if (typeof type.tag === 'number') {
|
|
840
|
-
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
if (typeof type === 'function') {
|
|
845
|
-
return type.displayName || type.name || null;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
if (typeof type === 'string') {
|
|
849
|
-
return type;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
switch (type) {
|
|
853
|
-
case exports.Fragment:
|
|
854
|
-
return 'Fragment';
|
|
855
|
-
|
|
856
|
-
case REACT_PORTAL_TYPE:
|
|
857
|
-
return 'Portal';
|
|
858
|
-
|
|
859
|
-
case REACT_PROFILER_TYPE:
|
|
860
|
-
return 'Profiler';
|
|
861
|
-
|
|
862
|
-
case REACT_STRICT_MODE_TYPE:
|
|
863
|
-
return 'StrictMode';
|
|
864
|
-
|
|
865
|
-
case REACT_SUSPENSE_TYPE:
|
|
866
|
-
return 'Suspense';
|
|
867
|
-
|
|
868
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
869
|
-
return 'SuspenseList';
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
if (_typeof(type) === 'object') {
|
|
873
|
-
switch (type.$$typeof) {
|
|
874
|
-
case REACT_CONTEXT_TYPE:
|
|
875
|
-
var context = type;
|
|
876
|
-
return getContextName(context) + '.Consumer';
|
|
877
|
-
|
|
878
|
-
case REACT_PROVIDER_TYPE:
|
|
879
|
-
var provider = type;
|
|
880
|
-
return getContextName(provider._context) + '.Provider';
|
|
881
|
-
|
|
882
|
-
case REACT_FORWARD_REF_TYPE:
|
|
883
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
884
|
-
|
|
885
|
-
case REACT_MEMO_TYPE:
|
|
886
|
-
return getComponentName(type.type);
|
|
887
|
-
|
|
888
|
-
case REACT_BLOCK_TYPE:
|
|
889
|
-
return getComponentName(type._render);
|
|
890
|
-
|
|
891
|
-
case REACT_LAZY_TYPE:
|
|
892
|
-
{
|
|
893
|
-
var lazyComponent = type;
|
|
894
|
-
var payload = lazyComponent._payload;
|
|
895
|
-
var init = lazyComponent._init;
|
|
896
|
-
|
|
897
|
-
try {
|
|
898
|
-
return getComponentName(init(payload));
|
|
899
|
-
} catch (x) {
|
|
900
|
-
return null;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return null;
|
|
907
|
-
} // Helpers to patch console.logs to avoid logging during side-effect free
|
|
908
|
-
// replaying on render function. This currently only patches the object
|
|
909
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
910
|
-
// We could also eagerly patch the method.
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
var disabledDepth = 0;
|
|
914
|
-
var prevLog;
|
|
915
|
-
var prevInfo;
|
|
916
|
-
var prevWarn;
|
|
917
|
-
var prevError;
|
|
918
|
-
var prevGroup;
|
|
919
|
-
var prevGroupCollapsed;
|
|
920
|
-
var prevGroupEnd;
|
|
921
|
-
|
|
922
|
-
function disabledLog() {}
|
|
923
|
-
|
|
924
|
-
disabledLog.__reactDisabledLog = true;
|
|
925
|
-
|
|
926
|
-
function disableLogs() {
|
|
927
|
-
{
|
|
928
|
-
if (disabledDepth === 0) {
|
|
929
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
930
|
-
prevLog = console.log;
|
|
931
|
-
prevInfo = console.info;
|
|
932
|
-
prevWarn = console.warn;
|
|
933
|
-
prevError = console.error;
|
|
934
|
-
prevGroup = console.group;
|
|
935
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
936
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
937
|
-
|
|
938
|
-
var props = {
|
|
939
|
-
configurable: true,
|
|
940
|
-
enumerable: true,
|
|
941
|
-
value: disabledLog,
|
|
942
|
-
writable: true
|
|
943
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
944
|
-
|
|
945
|
-
Object.defineProperties(console, {
|
|
946
|
-
info: props,
|
|
947
|
-
log: props,
|
|
948
|
-
warn: props,
|
|
949
|
-
error: props,
|
|
950
|
-
group: props,
|
|
951
|
-
groupCollapsed: props,
|
|
952
|
-
groupEnd: props
|
|
953
|
-
});
|
|
954
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
disabledDepth++;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
function reenableLogs() {
|
|
962
|
-
{
|
|
963
|
-
disabledDepth--;
|
|
964
|
-
|
|
965
|
-
if (disabledDepth === 0) {
|
|
966
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
967
|
-
var props = {
|
|
968
|
-
configurable: true,
|
|
969
|
-
enumerable: true,
|
|
970
|
-
writable: true
|
|
971
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
972
|
-
|
|
973
|
-
Object.defineProperties(console, {
|
|
974
|
-
log: _assign({}, props, {
|
|
975
|
-
value: prevLog
|
|
976
|
-
}),
|
|
977
|
-
info: _assign({}, props, {
|
|
978
|
-
value: prevInfo
|
|
979
|
-
}),
|
|
980
|
-
warn: _assign({}, props, {
|
|
981
|
-
value: prevWarn
|
|
982
|
-
}),
|
|
983
|
-
error: _assign({}, props, {
|
|
984
|
-
value: prevError
|
|
985
|
-
}),
|
|
986
|
-
group: _assign({}, props, {
|
|
987
|
-
value: prevGroup
|
|
988
|
-
}),
|
|
989
|
-
groupCollapsed: _assign({}, props, {
|
|
990
|
-
value: prevGroupCollapsed
|
|
991
|
-
}),
|
|
992
|
-
groupEnd: _assign({}, props, {
|
|
993
|
-
value: prevGroupEnd
|
|
994
|
-
})
|
|
995
|
-
});
|
|
996
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
if (disabledDepth < 0) {
|
|
1000
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1006
|
-
var prefix;
|
|
1007
|
-
|
|
1008
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1009
|
-
{
|
|
1010
|
-
if (prefix === undefined) {
|
|
1011
|
-
// Extract the VM specific prefix used by each line.
|
|
1012
|
-
try {
|
|
1013
|
-
throw Error();
|
|
1014
|
-
} catch (x) {
|
|
1015
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1016
|
-
prefix = match && match[1] || '';
|
|
1017
|
-
}
|
|
1018
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
return '\n' + prefix + name;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
var reentry = false;
|
|
1026
|
-
var componentFrameCache;
|
|
1027
|
-
{
|
|
1028
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
1029
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1033
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1034
|
-
if (!fn || reentry) {
|
|
1035
|
-
return '';
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
{
|
|
1039
|
-
var frame = componentFrameCache.get(fn);
|
|
1040
|
-
|
|
1041
|
-
if (frame !== undefined) {
|
|
1042
|
-
return frame;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
var control;
|
|
1046
|
-
reentry = true;
|
|
1047
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1048
|
-
|
|
1049
|
-
Error.prepareStackTrace = undefined;
|
|
1050
|
-
var previousDispatcher;
|
|
1051
|
-
{
|
|
1052
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1053
|
-
// for warnings.
|
|
1054
|
-
|
|
1055
|
-
ReactCurrentDispatcher.current = null;
|
|
1056
|
-
disableLogs();
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
try {
|
|
1060
|
-
// This should throw.
|
|
1061
|
-
if (construct) {
|
|
1062
|
-
// Something should be setting the props in the constructor.
|
|
1063
|
-
var Fake = function Fake() {
|
|
1064
|
-
throw Error();
|
|
1065
|
-
}; // $FlowFixMe
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
1069
|
-
set: function set() {
|
|
1070
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
1071
|
-
// because that won't throw in a non-strict mode function.
|
|
1072
|
-
throw Error();
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
|
|
1076
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === 'object' && Reflect.construct) {
|
|
1077
|
-
// We construct a different control for this case to include any extra
|
|
1078
|
-
// frames added by the construct call.
|
|
1079
|
-
try {
|
|
1080
|
-
Reflect.construct(Fake, []);
|
|
1081
|
-
} catch (x) {
|
|
1082
|
-
control = x;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
Reflect.construct(fn, [], Fake);
|
|
1086
|
-
} else {
|
|
1087
|
-
try {
|
|
1088
|
-
Fake.call();
|
|
1089
|
-
} catch (x) {
|
|
1090
|
-
control = x;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
fn.call(Fake.prototype);
|
|
1094
|
-
}
|
|
1095
|
-
} else {
|
|
1096
|
-
try {
|
|
1097
|
-
throw Error();
|
|
1098
|
-
} catch (x) {
|
|
1099
|
-
control = x;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
fn();
|
|
1103
|
-
}
|
|
1104
|
-
} catch (sample) {
|
|
1105
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
1106
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
1107
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
1108
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
1109
|
-
var sampleLines = sample.stack.split('\n');
|
|
1110
|
-
var controlLines = control.stack.split('\n');
|
|
1111
|
-
var s = sampleLines.length - 1;
|
|
1112
|
-
var c = controlLines.length - 1;
|
|
1113
|
-
|
|
1114
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1115
|
-
// We expect at least one stack frame to be shared.
|
|
1116
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
1117
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1118
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
1119
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
1120
|
-
// the sample somewhere in the control.
|
|
1121
|
-
c--;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1125
|
-
// Next we find the first one that isn't the same which should be the
|
|
1126
|
-
// frame that called our sample function and the control.
|
|
1127
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
1128
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
1129
|
-
// If we're about to return the first line, and the control is also on the same
|
|
1130
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1131
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1132
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
1133
|
-
if (s !== 1 || c !== 1) {
|
|
1134
|
-
do {
|
|
1135
|
-
s--;
|
|
1136
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
1137
|
-
// The next one that isn't the same should be our match though.
|
|
1138
|
-
|
|
1139
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1140
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1141
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
|
1142
|
-
|
|
1143
|
-
{
|
|
1144
|
-
if (typeof fn === 'function') {
|
|
1145
|
-
componentFrameCache.set(fn, _frame);
|
|
1146
|
-
}
|
|
1147
|
-
} // Return the line we found.
|
|
1148
|
-
|
|
1149
|
-
return _frame;
|
|
1150
|
-
}
|
|
1151
|
-
} while (s >= 1 && c >= 0);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
break;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
} finally {
|
|
1159
|
-
reentry = false;
|
|
1160
|
-
{
|
|
1161
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
1162
|
-
reenableLogs();
|
|
1163
|
-
}
|
|
1164
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1165
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
1169
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
1170
|
-
{
|
|
1171
|
-
if (typeof fn === 'function') {
|
|
1172
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
return syntheticFrame;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1179
|
-
{
|
|
1180
|
-
return describeNativeComponentFrame(fn, false);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
function shouldConstruct(Component) {
|
|
1185
|
-
var prototype = Component.prototype;
|
|
1186
|
-
return !!(prototype && prototype.isReactComponent);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1190
|
-
if (type == null) {
|
|
1191
|
-
return '';
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
if (typeof type === 'function') {
|
|
1195
|
-
{
|
|
1196
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
if (typeof type === 'string') {
|
|
1201
|
-
return describeBuiltInComponentFrame(type);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
switch (type) {
|
|
1205
|
-
case REACT_SUSPENSE_TYPE:
|
|
1206
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
1207
|
-
|
|
1208
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
1209
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
if (_typeof(type) === 'object') {
|
|
1213
|
-
switch (type.$$typeof) {
|
|
1214
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1215
|
-
return describeFunctionComponentFrame(type.render);
|
|
1216
|
-
|
|
1217
|
-
case REACT_MEMO_TYPE:
|
|
1218
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
1219
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
1220
|
-
|
|
1221
|
-
case REACT_BLOCK_TYPE:
|
|
1222
|
-
return describeFunctionComponentFrame(type._render);
|
|
1223
|
-
|
|
1224
|
-
case REACT_LAZY_TYPE:
|
|
1225
|
-
{
|
|
1226
|
-
var lazyComponent = type;
|
|
1227
|
-
var payload = lazyComponent._payload;
|
|
1228
|
-
var init = lazyComponent._init;
|
|
1229
|
-
|
|
1230
|
-
try {
|
|
1231
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
1232
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
1233
|
-
} catch (x) {}
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
return '';
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
var loggedTypeFailures = {};
|
|
1242
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1243
|
-
|
|
1244
|
-
function setCurrentlyValidatingElement(element) {
|
|
1245
|
-
{
|
|
1246
|
-
if (element) {
|
|
1247
|
-
var owner = element._owner;
|
|
1248
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1249
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
1250
|
-
} else {
|
|
1251
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1257
|
-
{
|
|
1258
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
1259
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1260
|
-
|
|
1261
|
-
for (var typeSpecName in typeSpecs) {
|
|
1262
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
1263
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
1264
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1265
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1266
|
-
|
|
1267
|
-
try {
|
|
1268
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1269
|
-
// behavior as without this statement except with a better message.
|
|
1270
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1271
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
1272
|
-
err.name = 'Invariant Violation';
|
|
1273
|
-
throw err;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
1277
|
-
} catch (ex) {
|
|
1278
|
-
error$1 = ex;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
1282
|
-
setCurrentlyValidatingElement(element);
|
|
1283
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, _typeof(error$1));
|
|
1284
|
-
setCurrentlyValidatingElement(null);
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1288
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1289
|
-
// same error.
|
|
1290
|
-
loggedTypeFailures[error$1.message] = true;
|
|
1291
|
-
setCurrentlyValidatingElement(element);
|
|
1292
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
1293
|
-
setCurrentlyValidatingElement(null);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
1301
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1302
|
-
var RESERVED_PROPS = {
|
|
1303
|
-
key: true,
|
|
1304
|
-
ref: true,
|
|
1305
|
-
__self: true,
|
|
1306
|
-
__source: true
|
|
1307
|
-
};
|
|
1308
|
-
var specialPropKeyWarningShown;
|
|
1309
|
-
var specialPropRefWarningShown;
|
|
1310
|
-
var didWarnAboutStringRefs;
|
|
1311
|
-
{
|
|
1312
|
-
didWarnAboutStringRefs = {};
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
function hasValidRef(config) {
|
|
1316
|
-
{
|
|
1317
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
1318
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1319
|
-
|
|
1320
|
-
if (getter && getter.isReactWarning) {
|
|
1321
|
-
return false;
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
return config.ref !== undefined;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
function hasValidKey(config) {
|
|
1329
|
-
{
|
|
1330
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
1331
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1332
|
-
|
|
1333
|
-
if (getter && getter.isReactWarning) {
|
|
1334
|
-
return false;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
return config.key !== undefined;
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
1342
|
-
{
|
|
1343
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
1344
|
-
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
1345
|
-
|
|
1346
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
1347
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
1348
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
1355
|
-
{
|
|
1356
|
-
var warnAboutAccessingKey = function warnAboutAccessingKey() {
|
|
1357
|
-
if (!specialPropKeyWarningShown) {
|
|
1358
|
-
specialPropKeyWarningShown = true;
|
|
1359
|
-
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
1364
|
-
Object.defineProperty(props, 'key', {
|
|
1365
|
-
get: warnAboutAccessingKey,
|
|
1366
|
-
configurable: true
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
1372
|
-
{
|
|
1373
|
-
var warnAboutAccessingRef = function warnAboutAccessingRef() {
|
|
1374
|
-
if (!specialPropRefWarningShown) {
|
|
1375
|
-
specialPropRefWarningShown = true;
|
|
1376
|
-
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
1381
|
-
Object.defineProperty(props, 'ref', {
|
|
1382
|
-
get: warnAboutAccessingRef,
|
|
1383
|
-
configurable: true
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
1389
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1390
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1391
|
-
* if something is a React Element.
|
|
1392
|
-
*
|
|
1393
|
-
* @param {*} type
|
|
1394
|
-
* @param {*} props
|
|
1395
|
-
* @param {*} key
|
|
1396
|
-
* @param {string|object} ref
|
|
1397
|
-
* @param {*} owner
|
|
1398
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1399
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
1400
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1401
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
1402
|
-
* change in behavior.
|
|
1403
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1404
|
-
* indicating filename, line number, and/or other information.
|
|
1405
|
-
* @internal
|
|
1406
|
-
*/
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
var ReactElement = function ReactElement(type, key, ref, self, source, owner, props) {
|
|
1410
|
-
var element = {
|
|
1411
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
1412
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
1413
|
-
// Built-in properties that belong on the element
|
|
1414
|
-
type: type,
|
|
1415
|
-
key: key,
|
|
1416
|
-
ref: ref,
|
|
1417
|
-
props: props,
|
|
1418
|
-
// Record the component responsible for creating this element.
|
|
1419
|
-
_owner: owner
|
|
1420
|
-
};
|
|
1421
|
-
{
|
|
1422
|
-
// The validation flag is currently mutative. We put it on
|
|
1423
|
-
// an external backing store so that we can freeze the whole object.
|
|
1424
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
1425
|
-
// commonly used development environments.
|
|
1426
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1427
|
-
// the validation flag non-enumerable (where possible, which should
|
|
1428
|
-
// include every environment we run tests in), so the test framework
|
|
1429
|
-
// ignores it.
|
|
1430
|
-
|
|
1431
|
-
Object.defineProperty(element._store, 'validated', {
|
|
1432
|
-
configurable: false,
|
|
1433
|
-
enumerable: false,
|
|
1434
|
-
writable: true,
|
|
1435
|
-
value: false
|
|
1436
|
-
}); // self and source are DEV only properties.
|
|
1437
|
-
|
|
1438
|
-
Object.defineProperty(element, '_self', {
|
|
1439
|
-
configurable: false,
|
|
1440
|
-
enumerable: false,
|
|
1441
|
-
writable: false,
|
|
1442
|
-
value: self
|
|
1443
|
-
}); // Two elements created in two different places should be considered
|
|
1444
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
1445
|
-
|
|
1446
|
-
Object.defineProperty(element, '_source', {
|
|
1447
|
-
configurable: false,
|
|
1448
|
-
enumerable: false,
|
|
1449
|
-
writable: false,
|
|
1450
|
-
value: source
|
|
1451
|
-
});
|
|
1452
|
-
|
|
1453
|
-
if (Object.freeze) {
|
|
1454
|
-
Object.freeze(element.props);
|
|
1455
|
-
Object.freeze(element);
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
return element;
|
|
1459
|
-
};
|
|
1460
|
-
/**
|
|
1461
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
1462
|
-
* @param {*} type
|
|
1463
|
-
* @param {object} props
|
|
1464
|
-
* @param {string} key
|
|
1465
|
-
*/
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
1469
|
-
{
|
|
1470
|
-
var propName; // Reserved names are extracted
|
|
1471
|
-
|
|
1472
|
-
var props = {};
|
|
1473
|
-
var key = null;
|
|
1474
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
1475
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
1476
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
1477
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
1478
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
1479
|
-
// key is explicitly declared to be undefined or not.
|
|
1480
|
-
|
|
1481
|
-
if (maybeKey !== undefined) {
|
|
1482
|
-
key = '' + maybeKey;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
if (hasValidKey(config)) {
|
|
1486
|
-
key = '' + config.key;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
if (hasValidRef(config)) {
|
|
1490
|
-
ref = config.ref;
|
|
1491
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
1492
|
-
} // Remaining properties are added to a new props object
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
for (propName in config) {
|
|
1496
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1497
|
-
props[propName] = config[propName];
|
|
1498
|
-
}
|
|
1499
|
-
} // Resolve default props
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
if (type && type.defaultProps) {
|
|
1503
|
-
var defaultProps = type.defaultProps;
|
|
1504
|
-
|
|
1505
|
-
for (propName in defaultProps) {
|
|
1506
|
-
if (props[propName] === undefined) {
|
|
1507
|
-
props[propName] = defaultProps[propName];
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
if (key || ref) {
|
|
1513
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1514
|
-
|
|
1515
|
-
if (key) {
|
|
1516
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
if (ref) {
|
|
1520
|
-
defineRefPropWarningGetter(props, displayName);
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1529
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1530
|
-
|
|
1531
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1532
|
-
{
|
|
1533
|
-
if (element) {
|
|
1534
|
-
var owner = element._owner;
|
|
1535
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1536
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1537
|
-
} else {
|
|
1538
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
var propTypesMisspellWarningShown;
|
|
1544
|
-
{
|
|
1545
|
-
propTypesMisspellWarningShown = false;
|
|
1546
|
-
}
|
|
1547
|
-
/**
|
|
1548
|
-
* Verifies the object is a ReactElement.
|
|
1549
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1550
|
-
* @param {?object} object
|
|
1551
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1552
|
-
* @final
|
|
1553
|
-
*/
|
|
1554
|
-
|
|
1555
|
-
function isValidElement(object) {
|
|
1556
|
-
{
|
|
1557
|
-
return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
function getDeclarationErrorAddendum() {
|
|
1562
|
-
{
|
|
1563
|
-
if (ReactCurrentOwner$1.current) {
|
|
1564
|
-
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
1565
|
-
|
|
1566
|
-
if (name) {
|
|
1567
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
return '';
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1576
|
-
{
|
|
1577
|
-
if (source !== undefined) {
|
|
1578
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1579
|
-
var lineNumber = source.lineNumber;
|
|
1580
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
return '';
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
/**
|
|
1587
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1588
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1589
|
-
* updates.
|
|
1590
|
-
*/
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
var ownerHasKeyUseWarning = {};
|
|
1594
|
-
|
|
1595
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1596
|
-
{
|
|
1597
|
-
var info = getDeclarationErrorAddendum();
|
|
1598
|
-
|
|
1599
|
-
if (!info) {
|
|
1600
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1601
|
-
|
|
1602
|
-
if (parentName) {
|
|
1603
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
return info;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1612
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1613
|
-
* reordered. All children that haven't already been validated are required to
|
|
1614
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1615
|
-
* will only be shown once.
|
|
1616
|
-
*
|
|
1617
|
-
* @internal
|
|
1618
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1619
|
-
* @param {*} parentType element's parent's type.
|
|
1620
|
-
*/
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
function validateExplicitKey(element, parentType) {
|
|
1624
|
-
{
|
|
1625
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1626
|
-
return;
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
element._store.validated = true;
|
|
1630
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1631
|
-
|
|
1632
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1637
|
-
// property, it may be the creator of the child that's responsible for
|
|
1638
|
-
// assigning it a key.
|
|
1639
|
-
|
|
1640
|
-
var childOwner = '';
|
|
1641
|
-
|
|
1642
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1643
|
-
// Give the component that originally created this child.
|
|
1644
|
-
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
setCurrentlyValidatingElement$1(element);
|
|
1648
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1649
|
-
setCurrentlyValidatingElement$1(null);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
/**
|
|
1653
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1654
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1655
|
-
* with valid key property.
|
|
1656
|
-
*
|
|
1657
|
-
* @internal
|
|
1658
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1659
|
-
* @param {*} parentType node's parent's type.
|
|
1660
|
-
*/
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
function validateChildKeys(node, parentType) {
|
|
1664
|
-
{
|
|
1665
|
-
if (_typeof(node) !== 'object') {
|
|
1666
|
-
return;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
if (Array.isArray(node)) {
|
|
1670
|
-
for (var i = 0; i < node.length; i++) {
|
|
1671
|
-
var child = node[i];
|
|
1672
|
-
|
|
1673
|
-
if (isValidElement(child)) {
|
|
1674
|
-
validateExplicitKey(child, parentType);
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
} else if (isValidElement(node)) {
|
|
1678
|
-
// This element was passed in a valid location.
|
|
1679
|
-
if (node._store) {
|
|
1680
|
-
node._store.validated = true;
|
|
1681
|
-
}
|
|
1682
|
-
} else if (node) {
|
|
1683
|
-
var iteratorFn = getIteratorFn(node);
|
|
1684
|
-
|
|
1685
|
-
if (typeof iteratorFn === 'function') {
|
|
1686
|
-
// Entry iterators used to provide implicit keys,
|
|
1687
|
-
// but now we print a separate warning for them later.
|
|
1688
|
-
if (iteratorFn !== node.entries) {
|
|
1689
|
-
var iterator = iteratorFn.call(node);
|
|
1690
|
-
var step;
|
|
1691
|
-
|
|
1692
|
-
while (!(step = iterator.next()).done) {
|
|
1693
|
-
if (isValidElement(step.value)) {
|
|
1694
|
-
validateExplicitKey(step.value, parentType);
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
/**
|
|
1703
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1704
|
-
* provided by the type.
|
|
1705
|
-
*
|
|
1706
|
-
* @param {ReactElement} element
|
|
1707
|
-
*/
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
function validatePropTypes(element) {
|
|
1711
|
-
{
|
|
1712
|
-
var type = element.type;
|
|
1713
|
-
|
|
1714
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1715
|
-
return;
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
var propTypes;
|
|
1719
|
-
|
|
1720
|
-
if (typeof type === 'function') {
|
|
1721
|
-
propTypes = type.propTypes;
|
|
1722
|
-
} else if (_typeof(type) === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1723
|
-
// Inner props are checked in the reconciler.
|
|
1724
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1725
|
-
propTypes = type.propTypes;
|
|
1726
|
-
} else {
|
|
1727
|
-
return;
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
if (propTypes) {
|
|
1731
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1732
|
-
var name = getComponentName(type);
|
|
1733
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1734
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1735
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1736
|
-
|
|
1737
|
-
var _name = getComponentName(type);
|
|
1738
|
-
|
|
1739
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1743
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1749
|
-
* @param {ReactElement} fragment
|
|
1750
|
-
*/
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
function validateFragmentProps(fragment) {
|
|
1754
|
-
{
|
|
1755
|
-
var keys = Object.keys(fragment.props);
|
|
1756
|
-
|
|
1757
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1758
|
-
var key = keys[i];
|
|
1759
|
-
|
|
1760
|
-
if (key !== 'children' && key !== 'key') {
|
|
1761
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1762
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1763
|
-
setCurrentlyValidatingElement$1(null);
|
|
1764
|
-
break;
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
if (fragment.ref !== null) {
|
|
1769
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1770
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1771
|
-
setCurrentlyValidatingElement$1(null);
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1777
|
-
{
|
|
1778
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1779
|
-
// succeed and there will likely be errors in render.
|
|
1780
|
-
|
|
1781
|
-
if (!validType) {
|
|
1782
|
-
var info = '';
|
|
1783
|
-
|
|
1784
|
-
if (type === undefined || _typeof(type) === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1785
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1789
|
-
|
|
1790
|
-
if (sourceInfo) {
|
|
1791
|
-
info += sourceInfo;
|
|
1792
|
-
} else {
|
|
1793
|
-
info += getDeclarationErrorAddendum();
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
var typeString;
|
|
1797
|
-
|
|
1798
|
-
if (type === null) {
|
|
1799
|
-
typeString = 'null';
|
|
1800
|
-
} else if (Array.isArray(type)) {
|
|
1801
|
-
typeString = 'array';
|
|
1802
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1803
|
-
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
1804
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1805
|
-
} else {
|
|
1806
|
-
typeString = _typeof(type);
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1813
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1814
|
-
|
|
1815
|
-
if (element == null) {
|
|
1816
|
-
return element;
|
|
1817
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1818
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1819
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1820
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1821
|
-
// fixed, the key warnings will appear.)
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
if (validType) {
|
|
1825
|
-
var children = props.children;
|
|
1826
|
-
|
|
1827
|
-
if (children !== undefined) {
|
|
1828
|
-
if (isStaticChildren) {
|
|
1829
|
-
if (Array.isArray(children)) {
|
|
1830
|
-
for (var i = 0; i < children.length; i++) {
|
|
1831
|
-
validateChildKeys(children[i], type);
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
if (Object.freeze) {
|
|
1835
|
-
Object.freeze(children);
|
|
1836
|
-
}
|
|
1837
|
-
} else {
|
|
1838
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1839
|
-
}
|
|
1840
|
-
} else {
|
|
1841
|
-
validateChildKeys(children, type);
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
if (type === exports.Fragment) {
|
|
1847
|
-
validateFragmentProps(element);
|
|
1848
|
-
} else {
|
|
1849
|
-
validatePropTypes(element);
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
return element;
|
|
1853
|
-
}
|
|
1854
|
-
} // These two functions exist to still get child warnings in dev
|
|
1855
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1856
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1857
|
-
// giving you warnings if you use production apis.
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1861
|
-
{
|
|
1862
|
-
return jsxWithValidation(type, props, key, true);
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1867
|
-
{
|
|
1868
|
-
return jsxWithValidation(type, props, key, false);
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
var jsx = jsxWithValidationDynamic; // we may want to special case jsxs internally to take advantage of static children.
|
|
1873
|
-
// for now we can ship identical prod functions
|
|
1874
|
-
|
|
1875
|
-
var jsxs = jsxWithValidationStatic;
|
|
1876
|
-
exports.jsx = jsx;
|
|
1877
|
-
exports.jsxs = jsxs;
|
|
1878
|
-
})();
|
|
1879
|
-
}
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
|
-
var jsxRuntime = createCommonjsModule(function (module) {
|
|
1883
|
-
|
|
1884
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1885
|
-
module.exports = reactJsxRuntime_production_min;
|
|
1886
|
-
} else {
|
|
1887
|
-
module.exports = reactJsxRuntime_development;
|
|
1888
|
-
}
|
|
1889
|
-
});
|
|
1890
|
-
|
|
1891
|
-
var initialDefaultOptions = function initialDefaultOptions() {
|
|
1892
|
-
return tus__namespace.defaultOptions;
|
|
1893
|
-
};
|
|
1894
|
-
var TusHandler = /*#__PURE__*/function () {
|
|
1895
|
-
function TusHandler(tusConfigs) {
|
|
1896
|
-
_classCallCheck(this, TusHandler);
|
|
1897
|
-
|
|
1898
|
-
var _ref = tusConfigs || {},
|
|
1899
|
-
_ref$canStoreURLs = _ref.canStoreURLs,
|
|
1900
|
-
canStoreURLs = _ref$canStoreURLs === void 0 ? tus__namespace.canStoreURLs : _ref$canStoreURLs,
|
|
1901
|
-
_ref$defaultOptions = _ref.defaultOptions,
|
|
1902
|
-
defaultOptions = _ref$defaultOptions === void 0 ? initialDefaultOptions : _ref$defaultOptions;
|
|
1903
|
-
|
|
1904
|
-
this.tus = _objectSpread2(_objectSpread2({}, tus__namespace), {}, {
|
|
1905
|
-
canStoreURLs: canStoreURLs,
|
|
1906
|
-
defaultOptions: defaultOptions
|
|
1907
|
-
});
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
_createClass(TusHandler, [{
|
|
1911
|
-
key: "getTus",
|
|
1912
|
-
get: function get() {
|
|
1913
|
-
return this.tus;
|
|
1914
|
-
}
|
|
1915
|
-
}]);
|
|
1916
|
-
|
|
1917
|
-
return TusHandler;
|
|
1918
|
-
}();
|
|
489
|
+
}, [targetTusState, setUpload, remove]);
|
|
490
|
+
useAutoAbort(tusResult.upload, autoAbort !== null && autoAbort !== void 0 ? autoAbort : false);
|
|
491
|
+
return tusResult;
|
|
492
|
+
};
|
|
1919
493
|
|
|
1920
494
|
var tusClientReducer = function tusClientReducer(state, actions) {
|
|
1921
495
|
switch (actions.type) {
|
|
1922
|
-
case
|
|
496
|
+
case "INSERT_UPLOAD_INSTANCE":
|
|
1923
497
|
{
|
|
1924
498
|
var _actions$payload = actions.payload,
|
|
1925
|
-
|
|
499
|
+
_cacheKey = _actions$payload.cacheKey,
|
|
1926
500
|
uploadState = _actions$payload.uploadState;
|
|
1927
501
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
1928
|
-
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({},
|
|
502
|
+
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({}, _cacheKey, uploadState))
|
|
1929
503
|
});
|
|
1930
504
|
}
|
|
1931
505
|
|
|
1932
|
-
case
|
|
506
|
+
case "UPDATE_SUCCESS_UPLOAD":
|
|
1933
507
|
{
|
|
1934
|
-
var
|
|
1935
|
-
var target = state.uploads[
|
|
508
|
+
var _cacheKey2 = actions.payload.cacheKey;
|
|
509
|
+
var target = state.uploads[_cacheKey2];
|
|
1936
510
|
|
|
1937
511
|
if (!target) {
|
|
1938
512
|
return state;
|
|
1939
513
|
}
|
|
1940
514
|
|
|
1941
515
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
1942
|
-
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({},
|
|
516
|
+
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({}, _cacheKey2, _objectSpread2(_objectSpread2({}, target || {}), {}, {
|
|
1943
517
|
isSuccess: true
|
|
1944
518
|
})))
|
|
1945
519
|
});
|
|
1946
520
|
}
|
|
1947
521
|
|
|
1948
|
-
case
|
|
522
|
+
case "UPDATE_ERROR_UPLOAD":
|
|
1949
523
|
{
|
|
1950
524
|
var _actions$payload2 = actions.payload,
|
|
1951
|
-
|
|
525
|
+
_cacheKey3 = _actions$payload2.cacheKey,
|
|
1952
526
|
error = _actions$payload2.error;
|
|
1953
|
-
var _target = state.uploads[
|
|
527
|
+
var _target = state.uploads[_cacheKey3];
|
|
1954
528
|
|
|
1955
529
|
if (!_target) {
|
|
1956
530
|
return state;
|
|
1957
531
|
}
|
|
1958
532
|
|
|
1959
533
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
1960
|
-
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({},
|
|
534
|
+
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({}, _cacheKey3, _objectSpread2(_objectSpread2({}, _target), {}, {
|
|
1961
535
|
error: error
|
|
1962
536
|
})))
|
|
1963
537
|
});
|
|
1964
538
|
}
|
|
1965
539
|
|
|
1966
|
-
case
|
|
540
|
+
case "UPDATE_IS_ABORTED_UPLOAD":
|
|
1967
541
|
{
|
|
1968
542
|
var _actions$payload3 = actions.payload,
|
|
1969
|
-
|
|
543
|
+
_cacheKey4 = _actions$payload3.cacheKey,
|
|
1970
544
|
isAborted = _actions$payload3.isAborted;
|
|
1971
|
-
var _target2 = state.uploads[
|
|
545
|
+
var _target2 = state.uploads[_cacheKey4];
|
|
1972
546
|
|
|
1973
547
|
if (!_target2) {
|
|
1974
548
|
return state;
|
|
1975
549
|
}
|
|
1976
550
|
|
|
1977
551
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
1978
|
-
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({},
|
|
552
|
+
uploads: _objectSpread2(_objectSpread2({}, state.uploads), {}, _defineProperty({}, _cacheKey4, _objectSpread2(_objectSpread2({}, _target2), {}, {
|
|
1979
553
|
isAborted: isAborted
|
|
1980
554
|
})))
|
|
1981
555
|
});
|
|
1982
556
|
}
|
|
1983
557
|
|
|
1984
|
-
case
|
|
558
|
+
case "REMOVE_UPLOAD_INSTANCE":
|
|
1985
559
|
{
|
|
1986
|
-
var
|
|
560
|
+
var _cacheKey5 = actions.payload.cacheKey;
|
|
1987
561
|
var newUploads = state.uploads;
|
|
1988
|
-
delete newUploads[
|
|
562
|
+
delete newUploads[_cacheKey5];
|
|
1989
563
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
1990
564
|
uploads: newUploads
|
|
1991
565
|
});
|
|
1992
566
|
}
|
|
1993
567
|
|
|
1994
|
-
case
|
|
1995
|
-
{
|
|
1996
|
-
return {
|
|
1997
|
-
tusHandler: new TusHandler(),
|
|
1998
|
-
uploads: {}
|
|
1999
|
-
};
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
case 'UPDATE_TUS_HANDLER_OPTIONS':
|
|
568
|
+
case "UPDATE_DEFAULT_OPTIONS":
|
|
2003
569
|
{
|
|
2004
|
-
var
|
|
2005
|
-
canStoreURLs = _actions$payload4.canStoreURLs,
|
|
2006
|
-
defaultOptions = _actions$payload4.defaultOptions;
|
|
570
|
+
var defaultOptions = actions.payload.defaultOptions;
|
|
2007
571
|
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
2008
|
-
|
|
2009
|
-
canStoreURLs: canStoreURLs,
|
|
2010
|
-
defaultOptions: defaultOptions
|
|
2011
|
-
})
|
|
572
|
+
defaultOptions: defaultOptions
|
|
2012
573
|
});
|
|
2013
574
|
}
|
|
2014
575
|
|
|
@@ -2018,73 +579,42 @@ var tusClientReducer = function tusClientReducer(state, actions) {
|
|
|
2018
579
|
};
|
|
2019
580
|
var tusClientInitialState = {
|
|
2020
581
|
uploads: {},
|
|
2021
|
-
|
|
582
|
+
defaultOptions: undefined
|
|
2022
583
|
};
|
|
2023
584
|
|
|
2024
|
-
var
|
|
2025
|
-
var
|
|
2026
|
-
_ref$defaultOptions = _ref.defaultOptions,
|
|
2027
|
-
defaultOptions = _ref$defaultOptions === void 0 ? initialDefaultOptions : _ref$defaultOptions,
|
|
585
|
+
var TusClientProvider = function TusClientProvider(_ref) {
|
|
586
|
+
var defaultOptions = _ref.defaultOptions,
|
|
2028
587
|
children = _ref.children;
|
|
2029
588
|
|
|
2030
|
-
var
|
|
2031
|
-
|
|
589
|
+
var _useReducer = react.useReducer(tusClientReducer, _objectSpread2(_objectSpread2({}, tusClientInitialState), {}, {
|
|
590
|
+
defaultOptions: defaultOptions
|
|
591
|
+
})),
|
|
592
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
593
|
+
tusClientState = _useReducer2[0],
|
|
594
|
+
tusClientDispatch = _useReducer2[1];
|
|
2032
595
|
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
f.useEffect(function () {
|
|
2036
|
-
if (tusHandler.getTus.isSupported || process.env.NODE_ENV === 'production') {
|
|
596
|
+
react.useEffect(function () {
|
|
597
|
+
if (tusJsClient.isSupported || process.env.NODE_ENV === "production") {
|
|
2037
598
|
return;
|
|
2038
|
-
}
|
|
2039
|
-
|
|
599
|
+
}
|
|
2040
600
|
|
|
2041
601
|
console.error(ERROR_MESSAGES.tusIsNotSupported);
|
|
2042
|
-
}, [
|
|
2043
|
-
|
|
2044
|
-
if (
|
|
602
|
+
}, []);
|
|
603
|
+
react.useEffect(function () {
|
|
604
|
+
if (tusClientState.defaultOptions === defaultOptions) {
|
|
2045
605
|
return;
|
|
2046
606
|
}
|
|
2047
607
|
|
|
2048
|
-
tusClientDispatch(
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
},
|
|
2053
|
-
return
|
|
2054
|
-
children: children
|
|
2055
|
-
}, void 0);
|
|
2056
|
-
};
|
|
2057
|
-
|
|
2058
|
-
var TusClientProvider = function TusClientProvider(_ref) {
|
|
2059
|
-
var canStoreURLs = _ref.canStoreURLs,
|
|
2060
|
-
defaultOptions = _ref.defaultOptions,
|
|
2061
|
-
children = _ref.children;
|
|
2062
|
-
|
|
2063
|
-
var _useReducer = f.useReducer(tusClientReducer, _objectSpread2(_objectSpread2({}, tusClientInitialState), {}, {
|
|
2064
|
-
tusHandler: new TusHandler({
|
|
2065
|
-
canStoreURLs: canStoreURLs,
|
|
2066
|
-
defaultOptions: defaultOptions
|
|
2067
|
-
})
|
|
2068
|
-
})),
|
|
2069
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
2070
|
-
tusClientState = _useReducer2[0],
|
|
2071
|
-
tusClientDispatch = _useReducer2[1];
|
|
2072
|
-
|
|
2073
|
-
return jsxRuntime.jsx(TusClientStateContext.Provider, Object.assign({
|
|
608
|
+
tusClientDispatch(updateDefaultOptions(defaultOptions));
|
|
609
|
+
}, [defaultOptions, tusClientState.defaultOptions]);
|
|
610
|
+
var tusClientDispatchContextProviderElement = react.createElement(TusClientDispatchContext.Provider, {
|
|
611
|
+
value: tusClientDispatch
|
|
612
|
+
}, children);
|
|
613
|
+
return react.createElement(TusClientStateContext.Provider, {
|
|
2074
614
|
value: tusClientState
|
|
2075
|
-
},
|
|
2076
|
-
children: jsxRuntime.jsx(TusClientDispatchContext.Provider, Object.assign({
|
|
2077
|
-
value: tusClientDispatch
|
|
2078
|
-
}, {
|
|
2079
|
-
children: jsxRuntime.jsx(TusController, Object.assign({
|
|
2080
|
-
canStoreURLs: canStoreURLs,
|
|
2081
|
-
defaultOptions: defaultOptions
|
|
2082
|
-
}, {
|
|
2083
|
-
children: children
|
|
2084
|
-
}), void 0)
|
|
2085
|
-
}), void 0)
|
|
2086
|
-
}), void 0);
|
|
615
|
+
}, tusClientDispatchContextProviderElement);
|
|
2087
616
|
};
|
|
2088
617
|
|
|
2089
618
|
exports.TusClientProvider = TusClientProvider;
|
|
2090
619
|
exports.useTus = useTus;
|
|
620
|
+
exports.useTusStore = useTusStore;
|