@knapsack/plugin-changelog-md 4.72.0--canary.4986.9e14d73.0 → 4.72.0--canary.5313.31d559e.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +132 -0
- package/dist/client/index.js +2750 -0
- package/package.json +15 -8
- package/rollup.config.js +108 -6
package/dist/client/index.js
CHANGED
@@ -1,3 +1,2753 @@
|
|
1
|
+
var react = {exports: {}};
|
2
|
+
|
3
|
+
var react_development = {exports: {}};
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @license React
|
7
|
+
* react.development.js
|
8
|
+
*
|
9
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
10
|
+
*
|
11
|
+
* This source code is licensed under the MIT license found in the
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
13
|
+
*/
|
14
|
+
|
15
|
+
(function (module, exports) {
|
16
|
+
|
17
|
+
{
|
18
|
+
(function() {
|
19
|
+
|
20
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
21
|
+
if (
|
22
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
23
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
24
|
+
'function'
|
25
|
+
) {
|
26
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
27
|
+
}
|
28
|
+
var ReactVersion = '18.3.1';
|
29
|
+
|
30
|
+
// ATTENTION
|
31
|
+
// When adding new symbols to this file,
|
32
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
33
|
+
// The Symbol used to tag the ReactElement-like types.
|
34
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
35
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
36
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
37
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
38
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
39
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
40
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
41
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
42
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
43
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
44
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
45
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
46
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
47
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
48
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
49
|
+
function getIteratorFn(maybeIterable) {
|
50
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
|
54
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
55
|
+
|
56
|
+
if (typeof maybeIterator === 'function') {
|
57
|
+
return maybeIterator;
|
58
|
+
}
|
59
|
+
|
60
|
+
return null;
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Keeps track of the current dispatcher.
|
65
|
+
*/
|
66
|
+
var ReactCurrentDispatcher = {
|
67
|
+
/**
|
68
|
+
* @internal
|
69
|
+
* @type {ReactComponent}
|
70
|
+
*/
|
71
|
+
current: null
|
72
|
+
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Keeps track of the current batch's configuration such as how long an update
|
76
|
+
* should suspend for if it needs to.
|
77
|
+
*/
|
78
|
+
var ReactCurrentBatchConfig = {
|
79
|
+
transition: null
|
80
|
+
};
|
81
|
+
|
82
|
+
var ReactCurrentActQueue = {
|
83
|
+
current: null,
|
84
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
85
|
+
isBatchingLegacy: false,
|
86
|
+
didScheduleLegacyUpdate: false
|
87
|
+
};
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Keeps track of the current owner.
|
91
|
+
*
|
92
|
+
* The current owner is the component who should own any components that are
|
93
|
+
* currently being constructed.
|
94
|
+
*/
|
95
|
+
var ReactCurrentOwner = {
|
96
|
+
/**
|
97
|
+
* @internal
|
98
|
+
* @type {ReactComponent}
|
99
|
+
*/
|
100
|
+
current: null
|
101
|
+
};
|
102
|
+
|
103
|
+
var ReactDebugCurrentFrame = {};
|
104
|
+
var currentExtraStackFrame = null;
|
105
|
+
function setExtraStackFrame(stack) {
|
106
|
+
{
|
107
|
+
currentExtraStackFrame = stack;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
{
|
112
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
113
|
+
{
|
114
|
+
currentExtraStackFrame = stack;
|
115
|
+
}
|
116
|
+
}; // Stack implementation injected by the current renderer.
|
117
|
+
|
118
|
+
|
119
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
120
|
+
|
121
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
122
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
123
|
+
|
124
|
+
if (currentExtraStackFrame) {
|
125
|
+
stack += currentExtraStackFrame;
|
126
|
+
} // Delegate to the injected renderer-specific implementation
|
127
|
+
|
128
|
+
|
129
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
130
|
+
|
131
|
+
if (impl) {
|
132
|
+
stack += impl() || '';
|
133
|
+
}
|
134
|
+
|
135
|
+
return stack;
|
136
|
+
};
|
137
|
+
}
|
138
|
+
|
139
|
+
// -----------------------------------------------------------------------------
|
140
|
+
|
141
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
142
|
+
var enableCacheElement = false;
|
143
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
144
|
+
|
145
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
146
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
147
|
+
// issues in DEV builds.
|
148
|
+
|
149
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
150
|
+
|
151
|
+
var ReactSharedInternals = {
|
152
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
153
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
154
|
+
ReactCurrentOwner: ReactCurrentOwner
|
155
|
+
};
|
156
|
+
|
157
|
+
{
|
158
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
159
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
160
|
+
}
|
161
|
+
|
162
|
+
// by calls to these methods by a Babel plugin.
|
163
|
+
//
|
164
|
+
// In PROD (or in packages without access to React internals),
|
165
|
+
// they are left as they are instead.
|
166
|
+
|
167
|
+
function warn(format) {
|
168
|
+
{
|
169
|
+
{
|
170
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
171
|
+
args[_key - 1] = arguments[_key];
|
172
|
+
}
|
173
|
+
|
174
|
+
printWarning('warn', format, args);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
function error(format) {
|
179
|
+
{
|
180
|
+
{
|
181
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
182
|
+
args[_key2 - 1] = arguments[_key2];
|
183
|
+
}
|
184
|
+
|
185
|
+
printWarning('error', format, args);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
function printWarning(level, format, args) {
|
191
|
+
// When changing this logic, you might want to also
|
192
|
+
// update consoleWithStackDev.www.js as well.
|
193
|
+
{
|
194
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
195
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
196
|
+
|
197
|
+
if (stack !== '') {
|
198
|
+
format += '%s';
|
199
|
+
args = args.concat([stack]);
|
200
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
201
|
+
|
202
|
+
|
203
|
+
var argsWithFormat = args.map(function (item) {
|
204
|
+
return String(item);
|
205
|
+
}); // Careful: RN currently depends on this prefix
|
206
|
+
|
207
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
208
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
209
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
210
|
+
|
211
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
216
|
+
|
217
|
+
function warnNoop(publicInstance, callerName) {
|
218
|
+
{
|
219
|
+
var _constructor = publicInstance.constructor;
|
220
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
221
|
+
var warningKey = componentName + "." + callerName;
|
222
|
+
|
223
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
|
227
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
228
|
+
|
229
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
/**
|
233
|
+
* This is the abstract API for an update queue.
|
234
|
+
*/
|
235
|
+
|
236
|
+
|
237
|
+
var ReactNoopUpdateQueue = {
|
238
|
+
/**
|
239
|
+
* Checks whether or not this composite component is mounted.
|
240
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
241
|
+
* @return {boolean} True if mounted, false otherwise.
|
242
|
+
* @protected
|
243
|
+
* @final
|
244
|
+
*/
|
245
|
+
isMounted: function (publicInstance) {
|
246
|
+
return false;
|
247
|
+
},
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Forces an update. This should only be invoked when it is known with
|
251
|
+
* certainty that we are **not** in a DOM transaction.
|
252
|
+
*
|
253
|
+
* You may want to call this when you know that some deeper aspect of the
|
254
|
+
* component's state has changed but `setState` was not called.
|
255
|
+
*
|
256
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
257
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
258
|
+
*
|
259
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
260
|
+
* @param {?function} callback Called after component is updated.
|
261
|
+
* @param {?string} callerName name of the calling function in the public API.
|
262
|
+
* @internal
|
263
|
+
*/
|
264
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
265
|
+
warnNoop(publicInstance, 'forceUpdate');
|
266
|
+
},
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
270
|
+
* You should treat `this.state` as immutable.
|
271
|
+
*
|
272
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
273
|
+
* accessing `this.state` after calling this method may return the old value.
|
274
|
+
*
|
275
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
276
|
+
* @param {object} completeState Next state.
|
277
|
+
* @param {?function} callback Called after component is updated.
|
278
|
+
* @param {?string} callerName name of the calling function in the public API.
|
279
|
+
* @internal
|
280
|
+
*/
|
281
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
282
|
+
warnNoop(publicInstance, 'replaceState');
|
283
|
+
},
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
287
|
+
* internal. This provides a merging strategy that is not available to deep
|
288
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
289
|
+
* during the merge.
|
290
|
+
*
|
291
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
292
|
+
* @param {object} partialState Next partial state to be merged with state.
|
293
|
+
* @param {?function} callback Called after component is updated.
|
294
|
+
* @param {?string} Name of the calling function in the public API.
|
295
|
+
* @internal
|
296
|
+
*/
|
297
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
298
|
+
warnNoop(publicInstance, 'setState');
|
299
|
+
}
|
300
|
+
};
|
301
|
+
|
302
|
+
var assign = Object.assign;
|
303
|
+
|
304
|
+
var emptyObject = {};
|
305
|
+
|
306
|
+
{
|
307
|
+
Object.freeze(emptyObject);
|
308
|
+
}
|
309
|
+
/**
|
310
|
+
* Base class helpers for the updating state of a component.
|
311
|
+
*/
|
312
|
+
|
313
|
+
|
314
|
+
function Component(props, context, updater) {
|
315
|
+
this.props = props;
|
316
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
317
|
+
|
318
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
319
|
+
// renderer.
|
320
|
+
|
321
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
322
|
+
}
|
323
|
+
|
324
|
+
Component.prototype.isReactComponent = {};
|
325
|
+
/**
|
326
|
+
* Sets a subset of the state. Always use this to mutate
|
327
|
+
* state. You should treat `this.state` as immutable.
|
328
|
+
*
|
329
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
330
|
+
* accessing `this.state` after calling this method may return the old value.
|
331
|
+
*
|
332
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
333
|
+
* as they may eventually be batched together. You can provide an optional
|
334
|
+
* callback that will be executed when the call to setState is actually
|
335
|
+
* completed.
|
336
|
+
*
|
337
|
+
* When a function is provided to setState, it will be called at some point in
|
338
|
+
* the future (not synchronously). It will be called with the up to date
|
339
|
+
* component arguments (state, props, context). These values can be different
|
340
|
+
* from this.* because your function may be called after receiveProps but before
|
341
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
342
|
+
* assigned to this.
|
343
|
+
*
|
344
|
+
* @param {object|function} partialState Next partial state or function to
|
345
|
+
* produce next partial state to be merged with current state.
|
346
|
+
* @param {?function} callback Called after state is updated.
|
347
|
+
* @final
|
348
|
+
* @protected
|
349
|
+
*/
|
350
|
+
|
351
|
+
Component.prototype.setState = function (partialState, callback) {
|
352
|
+
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
353
|
+
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
354
|
+
}
|
355
|
+
|
356
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
357
|
+
};
|
358
|
+
/**
|
359
|
+
* Forces an update. This should only be invoked when it is known with
|
360
|
+
* certainty that we are **not** in a DOM transaction.
|
361
|
+
*
|
362
|
+
* You may want to call this when you know that some deeper aspect of the
|
363
|
+
* component's state has changed but `setState` was not called.
|
364
|
+
*
|
365
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
366
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
367
|
+
*
|
368
|
+
* @param {?function} callback Called after update is complete.
|
369
|
+
* @final
|
370
|
+
* @protected
|
371
|
+
*/
|
372
|
+
|
373
|
+
|
374
|
+
Component.prototype.forceUpdate = function (callback) {
|
375
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
376
|
+
};
|
377
|
+
/**
|
378
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
379
|
+
* we would like to deprecate them, we're not going to move them over to this
|
380
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
381
|
+
*/
|
382
|
+
|
383
|
+
|
384
|
+
{
|
385
|
+
var deprecatedAPIs = {
|
386
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
387
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
388
|
+
};
|
389
|
+
|
390
|
+
var defineDeprecationWarning = function (methodName, info) {
|
391
|
+
Object.defineProperty(Component.prototype, methodName, {
|
392
|
+
get: function () {
|
393
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
394
|
+
|
395
|
+
return undefined;
|
396
|
+
}
|
397
|
+
});
|
398
|
+
};
|
399
|
+
|
400
|
+
for (var fnName in deprecatedAPIs) {
|
401
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
402
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
|
407
|
+
function ComponentDummy() {}
|
408
|
+
|
409
|
+
ComponentDummy.prototype = Component.prototype;
|
410
|
+
/**
|
411
|
+
* Convenience component with default shallow equality check for sCU.
|
412
|
+
*/
|
413
|
+
|
414
|
+
function PureComponent(props, context, updater) {
|
415
|
+
this.props = props;
|
416
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
417
|
+
|
418
|
+
this.refs = emptyObject;
|
419
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
420
|
+
}
|
421
|
+
|
422
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
423
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
424
|
+
|
425
|
+
assign(pureComponentPrototype, Component.prototype);
|
426
|
+
pureComponentPrototype.isPureReactComponent = true;
|
427
|
+
|
428
|
+
// an immutable object with a single mutable value
|
429
|
+
function createRef() {
|
430
|
+
var refObject = {
|
431
|
+
current: null
|
432
|
+
};
|
433
|
+
|
434
|
+
{
|
435
|
+
Object.seal(refObject);
|
436
|
+
}
|
437
|
+
|
438
|
+
return refObject;
|
439
|
+
}
|
440
|
+
|
441
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
442
|
+
|
443
|
+
function isArray(a) {
|
444
|
+
return isArrayImpl(a);
|
445
|
+
}
|
446
|
+
|
447
|
+
/*
|
448
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
449
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
450
|
+
*
|
451
|
+
* The functions in this module will throw an easier-to-understand,
|
452
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
453
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
454
|
+
* of the `value` object).
|
455
|
+
*/
|
456
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
457
|
+
function typeName(value) {
|
458
|
+
{
|
459
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
460
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
461
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
462
|
+
return type;
|
463
|
+
}
|
464
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
465
|
+
|
466
|
+
|
467
|
+
function willCoercionThrow(value) {
|
468
|
+
{
|
469
|
+
try {
|
470
|
+
testStringCoercion(value);
|
471
|
+
return false;
|
472
|
+
} catch (e) {
|
473
|
+
return true;
|
474
|
+
}
|
475
|
+
}
|
476
|
+
}
|
477
|
+
|
478
|
+
function testStringCoercion(value) {
|
479
|
+
// If you ended up here by following an exception call stack, here's what's
|
480
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
481
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
482
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
483
|
+
//
|
484
|
+
// The most common types that will cause this exception are `Symbol` instances
|
485
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
486
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
487
|
+
// exception. (Library authors do this to prevent users from using built-in
|
488
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
489
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
490
|
+
//
|
491
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
492
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
493
|
+
//
|
494
|
+
// To find which value is throwing, check the browser or debugger console.
|
495
|
+
// Before this exception was thrown, there should be `console.error` output
|
496
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
497
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
498
|
+
// In most cases, this console output also shows the component and its
|
499
|
+
// ancestor components where the exception happened.
|
500
|
+
//
|
501
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
502
|
+
return '' + value;
|
503
|
+
}
|
504
|
+
function checkKeyStringCoercion(value) {
|
505
|
+
{
|
506
|
+
if (willCoercionThrow(value)) {
|
507
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
508
|
+
|
509
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
510
|
+
}
|
511
|
+
}
|
512
|
+
}
|
513
|
+
|
514
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
515
|
+
var displayName = outerType.displayName;
|
516
|
+
|
517
|
+
if (displayName) {
|
518
|
+
return displayName;
|
519
|
+
}
|
520
|
+
|
521
|
+
var functionName = innerType.displayName || innerType.name || '';
|
522
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
523
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
524
|
+
|
525
|
+
|
526
|
+
function getContextName(type) {
|
527
|
+
return type.displayName || 'Context';
|
528
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
529
|
+
|
530
|
+
|
531
|
+
function getComponentNameFromType(type) {
|
532
|
+
if (type == null) {
|
533
|
+
// Host root, text node or just invalid type.
|
534
|
+
return null;
|
535
|
+
}
|
536
|
+
|
537
|
+
{
|
538
|
+
if (typeof type.tag === 'number') {
|
539
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
540
|
+
}
|
541
|
+
}
|
542
|
+
|
543
|
+
if (typeof type === 'function') {
|
544
|
+
return type.displayName || type.name || null;
|
545
|
+
}
|
546
|
+
|
547
|
+
if (typeof type === 'string') {
|
548
|
+
return type;
|
549
|
+
}
|
550
|
+
|
551
|
+
switch (type) {
|
552
|
+
case REACT_FRAGMENT_TYPE:
|
553
|
+
return 'Fragment';
|
554
|
+
|
555
|
+
case REACT_PORTAL_TYPE:
|
556
|
+
return 'Portal';
|
557
|
+
|
558
|
+
case REACT_PROFILER_TYPE:
|
559
|
+
return 'Profiler';
|
560
|
+
|
561
|
+
case REACT_STRICT_MODE_TYPE:
|
562
|
+
return 'StrictMode';
|
563
|
+
|
564
|
+
case REACT_SUSPENSE_TYPE:
|
565
|
+
return 'Suspense';
|
566
|
+
|
567
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
568
|
+
return 'SuspenseList';
|
569
|
+
|
570
|
+
}
|
571
|
+
|
572
|
+
if (typeof type === 'object') {
|
573
|
+
switch (type.$$typeof) {
|
574
|
+
case REACT_CONTEXT_TYPE:
|
575
|
+
var context = type;
|
576
|
+
return getContextName(context) + '.Consumer';
|
577
|
+
|
578
|
+
case REACT_PROVIDER_TYPE:
|
579
|
+
var provider = type;
|
580
|
+
return getContextName(provider._context) + '.Provider';
|
581
|
+
|
582
|
+
case REACT_FORWARD_REF_TYPE:
|
583
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
584
|
+
|
585
|
+
case REACT_MEMO_TYPE:
|
586
|
+
var outerName = type.displayName || null;
|
587
|
+
|
588
|
+
if (outerName !== null) {
|
589
|
+
return outerName;
|
590
|
+
}
|
591
|
+
|
592
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
593
|
+
|
594
|
+
case REACT_LAZY_TYPE:
|
595
|
+
{
|
596
|
+
var lazyComponent = type;
|
597
|
+
var payload = lazyComponent._payload;
|
598
|
+
var init = lazyComponent._init;
|
599
|
+
|
600
|
+
try {
|
601
|
+
return getComponentNameFromType(init(payload));
|
602
|
+
} catch (x) {
|
603
|
+
return null;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
// eslint-disable-next-line no-fallthrough
|
608
|
+
}
|
609
|
+
}
|
610
|
+
|
611
|
+
return null;
|
612
|
+
}
|
613
|
+
|
614
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
615
|
+
|
616
|
+
var RESERVED_PROPS = {
|
617
|
+
key: true,
|
618
|
+
ref: true,
|
619
|
+
__self: true,
|
620
|
+
__source: true
|
621
|
+
};
|
622
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
623
|
+
|
624
|
+
{
|
625
|
+
didWarnAboutStringRefs = {};
|
626
|
+
}
|
627
|
+
|
628
|
+
function hasValidRef(config) {
|
629
|
+
{
|
630
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
631
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
632
|
+
|
633
|
+
if (getter && getter.isReactWarning) {
|
634
|
+
return false;
|
635
|
+
}
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
return config.ref !== undefined;
|
640
|
+
}
|
641
|
+
|
642
|
+
function hasValidKey(config) {
|
643
|
+
{
|
644
|
+
if (hasOwnProperty.call(config, 'key')) {
|
645
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
646
|
+
|
647
|
+
if (getter && getter.isReactWarning) {
|
648
|
+
return false;
|
649
|
+
}
|
650
|
+
}
|
651
|
+
}
|
652
|
+
|
653
|
+
return config.key !== undefined;
|
654
|
+
}
|
655
|
+
|
656
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
657
|
+
var warnAboutAccessingKey = function () {
|
658
|
+
{
|
659
|
+
if (!specialPropKeyWarningShown) {
|
660
|
+
specialPropKeyWarningShown = true;
|
661
|
+
|
662
|
+
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);
|
663
|
+
}
|
664
|
+
}
|
665
|
+
};
|
666
|
+
|
667
|
+
warnAboutAccessingKey.isReactWarning = true;
|
668
|
+
Object.defineProperty(props, 'key', {
|
669
|
+
get: warnAboutAccessingKey,
|
670
|
+
configurable: true
|
671
|
+
});
|
672
|
+
}
|
673
|
+
|
674
|
+
function defineRefPropWarningGetter(props, displayName) {
|
675
|
+
var warnAboutAccessingRef = function () {
|
676
|
+
{
|
677
|
+
if (!specialPropRefWarningShown) {
|
678
|
+
specialPropRefWarningShown = true;
|
679
|
+
|
680
|
+
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);
|
681
|
+
}
|
682
|
+
}
|
683
|
+
};
|
684
|
+
|
685
|
+
warnAboutAccessingRef.isReactWarning = true;
|
686
|
+
Object.defineProperty(props, 'ref', {
|
687
|
+
get: warnAboutAccessingRef,
|
688
|
+
configurable: true
|
689
|
+
});
|
690
|
+
}
|
691
|
+
|
692
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
693
|
+
{
|
694
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
695
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
696
|
+
|
697
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
698
|
+
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', componentName, config.ref);
|
699
|
+
|
700
|
+
didWarnAboutStringRefs[componentName] = true;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
}
|
704
|
+
}
|
705
|
+
/**
|
706
|
+
* Factory method to create a new React element. This no longer adheres to
|
707
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
708
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
709
|
+
* if something is a React Element.
|
710
|
+
*
|
711
|
+
* @param {*} type
|
712
|
+
* @param {*} props
|
713
|
+
* @param {*} key
|
714
|
+
* @param {string|object} ref
|
715
|
+
* @param {*} owner
|
716
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
717
|
+
* different from the `owner` when React.createElement is called, so that we
|
718
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
719
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
720
|
+
* change in behavior.
|
721
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
722
|
+
* indicating filename, line number, and/or other information.
|
723
|
+
* @internal
|
724
|
+
*/
|
725
|
+
|
726
|
+
|
727
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
728
|
+
var element = {
|
729
|
+
// This tag allows us to uniquely identify this as a React Element
|
730
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
731
|
+
// Built-in properties that belong on the element
|
732
|
+
type: type,
|
733
|
+
key: key,
|
734
|
+
ref: ref,
|
735
|
+
props: props,
|
736
|
+
// Record the component responsible for creating this element.
|
737
|
+
_owner: owner
|
738
|
+
};
|
739
|
+
|
740
|
+
{
|
741
|
+
// The validation flag is currently mutative. We put it on
|
742
|
+
// an external backing store so that we can freeze the whole object.
|
743
|
+
// This can be replaced with a WeakMap once they are implemented in
|
744
|
+
// commonly used development environments.
|
745
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
746
|
+
// the validation flag non-enumerable (where possible, which should
|
747
|
+
// include every environment we run tests in), so the test framework
|
748
|
+
// ignores it.
|
749
|
+
|
750
|
+
Object.defineProperty(element._store, 'validated', {
|
751
|
+
configurable: false,
|
752
|
+
enumerable: false,
|
753
|
+
writable: true,
|
754
|
+
value: false
|
755
|
+
}); // self and source are DEV only properties.
|
756
|
+
|
757
|
+
Object.defineProperty(element, '_self', {
|
758
|
+
configurable: false,
|
759
|
+
enumerable: false,
|
760
|
+
writable: false,
|
761
|
+
value: self
|
762
|
+
}); // Two elements created in two different places should be considered
|
763
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
764
|
+
|
765
|
+
Object.defineProperty(element, '_source', {
|
766
|
+
configurable: false,
|
767
|
+
enumerable: false,
|
768
|
+
writable: false,
|
769
|
+
value: source
|
770
|
+
});
|
771
|
+
|
772
|
+
if (Object.freeze) {
|
773
|
+
Object.freeze(element.props);
|
774
|
+
Object.freeze(element);
|
775
|
+
}
|
776
|
+
}
|
777
|
+
|
778
|
+
return element;
|
779
|
+
};
|
780
|
+
/**
|
781
|
+
* Create and return a new ReactElement of the given type.
|
782
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
783
|
+
*/
|
784
|
+
|
785
|
+
function createElement(type, config, children) {
|
786
|
+
var propName; // Reserved names are extracted
|
787
|
+
|
788
|
+
var props = {};
|
789
|
+
var key = null;
|
790
|
+
var ref = null;
|
791
|
+
var self = null;
|
792
|
+
var source = null;
|
793
|
+
|
794
|
+
if (config != null) {
|
795
|
+
if (hasValidRef(config)) {
|
796
|
+
ref = config.ref;
|
797
|
+
|
798
|
+
{
|
799
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
800
|
+
}
|
801
|
+
}
|
802
|
+
|
803
|
+
if (hasValidKey(config)) {
|
804
|
+
{
|
805
|
+
checkKeyStringCoercion(config.key);
|
806
|
+
}
|
807
|
+
|
808
|
+
key = '' + config.key;
|
809
|
+
}
|
810
|
+
|
811
|
+
self = config.__self === undefined ? null : config.__self;
|
812
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
813
|
+
|
814
|
+
for (propName in config) {
|
815
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
816
|
+
props[propName] = config[propName];
|
817
|
+
}
|
818
|
+
}
|
819
|
+
} // Children can be more than one argument, and those are transferred onto
|
820
|
+
// the newly allocated props object.
|
821
|
+
|
822
|
+
|
823
|
+
var childrenLength = arguments.length - 2;
|
824
|
+
|
825
|
+
if (childrenLength === 1) {
|
826
|
+
props.children = children;
|
827
|
+
} else if (childrenLength > 1) {
|
828
|
+
var childArray = Array(childrenLength);
|
829
|
+
|
830
|
+
for (var i = 0; i < childrenLength; i++) {
|
831
|
+
childArray[i] = arguments[i + 2];
|
832
|
+
}
|
833
|
+
|
834
|
+
{
|
835
|
+
if (Object.freeze) {
|
836
|
+
Object.freeze(childArray);
|
837
|
+
}
|
838
|
+
}
|
839
|
+
|
840
|
+
props.children = childArray;
|
841
|
+
} // Resolve default props
|
842
|
+
|
843
|
+
|
844
|
+
if (type && type.defaultProps) {
|
845
|
+
var defaultProps = type.defaultProps;
|
846
|
+
|
847
|
+
for (propName in defaultProps) {
|
848
|
+
if (props[propName] === undefined) {
|
849
|
+
props[propName] = defaultProps[propName];
|
850
|
+
}
|
851
|
+
}
|
852
|
+
}
|
853
|
+
|
854
|
+
{
|
855
|
+
if (key || ref) {
|
856
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
857
|
+
|
858
|
+
if (key) {
|
859
|
+
defineKeyPropWarningGetter(props, displayName);
|
860
|
+
}
|
861
|
+
|
862
|
+
if (ref) {
|
863
|
+
defineRefPropWarningGetter(props, displayName);
|
864
|
+
}
|
865
|
+
}
|
866
|
+
}
|
867
|
+
|
868
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
869
|
+
}
|
870
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
871
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
872
|
+
return newElement;
|
873
|
+
}
|
874
|
+
/**
|
875
|
+
* Clone and return a new ReactElement using element as the starting point.
|
876
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
877
|
+
*/
|
878
|
+
|
879
|
+
function cloneElement(element, config, children) {
|
880
|
+
if (element === null || element === undefined) {
|
881
|
+
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
882
|
+
}
|
883
|
+
|
884
|
+
var propName; // Original props are copied
|
885
|
+
|
886
|
+
var props = assign({}, element.props); // Reserved names are extracted
|
887
|
+
|
888
|
+
var key = element.key;
|
889
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
890
|
+
|
891
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
892
|
+
// transpiler, and the original source is probably a better indicator of the
|
893
|
+
// true owner.
|
894
|
+
|
895
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
896
|
+
|
897
|
+
var owner = element._owner;
|
898
|
+
|
899
|
+
if (config != null) {
|
900
|
+
if (hasValidRef(config)) {
|
901
|
+
// Silently steal the ref from the parent.
|
902
|
+
ref = config.ref;
|
903
|
+
owner = ReactCurrentOwner.current;
|
904
|
+
}
|
905
|
+
|
906
|
+
if (hasValidKey(config)) {
|
907
|
+
{
|
908
|
+
checkKeyStringCoercion(config.key);
|
909
|
+
}
|
910
|
+
|
911
|
+
key = '' + config.key;
|
912
|
+
} // Remaining properties override existing props
|
913
|
+
|
914
|
+
|
915
|
+
var defaultProps;
|
916
|
+
|
917
|
+
if (element.type && element.type.defaultProps) {
|
918
|
+
defaultProps = element.type.defaultProps;
|
919
|
+
}
|
920
|
+
|
921
|
+
for (propName in config) {
|
922
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
923
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
924
|
+
// Resolve default props
|
925
|
+
props[propName] = defaultProps[propName];
|
926
|
+
} else {
|
927
|
+
props[propName] = config[propName];
|
928
|
+
}
|
929
|
+
}
|
930
|
+
}
|
931
|
+
} // Children can be more than one argument, and those are transferred onto
|
932
|
+
// the newly allocated props object.
|
933
|
+
|
934
|
+
|
935
|
+
var childrenLength = arguments.length - 2;
|
936
|
+
|
937
|
+
if (childrenLength === 1) {
|
938
|
+
props.children = children;
|
939
|
+
} else if (childrenLength > 1) {
|
940
|
+
var childArray = Array(childrenLength);
|
941
|
+
|
942
|
+
for (var i = 0; i < childrenLength; i++) {
|
943
|
+
childArray[i] = arguments[i + 2];
|
944
|
+
}
|
945
|
+
|
946
|
+
props.children = childArray;
|
947
|
+
}
|
948
|
+
|
949
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
950
|
+
}
|
951
|
+
/**
|
952
|
+
* Verifies the object is a ReactElement.
|
953
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
954
|
+
* @param {?object} object
|
955
|
+
* @return {boolean} True if `object` is a ReactElement.
|
956
|
+
* @final
|
957
|
+
*/
|
958
|
+
|
959
|
+
function isValidElement(object) {
|
960
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
961
|
+
}
|
962
|
+
|
963
|
+
var SEPARATOR = '.';
|
964
|
+
var SUBSEPARATOR = ':';
|
965
|
+
/**
|
966
|
+
* Escape and wrap key so it is safe to use as a reactid
|
967
|
+
*
|
968
|
+
* @param {string} key to be escaped.
|
969
|
+
* @return {string} the escaped key.
|
970
|
+
*/
|
971
|
+
|
972
|
+
function escape(key) {
|
973
|
+
var escapeRegex = /[=:]/g;
|
974
|
+
var escaperLookup = {
|
975
|
+
'=': '=0',
|
976
|
+
':': '=2'
|
977
|
+
};
|
978
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
979
|
+
return escaperLookup[match];
|
980
|
+
});
|
981
|
+
return '$' + escapedString;
|
982
|
+
}
|
983
|
+
/**
|
984
|
+
* TODO: Test that a single child and an array with one item have the same key
|
985
|
+
* pattern.
|
986
|
+
*/
|
987
|
+
|
988
|
+
|
989
|
+
var didWarnAboutMaps = false;
|
990
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
991
|
+
|
992
|
+
function escapeUserProvidedKey(text) {
|
993
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
994
|
+
}
|
995
|
+
/**
|
996
|
+
* Generate a key string that identifies a element within a set.
|
997
|
+
*
|
998
|
+
* @param {*} element A element that could contain a manual key.
|
999
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
1000
|
+
* @return {string}
|
1001
|
+
*/
|
1002
|
+
|
1003
|
+
|
1004
|
+
function getElementKey(element, index) {
|
1005
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
1006
|
+
// that we don't block potential future ES APIs.
|
1007
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
1008
|
+
// Explicit key
|
1009
|
+
{
|
1010
|
+
checkKeyStringCoercion(element.key);
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
return escape('' + element.key);
|
1014
|
+
} // Implicit key determined by the index in the set
|
1015
|
+
|
1016
|
+
|
1017
|
+
return index.toString(36);
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
1021
|
+
var type = typeof children;
|
1022
|
+
|
1023
|
+
if (type === 'undefined' || type === 'boolean') {
|
1024
|
+
// All of the above are perceived as null.
|
1025
|
+
children = null;
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
var invokeCallback = false;
|
1029
|
+
|
1030
|
+
if (children === null) {
|
1031
|
+
invokeCallback = true;
|
1032
|
+
} else {
|
1033
|
+
switch (type) {
|
1034
|
+
case 'string':
|
1035
|
+
case 'number':
|
1036
|
+
invokeCallback = true;
|
1037
|
+
break;
|
1038
|
+
|
1039
|
+
case 'object':
|
1040
|
+
switch (children.$$typeof) {
|
1041
|
+
case REACT_ELEMENT_TYPE:
|
1042
|
+
case REACT_PORTAL_TYPE:
|
1043
|
+
invokeCallback = true;
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
if (invokeCallback) {
|
1050
|
+
var _child = children;
|
1051
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
1052
|
+
// so that it's consistent if the number of children grows:
|
1053
|
+
|
1054
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
1055
|
+
|
1056
|
+
if (isArray(mappedChild)) {
|
1057
|
+
var escapedChildKey = '';
|
1058
|
+
|
1059
|
+
if (childKey != null) {
|
1060
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
1064
|
+
return c;
|
1065
|
+
});
|
1066
|
+
} else if (mappedChild != null) {
|
1067
|
+
if (isValidElement(mappedChild)) {
|
1068
|
+
{
|
1069
|
+
// The `if` statement here prevents auto-disabling of the safe
|
1070
|
+
// coercion ESLint rule, so we must manually disable it below.
|
1071
|
+
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1072
|
+
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
1073
|
+
checkKeyStringCoercion(mappedChild.key);
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1078
|
+
// traverseAllChildren used to do for objects as children
|
1079
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1080
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
1081
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
1082
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
array.push(mappedChild);
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
return 1;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
var child;
|
1092
|
+
var nextName;
|
1093
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
1094
|
+
|
1095
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1096
|
+
|
1097
|
+
if (isArray(children)) {
|
1098
|
+
for (var i = 0; i < children.length; i++) {
|
1099
|
+
child = children[i];
|
1100
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
1101
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1102
|
+
}
|
1103
|
+
} else {
|
1104
|
+
var iteratorFn = getIteratorFn(children);
|
1105
|
+
|
1106
|
+
if (typeof iteratorFn === 'function') {
|
1107
|
+
var iterableChildren = children;
|
1108
|
+
|
1109
|
+
{
|
1110
|
+
// Warn about using Maps as children
|
1111
|
+
if (iteratorFn === iterableChildren.entries) {
|
1112
|
+
if (!didWarnAboutMaps) {
|
1113
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
didWarnAboutMaps = true;
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
var iterator = iteratorFn.call(iterableChildren);
|
1121
|
+
var step;
|
1122
|
+
var ii = 0;
|
1123
|
+
|
1124
|
+
while (!(step = iterator.next()).done) {
|
1125
|
+
child = step.value;
|
1126
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
1127
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1128
|
+
}
|
1129
|
+
} else if (type === 'object') {
|
1130
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
1131
|
+
var childrenString = String(children);
|
1132
|
+
throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
return subtreeCount;
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
/**
|
1140
|
+
* Maps children that are typically specified as `props.children`.
|
1141
|
+
*
|
1142
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
1143
|
+
*
|
1144
|
+
* The provided mapFunction(child, index) will be called for each
|
1145
|
+
* leaf child.
|
1146
|
+
*
|
1147
|
+
* @param {?*} children Children tree container.
|
1148
|
+
* @param {function(*, int)} func The map function.
|
1149
|
+
* @param {*} context Context for mapFunction.
|
1150
|
+
* @return {object} Object containing the ordered map of results.
|
1151
|
+
*/
|
1152
|
+
function mapChildren(children, func, context) {
|
1153
|
+
if (children == null) {
|
1154
|
+
return children;
|
1155
|
+
}
|
1156
|
+
|
1157
|
+
var result = [];
|
1158
|
+
var count = 0;
|
1159
|
+
mapIntoArray(children, result, '', '', function (child) {
|
1160
|
+
return func.call(context, child, count++);
|
1161
|
+
});
|
1162
|
+
return result;
|
1163
|
+
}
|
1164
|
+
/**
|
1165
|
+
* Count the number of children that are typically specified as
|
1166
|
+
* `props.children`.
|
1167
|
+
*
|
1168
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
1169
|
+
*
|
1170
|
+
* @param {?*} children Children tree container.
|
1171
|
+
* @return {number} The number of children.
|
1172
|
+
*/
|
1173
|
+
|
1174
|
+
|
1175
|
+
function countChildren(children) {
|
1176
|
+
var n = 0;
|
1177
|
+
mapChildren(children, function () {
|
1178
|
+
n++; // Don't return anything
|
1179
|
+
});
|
1180
|
+
return n;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
/**
|
1184
|
+
* Iterates through children that are typically specified as `props.children`.
|
1185
|
+
*
|
1186
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
1187
|
+
*
|
1188
|
+
* The provided forEachFunc(child, index) will be called for each
|
1189
|
+
* leaf child.
|
1190
|
+
*
|
1191
|
+
* @param {?*} children Children tree container.
|
1192
|
+
* @param {function(*, int)} forEachFunc
|
1193
|
+
* @param {*} forEachContext Context for forEachContext.
|
1194
|
+
*/
|
1195
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
1196
|
+
mapChildren(children, function () {
|
1197
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
1198
|
+
}, forEachContext);
|
1199
|
+
}
|
1200
|
+
/**
|
1201
|
+
* Flatten a children object (typically specified as `props.children`) and
|
1202
|
+
* return an array with appropriately re-keyed children.
|
1203
|
+
*
|
1204
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
1205
|
+
*/
|
1206
|
+
|
1207
|
+
|
1208
|
+
function toArray(children) {
|
1209
|
+
return mapChildren(children, function (child) {
|
1210
|
+
return child;
|
1211
|
+
}) || [];
|
1212
|
+
}
|
1213
|
+
/**
|
1214
|
+
* Returns the first child in a collection of children and verifies that there
|
1215
|
+
* is only one child in the collection.
|
1216
|
+
*
|
1217
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
1218
|
+
*
|
1219
|
+
* The current implementation of this function assumes that a single child gets
|
1220
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
1221
|
+
* abstract away the particular structure of children.
|
1222
|
+
*
|
1223
|
+
* @param {?object} children Child collection structure.
|
1224
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
1225
|
+
* structure.
|
1226
|
+
*/
|
1227
|
+
|
1228
|
+
|
1229
|
+
function onlyChild(children) {
|
1230
|
+
if (!isValidElement(children)) {
|
1231
|
+
throw new Error('React.Children.only expected to receive a single React element child.');
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
return children;
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
function createContext(defaultValue) {
|
1238
|
+
// TODO: Second argument used to be an optional `calculateChangedBits`
|
1239
|
+
// function. Warn to reserve for future use?
|
1240
|
+
var context = {
|
1241
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1242
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
1243
|
+
// some renderers as primary and others as secondary. We only expect
|
1244
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
1245
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
1246
|
+
// Secondary renderers store their context values on separate fields.
|
1247
|
+
_currentValue: defaultValue,
|
1248
|
+
_currentValue2: defaultValue,
|
1249
|
+
// Used to track how many concurrent renderers this context currently
|
1250
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
1251
|
+
_threadCount: 0,
|
1252
|
+
// These are circular
|
1253
|
+
Provider: null,
|
1254
|
+
Consumer: null,
|
1255
|
+
// Add these to use same hidden class in VM as ServerContext
|
1256
|
+
_defaultValue: null,
|
1257
|
+
_globalName: null
|
1258
|
+
};
|
1259
|
+
context.Provider = {
|
1260
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
1261
|
+
_context: context
|
1262
|
+
};
|
1263
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
1264
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
1265
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
1266
|
+
|
1267
|
+
{
|
1268
|
+
// A separate object, but proxies back to the original context object for
|
1269
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
1270
|
+
// warn for the incorrect usage of Context as a Consumer.
|
1271
|
+
var Consumer = {
|
1272
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1273
|
+
_context: context
|
1274
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
1275
|
+
|
1276
|
+
Object.defineProperties(Consumer, {
|
1277
|
+
Provider: {
|
1278
|
+
get: function () {
|
1279
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
1280
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
1281
|
+
|
1282
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
return context.Provider;
|
1286
|
+
},
|
1287
|
+
set: function (_Provider) {
|
1288
|
+
context.Provider = _Provider;
|
1289
|
+
}
|
1290
|
+
},
|
1291
|
+
_currentValue: {
|
1292
|
+
get: function () {
|
1293
|
+
return context._currentValue;
|
1294
|
+
},
|
1295
|
+
set: function (_currentValue) {
|
1296
|
+
context._currentValue = _currentValue;
|
1297
|
+
}
|
1298
|
+
},
|
1299
|
+
_currentValue2: {
|
1300
|
+
get: function () {
|
1301
|
+
return context._currentValue2;
|
1302
|
+
},
|
1303
|
+
set: function (_currentValue2) {
|
1304
|
+
context._currentValue2 = _currentValue2;
|
1305
|
+
}
|
1306
|
+
},
|
1307
|
+
_threadCount: {
|
1308
|
+
get: function () {
|
1309
|
+
return context._threadCount;
|
1310
|
+
},
|
1311
|
+
set: function (_threadCount) {
|
1312
|
+
context._threadCount = _threadCount;
|
1313
|
+
}
|
1314
|
+
},
|
1315
|
+
Consumer: {
|
1316
|
+
get: function () {
|
1317
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1318
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
1319
|
+
|
1320
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
return context.Consumer;
|
1324
|
+
}
|
1325
|
+
},
|
1326
|
+
displayName: {
|
1327
|
+
get: function () {
|
1328
|
+
return context.displayName;
|
1329
|
+
},
|
1330
|
+
set: function (displayName) {
|
1331
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
1332
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
1333
|
+
|
1334
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
1335
|
+
}
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
1339
|
+
|
1340
|
+
context.Consumer = Consumer;
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
{
|
1344
|
+
context._currentRenderer = null;
|
1345
|
+
context._currentRenderer2 = null;
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
return context;
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
var Uninitialized = -1;
|
1352
|
+
var Pending = 0;
|
1353
|
+
var Resolved = 1;
|
1354
|
+
var Rejected = 2;
|
1355
|
+
|
1356
|
+
function lazyInitializer(payload) {
|
1357
|
+
if (payload._status === Uninitialized) {
|
1358
|
+
var ctor = payload._result;
|
1359
|
+
var thenable = ctor(); // Transition to the next state.
|
1360
|
+
// This might throw either because it's missing or throws. If so, we treat it
|
1361
|
+
// as still uninitialized and try again next time. Which is the same as what
|
1362
|
+
// happens if the ctor or any wrappers processing the ctor throws. This might
|
1363
|
+
// end up fixing it if the resolution was a concurrency bug.
|
1364
|
+
|
1365
|
+
thenable.then(function (moduleObject) {
|
1366
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1367
|
+
// Transition to the next state.
|
1368
|
+
var resolved = payload;
|
1369
|
+
resolved._status = Resolved;
|
1370
|
+
resolved._result = moduleObject;
|
1371
|
+
}
|
1372
|
+
}, function (error) {
|
1373
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1374
|
+
// Transition to the next state.
|
1375
|
+
var rejected = payload;
|
1376
|
+
rejected._status = Rejected;
|
1377
|
+
rejected._result = error;
|
1378
|
+
}
|
1379
|
+
});
|
1380
|
+
|
1381
|
+
if (payload._status === Uninitialized) {
|
1382
|
+
// In case, we're still uninitialized, then we're waiting for the thenable
|
1383
|
+
// to resolve. Set it as pending in the meantime.
|
1384
|
+
var pending = payload;
|
1385
|
+
pending._status = Pending;
|
1386
|
+
pending._result = thenable;
|
1387
|
+
}
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
if (payload._status === Resolved) {
|
1391
|
+
var moduleObject = payload._result;
|
1392
|
+
|
1393
|
+
{
|
1394
|
+
if (moduleObject === undefined) {
|
1395
|
+
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
1396
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
1397
|
+
}
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
{
|
1401
|
+
if (!('default' in moduleObject)) {
|
1402
|
+
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
1403
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
return moduleObject.default;
|
1408
|
+
} else {
|
1409
|
+
throw payload._result;
|
1410
|
+
}
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
function lazy(ctor) {
|
1414
|
+
var payload = {
|
1415
|
+
// We use these fields to store the result.
|
1416
|
+
_status: Uninitialized,
|
1417
|
+
_result: ctor
|
1418
|
+
};
|
1419
|
+
var lazyType = {
|
1420
|
+
$$typeof: REACT_LAZY_TYPE,
|
1421
|
+
_payload: payload,
|
1422
|
+
_init: lazyInitializer
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
{
|
1426
|
+
// In production, this would just set it on the object.
|
1427
|
+
var defaultProps;
|
1428
|
+
var propTypes; // $FlowFixMe
|
1429
|
+
|
1430
|
+
Object.defineProperties(lazyType, {
|
1431
|
+
defaultProps: {
|
1432
|
+
configurable: true,
|
1433
|
+
get: function () {
|
1434
|
+
return defaultProps;
|
1435
|
+
},
|
1436
|
+
set: function (newDefaultProps) {
|
1437
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1438
|
+
|
1439
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
1440
|
+
// $FlowFixMe
|
1441
|
+
|
1442
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
1443
|
+
enumerable: true
|
1444
|
+
});
|
1445
|
+
}
|
1446
|
+
},
|
1447
|
+
propTypes: {
|
1448
|
+
configurable: true,
|
1449
|
+
get: function () {
|
1450
|
+
return propTypes;
|
1451
|
+
},
|
1452
|
+
set: function (newPropTypes) {
|
1453
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1454
|
+
|
1455
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
1456
|
+
// $FlowFixMe
|
1457
|
+
|
1458
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
1459
|
+
enumerable: true
|
1460
|
+
});
|
1461
|
+
}
|
1462
|
+
}
|
1463
|
+
});
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
return lazyType;
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
function forwardRef(render) {
|
1470
|
+
{
|
1471
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1472
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1473
|
+
} else if (typeof render !== 'function') {
|
1474
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1475
|
+
} else {
|
1476
|
+
if (render.length !== 0 && render.length !== 2) {
|
1477
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
1478
|
+
}
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
if (render != null) {
|
1482
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
1483
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
var elementType = {
|
1489
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
1490
|
+
render: render
|
1491
|
+
};
|
1492
|
+
|
1493
|
+
{
|
1494
|
+
var ownName;
|
1495
|
+
Object.defineProperty(elementType, 'displayName', {
|
1496
|
+
enumerable: false,
|
1497
|
+
configurable: true,
|
1498
|
+
get: function () {
|
1499
|
+
return ownName;
|
1500
|
+
},
|
1501
|
+
set: function (name) {
|
1502
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
1503
|
+
// because the component may be used elsewhere.
|
1504
|
+
// But it's nice for anonymous functions to inherit the name,
|
1505
|
+
// so that our component-stack generation logic will display their frames.
|
1506
|
+
// An anonymous function generally suggests a pattern like:
|
1507
|
+
// React.forwardRef((props, ref) => {...});
|
1508
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1509
|
+
|
1510
|
+
if (!render.name && !render.displayName) {
|
1511
|
+
render.displayName = name;
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
});
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
return elementType;
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
var REACT_MODULE_REFERENCE;
|
1521
|
+
|
1522
|
+
{
|
1523
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
1524
|
+
}
|
1525
|
+
|
1526
|
+
function isValidElementType(type) {
|
1527
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
1528
|
+
return true;
|
1529
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
1530
|
+
|
1531
|
+
|
1532
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
1533
|
+
return true;
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
if (typeof type === 'object' && type !== null) {
|
1537
|
+
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 || // This needs to include all possible module reference object
|
1538
|
+
// types supported by any Flight configuration anywhere since
|
1539
|
+
// we don't know which Flight build this will end up being used
|
1540
|
+
// with.
|
1541
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
1542
|
+
return true;
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
return false;
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
function memo(type, compare) {
|
1550
|
+
{
|
1551
|
+
if (!isValidElementType(type)) {
|
1552
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1553
|
+
}
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
var elementType = {
|
1557
|
+
$$typeof: REACT_MEMO_TYPE,
|
1558
|
+
type: type,
|
1559
|
+
compare: compare === undefined ? null : compare
|
1560
|
+
};
|
1561
|
+
|
1562
|
+
{
|
1563
|
+
var ownName;
|
1564
|
+
Object.defineProperty(elementType, 'displayName', {
|
1565
|
+
enumerable: false,
|
1566
|
+
configurable: true,
|
1567
|
+
get: function () {
|
1568
|
+
return ownName;
|
1569
|
+
},
|
1570
|
+
set: function (name) {
|
1571
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
1572
|
+
// because the component may be used elsewhere.
|
1573
|
+
// But it's nice for anonymous functions to inherit the name,
|
1574
|
+
// so that our component-stack generation logic will display their frames.
|
1575
|
+
// An anonymous function generally suggests a pattern like:
|
1576
|
+
// React.memo((props) => {...});
|
1577
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1578
|
+
|
1579
|
+
if (!type.name && !type.displayName) {
|
1580
|
+
type.displayName = name;
|
1581
|
+
}
|
1582
|
+
}
|
1583
|
+
});
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
return elementType;
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
function resolveDispatcher() {
|
1590
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
1591
|
+
|
1592
|
+
{
|
1593
|
+
if (dispatcher === null) {
|
1594
|
+
error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
1595
|
+
}
|
1596
|
+
} // Will result in a null access error if accessed outside render phase. We
|
1597
|
+
// intentionally don't throw our own error because this is in a hot path.
|
1598
|
+
// Also helps ensure this is inlined.
|
1599
|
+
|
1600
|
+
|
1601
|
+
return dispatcher;
|
1602
|
+
}
|
1603
|
+
function useContext(Context) {
|
1604
|
+
var dispatcher = resolveDispatcher();
|
1605
|
+
|
1606
|
+
{
|
1607
|
+
// TODO: add a more generic warning for invalid values.
|
1608
|
+
if (Context._context !== undefined) {
|
1609
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
1610
|
+
// and nobody should be using this in existing code.
|
1611
|
+
|
1612
|
+
if (realContext.Consumer === Context) {
|
1613
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
1614
|
+
} else if (realContext.Provider === Context) {
|
1615
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1616
|
+
}
|
1617
|
+
}
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
return dispatcher.useContext(Context);
|
1621
|
+
}
|
1622
|
+
function useState(initialState) {
|
1623
|
+
var dispatcher = resolveDispatcher();
|
1624
|
+
return dispatcher.useState(initialState);
|
1625
|
+
}
|
1626
|
+
function useReducer(reducer, initialArg, init) {
|
1627
|
+
var dispatcher = resolveDispatcher();
|
1628
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
1629
|
+
}
|
1630
|
+
function useRef(initialValue) {
|
1631
|
+
var dispatcher = resolveDispatcher();
|
1632
|
+
return dispatcher.useRef(initialValue);
|
1633
|
+
}
|
1634
|
+
function useEffect(create, deps) {
|
1635
|
+
var dispatcher = resolveDispatcher();
|
1636
|
+
return dispatcher.useEffect(create, deps);
|
1637
|
+
}
|
1638
|
+
function useInsertionEffect(create, deps) {
|
1639
|
+
var dispatcher = resolveDispatcher();
|
1640
|
+
return dispatcher.useInsertionEffect(create, deps);
|
1641
|
+
}
|
1642
|
+
function useLayoutEffect(create, deps) {
|
1643
|
+
var dispatcher = resolveDispatcher();
|
1644
|
+
return dispatcher.useLayoutEffect(create, deps);
|
1645
|
+
}
|
1646
|
+
function useCallback(callback, deps) {
|
1647
|
+
var dispatcher = resolveDispatcher();
|
1648
|
+
return dispatcher.useCallback(callback, deps);
|
1649
|
+
}
|
1650
|
+
function useMemo(create, deps) {
|
1651
|
+
var dispatcher = resolveDispatcher();
|
1652
|
+
return dispatcher.useMemo(create, deps);
|
1653
|
+
}
|
1654
|
+
function useImperativeHandle(ref, create, deps) {
|
1655
|
+
var dispatcher = resolveDispatcher();
|
1656
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
1657
|
+
}
|
1658
|
+
function useDebugValue(value, formatterFn) {
|
1659
|
+
{
|
1660
|
+
var dispatcher = resolveDispatcher();
|
1661
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
1662
|
+
}
|
1663
|
+
}
|
1664
|
+
function useTransition() {
|
1665
|
+
var dispatcher = resolveDispatcher();
|
1666
|
+
return dispatcher.useTransition();
|
1667
|
+
}
|
1668
|
+
function useDeferredValue(value) {
|
1669
|
+
var dispatcher = resolveDispatcher();
|
1670
|
+
return dispatcher.useDeferredValue(value);
|
1671
|
+
}
|
1672
|
+
function useId() {
|
1673
|
+
var dispatcher = resolveDispatcher();
|
1674
|
+
return dispatcher.useId();
|
1675
|
+
}
|
1676
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
1677
|
+
var dispatcher = resolveDispatcher();
|
1678
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
1682
|
+
// replaying on render function. This currently only patches the object
|
1683
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
1684
|
+
// We could also eagerly patch the method.
|
1685
|
+
var disabledDepth = 0;
|
1686
|
+
var prevLog;
|
1687
|
+
var prevInfo;
|
1688
|
+
var prevWarn;
|
1689
|
+
var prevError;
|
1690
|
+
var prevGroup;
|
1691
|
+
var prevGroupCollapsed;
|
1692
|
+
var prevGroupEnd;
|
1693
|
+
|
1694
|
+
function disabledLog() {}
|
1695
|
+
|
1696
|
+
disabledLog.__reactDisabledLog = true;
|
1697
|
+
function disableLogs() {
|
1698
|
+
{
|
1699
|
+
if (disabledDepth === 0) {
|
1700
|
+
/* eslint-disable react-internal/no-production-logging */
|
1701
|
+
prevLog = console.log;
|
1702
|
+
prevInfo = console.info;
|
1703
|
+
prevWarn = console.warn;
|
1704
|
+
prevError = console.error;
|
1705
|
+
prevGroup = console.group;
|
1706
|
+
prevGroupCollapsed = console.groupCollapsed;
|
1707
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
1708
|
+
|
1709
|
+
var props = {
|
1710
|
+
configurable: true,
|
1711
|
+
enumerable: true,
|
1712
|
+
value: disabledLog,
|
1713
|
+
writable: true
|
1714
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
1715
|
+
|
1716
|
+
Object.defineProperties(console, {
|
1717
|
+
info: props,
|
1718
|
+
log: props,
|
1719
|
+
warn: props,
|
1720
|
+
error: props,
|
1721
|
+
group: props,
|
1722
|
+
groupCollapsed: props,
|
1723
|
+
groupEnd: props
|
1724
|
+
});
|
1725
|
+
/* eslint-enable react-internal/no-production-logging */
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
disabledDepth++;
|
1729
|
+
}
|
1730
|
+
}
|
1731
|
+
function reenableLogs() {
|
1732
|
+
{
|
1733
|
+
disabledDepth--;
|
1734
|
+
|
1735
|
+
if (disabledDepth === 0) {
|
1736
|
+
/* eslint-disable react-internal/no-production-logging */
|
1737
|
+
var props = {
|
1738
|
+
configurable: true,
|
1739
|
+
enumerable: true,
|
1740
|
+
writable: true
|
1741
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
1742
|
+
|
1743
|
+
Object.defineProperties(console, {
|
1744
|
+
log: assign({}, props, {
|
1745
|
+
value: prevLog
|
1746
|
+
}),
|
1747
|
+
info: assign({}, props, {
|
1748
|
+
value: prevInfo
|
1749
|
+
}),
|
1750
|
+
warn: assign({}, props, {
|
1751
|
+
value: prevWarn
|
1752
|
+
}),
|
1753
|
+
error: assign({}, props, {
|
1754
|
+
value: prevError
|
1755
|
+
}),
|
1756
|
+
group: assign({}, props, {
|
1757
|
+
value: prevGroup
|
1758
|
+
}),
|
1759
|
+
groupCollapsed: assign({}, props, {
|
1760
|
+
value: prevGroupCollapsed
|
1761
|
+
}),
|
1762
|
+
groupEnd: assign({}, props, {
|
1763
|
+
value: prevGroupEnd
|
1764
|
+
})
|
1765
|
+
});
|
1766
|
+
/* eslint-enable react-internal/no-production-logging */
|
1767
|
+
}
|
1768
|
+
|
1769
|
+
if (disabledDepth < 0) {
|
1770
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
1771
|
+
}
|
1772
|
+
}
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
1776
|
+
var prefix;
|
1777
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
1778
|
+
{
|
1779
|
+
if (prefix === undefined) {
|
1780
|
+
// Extract the VM specific prefix used by each line.
|
1781
|
+
try {
|
1782
|
+
throw Error();
|
1783
|
+
} catch (x) {
|
1784
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
1785
|
+
prefix = match && match[1] || '';
|
1786
|
+
}
|
1787
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
1788
|
+
|
1789
|
+
|
1790
|
+
return '\n' + prefix + name;
|
1791
|
+
}
|
1792
|
+
}
|
1793
|
+
var reentry = false;
|
1794
|
+
var componentFrameCache;
|
1795
|
+
|
1796
|
+
{
|
1797
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
1798
|
+
componentFrameCache = new PossiblyWeakMap();
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
function describeNativeComponentFrame(fn, construct) {
|
1802
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
1803
|
+
if ( !fn || reentry) {
|
1804
|
+
return '';
|
1805
|
+
}
|
1806
|
+
|
1807
|
+
{
|
1808
|
+
var frame = componentFrameCache.get(fn);
|
1809
|
+
|
1810
|
+
if (frame !== undefined) {
|
1811
|
+
return frame;
|
1812
|
+
}
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
var control;
|
1816
|
+
reentry = true;
|
1817
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
1818
|
+
|
1819
|
+
Error.prepareStackTrace = undefined;
|
1820
|
+
var previousDispatcher;
|
1821
|
+
|
1822
|
+
{
|
1823
|
+
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
1824
|
+
// for warnings.
|
1825
|
+
|
1826
|
+
ReactCurrentDispatcher$1.current = null;
|
1827
|
+
disableLogs();
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
try {
|
1831
|
+
// This should throw.
|
1832
|
+
if (construct) {
|
1833
|
+
// Something should be setting the props in the constructor.
|
1834
|
+
var Fake = function () {
|
1835
|
+
throw Error();
|
1836
|
+
}; // $FlowFixMe
|
1837
|
+
|
1838
|
+
|
1839
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
1840
|
+
set: function () {
|
1841
|
+
// We use a throwing setter instead of frozen or non-writable props
|
1842
|
+
// because that won't throw in a non-strict mode function.
|
1843
|
+
throw Error();
|
1844
|
+
}
|
1845
|
+
});
|
1846
|
+
|
1847
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
1848
|
+
// We construct a different control for this case to include any extra
|
1849
|
+
// frames added by the construct call.
|
1850
|
+
try {
|
1851
|
+
Reflect.construct(Fake, []);
|
1852
|
+
} catch (x) {
|
1853
|
+
control = x;
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
Reflect.construct(fn, [], Fake);
|
1857
|
+
} else {
|
1858
|
+
try {
|
1859
|
+
Fake.call();
|
1860
|
+
} catch (x) {
|
1861
|
+
control = x;
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
fn.call(Fake.prototype);
|
1865
|
+
}
|
1866
|
+
} else {
|
1867
|
+
try {
|
1868
|
+
throw Error();
|
1869
|
+
} catch (x) {
|
1870
|
+
control = x;
|
1871
|
+
}
|
1872
|
+
|
1873
|
+
fn();
|
1874
|
+
}
|
1875
|
+
} catch (sample) {
|
1876
|
+
// This is inlined manually because closure doesn't do it for us.
|
1877
|
+
if (sample && control && typeof sample.stack === 'string') {
|
1878
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
1879
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
1880
|
+
var sampleLines = sample.stack.split('\n');
|
1881
|
+
var controlLines = control.stack.split('\n');
|
1882
|
+
var s = sampleLines.length - 1;
|
1883
|
+
var c = controlLines.length - 1;
|
1884
|
+
|
1885
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
1886
|
+
// We expect at least one stack frame to be shared.
|
1887
|
+
// Typically this will be the root most one. However, stack frames may be
|
1888
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
1889
|
+
// earlier than the other. We assume that the sample is longer or the same
|
1890
|
+
// and there for cut off earlier. So we should find the root most frame in
|
1891
|
+
// the sample somewhere in the control.
|
1892
|
+
c--;
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
1896
|
+
// Next we find the first one that isn't the same which should be the
|
1897
|
+
// frame that called our sample function and the control.
|
1898
|
+
if (sampleLines[s] !== controlLines[c]) {
|
1899
|
+
// In V8, the first line is describing the message but other VMs don't.
|
1900
|
+
// If we're about to return the first line, and the control is also on the same
|
1901
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
1902
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
1903
|
+
// This can happen if you passed a class to function component, or non-function.
|
1904
|
+
if (s !== 1 || c !== 1) {
|
1905
|
+
do {
|
1906
|
+
s--;
|
1907
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
1908
|
+
// The next one that isn't the same should be our match though.
|
1909
|
+
|
1910
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
1911
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
1912
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
1913
|
+
// but we have a user-provided "displayName"
|
1914
|
+
// splice it in to make the stack more readable.
|
1915
|
+
|
1916
|
+
|
1917
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
1918
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
{
|
1922
|
+
if (typeof fn === 'function') {
|
1923
|
+
componentFrameCache.set(fn, _frame);
|
1924
|
+
}
|
1925
|
+
} // Return the line we found.
|
1926
|
+
|
1927
|
+
|
1928
|
+
return _frame;
|
1929
|
+
}
|
1930
|
+
} while (s >= 1 && c >= 0);
|
1931
|
+
}
|
1932
|
+
|
1933
|
+
break;
|
1934
|
+
}
|
1935
|
+
}
|
1936
|
+
}
|
1937
|
+
} finally {
|
1938
|
+
reentry = false;
|
1939
|
+
|
1940
|
+
{
|
1941
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
1942
|
+
reenableLogs();
|
1943
|
+
}
|
1944
|
+
|
1945
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
1946
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
1947
|
+
|
1948
|
+
|
1949
|
+
var name = fn ? fn.displayName || fn.name : '';
|
1950
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
1951
|
+
|
1952
|
+
{
|
1953
|
+
if (typeof fn === 'function') {
|
1954
|
+
componentFrameCache.set(fn, syntheticFrame);
|
1955
|
+
}
|
1956
|
+
}
|
1957
|
+
|
1958
|
+
return syntheticFrame;
|
1959
|
+
}
|
1960
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
1961
|
+
{
|
1962
|
+
return describeNativeComponentFrame(fn, false);
|
1963
|
+
}
|
1964
|
+
}
|
1965
|
+
|
1966
|
+
function shouldConstruct(Component) {
|
1967
|
+
var prototype = Component.prototype;
|
1968
|
+
return !!(prototype && prototype.isReactComponent);
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
1972
|
+
|
1973
|
+
if (type == null) {
|
1974
|
+
return '';
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
if (typeof type === 'function') {
|
1978
|
+
{
|
1979
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
if (typeof type === 'string') {
|
1984
|
+
return describeBuiltInComponentFrame(type);
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
switch (type) {
|
1988
|
+
case REACT_SUSPENSE_TYPE:
|
1989
|
+
return describeBuiltInComponentFrame('Suspense');
|
1990
|
+
|
1991
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
1992
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
1993
|
+
}
|
1994
|
+
|
1995
|
+
if (typeof type === 'object') {
|
1996
|
+
switch (type.$$typeof) {
|
1997
|
+
case REACT_FORWARD_REF_TYPE:
|
1998
|
+
return describeFunctionComponentFrame(type.render);
|
1999
|
+
|
2000
|
+
case REACT_MEMO_TYPE:
|
2001
|
+
// Memo may contain any component type so we recursively resolve it.
|
2002
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
2003
|
+
|
2004
|
+
case REACT_LAZY_TYPE:
|
2005
|
+
{
|
2006
|
+
var lazyComponent = type;
|
2007
|
+
var payload = lazyComponent._payload;
|
2008
|
+
var init = lazyComponent._init;
|
2009
|
+
|
2010
|
+
try {
|
2011
|
+
// Lazy may contain any component type so we recursively resolve it.
|
2012
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
2013
|
+
} catch (x) {}
|
2014
|
+
}
|
2015
|
+
}
|
2016
|
+
}
|
2017
|
+
|
2018
|
+
return '';
|
2019
|
+
}
|
2020
|
+
|
2021
|
+
var loggedTypeFailures = {};
|
2022
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2023
|
+
|
2024
|
+
function setCurrentlyValidatingElement(element) {
|
2025
|
+
{
|
2026
|
+
if (element) {
|
2027
|
+
var owner = element._owner;
|
2028
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2029
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
2030
|
+
} else {
|
2031
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
2032
|
+
}
|
2033
|
+
}
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
2037
|
+
{
|
2038
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
2039
|
+
var has = Function.call.bind(hasOwnProperty);
|
2040
|
+
|
2041
|
+
for (var typeSpecName in typeSpecs) {
|
2042
|
+
if (has(typeSpecs, typeSpecName)) {
|
2043
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
2044
|
+
// fail the render phase where it didn't fail before. So we log it.
|
2045
|
+
// After these have been cleaned up, we'll let them throw.
|
2046
|
+
|
2047
|
+
try {
|
2048
|
+
// This is intentionally an invariant that gets caught. It's the same
|
2049
|
+
// behavior as without this statement except with a better message.
|
2050
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2051
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
2052
|
+
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`.');
|
2053
|
+
err.name = 'Invariant Violation';
|
2054
|
+
throw err;
|
2055
|
+
}
|
2056
|
+
|
2057
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
2058
|
+
} catch (ex) {
|
2059
|
+
error$1 = ex;
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
2063
|
+
setCurrentlyValidatingElement(element);
|
2064
|
+
|
2065
|
+
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);
|
2066
|
+
|
2067
|
+
setCurrentlyValidatingElement(null);
|
2068
|
+
}
|
2069
|
+
|
2070
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
2071
|
+
// Only monitor this failure once because there tends to be a lot of the
|
2072
|
+
// same error.
|
2073
|
+
loggedTypeFailures[error$1.message] = true;
|
2074
|
+
setCurrentlyValidatingElement(element);
|
2075
|
+
|
2076
|
+
error('Failed %s type: %s', location, error$1.message);
|
2077
|
+
|
2078
|
+
setCurrentlyValidatingElement(null);
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
}
|
2082
|
+
}
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
function setCurrentlyValidatingElement$1(element) {
|
2086
|
+
{
|
2087
|
+
if (element) {
|
2088
|
+
var owner = element._owner;
|
2089
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2090
|
+
setExtraStackFrame(stack);
|
2091
|
+
} else {
|
2092
|
+
setExtraStackFrame(null);
|
2093
|
+
}
|
2094
|
+
}
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
var propTypesMisspellWarningShown;
|
2098
|
+
|
2099
|
+
{
|
2100
|
+
propTypesMisspellWarningShown = false;
|
2101
|
+
}
|
2102
|
+
|
2103
|
+
function getDeclarationErrorAddendum() {
|
2104
|
+
if (ReactCurrentOwner.current) {
|
2105
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
2106
|
+
|
2107
|
+
if (name) {
|
2108
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
2109
|
+
}
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
return '';
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
function getSourceInfoErrorAddendum(source) {
|
2116
|
+
if (source !== undefined) {
|
2117
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2118
|
+
var lineNumber = source.lineNumber;
|
2119
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
return '';
|
2123
|
+
}
|
2124
|
+
|
2125
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
2126
|
+
if (elementProps !== null && elementProps !== undefined) {
|
2127
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
return '';
|
2131
|
+
}
|
2132
|
+
/**
|
2133
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
2134
|
+
* object keys are not valid. This allows us to keep track of children between
|
2135
|
+
* updates.
|
2136
|
+
*/
|
2137
|
+
|
2138
|
+
|
2139
|
+
var ownerHasKeyUseWarning = {};
|
2140
|
+
|
2141
|
+
function getCurrentComponentErrorInfo(parentType) {
|
2142
|
+
var info = getDeclarationErrorAddendum();
|
2143
|
+
|
2144
|
+
if (!info) {
|
2145
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2146
|
+
|
2147
|
+
if (parentName) {
|
2148
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
2149
|
+
}
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
return info;
|
2153
|
+
}
|
2154
|
+
/**
|
2155
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
2156
|
+
* This element is in an array. The array could grow and shrink or be
|
2157
|
+
* reordered. All children that haven't already been validated are required to
|
2158
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
2159
|
+
* will only be shown once.
|
2160
|
+
*
|
2161
|
+
* @internal
|
2162
|
+
* @param {ReactElement} element Element that requires a key.
|
2163
|
+
* @param {*} parentType element's parent's type.
|
2164
|
+
*/
|
2165
|
+
|
2166
|
+
|
2167
|
+
function validateExplicitKey(element, parentType) {
|
2168
|
+
if (!element._store || element._store.validated || element.key != null) {
|
2169
|
+
return;
|
2170
|
+
}
|
2171
|
+
|
2172
|
+
element._store.validated = true;
|
2173
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2174
|
+
|
2175
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2176
|
+
return;
|
2177
|
+
}
|
2178
|
+
|
2179
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
2180
|
+
// property, it may be the creator of the child that's responsible for
|
2181
|
+
// assigning it a key.
|
2182
|
+
|
2183
|
+
var childOwner = '';
|
2184
|
+
|
2185
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2186
|
+
// Give the component that originally created this child.
|
2187
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
{
|
2191
|
+
setCurrentlyValidatingElement$1(element);
|
2192
|
+
|
2193
|
+
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);
|
2194
|
+
|
2195
|
+
setCurrentlyValidatingElement$1(null);
|
2196
|
+
}
|
2197
|
+
}
|
2198
|
+
/**
|
2199
|
+
* Ensure that every element either is passed in a static location, in an
|
2200
|
+
* array with an explicit keys property defined, or in an object literal
|
2201
|
+
* with valid key property.
|
2202
|
+
*
|
2203
|
+
* @internal
|
2204
|
+
* @param {ReactNode} node Statically passed child of any type.
|
2205
|
+
* @param {*} parentType node's parent's type.
|
2206
|
+
*/
|
2207
|
+
|
2208
|
+
|
2209
|
+
function validateChildKeys(node, parentType) {
|
2210
|
+
if (typeof node !== 'object') {
|
2211
|
+
return;
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
if (isArray(node)) {
|
2215
|
+
for (var i = 0; i < node.length; i++) {
|
2216
|
+
var child = node[i];
|
2217
|
+
|
2218
|
+
if (isValidElement(child)) {
|
2219
|
+
validateExplicitKey(child, parentType);
|
2220
|
+
}
|
2221
|
+
}
|
2222
|
+
} else if (isValidElement(node)) {
|
2223
|
+
// This element was passed in a valid location.
|
2224
|
+
if (node._store) {
|
2225
|
+
node._store.validated = true;
|
2226
|
+
}
|
2227
|
+
} else if (node) {
|
2228
|
+
var iteratorFn = getIteratorFn(node);
|
2229
|
+
|
2230
|
+
if (typeof iteratorFn === 'function') {
|
2231
|
+
// Entry iterators used to provide implicit keys,
|
2232
|
+
// but now we print a separate warning for them later.
|
2233
|
+
if (iteratorFn !== node.entries) {
|
2234
|
+
var iterator = iteratorFn.call(node);
|
2235
|
+
var step;
|
2236
|
+
|
2237
|
+
while (!(step = iterator.next()).done) {
|
2238
|
+
if (isValidElement(step.value)) {
|
2239
|
+
validateExplicitKey(step.value, parentType);
|
2240
|
+
}
|
2241
|
+
}
|
2242
|
+
}
|
2243
|
+
}
|
2244
|
+
}
|
2245
|
+
}
|
2246
|
+
/**
|
2247
|
+
* Given an element, validate that its props follow the propTypes definition,
|
2248
|
+
* provided by the type.
|
2249
|
+
*
|
2250
|
+
* @param {ReactElement} element
|
2251
|
+
*/
|
2252
|
+
|
2253
|
+
|
2254
|
+
function validatePropTypes(element) {
|
2255
|
+
{
|
2256
|
+
var type = element.type;
|
2257
|
+
|
2258
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
2259
|
+
return;
|
2260
|
+
}
|
2261
|
+
|
2262
|
+
var propTypes;
|
2263
|
+
|
2264
|
+
if (typeof type === 'function') {
|
2265
|
+
propTypes = type.propTypes;
|
2266
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
2267
|
+
// Inner props are checked in the reconciler.
|
2268
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
2269
|
+
propTypes = type.propTypes;
|
2270
|
+
} else {
|
2271
|
+
return;
|
2272
|
+
}
|
2273
|
+
|
2274
|
+
if (propTypes) {
|
2275
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
2276
|
+
var name = getComponentNameFromType(type);
|
2277
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
2278
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2279
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
2280
|
+
|
2281
|
+
var _name = getComponentNameFromType(type);
|
2282
|
+
|
2283
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
2284
|
+
}
|
2285
|
+
|
2286
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
2287
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
2288
|
+
}
|
2289
|
+
}
|
2290
|
+
}
|
2291
|
+
/**
|
2292
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
2293
|
+
* @param {ReactElement} fragment
|
2294
|
+
*/
|
2295
|
+
|
2296
|
+
|
2297
|
+
function validateFragmentProps(fragment) {
|
2298
|
+
{
|
2299
|
+
var keys = Object.keys(fragment.props);
|
2300
|
+
|
2301
|
+
for (var i = 0; i < keys.length; i++) {
|
2302
|
+
var key = keys[i];
|
2303
|
+
|
2304
|
+
if (key !== 'children' && key !== 'key') {
|
2305
|
+
setCurrentlyValidatingElement$1(fragment);
|
2306
|
+
|
2307
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2308
|
+
|
2309
|
+
setCurrentlyValidatingElement$1(null);
|
2310
|
+
break;
|
2311
|
+
}
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
if (fragment.ref !== null) {
|
2315
|
+
setCurrentlyValidatingElement$1(fragment);
|
2316
|
+
|
2317
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
2318
|
+
|
2319
|
+
setCurrentlyValidatingElement$1(null);
|
2320
|
+
}
|
2321
|
+
}
|
2322
|
+
}
|
2323
|
+
function createElementWithValidation(type, props, children) {
|
2324
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
2325
|
+
// succeed and there will likely be errors in render.
|
2326
|
+
|
2327
|
+
if (!validType) {
|
2328
|
+
var info = '';
|
2329
|
+
|
2330
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2331
|
+
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.";
|
2332
|
+
}
|
2333
|
+
|
2334
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
2335
|
+
|
2336
|
+
if (sourceInfo) {
|
2337
|
+
info += sourceInfo;
|
2338
|
+
} else {
|
2339
|
+
info += getDeclarationErrorAddendum();
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
var typeString;
|
2343
|
+
|
2344
|
+
if (type === null) {
|
2345
|
+
typeString = 'null';
|
2346
|
+
} else if (isArray(type)) {
|
2347
|
+
typeString = 'array';
|
2348
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2349
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
2350
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
2351
|
+
} else {
|
2352
|
+
typeString = typeof type;
|
2353
|
+
}
|
2354
|
+
|
2355
|
+
{
|
2356
|
+
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
2357
|
+
}
|
2358
|
+
}
|
2359
|
+
|
2360
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
2361
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
2362
|
+
|
2363
|
+
if (element == null) {
|
2364
|
+
return element;
|
2365
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
2366
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
2367
|
+
// We don't want exception behavior to differ between dev and prod.
|
2368
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
2369
|
+
// fixed, the key warnings will appear.)
|
2370
|
+
|
2371
|
+
|
2372
|
+
if (validType) {
|
2373
|
+
for (var i = 2; i < arguments.length; i++) {
|
2374
|
+
validateChildKeys(arguments[i], type);
|
2375
|
+
}
|
2376
|
+
}
|
2377
|
+
|
2378
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
2379
|
+
validateFragmentProps(element);
|
2380
|
+
} else {
|
2381
|
+
validatePropTypes(element);
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
return element;
|
2385
|
+
}
|
2386
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
2387
|
+
function createFactoryWithValidation(type) {
|
2388
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
2389
|
+
validatedFactory.type = type;
|
2390
|
+
|
2391
|
+
{
|
2392
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
2393
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
2394
|
+
|
2395
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
2396
|
+
} // Legacy hook: remove it
|
2397
|
+
|
2398
|
+
|
2399
|
+
Object.defineProperty(validatedFactory, 'type', {
|
2400
|
+
enumerable: false,
|
2401
|
+
get: function () {
|
2402
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2403
|
+
|
2404
|
+
Object.defineProperty(this, 'type', {
|
2405
|
+
value: type
|
2406
|
+
});
|
2407
|
+
return type;
|
2408
|
+
}
|
2409
|
+
});
|
2410
|
+
}
|
2411
|
+
|
2412
|
+
return validatedFactory;
|
2413
|
+
}
|
2414
|
+
function cloneElementWithValidation(element, props, children) {
|
2415
|
+
var newElement = cloneElement.apply(this, arguments);
|
2416
|
+
|
2417
|
+
for (var i = 2; i < arguments.length; i++) {
|
2418
|
+
validateChildKeys(arguments[i], newElement.type);
|
2419
|
+
}
|
2420
|
+
|
2421
|
+
validatePropTypes(newElement);
|
2422
|
+
return newElement;
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
function startTransition(scope, options) {
|
2426
|
+
var prevTransition = ReactCurrentBatchConfig.transition;
|
2427
|
+
ReactCurrentBatchConfig.transition = {};
|
2428
|
+
var currentTransition = ReactCurrentBatchConfig.transition;
|
2429
|
+
|
2430
|
+
{
|
2431
|
+
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
2432
|
+
}
|
2433
|
+
|
2434
|
+
try {
|
2435
|
+
scope();
|
2436
|
+
} finally {
|
2437
|
+
ReactCurrentBatchConfig.transition = prevTransition;
|
2438
|
+
|
2439
|
+
{
|
2440
|
+
if (prevTransition === null && currentTransition._updatedFibers) {
|
2441
|
+
var updatedFibersCount = currentTransition._updatedFibers.size;
|
2442
|
+
|
2443
|
+
if (updatedFibersCount > 10) {
|
2444
|
+
warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
|
2445
|
+
}
|
2446
|
+
|
2447
|
+
currentTransition._updatedFibers.clear();
|
2448
|
+
}
|
2449
|
+
}
|
2450
|
+
}
|
2451
|
+
}
|
2452
|
+
|
2453
|
+
var didWarnAboutMessageChannel = false;
|
2454
|
+
var enqueueTaskImpl = null;
|
2455
|
+
function enqueueTask(task) {
|
2456
|
+
if (enqueueTaskImpl === null) {
|
2457
|
+
try {
|
2458
|
+
// read require off the module object to get around the bundlers.
|
2459
|
+
// we don't want them to detect a require and bundle a Node polyfill.
|
2460
|
+
var requireString = ('require' + Math.random()).slice(0, 7);
|
2461
|
+
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
2462
|
+
// version of setImmediate, bypassing fake timers if any.
|
2463
|
+
|
2464
|
+
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
2465
|
+
} catch (_err) {
|
2466
|
+
// we're in a browser
|
2467
|
+
// we can't use regular timers because they may still be faked
|
2468
|
+
// so we try MessageChannel+postMessage instead
|
2469
|
+
enqueueTaskImpl = function (callback) {
|
2470
|
+
{
|
2471
|
+
if (didWarnAboutMessageChannel === false) {
|
2472
|
+
didWarnAboutMessageChannel = true;
|
2473
|
+
|
2474
|
+
if (typeof MessageChannel === 'undefined') {
|
2475
|
+
error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
2476
|
+
}
|
2477
|
+
}
|
2478
|
+
}
|
2479
|
+
|
2480
|
+
var channel = new MessageChannel();
|
2481
|
+
channel.port1.onmessage = callback;
|
2482
|
+
channel.port2.postMessage(undefined);
|
2483
|
+
};
|
2484
|
+
}
|
2485
|
+
}
|
2486
|
+
|
2487
|
+
return enqueueTaskImpl(task);
|
2488
|
+
}
|
2489
|
+
|
2490
|
+
var actScopeDepth = 0;
|
2491
|
+
var didWarnNoAwaitAct = false;
|
2492
|
+
function act(callback) {
|
2493
|
+
{
|
2494
|
+
// `act` calls can be nested, so we track the depth. This represents the
|
2495
|
+
// number of `act` scopes on the stack.
|
2496
|
+
var prevActScopeDepth = actScopeDepth;
|
2497
|
+
actScopeDepth++;
|
2498
|
+
|
2499
|
+
if (ReactCurrentActQueue.current === null) {
|
2500
|
+
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
2501
|
+
// will detect the queue and use it instead of Scheduler.
|
2502
|
+
ReactCurrentActQueue.current = [];
|
2503
|
+
}
|
2504
|
+
|
2505
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
2506
|
+
var result;
|
2507
|
+
|
2508
|
+
try {
|
2509
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
2510
|
+
// set to `true` while the given callback is executed, not for updates
|
2511
|
+
// triggered during an async event, because this is how the legacy
|
2512
|
+
// implementation of `act` behaved.
|
2513
|
+
ReactCurrentActQueue.isBatchingLegacy = true;
|
2514
|
+
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
2515
|
+
// which flushed updates immediately after the scope function exits, even
|
2516
|
+
// if it's an async function.
|
2517
|
+
|
2518
|
+
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
2519
|
+
var queue = ReactCurrentActQueue.current;
|
2520
|
+
|
2521
|
+
if (queue !== null) {
|
2522
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
2523
|
+
flushActQueue(queue);
|
2524
|
+
}
|
2525
|
+
}
|
2526
|
+
} catch (error) {
|
2527
|
+
popActScope(prevActScopeDepth);
|
2528
|
+
throw error;
|
2529
|
+
} finally {
|
2530
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
2531
|
+
}
|
2532
|
+
|
2533
|
+
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
2534
|
+
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
2535
|
+
// for it to resolve before exiting the current scope.
|
2536
|
+
|
2537
|
+
var wasAwaited = false;
|
2538
|
+
var thenable = {
|
2539
|
+
then: function (resolve, reject) {
|
2540
|
+
wasAwaited = true;
|
2541
|
+
thenableResult.then(function (returnValue) {
|
2542
|
+
popActScope(prevActScopeDepth);
|
2543
|
+
|
2544
|
+
if (actScopeDepth === 0) {
|
2545
|
+
// We've exited the outermost act scope. Recursively flush the
|
2546
|
+
// queue until there's no remaining work.
|
2547
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2548
|
+
} else {
|
2549
|
+
resolve(returnValue);
|
2550
|
+
}
|
2551
|
+
}, function (error) {
|
2552
|
+
// The callback threw an error.
|
2553
|
+
popActScope(prevActScopeDepth);
|
2554
|
+
reject(error);
|
2555
|
+
});
|
2556
|
+
}
|
2557
|
+
};
|
2558
|
+
|
2559
|
+
{
|
2560
|
+
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
2561
|
+
// eslint-disable-next-line no-undef
|
2562
|
+
Promise.resolve().then(function () {}).then(function () {
|
2563
|
+
if (!wasAwaited) {
|
2564
|
+
didWarnNoAwaitAct = true;
|
2565
|
+
|
2566
|
+
error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
|
2567
|
+
}
|
2568
|
+
});
|
2569
|
+
}
|
2570
|
+
}
|
2571
|
+
|
2572
|
+
return thenable;
|
2573
|
+
} else {
|
2574
|
+
var returnValue = result; // The callback is not an async function. Exit the current scope
|
2575
|
+
// immediately, without awaiting.
|
2576
|
+
|
2577
|
+
popActScope(prevActScopeDepth);
|
2578
|
+
|
2579
|
+
if (actScopeDepth === 0) {
|
2580
|
+
// Exiting the outermost act scope. Flush the queue.
|
2581
|
+
var _queue = ReactCurrentActQueue.current;
|
2582
|
+
|
2583
|
+
if (_queue !== null) {
|
2584
|
+
flushActQueue(_queue);
|
2585
|
+
ReactCurrentActQueue.current = null;
|
2586
|
+
} // Return a thenable. If the user awaits it, we'll flush again in
|
2587
|
+
// case additional work was scheduled by a microtask.
|
2588
|
+
|
2589
|
+
|
2590
|
+
var _thenable = {
|
2591
|
+
then: function (resolve, reject) {
|
2592
|
+
// Confirm we haven't re-entered another `act` scope, in case
|
2593
|
+
// the user does something weird like await the thenable
|
2594
|
+
// multiple times.
|
2595
|
+
if (ReactCurrentActQueue.current === null) {
|
2596
|
+
// Recursively flush the queue until there's no remaining work.
|
2597
|
+
ReactCurrentActQueue.current = [];
|
2598
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2599
|
+
} else {
|
2600
|
+
resolve(returnValue);
|
2601
|
+
}
|
2602
|
+
}
|
2603
|
+
};
|
2604
|
+
return _thenable;
|
2605
|
+
} else {
|
2606
|
+
// Since we're inside a nested `act` scope, the returned thenable
|
2607
|
+
// immediately resolves. The outer scope will flush the queue.
|
2608
|
+
var _thenable2 = {
|
2609
|
+
then: function (resolve, reject) {
|
2610
|
+
resolve(returnValue);
|
2611
|
+
}
|
2612
|
+
};
|
2613
|
+
return _thenable2;
|
2614
|
+
}
|
2615
|
+
}
|
2616
|
+
}
|
2617
|
+
}
|
2618
|
+
|
2619
|
+
function popActScope(prevActScopeDepth) {
|
2620
|
+
{
|
2621
|
+
if (prevActScopeDepth !== actScopeDepth - 1) {
|
2622
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
2623
|
+
}
|
2624
|
+
|
2625
|
+
actScopeDepth = prevActScopeDepth;
|
2626
|
+
}
|
2627
|
+
}
|
2628
|
+
|
2629
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
2630
|
+
{
|
2631
|
+
var queue = ReactCurrentActQueue.current;
|
2632
|
+
|
2633
|
+
if (queue !== null) {
|
2634
|
+
try {
|
2635
|
+
flushActQueue(queue);
|
2636
|
+
enqueueTask(function () {
|
2637
|
+
if (queue.length === 0) {
|
2638
|
+
// No additional work was scheduled. Finish.
|
2639
|
+
ReactCurrentActQueue.current = null;
|
2640
|
+
resolve(returnValue);
|
2641
|
+
} else {
|
2642
|
+
// Keep flushing work until there's none left.
|
2643
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2644
|
+
}
|
2645
|
+
});
|
2646
|
+
} catch (error) {
|
2647
|
+
reject(error);
|
2648
|
+
}
|
2649
|
+
} else {
|
2650
|
+
resolve(returnValue);
|
2651
|
+
}
|
2652
|
+
}
|
2653
|
+
}
|
2654
|
+
|
2655
|
+
var isFlushing = false;
|
2656
|
+
|
2657
|
+
function flushActQueue(queue) {
|
2658
|
+
{
|
2659
|
+
if (!isFlushing) {
|
2660
|
+
// Prevent re-entrance.
|
2661
|
+
isFlushing = true;
|
2662
|
+
var i = 0;
|
2663
|
+
|
2664
|
+
try {
|
2665
|
+
for (; i < queue.length; i++) {
|
2666
|
+
var callback = queue[i];
|
2667
|
+
|
2668
|
+
do {
|
2669
|
+
callback = callback(true);
|
2670
|
+
} while (callback !== null);
|
2671
|
+
}
|
2672
|
+
|
2673
|
+
queue.length = 0;
|
2674
|
+
} catch (error) {
|
2675
|
+
// If something throws, leave the remaining callbacks on the queue.
|
2676
|
+
queue = queue.slice(i + 1);
|
2677
|
+
throw error;
|
2678
|
+
} finally {
|
2679
|
+
isFlushing = false;
|
2680
|
+
}
|
2681
|
+
}
|
2682
|
+
}
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
var createElement$1 = createElementWithValidation ;
|
2686
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
2687
|
+
var createFactory = createFactoryWithValidation ;
|
2688
|
+
var Children = {
|
2689
|
+
map: mapChildren,
|
2690
|
+
forEach: forEachChildren,
|
2691
|
+
count: countChildren,
|
2692
|
+
toArray: toArray,
|
2693
|
+
only: onlyChild
|
2694
|
+
};
|
2695
|
+
|
2696
|
+
exports.Children = Children;
|
2697
|
+
exports.Component = Component;
|
2698
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
2699
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
2700
|
+
exports.PureComponent = PureComponent;
|
2701
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
2702
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
2703
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
2704
|
+
exports.act = act;
|
2705
|
+
exports.cloneElement = cloneElement$1;
|
2706
|
+
exports.createContext = createContext;
|
2707
|
+
exports.createElement = createElement$1;
|
2708
|
+
exports.createFactory = createFactory;
|
2709
|
+
exports.createRef = createRef;
|
2710
|
+
exports.forwardRef = forwardRef;
|
2711
|
+
exports.isValidElement = isValidElement;
|
2712
|
+
exports.lazy = lazy;
|
2713
|
+
exports.memo = memo;
|
2714
|
+
exports.startTransition = startTransition;
|
2715
|
+
exports.unstable_act = act;
|
2716
|
+
exports.useCallback = useCallback;
|
2717
|
+
exports.useContext = useContext;
|
2718
|
+
exports.useDebugValue = useDebugValue;
|
2719
|
+
exports.useDeferredValue = useDeferredValue;
|
2720
|
+
exports.useEffect = useEffect;
|
2721
|
+
exports.useId = useId;
|
2722
|
+
exports.useImperativeHandle = useImperativeHandle;
|
2723
|
+
exports.useInsertionEffect = useInsertionEffect;
|
2724
|
+
exports.useLayoutEffect = useLayoutEffect;
|
2725
|
+
exports.useMemo = useMemo;
|
2726
|
+
exports.useReducer = useReducer;
|
2727
|
+
exports.useRef = useRef;
|
2728
|
+
exports.useState = useState;
|
2729
|
+
exports.useSyncExternalStore = useSyncExternalStore;
|
2730
|
+
exports.useTransition = useTransition;
|
2731
|
+
exports.version = ReactVersion;
|
2732
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
2733
|
+
if (
|
2734
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
2735
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
2736
|
+
'function'
|
2737
|
+
) {
|
2738
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
2739
|
+
}
|
2740
|
+
|
2741
|
+
})();
|
2742
|
+
}
|
2743
|
+
}(react_development, react_development.exports));
|
2744
|
+
|
2745
|
+
{
|
2746
|
+
react.exports = react_development.exports;
|
2747
|
+
}
|
2748
|
+
|
2749
|
+
const React = react.exports;
|
2750
|
+
|
1
2751
|
function _async(f) {
|
2
2752
|
return function () {
|
3
2753
|
for (var args = [], i = 0; i < arguments.length; i++) {
|