react-test-renderer 16.10.2 → 16.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** @license React v16.10.2
1
+ /** @license React v16.13.1
2
2
  * react-test-renderer-shallow.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -10,1251 +10,1167 @@
10
10
  'use strict';
11
11
 
12
12
  (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
14
- typeof define === 'function' && define.amd ? define(['react'], factory) :
15
- (global.ReactShallowRenderer = factory(global.React));
13
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
14
+ typeof define === 'function' && define.amd ? define(['react'], factory) :
15
+ (global = global || self, global.ReactShallowRenderer = factory(global.React));
16
16
  }(this, (function (React) { 'use strict';
17
17
 
18
- // Do not require this module directly! Use normal `invariant` calls with
19
- // template literal strings. The messages will be converted to ReactError during
20
- // build, and in production they will be minified.
21
-
22
- // Do not require this module directly! Use normal `invariant` calls with
23
- // template literal strings. The messages will be converted to ReactError during
24
- // build, and in production they will be minified.
25
- function ReactError(error) {
26
- error.name = 'Invariant Violation';
27
- return error;
28
- }
29
-
30
- var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
31
- var _assign = ReactInternals.assign;
32
-
33
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
34
- // nor polyfill, then a plain number is used for performance.
35
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
36
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
37
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
38
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
39
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
40
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
41
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
42
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
43
- // (unstable) APIs that have been removed. Can we remove the symbols?
44
-
45
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
46
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
47
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
48
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
49
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
50
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
51
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
52
-
53
- /**
54
- * Forked from fbjs/warning:
55
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
56
- *
57
- * Only change is we use console.warn instead of console.error,
58
- * and do nothing when 'console' is not supported.
59
- * This really simplifies the code.
60
- * ---
61
- * Similar to invariant but only logs a warning if the condition is not met.
62
- * This can be used to log issues in development environments in critical
63
- * paths. Removing the logging code for production environments will keep the
64
- * same logic and follow the same code paths.
65
- */
66
- {
67
-
68
- }
69
-
70
- function typeOf(object) {
71
- if (typeof object === 'object' && object !== null) {
72
- var $$typeof = object.$$typeof;
73
-
74
- switch ($$typeof) {
75
- case REACT_ELEMENT_TYPE:
76
- var type = object.type;
77
-
78
- switch (type) {
79
- case REACT_ASYNC_MODE_TYPE:
80
- case REACT_CONCURRENT_MODE_TYPE:
81
- case REACT_FRAGMENT_TYPE:
82
- case REACT_PROFILER_TYPE:
83
- case REACT_STRICT_MODE_TYPE:
84
- case REACT_SUSPENSE_TYPE:
85
- return type;
86
-
87
- default:
88
- var $$typeofType = type && type.$$typeof;
89
-
90
- switch ($$typeofType) {
91
- case REACT_CONTEXT_TYPE:
92
- case REACT_FORWARD_REF_TYPE:
93
- case REACT_PROVIDER_TYPE:
94
- return $$typeofType;
95
-
96
- default:
97
- return $$typeof;
98
- }
18
+ // Do not require this module directly! Use normal `invariant` calls with
19
+ // template literal strings. The messages will be replaced with error codes
20
+ // during build.
21
+ function formatProdErrorMessage(code) {
22
+ var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
99
23
 
100
- }
101
-
102
- case REACT_LAZY_TYPE:
103
- case REACT_MEMO_TYPE:
104
- case REACT_PORTAL_TYPE:
105
- return $$typeof;
24
+ for (var i = 1; i < arguments.length; i++) {
25
+ url += '&args[]=' + encodeURIComponent(arguments[i]);
106
26
  }
107
- }
108
-
109
- return undefined;
110
- } // AsyncMode is deprecated along with isAsyncMode
111
-
112
-
113
-
114
-
115
27
 
28
+ return "Minified React error #" + code + "; visit " + url + " for the full message or " + 'use the non-minified dev environment for full errors and additional ' + 'helpful warnings.';
29
+ }
116
30
 
117
- var ForwardRef = REACT_FORWARD_REF_TYPE;
31
+ var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
32
+ var _assign = ReactInternals.assign;
118
33
 
34
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
35
+ // Current owner and dispatcher used to share the same ref,
36
+ // but PR #14548 split them out to better support the react-debug-tools package.
119
37
 
38
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
39
+ ReactSharedInternals.ReactCurrentDispatcher = {
40
+ current: null
41
+ };
42
+ }
120
43
 
44
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
45
+ ReactSharedInternals.ReactCurrentBatchConfig = {
46
+ suspense: null
47
+ };
48
+ }
121
49
 
50
+ function error(format) {
51
+ {
52
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
53
+ args[_key2 - 1] = arguments[_key2];
54
+ }
122
55
 
56
+ printWarning('error', format, args);
57
+ }
58
+ }
123
59
 
60
+ function printWarning(level, format, args) {
61
+ // When changing this logic, you might want to also
62
+ // update consoleWithStackDev.www.js as well.
63
+ {
64
+ var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
124
65
 
66
+ if (!hasExistingStack) {
67
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
68
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
125
69
 
70
+ if (stack !== '') {
71
+ format += '%s';
72
+ args = args.concat([stack]);
73
+ }
74
+ }
126
75
 
76
+ var argsWithFormat = args.map(function (item) {
77
+ return '' + item;
78
+ }); // Careful: RN currently depends on this prefix
127
79
 
80
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
81
+ // breaks IE9: https://github.com/facebook/react/issues/13610
82
+ // eslint-disable-next-line react-internal/no-production-logging
83
+
84
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
85
+
86
+ try {
87
+ // --- Welcome to debugging React ---
88
+ // This error was thrown as a convenience so that you can use this stack
89
+ // to find the callsite that caused this warning to fire.
90
+ var argIndex = 0;
91
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
92
+ return args[argIndex++];
93
+ });
94
+ throw new Error(message);
95
+ } catch (x) {}
96
+ }
97
+ }
128
98
 
99
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
100
+ // nor polyfill, then a plain number is used for performance.
101
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
102
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
103
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
104
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
105
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
106
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
107
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
108
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
109
+ // (unstable) APIs that have been removed. Can we remove the symbols?
110
+
111
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
112
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
113
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
114
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
115
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
116
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
117
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
118
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
119
+
120
+ function typeOf(object) {
121
+ if (typeof object === 'object' && object !== null) {
122
+ var $$typeof = object.$$typeof;
123
+
124
+ switch ($$typeof) {
125
+ case REACT_ELEMENT_TYPE:
126
+ var type = object.type;
127
+
128
+ switch (type) {
129
+ case REACT_ASYNC_MODE_TYPE:
130
+ case REACT_CONCURRENT_MODE_TYPE:
131
+ case REACT_FRAGMENT_TYPE:
132
+ case REACT_PROFILER_TYPE:
133
+ case REACT_STRICT_MODE_TYPE:
134
+ case REACT_SUSPENSE_TYPE:
135
+ return type;
136
+
137
+ default:
138
+ var $$typeofType = type && type.$$typeof;
139
+
140
+ switch ($$typeofType) {
141
+ case REACT_CONTEXT_TYPE:
142
+ case REACT_FORWARD_REF_TYPE:
143
+ case REACT_LAZY_TYPE:
144
+ case REACT_MEMO_TYPE:
145
+ case REACT_PROVIDER_TYPE:
146
+ return $$typeofType;
147
+
148
+ default:
149
+ return $$typeof;
150
+ }
129
151
 
130
- function isForwardRef(object) {
131
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
132
- }
152
+ }
133
153
 
154
+ case REACT_PORTAL_TYPE:
155
+ return $$typeof;
156
+ }
157
+ }
134
158
 
135
- function isMemo(object) {
136
- return typeOf(object) === REACT_MEMO_TYPE;
137
- }
159
+ return undefined;
160
+ } // AsyncMode is deprecated along with isAsyncMode
161
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
162
+ function isForwardRef(object) {
163
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
164
+ }
165
+ function isMemo(object) {
166
+ return typeOf(object) === REACT_MEMO_TYPE;
167
+ }
138
168
 
