@bcrumbs.net/bc-shared 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +60 -2876
- package/package.json +6 -8
- package/src/lib/services/auth/index.d.ts +0 -2
package/index.esm.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import * as ReactJSXRuntime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { forwardRef, useContext, Component } from 'react';
|
|
2
4
|
import i18n from 'i18next';
|
|
3
5
|
import { initReactI18next } from 'react-i18next';
|
|
4
6
|
import Backend from 'i18next-http-backend';
|
|
5
|
-
import decode from 'jwt-decode';
|
|
6
|
-
import { isAfter } from 'date-fns';
|
|
7
|
-
|
|
8
|
-
function _mergeNamespaces(n, m) {
|
|
9
|
-
m.forEach(function (e) {
|
|
10
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default' && !(k in n)) {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
7
|
|
|
23
8
|
const Dashboard = '/dashboard';
|
|
24
9
|
const AccountPortalRoot = '/account';
|
|
@@ -1195,2809 +1180,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
1195
1180
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1196
1181
|
};
|
|
1197
1182
|
|
|
1198
|
-
var react = {exports: {}};
|
|
1199
|
-
|
|
1200
|
-
var react_production_min = {};
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* @license React
|
|
1204
|
-
* react.production.min.js
|
|
1205
|
-
*
|
|
1206
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1207
|
-
*
|
|
1208
|
-
* This source code is licensed under the MIT license found in the
|
|
1209
|
-
* LICENSE file in the root directory of this source tree.
|
|
1210
|
-
*/
|
|
1211
|
-
|
|
1212
|
-
var hasRequiredReact_production_min;
|
|
1213
|
-
|
|
1214
|
-
function requireReact_production_min () {
|
|
1215
|
-
if (hasRequiredReact_production_min) return react_production_min;
|
|
1216
|
-
hasRequiredReact_production_min = 1;
|
|
1217
|
-
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}
|
|
1218
|
-
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={};
|
|
1219
|
-
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;
|
|
1220
|
-
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};
|
|
1221
|
-
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}}
|
|
1222
|
-
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)}
|
|
1223
|
-
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=
|
|
1224
|
-
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}
|
|
1225
|
-
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;}
|
|
1226
|
-
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.");}
|
|
1227
|
-
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;
|
|
1228
|
-
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;react_production_min.act=X;
|
|
1229
|
-
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);
|
|
1230
|
-
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}};
|
|
1231
|
-
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)};
|
|
1232
|
-
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)};
|
|
1233
|
-
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";
|
|
1234
|
-
return react_production_min;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
var react_development = {exports: {}};
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* @license React
|
|
1241
|
-
* react.development.js
|
|
1242
|
-
*
|
|
1243
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1244
|
-
*
|
|
1245
|
-
* This source code is licensed under the MIT license found in the
|
|
1246
|
-
* LICENSE file in the root directory of this source tree.
|
|
1247
|
-
*/
|
|
1248
|
-
react_development.exports;
|
|
1249
|
-
|
|
1250
|
-
var hasRequiredReact_development;
|
|
1251
|
-
|
|
1252
|
-
function requireReact_development () {
|
|
1253
|
-
if (hasRequiredReact_development) return react_development.exports;
|
|
1254
|
-
hasRequiredReact_development = 1;
|
|
1255
|
-
(function (module, exports) {
|
|
1256
|
-
|
|
1257
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1258
|
-
(function() {
|
|
1259
|
-
|
|
1260
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
1261
|
-
if (
|
|
1262
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
1263
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
1264
|
-
'function'
|
|
1265
|
-
) {
|
|
1266
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1267
|
-
}
|
|
1268
|
-
var ReactVersion = '18.3.1';
|
|
1269
|
-
|
|
1270
|
-
// ATTENTION
|
|
1271
|
-
// When adding new symbols to this file,
|
|
1272
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
1273
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
1274
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
1275
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
1276
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
1277
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
1278
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
1279
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
1280
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
1281
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
1282
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
1283
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
1284
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
1285
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
1286
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
1287
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
1288
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
1289
|
-
function getIteratorFn(maybeIterable) {
|
|
1290
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
1291
|
-
return null;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
1295
|
-
|
|
1296
|
-
if (typeof maybeIterator === 'function') {
|
|
1297
|
-
return maybeIterator;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
return null;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* Keeps track of the current dispatcher.
|
|
1305
|
-
*/
|
|
1306
|
-
var ReactCurrentDispatcher = {
|
|
1307
|
-
/**
|
|
1308
|
-
* @internal
|
|
1309
|
-
* @type {ReactComponent}
|
|
1310
|
-
*/
|
|
1311
|
-
current: null
|
|
1312
|
-
};
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
1316
|
-
* should suspend for if it needs to.
|
|
1317
|
-
*/
|
|
1318
|
-
var ReactCurrentBatchConfig = {
|
|
1319
|
-
transition: null
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
|
-
var ReactCurrentActQueue = {
|
|
1323
|
-
current: null,
|
|
1324
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
1325
|
-
isBatchingLegacy: false,
|
|
1326
|
-
didScheduleLegacyUpdate: false
|
|
1327
|
-
};
|
|
1328
|
-
|
|
1329
|
-
/**
|
|
1330
|
-
* Keeps track of the current owner.
|
|
1331
|
-
*
|
|
1332
|
-
* The current owner is the component who should own any components that are
|
|
1333
|
-
* currently being constructed.
|
|
1334
|
-
*/
|
|
1335
|
-
var ReactCurrentOwner = {
|
|
1336
|
-
/**
|
|
1337
|
-
* @internal
|
|
1338
|
-
* @type {ReactComponent}
|
|
1339
|
-
*/
|
|
1340
|
-
current: null
|
|
1341
|
-
};
|
|
1342
|
-
|
|
1343
|
-
var ReactDebugCurrentFrame = {};
|
|
1344
|
-
var currentExtraStackFrame = null;
|
|
1345
|
-
function setExtraStackFrame(stack) {
|
|
1346
|
-
{
|
|
1347
|
-
currentExtraStackFrame = stack;
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
{
|
|
1352
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
1353
|
-
{
|
|
1354
|
-
currentExtraStackFrame = stack;
|
|
1355
|
-
}
|
|
1356
|
-
}; // Stack implementation injected by the current renderer.
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
1360
|
-
|
|
1361
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
1362
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
1363
|
-
|
|
1364
|
-
if (currentExtraStackFrame) {
|
|
1365
|
-
stack += currentExtraStackFrame;
|
|
1366
|
-
} // Delegate to the injected renderer-specific implementation
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
1370
|
-
|
|
1371
|
-
if (impl) {
|
|
1372
|
-
stack += impl() || '';
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
return stack;
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
// -----------------------------------------------------------------------------
|
|
1380
|
-
|
|
1381
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
1382
|
-
var enableCacheElement = false;
|
|
1383
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
1384
|
-
|
|
1385
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
1386
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
1387
|
-
// issues in DEV builds.
|
|
1388
|
-
|
|
1389
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
1390
|
-
|
|
1391
|
-
var ReactSharedInternals = {
|
|
1392
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
1393
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
1394
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
{
|
|
1398
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
1399
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
// by calls to these methods by a Babel plugin.
|
|
1403
|
-
//
|
|
1404
|
-
// In PROD (or in packages without access to React internals),
|
|
1405
|
-
// they are left as they are instead.
|
|
1406
|
-
|
|
1407
|
-
function warn(format) {
|
|
1408
|
-
{
|
|
1409
|
-
{
|
|
1410
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1411
|
-
args[_key - 1] = arguments[_key];
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
printWarning('warn', format, args);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
function error(format) {
|
|
1419
|
-
{
|
|
1420
|
-
{
|
|
1421
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1422
|
-
args[_key2 - 1] = arguments[_key2];
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
printWarning('error', format, args);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
function printWarning(level, format, args) {
|
|
1431
|
-
// When changing this logic, you might want to also
|
|
1432
|
-
// update consoleWithStackDev.www.js as well.
|
|
1433
|
-
{
|
|
1434
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1435
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1436
|
-
|
|
1437
|
-
if (stack !== '') {
|
|
1438
|
-
format += '%s';
|
|
1439
|
-
args = args.concat([stack]);
|
|
1440
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
var argsWithFormat = args.map(function (item) {
|
|
1444
|
-
return String(item);
|
|
1445
|
-
}); // Careful: RN currently depends on this prefix
|
|
1446
|
-
|
|
1447
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
1448
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
1449
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
1450
|
-
|
|
1451
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
1456
|
-
|
|
1457
|
-
function warnNoop(publicInstance, callerName) {
|
|
1458
|
-
{
|
|
1459
|
-
var _constructor = publicInstance.constructor;
|
|
1460
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
1461
|
-
var warningKey = componentName + "." + callerName;
|
|
1462
|
-
|
|
1463
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
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);
|
|
1468
|
-
|
|
1469
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* This is the abstract API for an update queue.
|
|
1474
|
-
*/
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
var ReactNoopUpdateQueue = {
|
|
1478
|
-
/**
|
|
1479
|
-
* Checks whether or not this composite component is mounted.
|
|
1480
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
1481
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
1482
|
-
* @protected
|
|
1483
|
-
* @final
|
|
1484
|
-
*/
|
|
1485
|
-
isMounted: function (publicInstance) {
|
|
1486
|
-
return false;
|
|
1487
|
-
},
|
|
1488
|
-
|
|
1489
|
-
/**
|
|
1490
|
-
* Forces an update. This should only be invoked when it is known with
|
|
1491
|
-
* certainty that we are **not** in a DOM transaction.
|
|
1492
|
-
*
|
|
1493
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
1494
|
-
* component's state has changed but `setState` was not called.
|
|
1495
|
-
*
|
|
1496
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
1497
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
1498
|
-
*
|
|
1499
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
1500
|
-
* @param {?function} callback Called after component is updated.
|
|
1501
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
1502
|
-
* @internal
|
|
1503
|
-
*/
|
|
1504
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
1505
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
1506
|
-
},
|
|
1507
|
-
|
|
1508
|
-
/**
|
|
1509
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
1510
|
-
* You should treat `this.state` as immutable.
|
|
1511
|
-
*
|
|
1512
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
1513
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
1514
|
-
*
|
|
1515
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
1516
|
-
* @param {object} completeState Next state.
|
|
1517
|
-
* @param {?function} callback Called after component is updated.
|
|
1518
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
1519
|
-
* @internal
|
|
1520
|
-
*/
|
|
1521
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
1522
|
-
warnNoop(publicInstance, 'replaceState');
|
|
1523
|
-
},
|
|
1524
|
-
|
|
1525
|
-
/**
|
|
1526
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
1527
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
1528
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
1529
|
-
* during the merge.
|
|
1530
|
-
*
|
|
1531
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
1532
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
1533
|
-
* @param {?function} callback Called after component is updated.
|
|
1534
|
-
* @param {?string} Name of the calling function in the public API.
|
|
1535
|
-
* @internal
|
|
1536
|
-
*/
|
|
1537
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
1538
|
-
warnNoop(publicInstance, 'setState');
|
|
1539
|
-
}
|
|
1540
|
-
};
|
|
1541
|
-
|
|
1542
|
-
var assign = Object.assign;
|
|
1543
|
-
|
|
1544
|
-
var emptyObject = {};
|
|
1545
|
-
|
|
1546
|
-
{
|
|
1547
|
-
Object.freeze(emptyObject);
|
|
1548
|
-
}
|
|
1549
|
-
/**
|
|
1550
|
-
* Base class helpers for the updating state of a component.
|
|
1551
|
-
*/
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
function Component(props, context, updater) {
|
|
1555
|
-
this.props = props;
|
|
1556
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
1557
|
-
|
|
1558
|
-
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
1559
|
-
// renderer.
|
|
1560
|
-
|
|
1561
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
Component.prototype.isReactComponent = {};
|
|
1565
|
-
/**
|
|
1566
|
-
* Sets a subset of the state. Always use this to mutate
|
|
1567
|
-
* state. You should treat `this.state` as immutable.
|
|
1568
|
-
*
|
|
1569
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
1570
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
1571
|
-
*
|
|
1572
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
1573
|
-
* as they may eventually be batched together. You can provide an optional
|
|
1574
|
-
* callback that will be executed when the call to setState is actually
|
|
1575
|
-
* completed.
|
|
1576
|
-
*
|
|
1577
|
-
* When a function is provided to setState, it will be called at some point in
|
|
1578
|
-
* the future (not synchronously). It will be called with the up to date
|
|
1579
|
-
* component arguments (state, props, context). These values can be different
|
|
1580
|
-
* from this.* because your function may be called after receiveProps but before
|
|
1581
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
1582
|
-
* assigned to this.
|
|
1583
|
-
*
|
|
1584
|
-
* @param {object|function} partialState Next partial state or function to
|
|
1585
|
-
* produce next partial state to be merged with current state.
|
|
1586
|
-
* @param {?function} callback Called after state is updated.
|
|
1587
|
-
* @final
|
|
1588
|
-
* @protected
|
|
1589
|
-
*/
|
|
1590
|
-
|
|
1591
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
1592
|
-
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
|
1593
|
-
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
1597
|
-
};
|
|
1598
|
-
/**
|
|
1599
|
-
* Forces an update. This should only be invoked when it is known with
|
|
1600
|
-
* certainty that we are **not** in a DOM transaction.
|
|
1601
|
-
*
|
|
1602
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
1603
|
-
* component's state has changed but `setState` was not called.
|
|
1604
|
-
*
|
|
1605
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
1606
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
1607
|
-
*
|
|
1608
|
-
* @param {?function} callback Called after update is complete.
|
|
1609
|
-
* @final
|
|
1610
|
-
* @protected
|
|
1611
|
-
*/
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
1615
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
1616
|
-
};
|
|
1617
|
-
/**
|
|
1618
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
1619
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
1620
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
1621
|
-
*/
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
{
|
|
1625
|
-
var deprecatedAPIs = {
|
|
1626
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
1627
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
1631
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
1632
|
-
get: function () {
|
|
1633
|
-
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
1634
|
-
|
|
1635
|
-
return undefined;
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
for (var fnName in deprecatedAPIs) {
|
|
1641
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
1642
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
function ComponentDummy() {}
|
|
1648
|
-
|
|
1649
|
-
ComponentDummy.prototype = Component.prototype;
|
|
1650
|
-
/**
|
|
1651
|
-
* Convenience component with default shallow equality check for sCU.
|
|
1652
|
-
*/
|
|
1653
|
-
|
|
1654
|
-
function PureComponent(props, context, updater) {
|
|
1655
|
-
this.props = props;
|
|
1656
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
1657
|
-
|
|
1658
|
-
this.refs = emptyObject;
|
|
1659
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
1663
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
1664
|
-
|
|
1665
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
1666
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
1667
|
-
|
|
1668
|
-
// an immutable object with a single mutable value
|
|
1669
|
-
function createRef() {
|
|
1670
|
-
var refObject = {
|
|
1671
|
-
current: null
|
|
1672
|
-
};
|
|
1673
|
-
|
|
1674
|
-
{
|
|
1675
|
-
Object.seal(refObject);
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
return refObject;
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
1682
|
-
|
|
1683
|
-
function isArray(a) {
|
|
1684
|
-
return isArrayImpl(a);
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
/*
|
|
1688
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
1689
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
1690
|
-
*
|
|
1691
|
-
* The functions in this module will throw an easier-to-understand,
|
|
1692
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
1693
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
1694
|
-
* of the `value` object).
|
|
1695
|
-
*/
|
|
1696
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
1697
|
-
function typeName(value) {
|
|
1698
|
-
{
|
|
1699
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
1700
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
1701
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
1702
|
-
return type;
|
|
1703
|
-
}
|
|
1704
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
function willCoercionThrow(value) {
|
|
1708
|
-
{
|
|
1709
|
-
try {
|
|
1710
|
-
testStringCoercion(value);
|
|
1711
|
-
return false;
|
|
1712
|
-
} catch (e) {
|
|
1713
|
-
return true;
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
function testStringCoercion(value) {
|
|
1719
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
1720
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
1721
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
1722
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
1723
|
-
//
|
|
1724
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
1725
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
1726
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
1727
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
1728
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
1729
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
1730
|
-
//
|
|
1731
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
1732
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
1733
|
-
//
|
|
1734
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
1735
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
1736
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
1737
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
1738
|
-
// In most cases, this console output also shows the component and its
|
|
1739
|
-
// ancestor components where the exception happened.
|
|
1740
|
-
//
|
|
1741
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1742
|
-
return '' + value;
|
|
1743
|
-
}
|
|
1744
|
-
function checkKeyStringCoercion(value) {
|
|
1745
|
-
{
|
|
1746
|
-
if (willCoercionThrow(value)) {
|
|
1747
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
1748
|
-
|
|
1749
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
1755
|
-
var displayName = outerType.displayName;
|
|
1756
|
-
|
|
1757
|
-
if (displayName) {
|
|
1758
|
-
return displayName;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
1762
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
1763
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
function getContextName(type) {
|
|
1767
|
-
return type.displayName || 'Context';
|
|
1768
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
function getComponentNameFromType(type) {
|
|
1772
|
-
if (type == null) {
|
|
1773
|
-
// Host root, text node or just invalid type.
|
|
1774
|
-
return null;
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
{
|
|
1778
|
-
if (typeof type.tag === 'number') {
|
|
1779
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
if (typeof type === 'function') {
|
|
1784
|
-
return type.displayName || type.name || null;
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
if (typeof type === 'string') {
|
|
1788
|
-
return type;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
switch (type) {
|
|
1792
|
-
case REACT_FRAGMENT_TYPE:
|
|
1793
|
-
return 'Fragment';
|
|
1794
|
-
|
|
1795
|
-
case REACT_PORTAL_TYPE:
|
|
1796
|
-
return 'Portal';
|
|
1797
|
-
|
|
1798
|
-
case REACT_PROFILER_TYPE:
|
|
1799
|
-
return 'Profiler';
|
|
1800
|
-
|
|
1801
|
-
case REACT_STRICT_MODE_TYPE:
|
|
1802
|
-
return 'StrictMode';
|
|
1803
|
-
|
|
1804
|
-
case REACT_SUSPENSE_TYPE:
|
|
1805
|
-
return 'Suspense';
|
|
1806
|
-
|
|
1807
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
1808
|
-
return 'SuspenseList';
|
|
1809
|
-
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
if (typeof type === 'object') {
|
|
1813
|
-
switch (type.$$typeof) {
|
|
1814
|
-
case REACT_CONTEXT_TYPE:
|
|
1815
|
-
var context = type;
|
|
1816
|
-
return getContextName(context) + '.Consumer';
|
|
1817
|
-
|
|
1818
|
-
case REACT_PROVIDER_TYPE:
|
|
1819
|
-
var provider = type;
|
|
1820
|
-
return getContextName(provider._context) + '.Provider';
|
|
1821
|
-
|
|
1822
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1823
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
1824
|
-
|
|
1825
|
-
case REACT_MEMO_TYPE:
|
|
1826
|
-
var outerName = type.displayName || null;
|
|
1827
|
-
|
|
1828
|
-
if (outerName !== null) {
|
|
1829
|
-
return outerName;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
1833
|
-
|
|
1834
|
-
case REACT_LAZY_TYPE:
|
|
1835
|
-
{
|
|
1836
|
-
var lazyComponent = type;
|
|
1837
|
-
var payload = lazyComponent._payload;
|
|
1838
|
-
var init = lazyComponent._init;
|
|
1839
|
-
|
|
1840
|
-
try {
|
|
1841
|
-
return getComponentNameFromType(init(payload));
|
|
1842
|
-
} catch (x) {
|
|
1843
|
-
return null;
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
// eslint-disable-next-line no-fallthrough
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
return null;
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1855
|
-
|
|
1856
|
-
var RESERVED_PROPS = {
|
|
1857
|
-
key: true,
|
|
1858
|
-
ref: true,
|
|
1859
|
-
__self: true,
|
|
1860
|
-
__source: true
|
|
1861
|
-
};
|
|
1862
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
1863
|
-
|
|
1864
|
-
{
|
|
1865
|
-
didWarnAboutStringRefs = {};
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
function hasValidRef(config) {
|
|
1869
|
-
{
|
|
1870
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
1871
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1872
|
-
|
|
1873
|
-
if (getter && getter.isReactWarning) {
|
|
1874
|
-
return false;
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
return config.ref !== undefined;
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
function hasValidKey(config) {
|
|
1883
|
-
{
|
|
1884
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
1885
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1886
|
-
|
|
1887
|
-
if (getter && getter.isReactWarning) {
|
|
1888
|
-
return false;
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
return config.key !== undefined;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
1897
|
-
var warnAboutAccessingKey = function () {
|
|
1898
|
-
{
|
|
1899
|
-
if (!specialPropKeyWarningShown) {
|
|
1900
|
-
specialPropKeyWarningShown = true;
|
|
1901
|
-
|
|
1902
|
-
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);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
|
|
1907
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
1908
|
-
Object.defineProperty(props, 'key', {
|
|
1909
|
-
get: warnAboutAccessingKey,
|
|
1910
|
-
configurable: true
|
|
1911
|
-
});
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
1915
|
-
var warnAboutAccessingRef = function () {
|
|
1916
|
-
{
|
|
1917
|
-
if (!specialPropRefWarningShown) {
|
|
1918
|
-
specialPropRefWarningShown = true;
|
|
1919
|
-
|
|
1920
|
-
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);
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
|
|
1925
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
1926
|
-
Object.defineProperty(props, 'ref', {
|
|
1927
|
-
get: warnAboutAccessingRef,
|
|
1928
|
-
configurable: true
|
|
1929
|
-
});
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
1933
|
-
{
|
|
1934
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
1935
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
1936
|
-
|
|
1937
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
1938
|
-
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);
|
|
1939
|
-
|
|
1940
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
1947
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1948
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1949
|
-
* if something is a React Element.
|
|
1950
|
-
*
|
|
1951
|
-
* @param {*} type
|
|
1952
|
-
* @param {*} props
|
|
1953
|
-
* @param {*} key
|
|
1954
|
-
* @param {string|object} ref
|
|
1955
|
-
* @param {*} owner
|
|
1956
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1957
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
1958
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1959
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
1960
|
-
* change in behavior.
|
|
1961
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1962
|
-
* indicating filename, line number, and/or other information.
|
|
1963
|
-
* @internal
|
|
1964
|
-
*/
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
1968
|
-
var element = {
|
|
1969
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
1970
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
1971
|
-
// Built-in properties that belong on the element
|
|
1972
|
-
type: type,
|
|
1973
|
-
key: key,
|
|
1974
|
-
ref: ref,
|
|
1975
|
-
props: props,
|
|
1976
|
-
// Record the component responsible for creating this element.
|
|
1977
|
-
_owner: owner
|
|
1978
|
-
};
|
|
1979
|
-
|
|
1980
|
-
{
|
|
1981
|
-
// The validation flag is currently mutative. We put it on
|
|
1982
|
-
// an external backing store so that we can freeze the whole object.
|
|
1983
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
1984
|
-
// commonly used development environments.
|
|
1985
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1986
|
-
// the validation flag non-enumerable (where possible, which should
|
|
1987
|
-
// include every environment we run tests in), so the test framework
|
|
1988
|
-
// ignores it.
|
|
1989
|
-
|
|
1990
|
-
Object.defineProperty(element._store, 'validated', {
|
|
1991
|
-
configurable: false,
|
|
1992
|
-
enumerable: false,
|
|
1993
|
-
writable: true,
|
|
1994
|
-
value: false
|
|
1995
|
-
}); // self and source are DEV only properties.
|
|
1996
|
-
|
|
1997
|
-
Object.defineProperty(element, '_self', {
|
|
1998
|
-
configurable: false,
|
|
1999
|
-
enumerable: false,
|
|
2000
|
-
writable: false,
|
|
2001
|
-
value: self
|
|
2002
|
-
}); // Two elements created in two different places should be considered
|
|
2003
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
2004
|
-
|
|
2005
|
-
Object.defineProperty(element, '_source', {
|
|
2006
|
-
configurable: false,
|
|
2007
|
-
enumerable: false,
|
|
2008
|
-
writable: false,
|
|
2009
|
-
value: source
|
|
2010
|
-
});
|
|
2011
|
-
|
|
2012
|
-
if (Object.freeze) {
|
|
2013
|
-
Object.freeze(element.props);
|
|
2014
|
-
Object.freeze(element);
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
return element;
|
|
2019
|
-
};
|
|
2020
|
-
/**
|
|
2021
|
-
* Create and return a new ReactElement of the given type.
|
|
2022
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
2023
|
-
*/
|
|
2024
|
-
|
|
2025
|
-
function createElement(type, config, children) {
|
|
2026
|
-
var propName; // Reserved names are extracted
|
|
2027
|
-
|
|
2028
|
-
var props = {};
|
|
2029
|
-
var key = null;
|
|
2030
|
-
var ref = null;
|
|
2031
|
-
var self = null;
|
|
2032
|
-
var source = null;
|
|
2033
|
-
|
|
2034
|
-
if (config != null) {
|
|
2035
|
-
if (hasValidRef(config)) {
|
|
2036
|
-
ref = config.ref;
|
|
2037
|
-
|
|
2038
|
-
{
|
|
2039
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
if (hasValidKey(config)) {
|
|
2044
|
-
{
|
|
2045
|
-
checkKeyStringCoercion(config.key);
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
key = '' + config.key;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
self = config.__self === undefined ? null : config.__self;
|
|
2052
|
-
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
2053
|
-
|
|
2054
|
-
for (propName in config) {
|
|
2055
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
2056
|
-
props[propName] = config[propName];
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
2060
|
-
// the newly allocated props object.
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
var childrenLength = arguments.length - 2;
|
|
2064
|
-
|
|
2065
|
-
if (childrenLength === 1) {
|
|
2066
|
-
props.children = children;
|
|
2067
|
-
} else if (childrenLength > 1) {
|
|
2068
|
-
var childArray = Array(childrenLength);
|
|
2069
|
-
|
|
2070
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
2071
|
-
childArray[i] = arguments[i + 2];
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
{
|
|
2075
|
-
if (Object.freeze) {
|
|
2076
|
-
Object.freeze(childArray);
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
props.children = childArray;
|
|
2081
|
-
} // Resolve default props
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
if (type && type.defaultProps) {
|
|
2085
|
-
var defaultProps = type.defaultProps;
|
|
2086
|
-
|
|
2087
|
-
for (propName in defaultProps) {
|
|
2088
|
-
if (props[propName] === undefined) {
|
|
2089
|
-
props[propName] = defaultProps[propName];
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
{
|
|
2095
|
-
if (key || ref) {
|
|
2096
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
2097
|
-
|
|
2098
|
-
if (key) {
|
|
2099
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
if (ref) {
|
|
2103
|
-
defineRefPropWarningGetter(props, displayName);
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
2109
|
-
}
|
|
2110
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
2111
|
-
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
2112
|
-
return newElement;
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
2116
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
2117
|
-
*/
|
|
2118
|
-
|
|
2119
|
-
function cloneElement(element, config, children) {
|
|
2120
|
-
if (element === null || element === undefined) {
|
|
2121
|
-
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
var propName; // Original props are copied
|
|
2125
|
-
|
|
2126
|
-
var props = assign({}, element.props); // Reserved names are extracted
|
|
2127
|
-
|
|
2128
|
-
var key = element.key;
|
|
2129
|
-
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
2130
|
-
|
|
2131
|
-
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
2132
|
-
// transpiler, and the original source is probably a better indicator of the
|
|
2133
|
-
// true owner.
|
|
2134
|
-
|
|
2135
|
-
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
2136
|
-
|
|
2137
|
-
var owner = element._owner;
|
|
2138
|
-
|
|
2139
|
-
if (config != null) {
|
|
2140
|
-
if (hasValidRef(config)) {
|
|
2141
|
-
// Silently steal the ref from the parent.
|
|
2142
|
-
ref = config.ref;
|
|
2143
|
-
owner = ReactCurrentOwner.current;
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
if (hasValidKey(config)) {
|
|
2147
|
-
{
|
|
2148
|
-
checkKeyStringCoercion(config.key);
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
key = '' + config.key;
|
|
2152
|
-
} // Remaining properties override existing props
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
var defaultProps;
|
|
2156
|
-
|
|
2157
|
-
if (element.type && element.type.defaultProps) {
|
|
2158
|
-
defaultProps = element.type.defaultProps;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
for (propName in config) {
|
|
2162
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
2163
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
2164
|
-
// Resolve default props
|
|
2165
|
-
props[propName] = defaultProps[propName];
|
|
2166
|
-
} else {
|
|
2167
|
-
props[propName] = config[propName];
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
2172
|
-
// the newly allocated props object.
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
var childrenLength = arguments.length - 2;
|
|
2176
|
-
|
|
2177
|
-
if (childrenLength === 1) {
|
|
2178
|
-
props.children = children;
|
|
2179
|
-
} else if (childrenLength > 1) {
|
|
2180
|
-
var childArray = Array(childrenLength);
|
|
2181
|
-
|
|
2182
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
2183
|
-
childArray[i] = arguments[i + 2];
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
props.children = childArray;
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
2190
|
-
}
|
|
2191
|
-
/**
|
|
2192
|
-
* Verifies the object is a ReactElement.
|
|
2193
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
2194
|
-
* @param {?object} object
|
|
2195
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
2196
|
-
* @final
|
|
2197
|
-
*/
|
|
2198
|
-
|
|
2199
|
-
function isValidElement(object) {
|
|
2200
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
var SEPARATOR = '.';
|
|
2204
|
-
var SUBSEPARATOR = ':';
|
|
2205
|
-
/**
|
|
2206
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
2207
|
-
*
|
|
2208
|
-
* @param {string} key to be escaped.
|
|
2209
|
-
* @return {string} the escaped key.
|
|
2210
|
-
*/
|
|
2211
|
-
|
|
2212
|
-
function escape(key) {
|
|
2213
|
-
var escapeRegex = /[=:]/g;
|
|
2214
|
-
var escaperLookup = {
|
|
2215
|
-
'=': '=0',
|
|
2216
|
-
':': '=2'
|
|
2217
|
-
};
|
|
2218
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
2219
|
-
return escaperLookup[match];
|
|
2220
|
-
});
|
|
2221
|
-
return '$' + escapedString;
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
2225
|
-
* pattern.
|
|
2226
|
-
*/
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
var didWarnAboutMaps = false;
|
|
2230
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
2231
|
-
|
|
2232
|
-
function escapeUserProvidedKey(text) {
|
|
2233
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
2234
|
-
}
|
|
2235
|
-
/**
|
|
2236
|
-
* Generate a key string that identifies a element within a set.
|
|
2237
|
-
*
|
|
2238
|
-
* @param {*} element A element that could contain a manual key.
|
|
2239
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
2240
|
-
* @return {string}
|
|
2241
|
-
*/
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
function getElementKey(element, index) {
|
|
2245
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
2246
|
-
// that we don't block potential future ES APIs.
|
|
2247
|
-
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
2248
|
-
// Explicit key
|
|
2249
|
-
{
|
|
2250
|
-
checkKeyStringCoercion(element.key);
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
return escape('' + element.key);
|
|
2254
|
-
} // Implicit key determined by the index in the set
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
return index.toString(36);
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
2261
|
-
var type = typeof children;
|
|
2262
|
-
|
|
2263
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
2264
|
-
// All of the above are perceived as null.
|
|
2265
|
-
children = null;
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
var invokeCallback = false;
|
|
2269
|
-
|
|
2270
|
-
if (children === null) {
|
|
2271
|
-
invokeCallback = true;
|
|
2272
|
-
} else {
|
|
2273
|
-
switch (type) {
|
|
2274
|
-
case 'string':
|
|
2275
|
-
case 'number':
|
|
2276
|
-
invokeCallback = true;
|
|
2277
|
-
break;
|
|
2278
|
-
|
|
2279
|
-
case 'object':
|
|
2280
|
-
switch (children.$$typeof) {
|
|
2281
|
-
case REACT_ELEMENT_TYPE:
|
|
2282
|
-
case REACT_PORTAL_TYPE:
|
|
2283
|
-
invokeCallback = true;
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
if (invokeCallback) {
|
|
2290
|
-
var _child = children;
|
|
2291
|
-
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
2292
|
-
// so that it's consistent if the number of children grows:
|
|
2293
|
-
|
|
2294
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
2295
|
-
|
|
2296
|
-
if (isArray(mappedChild)) {
|
|
2297
|
-
var escapedChildKey = '';
|
|
2298
|
-
|
|
2299
|
-
if (childKey != null) {
|
|
2300
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
2304
|
-
return c;
|
|
2305
|
-
});
|
|
2306
|
-
} else if (mappedChild != null) {
|
|
2307
|
-
if (isValidElement(mappedChild)) {
|
|
2308
|
-
{
|
|
2309
|
-
// The `if` statement here prevents auto-disabling of the safe
|
|
2310
|
-
// coercion ESLint rule, so we must manually disable it below.
|
|
2311
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
2312
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
2313
|
-
checkKeyStringCoercion(mappedChild.key);
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
2318
|
-
// traverseAllChildren used to do for objects as children
|
|
2319
|
-
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
2320
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
2321
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
2322
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
2323
|
-
}
|
|
2324
|
-
|
|
2325
|
-
array.push(mappedChild);
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
return 1;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
var child;
|
|
2332
|
-
var nextName;
|
|
2333
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
2334
|
-
|
|
2335
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
2336
|
-
|
|
2337
|
-
if (isArray(children)) {
|
|
2338
|
-
for (var i = 0; i < children.length; i++) {
|
|
2339
|
-
child = children[i];
|
|
2340
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
2341
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
2342
|
-
}
|
|
2343
|
-
} else {
|
|
2344
|
-
var iteratorFn = getIteratorFn(children);
|
|
2345
|
-
|
|
2346
|
-
if (typeof iteratorFn === 'function') {
|
|
2347
|
-
var iterableChildren = children;
|
|
2348
|
-
|
|
2349
|
-
{
|
|
2350
|
-
// Warn about using Maps as children
|
|
2351
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
2352
|
-
if (!didWarnAboutMaps) {
|
|
2353
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
didWarnAboutMaps = true;
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
2361
|
-
var step;
|
|
2362
|
-
var ii = 0;
|
|
2363
|
-
|
|
2364
|
-
while (!(step = iterator.next()).done) {
|
|
2365
|
-
child = step.value;
|
|
2366
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
2367
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
2368
|
-
}
|
|
2369
|
-
} else if (type === 'object') {
|
|
2370
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
2371
|
-
var childrenString = String(children);
|
|
2372
|
-
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.');
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
return subtreeCount;
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
/**
|
|
2380
|
-
* Maps children that are typically specified as `props.children`.
|
|
2381
|
-
*
|
|
2382
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
2383
|
-
*
|
|
2384
|
-
* The provided mapFunction(child, index) will be called for each
|
|
2385
|
-
* leaf child.
|
|
2386
|
-
*
|
|
2387
|
-
* @param {?*} children Children tree container.
|
|
2388
|
-
* @param {function(*, int)} func The map function.
|
|
2389
|
-
* @param {*} context Context for mapFunction.
|
|
2390
|
-
* @return {object} Object containing the ordered map of results.
|
|
2391
|
-
*/
|
|
2392
|
-
function mapChildren(children, func, context) {
|
|
2393
|
-
if (children == null) {
|
|
2394
|
-
return children;
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
var result = [];
|
|
2398
|
-
var count = 0;
|
|
2399
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
2400
|
-
return func.call(context, child, count++);
|
|
2401
|
-
});
|
|
2402
|
-
return result;
|
|
2403
|
-
}
|
|
2404
|
-
/**
|
|
2405
|
-
* Count the number of children that are typically specified as
|
|
2406
|
-
* `props.children`.
|
|
2407
|
-
*
|
|
2408
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
2409
|
-
*
|
|
2410
|
-
* @param {?*} children Children tree container.
|
|
2411
|
-
* @return {number} The number of children.
|
|
2412
|
-
*/
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
function countChildren(children) {
|
|
2416
|
-
var n = 0;
|
|
2417
|
-
mapChildren(children, function () {
|
|
2418
|
-
n++; // Don't return anything
|
|
2419
|
-
});
|
|
2420
|
-
return n;
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
/**
|
|
2424
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
2425
|
-
*
|
|
2426
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
2427
|
-
*
|
|
2428
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
2429
|
-
* leaf child.
|
|
2430
|
-
*
|
|
2431
|
-
* @param {?*} children Children tree container.
|
|
2432
|
-
* @param {function(*, int)} forEachFunc
|
|
2433
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
2434
|
-
*/
|
|
2435
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
2436
|
-
mapChildren(children, function () {
|
|
2437
|
-
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
2438
|
-
}, forEachContext);
|
|
2439
|
-
}
|
|
2440
|
-
/**
|
|
2441
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
2442
|
-
* return an array with appropriately re-keyed children.
|
|
2443
|
-
*
|
|
2444
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
2445
|
-
*/
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
function toArray(children) {
|
|
2449
|
-
return mapChildren(children, function (child) {
|
|
2450
|
-
return child;
|
|
2451
|
-
}) || [];
|
|
2452
|
-
}
|
|
2453
|
-
/**
|
|
2454
|
-
* Returns the first child in a collection of children and verifies that there
|
|
2455
|
-
* is only one child in the collection.
|
|
2456
|
-
*
|
|
2457
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
2458
|
-
*
|
|
2459
|
-
* The current implementation of this function assumes that a single child gets
|
|
2460
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
2461
|
-
* abstract away the particular structure of children.
|
|
2462
|
-
*
|
|
2463
|
-
* @param {?object} children Child collection structure.
|
|
2464
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
2465
|
-
* structure.
|
|
2466
|
-
*/
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
function onlyChild(children) {
|
|
2470
|
-
if (!isValidElement(children)) {
|
|
2471
|
-
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
return children;
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
function createContext(defaultValue) {
|
|
2478
|
-
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
2479
|
-
// function. Warn to reserve for future use?
|
|
2480
|
-
var context = {
|
|
2481
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
2482
|
-
// As a workaround to support multiple concurrent renderers, we categorize
|
|
2483
|
-
// some renderers as primary and others as secondary. We only expect
|
|
2484
|
-
// there to be two concurrent renderers at most: React Native (primary) and
|
|
2485
|
-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
2486
|
-
// Secondary renderers store their context values on separate fields.
|
|
2487
|
-
_currentValue: defaultValue,
|
|
2488
|
-
_currentValue2: defaultValue,
|
|
2489
|
-
// Used to track how many concurrent renderers this context currently
|
|
2490
|
-
// supports within in a single renderer. Such as parallel server rendering.
|
|
2491
|
-
_threadCount: 0,
|
|
2492
|
-
// These are circular
|
|
2493
|
-
Provider: null,
|
|
2494
|
-
Consumer: null,
|
|
2495
|
-
// Add these to use same hidden class in VM as ServerContext
|
|
2496
|
-
_defaultValue: null,
|
|
2497
|
-
_globalName: null
|
|
2498
|
-
};
|
|
2499
|
-
context.Provider = {
|
|
2500
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
2501
|
-
_context: context
|
|
2502
|
-
};
|
|
2503
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
2504
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
2505
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
2506
|
-
|
|
2507
|
-
{
|
|
2508
|
-
// A separate object, but proxies back to the original context object for
|
|
2509
|
-
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
2510
|
-
// warn for the incorrect usage of Context as a Consumer.
|
|
2511
|
-
var Consumer = {
|
|
2512
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
2513
|
-
_context: context
|
|
2514
|
-
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
2515
|
-
|
|
2516
|
-
Object.defineProperties(Consumer, {
|
|
2517
|
-
Provider: {
|
|
2518
|
-
get: function () {
|
|
2519
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
2520
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
2521
|
-
|
|
2522
|
-
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?');
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
|
-
return context.Provider;
|
|
2526
|
-
},
|
|
2527
|
-
set: function (_Provider) {
|
|
2528
|
-
context.Provider = _Provider;
|
|
2529
|
-
}
|
|
2530
|
-
},
|
|
2531
|
-
_currentValue: {
|
|
2532
|
-
get: function () {
|
|
2533
|
-
return context._currentValue;
|
|
2534
|
-
},
|
|
2535
|
-
set: function (_currentValue) {
|
|
2536
|
-
context._currentValue = _currentValue;
|
|
2537
|
-
}
|
|
2538
|
-
},
|
|
2539
|
-
_currentValue2: {
|
|
2540
|
-
get: function () {
|
|
2541
|
-
return context._currentValue2;
|
|
2542
|
-
},
|
|
2543
|
-
set: function (_currentValue2) {
|
|
2544
|
-
context._currentValue2 = _currentValue2;
|
|
2545
|
-
}
|
|
2546
|
-
},
|
|
2547
|
-
_threadCount: {
|
|
2548
|
-
get: function () {
|
|
2549
|
-
return context._threadCount;
|
|
2550
|
-
},
|
|
2551
|
-
set: function (_threadCount) {
|
|
2552
|
-
context._threadCount = _threadCount;
|
|
2553
|
-
}
|
|
2554
|
-
},
|
|
2555
|
-
Consumer: {
|
|
2556
|
-
get: function () {
|
|
2557
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
2558
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
2559
|
-
|
|
2560
|
-
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?');
|
|
2561
|
-
}
|
|
2562
|
-
|
|
2563
|
-
return context.Consumer;
|
|
2564
|
-
}
|
|
2565
|
-
},
|
|
2566
|
-
displayName: {
|
|
2567
|
-
get: function () {
|
|
2568
|
-
return context.displayName;
|
|
2569
|
-
},
|
|
2570
|
-
set: function (displayName) {
|
|
2571
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
2572
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
2573
|
-
|
|
2574
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
2579
|
-
|
|
2580
|
-
context.Consumer = Consumer;
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
{
|
|
2584
|
-
context._currentRenderer = null;
|
|
2585
|
-
context._currentRenderer2 = null;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
return context;
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
|
-
var Uninitialized = -1;
|
|
2592
|
-
var Pending = 0;
|
|
2593
|
-
var Resolved = 1;
|
|
2594
|
-
var Rejected = 2;
|
|
2595
|
-
|
|
2596
|
-
function lazyInitializer(payload) {
|
|
2597
|
-
if (payload._status === Uninitialized) {
|
|
2598
|
-
var ctor = payload._result;
|
|
2599
|
-
var thenable = ctor(); // Transition to the next state.
|
|
2600
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
2601
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
2602
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
2603
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
2604
|
-
|
|
2605
|
-
thenable.then(function (moduleObject) {
|
|
2606
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
2607
|
-
// Transition to the next state.
|
|
2608
|
-
var resolved = payload;
|
|
2609
|
-
resolved._status = Resolved;
|
|
2610
|
-
resolved._result = moduleObject;
|
|
2611
|
-
}
|
|
2612
|
-
}, function (error) {
|
|
2613
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
2614
|
-
// Transition to the next state.
|
|
2615
|
-
var rejected = payload;
|
|
2616
|
-
rejected._status = Rejected;
|
|
2617
|
-
rejected._result = error;
|
|
2618
|
-
}
|
|
2619
|
-
});
|
|
2620
|
-
|
|
2621
|
-
if (payload._status === Uninitialized) {
|
|
2622
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
2623
|
-
// to resolve. Set it as pending in the meantime.
|
|
2624
|
-
var pending = payload;
|
|
2625
|
-
pending._status = Pending;
|
|
2626
|
-
pending._result = thenable;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
if (payload._status === Resolved) {
|
|
2631
|
-
var moduleObject = payload._result;
|
|
2632
|
-
|
|
2633
|
-
{
|
|
2634
|
-
if (moduleObject === undefined) {
|
|
2635
|
-
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.
|
|
2636
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
2637
|
-
}
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
{
|
|
2641
|
-
if (!('default' in moduleObject)) {
|
|
2642
|
-
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.
|
|
2643
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
return moduleObject.default;
|
|
2648
|
-
} else {
|
|
2649
|
-
throw payload._result;
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
function lazy(ctor) {
|
|
2654
|
-
var payload = {
|
|
2655
|
-
// We use these fields to store the result.
|
|
2656
|
-
_status: Uninitialized,
|
|
2657
|
-
_result: ctor
|
|
2658
|
-
};
|
|
2659
|
-
var lazyType = {
|
|
2660
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
2661
|
-
_payload: payload,
|
|
2662
|
-
_init: lazyInitializer
|
|
2663
|
-
};
|
|
2664
|
-
|
|
2665
|
-
{
|
|
2666
|
-
// In production, this would just set it on the object.
|
|
2667
|
-
var defaultProps;
|
|
2668
|
-
var propTypes; // $FlowFixMe
|
|
2669
|
-
|
|
2670
|
-
Object.defineProperties(lazyType, {
|
|
2671
|
-
defaultProps: {
|
|
2672
|
-
configurable: true,
|
|
2673
|
-
get: function () {
|
|
2674
|
-
return defaultProps;
|
|
2675
|
-
},
|
|
2676
|
-
set: function (newDefaultProps) {
|
|
2677
|
-
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.');
|
|
2678
|
-
|
|
2679
|
-
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
2680
|
-
// $FlowFixMe
|
|
2681
|
-
|
|
2682
|
-
Object.defineProperty(lazyType, 'defaultProps', {
|
|
2683
|
-
enumerable: true
|
|
2684
|
-
});
|
|
2685
|
-
}
|
|
2686
|
-
},
|
|
2687
|
-
propTypes: {
|
|
2688
|
-
configurable: true,
|
|
2689
|
-
get: function () {
|
|
2690
|
-
return propTypes;
|
|
2691
|
-
},
|
|
2692
|
-
set: function (newPropTypes) {
|
|
2693
|
-
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.');
|
|
2694
|
-
|
|
2695
|
-
propTypes = newPropTypes; // Match production behavior more closely:
|
|
2696
|
-
// $FlowFixMe
|
|
2697
|
-
|
|
2698
|
-
Object.defineProperty(lazyType, 'propTypes', {
|
|
2699
|
-
enumerable: true
|
|
2700
|
-
});
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
|
|
2706
|
-
return lazyType;
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
function forwardRef(render) {
|
|
2710
|
-
{
|
|
2711
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
2712
|
-
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
2713
|
-
} else if (typeof render !== 'function') {
|
|
2714
|
-
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
2715
|
-
} else {
|
|
2716
|
-
if (render.length !== 0 && render.length !== 2) {
|
|
2717
|
-
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.');
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
if (render != null) {
|
|
2722
|
-
if (render.defaultProps != null || render.propTypes != null) {
|
|
2723
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
var elementType = {
|
|
2729
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
2730
|
-
render: render
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
{
|
|
2734
|
-
var ownName;
|
|
2735
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
2736
|
-
enumerable: false,
|
|
2737
|
-
configurable: true,
|
|
2738
|
-
get: function () {
|
|
2739
|
-
return ownName;
|
|
2740
|
-
},
|
|
2741
|
-
set: function (name) {
|
|
2742
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
2743
|
-
// because the component may be used elsewhere.
|
|
2744
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
2745
|
-
// so that our component-stack generation logic will display their frames.
|
|
2746
|
-
// An anonymous function generally suggests a pattern like:
|
|
2747
|
-
// React.forwardRef((props, ref) => {...});
|
|
2748
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
2749
|
-
|
|
2750
|
-
if (!render.name && !render.displayName) {
|
|
2751
|
-
render.displayName = name;
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
});
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
return elementType;
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
var REACT_MODULE_REFERENCE;
|
|
2761
|
-
|
|
2762
|
-
{
|
|
2763
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
function isValidElementType(type) {
|
|
2767
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
2768
|
-
return true;
|
|
2769
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
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 ) {
|
|
2773
|
-
return true;
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2776
|
-
if (typeof type === 'object' && type !== null) {
|
|
2777
|
-
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
|
|
2778
|
-
// types supported by any Flight configuration anywhere since
|
|
2779
|
-
// we don't know which Flight build this will end up being used
|
|
2780
|
-
// with.
|
|
2781
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
2782
|
-
return true;
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
|
|
2786
|
-
return false;
|
|
2787
|
-
}
|
|
2788
|
-
|
|
2789
|
-
function memo(type, compare) {
|
|
2790
|
-
{
|
|
2791
|
-
if (!isValidElementType(type)) {
|
|
2792
|
-
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
var elementType = {
|
|
2797
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
2798
|
-
type: type,
|
|
2799
|
-
compare: compare === undefined ? null : compare
|
|
2800
|
-
};
|
|
2801
|
-
|
|
2802
|
-
{
|
|
2803
|
-
var ownName;
|
|
2804
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
2805
|
-
enumerable: false,
|
|
2806
|
-
configurable: true,
|
|
2807
|
-
get: function () {
|
|
2808
|
-
return ownName;
|
|
2809
|
-
},
|
|
2810
|
-
set: function (name) {
|
|
2811
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
2812
|
-
// because the component may be used elsewhere.
|
|
2813
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
2814
|
-
// so that our component-stack generation logic will display their frames.
|
|
2815
|
-
// An anonymous function generally suggests a pattern like:
|
|
2816
|
-
// React.memo((props) => {...});
|
|
2817
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
2818
|
-
|
|
2819
|
-
if (!type.name && !type.displayName) {
|
|
2820
|
-
type.displayName = name;
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
});
|
|
2824
|
-
}
|
|
2825
|
-
|
|
2826
|
-
return elementType;
|
|
2827
|
-
}
|
|
2828
|
-
|
|
2829
|
-
function resolveDispatcher() {
|
|
2830
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
2831
|
-
|
|
2832
|
-
{
|
|
2833
|
-
if (dispatcher === null) {
|
|
2834
|
-
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.');
|
|
2835
|
-
}
|
|
2836
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
2837
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
2838
|
-
// Also helps ensure this is inlined.
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
return dispatcher;
|
|
2842
|
-
}
|
|
2843
|
-
function useContext(Context) {
|
|
2844
|
-
var dispatcher = resolveDispatcher();
|
|
2845
|
-
|
|
2846
|
-
{
|
|
2847
|
-
// TODO: add a more generic warning for invalid values.
|
|
2848
|
-
if (Context._context !== undefined) {
|
|
2849
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
2850
|
-
// and nobody should be using this in existing code.
|
|
2851
|
-
|
|
2852
|
-
if (realContext.Consumer === Context) {
|
|
2853
|
-
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?');
|
|
2854
|
-
} else if (realContext.Provider === Context) {
|
|
2855
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2860
|
-
return dispatcher.useContext(Context);
|
|
2861
|
-
}
|
|
2862
|
-
function useState(initialState) {
|
|
2863
|
-
var dispatcher = resolveDispatcher();
|
|
2864
|
-
return dispatcher.useState(initialState);
|
|
2865
|
-
}
|
|
2866
|
-
function useReducer(reducer, initialArg, init) {
|
|
2867
|
-
var dispatcher = resolveDispatcher();
|
|
2868
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
2869
|
-
}
|
|
2870
|
-
function useRef(initialValue) {
|
|
2871
|
-
var dispatcher = resolveDispatcher();
|
|
2872
|
-
return dispatcher.useRef(initialValue);
|
|
2873
|
-
}
|
|
2874
|
-
function useEffect(create, deps) {
|
|
2875
|
-
var dispatcher = resolveDispatcher();
|
|
2876
|
-
return dispatcher.useEffect(create, deps);
|
|
2877
|
-
}
|
|
2878
|
-
function useInsertionEffect(create, deps) {
|
|
2879
|
-
var dispatcher = resolveDispatcher();
|
|
2880
|
-
return dispatcher.useInsertionEffect(create, deps);
|
|
2881
|
-
}
|
|
2882
|
-
function useLayoutEffect(create, deps) {
|
|
2883
|
-
var dispatcher = resolveDispatcher();
|
|
2884
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
2885
|
-
}
|
|
2886
|
-
function useCallback(callback, deps) {
|
|
2887
|
-
var dispatcher = resolveDispatcher();
|
|
2888
|
-
return dispatcher.useCallback(callback, deps);
|
|
2889
|
-
}
|
|
2890
|
-
function useMemo(create, deps) {
|
|
2891
|
-
var dispatcher = resolveDispatcher();
|
|
2892
|
-
return dispatcher.useMemo(create, deps);
|
|
2893
|
-
}
|
|
2894
|
-
function useImperativeHandle(ref, create, deps) {
|
|
2895
|
-
var dispatcher = resolveDispatcher();
|
|
2896
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
2897
|
-
}
|
|
2898
|
-
function useDebugValue(value, formatterFn) {
|
|
2899
|
-
{
|
|
2900
|
-
var dispatcher = resolveDispatcher();
|
|
2901
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
function useTransition() {
|
|
2905
|
-
var dispatcher = resolveDispatcher();
|
|
2906
|
-
return dispatcher.useTransition();
|
|
2907
|
-
}
|
|
2908
|
-
function useDeferredValue(value) {
|
|
2909
|
-
var dispatcher = resolveDispatcher();
|
|
2910
|
-
return dispatcher.useDeferredValue(value);
|
|
2911
|
-
}
|
|
2912
|
-
function useId() {
|
|
2913
|
-
var dispatcher = resolveDispatcher();
|
|
2914
|
-
return dispatcher.useId();
|
|
2915
|
-
}
|
|
2916
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
2917
|
-
var dispatcher = resolveDispatcher();
|
|
2918
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
2922
|
-
// replaying on render function. This currently only patches the object
|
|
2923
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
2924
|
-
// We could also eagerly patch the method.
|
|
2925
|
-
var disabledDepth = 0;
|
|
2926
|
-
var prevLog;
|
|
2927
|
-
var prevInfo;
|
|
2928
|
-
var prevWarn;
|
|
2929
|
-
var prevError;
|
|
2930
|
-
var prevGroup;
|
|
2931
|
-
var prevGroupCollapsed;
|
|
2932
|
-
var prevGroupEnd;
|
|
2933
|
-
|
|
2934
|
-
function disabledLog() {}
|
|
2935
|
-
|
|
2936
|
-
disabledLog.__reactDisabledLog = true;
|
|
2937
|
-
function disableLogs() {
|
|
2938
|
-
{
|
|
2939
|
-
if (disabledDepth === 0) {
|
|
2940
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
2941
|
-
prevLog = console.log;
|
|
2942
|
-
prevInfo = console.info;
|
|
2943
|
-
prevWarn = console.warn;
|
|
2944
|
-
prevError = console.error;
|
|
2945
|
-
prevGroup = console.group;
|
|
2946
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
2947
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
2948
|
-
|
|
2949
|
-
var props = {
|
|
2950
|
-
configurable: true,
|
|
2951
|
-
enumerable: true,
|
|
2952
|
-
value: disabledLog,
|
|
2953
|
-
writable: true
|
|
2954
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
2955
|
-
|
|
2956
|
-
Object.defineProperties(console, {
|
|
2957
|
-
info: props,
|
|
2958
|
-
log: props,
|
|
2959
|
-
warn: props,
|
|
2960
|
-
error: props,
|
|
2961
|
-
group: props,
|
|
2962
|
-
groupCollapsed: props,
|
|
2963
|
-
groupEnd: props
|
|
2964
|
-
});
|
|
2965
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
disabledDepth++;
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
function reenableLogs() {
|
|
2972
|
-
{
|
|
2973
|
-
disabledDepth--;
|
|
2974
|
-
|
|
2975
|
-
if (disabledDepth === 0) {
|
|
2976
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
2977
|
-
var props = {
|
|
2978
|
-
configurable: true,
|
|
2979
|
-
enumerable: true,
|
|
2980
|
-
writable: true
|
|
2981
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
2982
|
-
|
|
2983
|
-
Object.defineProperties(console, {
|
|
2984
|
-
log: assign({}, props, {
|
|
2985
|
-
value: prevLog
|
|
2986
|
-
}),
|
|
2987
|
-
info: assign({}, props, {
|
|
2988
|
-
value: prevInfo
|
|
2989
|
-
}),
|
|
2990
|
-
warn: assign({}, props, {
|
|
2991
|
-
value: prevWarn
|
|
2992
|
-
}),
|
|
2993
|
-
error: assign({}, props, {
|
|
2994
|
-
value: prevError
|
|
2995
|
-
}),
|
|
2996
|
-
group: assign({}, props, {
|
|
2997
|
-
value: prevGroup
|
|
2998
|
-
}),
|
|
2999
|
-
groupCollapsed: assign({}, props, {
|
|
3000
|
-
value: prevGroupCollapsed
|
|
3001
|
-
}),
|
|
3002
|
-
groupEnd: assign({}, props, {
|
|
3003
|
-
value: prevGroupEnd
|
|
3004
|
-
})
|
|
3005
|
-
});
|
|
3006
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
3007
|
-
}
|
|
3008
|
-
|
|
3009
|
-
if (disabledDepth < 0) {
|
|
3010
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
|
|
3015
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
3016
|
-
var prefix;
|
|
3017
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
3018
|
-
{
|
|
3019
|
-
if (prefix === undefined) {
|
|
3020
|
-
// Extract the VM specific prefix used by each line.
|
|
3021
|
-
try {
|
|
3022
|
-
throw Error();
|
|
3023
|
-
} catch (x) {
|
|
3024
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
3025
|
-
prefix = match && match[1] || '';
|
|
3026
|
-
}
|
|
3027
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
return '\n' + prefix + name;
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
var reentry = false;
|
|
3034
|
-
var componentFrameCache;
|
|
3035
|
-
|
|
3036
|
-
{
|
|
3037
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
3038
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
3042
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
3043
|
-
if ( !fn || reentry) {
|
|
3044
|
-
return '';
|
|
3045
|
-
}
|
|
3046
|
-
|
|
3047
|
-
{
|
|
3048
|
-
var frame = componentFrameCache.get(fn);
|
|
3049
|
-
|
|
3050
|
-
if (frame !== undefined) {
|
|
3051
|
-
return frame;
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
var control;
|
|
3056
|
-
reentry = true;
|
|
3057
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
3058
|
-
|
|
3059
|
-
Error.prepareStackTrace = undefined;
|
|
3060
|
-
var previousDispatcher;
|
|
3061
|
-
|
|
3062
|
-
{
|
|
3063
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
3064
|
-
// for warnings.
|
|
3065
|
-
|
|
3066
|
-
ReactCurrentDispatcher$1.current = null;
|
|
3067
|
-
disableLogs();
|
|
3068
|
-
}
|
|
3069
|
-
|
|
3070
|
-
try {
|
|
3071
|
-
// This should throw.
|
|
3072
|
-
if (construct) {
|
|
3073
|
-
// Something should be setting the props in the constructor.
|
|
3074
|
-
var Fake = function () {
|
|
3075
|
-
throw Error();
|
|
3076
|
-
}; // $FlowFixMe
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
3080
|
-
set: function () {
|
|
3081
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
3082
|
-
// because that won't throw in a non-strict mode function.
|
|
3083
|
-
throw Error();
|
|
3084
|
-
}
|
|
3085
|
-
});
|
|
3086
|
-
|
|
3087
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
3088
|
-
// We construct a different control for this case to include any extra
|
|
3089
|
-
// frames added by the construct call.
|
|
3090
|
-
try {
|
|
3091
|
-
Reflect.construct(Fake, []);
|
|
3092
|
-
} catch (x) {
|
|
3093
|
-
control = x;
|
|
3094
|
-
}
|
|
3095
|
-
|
|
3096
|
-
Reflect.construct(fn, [], Fake);
|
|
3097
|
-
} else {
|
|
3098
|
-
try {
|
|
3099
|
-
Fake.call();
|
|
3100
|
-
} catch (x) {
|
|
3101
|
-
control = x;
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
|
-
fn.call(Fake.prototype);
|
|
3105
|
-
}
|
|
3106
|
-
} else {
|
|
3107
|
-
try {
|
|
3108
|
-
throw Error();
|
|
3109
|
-
} catch (x) {
|
|
3110
|
-
control = x;
|
|
3111
|
-
}
|
|
3112
|
-
|
|
3113
|
-
fn();
|
|
3114
|
-
}
|
|
3115
|
-
} catch (sample) {
|
|
3116
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
3117
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
3118
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
3119
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
3120
|
-
var sampleLines = sample.stack.split('\n');
|
|
3121
|
-
var controlLines = control.stack.split('\n');
|
|
3122
|
-
var s = sampleLines.length - 1;
|
|
3123
|
-
var c = controlLines.length - 1;
|
|
3124
|
-
|
|
3125
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
3126
|
-
// We expect at least one stack frame to be shared.
|
|
3127
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
3128
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
3129
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
3130
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
3131
|
-
// the sample somewhere in the control.
|
|
3132
|
-
c--;
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
3136
|
-
// Next we find the first one that isn't the same which should be the
|
|
3137
|
-
// frame that called our sample function and the control.
|
|
3138
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
3139
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
3140
|
-
// If we're about to return the first line, and the control is also on the same
|
|
3141
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
3142
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
3143
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
3144
|
-
if (s !== 1 || c !== 1) {
|
|
3145
|
-
do {
|
|
3146
|
-
s--;
|
|
3147
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
3148
|
-
// The next one that isn't the same should be our match though.
|
|
3149
|
-
|
|
3150
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
3151
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
3152
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
3153
|
-
// but we have a user-provided "displayName"
|
|
3154
|
-
// splice it in to make the stack more readable.
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
3158
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
{
|
|
3162
|
-
if (typeof fn === 'function') {
|
|
3163
|
-
componentFrameCache.set(fn, _frame);
|
|
3164
|
-
}
|
|
3165
|
-
} // Return the line we found.
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
return _frame;
|
|
3169
|
-
}
|
|
3170
|
-
} while (s >= 1 && c >= 0);
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
|
-
break;
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
} finally {
|
|
3178
|
-
reentry = false;
|
|
3179
|
-
|
|
3180
|
-
{
|
|
3181
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
3182
|
-
reenableLogs();
|
|
3183
|
-
}
|
|
3184
|
-
|
|
3185
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
3186
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
3190
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
3191
|
-
|
|
3192
|
-
{
|
|
3193
|
-
if (typeof fn === 'function') {
|
|
3194
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
return syntheticFrame;
|
|
3199
|
-
}
|
|
3200
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
3201
|
-
{
|
|
3202
|
-
return describeNativeComponentFrame(fn, false);
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
function shouldConstruct(Component) {
|
|
3207
|
-
var prototype = Component.prototype;
|
|
3208
|
-
return !!(prototype && prototype.isReactComponent);
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
3212
|
-
|
|
3213
|
-
if (type == null) {
|
|
3214
|
-
return '';
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
if (typeof type === 'function') {
|
|
3218
|
-
{
|
|
3219
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3222
|
-
|
|
3223
|
-
if (typeof type === 'string') {
|
|
3224
|
-
return describeBuiltInComponentFrame(type);
|
|
3225
|
-
}
|
|
3226
|
-
|
|
3227
|
-
switch (type) {
|
|
3228
|
-
case REACT_SUSPENSE_TYPE:
|
|
3229
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
3230
|
-
|
|
3231
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
3232
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
3233
|
-
}
|
|
3234
|
-
|
|
3235
|
-
if (typeof type === 'object') {
|
|
3236
|
-
switch (type.$$typeof) {
|
|
3237
|
-
case REACT_FORWARD_REF_TYPE:
|
|
3238
|
-
return describeFunctionComponentFrame(type.render);
|
|
3239
|
-
|
|
3240
|
-
case REACT_MEMO_TYPE:
|
|
3241
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
3242
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
3243
|
-
|
|
3244
|
-
case REACT_LAZY_TYPE:
|
|
3245
|
-
{
|
|
3246
|
-
var lazyComponent = type;
|
|
3247
|
-
var payload = lazyComponent._payload;
|
|
3248
|
-
var init = lazyComponent._init;
|
|
3249
|
-
|
|
3250
|
-
try {
|
|
3251
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
3252
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
3253
|
-
} catch (x) {}
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
return '';
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
|
-
var loggedTypeFailures = {};
|
|
3262
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
3263
|
-
|
|
3264
|
-
function setCurrentlyValidatingElement(element) {
|
|
3265
|
-
{
|
|
3266
|
-
if (element) {
|
|
3267
|
-
var owner = element._owner;
|
|
3268
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
3269
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
3270
|
-
} else {
|
|
3271
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
|
|
3276
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
3277
|
-
{
|
|
3278
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
3279
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
3280
|
-
|
|
3281
|
-
for (var typeSpecName in typeSpecs) {
|
|
3282
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
3283
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
3284
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
3285
|
-
// After these have been cleaned up, we'll let them throw.
|
|
3286
|
-
|
|
3287
|
-
try {
|
|
3288
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
3289
|
-
// behavior as without this statement except with a better message.
|
|
3290
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
3291
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
3292
|
-
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`.');
|
|
3293
|
-
err.name = 'Invariant Violation';
|
|
3294
|
-
throw err;
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
3298
|
-
} catch (ex) {
|
|
3299
|
-
error$1 = ex;
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
3303
|
-
setCurrentlyValidatingElement(element);
|
|
3304
|
-
|
|
3305
|
-
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);
|
|
3306
|
-
|
|
3307
|
-
setCurrentlyValidatingElement(null);
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3310
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
3311
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
3312
|
-
// same error.
|
|
3313
|
-
loggedTypeFailures[error$1.message] = true;
|
|
3314
|
-
setCurrentlyValidatingElement(element);
|
|
3315
|
-
|
|
3316
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
3317
|
-
|
|
3318
|
-
setCurrentlyValidatingElement(null);
|
|
3319
|
-
}
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
|
|
3325
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
3326
|
-
{
|
|
3327
|
-
if (element) {
|
|
3328
|
-
var owner = element._owner;
|
|
3329
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
3330
|
-
setExtraStackFrame(stack);
|
|
3331
|
-
} else {
|
|
3332
|
-
setExtraStackFrame(null);
|
|
3333
|
-
}
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
|
|
3337
|
-
var propTypesMisspellWarningShown;
|
|
3338
|
-
|
|
3339
|
-
{
|
|
3340
|
-
propTypesMisspellWarningShown = false;
|
|
3341
|
-
}
|
|
3342
|
-
|
|
3343
|
-
function getDeclarationErrorAddendum() {
|
|
3344
|
-
if (ReactCurrentOwner.current) {
|
|
3345
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
3346
|
-
|
|
3347
|
-
if (name) {
|
|
3348
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
|
|
3352
|
-
return '';
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
function getSourceInfoErrorAddendum(source) {
|
|
3356
|
-
if (source !== undefined) {
|
|
3357
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
3358
|
-
var lineNumber = source.lineNumber;
|
|
3359
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
|
-
return '';
|
|
3363
|
-
}
|
|
3364
|
-
|
|
3365
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
3366
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
3367
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
3368
|
-
}
|
|
3369
|
-
|
|
3370
|
-
return '';
|
|
3371
|
-
}
|
|
3372
|
-
/**
|
|
3373
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
3374
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
3375
|
-
* updates.
|
|
3376
|
-
*/
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
var ownerHasKeyUseWarning = {};
|
|
3380
|
-
|
|
3381
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
3382
|
-
var info = getDeclarationErrorAddendum();
|
|
3383
|
-
|
|
3384
|
-
if (!info) {
|
|
3385
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
3386
|
-
|
|
3387
|
-
if (parentName) {
|
|
3388
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
|
|
3392
|
-
return info;
|
|
3393
|
-
}
|
|
3394
|
-
/**
|
|
3395
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
3396
|
-
* This element is in an array. The array could grow and shrink or be
|
|
3397
|
-
* reordered. All children that haven't already been validated are required to
|
|
3398
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
3399
|
-
* will only be shown once.
|
|
3400
|
-
*
|
|
3401
|
-
* @internal
|
|
3402
|
-
* @param {ReactElement} element Element that requires a key.
|
|
3403
|
-
* @param {*} parentType element's parent's type.
|
|
3404
|
-
*/
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
function validateExplicitKey(element, parentType) {
|
|
3408
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
3409
|
-
return;
|
|
3410
|
-
}
|
|
3411
|
-
|
|
3412
|
-
element._store.validated = true;
|
|
3413
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
3414
|
-
|
|
3415
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
3416
|
-
return;
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
3420
|
-
// property, it may be the creator of the child that's responsible for
|
|
3421
|
-
// assigning it a key.
|
|
3422
|
-
|
|
3423
|
-
var childOwner = '';
|
|
3424
|
-
|
|
3425
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
3426
|
-
// Give the component that originally created this child.
|
|
3427
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
|
-
{
|
|
3431
|
-
setCurrentlyValidatingElement$1(element);
|
|
3432
|
-
|
|
3433
|
-
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);
|
|
3434
|
-
|
|
3435
|
-
setCurrentlyValidatingElement$1(null);
|
|
3436
|
-
}
|
|
3437
|
-
}
|
|
3438
|
-
/**
|
|
3439
|
-
* Ensure that every element either is passed in a static location, in an
|
|
3440
|
-
* array with an explicit keys property defined, or in an object literal
|
|
3441
|
-
* with valid key property.
|
|
3442
|
-
*
|
|
3443
|
-
* @internal
|
|
3444
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
3445
|
-
* @param {*} parentType node's parent's type.
|
|
3446
|
-
*/
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
function validateChildKeys(node, parentType) {
|
|
3450
|
-
if (typeof node !== 'object') {
|
|
3451
|
-
return;
|
|
3452
|
-
}
|
|
3453
|
-
|
|
3454
|
-
if (isArray(node)) {
|
|
3455
|
-
for (var i = 0; i < node.length; i++) {
|
|
3456
|
-
var child = node[i];
|
|
3457
|
-
|
|
3458
|
-
if (isValidElement(child)) {
|
|
3459
|
-
validateExplicitKey(child, parentType);
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
} else if (isValidElement(node)) {
|
|
3463
|
-
// This element was passed in a valid location.
|
|
3464
|
-
if (node._store) {
|
|
3465
|
-
node._store.validated = true;
|
|
3466
|
-
}
|
|
3467
|
-
} else if (node) {
|
|
3468
|
-
var iteratorFn = getIteratorFn(node);
|
|
3469
|
-
|
|
3470
|
-
if (typeof iteratorFn === 'function') {
|
|
3471
|
-
// Entry iterators used to provide implicit keys,
|
|
3472
|
-
// but now we print a separate warning for them later.
|
|
3473
|
-
if (iteratorFn !== node.entries) {
|
|
3474
|
-
var iterator = iteratorFn.call(node);
|
|
3475
|
-
var step;
|
|
3476
|
-
|
|
3477
|
-
while (!(step = iterator.next()).done) {
|
|
3478
|
-
if (isValidElement(step.value)) {
|
|
3479
|
-
validateExplicitKey(step.value, parentType);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
}
|
|
3486
|
-
/**
|
|
3487
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
3488
|
-
* provided by the type.
|
|
3489
|
-
*
|
|
3490
|
-
* @param {ReactElement} element
|
|
3491
|
-
*/
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
function validatePropTypes(element) {
|
|
3495
|
-
{
|
|
3496
|
-
var type = element.type;
|
|
3497
|
-
|
|
3498
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
3499
|
-
return;
|
|
3500
|
-
}
|
|
3501
|
-
|
|
3502
|
-
var propTypes;
|
|
3503
|
-
|
|
3504
|
-
if (typeof type === 'function') {
|
|
3505
|
-
propTypes = type.propTypes;
|
|
3506
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
3507
|
-
// Inner props are checked in the reconciler.
|
|
3508
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
3509
|
-
propTypes = type.propTypes;
|
|
3510
|
-
} else {
|
|
3511
|
-
return;
|
|
3512
|
-
}
|
|
3513
|
-
|
|
3514
|
-
if (propTypes) {
|
|
3515
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
3516
|
-
var name = getComponentNameFromType(type);
|
|
3517
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
3518
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
3519
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
3520
|
-
|
|
3521
|
-
var _name = getComponentNameFromType(type);
|
|
3522
|
-
|
|
3523
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
3524
|
-
}
|
|
3525
|
-
|
|
3526
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
3527
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
/**
|
|
3532
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
3533
|
-
* @param {ReactElement} fragment
|
|
3534
|
-
*/
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
function validateFragmentProps(fragment) {
|
|
3538
|
-
{
|
|
3539
|
-
var keys = Object.keys(fragment.props);
|
|
3540
|
-
|
|
3541
|
-
for (var i = 0; i < keys.length; i++) {
|
|
3542
|
-
var key = keys[i];
|
|
3543
|
-
|
|
3544
|
-
if (key !== 'children' && key !== 'key') {
|
|
3545
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
3546
|
-
|
|
3547
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
3548
|
-
|
|
3549
|
-
setCurrentlyValidatingElement$1(null);
|
|
3550
|
-
break;
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3554
|
-
if (fragment.ref !== null) {
|
|
3555
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
3556
|
-
|
|
3557
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
3558
|
-
|
|
3559
|
-
setCurrentlyValidatingElement$1(null);
|
|
3560
|
-
}
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
3563
|
-
function createElementWithValidation(type, props, children) {
|
|
3564
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
3565
|
-
// succeed and there will likely be errors in render.
|
|
3566
|
-
|
|
3567
|
-
if (!validType) {
|
|
3568
|
-
var info = '';
|
|
3569
|
-
|
|
3570
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
3571
|
-
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.";
|
|
3572
|
-
}
|
|
3573
|
-
|
|
3574
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
3575
|
-
|
|
3576
|
-
if (sourceInfo) {
|
|
3577
|
-
info += sourceInfo;
|
|
3578
|
-
} else {
|
|
3579
|
-
info += getDeclarationErrorAddendum();
|
|
3580
|
-
}
|
|
3581
|
-
|
|
3582
|
-
var typeString;
|
|
3583
|
-
|
|
3584
|
-
if (type === null) {
|
|
3585
|
-
typeString = 'null';
|
|
3586
|
-
} else if (isArray(type)) {
|
|
3587
|
-
typeString = 'array';
|
|
3588
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
3589
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
3590
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
3591
|
-
} else {
|
|
3592
|
-
typeString = typeof type;
|
|
3593
|
-
}
|
|
3594
|
-
|
|
3595
|
-
{
|
|
3596
|
-
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);
|
|
3597
|
-
}
|
|
3598
|
-
}
|
|
3599
|
-
|
|
3600
|
-
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
3601
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
3602
|
-
|
|
3603
|
-
if (element == null) {
|
|
3604
|
-
return element;
|
|
3605
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
3606
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
3607
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
3608
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
3609
|
-
// fixed, the key warnings will appear.)
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
if (validType) {
|
|
3613
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
3614
|
-
validateChildKeys(arguments[i], type);
|
|
3615
|
-
}
|
|
3616
|
-
}
|
|
3617
|
-
|
|
3618
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
3619
|
-
validateFragmentProps(element);
|
|
3620
|
-
} else {
|
|
3621
|
-
validatePropTypes(element);
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
return element;
|
|
3625
|
-
}
|
|
3626
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
3627
|
-
function createFactoryWithValidation(type) {
|
|
3628
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
3629
|
-
validatedFactory.type = type;
|
|
3630
|
-
|
|
3631
|
-
{
|
|
3632
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
3633
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
3634
|
-
|
|
3635
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
3636
|
-
} // Legacy hook: remove it
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
3640
|
-
enumerable: false,
|
|
3641
|
-
get: function () {
|
|
3642
|
-
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
3643
|
-
|
|
3644
|
-
Object.defineProperty(this, 'type', {
|
|
3645
|
-
value: type
|
|
3646
|
-
});
|
|
3647
|
-
return type;
|
|
3648
|
-
}
|
|
3649
|
-
});
|
|
3650
|
-
}
|
|
3651
|
-
|
|
3652
|
-
return validatedFactory;
|
|
3653
|
-
}
|
|
3654
|
-
function cloneElementWithValidation(element, props, children) {
|
|
3655
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
3656
|
-
|
|
3657
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
3658
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
3659
|
-
}
|
|
3660
|
-
|
|
3661
|
-
validatePropTypes(newElement);
|
|
3662
|
-
return newElement;
|
|
3663
|
-
}
|
|
3664
|
-
|
|
3665
|
-
function startTransition(scope, options) {
|
|
3666
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
3667
|
-
ReactCurrentBatchConfig.transition = {};
|
|
3668
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
3669
|
-
|
|
3670
|
-
{
|
|
3671
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
|
-
try {
|
|
3675
|
-
scope();
|
|
3676
|
-
} finally {
|
|
3677
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
3678
|
-
|
|
3679
|
-
{
|
|
3680
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
3681
|
-
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
3682
|
-
|
|
3683
|
-
if (updatedFibersCount > 10) {
|
|
3684
|
-
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.');
|
|
3685
|
-
}
|
|
3686
|
-
|
|
3687
|
-
currentTransition._updatedFibers.clear();
|
|
3688
|
-
}
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
}
|
|
3692
|
-
|
|
3693
|
-
var didWarnAboutMessageChannel = false;
|
|
3694
|
-
var enqueueTaskImpl = null;
|
|
3695
|
-
function enqueueTask(task) {
|
|
3696
|
-
if (enqueueTaskImpl === null) {
|
|
3697
|
-
try {
|
|
3698
|
-
// read require off the module object to get around the bundlers.
|
|
3699
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
3700
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
3701
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
3702
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
3703
|
-
|
|
3704
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
3705
|
-
} catch (_err) {
|
|
3706
|
-
// we're in a browser
|
|
3707
|
-
// we can't use regular timers because they may still be faked
|
|
3708
|
-
// so we try MessageChannel+postMessage instead
|
|
3709
|
-
enqueueTaskImpl = function (callback) {
|
|
3710
|
-
{
|
|
3711
|
-
if (didWarnAboutMessageChannel === false) {
|
|
3712
|
-
didWarnAboutMessageChannel = true;
|
|
3713
|
-
|
|
3714
|
-
if (typeof MessageChannel === 'undefined') {
|
|
3715
|
-
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.');
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
var channel = new MessageChannel();
|
|
3721
|
-
channel.port1.onmessage = callback;
|
|
3722
|
-
channel.port2.postMessage(undefined);
|
|
3723
|
-
};
|
|
3724
|
-
}
|
|
3725
|
-
}
|
|
3726
|
-
|
|
3727
|
-
return enqueueTaskImpl(task);
|
|
3728
|
-
}
|
|
3729
|
-
|
|
3730
|
-
var actScopeDepth = 0;
|
|
3731
|
-
var didWarnNoAwaitAct = false;
|
|
3732
|
-
function act(callback) {
|
|
3733
|
-
{
|
|
3734
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
3735
|
-
// number of `act` scopes on the stack.
|
|
3736
|
-
var prevActScopeDepth = actScopeDepth;
|
|
3737
|
-
actScopeDepth++;
|
|
3738
|
-
|
|
3739
|
-
if (ReactCurrentActQueue.current === null) {
|
|
3740
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
3741
|
-
// will detect the queue and use it instead of Scheduler.
|
|
3742
|
-
ReactCurrentActQueue.current = [];
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
3746
|
-
var result;
|
|
3747
|
-
|
|
3748
|
-
try {
|
|
3749
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
3750
|
-
// set to `true` while the given callback is executed, not for updates
|
|
3751
|
-
// triggered during an async event, because this is how the legacy
|
|
3752
|
-
// implementation of `act` behaved.
|
|
3753
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
3754
|
-
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
3755
|
-
// which flushed updates immediately after the scope function exits, even
|
|
3756
|
-
// if it's an async function.
|
|
3757
|
-
|
|
3758
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
3759
|
-
var queue = ReactCurrentActQueue.current;
|
|
3760
|
-
|
|
3761
|
-
if (queue !== null) {
|
|
3762
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
3763
|
-
flushActQueue(queue);
|
|
3764
|
-
}
|
|
3765
|
-
}
|
|
3766
|
-
} catch (error) {
|
|
3767
|
-
popActScope(prevActScopeDepth);
|
|
3768
|
-
throw error;
|
|
3769
|
-
} finally {
|
|
3770
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3773
|
-
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
3774
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
3775
|
-
// for it to resolve before exiting the current scope.
|
|
3776
|
-
|
|
3777
|
-
var wasAwaited = false;
|
|
3778
|
-
var thenable = {
|
|
3779
|
-
then: function (resolve, reject) {
|
|
3780
|
-
wasAwaited = true;
|
|
3781
|
-
thenableResult.then(function (returnValue) {
|
|
3782
|
-
popActScope(prevActScopeDepth);
|
|
3783
|
-
|
|
3784
|
-
if (actScopeDepth === 0) {
|
|
3785
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
3786
|
-
// queue until there's no remaining work.
|
|
3787
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
3788
|
-
} else {
|
|
3789
|
-
resolve(returnValue);
|
|
3790
|
-
}
|
|
3791
|
-
}, function (error) {
|
|
3792
|
-
// The callback threw an error.
|
|
3793
|
-
popActScope(prevActScopeDepth);
|
|
3794
|
-
reject(error);
|
|
3795
|
-
});
|
|
3796
|
-
}
|
|
3797
|
-
};
|
|
3798
|
-
|
|
3799
|
-
{
|
|
3800
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
3801
|
-
// eslint-disable-next-line no-undef
|
|
3802
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
3803
|
-
if (!wasAwaited) {
|
|
3804
|
-
didWarnNoAwaitAct = true;
|
|
3805
|
-
|
|
3806
|
-
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 () => ...);');
|
|
3807
|
-
}
|
|
3808
|
-
});
|
|
3809
|
-
}
|
|
3810
|
-
}
|
|
3811
|
-
|
|
3812
|
-
return thenable;
|
|
3813
|
-
} else {
|
|
3814
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
3815
|
-
// immediately, without awaiting.
|
|
3816
|
-
|
|
3817
|
-
popActScope(prevActScopeDepth);
|
|
3818
|
-
|
|
3819
|
-
if (actScopeDepth === 0) {
|
|
3820
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
3821
|
-
var _queue = ReactCurrentActQueue.current;
|
|
3822
|
-
|
|
3823
|
-
if (_queue !== null) {
|
|
3824
|
-
flushActQueue(_queue);
|
|
3825
|
-
ReactCurrentActQueue.current = null;
|
|
3826
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
3827
|
-
// case additional work was scheduled by a microtask.
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
var _thenable = {
|
|
3831
|
-
then: function (resolve, reject) {
|
|
3832
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
3833
|
-
// the user does something weird like await the thenable
|
|
3834
|
-
// multiple times.
|
|
3835
|
-
if (ReactCurrentActQueue.current === null) {
|
|
3836
|
-
// Recursively flush the queue until there's no remaining work.
|
|
3837
|
-
ReactCurrentActQueue.current = [];
|
|
3838
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
3839
|
-
} else {
|
|
3840
|
-
resolve(returnValue);
|
|
3841
|
-
}
|
|
3842
|
-
}
|
|
3843
|
-
};
|
|
3844
|
-
return _thenable;
|
|
3845
|
-
} else {
|
|
3846
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
3847
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
3848
|
-
var _thenable2 = {
|
|
3849
|
-
then: function (resolve, reject) {
|
|
3850
|
-
resolve(returnValue);
|
|
3851
|
-
}
|
|
3852
|
-
};
|
|
3853
|
-
return _thenable2;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
|
-
}
|
|
3858
|
-
|
|
3859
|
-
function popActScope(prevActScopeDepth) {
|
|
3860
|
-
{
|
|
3861
|
-
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
3862
|
-
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
3863
|
-
}
|
|
3864
|
-
|
|
3865
|
-
actScopeDepth = prevActScopeDepth;
|
|
3866
|
-
}
|
|
3867
|
-
}
|
|
3868
|
-
|
|
3869
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
3870
|
-
{
|
|
3871
|
-
var queue = ReactCurrentActQueue.current;
|
|
3872
|
-
|
|
3873
|
-
if (queue !== null) {
|
|
3874
|
-
try {
|
|
3875
|
-
flushActQueue(queue);
|
|
3876
|
-
enqueueTask(function () {
|
|
3877
|
-
if (queue.length === 0) {
|
|
3878
|
-
// No additional work was scheduled. Finish.
|
|
3879
|
-
ReactCurrentActQueue.current = null;
|
|
3880
|
-
resolve(returnValue);
|
|
3881
|
-
} else {
|
|
3882
|
-
// Keep flushing work until there's none left.
|
|
3883
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
3884
|
-
}
|
|
3885
|
-
});
|
|
3886
|
-
} catch (error) {
|
|
3887
|
-
reject(error);
|
|
3888
|
-
}
|
|
3889
|
-
} else {
|
|
3890
|
-
resolve(returnValue);
|
|
3891
|
-
}
|
|
3892
|
-
}
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
|
-
var isFlushing = false;
|
|
3896
|
-
|
|
3897
|
-
function flushActQueue(queue) {
|
|
3898
|
-
{
|
|
3899
|
-
if (!isFlushing) {
|
|
3900
|
-
// Prevent re-entrance.
|
|
3901
|
-
isFlushing = true;
|
|
3902
|
-
var i = 0;
|
|
3903
|
-
|
|
3904
|
-
try {
|
|
3905
|
-
for (; i < queue.length; i++) {
|
|
3906
|
-
var callback = queue[i];
|
|
3907
|
-
|
|
3908
|
-
do {
|
|
3909
|
-
callback = callback(true);
|
|
3910
|
-
} while (callback !== null);
|
|
3911
|
-
}
|
|
3912
|
-
|
|
3913
|
-
queue.length = 0;
|
|
3914
|
-
} catch (error) {
|
|
3915
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
3916
|
-
queue = queue.slice(i + 1);
|
|
3917
|
-
throw error;
|
|
3918
|
-
} finally {
|
|
3919
|
-
isFlushing = false;
|
|
3920
|
-
}
|
|
3921
|
-
}
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
|
|
3925
|
-
var createElement$1 = createElementWithValidation ;
|
|
3926
|
-
var cloneElement$1 = cloneElementWithValidation ;
|
|
3927
|
-
var createFactory = createFactoryWithValidation ;
|
|
3928
|
-
var Children = {
|
|
3929
|
-
map: mapChildren,
|
|
3930
|
-
forEach: forEachChildren,
|
|
3931
|
-
count: countChildren,
|
|
3932
|
-
toArray: toArray,
|
|
3933
|
-
only: onlyChild
|
|
3934
|
-
};
|
|
3935
|
-
|
|
3936
|
-
exports.Children = Children;
|
|
3937
|
-
exports.Component = Component;
|
|
3938
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
3939
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
3940
|
-
exports.PureComponent = PureComponent;
|
|
3941
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
3942
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
3943
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
3944
|
-
exports.act = act;
|
|
3945
|
-
exports.cloneElement = cloneElement$1;
|
|
3946
|
-
exports.createContext = createContext;
|
|
3947
|
-
exports.createElement = createElement$1;
|
|
3948
|
-
exports.createFactory = createFactory;
|
|
3949
|
-
exports.createRef = createRef;
|
|
3950
|
-
exports.forwardRef = forwardRef;
|
|
3951
|
-
exports.isValidElement = isValidElement;
|
|
3952
|
-
exports.lazy = lazy;
|
|
3953
|
-
exports.memo = memo;
|
|
3954
|
-
exports.startTransition = startTransition;
|
|
3955
|
-
exports.unstable_act = act;
|
|
3956
|
-
exports.useCallback = useCallback;
|
|
3957
|
-
exports.useContext = useContext;
|
|
3958
|
-
exports.useDebugValue = useDebugValue;
|
|
3959
|
-
exports.useDeferredValue = useDeferredValue;
|
|
3960
|
-
exports.useEffect = useEffect;
|
|
3961
|
-
exports.useId = useId;
|
|
3962
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
3963
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
3964
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
3965
|
-
exports.useMemo = useMemo;
|
|
3966
|
-
exports.useReducer = useReducer;
|
|
3967
|
-
exports.useRef = useRef;
|
|
3968
|
-
exports.useState = useState;
|
|
3969
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
3970
|
-
exports.useTransition = useTransition;
|
|
3971
|
-
exports.version = ReactVersion;
|
|
3972
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
3973
|
-
if (
|
|
3974
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
3975
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
3976
|
-
'function'
|
|
3977
|
-
) {
|
|
3978
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3979
|
-
}
|
|
3980
|
-
|
|
3981
|
-
})();
|
|
3982
|
-
}
|
|
3983
|
-
} (react_development, react_development.exports));
|
|
3984
|
-
return react_development.exports;
|
|
3985
|
-
}
|
|
3986
|
-
|
|
3987
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3988
|
-
react.exports = requireReact_production_min();
|
|
3989
|
-
} else {
|
|
3990
|
-
react.exports = requireReact_development();
|
|
3991
|
-
}
|
|
3992
|
-
|
|
3993
|
-
var reactExports = react.exports;
|
|
3994
|
-
var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
|
|
3995
|
-
|
|
3996
|
-
var React$1 = /*#__PURE__*/_mergeNamespaces({
|
|
3997
|
-
__proto__: null,
|
|
3998
|
-
default: React
|
|
3999
|
-
}, [reactExports]);
|
|
4000
|
-
|
|
4001
1183
|
/*
|
|
4002
1184
|
|
|
4003
1185
|
Based off glamor's StyleSheet, thanks Sunil ❤️
|
|
@@ -6136,13 +3318,13 @@ var syncFallback = function syncFallback(create) {
|
|
|
6136
3318
|
return create();
|
|
6137
3319
|
};
|
|
6138
3320
|
|
|
6139
|
-
var useInsertionEffect = React
|
|
3321
|
+
var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
|
|
6140
3322
|
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : useInsertionEffect || syncFallback;
|
|
6141
3323
|
|
|
6142
3324
|
var isBrowser = typeof document !== 'undefined';
|
|
6143
3325
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
6144
3326
|
|
|
6145
|
-
var EmotionCacheContext = /* #__PURE__ */
|
|
3327
|
+
var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
6146
3328
|
// because this module is primarily intended for the browser and node
|
|
6147
3329
|
// but it's also required in react native and similar environments sometimes
|
|
6148
3330
|
// and we could have a special build just for that
|
|
@@ -6160,9 +3342,9 @@ EmotionCacheContext.Provider;
|
|
|
6160
3342
|
|
|
6161
3343
|
var withEmotionCache = function withEmotionCache(func) {
|
|
6162
3344
|
// $FlowFixMe
|
|
6163
|
-
return /*#__PURE__*/
|
|
3345
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
6164
3346
|
// the cache will never be null in the browser
|
|
6165
|
-
var cache =
|
|
3347
|
+
var cache = useContext(EmotionCacheContext);
|
|
6166
3348
|
return func(props, cache, ref);
|
|
6167
3349
|
});
|
|
6168
3350
|
};
|
|
@@ -6170,7 +3352,7 @@ var withEmotionCache = function withEmotionCache(func) {
|
|
|
6170
3352
|
if (!isBrowser) {
|
|
6171
3353
|
withEmotionCache = function withEmotionCache(func) {
|
|
6172
3354
|
return function (props) {
|
|
6173
|
-
var cache =
|
|
3355
|
+
var cache = useContext(EmotionCacheContext);
|
|
6174
3356
|
|
|
6175
3357
|
if (cache === null) {
|
|
6176
3358
|
// yes, we're potentially creating this on every render
|
|
@@ -6181,7 +3363,7 @@ if (!isBrowser) {
|
|
|
6181
3363
|
cache = createCache({
|
|
6182
3364
|
key: 'css'
|
|
6183
3365
|
});
|
|
6184
|
-
return /*#__PURE__*/
|
|
3366
|
+
return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
|
|
6185
3367
|
value: cache
|
|
6186
3368
|
}, func(props, cache));
|
|
6187
3369
|
} else {
|
|
@@ -6191,7 +3373,7 @@ if (!isBrowser) {
|
|
|
6191
3373
|
};
|
|
6192
3374
|
}
|
|
6193
3375
|
|
|
6194
|
-
var ThemeContext = /* #__PURE__ */
|
|
3376
|
+
var ThemeContext = /* #__PURE__ */React.createContext({});
|
|
6195
3377
|
|
|
6196
3378
|
if (process.env.NODE_ENV !== 'production') {
|
|
6197
3379
|
ThemeContext.displayName = 'EmotionThemeContext';
|
|
@@ -6287,7 +3469,7 @@ var Insertion = function Insertion(_ref) {
|
|
|
6287
3469
|
next = next.next;
|
|
6288
3470
|
}
|
|
6289
3471
|
|
|
6290
|
-
return /*#__PURE__*/
|
|
3472
|
+
return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
6291
3473
|
__html: rules
|
|
6292
3474
|
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
6293
3475
|
}
|
|
@@ -6314,7 +3496,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
6314
3496
|
className = props.className + " ";
|
|
6315
3497
|
}
|
|
6316
3498
|
|
|
6317
|
-
var serialized = serializeStyles(registeredStyles, undefined,
|
|
3499
|
+
var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
|
|
6318
3500
|
|
|
6319
3501
|
if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
|
|
6320
3502
|
var labelFromStack = props[labelPropName];
|
|
@@ -6335,11 +3517,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
6335
3517
|
|
|
6336
3518
|
newProps.ref = ref;
|
|
6337
3519
|
newProps.className = className;
|
|
6338
|
-
return /*#__PURE__*/
|
|
3520
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
|
6339
3521
|
cache: cache,
|
|
6340
3522
|
serialized: serialized,
|
|
6341
3523
|
isStringTag: typeof WrappedComponent === 'string'
|
|
6342
|
-
}), /*#__PURE__*/
|
|
3524
|
+
}), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
|
|
6343
3525
|
});
|
|
6344
3526
|
|
|
6345
3527
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -8090,7 +5272,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
8090
5272
|
};
|
|
8091
5273
|
|
|
8092
5274
|
return Provider;
|
|
8093
|
-
}(
|
|
5275
|
+
}(Component);
|
|
8094
5276
|
|
|
8095
5277
|
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = PropTypes.object.isRequired, _Provider$childContex);
|
|
8096
5278
|
|
|
@@ -8153,7 +5335,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
8153
5335
|
};
|
|
8154
5336
|
|
|
8155
5337
|
return Consumer;
|
|
8156
|
-
}(
|
|
5338
|
+
}(Component);
|
|
8157
5339
|
|
|
8158
5340
|
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = PropTypes.object, _Consumer$contextType);
|
|
8159
5341
|
return {
|
|
@@ -8162,7 +5344,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
8162
5344
|
};
|
|
8163
5345
|
}
|
|
8164
5346
|
|
|
8165
|
-
var index =
|
|
5347
|
+
var index = React__default.createContext || createReactContext;
|
|
8166
5348
|
|
|
8167
5349
|
var pathToRegexp$2 = {exports: {}};
|
|
8168
5350
|
|
|
@@ -8923,21 +6105,21 @@ function (_React$Component) {
|
|
|
8923
6105
|
};
|
|
8924
6106
|
|
|
8925
6107
|
_proto.render = function render() {
|
|
8926
|
-
return
|
|
6108
|
+
return React__default.createElement(context.Provider, {
|
|
8927
6109
|
value: {
|
|
8928
6110
|
history: this.props.history,
|
|
8929
6111
|
location: this.state.location,
|
|
8930
6112
|
match: Router.computeRootMatch(this.state.location.pathname),
|
|
8931
6113
|
staticContext: this.props.staticContext
|
|
8932
6114
|
}
|
|
8933
|
-
},
|
|
6115
|
+
}, React__default.createElement(historyContext.Provider, {
|
|
8934
6116
|
children: this.props.children || null,
|
|
8935
6117
|
value: this.props.history
|
|
8936
6118
|
}));
|
|
8937
6119
|
};
|
|
8938
6120
|
|
|
8939
6121
|
return Router;
|
|
8940
|
-
}(
|
|
6122
|
+
}(React__default.Component);
|
|
8941
6123
|
|
|
8942
6124
|
if (process.env.NODE_ENV !== "production") {
|
|
8943
6125
|
Router.propTypes = {
|
|
@@ -8975,14 +6157,14 @@ function (_React$Component) {
|
|
|
8975
6157
|
var _proto = MemoryRouter.prototype;
|
|
8976
6158
|
|
|
8977
6159
|
_proto.render = function render() {
|
|
8978
|
-
return
|
|
6160
|
+
return React__default.createElement(Router, {
|
|
8979
6161
|
history: this.history,
|
|
8980
6162
|
children: this.props.children
|
|
8981
6163
|
});
|
|
8982
6164
|
};
|
|
8983
6165
|
|
|
8984
6166
|
return MemoryRouter;
|
|
8985
|
-
}(
|
|
6167
|
+
}(React__default.Component);
|
|
8986
6168
|
|
|
8987
6169
|
if (process.env.NODE_ENV !== "production") {
|
|
8988
6170
|
MemoryRouter.propTypes = {
|
|
@@ -9026,7 +6208,7 @@ function (_React$Component) {
|
|
|
9026
6208
|
};
|
|
9027
6209
|
|
|
9028
6210
|
return Lifecycle;
|
|
9029
|
-
}(
|
|
6211
|
+
}(React__default.Component);
|
|
9030
6212
|
|
|
9031
6213
|
if (process.env.NODE_ENV !== "production") {
|
|
9032
6214
|
var messageType = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);
|
|
@@ -9079,7 +6261,7 @@ function Redirect(_ref) {
|
|
|
9079
6261
|
to = _ref.to,
|
|
9080
6262
|
_ref$push = _ref.push,
|
|
9081
6263
|
push = _ref$push === void 0 ? false : _ref$push;
|
|
9082
|
-
return
|
|
6264
|
+
return React__default.createElement(context.Consumer, null, function (context) {
|
|
9083
6265
|
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <Redirect> outside a <Router>") : invariant() : void 0;
|
|
9084
6266
|
var history = context.history,
|
|
9085
6267
|
staticContext = context.staticContext;
|
|
@@ -9094,7 +6276,7 @@ function Redirect(_ref) {
|
|
|
9094
6276
|
return null;
|
|
9095
6277
|
}
|
|
9096
6278
|
|
|
9097
|
-
return
|
|
6279
|
+
return React__default.createElement(Lifecycle, {
|
|
9098
6280
|
onMount: function onMount() {
|
|
9099
6281
|
method(location);
|
|
9100
6282
|
},
|
|
@@ -9201,7 +6383,7 @@ function matchPath(pathname, options) {
|
|
|
9201
6383
|
}
|
|
9202
6384
|
|
|
9203
6385
|
function isEmptyChildren(children) {
|
|
9204
|
-
return
|
|
6386
|
+
return React__default.Children.count(children) === 0;
|
|
9205
6387
|
}
|
|
9206
6388
|
|
|
9207
6389
|
function evalChildrenDev(children, props, path) {
|
|
@@ -9228,7 +6410,7 @@ function (_React$Component) {
|
|
|
9228
6410
|
_proto.render = function render() {
|
|
9229
6411
|
var _this = this;
|
|
9230
6412
|
|
|
9231
|
-
return
|
|
6413
|
+
return React__default.createElement(context.Consumer, null, function (context$1) {
|
|
9232
6414
|
!context$1 ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <Route> outside a <Router>") : invariant() : void 0;
|
|
9233
6415
|
var location = _this.props.location || context$1.location;
|
|
9234
6416
|
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
@@ -9249,14 +6431,14 @@ function (_React$Component) {
|
|
|
9249
6431
|
children = null;
|
|
9250
6432
|
}
|
|
9251
6433
|
|
|
9252
|
-
return
|
|
6434
|
+
return React__default.createElement(context.Provider, {
|
|
9253
6435
|
value: props
|
|
9254
|
-
}, props.match ? children ? typeof children === "function" ? process.env.NODE_ENV !== "production" ? evalChildrenDev(children, props, _this.props.path) : children(props) : children : component ?
|
|
6436
|
+
}, props.match ? children ? typeof children === "function" ? process.env.NODE_ENV !== "production" ? evalChildrenDev(children, props, _this.props.path) : children(props) : children : component ? React__default.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? process.env.NODE_ENV !== "production" ? evalChildrenDev(children, props, _this.props.path) : children(props) : null);
|
|
9255
6437
|
});
|
|
9256
6438
|
};
|
|
9257
6439
|
|
|
9258
6440
|
return Route;
|
|
9259
|
-
}(
|
|
6441
|
+
}(React__default.Component);
|
|
9260
6442
|
|
|
9261
6443
|
if (process.env.NODE_ENV !== "production") {
|
|
9262
6444
|
Route.propTypes = {
|
|
@@ -9395,14 +6577,14 @@ function (_React$Component) {
|
|
|
9395
6577
|
listen: this.handleListen,
|
|
9396
6578
|
block: this.handleBlock
|
|
9397
6579
|
};
|
|
9398
|
-
return
|
|
6580
|
+
return React__default.createElement(Router, _extends({}, rest, {
|
|
9399
6581
|
history: history,
|
|
9400
6582
|
staticContext: context
|
|
9401
6583
|
}));
|
|
9402
6584
|
};
|
|
9403
6585
|
|
|
9404
6586
|
return StaticRouter;
|
|
9405
|
-
}(
|
|
6587
|
+
}(React__default.Component);
|
|
9406
6588
|
|
|
9407
6589
|
if (process.env.NODE_ENV !== "production") {
|
|
9408
6590
|
StaticRouter.propTypes = {
|
|
@@ -9434,7 +6616,7 @@ function (_React$Component) {
|
|
|
9434
6616
|
_proto.render = function render() {
|
|
9435
6617
|
var _this = this;
|
|
9436
6618
|
|
|
9437
|
-
return
|
|
6619
|
+
return React__default.createElement(context.Consumer, null, function (context) {
|
|
9438
6620
|
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <Switch> outside a <Router>") : invariant() : void 0;
|
|
9439
6621
|
var location = _this.props.location || context.location;
|
|
9440
6622
|
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
@@ -9442,8 +6624,8 @@ function (_React$Component) {
|
|
|
9442
6624
|
// to trigger an unmount/remount for two <Route>s that render the same
|
|
9443
6625
|
// component at different URLs.
|
|
9444
6626
|
|
|
9445
|
-
|
|
9446
|
-
if (match == null &&
|
|
6627
|
+
React__default.Children.forEach(_this.props.children, function (child) {
|
|
6628
|
+
if (match == null && React__default.isValidElement(child)) {
|
|
9447
6629
|
element = child;
|
|
9448
6630
|
var path = child.props.path || child.props.from;
|
|
9449
6631
|
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
@@ -9451,7 +6633,7 @@ function (_React$Component) {
|
|
|
9451
6633
|
})) : context.match;
|
|
9452
6634
|
}
|
|
9453
6635
|
});
|
|
9454
|
-
return match ?
|
|
6636
|
+
return match ? React__default.cloneElement(element, {
|
|
9455
6637
|
location: location,
|
|
9456
6638
|
computedMatch: match
|
|
9457
6639
|
}) : null;
|
|
@@ -9459,7 +6641,7 @@ function (_React$Component) {
|
|
|
9459
6641
|
};
|
|
9460
6642
|
|
|
9461
6643
|
return Switch;
|
|
9462
|
-
}(
|
|
6644
|
+
}(React__default.Component);
|
|
9463
6645
|
|
|
9464
6646
|
if (process.env.NODE_ENV !== "production") {
|
|
9465
6647
|
Switch.propTypes = {
|
|
@@ -9473,7 +6655,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
9473
6655
|
};
|
|
9474
6656
|
}
|
|
9475
6657
|
|
|
9476
|
-
|
|
6658
|
+
React__default.useContext;
|
|
9477
6659
|
|
|
9478
6660
|
if (process.env.NODE_ENV !== "production") {
|
|
9479
6661
|
if (typeof window !== "undefined") {
|
|
@@ -10291,7 +7473,9 @@ const init = ({
|
|
|
10291
7473
|
.init({
|
|
10292
7474
|
lng: currentLng,
|
|
10293
7475
|
fallbackLng: systemDefaultLang,
|
|
10294
|
-
ns: '
|
|
7476
|
+
ns: ['common', 'inbox'],
|
|
7477
|
+
// define your namespaces
|
|
7478
|
+
defaultNS: 'common',
|
|
10295
7479
|
interpolation: {
|
|
10296
7480
|
escapeValue: false
|
|
10297
7481
|
},
|
|
@@ -10894,20 +8078,20 @@ const auth = {
|
|
|
10894
8078
|
* @param {string} encodedToken - base 64 token received from server and stored in local storage
|
|
10895
8079
|
* @returns {date | null} returns expiration date or null id expired props not found in decoded token
|
|
10896
8080
|
*/
|
|
10897
|
-
getTokenExpirationDate(encodedToken) {
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
},
|
|
8081
|
+
// getTokenExpirationDate(encodedToken: string): Date {
|
|
8082
|
+
// if (typeof window === 'undefined') {
|
|
8083
|
+
// return new Date(0);
|
|
8084
|
+
// }
|
|
8085
|
+
// if (!encodedToken) {
|
|
8086
|
+
// return new Date(0); // is expired
|
|
8087
|
+
// }
|
|
8088
|
+
// const token = decode<Token>(encodedToken);
|
|
8089
|
+
// if (!token.exp) {
|
|
8090
|
+
// return new Date(0); // is expired
|
|
8091
|
+
// }
|
|
8092
|
+
// const expirationDate = new Date(token.exp * 1000);
|
|
8093
|
+
// return expirationDate;
|
|
8094
|
+
// },
|
|
10911
8095
|
//TODO: Its not working for now while the token is not JWT token
|
|
10912
8096
|
/**
|
|
10913
8097
|
*
|
|
@@ -10916,12 +8100,12 @@ const auth = {
|
|
|
10916
8100
|
* @param {string} encodedToken - base 64 token received from server and stored in local storage
|
|
10917
8101
|
* @returns {bool} returns true if expired else false
|
|
10918
8102
|
*/
|
|
10919
|
-
isExpiredToken(encodedToken) {
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
},
|
|
8103
|
+
// isExpiredToken(encodedToken: string): boolean {
|
|
8104
|
+
// const expirationDate = this.getTokenExpirationDate(encodedToken);
|
|
8105
|
+
// const rightNow = new Date();
|
|
8106
|
+
// const isExpiredToken = isAfter(rightNow, expirationDate);
|
|
8107
|
+
// return isExpiredToken;
|
|
8108
|
+
// },
|
|
10925
8109
|
// /////////////////////////////////////////////////////////////
|
|
10926
8110
|
// USER_INFO
|
|
10927
8111
|
// /////////////////////////////////////////////////////////////
|