powell-react 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +321 -0
- package/dist/cjs/index.js +4234 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/Button/Button.d.ts +7 -0
- package/dist/cjs/types/components/Button/index.d.ts +2 -0
- package/dist/cjs/types/components/Input/Input.d.ts +2 -0
- package/dist/cjs/types/components/Input/index.d.ts +2 -0
- package/dist/cjs/types/components/index.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/esm/index.js +4231 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/Button/Button.d.ts +7 -0
- package/dist/esm/types/components/Button/index.d.ts +2 -0
- package/dist/esm/types/components/Input/Input.d.ts +2 -0
- package/dist/esm/types/components/Input/index.d.ts +2 -0
- package/dist/esm/types/components/index.d.ts +2 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/index.d.ts +11 -0
- package/package.json +79 -0
@@ -0,0 +1,4231 @@
|
|
1
|
+
var jsxRuntime = {exports: {}};
|
2
|
+
|
3
|
+
var reactJsxRuntime_production_min = {};
|
4
|
+
|
5
|
+
var react = {exports: {}};
|
6
|
+
|
7
|
+
var react_production_min = {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @license React
|
11
|
+
* react.production.min.js
|
12
|
+
*
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
14
|
+
*
|
15
|
+
* This source code is licensed under the MIT license found in the
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
17
|
+
*/
|
18
|
+
|
19
|
+
var hasRequiredReact_production_min;
|
20
|
+
|
21
|
+
function requireReact_production_min () {
|
22
|
+
if (hasRequiredReact_production_min) return react_production_min;
|
23
|
+
hasRequiredReact_production_min = 1;
|
24
|
+
var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null}
|
25
|
+
var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={};
|
26
|
+
E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F;
|
27
|
+
H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};
|
28
|
+
function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}
|
29
|
+
function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
|
30
|
+
function R(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case l:case n:h=!0;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k=
|
31
|
+
a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h}
|
32
|
+
function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;}
|
33
|
+
var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};function X(){throw Error("act(...) is not supported in production builds of React.");}
|
34
|
+
react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;
|
35
|
+
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;react_production_min.act=X;
|
36
|
+
react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);
|
37
|
+
for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};
|
38
|
+
react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=X;react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)};
|
39
|
+
react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};
|
40
|
+
react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.3.1";
|
41
|
+
return react_production_min;
|
42
|
+
}
|
43
|
+
|
44
|
+
var react_development = {exports: {}};
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @license React
|
48
|
+
* react.development.js
|
49
|
+
*
|
50
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
51
|
+
*
|
52
|
+
* This source code is licensed under the MIT license found in the
|
53
|
+
* LICENSE file in the root directory of this source tree.
|
54
|
+
*/
|
55
|
+
react_development.exports;
|
56
|
+
|
57
|
+
var hasRequiredReact_development;
|
58
|
+
|
59
|
+
function requireReact_development () {
|
60
|
+
if (hasRequiredReact_development) return react_development.exports;
|
61
|
+
hasRequiredReact_development = 1;
|
62
|
+
(function (module, exports) {
|
63
|
+
|
64
|
+
if (process.env.NODE_ENV !== "production") {
|
65
|
+
(function() {
|
66
|
+
|
67
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
68
|
+
if (
|
69
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
70
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
71
|
+
'function'
|
72
|
+
) {
|
73
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
74
|
+
}
|
75
|
+
var ReactVersion = '18.3.1';
|
76
|
+
|
77
|
+
// ATTENTION
|
78
|
+
// When adding new symbols to this file,
|
79
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
80
|
+
// The Symbol used to tag the ReactElement-like types.
|
81
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
82
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
83
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
84
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
85
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
86
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
87
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
88
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
89
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
90
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
91
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
92
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
93
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
94
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
95
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
96
|
+
function getIteratorFn(maybeIterable) {
|
97
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
|
101
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
102
|
+
|
103
|
+
if (typeof maybeIterator === 'function') {
|
104
|
+
return maybeIterator;
|
105
|
+
}
|
106
|
+
|
107
|
+
return null;
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Keeps track of the current dispatcher.
|
112
|
+
*/
|
113
|
+
var ReactCurrentDispatcher = {
|
114
|
+
/**
|
115
|
+
* @internal
|
116
|
+
* @type {ReactComponent}
|
117
|
+
*/
|
118
|
+
current: null
|
119
|
+
};
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Keeps track of the current batch's configuration such as how long an update
|
123
|
+
* should suspend for if it needs to.
|
124
|
+
*/
|
125
|
+
var ReactCurrentBatchConfig = {
|
126
|
+
transition: null
|
127
|
+
};
|
128
|
+
|
129
|
+
var ReactCurrentActQueue = {
|
130
|
+
current: null,
|
131
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
132
|
+
isBatchingLegacy: false,
|
133
|
+
didScheduleLegacyUpdate: false
|
134
|
+
};
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Keeps track of the current owner.
|
138
|
+
*
|
139
|
+
* The current owner is the component who should own any components that are
|
140
|
+
* currently being constructed.
|
141
|
+
*/
|
142
|
+
var ReactCurrentOwner = {
|
143
|
+
/**
|
144
|
+
* @internal
|
145
|
+
* @type {ReactComponent}
|
146
|
+
*/
|
147
|
+
current: null
|
148
|
+
};
|
149
|
+
|
150
|
+
var ReactDebugCurrentFrame = {};
|
151
|
+
var currentExtraStackFrame = null;
|
152
|
+
function setExtraStackFrame(stack) {
|
153
|
+
{
|
154
|
+
currentExtraStackFrame = stack;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
{
|
159
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
160
|
+
{
|
161
|
+
currentExtraStackFrame = stack;
|
162
|
+
}
|
163
|
+
}; // Stack implementation injected by the current renderer.
|
164
|
+
|
165
|
+
|
166
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
167
|
+
|
168
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
169
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
170
|
+
|
171
|
+
if (currentExtraStackFrame) {
|
172
|
+
stack += currentExtraStackFrame;
|
173
|
+
} // Delegate to the injected renderer-specific implementation
|
174
|
+
|
175
|
+
|
176
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
177
|
+
|
178
|
+
if (impl) {
|
179
|
+
stack += impl() || '';
|
180
|
+
}
|
181
|
+
|
182
|
+
return stack;
|
183
|
+
};
|
184
|
+
}
|
185
|
+
|
186
|
+
// -----------------------------------------------------------------------------
|
187
|
+
|
188
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
189
|
+
var enableCacheElement = false;
|
190
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
191
|
+
|
192
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
193
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
194
|
+
// issues in DEV builds.
|
195
|
+
|
196
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
197
|
+
|
198
|
+
var ReactSharedInternals = {
|
199
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
200
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
201
|
+
ReactCurrentOwner: ReactCurrentOwner
|
202
|
+
};
|
203
|
+
|
204
|
+
{
|
205
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
206
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
207
|
+
}
|
208
|
+
|
209
|
+
// by calls to these methods by a Babel plugin.
|
210
|
+
//
|
211
|
+
// In PROD (or in packages without access to React internals),
|
212
|
+
// they are left as they are instead.
|
213
|
+
|
214
|
+
function warn(format) {
|
215
|
+
{
|
216
|
+
{
|
217
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
218
|
+
args[_key - 1] = arguments[_key];
|
219
|
+
}
|
220
|
+
|
221
|
+
printWarning('warn', format, args);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
function error(format) {
|
226
|
+
{
|
227
|
+
{
|
228
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
229
|
+
args[_key2 - 1] = arguments[_key2];
|
230
|
+
}
|
231
|
+
|
232
|
+
printWarning('error', format, args);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
function printWarning(level, format, args) {
|
238
|
+
// When changing this logic, you might want to also
|
239
|
+
// update consoleWithStackDev.www.js as well.
|
240
|
+
{
|
241
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
242
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
243
|
+
|
244
|
+
if (stack !== '') {
|
245
|
+
format += '%s';
|
246
|
+
args = args.concat([stack]);
|
247
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
248
|
+
|
249
|
+
|
250
|
+
var argsWithFormat = args.map(function (item) {
|
251
|
+
return String(item);
|
252
|
+
}); // Careful: RN currently depends on this prefix
|
253
|
+
|
254
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
255
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
256
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
257
|
+
|
258
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
263
|
+
|
264
|
+
function warnNoop(publicInstance, callerName) {
|
265
|
+
{
|
266
|
+
var _constructor = publicInstance.constructor;
|
267
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
268
|
+
var warningKey = componentName + "." + callerName;
|
269
|
+
|
270
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
271
|
+
return;
|
272
|
+
}
|
273
|
+
|
274
|
+
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);
|
275
|
+
|
276
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
/**
|
280
|
+
* This is the abstract API for an update queue.
|
281
|
+
*/
|
282
|
+
|
283
|
+
|
284
|
+
var ReactNoopUpdateQueue = {
|
285
|
+
/**
|
286
|
+
* Checks whether or not this composite component is mounted.
|
287
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
288
|
+
* @return {boolean} True if mounted, false otherwise.
|
289
|
+
* @protected
|
290
|
+
* @final
|
291
|
+
*/
|
292
|
+
isMounted: function (publicInstance) {
|
293
|
+
return false;
|
294
|
+
},
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Forces an update. This should only be invoked when it is known with
|
298
|
+
* certainty that we are **not** in a DOM transaction.
|
299
|
+
*
|
300
|
+
* You may want to call this when you know that some deeper aspect of the
|
301
|
+
* component's state has changed but `setState` was not called.
|
302
|
+
*
|
303
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
304
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
305
|
+
*
|
306
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
307
|
+
* @param {?function} callback Called after component is updated.
|
308
|
+
* @param {?string} callerName name of the calling function in the public API.
|
309
|
+
* @internal
|
310
|
+
*/
|
311
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
312
|
+
warnNoop(publicInstance, 'forceUpdate');
|
313
|
+
},
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
317
|
+
* You should treat `this.state` as immutable.
|
318
|
+
*
|
319
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
320
|
+
* accessing `this.state` after calling this method may return the old value.
|
321
|
+
*
|
322
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
323
|
+
* @param {object} completeState Next state.
|
324
|
+
* @param {?function} callback Called after component is updated.
|
325
|
+
* @param {?string} callerName name of the calling function in the public API.
|
326
|
+
* @internal
|
327
|
+
*/
|
328
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
329
|
+
warnNoop(publicInstance, 'replaceState');
|
330
|
+
},
|
331
|
+
|
332
|
+
/**
|
333
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
334
|
+
* internal. This provides a merging strategy that is not available to deep
|
335
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
336
|
+
* during the merge.
|
337
|
+
*
|
338
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
339
|
+
* @param {object} partialState Next partial state to be merged with state.
|
340
|
+
* @param {?function} callback Called after component is updated.
|
341
|
+
* @param {?string} Name of the calling function in the public API.
|
342
|
+
* @internal
|
343
|
+
*/
|
344
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
345
|
+
warnNoop(publicInstance, 'setState');
|
346
|
+
}
|
347
|
+
};
|
348
|
+
|
349
|
+
var assign = Object.assign;
|
350
|
+
|
351
|
+
var emptyObject = {};
|
352
|
+
|
353
|
+
{
|
354
|
+
Object.freeze(emptyObject);
|
355
|
+
}
|
356
|
+
/**
|
357
|
+
* Base class helpers for the updating state of a component.
|
358
|
+
*/
|
359
|
+
|
360
|
+
|
361
|
+
function Component(props, context, updater) {
|
362
|
+
this.props = props;
|
363
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
364
|
+
|
365
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
366
|
+
// renderer.
|
367
|
+
|
368
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
369
|
+
}
|
370
|
+
|
371
|
+
Component.prototype.isReactComponent = {};
|
372
|
+
/**
|
373
|
+
* Sets a subset of the state. Always use this to mutate
|
374
|
+
* state. You should treat `this.state` as immutable.
|
375
|
+
*
|
376
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
377
|
+
* accessing `this.state` after calling this method may return the old value.
|
378
|
+
*
|
379
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
380
|
+
* as they may eventually be batched together. You can provide an optional
|
381
|
+
* callback that will be executed when the call to setState is actually
|
382
|
+
* completed.
|
383
|
+
*
|
384
|
+
* When a function is provided to setState, it will be called at some point in
|
385
|
+
* the future (not synchronously). It will be called with the up to date
|
386
|
+
* component arguments (state, props, context). These values can be different
|
387
|
+
* from this.* because your function may be called after receiveProps but before
|
388
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
389
|
+
* assigned to this.
|
390
|
+
*
|
391
|
+
* @param {object|function} partialState Next partial state or function to
|
392
|
+
* produce next partial state to be merged with current state.
|
393
|
+
* @param {?function} callback Called after state is updated.
|
394
|
+
* @final
|
395
|
+
* @protected
|
396
|
+
*/
|
397
|
+
|
398
|
+
Component.prototype.setState = function (partialState, callback) {
|
399
|
+
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
400
|
+
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
401
|
+
}
|
402
|
+
|
403
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
404
|
+
};
|
405
|
+
/**
|
406
|
+
* Forces an update. This should only be invoked when it is known with
|
407
|
+
* certainty that we are **not** in a DOM transaction.
|
408
|
+
*
|
409
|
+
* You may want to call this when you know that some deeper aspect of the
|
410
|
+
* component's state has changed but `setState` was not called.
|
411
|
+
*
|
412
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
413
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
414
|
+
*
|
415
|
+
* @param {?function} callback Called after update is complete.
|
416
|
+
* @final
|
417
|
+
* @protected
|
418
|
+
*/
|
419
|
+
|
420
|
+
|
421
|
+
Component.prototype.forceUpdate = function (callback) {
|
422
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
423
|
+
};
|
424
|
+
/**
|
425
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
426
|
+
* we would like to deprecate them, we're not going to move them over to this
|
427
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
428
|
+
*/
|
429
|
+
|
430
|
+
|
431
|
+
{
|
432
|
+
var deprecatedAPIs = {
|
433
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
434
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
435
|
+
};
|
436
|
+
|
437
|
+
var defineDeprecationWarning = function (methodName, info) {
|
438
|
+
Object.defineProperty(Component.prototype, methodName, {
|
439
|
+
get: function () {
|
440
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
441
|
+
|
442
|
+
return undefined;
|
443
|
+
}
|
444
|
+
});
|
445
|
+
};
|
446
|
+
|
447
|
+
for (var fnName in deprecatedAPIs) {
|
448
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
449
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
450
|
+
}
|
451
|
+
}
|
452
|
+
}
|
453
|
+
|
454
|
+
function ComponentDummy() {}
|
455
|
+
|
456
|
+
ComponentDummy.prototype = Component.prototype;
|
457
|
+
/**
|
458
|
+
* Convenience component with default shallow equality check for sCU.
|
459
|
+
*/
|
460
|
+
|
461
|
+
function PureComponent(props, context, updater) {
|
462
|
+
this.props = props;
|
463
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
464
|
+
|
465
|
+
this.refs = emptyObject;
|
466
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
467
|
+
}
|
468
|
+
|
469
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
470
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
471
|
+
|
472
|
+
assign(pureComponentPrototype, Component.prototype);
|
473
|
+
pureComponentPrototype.isPureReactComponent = true;
|
474
|
+
|
475
|
+
// an immutable object with a single mutable value
|
476
|
+
function createRef() {
|
477
|
+
var refObject = {
|
478
|
+
current: null
|
479
|
+
};
|
480
|
+
|
481
|
+
{
|
482
|
+
Object.seal(refObject);
|
483
|
+
}
|
484
|
+
|
485
|
+
return refObject;
|
486
|
+
}
|
487
|
+
|
488
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
489
|
+
|
490
|
+
function isArray(a) {
|
491
|
+
return isArrayImpl(a);
|
492
|
+
}
|
493
|
+
|
494
|
+
/*
|
495
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
496
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
497
|
+
*
|
498
|
+
* The functions in this module will throw an easier-to-understand,
|
499
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
500
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
501
|
+
* of the `value` object).
|
502
|
+
*/
|
503
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
504
|
+
function typeName(value) {
|
505
|
+
{
|
506
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
507
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
508
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
509
|
+
return type;
|
510
|
+
}
|
511
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
512
|
+
|
513
|
+
|
514
|
+
function willCoercionThrow(value) {
|
515
|
+
{
|
516
|
+
try {
|
517
|
+
testStringCoercion(value);
|
518
|
+
return false;
|
519
|
+
} catch (e) {
|
520
|
+
return true;
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
|
525
|
+
function testStringCoercion(value) {
|
526
|
+
// If you ended up here by following an exception call stack, here's what's
|
527
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
528
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
529
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
530
|
+
//
|
531
|
+
// The most common types that will cause this exception are `Symbol` instances
|
532
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
533
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
534
|
+
// exception. (Library authors do this to prevent users from using built-in
|
535
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
536
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
537
|
+
//
|
538
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
539
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
540
|
+
//
|
541
|
+
// To find which value is throwing, check the browser or debugger console.
|
542
|
+
// Before this exception was thrown, there should be `console.error` output
|
543
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
544
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
545
|
+
// In most cases, this console output also shows the component and its
|
546
|
+
// ancestor components where the exception happened.
|
547
|
+
//
|
548
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
549
|
+
return '' + value;
|
550
|
+
}
|
551
|
+
function checkKeyStringCoercion(value) {
|
552
|
+
{
|
553
|
+
if (willCoercionThrow(value)) {
|
554
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
555
|
+
|
556
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}
|
560
|
+
|
561
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
562
|
+
var displayName = outerType.displayName;
|
563
|
+
|
564
|
+
if (displayName) {
|
565
|
+
return displayName;
|
566
|
+
}
|
567
|
+
|
568
|
+
var functionName = innerType.displayName || innerType.name || '';
|
569
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
570
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
571
|
+
|
572
|
+
|
573
|
+
function getContextName(type) {
|
574
|
+
return type.displayName || 'Context';
|
575
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
576
|
+
|
577
|
+
|
578
|
+
function getComponentNameFromType(type) {
|
579
|
+
if (type == null) {
|
580
|
+
// Host root, text node or just invalid type.
|
581
|
+
return null;
|
582
|
+
}
|
583
|
+
|
584
|
+
{
|
585
|
+
if (typeof type.tag === 'number') {
|
586
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
if (typeof type === 'function') {
|
591
|
+
return type.displayName || type.name || null;
|
592
|
+
}
|
593
|
+
|
594
|
+
if (typeof type === 'string') {
|
595
|
+
return type;
|
596
|
+
}
|
597
|
+
|
598
|
+
switch (type) {
|
599
|
+
case REACT_FRAGMENT_TYPE:
|
600
|
+
return 'Fragment';
|
601
|
+
|
602
|
+
case REACT_PORTAL_TYPE:
|
603
|
+
return 'Portal';
|
604
|
+
|
605
|
+
case REACT_PROFILER_TYPE:
|
606
|
+
return 'Profiler';
|
607
|
+
|
608
|
+
case REACT_STRICT_MODE_TYPE:
|
609
|
+
return 'StrictMode';
|
610
|
+
|
611
|
+
case REACT_SUSPENSE_TYPE:
|
612
|
+
return 'Suspense';
|
613
|
+
|
614
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
615
|
+
return 'SuspenseList';
|
616
|
+
|
617
|
+
}
|
618
|
+
|
619
|
+
if (typeof type === 'object') {
|
620
|
+
switch (type.$$typeof) {
|
621
|
+
case REACT_CONTEXT_TYPE:
|
622
|
+
var context = type;
|
623
|
+
return getContextName(context) + '.Consumer';
|
624
|
+
|
625
|
+
case REACT_PROVIDER_TYPE:
|
626
|
+
var provider = type;
|
627
|
+
return getContextName(provider._context) + '.Provider';
|
628
|
+
|
629
|
+
case REACT_FORWARD_REF_TYPE:
|
630
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
631
|
+
|
632
|
+
case REACT_MEMO_TYPE:
|
633
|
+
var outerName = type.displayName || null;
|
634
|
+
|
635
|
+
if (outerName !== null) {
|
636
|
+
return outerName;
|
637
|
+
}
|
638
|
+
|
639
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
640
|
+
|
641
|
+
case REACT_LAZY_TYPE:
|
642
|
+
{
|
643
|
+
var lazyComponent = type;
|
644
|
+
var payload = lazyComponent._payload;
|
645
|
+
var init = lazyComponent._init;
|
646
|
+
|
647
|
+
try {
|
648
|
+
return getComponentNameFromType(init(payload));
|
649
|
+
} catch (x) {
|
650
|
+
return null;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
// eslint-disable-next-line no-fallthrough
|
655
|
+
}
|
656
|
+
}
|
657
|
+
|
658
|
+
return null;
|
659
|
+
}
|
660
|
+
|
661
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
662
|
+
|
663
|
+
var RESERVED_PROPS = {
|
664
|
+
key: true,
|
665
|
+
ref: true,
|
666
|
+
__self: true,
|
667
|
+
__source: true
|
668
|
+
};
|
669
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
670
|
+
|
671
|
+
{
|
672
|
+
didWarnAboutStringRefs = {};
|
673
|
+
}
|
674
|
+
|
675
|
+
function hasValidRef(config) {
|
676
|
+
{
|
677
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
678
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
679
|
+
|
680
|
+
if (getter && getter.isReactWarning) {
|
681
|
+
return false;
|
682
|
+
}
|
683
|
+
}
|
684
|
+
}
|
685
|
+
|
686
|
+
return config.ref !== undefined;
|
687
|
+
}
|
688
|
+
|
689
|
+
function hasValidKey(config) {
|
690
|
+
{
|
691
|
+
if (hasOwnProperty.call(config, 'key')) {
|
692
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
693
|
+
|
694
|
+
if (getter && getter.isReactWarning) {
|
695
|
+
return false;
|
696
|
+
}
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
return config.key !== undefined;
|
701
|
+
}
|
702
|
+
|
703
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
704
|
+
var warnAboutAccessingKey = function () {
|
705
|
+
{
|
706
|
+
if (!specialPropKeyWarningShown) {
|
707
|
+
specialPropKeyWarningShown = true;
|
708
|
+
|
709
|
+
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);
|
710
|
+
}
|
711
|
+
}
|
712
|
+
};
|
713
|
+
|
714
|
+
warnAboutAccessingKey.isReactWarning = true;
|
715
|
+
Object.defineProperty(props, 'key', {
|
716
|
+
get: warnAboutAccessingKey,
|
717
|
+
configurable: true
|
718
|
+
});
|
719
|
+
}
|
720
|
+
|
721
|
+
function defineRefPropWarningGetter(props, displayName) {
|
722
|
+
var warnAboutAccessingRef = function () {
|
723
|
+
{
|
724
|
+
if (!specialPropRefWarningShown) {
|
725
|
+
specialPropRefWarningShown = true;
|
726
|
+
|
727
|
+
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);
|
728
|
+
}
|
729
|
+
}
|
730
|
+
};
|
731
|
+
|
732
|
+
warnAboutAccessingRef.isReactWarning = true;
|
733
|
+
Object.defineProperty(props, 'ref', {
|
734
|
+
get: warnAboutAccessingRef,
|
735
|
+
configurable: true
|
736
|
+
});
|
737
|
+
}
|
738
|
+
|
739
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
740
|
+
{
|
741
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
742
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
743
|
+
|
744
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
745
|
+
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);
|
746
|
+
|
747
|
+
didWarnAboutStringRefs[componentName] = true;
|
748
|
+
}
|
749
|
+
}
|
750
|
+
}
|
751
|
+
}
|
752
|
+
/**
|
753
|
+
* Factory method to create a new React element. This no longer adheres to
|
754
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
755
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
756
|
+
* if something is a React Element.
|
757
|
+
*
|
758
|
+
* @param {*} type
|
759
|
+
* @param {*} props
|
760
|
+
* @param {*} key
|
761
|
+
* @param {string|object} ref
|
762
|
+
* @param {*} owner
|
763
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
764
|
+
* different from the `owner` when React.createElement is called, so that we
|
765
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
766
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
767
|
+
* change in behavior.
|
768
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
769
|
+
* indicating filename, line number, and/or other information.
|
770
|
+
* @internal
|
771
|
+
*/
|
772
|
+
|
773
|
+
|
774
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
775
|
+
var element = {
|
776
|
+
// This tag allows us to uniquely identify this as a React Element
|
777
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
778
|
+
// Built-in properties that belong on the element
|
779
|
+
type: type,
|
780
|
+
key: key,
|
781
|
+
ref: ref,
|
782
|
+
props: props,
|
783
|
+
// Record the component responsible for creating this element.
|
784
|
+
_owner: owner
|
785
|
+
};
|
786
|
+
|
787
|
+
{
|
788
|
+
// The validation flag is currently mutative. We put it on
|
789
|
+
// an external backing store so that we can freeze the whole object.
|
790
|
+
// This can be replaced with a WeakMap once they are implemented in
|
791
|
+
// commonly used development environments.
|
792
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
793
|
+
// the validation flag non-enumerable (where possible, which should
|
794
|
+
// include every environment we run tests in), so the test framework
|
795
|
+
// ignores it.
|
796
|
+
|
797
|
+
Object.defineProperty(element._store, 'validated', {
|
798
|
+
configurable: false,
|
799
|
+
enumerable: false,
|
800
|
+
writable: true,
|
801
|
+
value: false
|
802
|
+
}); // self and source are DEV only properties.
|
803
|
+
|
804
|
+
Object.defineProperty(element, '_self', {
|
805
|
+
configurable: false,
|
806
|
+
enumerable: false,
|
807
|
+
writable: false,
|
808
|
+
value: self
|
809
|
+
}); // Two elements created in two different places should be considered
|
810
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
811
|
+
|
812
|
+
Object.defineProperty(element, '_source', {
|
813
|
+
configurable: false,
|
814
|
+
enumerable: false,
|
815
|
+
writable: false,
|
816
|
+
value: source
|
817
|
+
});
|
818
|
+
|
819
|
+
if (Object.freeze) {
|
820
|
+
Object.freeze(element.props);
|
821
|
+
Object.freeze(element);
|
822
|
+
}
|
823
|
+
}
|
824
|
+
|
825
|
+
return element;
|
826
|
+
};
|
827
|
+
/**
|
828
|
+
* Create and return a new ReactElement of the given type.
|
829
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
830
|
+
*/
|
831
|
+
|
832
|
+
function createElement(type, config, children) {
|
833
|
+
var propName; // Reserved names are extracted
|
834
|
+
|
835
|
+
var props = {};
|
836
|
+
var key = null;
|
837
|
+
var ref = null;
|
838
|
+
var self = null;
|
839
|
+
var source = null;
|
840
|
+
|
841
|
+
if (config != null) {
|
842
|
+
if (hasValidRef(config)) {
|
843
|
+
ref = config.ref;
|
844
|
+
|
845
|
+
{
|
846
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
847
|
+
}
|
848
|
+
}
|
849
|
+
|
850
|
+
if (hasValidKey(config)) {
|
851
|
+
{
|
852
|
+
checkKeyStringCoercion(config.key);
|
853
|
+
}
|
854
|
+
|
855
|
+
key = '' + config.key;
|
856
|
+
}
|
857
|
+
|
858
|
+
self = config.__self === undefined ? null : config.__self;
|
859
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
860
|
+
|
861
|
+
for (propName in config) {
|
862
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
863
|
+
props[propName] = config[propName];
|
864
|
+
}
|
865
|
+
}
|
866
|
+
} // Children can be more than one argument, and those are transferred onto
|
867
|
+
// the newly allocated props object.
|
868
|
+
|
869
|
+
|
870
|
+
var childrenLength = arguments.length - 2;
|
871
|
+
|
872
|
+
if (childrenLength === 1) {
|
873
|
+
props.children = children;
|
874
|
+
} else if (childrenLength > 1) {
|
875
|
+
var childArray = Array(childrenLength);
|
876
|
+
|
877
|
+
for (var i = 0; i < childrenLength; i++) {
|
878
|
+
childArray[i] = arguments[i + 2];
|
879
|
+
}
|
880
|
+
|
881
|
+
{
|
882
|
+
if (Object.freeze) {
|
883
|
+
Object.freeze(childArray);
|
884
|
+
}
|
885
|
+
}
|
886
|
+
|
887
|
+
props.children = childArray;
|
888
|
+
} // Resolve default props
|
889
|
+
|
890
|
+
|
891
|
+
if (type && type.defaultProps) {
|
892
|
+
var defaultProps = type.defaultProps;
|
893
|
+
|
894
|
+
for (propName in defaultProps) {
|
895
|
+
if (props[propName] === undefined) {
|
896
|
+
props[propName] = defaultProps[propName];
|
897
|
+
}
|
898
|
+
}
|
899
|
+
}
|
900
|
+
|
901
|
+
{
|
902
|
+
if (key || ref) {
|
903
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
904
|
+
|
905
|
+
if (key) {
|
906
|
+
defineKeyPropWarningGetter(props, displayName);
|
907
|
+
}
|
908
|
+
|
909
|
+
if (ref) {
|
910
|
+
defineRefPropWarningGetter(props, displayName);
|
911
|
+
}
|
912
|
+
}
|
913
|
+
}
|
914
|
+
|
915
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
916
|
+
}
|
917
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
918
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
919
|
+
return newElement;
|
920
|
+
}
|
921
|
+
/**
|
922
|
+
* Clone and return a new ReactElement using element as the starting point.
|
923
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
924
|
+
*/
|
925
|
+
|
926
|
+
function cloneElement(element, config, children) {
|
927
|
+
if (element === null || element === undefined) {
|
928
|
+
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
929
|
+
}
|
930
|
+
|
931
|
+
var propName; // Original props are copied
|
932
|
+
|
933
|
+
var props = assign({}, element.props); // Reserved names are extracted
|
934
|
+
|
935
|
+
var key = element.key;
|
936
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
937
|
+
|
938
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
939
|
+
// transpiler, and the original source is probably a better indicator of the
|
940
|
+
// true owner.
|
941
|
+
|
942
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
943
|
+
|
944
|
+
var owner = element._owner;
|
945
|
+
|
946
|
+
if (config != null) {
|
947
|
+
if (hasValidRef(config)) {
|
948
|
+
// Silently steal the ref from the parent.
|
949
|
+
ref = config.ref;
|
950
|
+
owner = ReactCurrentOwner.current;
|
951
|
+
}
|
952
|
+
|
953
|
+
if (hasValidKey(config)) {
|
954
|
+
{
|
955
|
+
checkKeyStringCoercion(config.key);
|
956
|
+
}
|
957
|
+
|
958
|
+
key = '' + config.key;
|
959
|
+
} // Remaining properties override existing props
|
960
|
+
|
961
|
+
|
962
|
+
var defaultProps;
|
963
|
+
|
964
|
+
if (element.type && element.type.defaultProps) {
|
965
|
+
defaultProps = element.type.defaultProps;
|
966
|
+
}
|
967
|
+
|
968
|
+
for (propName in config) {
|
969
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
970
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
971
|
+
// Resolve default props
|
972
|
+
props[propName] = defaultProps[propName];
|
973
|
+
} else {
|
974
|
+
props[propName] = config[propName];
|
975
|
+
}
|
976
|
+
}
|
977
|
+
}
|
978
|
+
} // Children can be more than one argument, and those are transferred onto
|
979
|
+
// the newly allocated props object.
|
980
|
+
|
981
|
+
|
982
|
+
var childrenLength = arguments.length - 2;
|
983
|
+
|
984
|
+
if (childrenLength === 1) {
|
985
|
+
props.children = children;
|
986
|
+
} else if (childrenLength > 1) {
|
987
|
+
var childArray = Array(childrenLength);
|
988
|
+
|
989
|
+
for (var i = 0; i < childrenLength; i++) {
|
990
|
+
childArray[i] = arguments[i + 2];
|
991
|
+
}
|
992
|
+
|
993
|
+
props.children = childArray;
|
994
|
+
}
|
995
|
+
|
996
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
997
|
+
}
|
998
|
+
/**
|
999
|
+
* Verifies the object is a ReactElement.
|
1000
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
1001
|
+
* @param {?object} object
|
1002
|
+
* @return {boolean} True if `object` is a ReactElement.
|
1003
|
+
* @final
|
1004
|
+
*/
|
1005
|
+
|
1006
|
+
function isValidElement(object) {
|
1007
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
var SEPARATOR = '.';
|
1011
|
+
var SUBSEPARATOR = ':';
|
1012
|
+
/**
|
1013
|
+
* Escape and wrap key so it is safe to use as a reactid
|
1014
|
+
*
|
1015
|
+
* @param {string} key to be escaped.
|
1016
|
+
* @return {string} the escaped key.
|
1017
|
+
*/
|
1018
|
+
|
1019
|
+
function escape(key) {
|
1020
|
+
var escapeRegex = /[=:]/g;
|
1021
|
+
var escaperLookup = {
|
1022
|
+
'=': '=0',
|
1023
|
+
':': '=2'
|
1024
|
+
};
|
1025
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
1026
|
+
return escaperLookup[match];
|
1027
|
+
});
|
1028
|
+
return '$' + escapedString;
|
1029
|
+
}
|
1030
|
+
/**
|
1031
|
+
* TODO: Test that a single child and an array with one item have the same key
|
1032
|
+
* pattern.
|
1033
|
+
*/
|
1034
|
+
|
1035
|
+
|
1036
|
+
var didWarnAboutMaps = false;
|
1037
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
1038
|
+
|
1039
|
+
function escapeUserProvidedKey(text) {
|
1040
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
1041
|
+
}
|
1042
|
+
/**
|
1043
|
+
* Generate a key string that identifies a element within a set.
|
1044
|
+
*
|
1045
|
+
* @param {*} element A element that could contain a manual key.
|
1046
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
1047
|
+
* @return {string}
|
1048
|
+
*/
|
1049
|
+
|
1050
|
+
|
1051
|
+
function getElementKey(element, index) {
|
1052
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
1053
|
+
// that we don't block potential future ES APIs.
|
1054
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
1055
|
+
// Explicit key
|
1056
|
+
{
|
1057
|
+
checkKeyStringCoercion(element.key);
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
return escape('' + element.key);
|
1061
|
+
} // Implicit key determined by the index in the set
|
1062
|
+
|
1063
|
+
|
1064
|
+
return index.toString(36);
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
1068
|
+
var type = typeof children;
|
1069
|
+
|
1070
|
+
if (type === 'undefined' || type === 'boolean') {
|
1071
|
+
// All of the above are perceived as null.
|
1072
|
+
children = null;
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
var invokeCallback = false;
|
1076
|
+
|
1077
|
+
if (children === null) {
|
1078
|
+
invokeCallback = true;
|
1079
|
+
} else {
|
1080
|
+
switch (type) {
|
1081
|
+
case 'string':
|
1082
|
+
case 'number':
|
1083
|
+
invokeCallback = true;
|
1084
|
+
break;
|
1085
|
+
|
1086
|
+
case 'object':
|
1087
|
+
switch (children.$$typeof) {
|
1088
|
+
case REACT_ELEMENT_TYPE:
|
1089
|
+
case REACT_PORTAL_TYPE:
|
1090
|
+
invokeCallback = true;
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
}
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
if (invokeCallback) {
|
1097
|
+
var _child = children;
|
1098
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
1099
|
+
// so that it's consistent if the number of children grows:
|
1100
|
+
|
1101
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
1102
|
+
|
1103
|
+
if (isArray(mappedChild)) {
|
1104
|
+
var escapedChildKey = '';
|
1105
|
+
|
1106
|
+
if (childKey != null) {
|
1107
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
1111
|
+
return c;
|
1112
|
+
});
|
1113
|
+
} else if (mappedChild != null) {
|
1114
|
+
if (isValidElement(mappedChild)) {
|
1115
|
+
{
|
1116
|
+
// The `if` statement here prevents auto-disabling of the safe
|
1117
|
+
// coercion ESLint rule, so we must manually disable it below.
|
1118
|
+
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1119
|
+
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
1120
|
+
checkKeyStringCoercion(mappedChild.key);
|
1121
|
+
}
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1125
|
+
// traverseAllChildren used to do for objects as children
|
1126
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1127
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
1128
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
1129
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
array.push(mappedChild);
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
return 1;
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
var child;
|
1139
|
+
var nextName;
|
1140
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
1141
|
+
|
1142
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1143
|
+
|
1144
|
+
if (isArray(children)) {
|
1145
|
+
for (var i = 0; i < children.length; i++) {
|
1146
|
+
child = children[i];
|
1147
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
1148
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1149
|
+
}
|
1150
|
+
} else {
|
1151
|
+
var iteratorFn = getIteratorFn(children);
|
1152
|
+
|
1153
|
+
if (typeof iteratorFn === 'function') {
|
1154
|
+
var iterableChildren = children;
|
1155
|
+
|
1156
|
+
{
|
1157
|
+
// Warn about using Maps as children
|
1158
|
+
if (iteratorFn === iterableChildren.entries) {
|
1159
|
+
if (!didWarnAboutMaps) {
|
1160
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
didWarnAboutMaps = true;
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
var iterator = iteratorFn.call(iterableChildren);
|
1168
|
+
var step;
|
1169
|
+
var ii = 0;
|
1170
|
+
|
1171
|
+
while (!(step = iterator.next()).done) {
|
1172
|
+
child = step.value;
|
1173
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
1174
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1175
|
+
}
|
1176
|
+
} else if (type === 'object') {
|
1177
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
1178
|
+
var childrenString = String(children);
|
1179
|
+
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.');
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
return subtreeCount;
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
/**
|
1187
|
+
* Maps children that are typically specified as `props.children`.
|
1188
|
+
*
|
1189
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
1190
|
+
*
|
1191
|
+
* The provided mapFunction(child, index) will be called for each
|
1192
|
+
* leaf child.
|
1193
|
+
*
|
1194
|
+
* @param {?*} children Children tree container.
|
1195
|
+
* @param {function(*, int)} func The map function.
|
1196
|
+
* @param {*} context Context for mapFunction.
|
1197
|
+
* @return {object} Object containing the ordered map of results.
|
1198
|
+
*/
|
1199
|
+
function mapChildren(children, func, context) {
|
1200
|
+
if (children == null) {
|
1201
|
+
return children;
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
var result = [];
|
1205
|
+
var count = 0;
|
1206
|
+
mapIntoArray(children, result, '', '', function (child) {
|
1207
|
+
return func.call(context, child, count++);
|
1208
|
+
});
|
1209
|
+
return result;
|
1210
|
+
}
|
1211
|
+
/**
|
1212
|
+
* Count the number of children that are typically specified as
|
1213
|
+
* `props.children`.
|
1214
|
+
*
|
1215
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
1216
|
+
*
|
1217
|
+
* @param {?*} children Children tree container.
|
1218
|
+
* @return {number} The number of children.
|
1219
|
+
*/
|
1220
|
+
|
1221
|
+
|
1222
|
+
function countChildren(children) {
|
1223
|
+
var n = 0;
|
1224
|
+
mapChildren(children, function () {
|
1225
|
+
n++; // Don't return anything
|
1226
|
+
});
|
1227
|
+
return n;
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
/**
|
1231
|
+
* Iterates through children that are typically specified as `props.children`.
|
1232
|
+
*
|
1233
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
1234
|
+
*
|
1235
|
+
* The provided forEachFunc(child, index) will be called for each
|
1236
|
+
* leaf child.
|
1237
|
+
*
|
1238
|
+
* @param {?*} children Children tree container.
|
1239
|
+
* @param {function(*, int)} forEachFunc
|
1240
|
+
* @param {*} forEachContext Context for forEachContext.
|
1241
|
+
*/
|
1242
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
1243
|
+
mapChildren(children, function () {
|
1244
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
1245
|
+
}, forEachContext);
|
1246
|
+
}
|
1247
|
+
/**
|
1248
|
+
* Flatten a children object (typically specified as `props.children`) and
|
1249
|
+
* return an array with appropriately re-keyed children.
|
1250
|
+
*
|
1251
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
1252
|
+
*/
|
1253
|
+
|
1254
|
+
|
1255
|
+
function toArray(children) {
|
1256
|
+
return mapChildren(children, function (child) {
|
1257
|
+
return child;
|
1258
|
+
}) || [];
|
1259
|
+
}
|
1260
|
+
/**
|
1261
|
+
* Returns the first child in a collection of children and verifies that there
|
1262
|
+
* is only one child in the collection.
|
1263
|
+
*
|
1264
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
1265
|
+
*
|
1266
|
+
* The current implementation of this function assumes that a single child gets
|
1267
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
1268
|
+
* abstract away the particular structure of children.
|
1269
|
+
*
|
1270
|
+
* @param {?object} children Child collection structure.
|
1271
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
1272
|
+
* structure.
|
1273
|
+
*/
|
1274
|
+
|
1275
|
+
|
1276
|
+
function onlyChild(children) {
|
1277
|
+
if (!isValidElement(children)) {
|
1278
|
+
throw new Error('React.Children.only expected to receive a single React element child.');
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
return children;
|
1282
|
+
}
|
1283
|
+
|
1284
|
+
function createContext(defaultValue) {
|
1285
|
+
// TODO: Second argument used to be an optional `calculateChangedBits`
|
1286
|
+
// function. Warn to reserve for future use?
|
1287
|
+
var context = {
|
1288
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1289
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
1290
|
+
// some renderers as primary and others as secondary. We only expect
|
1291
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
1292
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
1293
|
+
// Secondary renderers store their context values on separate fields.
|
1294
|
+
_currentValue: defaultValue,
|
1295
|
+
_currentValue2: defaultValue,
|
1296
|
+
// Used to track how many concurrent renderers this context currently
|
1297
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
1298
|
+
_threadCount: 0,
|
1299
|
+
// These are circular
|
1300
|
+
Provider: null,
|
1301
|
+
Consumer: null,
|
1302
|
+
// Add these to use same hidden class in VM as ServerContext
|
1303
|
+
_defaultValue: null,
|
1304
|
+
_globalName: null
|
1305
|
+
};
|
1306
|
+
context.Provider = {
|
1307
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
1308
|
+
_context: context
|
1309
|
+
};
|
1310
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
1311
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
1312
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
1313
|
+
|
1314
|
+
{
|
1315
|
+
// A separate object, but proxies back to the original context object for
|
1316
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
1317
|
+
// warn for the incorrect usage of Context as a Consumer.
|
1318
|
+
var Consumer = {
|
1319
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1320
|
+
_context: context
|
1321
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
1322
|
+
|
1323
|
+
Object.defineProperties(Consumer, {
|
1324
|
+
Provider: {
|
1325
|
+
get: function () {
|
1326
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
1327
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
1328
|
+
|
1329
|
+
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?');
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
return context.Provider;
|
1333
|
+
},
|
1334
|
+
set: function (_Provider) {
|
1335
|
+
context.Provider = _Provider;
|
1336
|
+
}
|
1337
|
+
},
|
1338
|
+
_currentValue: {
|
1339
|
+
get: function () {
|
1340
|
+
return context._currentValue;
|
1341
|
+
},
|
1342
|
+
set: function (_currentValue) {
|
1343
|
+
context._currentValue = _currentValue;
|
1344
|
+
}
|
1345
|
+
},
|
1346
|
+
_currentValue2: {
|
1347
|
+
get: function () {
|
1348
|
+
return context._currentValue2;
|
1349
|
+
},
|
1350
|
+
set: function (_currentValue2) {
|
1351
|
+
context._currentValue2 = _currentValue2;
|
1352
|
+
}
|
1353
|
+
},
|
1354
|
+
_threadCount: {
|
1355
|
+
get: function () {
|
1356
|
+
return context._threadCount;
|
1357
|
+
},
|
1358
|
+
set: function (_threadCount) {
|
1359
|
+
context._threadCount = _threadCount;
|
1360
|
+
}
|
1361
|
+
},
|
1362
|
+
Consumer: {
|
1363
|
+
get: function () {
|
1364
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1365
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
1366
|
+
|
1367
|
+
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?');
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
return context.Consumer;
|
1371
|
+
}
|
1372
|
+
},
|
1373
|
+
displayName: {
|
1374
|
+
get: function () {
|
1375
|
+
return context.displayName;
|
1376
|
+
},
|
1377
|
+
set: function (displayName) {
|
1378
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
1379
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
1380
|
+
|
1381
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
1382
|
+
}
|
1383
|
+
}
|
1384
|
+
}
|
1385
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
1386
|
+
|
1387
|
+
context.Consumer = Consumer;
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
{
|
1391
|
+
context._currentRenderer = null;
|
1392
|
+
context._currentRenderer2 = null;
|
1393
|
+
}
|
1394
|
+
|
1395
|
+
return context;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
var Uninitialized = -1;
|
1399
|
+
var Pending = 0;
|
1400
|
+
var Resolved = 1;
|
1401
|
+
var Rejected = 2;
|
1402
|
+
|
1403
|
+
function lazyInitializer(payload) {
|
1404
|
+
if (payload._status === Uninitialized) {
|
1405
|
+
var ctor = payload._result;
|
1406
|
+
var thenable = ctor(); // Transition to the next state.
|
1407
|
+
// This might throw either because it's missing or throws. If so, we treat it
|
1408
|
+
// as still uninitialized and try again next time. Which is the same as what
|
1409
|
+
// happens if the ctor or any wrappers processing the ctor throws. This might
|
1410
|
+
// end up fixing it if the resolution was a concurrency bug.
|
1411
|
+
|
1412
|
+
thenable.then(function (moduleObject) {
|
1413
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1414
|
+
// Transition to the next state.
|
1415
|
+
var resolved = payload;
|
1416
|
+
resolved._status = Resolved;
|
1417
|
+
resolved._result = moduleObject;
|
1418
|
+
}
|
1419
|
+
}, function (error) {
|
1420
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1421
|
+
// Transition to the next state.
|
1422
|
+
var rejected = payload;
|
1423
|
+
rejected._status = Rejected;
|
1424
|
+
rejected._result = error;
|
1425
|
+
}
|
1426
|
+
});
|
1427
|
+
|
1428
|
+
if (payload._status === Uninitialized) {
|
1429
|
+
// In case, we're still uninitialized, then we're waiting for the thenable
|
1430
|
+
// to resolve. Set it as pending in the meantime.
|
1431
|
+
var pending = payload;
|
1432
|
+
pending._status = Pending;
|
1433
|
+
pending._result = thenable;
|
1434
|
+
}
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
if (payload._status === Resolved) {
|
1438
|
+
var moduleObject = payload._result;
|
1439
|
+
|
1440
|
+
{
|
1441
|
+
if (moduleObject === undefined) {
|
1442
|
+
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.
|
1443
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
1444
|
+
}
|
1445
|
+
}
|
1446
|
+
|
1447
|
+
{
|
1448
|
+
if (!('default' in moduleObject)) {
|
1449
|
+
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.
|
1450
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
1451
|
+
}
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
return moduleObject.default;
|
1455
|
+
} else {
|
1456
|
+
throw payload._result;
|
1457
|
+
}
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
function lazy(ctor) {
|
1461
|
+
var payload = {
|
1462
|
+
// We use these fields to store the result.
|
1463
|
+
_status: Uninitialized,
|
1464
|
+
_result: ctor
|
1465
|
+
};
|
1466
|
+
var lazyType = {
|
1467
|
+
$$typeof: REACT_LAZY_TYPE,
|
1468
|
+
_payload: payload,
|
1469
|
+
_init: lazyInitializer
|
1470
|
+
};
|
1471
|
+
|
1472
|
+
{
|
1473
|
+
// In production, this would just set it on the object.
|
1474
|
+
var defaultProps;
|
1475
|
+
var propTypes; // $FlowFixMe
|
1476
|
+
|
1477
|
+
Object.defineProperties(lazyType, {
|
1478
|
+
defaultProps: {
|
1479
|
+
configurable: true,
|
1480
|
+
get: function () {
|
1481
|
+
return defaultProps;
|
1482
|
+
},
|
1483
|
+
set: function (newDefaultProps) {
|
1484
|
+
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.');
|
1485
|
+
|
1486
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
1487
|
+
// $FlowFixMe
|
1488
|
+
|
1489
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
1490
|
+
enumerable: true
|
1491
|
+
});
|
1492
|
+
}
|
1493
|
+
},
|
1494
|
+
propTypes: {
|
1495
|
+
configurable: true,
|
1496
|
+
get: function () {
|
1497
|
+
return propTypes;
|
1498
|
+
},
|
1499
|
+
set: function (newPropTypes) {
|
1500
|
+
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.');
|
1501
|
+
|
1502
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
1503
|
+
// $FlowFixMe
|
1504
|
+
|
1505
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
1506
|
+
enumerable: true
|
1507
|
+
});
|
1508
|
+
}
|
1509
|
+
}
|
1510
|
+
});
|
1511
|
+
}
|
1512
|
+
|
1513
|
+
return lazyType;
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
function forwardRef(render) {
|
1517
|
+
{
|
1518
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1519
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1520
|
+
} else if (typeof render !== 'function') {
|
1521
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1522
|
+
} else {
|
1523
|
+
if (render.length !== 0 && render.length !== 2) {
|
1524
|
+
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.');
|
1525
|
+
}
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
if (render != null) {
|
1529
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
1530
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
1531
|
+
}
|
1532
|
+
}
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
var elementType = {
|
1536
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
1537
|
+
render: render
|
1538
|
+
};
|
1539
|
+
|
1540
|
+
{
|
1541
|
+
var ownName;
|
1542
|
+
Object.defineProperty(elementType, 'displayName', {
|
1543
|
+
enumerable: false,
|
1544
|
+
configurable: true,
|
1545
|
+
get: function () {
|
1546
|
+
return ownName;
|
1547
|
+
},
|
1548
|
+
set: function (name) {
|
1549
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
1550
|
+
// because the component may be used elsewhere.
|
1551
|
+
// But it's nice for anonymous functions to inherit the name,
|
1552
|
+
// so that our component-stack generation logic will display their frames.
|
1553
|
+
// An anonymous function generally suggests a pattern like:
|
1554
|
+
// React.forwardRef((props, ref) => {...});
|
1555
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1556
|
+
|
1557
|
+
if (!render.name && !render.displayName) {
|
1558
|
+
render.displayName = name;
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
});
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
return elementType;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
var REACT_MODULE_REFERENCE;
|
1568
|
+
|
1569
|
+
{
|
1570
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
function isValidElementType(type) {
|
1574
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
1575
|
+
return true;
|
1576
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
1577
|
+
|
1578
|
+
|
1579
|
+
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 ) {
|
1580
|
+
return true;
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
if (typeof type === 'object' && type !== null) {
|
1584
|
+
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
|
1585
|
+
// types supported by any Flight configuration anywhere since
|
1586
|
+
// we don't know which Flight build this will end up being used
|
1587
|
+
// with.
|
1588
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
1589
|
+
return true;
|
1590
|
+
}
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
return false;
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
function memo(type, compare) {
|
1597
|
+
{
|
1598
|
+
if (!isValidElementType(type)) {
|
1599
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1600
|
+
}
|
1601
|
+
}
|
1602
|
+
|
1603
|
+
var elementType = {
|
1604
|
+
$$typeof: REACT_MEMO_TYPE,
|
1605
|
+
type: type,
|
1606
|
+
compare: compare === undefined ? null : compare
|
1607
|
+
};
|
1608
|
+
|
1609
|
+
{
|
1610
|
+
var ownName;
|
1611
|
+
Object.defineProperty(elementType, 'displayName', {
|
1612
|
+
enumerable: false,
|
1613
|
+
configurable: true,
|
1614
|
+
get: function () {
|
1615
|
+
return ownName;
|
1616
|
+
},
|
1617
|
+
set: function (name) {
|
1618
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
1619
|
+
// because the component may be used elsewhere.
|
1620
|
+
// But it's nice for anonymous functions to inherit the name,
|
1621
|
+
// so that our component-stack generation logic will display their frames.
|
1622
|
+
// An anonymous function generally suggests a pattern like:
|
1623
|
+
// React.memo((props) => {...});
|
1624
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
1625
|
+
|
1626
|
+
if (!type.name && !type.displayName) {
|
1627
|
+
type.displayName = name;
|
1628
|
+
}
|
1629
|
+
}
|
1630
|
+
});
|
1631
|
+
}
|
1632
|
+
|
1633
|
+
return elementType;
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
function resolveDispatcher() {
|
1637
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
1638
|
+
|
1639
|
+
{
|
1640
|
+
if (dispatcher === null) {
|
1641
|
+
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.');
|
1642
|
+
}
|
1643
|
+
} // Will result in a null access error if accessed outside render phase. We
|
1644
|
+
// intentionally don't throw our own error because this is in a hot path.
|
1645
|
+
// Also helps ensure this is inlined.
|
1646
|
+
|
1647
|
+
|
1648
|
+
return dispatcher;
|
1649
|
+
}
|
1650
|
+
function useContext(Context) {
|
1651
|
+
var dispatcher = resolveDispatcher();
|
1652
|
+
|
1653
|
+
{
|
1654
|
+
// TODO: add a more generic warning for invalid values.
|
1655
|
+
if (Context._context !== undefined) {
|
1656
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
1657
|
+
// and nobody should be using this in existing code.
|
1658
|
+
|
1659
|
+
if (realContext.Consumer === Context) {
|
1660
|
+
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?');
|
1661
|
+
} else if (realContext.Provider === Context) {
|
1662
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
return dispatcher.useContext(Context);
|
1668
|
+
}
|
1669
|
+
function useState(initialState) {
|
1670
|
+
var dispatcher = resolveDispatcher();
|
1671
|
+
return dispatcher.useState(initialState);
|
1672
|
+
}
|
1673
|
+
function useReducer(reducer, initialArg, init) {
|
1674
|
+
var dispatcher = resolveDispatcher();
|
1675
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
1676
|
+
}
|
1677
|
+
function useRef(initialValue) {
|
1678
|
+
var dispatcher = resolveDispatcher();
|
1679
|
+
return dispatcher.useRef(initialValue);
|
1680
|
+
}
|
1681
|
+
function useEffect(create, deps) {
|
1682
|
+
var dispatcher = resolveDispatcher();
|
1683
|
+
return dispatcher.useEffect(create, deps);
|
1684
|
+
}
|
1685
|
+
function useInsertionEffect(create, deps) {
|
1686
|
+
var dispatcher = resolveDispatcher();
|
1687
|
+
return dispatcher.useInsertionEffect(create, deps);
|
1688
|
+
}
|
1689
|
+
function useLayoutEffect(create, deps) {
|
1690
|
+
var dispatcher = resolveDispatcher();
|
1691
|
+
return dispatcher.useLayoutEffect(create, deps);
|
1692
|
+
}
|
1693
|
+
function useCallback(callback, deps) {
|
1694
|
+
var dispatcher = resolveDispatcher();
|
1695
|
+
return dispatcher.useCallback(callback, deps);
|
1696
|
+
}
|
1697
|
+
function useMemo(create, deps) {
|
1698
|
+
var dispatcher = resolveDispatcher();
|
1699
|
+
return dispatcher.useMemo(create, deps);
|
1700
|
+
}
|
1701
|
+
function useImperativeHandle(ref, create, deps) {
|
1702
|
+
var dispatcher = resolveDispatcher();
|
1703
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
1704
|
+
}
|
1705
|
+
function useDebugValue(value, formatterFn) {
|
1706
|
+
{
|
1707
|
+
var dispatcher = resolveDispatcher();
|
1708
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
function useTransition() {
|
1712
|
+
var dispatcher = resolveDispatcher();
|
1713
|
+
return dispatcher.useTransition();
|
1714
|
+
}
|
1715
|
+
function useDeferredValue(value) {
|
1716
|
+
var dispatcher = resolveDispatcher();
|
1717
|
+
return dispatcher.useDeferredValue(value);
|
1718
|
+
}
|
1719
|
+
function useId() {
|
1720
|
+
var dispatcher = resolveDispatcher();
|
1721
|
+
return dispatcher.useId();
|
1722
|
+
}
|
1723
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
1724
|
+
var dispatcher = resolveDispatcher();
|
1725
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
1729
|
+
// replaying on render function. This currently only patches the object
|
1730
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
1731
|
+
// We could also eagerly patch the method.
|
1732
|
+
var disabledDepth = 0;
|
1733
|
+
var prevLog;
|
1734
|
+
var prevInfo;
|
1735
|
+
var prevWarn;
|
1736
|
+
var prevError;
|
1737
|
+
var prevGroup;
|
1738
|
+
var prevGroupCollapsed;
|
1739
|
+
var prevGroupEnd;
|
1740
|
+
|
1741
|
+
function disabledLog() {}
|
1742
|
+
|
1743
|
+
disabledLog.__reactDisabledLog = true;
|
1744
|
+
function disableLogs() {
|
1745
|
+
{
|
1746
|
+
if (disabledDepth === 0) {
|
1747
|
+
/* eslint-disable react-internal/no-production-logging */
|
1748
|
+
prevLog = console.log;
|
1749
|
+
prevInfo = console.info;
|
1750
|
+
prevWarn = console.warn;
|
1751
|
+
prevError = console.error;
|
1752
|
+
prevGroup = console.group;
|
1753
|
+
prevGroupCollapsed = console.groupCollapsed;
|
1754
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
1755
|
+
|
1756
|
+
var props = {
|
1757
|
+
configurable: true,
|
1758
|
+
enumerable: true,
|
1759
|
+
value: disabledLog,
|
1760
|
+
writable: true
|
1761
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
1762
|
+
|
1763
|
+
Object.defineProperties(console, {
|
1764
|
+
info: props,
|
1765
|
+
log: props,
|
1766
|
+
warn: props,
|
1767
|
+
error: props,
|
1768
|
+
group: props,
|
1769
|
+
groupCollapsed: props,
|
1770
|
+
groupEnd: props
|
1771
|
+
});
|
1772
|
+
/* eslint-enable react-internal/no-production-logging */
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
disabledDepth++;
|
1776
|
+
}
|
1777
|
+
}
|
1778
|
+
function reenableLogs() {
|
1779
|
+
{
|
1780
|
+
disabledDepth--;
|
1781
|
+
|
1782
|
+
if (disabledDepth === 0) {
|
1783
|
+
/* eslint-disable react-internal/no-production-logging */
|
1784
|
+
var props = {
|
1785
|
+
configurable: true,
|
1786
|
+
enumerable: true,
|
1787
|
+
writable: true
|
1788
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
1789
|
+
|
1790
|
+
Object.defineProperties(console, {
|
1791
|
+
log: assign({}, props, {
|
1792
|
+
value: prevLog
|
1793
|
+
}),
|
1794
|
+
info: assign({}, props, {
|
1795
|
+
value: prevInfo
|
1796
|
+
}),
|
1797
|
+
warn: assign({}, props, {
|
1798
|
+
value: prevWarn
|
1799
|
+
}),
|
1800
|
+
error: assign({}, props, {
|
1801
|
+
value: prevError
|
1802
|
+
}),
|
1803
|
+
group: assign({}, props, {
|
1804
|
+
value: prevGroup
|
1805
|
+
}),
|
1806
|
+
groupCollapsed: assign({}, props, {
|
1807
|
+
value: prevGroupCollapsed
|
1808
|
+
}),
|
1809
|
+
groupEnd: assign({}, props, {
|
1810
|
+
value: prevGroupEnd
|
1811
|
+
})
|
1812
|
+
});
|
1813
|
+
/* eslint-enable react-internal/no-production-logging */
|
1814
|
+
}
|
1815
|
+
|
1816
|
+
if (disabledDepth < 0) {
|
1817
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
1818
|
+
}
|
1819
|
+
}
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
1823
|
+
var prefix;
|
1824
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
1825
|
+
{
|
1826
|
+
if (prefix === undefined) {
|
1827
|
+
// Extract the VM specific prefix used by each line.
|
1828
|
+
try {
|
1829
|
+
throw Error();
|
1830
|
+
} catch (x) {
|
1831
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
1832
|
+
prefix = match && match[1] || '';
|
1833
|
+
}
|
1834
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
1835
|
+
|
1836
|
+
|
1837
|
+
return '\n' + prefix + name;
|
1838
|
+
}
|
1839
|
+
}
|
1840
|
+
var reentry = false;
|
1841
|
+
var componentFrameCache;
|
1842
|
+
|
1843
|
+
{
|
1844
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
1845
|
+
componentFrameCache = new PossiblyWeakMap();
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
function describeNativeComponentFrame(fn, construct) {
|
1849
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
1850
|
+
if ( !fn || reentry) {
|
1851
|
+
return '';
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
{
|
1855
|
+
var frame = componentFrameCache.get(fn);
|
1856
|
+
|
1857
|
+
if (frame !== undefined) {
|
1858
|
+
return frame;
|
1859
|
+
}
|
1860
|
+
}
|
1861
|
+
|
1862
|
+
var control;
|
1863
|
+
reentry = true;
|
1864
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
1865
|
+
|
1866
|
+
Error.prepareStackTrace = undefined;
|
1867
|
+
var previousDispatcher;
|
1868
|
+
|
1869
|
+
{
|
1870
|
+
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
1871
|
+
// for warnings.
|
1872
|
+
|
1873
|
+
ReactCurrentDispatcher$1.current = null;
|
1874
|
+
disableLogs();
|
1875
|
+
}
|
1876
|
+
|
1877
|
+
try {
|
1878
|
+
// This should throw.
|
1879
|
+
if (construct) {
|
1880
|
+
// Something should be setting the props in the constructor.
|
1881
|
+
var Fake = function () {
|
1882
|
+
throw Error();
|
1883
|
+
}; // $FlowFixMe
|
1884
|
+
|
1885
|
+
|
1886
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
1887
|
+
set: function () {
|
1888
|
+
// We use a throwing setter instead of frozen or non-writable props
|
1889
|
+
// because that won't throw in a non-strict mode function.
|
1890
|
+
throw Error();
|
1891
|
+
}
|
1892
|
+
});
|
1893
|
+
|
1894
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
1895
|
+
// We construct a different control for this case to include any extra
|
1896
|
+
// frames added by the construct call.
|
1897
|
+
try {
|
1898
|
+
Reflect.construct(Fake, []);
|
1899
|
+
} catch (x) {
|
1900
|
+
control = x;
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
Reflect.construct(fn, [], Fake);
|
1904
|
+
} else {
|
1905
|
+
try {
|
1906
|
+
Fake.call();
|
1907
|
+
} catch (x) {
|
1908
|
+
control = x;
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
fn.call(Fake.prototype);
|
1912
|
+
}
|
1913
|
+
} else {
|
1914
|
+
try {
|
1915
|
+
throw Error();
|
1916
|
+
} catch (x) {
|
1917
|
+
control = x;
|
1918
|
+
}
|
1919
|
+
|
1920
|
+
fn();
|
1921
|
+
}
|
1922
|
+
} catch (sample) {
|
1923
|
+
// This is inlined manually because closure doesn't do it for us.
|
1924
|
+
if (sample && control && typeof sample.stack === 'string') {
|
1925
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
1926
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
1927
|
+
var sampleLines = sample.stack.split('\n');
|
1928
|
+
var controlLines = control.stack.split('\n');
|
1929
|
+
var s = sampleLines.length - 1;
|
1930
|
+
var c = controlLines.length - 1;
|
1931
|
+
|
1932
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
1933
|
+
// We expect at least one stack frame to be shared.
|
1934
|
+
// Typically this will be the root most one. However, stack frames may be
|
1935
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
1936
|
+
// earlier than the other. We assume that the sample is longer or the same
|
1937
|
+
// and there for cut off earlier. So we should find the root most frame in
|
1938
|
+
// the sample somewhere in the control.
|
1939
|
+
c--;
|
1940
|
+
}
|
1941
|
+
|
1942
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
1943
|
+
// Next we find the first one that isn't the same which should be the
|
1944
|
+
// frame that called our sample function and the control.
|
1945
|
+
if (sampleLines[s] !== controlLines[c]) {
|
1946
|
+
// In V8, the first line is describing the message but other VMs don't.
|
1947
|
+
// If we're about to return the first line, and the control is also on the same
|
1948
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
1949
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
1950
|
+
// This can happen if you passed a class to function component, or non-function.
|
1951
|
+
if (s !== 1 || c !== 1) {
|
1952
|
+
do {
|
1953
|
+
s--;
|
1954
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
1955
|
+
// The next one that isn't the same should be our match though.
|
1956
|
+
|
1957
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
1958
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
1959
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
1960
|
+
// but we have a user-provided "displayName"
|
1961
|
+
// splice it in to make the stack more readable.
|
1962
|
+
|
1963
|
+
|
1964
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
1965
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
1966
|
+
}
|
1967
|
+
|
1968
|
+
{
|
1969
|
+
if (typeof fn === 'function') {
|
1970
|
+
componentFrameCache.set(fn, _frame);
|
1971
|
+
}
|
1972
|
+
} // Return the line we found.
|
1973
|
+
|
1974
|
+
|
1975
|
+
return _frame;
|
1976
|
+
}
|
1977
|
+
} while (s >= 1 && c >= 0);
|
1978
|
+
}
|
1979
|
+
|
1980
|
+
break;
|
1981
|
+
}
|
1982
|
+
}
|
1983
|
+
}
|
1984
|
+
} finally {
|
1985
|
+
reentry = false;
|
1986
|
+
|
1987
|
+
{
|
1988
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
1989
|
+
reenableLogs();
|
1990
|
+
}
|
1991
|
+
|
1992
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
1993
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
1994
|
+
|
1995
|
+
|
1996
|
+
var name = fn ? fn.displayName || fn.name : '';
|
1997
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
1998
|
+
|
1999
|
+
{
|
2000
|
+
if (typeof fn === 'function') {
|
2001
|
+
componentFrameCache.set(fn, syntheticFrame);
|
2002
|
+
}
|
2003
|
+
}
|
2004
|
+
|
2005
|
+
return syntheticFrame;
|
2006
|
+
}
|
2007
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
2008
|
+
{
|
2009
|
+
return describeNativeComponentFrame(fn, false);
|
2010
|
+
}
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
function shouldConstruct(Component) {
|
2014
|
+
var prototype = Component.prototype;
|
2015
|
+
return !!(prototype && prototype.isReactComponent);
|
2016
|
+
}
|
2017
|
+
|
2018
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
2019
|
+
|
2020
|
+
if (type == null) {
|
2021
|
+
return '';
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
if (typeof type === 'function') {
|
2025
|
+
{
|
2026
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
2027
|
+
}
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
if (typeof type === 'string') {
|
2031
|
+
return describeBuiltInComponentFrame(type);
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
switch (type) {
|
2035
|
+
case REACT_SUSPENSE_TYPE:
|
2036
|
+
return describeBuiltInComponentFrame('Suspense');
|
2037
|
+
|
2038
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
2039
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
2040
|
+
}
|
2041
|
+
|
2042
|
+
if (typeof type === 'object') {
|
2043
|
+
switch (type.$$typeof) {
|
2044
|
+
case REACT_FORWARD_REF_TYPE:
|
2045
|
+
return describeFunctionComponentFrame(type.render);
|
2046
|
+
|
2047
|
+
case REACT_MEMO_TYPE:
|
2048
|
+
// Memo may contain any component type so we recursively resolve it.
|
2049
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
2050
|
+
|
2051
|
+
case REACT_LAZY_TYPE:
|
2052
|
+
{
|
2053
|
+
var lazyComponent = type;
|
2054
|
+
var payload = lazyComponent._payload;
|
2055
|
+
var init = lazyComponent._init;
|
2056
|
+
|
2057
|
+
try {
|
2058
|
+
// Lazy may contain any component type so we recursively resolve it.
|
2059
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
2060
|
+
} catch (x) {}
|
2061
|
+
}
|
2062
|
+
}
|
2063
|
+
}
|
2064
|
+
|
2065
|
+
return '';
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
var loggedTypeFailures = {};
|
2069
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2070
|
+
|
2071
|
+
function setCurrentlyValidatingElement(element) {
|
2072
|
+
{
|
2073
|
+
if (element) {
|
2074
|
+
var owner = element._owner;
|
2075
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2076
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
2077
|
+
} else {
|
2078
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
}
|
2082
|
+
|
2083
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
2084
|
+
{
|
2085
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
2086
|
+
var has = Function.call.bind(hasOwnProperty);
|
2087
|
+
|
2088
|
+
for (var typeSpecName in typeSpecs) {
|
2089
|
+
if (has(typeSpecs, typeSpecName)) {
|
2090
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
2091
|
+
// fail the render phase where it didn't fail before. So we log it.
|
2092
|
+
// After these have been cleaned up, we'll let them throw.
|
2093
|
+
|
2094
|
+
try {
|
2095
|
+
// This is intentionally an invariant that gets caught. It's the same
|
2096
|
+
// behavior as without this statement except with a better message.
|
2097
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2098
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
2099
|
+
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`.');
|
2100
|
+
err.name = 'Invariant Violation';
|
2101
|
+
throw err;
|
2102
|
+
}
|
2103
|
+
|
2104
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
2105
|
+
} catch (ex) {
|
2106
|
+
error$1 = ex;
|
2107
|
+
}
|
2108
|
+
|
2109
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
2110
|
+
setCurrentlyValidatingElement(element);
|
2111
|
+
|
2112
|
+
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);
|
2113
|
+
|
2114
|
+
setCurrentlyValidatingElement(null);
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
2118
|
+
// Only monitor this failure once because there tends to be a lot of the
|
2119
|
+
// same error.
|
2120
|
+
loggedTypeFailures[error$1.message] = true;
|
2121
|
+
setCurrentlyValidatingElement(element);
|
2122
|
+
|
2123
|
+
error('Failed %s type: %s', location, error$1.message);
|
2124
|
+
|
2125
|
+
setCurrentlyValidatingElement(null);
|
2126
|
+
}
|
2127
|
+
}
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
}
|
2131
|
+
|
2132
|
+
function setCurrentlyValidatingElement$1(element) {
|
2133
|
+
{
|
2134
|
+
if (element) {
|
2135
|
+
var owner = element._owner;
|
2136
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2137
|
+
setExtraStackFrame(stack);
|
2138
|
+
} else {
|
2139
|
+
setExtraStackFrame(null);
|
2140
|
+
}
|
2141
|
+
}
|
2142
|
+
}
|
2143
|
+
|
2144
|
+
var propTypesMisspellWarningShown;
|
2145
|
+
|
2146
|
+
{
|
2147
|
+
propTypesMisspellWarningShown = false;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
function getDeclarationErrorAddendum() {
|
2151
|
+
if (ReactCurrentOwner.current) {
|
2152
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
2153
|
+
|
2154
|
+
if (name) {
|
2155
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
2156
|
+
}
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
return '';
|
2160
|
+
}
|
2161
|
+
|
2162
|
+
function getSourceInfoErrorAddendum(source) {
|
2163
|
+
if (source !== undefined) {
|
2164
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2165
|
+
var lineNumber = source.lineNumber;
|
2166
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2167
|
+
}
|
2168
|
+
|
2169
|
+
return '';
|
2170
|
+
}
|
2171
|
+
|
2172
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
2173
|
+
if (elementProps !== null && elementProps !== undefined) {
|
2174
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
2175
|
+
}
|
2176
|
+
|
2177
|
+
return '';
|
2178
|
+
}
|
2179
|
+
/**
|
2180
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
2181
|
+
* object keys are not valid. This allows us to keep track of children between
|
2182
|
+
* updates.
|
2183
|
+
*/
|
2184
|
+
|
2185
|
+
|
2186
|
+
var ownerHasKeyUseWarning = {};
|
2187
|
+
|
2188
|
+
function getCurrentComponentErrorInfo(parentType) {
|
2189
|
+
var info = getDeclarationErrorAddendum();
|
2190
|
+
|
2191
|
+
if (!info) {
|
2192
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2193
|
+
|
2194
|
+
if (parentName) {
|
2195
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
2196
|
+
}
|
2197
|
+
}
|
2198
|
+
|
2199
|
+
return info;
|
2200
|
+
}
|
2201
|
+
/**
|
2202
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
2203
|
+
* This element is in an array. The array could grow and shrink or be
|
2204
|
+
* reordered. All children that haven't already been validated are required to
|
2205
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
2206
|
+
* will only be shown once.
|
2207
|
+
*
|
2208
|
+
* @internal
|
2209
|
+
* @param {ReactElement} element Element that requires a key.
|
2210
|
+
* @param {*} parentType element's parent's type.
|
2211
|
+
*/
|
2212
|
+
|
2213
|
+
|
2214
|
+
function validateExplicitKey(element, parentType) {
|
2215
|
+
if (!element._store || element._store.validated || element.key != null) {
|
2216
|
+
return;
|
2217
|
+
}
|
2218
|
+
|
2219
|
+
element._store.validated = true;
|
2220
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2221
|
+
|
2222
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2223
|
+
return;
|
2224
|
+
}
|
2225
|
+
|
2226
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
2227
|
+
// property, it may be the creator of the child that's responsible for
|
2228
|
+
// assigning it a key.
|
2229
|
+
|
2230
|
+
var childOwner = '';
|
2231
|
+
|
2232
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2233
|
+
// Give the component that originally created this child.
|
2234
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
2235
|
+
}
|
2236
|
+
|
2237
|
+
{
|
2238
|
+
setCurrentlyValidatingElement$1(element);
|
2239
|
+
|
2240
|
+
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);
|
2241
|
+
|
2242
|
+
setCurrentlyValidatingElement$1(null);
|
2243
|
+
}
|
2244
|
+
}
|
2245
|
+
/**
|
2246
|
+
* Ensure that every element either is passed in a static location, in an
|
2247
|
+
* array with an explicit keys property defined, or in an object literal
|
2248
|
+
* with valid key property.
|
2249
|
+
*
|
2250
|
+
* @internal
|
2251
|
+
* @param {ReactNode} node Statically passed child of any type.
|
2252
|
+
* @param {*} parentType node's parent's type.
|
2253
|
+
*/
|
2254
|
+
|
2255
|
+
|
2256
|
+
function validateChildKeys(node, parentType) {
|
2257
|
+
if (typeof node !== 'object') {
|
2258
|
+
return;
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
if (isArray(node)) {
|
2262
|
+
for (var i = 0; i < node.length; i++) {
|
2263
|
+
var child = node[i];
|
2264
|
+
|
2265
|
+
if (isValidElement(child)) {
|
2266
|
+
validateExplicitKey(child, parentType);
|
2267
|
+
}
|
2268
|
+
}
|
2269
|
+
} else if (isValidElement(node)) {
|
2270
|
+
// This element was passed in a valid location.
|
2271
|
+
if (node._store) {
|
2272
|
+
node._store.validated = true;
|
2273
|
+
}
|
2274
|
+
} else if (node) {
|
2275
|
+
var iteratorFn = getIteratorFn(node);
|
2276
|
+
|
2277
|
+
if (typeof iteratorFn === 'function') {
|
2278
|
+
// Entry iterators used to provide implicit keys,
|
2279
|
+
// but now we print a separate warning for them later.
|
2280
|
+
if (iteratorFn !== node.entries) {
|
2281
|
+
var iterator = iteratorFn.call(node);
|
2282
|
+
var step;
|
2283
|
+
|
2284
|
+
while (!(step = iterator.next()).done) {
|
2285
|
+
if (isValidElement(step.value)) {
|
2286
|
+
validateExplicitKey(step.value, parentType);
|
2287
|
+
}
|
2288
|
+
}
|
2289
|
+
}
|
2290
|
+
}
|
2291
|
+
}
|
2292
|
+
}
|
2293
|
+
/**
|
2294
|
+
* Given an element, validate that its props follow the propTypes definition,
|
2295
|
+
* provided by the type.
|
2296
|
+
*
|
2297
|
+
* @param {ReactElement} element
|
2298
|
+
*/
|
2299
|
+
|
2300
|
+
|
2301
|
+
function validatePropTypes(element) {
|
2302
|
+
{
|
2303
|
+
var type = element.type;
|
2304
|
+
|
2305
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
2306
|
+
return;
|
2307
|
+
}
|
2308
|
+
|
2309
|
+
var propTypes;
|
2310
|
+
|
2311
|
+
if (typeof type === 'function') {
|
2312
|
+
propTypes = type.propTypes;
|
2313
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
2314
|
+
// Inner props are checked in the reconciler.
|
2315
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
2316
|
+
propTypes = type.propTypes;
|
2317
|
+
} else {
|
2318
|
+
return;
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
if (propTypes) {
|
2322
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
2323
|
+
var name = getComponentNameFromType(type);
|
2324
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
2325
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2326
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
2327
|
+
|
2328
|
+
var _name = getComponentNameFromType(type);
|
2329
|
+
|
2330
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
2331
|
+
}
|
2332
|
+
|
2333
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
2334
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
2335
|
+
}
|
2336
|
+
}
|
2337
|
+
}
|
2338
|
+
/**
|
2339
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
2340
|
+
* @param {ReactElement} fragment
|
2341
|
+
*/
|
2342
|
+
|
2343
|
+
|
2344
|
+
function validateFragmentProps(fragment) {
|
2345
|
+
{
|
2346
|
+
var keys = Object.keys(fragment.props);
|
2347
|
+
|
2348
|
+
for (var i = 0; i < keys.length; i++) {
|
2349
|
+
var key = keys[i];
|
2350
|
+
|
2351
|
+
if (key !== 'children' && key !== 'key') {
|
2352
|
+
setCurrentlyValidatingElement$1(fragment);
|
2353
|
+
|
2354
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2355
|
+
|
2356
|
+
setCurrentlyValidatingElement$1(null);
|
2357
|
+
break;
|
2358
|
+
}
|
2359
|
+
}
|
2360
|
+
|
2361
|
+
if (fragment.ref !== null) {
|
2362
|
+
setCurrentlyValidatingElement$1(fragment);
|
2363
|
+
|
2364
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
2365
|
+
|
2366
|
+
setCurrentlyValidatingElement$1(null);
|
2367
|
+
}
|
2368
|
+
}
|
2369
|
+
}
|
2370
|
+
function createElementWithValidation(type, props, children) {
|
2371
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
2372
|
+
// succeed and there will likely be errors in render.
|
2373
|
+
|
2374
|
+
if (!validType) {
|
2375
|
+
var info = '';
|
2376
|
+
|
2377
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2378
|
+
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.";
|
2379
|
+
}
|
2380
|
+
|
2381
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
2382
|
+
|
2383
|
+
if (sourceInfo) {
|
2384
|
+
info += sourceInfo;
|
2385
|
+
} else {
|
2386
|
+
info += getDeclarationErrorAddendum();
|
2387
|
+
}
|
2388
|
+
|
2389
|
+
var typeString;
|
2390
|
+
|
2391
|
+
if (type === null) {
|
2392
|
+
typeString = 'null';
|
2393
|
+
} else if (isArray(type)) {
|
2394
|
+
typeString = 'array';
|
2395
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2396
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
2397
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
2398
|
+
} else {
|
2399
|
+
typeString = typeof type;
|
2400
|
+
}
|
2401
|
+
|
2402
|
+
{
|
2403
|
+
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);
|
2404
|
+
}
|
2405
|
+
}
|
2406
|
+
|
2407
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
2408
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
2409
|
+
|
2410
|
+
if (element == null) {
|
2411
|
+
return element;
|
2412
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
2413
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
2414
|
+
// We don't want exception behavior to differ between dev and prod.
|
2415
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
2416
|
+
// fixed, the key warnings will appear.)
|
2417
|
+
|
2418
|
+
|
2419
|
+
if (validType) {
|
2420
|
+
for (var i = 2; i < arguments.length; i++) {
|
2421
|
+
validateChildKeys(arguments[i], type);
|
2422
|
+
}
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
2426
|
+
validateFragmentProps(element);
|
2427
|
+
} else {
|
2428
|
+
validatePropTypes(element);
|
2429
|
+
}
|
2430
|
+
|
2431
|
+
return element;
|
2432
|
+
}
|
2433
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
2434
|
+
function createFactoryWithValidation(type) {
|
2435
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
2436
|
+
validatedFactory.type = type;
|
2437
|
+
|
2438
|
+
{
|
2439
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
2440
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
2441
|
+
|
2442
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
2443
|
+
} // Legacy hook: remove it
|
2444
|
+
|
2445
|
+
|
2446
|
+
Object.defineProperty(validatedFactory, 'type', {
|
2447
|
+
enumerable: false,
|
2448
|
+
get: function () {
|
2449
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2450
|
+
|
2451
|
+
Object.defineProperty(this, 'type', {
|
2452
|
+
value: type
|
2453
|
+
});
|
2454
|
+
return type;
|
2455
|
+
}
|
2456
|
+
});
|
2457
|
+
}
|
2458
|
+
|
2459
|
+
return validatedFactory;
|
2460
|
+
}
|
2461
|
+
function cloneElementWithValidation(element, props, children) {
|
2462
|
+
var newElement = cloneElement.apply(this, arguments);
|
2463
|
+
|
2464
|
+
for (var i = 2; i < arguments.length; i++) {
|
2465
|
+
validateChildKeys(arguments[i], newElement.type);
|
2466
|
+
}
|
2467
|
+
|
2468
|
+
validatePropTypes(newElement);
|
2469
|
+
return newElement;
|
2470
|
+
}
|
2471
|
+
|
2472
|
+
function startTransition(scope, options) {
|
2473
|
+
var prevTransition = ReactCurrentBatchConfig.transition;
|
2474
|
+
ReactCurrentBatchConfig.transition = {};
|
2475
|
+
var currentTransition = ReactCurrentBatchConfig.transition;
|
2476
|
+
|
2477
|
+
{
|
2478
|
+
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
2479
|
+
}
|
2480
|
+
|
2481
|
+
try {
|
2482
|
+
scope();
|
2483
|
+
} finally {
|
2484
|
+
ReactCurrentBatchConfig.transition = prevTransition;
|
2485
|
+
|
2486
|
+
{
|
2487
|
+
if (prevTransition === null && currentTransition._updatedFibers) {
|
2488
|
+
var updatedFibersCount = currentTransition._updatedFibers.size;
|
2489
|
+
|
2490
|
+
if (updatedFibersCount > 10) {
|
2491
|
+
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.');
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
currentTransition._updatedFibers.clear();
|
2495
|
+
}
|
2496
|
+
}
|
2497
|
+
}
|
2498
|
+
}
|
2499
|
+
|
2500
|
+
var didWarnAboutMessageChannel = false;
|
2501
|
+
var enqueueTaskImpl = null;
|
2502
|
+
function enqueueTask(task) {
|
2503
|
+
if (enqueueTaskImpl === null) {
|
2504
|
+
try {
|
2505
|
+
// read require off the module object to get around the bundlers.
|
2506
|
+
// we don't want them to detect a require and bundle a Node polyfill.
|
2507
|
+
var requireString = ('require' + Math.random()).slice(0, 7);
|
2508
|
+
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
2509
|
+
// version of setImmediate, bypassing fake timers if any.
|
2510
|
+
|
2511
|
+
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
2512
|
+
} catch (_err) {
|
2513
|
+
// we're in a browser
|
2514
|
+
// we can't use regular timers because they may still be faked
|
2515
|
+
// so we try MessageChannel+postMessage instead
|
2516
|
+
enqueueTaskImpl = function (callback) {
|
2517
|
+
{
|
2518
|
+
if (didWarnAboutMessageChannel === false) {
|
2519
|
+
didWarnAboutMessageChannel = true;
|
2520
|
+
|
2521
|
+
if (typeof MessageChannel === 'undefined') {
|
2522
|
+
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.');
|
2523
|
+
}
|
2524
|
+
}
|
2525
|
+
}
|
2526
|
+
|
2527
|
+
var channel = new MessageChannel();
|
2528
|
+
channel.port1.onmessage = callback;
|
2529
|
+
channel.port2.postMessage(undefined);
|
2530
|
+
};
|
2531
|
+
}
|
2532
|
+
}
|
2533
|
+
|
2534
|
+
return enqueueTaskImpl(task);
|
2535
|
+
}
|
2536
|
+
|
2537
|
+
var actScopeDepth = 0;
|
2538
|
+
var didWarnNoAwaitAct = false;
|
2539
|
+
function act(callback) {
|
2540
|
+
{
|
2541
|
+
// `act` calls can be nested, so we track the depth. This represents the
|
2542
|
+
// number of `act` scopes on the stack.
|
2543
|
+
var prevActScopeDepth = actScopeDepth;
|
2544
|
+
actScopeDepth++;
|
2545
|
+
|
2546
|
+
if (ReactCurrentActQueue.current === null) {
|
2547
|
+
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
2548
|
+
// will detect the queue and use it instead of Scheduler.
|
2549
|
+
ReactCurrentActQueue.current = [];
|
2550
|
+
}
|
2551
|
+
|
2552
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
2553
|
+
var result;
|
2554
|
+
|
2555
|
+
try {
|
2556
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
2557
|
+
// set to `true` while the given callback is executed, not for updates
|
2558
|
+
// triggered during an async event, because this is how the legacy
|
2559
|
+
// implementation of `act` behaved.
|
2560
|
+
ReactCurrentActQueue.isBatchingLegacy = true;
|
2561
|
+
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
2562
|
+
// which flushed updates immediately after the scope function exits, even
|
2563
|
+
// if it's an async function.
|
2564
|
+
|
2565
|
+
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
2566
|
+
var queue = ReactCurrentActQueue.current;
|
2567
|
+
|
2568
|
+
if (queue !== null) {
|
2569
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
2570
|
+
flushActQueue(queue);
|
2571
|
+
}
|
2572
|
+
}
|
2573
|
+
} catch (error) {
|
2574
|
+
popActScope(prevActScopeDepth);
|
2575
|
+
throw error;
|
2576
|
+
} finally {
|
2577
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
2578
|
+
}
|
2579
|
+
|
2580
|
+
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
2581
|
+
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
2582
|
+
// for it to resolve before exiting the current scope.
|
2583
|
+
|
2584
|
+
var wasAwaited = false;
|
2585
|
+
var thenable = {
|
2586
|
+
then: function (resolve, reject) {
|
2587
|
+
wasAwaited = true;
|
2588
|
+
thenableResult.then(function (returnValue) {
|
2589
|
+
popActScope(prevActScopeDepth);
|
2590
|
+
|
2591
|
+
if (actScopeDepth === 0) {
|
2592
|
+
// We've exited the outermost act scope. Recursively flush the
|
2593
|
+
// queue until there's no remaining work.
|
2594
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2595
|
+
} else {
|
2596
|
+
resolve(returnValue);
|
2597
|
+
}
|
2598
|
+
}, function (error) {
|
2599
|
+
// The callback threw an error.
|
2600
|
+
popActScope(prevActScopeDepth);
|
2601
|
+
reject(error);
|
2602
|
+
});
|
2603
|
+
}
|
2604
|
+
};
|
2605
|
+
|
2606
|
+
{
|
2607
|
+
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
2608
|
+
// eslint-disable-next-line no-undef
|
2609
|
+
Promise.resolve().then(function () {}).then(function () {
|
2610
|
+
if (!wasAwaited) {
|
2611
|
+
didWarnNoAwaitAct = true;
|
2612
|
+
|
2613
|
+
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 () => ...);');
|
2614
|
+
}
|
2615
|
+
});
|
2616
|
+
}
|
2617
|
+
}
|
2618
|
+
|
2619
|
+
return thenable;
|
2620
|
+
} else {
|
2621
|
+
var returnValue = result; // The callback is not an async function. Exit the current scope
|
2622
|
+
// immediately, without awaiting.
|
2623
|
+
|
2624
|
+
popActScope(prevActScopeDepth);
|
2625
|
+
|
2626
|
+
if (actScopeDepth === 0) {
|
2627
|
+
// Exiting the outermost act scope. Flush the queue.
|
2628
|
+
var _queue = ReactCurrentActQueue.current;
|
2629
|
+
|
2630
|
+
if (_queue !== null) {
|
2631
|
+
flushActQueue(_queue);
|
2632
|
+
ReactCurrentActQueue.current = null;
|
2633
|
+
} // Return a thenable. If the user awaits it, we'll flush again in
|
2634
|
+
// case additional work was scheduled by a microtask.
|
2635
|
+
|
2636
|
+
|
2637
|
+
var _thenable = {
|
2638
|
+
then: function (resolve, reject) {
|
2639
|
+
// Confirm we haven't re-entered another `act` scope, in case
|
2640
|
+
// the user does something weird like await the thenable
|
2641
|
+
// multiple times.
|
2642
|
+
if (ReactCurrentActQueue.current === null) {
|
2643
|
+
// Recursively flush the queue until there's no remaining work.
|
2644
|
+
ReactCurrentActQueue.current = [];
|
2645
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2646
|
+
} else {
|
2647
|
+
resolve(returnValue);
|
2648
|
+
}
|
2649
|
+
}
|
2650
|
+
};
|
2651
|
+
return _thenable;
|
2652
|
+
} else {
|
2653
|
+
// Since we're inside a nested `act` scope, the returned thenable
|
2654
|
+
// immediately resolves. The outer scope will flush the queue.
|
2655
|
+
var _thenable2 = {
|
2656
|
+
then: function (resolve, reject) {
|
2657
|
+
resolve(returnValue);
|
2658
|
+
}
|
2659
|
+
};
|
2660
|
+
return _thenable2;
|
2661
|
+
}
|
2662
|
+
}
|
2663
|
+
}
|
2664
|
+
}
|
2665
|
+
|
2666
|
+
function popActScope(prevActScopeDepth) {
|
2667
|
+
{
|
2668
|
+
if (prevActScopeDepth !== actScopeDepth - 1) {
|
2669
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
actScopeDepth = prevActScopeDepth;
|
2673
|
+
}
|
2674
|
+
}
|
2675
|
+
|
2676
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
2677
|
+
{
|
2678
|
+
var queue = ReactCurrentActQueue.current;
|
2679
|
+
|
2680
|
+
if (queue !== null) {
|
2681
|
+
try {
|
2682
|
+
flushActQueue(queue);
|
2683
|
+
enqueueTask(function () {
|
2684
|
+
if (queue.length === 0) {
|
2685
|
+
// No additional work was scheduled. Finish.
|
2686
|
+
ReactCurrentActQueue.current = null;
|
2687
|
+
resolve(returnValue);
|
2688
|
+
} else {
|
2689
|
+
// Keep flushing work until there's none left.
|
2690
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2691
|
+
}
|
2692
|
+
});
|
2693
|
+
} catch (error) {
|
2694
|
+
reject(error);
|
2695
|
+
}
|
2696
|
+
} else {
|
2697
|
+
resolve(returnValue);
|
2698
|
+
}
|
2699
|
+
}
|
2700
|
+
}
|
2701
|
+
|
2702
|
+
var isFlushing = false;
|
2703
|
+
|
2704
|
+
function flushActQueue(queue) {
|
2705
|
+
{
|
2706
|
+
if (!isFlushing) {
|
2707
|
+
// Prevent re-entrance.
|
2708
|
+
isFlushing = true;
|
2709
|
+
var i = 0;
|
2710
|
+
|
2711
|
+
try {
|
2712
|
+
for (; i < queue.length; i++) {
|
2713
|
+
var callback = queue[i];
|
2714
|
+
|
2715
|
+
do {
|
2716
|
+
callback = callback(true);
|
2717
|
+
} while (callback !== null);
|
2718
|
+
}
|
2719
|
+
|
2720
|
+
queue.length = 0;
|
2721
|
+
} catch (error) {
|
2722
|
+
// If something throws, leave the remaining callbacks on the queue.
|
2723
|
+
queue = queue.slice(i + 1);
|
2724
|
+
throw error;
|
2725
|
+
} finally {
|
2726
|
+
isFlushing = false;
|
2727
|
+
}
|
2728
|
+
}
|
2729
|
+
}
|
2730
|
+
}
|
2731
|
+
|
2732
|
+
var createElement$1 = createElementWithValidation ;
|
2733
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
2734
|
+
var createFactory = createFactoryWithValidation ;
|
2735
|
+
var Children = {
|
2736
|
+
map: mapChildren,
|
2737
|
+
forEach: forEachChildren,
|
2738
|
+
count: countChildren,
|
2739
|
+
toArray: toArray,
|
2740
|
+
only: onlyChild
|
2741
|
+
};
|
2742
|
+
|
2743
|
+
exports.Children = Children;
|
2744
|
+
exports.Component = Component;
|
2745
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
2746
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
2747
|
+
exports.PureComponent = PureComponent;
|
2748
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
2749
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
2750
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
2751
|
+
exports.act = act;
|
2752
|
+
exports.cloneElement = cloneElement$1;
|
2753
|
+
exports.createContext = createContext;
|
2754
|
+
exports.createElement = createElement$1;
|
2755
|
+
exports.createFactory = createFactory;
|
2756
|
+
exports.createRef = createRef;
|
2757
|
+
exports.forwardRef = forwardRef;
|
2758
|
+
exports.isValidElement = isValidElement;
|
2759
|
+
exports.lazy = lazy;
|
2760
|
+
exports.memo = memo;
|
2761
|
+
exports.startTransition = startTransition;
|
2762
|
+
exports.unstable_act = act;
|
2763
|
+
exports.useCallback = useCallback;
|
2764
|
+
exports.useContext = useContext;
|
2765
|
+
exports.useDebugValue = useDebugValue;
|
2766
|
+
exports.useDeferredValue = useDeferredValue;
|
2767
|
+
exports.useEffect = useEffect;
|
2768
|
+
exports.useId = useId;
|
2769
|
+
exports.useImperativeHandle = useImperativeHandle;
|
2770
|
+
exports.useInsertionEffect = useInsertionEffect;
|
2771
|
+
exports.useLayoutEffect = useLayoutEffect;
|
2772
|
+
exports.useMemo = useMemo;
|
2773
|
+
exports.useReducer = useReducer;
|
2774
|
+
exports.useRef = useRef;
|
2775
|
+
exports.useState = useState;
|
2776
|
+
exports.useSyncExternalStore = useSyncExternalStore;
|
2777
|
+
exports.useTransition = useTransition;
|
2778
|
+
exports.version = ReactVersion;
|
2779
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
2780
|
+
if (
|
2781
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
2782
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
2783
|
+
'function'
|
2784
|
+
) {
|
2785
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
})();
|
2789
|
+
}
|
2790
|
+
} (react_development, react_development.exports));
|
2791
|
+
return react_development.exports;
|
2792
|
+
}
|
2793
|
+
|
2794
|
+
var hasRequiredReact;
|
2795
|
+
|
2796
|
+
function requireReact () {
|
2797
|
+
if (hasRequiredReact) return react.exports;
|
2798
|
+
hasRequiredReact = 1;
|
2799
|
+
|
2800
|
+
if (process.env.NODE_ENV === 'production') {
|
2801
|
+
react.exports = requireReact_production_min();
|
2802
|
+
} else {
|
2803
|
+
react.exports = requireReact_development();
|
2804
|
+
}
|
2805
|
+
return react.exports;
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
/**
|
2809
|
+
* @license React
|
2810
|
+
* react-jsx-runtime.production.min.js
|
2811
|
+
*
|
2812
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
2813
|
+
*
|
2814
|
+
* This source code is licensed under the MIT license found in the
|
2815
|
+
* LICENSE file in the root directory of this source tree.
|
2816
|
+
*/
|
2817
|
+
|
2818
|
+
var hasRequiredReactJsxRuntime_production_min;
|
2819
|
+
|
2820
|
+
function requireReactJsxRuntime_production_min () {
|
2821
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
2822
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
2823
|
+
var f=requireReact(),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
2824
|
+
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
2825
|
+
return reactJsxRuntime_production_min;
|
2826
|
+
}
|
2827
|
+
|
2828
|
+
var reactJsxRuntime_development = {};
|
2829
|
+
|
2830
|
+
/**
|
2831
|
+
* @license React
|
2832
|
+
* react-jsx-runtime.development.js
|
2833
|
+
*
|
2834
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
2835
|
+
*
|
2836
|
+
* This source code is licensed under the MIT license found in the
|
2837
|
+
* LICENSE file in the root directory of this source tree.
|
2838
|
+
*/
|
2839
|
+
|
2840
|
+
var hasRequiredReactJsxRuntime_development;
|
2841
|
+
|
2842
|
+
function requireReactJsxRuntime_development () {
|
2843
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
2844
|
+
hasRequiredReactJsxRuntime_development = 1;
|
2845
|
+
|
2846
|
+
if (process.env.NODE_ENV !== "production") {
|
2847
|
+
(function() {
|
2848
|
+
|
2849
|
+
var React = requireReact();
|
2850
|
+
|
2851
|
+
// ATTENTION
|
2852
|
+
// When adding new symbols to this file,
|
2853
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
2854
|
+
// The Symbol used to tag the ReactElement-like types.
|
2855
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
2856
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
2857
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
2858
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
2859
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
2860
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
2861
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
2862
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
2863
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
2864
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
2865
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
2866
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
2867
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
2868
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
2869
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
2870
|
+
function getIteratorFn(maybeIterable) {
|
2871
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
2872
|
+
return null;
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
2876
|
+
|
2877
|
+
if (typeof maybeIterator === 'function') {
|
2878
|
+
return maybeIterator;
|
2879
|
+
}
|
2880
|
+
|
2881
|
+
return null;
|
2882
|
+
}
|
2883
|
+
|
2884
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
2885
|
+
|
2886
|
+
function error(format) {
|
2887
|
+
{
|
2888
|
+
{
|
2889
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
2890
|
+
args[_key2 - 1] = arguments[_key2];
|
2891
|
+
}
|
2892
|
+
|
2893
|
+
printWarning('error', format, args);
|
2894
|
+
}
|
2895
|
+
}
|
2896
|
+
}
|
2897
|
+
|
2898
|
+
function printWarning(level, format, args) {
|
2899
|
+
// When changing this logic, you might want to also
|
2900
|
+
// update consoleWithStackDev.www.js as well.
|
2901
|
+
{
|
2902
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
2903
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
2904
|
+
|
2905
|
+
if (stack !== '') {
|
2906
|
+
format += '%s';
|
2907
|
+
args = args.concat([stack]);
|
2908
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
2909
|
+
|
2910
|
+
|
2911
|
+
var argsWithFormat = args.map(function (item) {
|
2912
|
+
return String(item);
|
2913
|
+
}); // Careful: RN currently depends on this prefix
|
2914
|
+
|
2915
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
2916
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
2917
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
2918
|
+
|
2919
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
2920
|
+
}
|
2921
|
+
}
|
2922
|
+
|
2923
|
+
// -----------------------------------------------------------------------------
|
2924
|
+
|
2925
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
2926
|
+
var enableCacheElement = false;
|
2927
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
2928
|
+
|
2929
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
2930
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
2931
|
+
// issues in DEV builds.
|
2932
|
+
|
2933
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
2934
|
+
|
2935
|
+
var REACT_MODULE_REFERENCE;
|
2936
|
+
|
2937
|
+
{
|
2938
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
2939
|
+
}
|
2940
|
+
|
2941
|
+
function isValidElementType(type) {
|
2942
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
2943
|
+
return true;
|
2944
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
2945
|
+
|
2946
|
+
|
2947
|
+
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 ) {
|
2948
|
+
return true;
|
2949
|
+
}
|
2950
|
+
|
2951
|
+
if (typeof type === 'object' && type !== null) {
|
2952
|
+
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
|
2953
|
+
// types supported by any Flight configuration anywhere since
|
2954
|
+
// we don't know which Flight build this will end up being used
|
2955
|
+
// with.
|
2956
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
2957
|
+
return true;
|
2958
|
+
}
|
2959
|
+
}
|
2960
|
+
|
2961
|
+
return false;
|
2962
|
+
}
|
2963
|
+
|
2964
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
2965
|
+
var displayName = outerType.displayName;
|
2966
|
+
|
2967
|
+
if (displayName) {
|
2968
|
+
return displayName;
|
2969
|
+
}
|
2970
|
+
|
2971
|
+
var functionName = innerType.displayName || innerType.name || '';
|
2972
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
2973
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
2974
|
+
|
2975
|
+
|
2976
|
+
function getContextName(type) {
|
2977
|
+
return type.displayName || 'Context';
|
2978
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
2979
|
+
|
2980
|
+
|
2981
|
+
function getComponentNameFromType(type) {
|
2982
|
+
if (type == null) {
|
2983
|
+
// Host root, text node or just invalid type.
|
2984
|
+
return null;
|
2985
|
+
}
|
2986
|
+
|
2987
|
+
{
|
2988
|
+
if (typeof type.tag === 'number') {
|
2989
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
2990
|
+
}
|
2991
|
+
}
|
2992
|
+
|
2993
|
+
if (typeof type === 'function') {
|
2994
|
+
return type.displayName || type.name || null;
|
2995
|
+
}
|
2996
|
+
|
2997
|
+
if (typeof type === 'string') {
|
2998
|
+
return type;
|
2999
|
+
}
|
3000
|
+
|
3001
|
+
switch (type) {
|
3002
|
+
case REACT_FRAGMENT_TYPE:
|
3003
|
+
return 'Fragment';
|
3004
|
+
|
3005
|
+
case REACT_PORTAL_TYPE:
|
3006
|
+
return 'Portal';
|
3007
|
+
|
3008
|
+
case REACT_PROFILER_TYPE:
|
3009
|
+
return 'Profiler';
|
3010
|
+
|
3011
|
+
case REACT_STRICT_MODE_TYPE:
|
3012
|
+
return 'StrictMode';
|
3013
|
+
|
3014
|
+
case REACT_SUSPENSE_TYPE:
|
3015
|
+
return 'Suspense';
|
3016
|
+
|
3017
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
3018
|
+
return 'SuspenseList';
|
3019
|
+
|
3020
|
+
}
|
3021
|
+
|
3022
|
+
if (typeof type === 'object') {
|
3023
|
+
switch (type.$$typeof) {
|
3024
|
+
case REACT_CONTEXT_TYPE:
|
3025
|
+
var context = type;
|
3026
|
+
return getContextName(context) + '.Consumer';
|
3027
|
+
|
3028
|
+
case REACT_PROVIDER_TYPE:
|
3029
|
+
var provider = type;
|
3030
|
+
return getContextName(provider._context) + '.Provider';
|
3031
|
+
|
3032
|
+
case REACT_FORWARD_REF_TYPE:
|
3033
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
3034
|
+
|
3035
|
+
case REACT_MEMO_TYPE:
|
3036
|
+
var outerName = type.displayName || null;
|
3037
|
+
|
3038
|
+
if (outerName !== null) {
|
3039
|
+
return outerName;
|
3040
|
+
}
|
3041
|
+
|
3042
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
3043
|
+
|
3044
|
+
case REACT_LAZY_TYPE:
|
3045
|
+
{
|
3046
|
+
var lazyComponent = type;
|
3047
|
+
var payload = lazyComponent._payload;
|
3048
|
+
var init = lazyComponent._init;
|
3049
|
+
|
3050
|
+
try {
|
3051
|
+
return getComponentNameFromType(init(payload));
|
3052
|
+
} catch (x) {
|
3053
|
+
return null;
|
3054
|
+
}
|
3055
|
+
}
|
3056
|
+
|
3057
|
+
// eslint-disable-next-line no-fallthrough
|
3058
|
+
}
|
3059
|
+
}
|
3060
|
+
|
3061
|
+
return null;
|
3062
|
+
}
|
3063
|
+
|
3064
|
+
var assign = Object.assign;
|
3065
|
+
|
3066
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
3067
|
+
// replaying on render function. This currently only patches the object
|
3068
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
3069
|
+
// We could also eagerly patch the method.
|
3070
|
+
var disabledDepth = 0;
|
3071
|
+
var prevLog;
|
3072
|
+
var prevInfo;
|
3073
|
+
var prevWarn;
|
3074
|
+
var prevError;
|
3075
|
+
var prevGroup;
|
3076
|
+
var prevGroupCollapsed;
|
3077
|
+
var prevGroupEnd;
|
3078
|
+
|
3079
|
+
function disabledLog() {}
|
3080
|
+
|
3081
|
+
disabledLog.__reactDisabledLog = true;
|
3082
|
+
function disableLogs() {
|
3083
|
+
{
|
3084
|
+
if (disabledDepth === 0) {
|
3085
|
+
/* eslint-disable react-internal/no-production-logging */
|
3086
|
+
prevLog = console.log;
|
3087
|
+
prevInfo = console.info;
|
3088
|
+
prevWarn = console.warn;
|
3089
|
+
prevError = console.error;
|
3090
|
+
prevGroup = console.group;
|
3091
|
+
prevGroupCollapsed = console.groupCollapsed;
|
3092
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
3093
|
+
|
3094
|
+
var props = {
|
3095
|
+
configurable: true,
|
3096
|
+
enumerable: true,
|
3097
|
+
value: disabledLog,
|
3098
|
+
writable: true
|
3099
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
3100
|
+
|
3101
|
+
Object.defineProperties(console, {
|
3102
|
+
info: props,
|
3103
|
+
log: props,
|
3104
|
+
warn: props,
|
3105
|
+
error: props,
|
3106
|
+
group: props,
|
3107
|
+
groupCollapsed: props,
|
3108
|
+
groupEnd: props
|
3109
|
+
});
|
3110
|
+
/* eslint-enable react-internal/no-production-logging */
|
3111
|
+
}
|
3112
|
+
|
3113
|
+
disabledDepth++;
|
3114
|
+
}
|
3115
|
+
}
|
3116
|
+
function reenableLogs() {
|
3117
|
+
{
|
3118
|
+
disabledDepth--;
|
3119
|
+
|
3120
|
+
if (disabledDepth === 0) {
|
3121
|
+
/* eslint-disable react-internal/no-production-logging */
|
3122
|
+
var props = {
|
3123
|
+
configurable: true,
|
3124
|
+
enumerable: true,
|
3125
|
+
writable: true
|
3126
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
3127
|
+
|
3128
|
+
Object.defineProperties(console, {
|
3129
|
+
log: assign({}, props, {
|
3130
|
+
value: prevLog
|
3131
|
+
}),
|
3132
|
+
info: assign({}, props, {
|
3133
|
+
value: prevInfo
|
3134
|
+
}),
|
3135
|
+
warn: assign({}, props, {
|
3136
|
+
value: prevWarn
|
3137
|
+
}),
|
3138
|
+
error: assign({}, props, {
|
3139
|
+
value: prevError
|
3140
|
+
}),
|
3141
|
+
group: assign({}, props, {
|
3142
|
+
value: prevGroup
|
3143
|
+
}),
|
3144
|
+
groupCollapsed: assign({}, props, {
|
3145
|
+
value: prevGroupCollapsed
|
3146
|
+
}),
|
3147
|
+
groupEnd: assign({}, props, {
|
3148
|
+
value: prevGroupEnd
|
3149
|
+
})
|
3150
|
+
});
|
3151
|
+
/* eslint-enable react-internal/no-production-logging */
|
3152
|
+
}
|
3153
|
+
|
3154
|
+
if (disabledDepth < 0) {
|
3155
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
3156
|
+
}
|
3157
|
+
}
|
3158
|
+
}
|
3159
|
+
|
3160
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
3161
|
+
var prefix;
|
3162
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
3163
|
+
{
|
3164
|
+
if (prefix === undefined) {
|
3165
|
+
// Extract the VM specific prefix used by each line.
|
3166
|
+
try {
|
3167
|
+
throw Error();
|
3168
|
+
} catch (x) {
|
3169
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
3170
|
+
prefix = match && match[1] || '';
|
3171
|
+
}
|
3172
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
3173
|
+
|
3174
|
+
|
3175
|
+
return '\n' + prefix + name;
|
3176
|
+
}
|
3177
|
+
}
|
3178
|
+
var reentry = false;
|
3179
|
+
var componentFrameCache;
|
3180
|
+
|
3181
|
+
{
|
3182
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
3183
|
+
componentFrameCache = new PossiblyWeakMap();
|
3184
|
+
}
|
3185
|
+
|
3186
|
+
function describeNativeComponentFrame(fn, construct) {
|
3187
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
3188
|
+
if ( !fn || reentry) {
|
3189
|
+
return '';
|
3190
|
+
}
|
3191
|
+
|
3192
|
+
{
|
3193
|
+
var frame = componentFrameCache.get(fn);
|
3194
|
+
|
3195
|
+
if (frame !== undefined) {
|
3196
|
+
return frame;
|
3197
|
+
}
|
3198
|
+
}
|
3199
|
+
|
3200
|
+
var control;
|
3201
|
+
reentry = true;
|
3202
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
3203
|
+
|
3204
|
+
Error.prepareStackTrace = undefined;
|
3205
|
+
var previousDispatcher;
|
3206
|
+
|
3207
|
+
{
|
3208
|
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
3209
|
+
// for warnings.
|
3210
|
+
|
3211
|
+
ReactCurrentDispatcher.current = null;
|
3212
|
+
disableLogs();
|
3213
|
+
}
|
3214
|
+
|
3215
|
+
try {
|
3216
|
+
// This should throw.
|
3217
|
+
if (construct) {
|
3218
|
+
// Something should be setting the props in the constructor.
|
3219
|
+
var Fake = function () {
|
3220
|
+
throw Error();
|
3221
|
+
}; // $FlowFixMe
|
3222
|
+
|
3223
|
+
|
3224
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
3225
|
+
set: function () {
|
3226
|
+
// We use a throwing setter instead of frozen or non-writable props
|
3227
|
+
// because that won't throw in a non-strict mode function.
|
3228
|
+
throw Error();
|
3229
|
+
}
|
3230
|
+
});
|
3231
|
+
|
3232
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
3233
|
+
// We construct a different control for this case to include any extra
|
3234
|
+
// frames added by the construct call.
|
3235
|
+
try {
|
3236
|
+
Reflect.construct(Fake, []);
|
3237
|
+
} catch (x) {
|
3238
|
+
control = x;
|
3239
|
+
}
|
3240
|
+
|
3241
|
+
Reflect.construct(fn, [], Fake);
|
3242
|
+
} else {
|
3243
|
+
try {
|
3244
|
+
Fake.call();
|
3245
|
+
} catch (x) {
|
3246
|
+
control = x;
|
3247
|
+
}
|
3248
|
+
|
3249
|
+
fn.call(Fake.prototype);
|
3250
|
+
}
|
3251
|
+
} else {
|
3252
|
+
try {
|
3253
|
+
throw Error();
|
3254
|
+
} catch (x) {
|
3255
|
+
control = x;
|
3256
|
+
}
|
3257
|
+
|
3258
|
+
fn();
|
3259
|
+
}
|
3260
|
+
} catch (sample) {
|
3261
|
+
// This is inlined manually because closure doesn't do it for us.
|
3262
|
+
if (sample && control && typeof sample.stack === 'string') {
|
3263
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
3264
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
3265
|
+
var sampleLines = sample.stack.split('\n');
|
3266
|
+
var controlLines = control.stack.split('\n');
|
3267
|
+
var s = sampleLines.length - 1;
|
3268
|
+
var c = controlLines.length - 1;
|
3269
|
+
|
3270
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
3271
|
+
// We expect at least one stack frame to be shared.
|
3272
|
+
// Typically this will be the root most one. However, stack frames may be
|
3273
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
3274
|
+
// earlier than the other. We assume that the sample is longer or the same
|
3275
|
+
// and there for cut off earlier. So we should find the root most frame in
|
3276
|
+
// the sample somewhere in the control.
|
3277
|
+
c--;
|
3278
|
+
}
|
3279
|
+
|
3280
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
3281
|
+
// Next we find the first one that isn't the same which should be the
|
3282
|
+
// frame that called our sample function and the control.
|
3283
|
+
if (sampleLines[s] !== controlLines[c]) {
|
3284
|
+
// In V8, the first line is describing the message but other VMs don't.
|
3285
|
+
// If we're about to return the first line, and the control is also on the same
|
3286
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
3287
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
3288
|
+
// This can happen if you passed a class to function component, or non-function.
|
3289
|
+
if (s !== 1 || c !== 1) {
|
3290
|
+
do {
|
3291
|
+
s--;
|
3292
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
3293
|
+
// The next one that isn't the same should be our match though.
|
3294
|
+
|
3295
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
3296
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
3297
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
3298
|
+
// but we have a user-provided "displayName"
|
3299
|
+
// splice it in to make the stack more readable.
|
3300
|
+
|
3301
|
+
|
3302
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
3303
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
3304
|
+
}
|
3305
|
+
|
3306
|
+
{
|
3307
|
+
if (typeof fn === 'function') {
|
3308
|
+
componentFrameCache.set(fn, _frame);
|
3309
|
+
}
|
3310
|
+
} // Return the line we found.
|
3311
|
+
|
3312
|
+
|
3313
|
+
return _frame;
|
3314
|
+
}
|
3315
|
+
} while (s >= 1 && c >= 0);
|
3316
|
+
}
|
3317
|
+
|
3318
|
+
break;
|
3319
|
+
}
|
3320
|
+
}
|
3321
|
+
}
|
3322
|
+
} finally {
|
3323
|
+
reentry = false;
|
3324
|
+
|
3325
|
+
{
|
3326
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
3327
|
+
reenableLogs();
|
3328
|
+
}
|
3329
|
+
|
3330
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
3331
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
3332
|
+
|
3333
|
+
|
3334
|
+
var name = fn ? fn.displayName || fn.name : '';
|
3335
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
3336
|
+
|
3337
|
+
{
|
3338
|
+
if (typeof fn === 'function') {
|
3339
|
+
componentFrameCache.set(fn, syntheticFrame);
|
3340
|
+
}
|
3341
|
+
}
|
3342
|
+
|
3343
|
+
return syntheticFrame;
|
3344
|
+
}
|
3345
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
3346
|
+
{
|
3347
|
+
return describeNativeComponentFrame(fn, false);
|
3348
|
+
}
|
3349
|
+
}
|
3350
|
+
|
3351
|
+
function shouldConstruct(Component) {
|
3352
|
+
var prototype = Component.prototype;
|
3353
|
+
return !!(prototype && prototype.isReactComponent);
|
3354
|
+
}
|
3355
|
+
|
3356
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
3357
|
+
|
3358
|
+
if (type == null) {
|
3359
|
+
return '';
|
3360
|
+
}
|
3361
|
+
|
3362
|
+
if (typeof type === 'function') {
|
3363
|
+
{
|
3364
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
3365
|
+
}
|
3366
|
+
}
|
3367
|
+
|
3368
|
+
if (typeof type === 'string') {
|
3369
|
+
return describeBuiltInComponentFrame(type);
|
3370
|
+
}
|
3371
|
+
|
3372
|
+
switch (type) {
|
3373
|
+
case REACT_SUSPENSE_TYPE:
|
3374
|
+
return describeBuiltInComponentFrame('Suspense');
|
3375
|
+
|
3376
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
3377
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
3378
|
+
}
|
3379
|
+
|
3380
|
+
if (typeof type === 'object') {
|
3381
|
+
switch (type.$$typeof) {
|
3382
|
+
case REACT_FORWARD_REF_TYPE:
|
3383
|
+
return describeFunctionComponentFrame(type.render);
|
3384
|
+
|
3385
|
+
case REACT_MEMO_TYPE:
|
3386
|
+
// Memo may contain any component type so we recursively resolve it.
|
3387
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
3388
|
+
|
3389
|
+
case REACT_LAZY_TYPE:
|
3390
|
+
{
|
3391
|
+
var lazyComponent = type;
|
3392
|
+
var payload = lazyComponent._payload;
|
3393
|
+
var init = lazyComponent._init;
|
3394
|
+
|
3395
|
+
try {
|
3396
|
+
// Lazy may contain any component type so we recursively resolve it.
|
3397
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
3398
|
+
} catch (x) {}
|
3399
|
+
}
|
3400
|
+
}
|
3401
|
+
}
|
3402
|
+
|
3403
|
+
return '';
|
3404
|
+
}
|
3405
|
+
|
3406
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3407
|
+
|
3408
|
+
var loggedTypeFailures = {};
|
3409
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
3410
|
+
|
3411
|
+
function setCurrentlyValidatingElement(element) {
|
3412
|
+
{
|
3413
|
+
if (element) {
|
3414
|
+
var owner = element._owner;
|
3415
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
3416
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
3417
|
+
} else {
|
3418
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
3419
|
+
}
|
3420
|
+
}
|
3421
|
+
}
|
3422
|
+
|
3423
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
3424
|
+
{
|
3425
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
3426
|
+
var has = Function.call.bind(hasOwnProperty);
|
3427
|
+
|
3428
|
+
for (var typeSpecName in typeSpecs) {
|
3429
|
+
if (has(typeSpecs, typeSpecName)) {
|
3430
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
3431
|
+
// fail the render phase where it didn't fail before. So we log it.
|
3432
|
+
// After these have been cleaned up, we'll let them throw.
|
3433
|
+
|
3434
|
+
try {
|
3435
|
+
// This is intentionally an invariant that gets caught. It's the same
|
3436
|
+
// behavior as without this statement except with a better message.
|
3437
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
3438
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
3439
|
+
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`.');
|
3440
|
+
err.name = 'Invariant Violation';
|
3441
|
+
throw err;
|
3442
|
+
}
|
3443
|
+
|
3444
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
3445
|
+
} catch (ex) {
|
3446
|
+
error$1 = ex;
|
3447
|
+
}
|
3448
|
+
|
3449
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
3450
|
+
setCurrentlyValidatingElement(element);
|
3451
|
+
|
3452
|
+
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);
|
3453
|
+
|
3454
|
+
setCurrentlyValidatingElement(null);
|
3455
|
+
}
|
3456
|
+
|
3457
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
3458
|
+
// Only monitor this failure once because there tends to be a lot of the
|
3459
|
+
// same error.
|
3460
|
+
loggedTypeFailures[error$1.message] = true;
|
3461
|
+
setCurrentlyValidatingElement(element);
|
3462
|
+
|
3463
|
+
error('Failed %s type: %s', location, error$1.message);
|
3464
|
+
|
3465
|
+
setCurrentlyValidatingElement(null);
|
3466
|
+
}
|
3467
|
+
}
|
3468
|
+
}
|
3469
|
+
}
|
3470
|
+
}
|
3471
|
+
|
3472
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
3473
|
+
|
3474
|
+
function isArray(a) {
|
3475
|
+
return isArrayImpl(a);
|
3476
|
+
}
|
3477
|
+
|
3478
|
+
/*
|
3479
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
3480
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
3481
|
+
*
|
3482
|
+
* The functions in this module will throw an easier-to-understand,
|
3483
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
3484
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
3485
|
+
* of the `value` object).
|
3486
|
+
*/
|
3487
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
3488
|
+
function typeName(value) {
|
3489
|
+
{
|
3490
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
3491
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
3492
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
3493
|
+
return type;
|
3494
|
+
}
|
3495
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
3496
|
+
|
3497
|
+
|
3498
|
+
function willCoercionThrow(value) {
|
3499
|
+
{
|
3500
|
+
try {
|
3501
|
+
testStringCoercion(value);
|
3502
|
+
return false;
|
3503
|
+
} catch (e) {
|
3504
|
+
return true;
|
3505
|
+
}
|
3506
|
+
}
|
3507
|
+
}
|
3508
|
+
|
3509
|
+
function testStringCoercion(value) {
|
3510
|
+
// If you ended up here by following an exception call stack, here's what's
|
3511
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
3512
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
3513
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
3514
|
+
//
|
3515
|
+
// The most common types that will cause this exception are `Symbol` instances
|
3516
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
3517
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
3518
|
+
// exception. (Library authors do this to prevent users from using built-in
|
3519
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
3520
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
3521
|
+
//
|
3522
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
3523
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
3524
|
+
//
|
3525
|
+
// To find which value is throwing, check the browser or debugger console.
|
3526
|
+
// Before this exception was thrown, there should be `console.error` output
|
3527
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
3528
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
3529
|
+
// In most cases, this console output also shows the component and its
|
3530
|
+
// ancestor components where the exception happened.
|
3531
|
+
//
|
3532
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
3533
|
+
return '' + value;
|
3534
|
+
}
|
3535
|
+
function checkKeyStringCoercion(value) {
|
3536
|
+
{
|
3537
|
+
if (willCoercionThrow(value)) {
|
3538
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
3539
|
+
|
3540
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
3541
|
+
}
|
3542
|
+
}
|
3543
|
+
}
|
3544
|
+
|
3545
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
3546
|
+
var RESERVED_PROPS = {
|
3547
|
+
key: true,
|
3548
|
+
ref: true,
|
3549
|
+
__self: true,
|
3550
|
+
__source: true
|
3551
|
+
};
|
3552
|
+
var specialPropKeyWarningShown;
|
3553
|
+
var specialPropRefWarningShown;
|
3554
|
+
var didWarnAboutStringRefs;
|
3555
|
+
|
3556
|
+
{
|
3557
|
+
didWarnAboutStringRefs = {};
|
3558
|
+
}
|
3559
|
+
|
3560
|
+
function hasValidRef(config) {
|
3561
|
+
{
|
3562
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
3563
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
3564
|
+
|
3565
|
+
if (getter && getter.isReactWarning) {
|
3566
|
+
return false;
|
3567
|
+
}
|
3568
|
+
}
|
3569
|
+
}
|
3570
|
+
|
3571
|
+
return config.ref !== undefined;
|
3572
|
+
}
|
3573
|
+
|
3574
|
+
function hasValidKey(config) {
|
3575
|
+
{
|
3576
|
+
if (hasOwnProperty.call(config, 'key')) {
|
3577
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
3578
|
+
|
3579
|
+
if (getter && getter.isReactWarning) {
|
3580
|
+
return false;
|
3581
|
+
}
|
3582
|
+
}
|
3583
|
+
}
|
3584
|
+
|
3585
|
+
return config.key !== undefined;
|
3586
|
+
}
|
3587
|
+
|
3588
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
3589
|
+
{
|
3590
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
3591
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
3592
|
+
|
3593
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
3594
|
+
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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
3595
|
+
|
3596
|
+
didWarnAboutStringRefs[componentName] = true;
|
3597
|
+
}
|
3598
|
+
}
|
3599
|
+
}
|
3600
|
+
}
|
3601
|
+
|
3602
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
3603
|
+
{
|
3604
|
+
var warnAboutAccessingKey = function () {
|
3605
|
+
if (!specialPropKeyWarningShown) {
|
3606
|
+
specialPropKeyWarningShown = true;
|
3607
|
+
|
3608
|
+
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);
|
3609
|
+
}
|
3610
|
+
};
|
3611
|
+
|
3612
|
+
warnAboutAccessingKey.isReactWarning = true;
|
3613
|
+
Object.defineProperty(props, 'key', {
|
3614
|
+
get: warnAboutAccessingKey,
|
3615
|
+
configurable: true
|
3616
|
+
});
|
3617
|
+
}
|
3618
|
+
}
|
3619
|
+
|
3620
|
+
function defineRefPropWarningGetter(props, displayName) {
|
3621
|
+
{
|
3622
|
+
var warnAboutAccessingRef = function () {
|
3623
|
+
if (!specialPropRefWarningShown) {
|
3624
|
+
specialPropRefWarningShown = true;
|
3625
|
+
|
3626
|
+
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);
|
3627
|
+
}
|
3628
|
+
};
|
3629
|
+
|
3630
|
+
warnAboutAccessingRef.isReactWarning = true;
|
3631
|
+
Object.defineProperty(props, 'ref', {
|
3632
|
+
get: warnAboutAccessingRef,
|
3633
|
+
configurable: true
|
3634
|
+
});
|
3635
|
+
}
|
3636
|
+
}
|
3637
|
+
/**
|
3638
|
+
* Factory method to create a new React element. This no longer adheres to
|
3639
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
3640
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
3641
|
+
* if something is a React Element.
|
3642
|
+
*
|
3643
|
+
* @param {*} type
|
3644
|
+
* @param {*} props
|
3645
|
+
* @param {*} key
|
3646
|
+
* @param {string|object} ref
|
3647
|
+
* @param {*} owner
|
3648
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
3649
|
+
* different from the `owner` when React.createElement is called, so that we
|
3650
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
3651
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
3652
|
+
* change in behavior.
|
3653
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
3654
|
+
* indicating filename, line number, and/or other information.
|
3655
|
+
* @internal
|
3656
|
+
*/
|
3657
|
+
|
3658
|
+
|
3659
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
3660
|
+
var element = {
|
3661
|
+
// This tag allows us to uniquely identify this as a React Element
|
3662
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
3663
|
+
// Built-in properties that belong on the element
|
3664
|
+
type: type,
|
3665
|
+
key: key,
|
3666
|
+
ref: ref,
|
3667
|
+
props: props,
|
3668
|
+
// Record the component responsible for creating this element.
|
3669
|
+
_owner: owner
|
3670
|
+
};
|
3671
|
+
|
3672
|
+
{
|
3673
|
+
// The validation flag is currently mutative. We put it on
|
3674
|
+
// an external backing store so that we can freeze the whole object.
|
3675
|
+
// This can be replaced with a WeakMap once they are implemented in
|
3676
|
+
// commonly used development environments.
|
3677
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
3678
|
+
// the validation flag non-enumerable (where possible, which should
|
3679
|
+
// include every environment we run tests in), so the test framework
|
3680
|
+
// ignores it.
|
3681
|
+
|
3682
|
+
Object.defineProperty(element._store, 'validated', {
|
3683
|
+
configurable: false,
|
3684
|
+
enumerable: false,
|
3685
|
+
writable: true,
|
3686
|
+
value: false
|
3687
|
+
}); // self and source are DEV only properties.
|
3688
|
+
|
3689
|
+
Object.defineProperty(element, '_self', {
|
3690
|
+
configurable: false,
|
3691
|
+
enumerable: false,
|
3692
|
+
writable: false,
|
3693
|
+
value: self
|
3694
|
+
}); // Two elements created in two different places should be considered
|
3695
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
3696
|
+
|
3697
|
+
Object.defineProperty(element, '_source', {
|
3698
|
+
configurable: false,
|
3699
|
+
enumerable: false,
|
3700
|
+
writable: false,
|
3701
|
+
value: source
|
3702
|
+
});
|
3703
|
+
|
3704
|
+
if (Object.freeze) {
|
3705
|
+
Object.freeze(element.props);
|
3706
|
+
Object.freeze(element);
|
3707
|
+
}
|
3708
|
+
}
|
3709
|
+
|
3710
|
+
return element;
|
3711
|
+
};
|
3712
|
+
/**
|
3713
|
+
* https://github.com/reactjs/rfcs/pull/107
|
3714
|
+
* @param {*} type
|
3715
|
+
* @param {object} props
|
3716
|
+
* @param {string} key
|
3717
|
+
*/
|
3718
|
+
|
3719
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
3720
|
+
{
|
3721
|
+
var propName; // Reserved names are extracted
|
3722
|
+
|
3723
|
+
var props = {};
|
3724
|
+
var key = null;
|
3725
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
3726
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
3727
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
3728
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
3729
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
3730
|
+
// key is explicitly declared to be undefined or not.
|
3731
|
+
|
3732
|
+
if (maybeKey !== undefined) {
|
3733
|
+
{
|
3734
|
+
checkKeyStringCoercion(maybeKey);
|
3735
|
+
}
|
3736
|
+
|
3737
|
+
key = '' + maybeKey;
|
3738
|
+
}
|
3739
|
+
|
3740
|
+
if (hasValidKey(config)) {
|
3741
|
+
{
|
3742
|
+
checkKeyStringCoercion(config.key);
|
3743
|
+
}
|
3744
|
+
|
3745
|
+
key = '' + config.key;
|
3746
|
+
}
|
3747
|
+
|
3748
|
+
if (hasValidRef(config)) {
|
3749
|
+
ref = config.ref;
|
3750
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
3751
|
+
} // Remaining properties are added to a new props object
|
3752
|
+
|
3753
|
+
|
3754
|
+
for (propName in config) {
|
3755
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
3756
|
+
props[propName] = config[propName];
|
3757
|
+
}
|
3758
|
+
} // Resolve default props
|
3759
|
+
|
3760
|
+
|
3761
|
+
if (type && type.defaultProps) {
|
3762
|
+
var defaultProps = type.defaultProps;
|
3763
|
+
|
3764
|
+
for (propName in defaultProps) {
|
3765
|
+
if (props[propName] === undefined) {
|
3766
|
+
props[propName] = defaultProps[propName];
|
3767
|
+
}
|
3768
|
+
}
|
3769
|
+
}
|
3770
|
+
|
3771
|
+
if (key || ref) {
|
3772
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
3773
|
+
|
3774
|
+
if (key) {
|
3775
|
+
defineKeyPropWarningGetter(props, displayName);
|
3776
|
+
}
|
3777
|
+
|
3778
|
+
if (ref) {
|
3779
|
+
defineRefPropWarningGetter(props, displayName);
|
3780
|
+
}
|
3781
|
+
}
|
3782
|
+
|
3783
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
3784
|
+
}
|
3785
|
+
}
|
3786
|
+
|
3787
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
3788
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
3789
|
+
|
3790
|
+
function setCurrentlyValidatingElement$1(element) {
|
3791
|
+
{
|
3792
|
+
if (element) {
|
3793
|
+
var owner = element._owner;
|
3794
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
3795
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
3796
|
+
} else {
|
3797
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
3798
|
+
}
|
3799
|
+
}
|
3800
|
+
}
|
3801
|
+
|
3802
|
+
var propTypesMisspellWarningShown;
|
3803
|
+
|
3804
|
+
{
|
3805
|
+
propTypesMisspellWarningShown = false;
|
3806
|
+
}
|
3807
|
+
/**
|
3808
|
+
* Verifies the object is a ReactElement.
|
3809
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
3810
|
+
* @param {?object} object
|
3811
|
+
* @return {boolean} True if `object` is a ReactElement.
|
3812
|
+
* @final
|
3813
|
+
*/
|
3814
|
+
|
3815
|
+
|
3816
|
+
function isValidElement(object) {
|
3817
|
+
{
|
3818
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
3819
|
+
}
|
3820
|
+
}
|
3821
|
+
|
3822
|
+
function getDeclarationErrorAddendum() {
|
3823
|
+
{
|
3824
|
+
if (ReactCurrentOwner$1.current) {
|
3825
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
3826
|
+
|
3827
|
+
if (name) {
|
3828
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
3829
|
+
}
|
3830
|
+
}
|
3831
|
+
|
3832
|
+
return '';
|
3833
|
+
}
|
3834
|
+
}
|
3835
|
+
|
3836
|
+
function getSourceInfoErrorAddendum(source) {
|
3837
|
+
{
|
3838
|
+
|
3839
|
+
return '';
|
3840
|
+
}
|
3841
|
+
}
|
3842
|
+
/**
|
3843
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
3844
|
+
* object keys are not valid. This allows us to keep track of children between
|
3845
|
+
* updates.
|
3846
|
+
*/
|
3847
|
+
|
3848
|
+
|
3849
|
+
var ownerHasKeyUseWarning = {};
|
3850
|
+
|
3851
|
+
function getCurrentComponentErrorInfo(parentType) {
|
3852
|
+
{
|
3853
|
+
var info = getDeclarationErrorAddendum();
|
3854
|
+
|
3855
|
+
if (!info) {
|
3856
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
3857
|
+
|
3858
|
+
if (parentName) {
|
3859
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
3860
|
+
}
|
3861
|
+
}
|
3862
|
+
|
3863
|
+
return info;
|
3864
|
+
}
|
3865
|
+
}
|
3866
|
+
/**
|
3867
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
3868
|
+
* This element is in an array. The array could grow and shrink or be
|
3869
|
+
* reordered. All children that haven't already been validated are required to
|
3870
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
3871
|
+
* will only be shown once.
|
3872
|
+
*
|
3873
|
+
* @internal
|
3874
|
+
* @param {ReactElement} element Element that requires a key.
|
3875
|
+
* @param {*} parentType element's parent's type.
|
3876
|
+
*/
|
3877
|
+
|
3878
|
+
|
3879
|
+
function validateExplicitKey(element, parentType) {
|
3880
|
+
{
|
3881
|
+
if (!element._store || element._store.validated || element.key != null) {
|
3882
|
+
return;
|
3883
|
+
}
|
3884
|
+
|
3885
|
+
element._store.validated = true;
|
3886
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
3887
|
+
|
3888
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
3889
|
+
return;
|
3890
|
+
}
|
3891
|
+
|
3892
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
3893
|
+
// property, it may be the creator of the child that's responsible for
|
3894
|
+
// assigning it a key.
|
3895
|
+
|
3896
|
+
var childOwner = '';
|
3897
|
+
|
3898
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
3899
|
+
// Give the component that originally created this child.
|
3900
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
3901
|
+
}
|
3902
|
+
|
3903
|
+
setCurrentlyValidatingElement$1(element);
|
3904
|
+
|
3905
|
+
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);
|
3906
|
+
|
3907
|
+
setCurrentlyValidatingElement$1(null);
|
3908
|
+
}
|
3909
|
+
}
|
3910
|
+
/**
|
3911
|
+
* Ensure that every element either is passed in a static location, in an
|
3912
|
+
* array with an explicit keys property defined, or in an object literal
|
3913
|
+
* with valid key property.
|
3914
|
+
*
|
3915
|
+
* @internal
|
3916
|
+
* @param {ReactNode} node Statically passed child of any type.
|
3917
|
+
* @param {*} parentType node's parent's type.
|
3918
|
+
*/
|
3919
|
+
|
3920
|
+
|
3921
|
+
function validateChildKeys(node, parentType) {
|
3922
|
+
{
|
3923
|
+
if (typeof node !== 'object') {
|
3924
|
+
return;
|
3925
|
+
}
|
3926
|
+
|
3927
|
+
if (isArray(node)) {
|
3928
|
+
for (var i = 0; i < node.length; i++) {
|
3929
|
+
var child = node[i];
|
3930
|
+
|
3931
|
+
if (isValidElement(child)) {
|
3932
|
+
validateExplicitKey(child, parentType);
|
3933
|
+
}
|
3934
|
+
}
|
3935
|
+
} else if (isValidElement(node)) {
|
3936
|
+
// This element was passed in a valid location.
|
3937
|
+
if (node._store) {
|
3938
|
+
node._store.validated = true;
|
3939
|
+
}
|
3940
|
+
} else if (node) {
|
3941
|
+
var iteratorFn = getIteratorFn(node);
|
3942
|
+
|
3943
|
+
if (typeof iteratorFn === 'function') {
|
3944
|
+
// Entry iterators used to provide implicit keys,
|
3945
|
+
// but now we print a separate warning for them later.
|
3946
|
+
if (iteratorFn !== node.entries) {
|
3947
|
+
var iterator = iteratorFn.call(node);
|
3948
|
+
var step;
|
3949
|
+
|
3950
|
+
while (!(step = iterator.next()).done) {
|
3951
|
+
if (isValidElement(step.value)) {
|
3952
|
+
validateExplicitKey(step.value, parentType);
|
3953
|
+
}
|
3954
|
+
}
|
3955
|
+
}
|
3956
|
+
}
|
3957
|
+
}
|
3958
|
+
}
|
3959
|
+
}
|
3960
|
+
/**
|
3961
|
+
* Given an element, validate that its props follow the propTypes definition,
|
3962
|
+
* provided by the type.
|
3963
|
+
*
|
3964
|
+
* @param {ReactElement} element
|
3965
|
+
*/
|
3966
|
+
|
3967
|
+
|
3968
|
+
function validatePropTypes(element) {
|
3969
|
+
{
|
3970
|
+
var type = element.type;
|
3971
|
+
|
3972
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
3973
|
+
return;
|
3974
|
+
}
|
3975
|
+
|
3976
|
+
var propTypes;
|
3977
|
+
|
3978
|
+
if (typeof type === 'function') {
|
3979
|
+
propTypes = type.propTypes;
|
3980
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
3981
|
+
// Inner props are checked in the reconciler.
|
3982
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
3983
|
+
propTypes = type.propTypes;
|
3984
|
+
} else {
|
3985
|
+
return;
|
3986
|
+
}
|
3987
|
+
|
3988
|
+
if (propTypes) {
|
3989
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
3990
|
+
var name = getComponentNameFromType(type);
|
3991
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
3992
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
3993
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
3994
|
+
|
3995
|
+
var _name = getComponentNameFromType(type);
|
3996
|
+
|
3997
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
3998
|
+
}
|
3999
|
+
|
4000
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
4001
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
4002
|
+
}
|
4003
|
+
}
|
4004
|
+
}
|
4005
|
+
/**
|
4006
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
4007
|
+
* @param {ReactElement} fragment
|
4008
|
+
*/
|
4009
|
+
|
4010
|
+
|
4011
|
+
function validateFragmentProps(fragment) {
|
4012
|
+
{
|
4013
|
+
var keys = Object.keys(fragment.props);
|
4014
|
+
|
4015
|
+
for (var i = 0; i < keys.length; i++) {
|
4016
|
+
var key = keys[i];
|
4017
|
+
|
4018
|
+
if (key !== 'children' && key !== 'key') {
|
4019
|
+
setCurrentlyValidatingElement$1(fragment);
|
4020
|
+
|
4021
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
4022
|
+
|
4023
|
+
setCurrentlyValidatingElement$1(null);
|
4024
|
+
break;
|
4025
|
+
}
|
4026
|
+
}
|
4027
|
+
|
4028
|
+
if (fragment.ref !== null) {
|
4029
|
+
setCurrentlyValidatingElement$1(fragment);
|
4030
|
+
|
4031
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
4032
|
+
|
4033
|
+
setCurrentlyValidatingElement$1(null);
|
4034
|
+
}
|
4035
|
+
}
|
4036
|
+
}
|
4037
|
+
|
4038
|
+
var didWarnAboutKeySpread = {};
|
4039
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
4040
|
+
{
|
4041
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
4042
|
+
// succeed and there will likely be errors in render.
|
4043
|
+
|
4044
|
+
if (!validType) {
|
4045
|
+
var info = '';
|
4046
|
+
|
4047
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
4048
|
+
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.";
|
4049
|
+
}
|
4050
|
+
|
4051
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
4052
|
+
|
4053
|
+
if (sourceInfo) {
|
4054
|
+
info += sourceInfo;
|
4055
|
+
} else {
|
4056
|
+
info += getDeclarationErrorAddendum();
|
4057
|
+
}
|
4058
|
+
|
4059
|
+
var typeString;
|
4060
|
+
|
4061
|
+
if (type === null) {
|
4062
|
+
typeString = 'null';
|
4063
|
+
} else if (isArray(type)) {
|
4064
|
+
typeString = 'array';
|
4065
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
4066
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
4067
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
4068
|
+
} else {
|
4069
|
+
typeString = typeof type;
|
4070
|
+
}
|
4071
|
+
|
4072
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
4073
|
+
}
|
4074
|
+
|
4075
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
4076
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
4077
|
+
|
4078
|
+
if (element == null) {
|
4079
|
+
return element;
|
4080
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
4081
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
4082
|
+
// We don't want exception behavior to differ between dev and prod.
|
4083
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
4084
|
+
// fixed, the key warnings will appear.)
|
4085
|
+
|
4086
|
+
|
4087
|
+
if (validType) {
|
4088
|
+
var children = props.children;
|
4089
|
+
|
4090
|
+
if (children !== undefined) {
|
4091
|
+
if (isStaticChildren) {
|
4092
|
+
if (isArray(children)) {
|
4093
|
+
for (var i = 0; i < children.length; i++) {
|
4094
|
+
validateChildKeys(children[i], type);
|
4095
|
+
}
|
4096
|
+
|
4097
|
+
if (Object.freeze) {
|
4098
|
+
Object.freeze(children);
|
4099
|
+
}
|
4100
|
+
} else {
|
4101
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
4102
|
+
}
|
4103
|
+
} else {
|
4104
|
+
validateChildKeys(children, type);
|
4105
|
+
}
|
4106
|
+
}
|
4107
|
+
}
|
4108
|
+
|
4109
|
+
{
|
4110
|
+
if (hasOwnProperty.call(props, 'key')) {
|
4111
|
+
var componentName = getComponentNameFromType(type);
|
4112
|
+
var keys = Object.keys(props).filter(function (k) {
|
4113
|
+
return k !== 'key';
|
4114
|
+
});
|
4115
|
+
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
4116
|
+
|
4117
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
4118
|
+
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
4119
|
+
|
4120
|
+
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
4121
|
+
|
4122
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
4123
|
+
}
|
4124
|
+
}
|
4125
|
+
}
|
4126
|
+
|
4127
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
4128
|
+
validateFragmentProps(element);
|
4129
|
+
} else {
|
4130
|
+
validatePropTypes(element);
|
4131
|
+
}
|
4132
|
+
|
4133
|
+
return element;
|
4134
|
+
}
|
4135
|
+
} // These two functions exist to still get child warnings in dev
|
4136
|
+
// even with the prod transform. This means that jsxDEV is purely
|
4137
|
+
// opt-in behavior for better messages but that we won't stop
|
4138
|
+
// giving you warnings if you use production apis.
|
4139
|
+
|
4140
|
+
function jsxWithValidationStatic(type, props, key) {
|
4141
|
+
{
|
4142
|
+
return jsxWithValidation(type, props, key, true);
|
4143
|
+
}
|
4144
|
+
}
|
4145
|
+
function jsxWithValidationDynamic(type, props, key) {
|
4146
|
+
{
|
4147
|
+
return jsxWithValidation(type, props, key, false);
|
4148
|
+
}
|
4149
|
+
}
|
4150
|
+
|
4151
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
4152
|
+
// for now we can ship identical prod functions
|
4153
|
+
|
4154
|
+
var jsxs = jsxWithValidationStatic ;
|
4155
|
+
|
4156
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
4157
|
+
reactJsxRuntime_development.jsx = jsx;
|
4158
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
4159
|
+
})();
|
4160
|
+
}
|
4161
|
+
return reactJsxRuntime_development;
|
4162
|
+
}
|
4163
|
+
|
4164
|
+
if (process.env.NODE_ENV === 'production') {
|
4165
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
4166
|
+
} else {
|
4167
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
4168
|
+
}
|
4169
|
+
|
4170
|
+
var jsxRuntimeExports = jsxRuntime.exports;
|
4171
|
+
|
4172
|
+
function styleInject(css, ref) {
|
4173
|
+
if ( ref === void 0 ) ref = {};
|
4174
|
+
var insertAt = ref.insertAt;
|
4175
|
+
|
4176
|
+
if (typeof document === 'undefined') { return; }
|
4177
|
+
|
4178
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
4179
|
+
var style = document.createElement('style');
|
4180
|
+
style.type = 'text/css';
|
4181
|
+
|
4182
|
+
if (insertAt === 'top') {
|
4183
|
+
if (head.firstChild) {
|
4184
|
+
head.insertBefore(style, head.firstChild);
|
4185
|
+
} else {
|
4186
|
+
head.appendChild(style);
|
4187
|
+
}
|
4188
|
+
} else {
|
4189
|
+
head.appendChild(style);
|
4190
|
+
}
|
4191
|
+
|
4192
|
+
if (style.styleSheet) {
|
4193
|
+
style.styleSheet.cssText = css;
|
4194
|
+
} else {
|
4195
|
+
style.appendChild(document.createTextNode(css));
|
4196
|
+
}
|
4197
|
+
}
|
4198
|
+
|
4199
|
+
var css_248z = "button {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n padding-left: 1rem;\n padding-right: 1rem;\n border-radius: 0.75rem;\n border-width: 1px;\n text-align: center;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n}\n\nbutton:hover {\n box-shadow:\n 0 4px 6px -1px rgba(0, 0, 0, 0.1),\n 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n filter: brightness(1.25);\n}\n\nbutton:disabled {\n background-color: #737373;\n border-color: #737373;\n color: #e5e5e5;\n cursor: not-allowed;\n}\n";
|
4200
|
+
styleInject(css_248z);
|
4201
|
+
|
4202
|
+
const Button = ({ variant, ...props }) => {
|
4203
|
+
const styles = () => {
|
4204
|
+
const propStyle = props.style ?? {};
|
4205
|
+
if (props.disabled)
|
4206
|
+
return propStyle;
|
4207
|
+
if (variant === "primary")
|
4208
|
+
return {
|
4209
|
+
borderColor: "#6366F1",
|
4210
|
+
backgroundColor: "#6366F1",
|
4211
|
+
color: "#FAFAFA",
|
4212
|
+
...propStyle,
|
4213
|
+
};
|
4214
|
+
if (variant === "secondary")
|
4215
|
+
return {
|
4216
|
+
borderColor: "#6366F1",
|
4217
|
+
backgroundColor: "#FAFAFA",
|
4218
|
+
color: "#6366F1",
|
4219
|
+
...propStyle,
|
4220
|
+
};
|
4221
|
+
return propStyle;
|
4222
|
+
};
|
4223
|
+
return (jsxRuntimeExports.jsx("button", { ...props, style: styles(), children: props.children }));
|
4224
|
+
};
|
4225
|
+
|
4226
|
+
const Input = () => {
|
4227
|
+
return jsxRuntimeExports.jsx("div", { children: "Input" });
|
4228
|
+
};
|
4229
|
+
|
4230
|
+
export { Button, Input };
|
4231
|
+
//# sourceMappingURL=index.js.map
|