139
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
140
- var describeComponentFrame = function (name, source, ownerName) {
141
- var sourceInfo = '';
169
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
170
+ function describeComponentFrame (name, source, ownerName) {
171
+ var sourceInfo = '';
142
172
 
143
- if (source) {
144
- var path = source.fileName;
145
- var fileName = path.replace(BEFORE_SLASH_RE, '');
173
+ if (source) {
174
+ var path = source.fileName;
175
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
146
176
 
147
- {
148
- // In DEV, include code for a common special case:
149
- // prefer "folder/index.js" instead of just "index.js".
150
- if (/^index\./.test(fileName)) {
151
- var match = path.match(BEFORE_SLASH_RE);
177
+ {
178
+ // In DEV, include code for a common special case:
179
+ // prefer "folder/index.js" instead of just "index.js".
180
+ if (/^index\./.test(fileName)) {
181
+ var match = path.match(BEFORE_SLASH_RE);
152
182
 
153
- if (match) {
154
- var pathBeforeSlash = match[1];
183
+ if (match) {
184
+ var pathBeforeSlash = match[1];
155
185
 
156
- if (pathBeforeSlash) {
157
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
158
- fileName = folderName + '/' + fileName;
186
+ if (pathBeforeSlash) {
187
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
188
+ fileName = folderName + '/' + fileName;
189
+ }
159
190
  }
160
191
  }
161
192
  }
193
+
194
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
195
+ } else if (ownerName) {
196
+ sourceInfo = ' (created by ' + ownerName + ')';
162
197
  }
163
198
 
164
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
165
- } else if (ownerName) {
166
- sourceInfo = ' (created by ' + ownerName + ')';
199
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
167
200
  }
168
201
 
169
- return '\n in ' + (name || 'Unknown') + sourceInfo;
170
- };
171
-
172
- /**
173
- * Similar to invariant but only logs a warning if the condition is not met.
174
- * This can be used to log issues in development environments in critical
175
- * paths. Removing the logging code for production environments will keep the
176
- * same logic and follow the same code paths.
177
- */
178
- var warningWithoutStack = function () {};
202
+ var Resolved = 1;
203
+ function refineResolvedLazyComponent(lazyComponent) {
204
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
205
+ }
179
206
 
180
- {
181
- warningWithoutStack = function (condition, format) {
182
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
183
- args[_key - 2] = arguments[_key];
184
- }
207
+ function getWrappedName(outerType, innerType, wrapperName) {
208
+ var functionName = innerType.displayName || innerType.name || '';
209
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
210
+ }
185
211
 
186
- if (format === undefined) {
187
- throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
212
+ function getComponentName(type) {
213
+ if (type == null) {
214
+ // Host root, text node or just invalid type.
215
+ return null;
188
216
  }
189
217
 
190
- if (args.length > 8) {
191
- // Check before the condition to catch violations early.
192
- throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
218
+ {
219
+ if (typeof type.tag === 'number') {
220
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
221
+ }
193
222
  }
194
223
 
195
- if (condition) {
196
- return;
224
+ if (typeof type === 'function') {
225
+ return type.displayName || type.name || null;
197
226
  }
198
227
 
199
- if (typeof console !== 'undefined') {
200
- var argsWithFormat = args.map(function (item) {
201
- return '' + item;
202
- });
203
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
204
- // breaks IE9: https://github.com/facebook/react/issues/13610
205
-
206
- Function.prototype.apply.call(console.error, console, argsWithFormat);
228
+ if (typeof type === 'string') {
229
+ return type;
207
230
  }
208
231
 
209
- try {
210
- // --- Welcome to debugging React ---
211
- // This error was thrown as a convenience so that you can use this stack
212
- // to find the callsite that caused this warning to fire.
213
- var argIndex = 0;
214
- var message = 'Warning: ' + format.replace(/%s/g, function () {
215
- return args[argIndex++];
216
- });
217
- throw new Error(message);
218
- } catch (x) {}
219
- };
220
- }
221
-
222
- var warningWithoutStack$1 = warningWithoutStack;
223
-
224
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
225
- // Current owner and dispatcher used to share the same ref,
226
- // but PR #14548 split them out to better support the react-debug-tools package.
232
+ switch (type) {
233
+ case REACT_FRAGMENT_TYPE:
234
+ return 'Fragment';
227
235
 
228
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
229
- ReactSharedInternals.ReactCurrentDispatcher = {
230
- current: null
231
- };
232
- }
236
+ case REACT_PORTAL_TYPE:
237
+ return 'Portal';
233
238
 
234
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
235
- ReactSharedInternals.ReactCurrentBatchConfig = {
236
- suspense: null
237
- };
238
- }
239
+ case REACT_PROFILER_TYPE:
240
+ return "Profiler";
239
241
 
240
- /**
241
- * Similar to invariant but only logs a warning if the condition is not met.
242
- * This can be used to log issues in development environments in critical
243
- * paths. Removing the logging code for production environments will keep the
244
- * same logic and follow the same code paths.
245
- */
242
+ case REACT_STRICT_MODE_TYPE:
243
+ return 'StrictMode';
246
244
 
247
- var warning = warningWithoutStack$1;
245
+ case REACT_SUSPENSE_TYPE:
246
+ return 'Suspense';
248
247
 
249
- {
250
- warning = function (condition, format) {
251
- if (condition) {
252
- return;
248
+ case REACT_SUSPENSE_LIST_TYPE:
249
+ return 'SuspenseList';
253
250
  }
254
251
 
255
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
256
- var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
252
+ if (typeof type === 'object') {
253
+ switch (type.$$typeof) {
254
+ case REACT_CONTEXT_TYPE:
255
+ return 'Context.Consumer';
257
256
 
258
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
259
- args[_key - 2] = arguments[_key];
260
- }
257
+ case REACT_PROVIDER_TYPE:
258
+ return 'Context.Provider';
261
259
 
262
- warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
263
- };
264
- }
260
+ case REACT_FORWARD_REF_TYPE:
261
+ return getWrappedName(type, type.render, 'ForwardRef');
265
262
 
266
- var warning$1 = warning;
263
+ case REACT_MEMO_TYPE:
264
+ return getComponentName(type.type);
267
265
 
268
- var Resolved = 1;
266
+ case REACT_BLOCK_TYPE:
267
+ return getComponentName(type.render);
269
268
 
270
- function refineResolvedLazyComponent(lazyComponent) {
271
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
272
- }
269
+ case REACT_LAZY_TYPE:
270
+ {
271
+ var thenable = type;
272
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
273
273
 
274
- function getWrappedName(outerType, innerType, wrapperName) {
275
- var functionName = innerType.displayName || innerType.name || '';
276
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
277
- }
278
-
279
- function getComponentName(type) {
280
- if (type == null) {
281
- // Host root, text node or just invalid type.
282
- return null;
283
- }
274
+ if (resolvedThenable) {
275
+ return getComponentName(resolvedThenable);
276
+ }
284
277
 
285
- {
286
- if (typeof type.tag === 'number') {
287
- warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
278
+ break;
279
+ }
280
+ }
288
281
  }
289
- }
290
282
 
291
- if (typeof type === 'function') {
292
- return type.displayName || type.name || null;
283
+ return null;
293
284
  }
294
285
 
295
- if (typeof type === 'string') {
296
- return type;
286
+ /**
287
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
288
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
289
+ */
290
+ function is(x, y) {
291
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
292
+ ;
297
293
  }
298
294
 
299
- switch (type) {
300
- case REACT_FRAGMENT_TYPE:
301
- return 'Fragment';
302
-
303
- case REACT_PORTAL_TYPE:
304
- return 'Portal';
305
-
306
- case REACT_PROFILER_TYPE:
307
- return "Profiler";
295
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
308
296
 
309
- case REACT_STRICT_MODE_TYPE:
310
- return 'StrictMode';
297
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
298
+ /**
299
+ * Performs equality by iterating through keys on an object and returning false
300
+ * when any key has values which are not strictly equal between the arguments.
301
+ * Returns true when the values of all keys are strictly equal.
302
+ */
311
303
 
312
- case REACT_SUSPENSE_TYPE:
313
- return 'Suspense';
314
-
315
- case REACT_SUSPENSE_LIST_TYPE:
316
- return 'SuspenseList';
317
- }
318
-
319
- if (typeof type === 'object') {
320
- switch (type.$$typeof) {
321
- case REACT_CONTEXT_TYPE:
322
- return 'Context.Consumer';
323
-
324
- case REACT_PROVIDER_TYPE:
325
- return 'Context.Provider';
304
+ function shallowEqual(objA, objB) {
305
+ if (objectIs(objA, objB)) {
306
+ return true;
307
+ }
326
308
 
327
- case REACT_FORWARD_REF_TYPE:
328
- return getWrappedName(type, type.render, 'ForwardRef');
309
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
310
+ return false;
311
+ }
329
312
 
330
- case REACT_MEMO_TYPE:
331
- return getComponentName(type.type);
313
+ var keysA = Object.keys(objA);
314
+ var keysB = Object.keys(objB);
332
315
 
333
- case REACT_LAZY_TYPE:
334
- {
335
- var thenable = type;
336
- var resolvedThenable = refineResolvedLazyComponent(thenable);
316
+ if (keysA.length !== keysB.length) {
317
+ return false;
318
+ } // Test for A's keys different from B.
337
319
 
338
- if (resolvedThenable) {
339
- return getComponentName(resolvedThenable);
340
- }
341
320
 
342
- break;
343
- }
321
+ for (var i = 0; i < keysA.length; i++) {
322
+ if (!hasOwnProperty.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
323
+ return false;
324
+ }
344
325
  }
345
- }
346
326
 
347
- return null;
348
- }
349
-
350
- /**
351
- * inlined Object.is polyfill to avoid requiring consumers ship their own
352
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
353
- */
354
- function is(x, y) {
355
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
356
- ;
357
- }
358
-
359
- var is$1 = typeof Object.is === 'function' ? Object.is : is;
360
-
361
- var hasOwnProperty = Object.prototype.hasOwnProperty;
362
- /**
363
- * Performs equality by iterating through keys on an object and returning false
364
- * when any key has values which are not strictly equal between the arguments.
365
- * Returns true when the values of all keys are strictly equal.
366
- */
367
-
368
- function shallowEqual(objA, objB) {
369
- if (is$1(objA, objB)) {
370
327
  return true;
371
328
  }
372
329
 
373
- if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
374
- return false;
375
- }
330
+ /**
331
+ * Copyright (c) 2013-present, Facebook, Inc.
332
+ *
333
+ * This source code is licensed under the MIT license found in the
334
+ * LICENSE file in the root directory of this source tree.
335
+ */
376
336
 
377
- var keysA = Object.keys(objA);
378
- var keysB = Object.keys(objB);
337
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
379
338
 
380
- if (keysA.length !== keysB.length) {
381
- return false;
382
- } // Test for A's keys different from B.
339
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret;
383
340
 
341
+ var printWarning$1 = function() {};
384
342
 
385
- for (var i = 0; i < keysA.length; i++) {
386
- if (!hasOwnProperty.call(objB, keysA[i]) || !is$1(objA[keysA[i]], objB[keysA[i]])) {
387
- return false;
388
- }
343
+ {
344
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
345
+ var loggedTypeFailures = {};
346
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
347
+
348
+ printWarning$1 = function(text) {
349
+ var message = 'Warning: ' + text;
350
+ if (typeof console !== 'undefined') {
351
+ console.error(message);
352
+ }
353
+ try {
354
+ // --- Welcome to debugging React ---
355
+ // This error was thrown as a convenience so that you can use this stack
356
+ // to find the callsite that caused this warning to fire.
357
+ throw new Error(message);
358
+ } catch (x) {}
359
+ };
389
360
  }
390
361
 
391
- return true;
392
- }
393
-
394
- /**
395
- * Use invariant() to assert state which your program assumes to be true.
396
- *
397
- * Provide sprintf-style format (only %s is supported) and arguments
398
- * to provide information about what broke and what you were
399
- * expecting.
400
- *
401
- * The invariant message will be stripped in production, but the invariant
402
- * will remain to ensure logic does not differ in production.
403
- */
404
-
405
- /**
406
- * Copyright (c) 2013-present, Facebook, Inc.
407
- *
408
- * This source code is licensed under the MIT license found in the
409
- * LICENSE file in the root directory of this source tree.
410
- */
411
-
412
-
413
-
414
- var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
415
-
416
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
417
-
418
- /**
419
- * Copyright (c) 2013-present, Facebook, Inc.
420
- *
421
- * This source code is licensed under the MIT license found in the
422
- * LICENSE file in the root directory of this source tree.
423
- */
424
-
425
-
426
-
427
- var printWarning$1 = function() {};
428
-
429
- {
430
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
431
- var loggedTypeFailures = {};
432
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
433
-
434
- printWarning$1 = function(text) {
435
- var message = 'Warning: ' + text;
436
- if (typeof console !== 'undefined') {
437
- console.error(message);
438
- }
439
- try {
440
- // --- Welcome to debugging React ---
441
- // This error was thrown as a convenience so that you can use this stack
442
- // to find the callsite that caused this warning to fire.
443
- throw new Error(message);
444
- } catch (x) {}
445
- };
446
- }
447
-
448
- /**
449
- * Assert that the values match with the type specs.
450
- * Error messages are memorized and will only be shown once.
451
- *
452
- * @param {object} typeSpecs Map of name to a ReactPropType
453
- * @param {object} values Runtime values that need to be type-checked
454
- * @param {string} location e.g. "prop", "context", "child context"
455
- * @param {string} componentName Name of the component for error messages.
456
- * @param {?Function} getStack Returns the component stack.
457
- * @private
458
- */
459
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
460
- {
461
- for (var typeSpecName in typeSpecs) {
462
- if (has(typeSpecs, typeSpecName)) {
463
- var error;
464
- // Prop type validation may throw. In case they do, we don't want to
465
- // fail the render phase where it didn't fail before. So we log it.
466
- // After these have been cleaned up, we'll let them throw.
467
- try {
468
- // This is intentionally an invariant that gets caught. It's the same
469
- // behavior as without this statement except with a better message.
470
- if (typeof typeSpecs[typeSpecName] !== 'function') {
471
- var err = Error(
472
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
473
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
362
+ /**
363
+ * Assert that the values match with the type specs.
364
+ * Error messages are memorized and will only be shown once.
365
+ *
366
+ * @param {object} typeSpecs Map of name to a ReactPropType
367
+ * @param {object} values Runtime values that need to be type-checked
368
+ * @param {string} location e.g. "prop", "context", "child context"
369
+ * @param {string} componentName Name of the component for error messages.
370
+ * @param {?Function} getStack Returns the component stack.
371
+ * @private
372
+ */
373
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
374
+ {
375
+ for (var typeSpecName in typeSpecs) {
376
+ if (has(typeSpecs, typeSpecName)) {
377
+ var error;
378
+ // Prop type validation may throw. In case they do, we don't want to
379
+ // fail the render phase where it didn't fail before. So we log it.
380
+ // After these have been cleaned up, we'll let them throw.
381
+ try {
382
+ // This is intentionally an invariant that gets caught. It's the same
383
+ // behavior as without this statement except with a better message.
384
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
385
+ var err = Error(
386
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
387
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
388
+ );
389
+ err.name = 'Invariant Violation';
390
+ throw err;
391
+ }
392
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
393
+ } catch (ex) {
394
+ error = ex;
395
+ }
396
+ if (error && !(error instanceof Error)) {
397
+ printWarning$1(
398
+ (componentName || 'React class') + ': type specification of ' +
399
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
400
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
401
+ 'You may have forgotten to pass an argument to the type checker ' +
402
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
403
+ 'shape all require an argument).'
474
404
  );
475
- err.name = 'Invariant Violation';
476
- throw err;
477
405
  }
478
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
479
- } catch (ex) {
480
- error = ex;
481
- }
482
- if (error && !(error instanceof Error)) {
483
- printWarning$1(
484
- (componentName || 'React class') + ': type specification of ' +
485
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
486
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
487
- 'You may have forgotten to pass an argument to the type checker ' +
488
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
489
- 'shape all require an argument).'
490
- );
491
- }
492
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
493
- // Only monitor this failure once because there tends to be a lot of the
494
- // same error.
495
- loggedTypeFailures[error.message] = true;
406
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
407
+ // Only monitor this failure once because there tends to be a lot of the
408
+ // same error.
409
+ loggedTypeFailures[error.message] = true;
496
410
 
497
- var stack = getStack ? getStack() : '';
411
+ var stack = getStack ? getStack() : '';
498
412
 
499
- printWarning$1(
500
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
501
- );
413
+ printWarning$1(
414
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
415
+ );
416
+ }
502
417
  }
503
418
  }
504
419
  }
505
420
  }
506
- }
507
421
 
508
- /**
509
- * Resets warning cache when testing.
510
- *
511
- * @private
512
- */
513
- checkPropTypes.resetWarningCache = function() {
514
- {
515
- loggedTypeFailures = {};
516
- }
517
- };
518
-
519
- var checkPropTypes_1 = checkPropTypes;
422
+ /**
423
+ * Resets warning cache when testing.
424
+ *
425
+ * @private
426
+ */
427
+ checkPropTypes.resetWarningCache = function() {
428
+ {
429
+ loggedTypeFailures = {};
430
+ }
431
+ };
520
432
 
521
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
522
- var RE_RENDER_LIMIT = 25;
523
- var emptyObject = {};
433
+ var checkPropTypes_1 = checkPropTypes;
524
434
 
525
- {
526
- Object.freeze(emptyObject);
527
- } // In DEV, this is the name of the currently executing primitive hook
435
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
436
+ var RE_RENDER_LIMIT = 25;
437
+ var emptyObject = {};
528
438
 
439
+ {
440
+ Object.freeze(emptyObject);
441
+ } // In DEV, this is the name of the currently executing primitive hook
529
442
 
530
- var currentHookNameInDev;
531
443
 
532
- function areHookInputsEqual(nextDeps, prevDeps) {
533
- if (prevDeps === null) {
534
- warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
535
- return false;
536
- } // Don't bother comparing lengths in prod because these arrays should be
537
- // passed inline.
444
+ var currentHookNameInDev;
538
445
 
446
+ function areHookInputsEqual(nextDeps, prevDeps) {
447
+ if (prevDeps === null) {
448
+ {
449
+ error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
450
+ }
539
451
 
540
- if (nextDeps.length !== prevDeps.length) {
541
- warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
542
- }
452
+ return false;
453
+ }
543
454
 
544
- for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
545
- if (is$1(nextDeps[i], prevDeps[i])) {
546
- continue;
455
+ {
456
+ // Don't bother comparing lengths in prod because these arrays should be
457
+ // passed inline.
458
+ if (nextDeps.length !== prevDeps.length) {
459
+ error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
460
+ }
547
461
  }
548
462
 
549
- return false;
550
- }
463
+ for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
464
+ if (objectIs(nextDeps[i], prevDeps[i])) {
465
+ continue;
466
+ }
551
467
 
552
- return true;
553
- }
468
+ return false;
469
+ }
554
470
 
555
- var Updater =
556
- /*#__PURE__*/
557
- function () {
558
- function Updater(renderer) {
559
- this._renderer = renderer;
560
- this._callbacks = [];
471
+ return true;
561
472
  }
562
473
 
563
- var _proto = Updater.prototype;
564
-
565
- _proto._enqueueCallback = function _enqueueCallback(callback, publicInstance) {
566
- if (typeof callback === 'function' && publicInstance) {
567
- this._callbacks.push({
568
- callback: callback,
569
- publicInstance: publicInstance
570
- });
474
+ var Updater =
475
+ /*#__PURE__*/
476
+ function () {
477
+ function Updater(renderer) {
478
+ this._renderer = renderer;
479
+ this._callbacks = [];
571
480
  }
572
- };
573
481
 
574
- _proto._invokeCallbacks = function _invokeCallbacks() {
575
- var callbacks = this._callbacks;
576
- this._callbacks = [];
577
- callbacks.forEach(function (_ref) {
578
- var callback = _ref.callback,
579
- publicInstance = _ref.publicInstance;
580
- callback.call(publicInstance);
581
- });
582
- };
482
+ var _proto = Updater.prototype;
583
483
 
584
- _proto.isMounted = function isMounted(publicInstance) {
585
- return !!this._renderer._element;
586
- };
484
+ _proto._enqueueCallback = function _enqueueCallback(callback, publicInstance) {
485
+ if (typeof callback === 'function' && publicInstance) {
486
+ this._callbacks.push({
487
+ callback: callback,
488
+ publicInstance: publicInstance
489
+ });
490
+ }
491
+ };
587
492
 
588
- _proto.enqueueForceUpdate = function enqueueForceUpdate(publicInstance, callback, callerName) {
589
- this._enqueueCallback(callback, publicInstance);
493
+ _proto._invokeCallbacks = function _invokeCallbacks() {
494
+ var callbacks = this._callbacks;
495
+ this._callbacks = [];
496
+ callbacks.forEach(function (_ref) {
497
+ var callback = _ref.callback,
498
+ publicInstance = _ref.publicInstance;
499
+ callback.call(publicInstance);
500
+ });
501
+ };
590
502
 
591
- this._renderer._forcedUpdate = true;
503
+ _proto.isMounted = function isMounted(publicInstance) {
504
+ return !!this._renderer._element;
505
+ };
592
506
 
593
- this._renderer.render(this._renderer._element, this._renderer._context);
594
- };
507
+ _proto.enqueueForceUpdate = function enqueueForceUpdate(publicInstance, callback, callerName) {
508
+ this._enqueueCallback(callback, publicInstance);
595
509
 
596
- _proto.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState, callback, callerName) {
597
- this._enqueueCallback(callback, publicInstance);
510
+ this._renderer._forcedUpdate = true;
598
511
 
599
- this._renderer._newState = completeState;
512
+ this._renderer.render(this._renderer._element, this._renderer._context);
513
+ };
600
514
 
601
- this._renderer.render(this._renderer._element, this._renderer._context);
602
- };
515
+ _proto.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState, callback, callerName) {
516
+ this._enqueueCallback(callback, publicInstance);
603
517
 
604
- _proto.enqueueSetState = function enqueueSetState(publicInstance, partialState, callback, callerName) {
605
- this._enqueueCallback(callback, publicInstance);
518
+ this._renderer._newState = completeState;
606
519
 
607
- var currentState = this._renderer._newState || publicInstance.state;
520
+ this._renderer.render(this._renderer._element, this._renderer._context);
521
+ };
608
522
 
609
- if (typeof partialState === 'function') {
610
- partialState = partialState.call(publicInstance, currentState, publicInstance.props);
611
- } // Null and undefined are treated as no-ops.
523
+ _proto.enqueueSetState = function enqueueSetState(publicInstance, partialState, callback, callerName) {
524
+ this._enqueueCallback(callback, publicInstance);
612
525
 
526
+ var currentState = this._renderer._newState || publicInstance.state;
613
527
 
614
- if (partialState === null || partialState === undefined) {
615
- return;
616
- }
528
+ if (typeof partialState === 'function') {
529
+ partialState = partialState.call(publicInstance, currentState, publicInstance.props);
530
+ } // Null and undefined are treated as no-ops.
617
531
 
618
- this._renderer._newState = _assign({}, currentState, {}, partialState);
619
532
 
620
- this._renderer.render(this._renderer._element, this._renderer._context);
621
- };
533
+ if (partialState === null || partialState === undefined) {
534
+ return;
535
+ }
622
536
 
623
- return Updater;
624
- }();
537
+ this._renderer._newState = _assign({}, currentState, {}, partialState);
625
538
 
626
- function createHook() {
627
- return {
628
- memoizedState: null,
629
- queue: null,
630
- next: null
631
- };
632
- }
539
+ this._renderer.render(this._renderer._element, this._renderer._context);
540
+ };
633
541
 
634
- function basicStateReducer(state, action) {
635
- return typeof action === 'function' ? action(state) : action;
636
- }
542
+ return Updater;
543
+ }();
637
544
 
638
- var ReactShallowRenderer =
639
- /*#__PURE__*/
640
- function () {
641
- function ReactShallowRenderer() {
642
- this._reset();
545
+ function createHook() {
546
+ return {
547
+ memoizedState: null,
548
+ queue: null,
549
+ next: null
550
+ };
643
551
  }
644
552
 
645
- var _proto2 = ReactShallowRenderer.prototype;
646
-
647
- _proto2._reset = function _reset() {
648
- this._context = null;
649
- this._element = null;
650
- this._instance = null;
651
- this._newState = null;
652
- this._rendered = null;
653
- this._rendering = false;
654
- this._forcedUpdate = false;
655
- this._updater = new Updater(this);
656
- this._dispatcher = this._createDispatcher();
657
- this._workInProgressHook = null;
658
- this._firstWorkInProgressHook = null;
659
- this._isReRender = false;
660
- this._didScheduleRenderPhaseUpdate = false;
661
- this._renderPhaseUpdates = null;
662
- this._numberOfReRenders = 0;
663
- };
553
+ function basicStateReducer(state, action) {
554
+ // $FlowFixMe: Flow doesn't like mixed types
555
+ return typeof action === 'function' ? action(state) : action;
556
+ }
557
+
558
+ var ReactShallowRenderer =
559
+ /*#__PURE__*/
560
+ function () {
561
+ function ReactShallowRenderer() {
562
+ this._reset();
563
+ }
564
+
565
+ var _proto2 = ReactShallowRenderer.prototype;
664
566
 
665
- _proto2._validateCurrentlyRenderingComponent = function _validateCurrentlyRenderingComponent() {
666
- var _this = this;
567
+ _proto2._reset = function _reset() {
568
+ this._context = null;
569
+ this._element = null;
570
+ this._instance = null;
571
+ this._newState = null;
572
+ this._rendered = null;
573
+ this._rendering = false;
574
+ this._forcedUpdate = false;
575
+ this._updater = new Updater(this);
576
+ this._dispatcher = this._createDispatcher();
577
+ this._workInProgressHook = null;
578
+ this._firstWorkInProgressHook = null;
579
+ this._isReRender = false;
580
+ this._didScheduleRenderPhaseUpdate = false;
581
+ this._renderPhaseUpdates = null;
582
+ this._numberOfReRenders = 0;
583
+ };
667
584
 
668
- (function () {
669
- if (!(_this._rendering && !_this._instance)) {
585
+ _proto2._validateCurrentlyRenderingComponent = function _validateCurrentlyRenderingComponent() {
586
+ if (!(this._rendering && !this._instance)) {
670
587
  {
671
- throw ReactError(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:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
588
+ throw 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:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
672
589
  }
673
590
  }
674
- })();
675
- };
591
+ };
676
592
 
677
- _proto2._createDispatcher = function _createDispatcher() {
678
- var _this2 = this;
593
+ _proto2._createDispatcher = function _createDispatcher() {
594
+ var _this = this;
679
595
 
680
- var useReducer = function (reducer, initialArg, init) {
681
- _this2._validateCurrentlyRenderingComponent();
596
+ var useReducer = function (reducer, initialArg, init) {
597
+ _this._validateCurrentlyRenderingComponent();
682
598
 
683
- _this2._createWorkInProgressHook();
599
+ _this._createWorkInProgressHook();
684
600
 
685
- var workInProgressHook = _this2._workInProgressHook;
601
+ var workInProgressHook = _this._workInProgressHook;
686
602
 
687
- if (_this2._isReRender) {
688
- // This is a re-render.
689
- var queue = workInProgressHook.queue;
690
- var dispatch = queue.dispatch;
603
+ if (_this._isReRender) {
604
+ // This is a re-render.
605
+ var queue = workInProgressHook.queue;
606
+ var dispatch = queue.dispatch;
691
607
 
692
- if (_this2._numberOfReRenders > 0) {
693
- // Apply the new render phase updates to the previous current hook.
694
- if (_this2._renderPhaseUpdates !== null) {
695
- // Render phase updates are stored in a map of queue -> linked list
696
- var firstRenderPhaseUpdate = _this2._renderPhaseUpdates.get(queue);
608
+ if (_this._numberOfReRenders > 0) {
609
+ // Apply the new render phase updates to the previous current hook.
610
+ if (_this._renderPhaseUpdates !== null) {
611
+ // Render phase updates are stored in a map of queue -> linked list
612
+ var firstRenderPhaseUpdate = _this._renderPhaseUpdates.get(queue);
697
613
 
698
- if (firstRenderPhaseUpdate !== undefined) {
699
- _this2._renderPhaseUpdates.delete(queue);
614
+ if (firstRenderPhaseUpdate !== undefined) {
615
+ _this._renderPhaseUpdates.delete(queue);
700
616
 
701
- var _newState = workInProgressHook.memoizedState;
702
- var _update = firstRenderPhaseUpdate;
617
+ var _newState = workInProgressHook.memoizedState;
618
+ var _update = firstRenderPhaseUpdate;
703
619
 
704
- do {
705
- var action = _update.action;
706
- _newState = reducer(_newState, action);
707
- _update = _update.next;
708
- } while (_update !== null);
620
+ do {
621
+ var action = _update.action;
622
+ _newState = reducer(_newState, action);
623
+ _update = _update.next;
624
+ } while (_update !== null);
709
625
 
710
- workInProgressHook.memoizedState = _newState;
711
- return [_newState, dispatch];
626
+ workInProgressHook.memoizedState = _newState;
627
+ return [_newState, dispatch];
628
+ }
712
629
  }
630
+
631
+ return [workInProgressHook.memoizedState, dispatch];
632
+ } // Process updates outside of render
633
+
634
+
635
+ var newState = workInProgressHook.memoizedState;
636
+ var update = queue.first;
637
+
638
+ if (update !== null) {
639
+ do {
640
+ var _action = update.action;
641
+ newState = reducer(newState, _action);
642
+ update = update.next;
643
+ } while (update !== null);
644
+
645
+ queue.first = null;
646
+ workInProgressHook.memoizedState = newState;
713
647
  }
714
648
 
715
- return [workInProgressHook.memoizedState, dispatch];
716
- } // Process updates outside of render
649
+ return [newState, dispatch];
650
+ } else {
651
+ var initialState;
717
652
 
653
+ if (reducer === basicStateReducer) {
654
+ // Special case for `useState`.
655
+ initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
656
+ } else {
657
+ initialState = init !== undefined ? init(initialArg) : initialArg;
658
+ }
718
659
 
719
- var newState = workInProgressHook.memoizedState;
720
- var update = queue.first;
660
+ workInProgressHook.memoizedState = initialState;
721
661
 
722
- if (update !== null) {
723
- do {
724
- var _action = update.action;
725
- newState = reducer(newState, _action);
726
- update = update.next;
727
- } while (update !== null);
662
+ var _queue = workInProgressHook.queue = {
663
+ first: null,
664
+ dispatch: null
665
+ };
728
666
 
729
- queue.first = null;
730
- workInProgressHook.memoizedState = newState;
667
+ var _dispatch = _queue.dispatch = _this._dispatchAction.bind(_this, _queue);
668
+
669
+ return [workInProgressHook.memoizedState, _dispatch];
731
670
  }
671
+ };
732
672
 
733
- return [newState, dispatch];
734
- } else {
735
- var initialState;
673
+ var useState = function (initialState) {
674
+ return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
675
+ initialState);
676
+ };
736
677
 
737
- if (reducer === basicStateReducer) {
738
- // Special case for `useState`.
739
- initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
740
- } else {
741
- initialState = init !== undefined ? init(initialArg) : initialArg;
742
- }
678
+ var useMemo = function (nextCreate, deps) {
679
+ _this._validateCurrentlyRenderingComponent();
743
680
 
744
- workInProgressHook.memoizedState = initialState;
681
+ _this._createWorkInProgressHook();
745
682
 
746
- var _queue = workInProgressHook.queue = {
747
- first: null,
748
- dispatch: null
749
- };
683
+ var nextDeps = deps !== undefined ? deps : null;
750
684
 
751
- var _dispatch = _queue.dispatch = _this2._dispatchAction.bind(_this2, _queue);
685
+ if (_this._workInProgressHook !== null && _this._workInProgressHook.memoizedState !== null) {
686
+ var prevState = _this._workInProgressHook.memoizedState;
687
+ var prevDeps = prevState[1];
752
688
 
753
- return [workInProgressHook.memoizedState, _dispatch];
754
- }
755
- };
689
+ if (nextDeps !== null) {
690
+ if (areHookInputsEqual(nextDeps, prevDeps)) {
691
+ return prevState[0];
692
+ }
693
+ }
694
+ }
756
695
 
757
- var useState = function (initialState) {
758
- return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
759
- initialState);
760
- };
696
+ var nextValue = nextCreate();
697
+ _this._workInProgressHook.memoizedState = [nextValue, nextDeps];
698
+ return nextValue;
699
+ };
761
700
 
762
- var useMemo = function (nextCreate, deps) {
763
- _this2._validateCurrentlyRenderingComponent();
701
+ var useRef = function (initialValue) {
702
+ _this._validateCurrentlyRenderingComponent();
764
703
 
765
- _this2._createWorkInProgressHook();
704
+ _this._createWorkInProgressHook();
766
705
 
767
- var nextDeps = deps !== undefined ? deps : null;
706
+ var previousRef = _this._workInProgressHook.memoizedState;
768
707
 
769
- if (_this2._workInProgressHook !== null && _this2._workInProgressHook.memoizedState !== null) {
770
- var prevState = _this2._workInProgressHook.memoizedState;
771
- var prevDeps = prevState[1];
708
+ if (previousRef === null) {
709
+ var ref = {
710
+ current: initialValue
711
+ };
772
712
 
773
- if (nextDeps !== null) {
774
- if (areHookInputsEqual(nextDeps, prevDeps)) {
775
- return prevState[0];
713
+ {
714
+ Object.seal(ref);
776
715
  }
777
- }
778
- }
779
716
 
780
- var nextValue = nextCreate();
781
- _this2._workInProgressHook.memoizedState = [nextValue, nextDeps];
782
- return nextValue;
783
- };
717
+ _this._workInProgressHook.memoizedState = ref;
718
+ return ref;
719
+ } else {
720
+ return previousRef;
721
+ }
722
+ };
784
723
 
785
- var useRef = function (initialValue) {
786
- _this2._validateCurrentlyRenderingComponent();
724
+ var readContext = function (context, observedBits) {
725
+ return context._currentValue;
726
+ };
787
727
 
788
- _this2._createWorkInProgressHook();
728
+ var noOp = function () {
729
+ _this._validateCurrentlyRenderingComponent();
730
+ };
789
731
 
790
- var previousRef = _this2._workInProgressHook.memoizedState;
732
+ var identity = function (fn) {
733
+ return fn;
734
+ };
791
735
 
792
- if (previousRef === null) {
793
- var ref = {
794
- current: initialValue
736
+ var useResponder = function (responder, props) {
737
+ return {
738
+ props: props,
739
+ responder: responder
795
740
  };
741
+ }; // TODO: implement if we decide to keep the shallow renderer
796
742
 
797
- {
798
- Object.seal(ref);
799
- }
800
743
 
801
- _this2._workInProgressHook.memoizedState = ref;
802
- return ref;
803
- } else {
804
- return previousRef;
805
- }
806
- };
744
+ var useTransition = function (config) {
745
+ _this._validateCurrentlyRenderingComponent();
807
746
 
808
- var readContext = function (context, observedBits) {
809
- return context._currentValue;
810
- };
747
+ var startTransition = function (callback) {
748
+ callback();
749
+ };
811
750
 
812
- var noOp = function () {
813
- _this2._validateCurrentlyRenderingComponent();
814
- };
751
+ return [startTransition, false];
752
+ }; // TODO: implement if we decide to keep the shallow renderer
815
753
 
816
- var identity = function (fn) {
817
- return fn;
818
- };
819
754
 
820
- var useResponder = function (responder, props) {
755
+ var useDeferredValue = function (value, config) {
756
+ _this._validateCurrentlyRenderingComponent();
757
+
758
+ return value;
759
+ };
760
+
821
761
  return {
822
- props: props,
823
- responder: responder
762
+ readContext: readContext,
763
+ useCallback: identity,
764
+ useContext: function (context) {
765
+ _this._validateCurrentlyRenderingComponent();
766
+
767
+ return readContext(context);
768
+ },
769
+ useDebugValue: noOp,
770
+ useEffect: noOp,
771
+ useImperativeHandle: noOp,
772
+ useLayoutEffect: noOp,
773
+ useMemo: useMemo,
774
+ useReducer: useReducer,
775
+ useRef: useRef,
776
+ useState: useState,
777
+ useResponder: useResponder,
778
+ useTransition: useTransition,
779
+ useDeferredValue: useDeferredValue
824
780
  };
825
781
  };
826
782
 
827
- return {
828
- readContext: readContext,
829
- useCallback: identity,
830
- useContext: function (context) {
831
- _this2._validateCurrentlyRenderingComponent();
832
-
833
- return readContext(context);
834
- },
835
- useDebugValue: noOp,
836
- useEffect: noOp,
837
- useImperativeHandle: noOp,
838
- useLayoutEffect: noOp,
839
- useMemo: useMemo,
840
- useReducer: useReducer,
841
- useRef: useRef,
842
- useState: useState,
843
- useResponder: useResponder
844
- };
845
- };
846
-
847
- _proto2._dispatchAction = function _dispatchAction(queue, action) {
848
- var _this3 = this;
849
-
850
- (function () {
851
- if (!(_this3._numberOfReRenders < RE_RENDER_LIMIT)) {
783
+ _proto2._dispatchAction = function _dispatchAction(queue, action) {
784
+ if (!(this._numberOfReRenders < RE_RENDER_LIMIT)) {
852
785
  {
853
- throw ReactError(Error("Too many re-renders. React limits the number of renders to prevent an infinite loop."));
786
+ throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
854
787
  }
855
788
  }
856
- })();
857
-
858
- if (this._rendering) {
859
- // This is a render phase update. Stash it in a lazily-created map of
860
- // queue -> linked list of updates. After this render pass, we'll restart
861
- // and apply the stashed updates on top of the work-in-progress hook.
862
- this._didScheduleRenderPhaseUpdate = true;
863
- var update = {
864
- action: action,
865
- next: null
866
- };
867
- var renderPhaseUpdates = this._renderPhaseUpdates;
868
-
869
- if (renderPhaseUpdates === null) {
870
- this._renderPhaseUpdates = renderPhaseUpdates = new Map();
871
- }
872
789
 
873
- var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
874
-
875
- if (firstRenderPhaseUpdate === undefined) {
876
- renderPhaseUpdates.set(queue, update);
877
- } else {
878
- // Append the update to the end of the list.
879
- var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
790
+ if (this._rendering) {
791
+ // This is a render phase update. Stash it in a lazily-created map of
792
+ // queue -> linked list of updates. After this render pass, we'll restart
793
+ // and apply the stashed updates on top of the work-in-progress hook.
794
+ this._didScheduleRenderPhaseUpdate = true;
795
+ var update = {
796
+ action: action,
797
+ next: null
798
+ };
799
+ var renderPhaseUpdates = this._renderPhaseUpdates;
880
800
 
881
- while (lastRenderPhaseUpdate.next !== null) {
882
- lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
801
+ if (renderPhaseUpdates === null) {
802
+ this._renderPhaseUpdates = renderPhaseUpdates = new Map();
883
803
  }
884
804
 
885
- lastRenderPhaseUpdate.next = update;
886
- }
887
- } else {
888
- var _update2 = {
889
- action: action,
890
- next: null
891
- }; // Append the update to the end of the list.
805
+ var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
892
806
 
893
- var last = queue.first;
807
+ if (firstRenderPhaseUpdate === undefined) {
808
+ renderPhaseUpdates.set(queue, update);
809
+ } else {
810
+ // Append the update to the end of the list.
811
+ var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
894
812
 
895
- if (last === null) {
896
- queue.first = _update2;
897
- } else {
898
- while (last.next !== null) {
899
- last = last.next;
813
+ while (lastRenderPhaseUpdate.next !== null) {
814
+ lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
815
+ }
816
+
817
+ lastRenderPhaseUpdate.next = update;
900
818
  }
819
+ } else {
820
+ var _update2 = {
821
+ action: action,
822
+ next: null
823
+ }; // Append the update to the end of the list.
901
824
 
902
- last.next = _update2;
903
- } // Re-render now.
825
+ var last = queue.first;
904
826
 
827
+ if (last === null) {
828
+ queue.first = _update2;
829
+ } else {
830
+ while (last.next !== null) {
831
+ last = last.next;
832
+ }
905
833
 
906
- this.render(this._element, this._context);
907
- }
908
- };
834
+ last.next = _update2;
835
+ } // Re-render now.
909
836
 
910
- _proto2._createWorkInProgressHook = function _createWorkInProgressHook() {
911
- if (this._workInProgressHook === null) {
912
- // This is the first hook in the list
913
- if (this._firstWorkInProgressHook === null) {
914
- this._isReRender = false;
915
- this._firstWorkInProgressHook = this._workInProgressHook = createHook();
916
- } else {
917
- // There's already a work-in-progress. Reuse it.
918
- this._isReRender = true;
919
- this._workInProgressHook = this._firstWorkInProgressHook;
837
+
838
+ this.render(this._element, this._context);
920
839
  }
921
- } else {
922
- if (this._workInProgressHook.next === null) {
923
- this._isReRender = false; // Append to the end of the list
840
+ };
924
841
 
925
- this._workInProgressHook = this._workInProgressHook.next = createHook();
842
+ _proto2._createWorkInProgressHook = function _createWorkInProgressHook() {
843
+ if (this._workInProgressHook === null) {
844
+ // This is the first hook in the list
845
+ if (this._firstWorkInProgressHook === null) {
846
+ this._isReRender = false;
847
+ this._firstWorkInProgressHook = this._workInProgressHook = createHook();
848
+ } else {
849
+ // There's already a work-in-progress. Reuse it.
850
+ this._isReRender = true;
851
+ this._workInProgressHook = this._firstWorkInProgressHook;
852
+ }
926
853
  } else {
927
- // There's already a work-in-progress. Reuse it.
928
- this._isReRender = true;
929
- this._workInProgressHook = this._workInProgressHook.next;
930
- }
931
- }
854
+ if (this._workInProgressHook.next === null) {
855
+ this._isReRender = false; // Append to the end of the list
932
856
 
933
- return this._workInProgressHook;
934
- };
857
+ this._workInProgressHook = this._workInProgressHook.next = createHook();
858
+ } else {
859
+ // There's already a work-in-progress. Reuse it.
860
+ this._isReRender = true;
861
+ this._workInProgressHook = this._workInProgressHook.next;
862
+ }
863
+ }
935
864
 
936
- _proto2._finishHooks = function _finishHooks(element, context) {
937
- if (this._didScheduleRenderPhaseUpdate) {
938
- // Updates were scheduled during the render phase. They are stored in
939
- // the `renderPhaseUpdates` map. Call the component again, reusing the
940
- // work-in-progress hooks and applying the additional updates on top. Keep
941
- // restarting until no more updates are scheduled.
942
- this._didScheduleRenderPhaseUpdate = false;
943
- this._numberOfReRenders += 1; // Start over from the beginning of the list
865
+ return this._workInProgressHook;
866
+ };
944
867
 
945
- this._workInProgressHook = null;
946
- this._rendering = false;
947
- this.render(element, context);
948
- } else {
949
- this._workInProgressHook = null;
950
- this._renderPhaseUpdates = null;
951
- this._numberOfReRenders = 0;
952
- }
953
- };
868
+ _proto2._finishHooks = function _finishHooks(element, context) {
869
+ if (this._didScheduleRenderPhaseUpdate) {
870
+ // Updates were scheduled during the render phase. They are stored in
871
+ // the `renderPhaseUpdates` map. Call the component again, reusing the
872
+ // work-in-progress hooks and applying the additional updates on top. Keep
873
+ // restarting until no more updates are scheduled.
874
+ this._didScheduleRenderPhaseUpdate = false;
875
+ this._numberOfReRenders += 1; // Start over from the beginning of the list
876
+
877
+ this._workInProgressHook = null;
878
+ this._rendering = false;
879
+ this.render(element, context);
880
+ } else {
881
+ this._workInProgressHook = null;
882
+ this._renderPhaseUpdates = null;
883
+ this._numberOfReRenders = 0;
884
+ }
885
+ };
954
886
 
955
- _proto2.getMountedInstance = function getMountedInstance() {
956
- return this._instance;
957
- };
887
+ _proto2.getMountedInstance = function getMountedInstance() {
888
+ return this._instance;
889
+ };
958
890
 
959
- _proto2.getRenderOutput = function getRenderOutput() {
960
- return this._rendered;
961
- };
891
+ _proto2.getRenderOutput = function getRenderOutput() {
892
+ return this._rendered;
893
+ };
962
894
 
963
- _proto2.render = function render(element) {
964
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : emptyObject;
895
+ _proto2.render = function render(element) {
896
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : emptyObject;
965
897
 
966
- (function () {
967
898
  if (!React.isValidElement(element)) {
968
899
  {
969
- throw ReactError(Error("ReactShallowRenderer render(): Invalid component element." + (typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '')));
900
+ throw Error( "ReactShallowRenderer render(): Invalid component element." + (typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') );
970
901
  }
971
902
  }
972
- })();
973
903
 
974
- element = element; // Show a special message for host elements since it's a common case.
904
+ element = element; // Show a special message for host elements since it's a common case.
975
905
 
976
- (function () {
977
906
  if (!(typeof element.type !== 'string')) {
978
907
  {
979
- throw ReactError(Error("ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (" + element.type + "). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead."));
908
+ throw Error( "ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (" + element.type + "). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead." );
980
909
  }
981
910
  }
982
- })();
983
911
 
984
- (function () {
985
- if (!(isForwardRef(element) || typeof element.type === 'function' || isMemo(element.type))) {
912
+ if (!(isForwardRef(element) || typeof element.type === 'function' || isMemo(element))) {
986
913
  {
987
- throw ReactError(Error("ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `" + (Array.isArray(element.type) ? 'array' : element.type === null ? 'null' : typeof element.type) + "`."));
914
+ throw Error( "ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `" + (Array.isArray(element.type) ? 'array' : element.type === null ? 'null' : typeof element.type) + "`." );
988
915
  }
989
916
  }
990
- })();
991
917
 
992
- if (this._rendering) {
993
- return;
994
- }
918
+ if (this._rendering) {
919
+ return;
920
+ }
995
921
 
996
- if (this._element != null && this._element.type !== element.type) {
997
- this._reset();
998
- }
922
+ if (this._element != null && this._element.type !== element.type) {
923
+ this._reset();
924
+ }
999
925
 
1000
- var elementType = isMemo(element.type) ? element.type.type : element.type;
1001
- var previousElement = this._element;
1002
- this._rendering = true;
1003
- this._element = element;
1004
- this._context = getMaskedContext(elementType.contextTypes, context); // Inner memo component props aren't currently validated in createElement.
926
+ var elementType = isMemo(element) ? element.type.type : element.type;
927
+ var previousElement = this._element;
928
+ this._rendering = true;
929
+ this._element = element;
930
+ this._context = getMaskedContext(elementType.contextTypes, context); // Inner memo component props aren't currently validated in createElement.
1005
931
 
1006
- if (isMemo(element.type) && elementType.propTypes) {
1007
- currentlyValidatingElement = element;
1008
- checkPropTypes_1(elementType.propTypes, element.props, 'prop', getComponentName(elementType), getStackAddendum);
1009
- }
932
+ if (isMemo(element) && elementType.propTypes) {
933
+ currentlyValidatingElement = element;
934
+ checkPropTypes_1(elementType.propTypes, element.props, 'prop', getComponentName(elementType), getStackAddendum);
935
+ }
1010
936
 
1011
- if (this._instance) {
1012
- this._updateClassComponent(elementType, element, this._context);
1013
- } else {
1014
- if (shouldConstruct(elementType)) {
1015
- this._instance = new elementType(element.props, this._context, this._updater);
937
+ if (this._instance) {
938
+ this._updateClassComponent(elementType, element, this._context);
939
+ } else {
940
+ if (shouldConstruct(elementType)) {
941
+ this._instance = new elementType(element.props, this._context, this._updater);
1016
942
 
1017
- if (typeof elementType.getDerivedStateFromProps === 'function') {
1018
- var partialState = elementType.getDerivedStateFromProps.call(null, element.props, this._instance.state);
943
+ if (typeof elementType.getDerivedStateFromProps === 'function') {
944
+ var partialState = elementType.getDerivedStateFromProps.call(null, element.props, this._instance.state);
1019
945
 
1020
- if (partialState != null) {
1021
- this._instance.state = _assign({}, this._instance.state, partialState);
946
+ if (partialState != null) {
947
+ this._instance.state = _assign({}, this._instance.state, partialState);
948
+ }
1022
949
  }
1023
- }
1024
950
 
1025
- if (elementType.contextTypes) {
1026
- currentlyValidatingElement = element;
1027
- checkPropTypes_1(elementType.contextTypes, this._context, 'context', getName(elementType, this._instance), getStackAddendum);
1028
- currentlyValidatingElement = null;
1029
- }
951
+ if (elementType.contextTypes) {
952
+ currentlyValidatingElement = element;
953
+ checkPropTypes_1(elementType.contextTypes, this._context, 'context', getName(elementType, this._instance), getStackAddendum);
954
+ currentlyValidatingElement = null;
955
+ }
1030
956
 
1031
- this._mountClassComponent(elementType, element, this._context);
1032
- } else {
1033
- var shouldRender = true;
957
+ this._mountClassComponent(elementType, element, this._context);
958
+ } else {
959
+ var shouldRender = true;
1034
960
 
1035
- if (isMemo(element.type) && previousElement !== null) {
1036
- // This is a Memo component that is being re-rendered.
1037
- var compare = element.type.compare || shallowEqual;
961
+ if (isMemo(element) && previousElement !== null) {
962
+ // This is a Memo component that is being re-rendered.
963
+ var compare = element.type.compare || shallowEqual;
1038
964
 
1039
- if (compare(previousElement.props, element.props)) {
1040
- shouldRender = false;
965
+ if (compare(previousElement.props, element.props)) {
966
+ shouldRender = false;
967
+ }
1041
968
  }
1042
- }
1043
969
 
1044
- if (shouldRender) {
1045
- var prevDispatcher = ReactCurrentDispatcher.current;
1046
- ReactCurrentDispatcher.current = this._dispatcher;
970
+ if (shouldRender) {
971
+ var prevDispatcher = ReactCurrentDispatcher.current;
972
+ ReactCurrentDispatcher.current = this._dispatcher;
1047
973
 
1048
- try {
1049
- // elementType could still be a ForwardRef if it was
1050
- // nested inside Memo.
1051
- if (elementType.$$typeof === ForwardRef) {
1052
- (function () {
974
+ try {
975
+ // elementType could still be a ForwardRef if it was
976
+ // nested inside Memo.
977
+ if (elementType.$$typeof === ForwardRef) {
1053
978
  if (!(typeof elementType.render === 'function')) {
1054
979
  {
1055
- throw ReactError(Error("forwardRef requires a render function but was given " + typeof elementType.render + "."));
980
+ throw Error(true ? "forwardRef requires a render function but was given " + typeof elementType.render + "." : formatProdErrorMessage(322, typeof elementType.render));
1056
981
  }
1057
982
  }
1058
- })();
1059
983
 
1060
- this._rendered = elementType.render.call(undefined, element.props, element.ref);
1061
- } else {
1062
- this._rendered = elementType(element.props, this._context);
984
+ this._rendered = elementType.render.call(undefined, element.props, element.ref);
985
+ } else {
986
+ this._rendered = elementType(element.props, this._context);
987
+ }
988
+ } finally {
989
+ ReactCurrentDispatcher.current = prevDispatcher;
1063
990
  }
1064
- } finally {
1065
- ReactCurrentDispatcher.current = prevDispatcher;
1066
- }
1067
991
 
1068
- this._finishHooks(element, context);
992
+ this._finishHooks(element, context);
993
+ }
1069
994
  }
1070
995
  }
1071
- }
1072
996
 
1073
- this._rendering = false;
997
+ this._rendering = false;
1074
998
 
1075
- this._updater._invokeCallbacks();
999
+ this._updater._invokeCallbacks();
1076
1000
 
1077
- return this.getRenderOutput();
1078
- };
1001
+ return this.getRenderOutput();
1002
+ };
1079
1003
 
1080
- _proto2.unmount = function unmount() {
1081
- if (this._instance) {
1082
- if (typeof this._instance.componentWillUnmount === 'function') {
1083
- this._instance.componentWillUnmount();
1004
+ _proto2.unmount = function unmount() {
1005
+ if (this._instance) {
1006
+ if (typeof this._instance.componentWillUnmount === 'function') {
1007
+ this._instance.componentWillUnmount();
1008
+ }
1084
1009
  }
1085
- }
1086
1010
 
1087
- this._reset();
1088
- };
1011
+ this._reset();
1012
+ };
1089
1013
 
1090
- _proto2._mountClassComponent = function _mountClassComponent(elementType, element, context) {
1091
- this._instance.context = context;
1092
- this._instance.props = element.props;
1093
- this._instance.state = this._instance.state || null;
1094
- this._instance.updater = this._updater;
1014
+ _proto2._mountClassComponent = function _mountClassComponent(elementType, element, context) {
1015
+ this._instance.context = context;
1016
+ this._instance.props = element.props;
1017
+ this._instance.state = this._instance.state || null;
1018
+ this._instance.updater = this._updater;
1095
1019
 
1096
- if (typeof this._instance.UNSAFE_componentWillMount === 'function' || typeof this._instance.componentWillMount === 'function') {
1097
- var beforeState = this._newState; // In order to support react-lifecycles-compat polyfilled components,
1098
- // Unsafe lifecycles should not be invoked for components using the new APIs.
1020
+ if (typeof this._instance.UNSAFE_componentWillMount === 'function' || typeof this._instance.componentWillMount === 'function') {
1021
+ var beforeState = this._newState; // In order to support react-lifecycles-compat polyfilled components,
1022
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
1099
1023
 
1100
- if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1101
- if (typeof this._instance.componentWillMount === 'function') {
1102
- this._instance.componentWillMount();
1103
- }
1024
+ if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1025
+ if (typeof this._instance.componentWillMount === 'function') {
1026
+ this._instance.componentWillMount();
1027
+ }
1104
1028
 
1105
- if (typeof this._instance.UNSAFE_componentWillMount === 'function') {
1106
- this._instance.UNSAFE_componentWillMount();
1107
- }
1108
- } // setState may have been called during cWM
1029
+ if (typeof this._instance.UNSAFE_componentWillMount === 'function') {
1030
+ this._instance.UNSAFE_componentWillMount();
1031
+ }
1032
+ } // setState may have been called during cWM
1109
1033
 
1110
1034
 
1111
- if (beforeState !== this._newState) {
1112
- this._instance.state = this._newState || emptyObject;
1035
+ if (beforeState !== this._newState) {
1036
+ this._instance.state = this._newState || emptyObject;
1037
+ }
1113
1038
  }
1114
- }
1115
1039
 
1116
- this._rendered = this._instance.render(); // Intentionally do not call componentDidMount()
1117
- // because DOM refs are not available.
1118
- };
1040
+ this._rendered = this._instance.render(); // Intentionally do not call componentDidMount()
1041
+ // because DOM refs are not available.
1042
+ };
1119
1043
 
1120
- _proto2._updateClassComponent = function _updateClassComponent(elementType, element, context) {
1121
- var props = element.props;
1122
- var oldState = this._instance.state || emptyObject;
1123
- var oldProps = this._instance.props;
1124
-
1125
- if (oldProps !== props) {
1126
- // In order to support react-lifecycles-compat polyfilled components,
1127
- // Unsafe lifecycles should not be invoked for components using the new APIs.
1128
- if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1129
- if (typeof this._instance.componentWillReceiveProps === 'function') {
1130
- this._instance.componentWillReceiveProps(props, context);
1131
- }
1044
+ _proto2._updateClassComponent = function _updateClassComponent(elementType, element, context) {
1045
+ var props = element.props;
1046
+ var oldState = this._instance.state || emptyObject;
1047
+ var oldProps = this._instance.props;
1048
+
1049
+ if (oldProps !== props) {
1050
+ // In order to support react-lifecycles-compat polyfilled components,
1051
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
1052
+ if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1053
+ if (typeof this._instance.componentWillReceiveProps === 'function') {
1054
+ this._instance.componentWillReceiveProps(props, context);
1055
+ }
1132
1056
 
1133
- if (typeof this._instance.UNSAFE_componentWillReceiveProps === 'function') {
1134
- this._instance.UNSAFE_componentWillReceiveProps(props, context);
1057
+ if (typeof this._instance.UNSAFE_componentWillReceiveProps === 'function') {
1058
+ this._instance.UNSAFE_componentWillReceiveProps(props, context);
1059
+ }
1135
1060
  }
1136
- }
1137
- } // Read state after cWRP in case it calls setState
1061
+ } // Read state after cWRP in case it calls setState
1138
1062
 
1139
1063
 
1140
- var state = this._newState || oldState;
1064
+ var state = this._newState || oldState;
1141
1065
 
1142
- if (typeof elementType.getDerivedStateFromProps === 'function') {
1143
- var partialState = elementType.getDerivedStateFromProps.call(null, props, state);
1066
+ if (typeof elementType.getDerivedStateFromProps === 'function') {
1067
+ var partialState = elementType.getDerivedStateFromProps.call(null, props, state);
1144
1068
 
1145
- if (partialState != null) {
1146
- state = _assign({}, state, partialState);
1069
+ if (partialState != null) {
1070
+ state = _assign({}, state, partialState);
1071
+ }
1147
1072
  }
1148
- }
1149
1073
 
1150
- var shouldUpdate = true;
1074
+ var shouldUpdate = true;
1151
1075
 
1152
- if (this._forcedUpdate) {
1153
- shouldUpdate = true;
1154
- this._forcedUpdate = false;
1155
- } else if (typeof this._instance.shouldComponentUpdate === 'function') {
1156
- shouldUpdate = !!this._instance.shouldComponentUpdate(props, state, context);
1157
- } else if (elementType.prototype && elementType.prototype.isPureReactComponent) {
1158
- shouldUpdate = !shallowEqual(oldProps, props) || !shallowEqual(oldState, state);
1159
- }
1076
+ if (this._forcedUpdate) {
1077
+ shouldUpdate = true;
1078
+ this._forcedUpdate = false;
1079
+ } else if (typeof this._instance.shouldComponentUpdate === 'function') {
1080
+ shouldUpdate = !!this._instance.shouldComponentUpdate(props, state, context);
1081
+ } else if (elementType.prototype && elementType.prototype.isPureReactComponent) {
1082
+ shouldUpdate = !shallowEqual(oldProps, props) || !shallowEqual(oldState, state);
1083
+ }
1160
1084
 
1161
- if (shouldUpdate) {
1162
- // In order to support react-lifecycles-compat polyfilled components,
1163
- // Unsafe lifecycles should not be invoked for components using the new APIs.
1164
- if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1165
- if (typeof this._instance.componentWillUpdate === 'function') {
1166
- this._instance.componentWillUpdate(props, state, context);
1167
- }
1085
+ if (shouldUpdate) {
1086
+ // In order to support react-lifecycles-compat polyfilled components,
1087
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
1088
+ if (typeof elementType.getDerivedStateFromProps !== 'function' && typeof this._instance.getSnapshotBeforeUpdate !== 'function') {
1089
+ if (typeof this._instance.componentWillUpdate === 'function') {
1090
+ this._instance.componentWillUpdate(props, state, context);
1091
+ }
1168
1092
 
1169
- if (typeof this._instance.UNSAFE_componentWillUpdate === 'function') {
1170
- this._instance.UNSAFE_componentWillUpdate(props, state, context);
1093
+ if (typeof this._instance.UNSAFE_componentWillUpdate === 'function') {
1094
+ this._instance.UNSAFE_componentWillUpdate(props, state, context);
1095
+ }
1171
1096
  }
1172
1097
  }
1173
- }
1174
1098
 
1175
- this._instance.context = context;
1176
- this._instance.props = props;
1177
- this._instance.state = state;
1178
- this._newState = null;
1099
+ this._instance.context = context;
1100
+ this._instance.props = props;
1101
+ this._instance.state = state;
1102
+ this._newState = null;
1179
1103
 
1180
- if (shouldUpdate) {
1181
- this._rendered = this._instance.render();
1182
- } // Intentionally do not call componentDidUpdate()
1183
- // because DOM refs are not available.
1104
+ if (shouldUpdate) {
1105
+ this._rendered = this._instance.render();
1106
+ } // Intentionally do not call componentDidUpdate()
1107
+ // because DOM refs are not available.
1184
1108
 
1185
- };
1109
+ };
1186
1110
 
1187
- return ReactShallowRenderer;
1188
- }();
1189
-
1190
- ReactShallowRenderer.createRenderer = function () {
1191
- return new ReactShallowRenderer();
1192
- };
1193
-
1194
- var currentlyValidatingElement = null;
1195
-
1196
- function getDisplayName(element) {
1197
- if (element == null) {
1198
- return '#empty';
1199
- } else if (typeof element === 'string' || typeof element === 'number') {
1200
- return '#text';
1201
- } else if (typeof element.type === 'string') {
1202
- return element.type;
1203
- } else {
1204
- var elementType = isMemo(element.type) ? element.type.type : element.type;
1205
- return elementType.displayName || elementType.name || 'Unknown';
1206
- }
1207
- }
1111
+ return ReactShallowRenderer;
1112
+ }();
1208
1113
 
1209
- function getStackAddendum() {
1210
- var stack = '';
1114
+ ReactShallowRenderer.createRenderer = function () {
1115
+ return new ReactShallowRenderer();
1116
+ };
1211
1117
 
1212
- if (currentlyValidatingElement) {
1213
- var name = getDisplayName(currentlyValidatingElement);
1214
- var owner = currentlyValidatingElement._owner;
1215
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
1216
- }
1118
+ var currentlyValidatingElement = null;
1217
1119
 
1218
- return stack;
1219
- }
1120
+ function getDisplayName(element) {
1121
+ if (element == null) {
1122
+ return '#empty';
1123
+ } else if (typeof element === 'string' || typeof element === 'number') {
1124
+ return '#text';
1125
+ } else if (typeof element.type === 'string') {
1126
+ return element.type;
1127
+ } else {
1128
+ var elementType = isMemo(element) ? element.type.type : element.type;
1129
+ return elementType.displayName || elementType.name || 'Unknown';
1130
+ }
1131
+ }
1220
1132
 
1221
- function getName(type, instance) {
1222
- var constructor = instance && instance.constructor;
1223
- return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
1224
- }
1133
+ function getStackAddendum() {
1134
+ var stack = '';
1225
1135
 
1226
- function shouldConstruct(Component) {
1227
- return !!(Component.prototype && Component.prototype.isReactComponent);
1228
- }
1136
+ if (currentlyValidatingElement) {
1137
+ var name = getDisplayName(currentlyValidatingElement);
1138
+ var owner = currentlyValidatingElement._owner;
1139
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
1140
+ }
1229
1141
 
1230
- function getMaskedContext(contextTypes, unmaskedContext) {
1231
- if (!contextTypes || !unmaskedContext) {
1232
- return emptyObject;
1142
+ return stack;
1233
1143
  }
1234
1144
 
1235
- var context = {};
1236
-
1237
- for (var key in contextTypes) {
1238
- context[key] = unmaskedContext[key];
1145
+ function getName(type, instance) {
1146
+ var constructor = instance && instance.constructor;
1147
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
1239
1148
  }
1240
1149
 
1241
- return context;
1242
- }
1150
+ function shouldConstruct(Component) {
1151
+ return !!(Component.prototype && Component.prototype.isReactComponent);
1152
+ }
1243
1153
 
1154
+ function getMaskedContext(contextTypes, unmaskedContext) {
1155
+ if (!contextTypes || !unmaskedContext) {
1156
+ return emptyObject;
1157
+ }
1244
1158
 
1159
+ var context = {};
1245
1160
 
1246
- var ReactShallowRenderer$2 = Object.freeze({
1247
- default: ReactShallowRenderer
1248
- });
1161
+ for (var key in contextTypes) {
1162
+ context[key] = unmaskedContext[key];
1163
+ }
1249
1164
 
1250
- var ReactShallowRenderer$3 = ( ReactShallowRenderer$2 && ReactShallowRenderer ) || ReactShallowRenderer$2;
1165
+ return context;
1166
+ }
1251
1167
 
1252
- // TODO: decide on the top-level export form.
1253
- // This is hacky but makes it work with both Rollup and Jest.
1168
+ // TODO: decide on the top-level export form.
1169
+ // This is hacky but makes it work with both Rollup and Jest.
1254
1170
 
1255
1171
 
1256
- var shallow = ReactShallowRenderer$3.default || ReactShallowRenderer$3;
1172
+ var shallow = ReactShallowRenderer.default || ReactShallowRenderer;
1257
1173
 
1258
- return shallow;
1174
+ return shallow;
1259
1175
 
1260
1176
  })));