@nibssplc/cams-sdk-react 0.0.1-beta.41 → 0.0.1-beta.9
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/dist/components/CAMSMSALProvider.d.ts +5 -13
- package/dist/components/CAMSProvider.d.ts +1 -6
- package/dist/components/ProtectedRoute.d.ts +1 -1
- package/dist/hooks/useCAMSMSALAuth.d.ts +7 -5
- package/dist/index.cjs.js +1383 -609
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +1385 -609
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +18258 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +7 -10
- package/dist/components/ClientOnly.d.ts +0 -6
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React__default from 'react';
|
|
2
2
|
import React__default__default, { useState, useRef, useEffect, useCallback, useMemo, useReducer, useContext, createContext } from 'react';
|
|
3
|
-
import { CAMSSessionManager, CAMSError, CAMSErrorType
|
|
3
|
+
import { CAMSSessionManager, CAMSError, CAMSErrorType } from '@nibssplc/cams-sdk';
|
|
4
4
|
export * from '@nibssplc/cams-sdk';
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
@@ -97,9 +97,6 @@ function useCAMSAuth(options) {
|
|
|
97
97
|
var sessionManagerRef = useRef(null);
|
|
98
98
|
useEffect(function () {
|
|
99
99
|
var _a;
|
|
100
|
-
// Only initialize on client side
|
|
101
|
-
if (typeof window === 'undefined')
|
|
102
|
-
return;
|
|
103
100
|
(_a = sessionManagerRef.current) !== null && _a !== void 0 ? _a : (sessionManagerRef.current = new CAMSSessionManager(localStorage, options.storageKey || 'CAMS-SDK', {
|
|
104
101
|
onAuthSuccess: function (res) {
|
|
105
102
|
var _a;
|
|
@@ -16690,142 +16687,88 @@ function useAccount(accountIdentifiers) {
|
|
|
16690
16687
|
|
|
16691
16688
|
function useCAMSMSALAuth(options) {
|
|
16692
16689
|
var _this = this;
|
|
16693
|
-
if (options === void 0) { options = {
|
|
16694
|
-
mfaUrl: "/auth/multi-factor",
|
|
16695
|
-
}; }
|
|
16690
|
+
if (options === void 0) { options = {}; }
|
|
16696
16691
|
var _a = useMsal(), instance = _a.instance, inProgress = _a.inProgress, accounts = _a.accounts;
|
|
16697
16692
|
var account = useAccount(accounts[0] || {});
|
|
16698
|
-
var storageKey = 'CAMS-MSAL-AUTH-SDK';
|
|
16699
16693
|
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
16700
16694
|
var _c = useState(null), token = _c[0], setToken = _c[1];
|
|
16701
|
-
var _d = useState(null),
|
|
16702
|
-
var _e = useState(
|
|
16695
|
+
var _d = useState(null), profile = _d[0], setProfile = _d[1];
|
|
16696
|
+
var _e = useState(false), isMFAPending = _e[0], setIsMFAPending = _e[1];
|
|
16703
16697
|
var isLoading = inProgress !== InteractionStatus.None;
|
|
16704
|
-
var isAuthenticated = !!account && !!token;
|
|
16698
|
+
var isAuthenticated = !!account && !!token && !isMFAPending;
|
|
16705
16699
|
var scopes = options.scopes || ["openid", "profile", "email"];
|
|
16706
|
-
var isTokenValid = function (token) {
|
|
16707
|
-
try {
|
|
16708
|
-
var payload = JSON.parse(atob(token.split('.')[1]));
|
|
16709
|
-
return payload.exp * 1000 > Date.now();
|
|
16710
|
-
}
|
|
16711
|
-
catch (_a) {
|
|
16712
|
-
return false;
|
|
16713
|
-
}
|
|
16714
|
-
};
|
|
16715
16700
|
useEffect(function () {
|
|
16716
|
-
if (
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
16728
|
-
|
|
16701
|
+
if (account && !isMFAPending) {
|
|
16702
|
+
// Get token silently
|
|
16703
|
+
instance
|
|
16704
|
+
.acquireTokenSilent({
|
|
16705
|
+
scopes: scopes,
|
|
16706
|
+
account: account,
|
|
16707
|
+
})
|
|
16708
|
+
.then(function (response) {
|
|
16709
|
+
var _a, _b;
|
|
16710
|
+
if (options.mfaUrl) {
|
|
16711
|
+
// Redirect to MFA page
|
|
16712
|
+
setIsMFAPending(true);
|
|
16713
|
+
(_a = options.onMFARequired) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken, account);
|
|
16714
|
+
window.location.href = "".concat(options.mfaUrl, "?token=").concat(encodeURIComponent(response.accessToken));
|
|
16729
16715
|
}
|
|
16730
|
-
|
|
16731
|
-
|
|
16716
|
+
else {
|
|
16717
|
+
// Complete auth without MFA
|
|
16718
|
+
setToken(response.accessToken);
|
|
16719
|
+
setProfile({
|
|
16720
|
+
type: "AUTH_SUCCESS",
|
|
16721
|
+
userProfile: {
|
|
16722
|
+
name: account.name || "",
|
|
16723
|
+
email: account.username || "",
|
|
16724
|
+
isAuthenticated: true,
|
|
16725
|
+
mfaIsEnabled: true,
|
|
16726
|
+
message: "Authentication successful",
|
|
16727
|
+
userType: "USER",
|
|
16728
|
+
tokens: {
|
|
16729
|
+
Nonce: "",
|
|
16730
|
+
Bearer: response.accessToken,
|
|
16731
|
+
},
|
|
16732
|
+
},
|
|
16733
|
+
});
|
|
16734
|
+
(_b = options.onAuthSuccess) === null || _b === void 0 ? void 0 : _b.call(options, response.accessToken);
|
|
16735
|
+
}
|
|
16736
|
+
})
|
|
16737
|
+
.catch(function (err) {
|
|
16738
|
+
var _a;
|
|
16739
|
+
var camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Failed to acquire token silently: " + err);
|
|
16740
|
+
setError(camsError);
|
|
16741
|
+
(_a = options.onAuthError) === null || _a === void 0 ? void 0 : _a.call(options, camsError);
|
|
16742
|
+
});
|
|
16732
16743
|
}
|
|
16733
|
-
}, [
|
|
16734
|
-
// useEffect(() => {
|
|
16735
|
-
// const handleRedirect = async () => {
|
|
16736
|
-
// try {
|
|
16737
|
-
// const response = await instance.handleRedirectPromise();
|
|
16738
|
-
// if (response) {
|
|
16739
|
-
// const account = response.account;
|
|
16740
|
-
// instance.setActiveA ccount(account);
|
|
16741
|
-
// const tokenResponse = await instance.acq uireTokenSilent({
|
|
16742
|
-
// scopes,
|
|
16743
|
-
// account,
|
|
16744
|
-
// });
|
|
16745
|
-
// setToken(tokenResponse.accessToken);
|
|
16746
|
-
// setAccessToken(tokenResponse.accessToken);
|
|
16747
|
-
// setIdToken(tokenResponse.idTo ken);
|
|
16748
|
-
// options.onAuthSuccess?.(tokenR esponse.accessToken);
|
|
16749
|
-
// if (
|
|
16750
|
-
// typeof window !== "undefined" &&
|
|
16751
|
-
// process.env.NODE_ENV !== "test"
|
|
16752
|
-
// ) {
|
|
16753
|
-
// window.location.href = options.mfaUrl!;
|
|
16754
|
-
// }
|
|
16755
|
-
// }
|
|
16756
|
-
// } catch (err) {
|
|
16757
|
-
// console.error("Redirect handling failed:", err);
|
|
16758
|
-
// }
|
|
16759
|
-
// };
|
|
16760
|
-
// handleRedirect();
|
|
16761
|
-
// }, []);
|
|
16744
|
+
}, [account, instance, isMFAPending]);
|
|
16762
16745
|
var login = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16763
|
-
var err_1,
|
|
16764
|
-
var _a
|
|
16765
|
-
return __generator(this, function (
|
|
16766
|
-
switch (
|
|
16746
|
+
var err_1, camsError;
|
|
16747
|
+
var _a;
|
|
16748
|
+
return __generator(this, function (_b) {
|
|
16749
|
+
switch (_b.label) {
|
|
16767
16750
|
case 0:
|
|
16768
16751
|
setError(null);
|
|
16769
|
-
|
|
16752
|
+
_b.label = 1;
|
|
16770
16753
|
case 1:
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
// scopes,
|
|
16774
|
-
// prompt: options.prompt || "login",
|
|
16775
|
-
// });
|
|
16776
|
-
return [4 /*yield*/, instance
|
|
16777
|
-
.loginPopup({
|
|
16754
|
+
_b.trys.push([1, 3, , 4]);
|
|
16755
|
+
return [4 /*yield*/, instance.loginRedirect({
|
|
16778
16756
|
scopes: scopes,
|
|
16779
|
-
prompt:
|
|
16780
|
-
})
|
|
16781
|
-
.then(function (response) {
|
|
16782
|
-
var _a;
|
|
16783
|
-
Logger$1.debug("Login Token response:", {
|
|
16784
|
-
accessToken: accessToken,
|
|
16785
|
-
idToken: idToken
|
|
16786
|
-
});
|
|
16787
|
-
setToken(response.accessToken);
|
|
16788
|
-
setAccessToken(response.accessToken);
|
|
16789
|
-
setIdToken(response.idToken);
|
|
16790
|
-
// Persist tokens to localStorage
|
|
16791
|
-
if (typeof window !== 'undefined') {
|
|
16792
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
16793
|
-
isAuthenticated: true,
|
|
16794
|
-
accessToken: response.accessToken,
|
|
16795
|
-
idToken: response.idToken
|
|
16796
|
-
}));
|
|
16797
|
-
}
|
|
16798
|
-
(_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
|
|
16799
|
-
if (typeof window !== "undefined" &&
|
|
16800
|
-
process.env.NODE_ENV !== "test") {
|
|
16801
|
-
window.location.href = options.mfaUrl;
|
|
16802
|
-
}
|
|
16757
|
+
prompt: "select_account",
|
|
16803
16758
|
})];
|
|
16804
16759
|
case 2:
|
|
16805
|
-
|
|
16806
|
-
// scopes,
|
|
16807
|
-
// prompt: options.prompt || "login",
|
|
16808
|
-
// });
|
|
16809
|
-
_d.sent();
|
|
16760
|
+
_b.sent();
|
|
16810
16761
|
return [3 /*break*/, 4];
|
|
16811
16762
|
case 3:
|
|
16812
|
-
err_1 =
|
|
16813
|
-
// If popup is blocked
|
|
16814
|
-
if (err_1.errorCode === "popup_window_error" ||
|
|
16815
|
-
((_a = err_1.message) === null || _a === void 0 ? void 0 : _a.includes("popup"))) {
|
|
16816
|
-
camsError_1 = new CAMSError(CAMSErrorType.POPUP_BLOCKED, "Both popup and redirect failed: " + err_1);
|
|
16817
|
-
setError(camsError_1);
|
|
16818
|
-
(_b = options.onAuthError) === null || _b === void 0 ? void 0 : _b.call(options, camsError_1);
|
|
16819
|
-
return [2 /*return*/];
|
|
16820
|
-
}
|
|
16763
|
+
err_1 = _b.sent();
|
|
16821
16764
|
camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Login failed: " + err_1);
|
|
16822
16765
|
setError(camsError);
|
|
16823
|
-
(
|
|
16766
|
+
(_a = options.onAuthError) === null || _a === void 0 ? void 0 : _a.call(options, camsError);
|
|
16824
16767
|
return [3 /*break*/, 4];
|
|
16825
16768
|
case 4: return [2 /*return*/];
|
|
16826
16769
|
}
|
|
16827
16770
|
});
|
|
16828
|
-
}); }, [instance, scopes
|
|
16771
|
+
}); }, [instance, scopes]);
|
|
16829
16772
|
var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16830
16773
|
var err_2, camsError;
|
|
16831
16774
|
return __generator(this, function (_a) {
|
|
@@ -16836,12 +16779,9 @@ function useCAMSMSALAuth(options) {
|
|
|
16836
16779
|
case 1:
|
|
16837
16780
|
_a.sent();
|
|
16838
16781
|
setToken(null);
|
|
16839
|
-
|
|
16840
|
-
setIdToken(null);
|
|
16782
|
+
setProfile(null);
|
|
16841
16783
|
setError(null);
|
|
16842
|
-
|
|
16843
|
-
localStorage.removeItem(storageKey);
|
|
16844
|
-
}
|
|
16784
|
+
setIsMFAPending(false);
|
|
16845
16785
|
return [3 /*break*/, 3];
|
|
16846
16786
|
case 2:
|
|
16847
16787
|
err_2 = _a.sent();
|
|
@@ -16852,62 +16792,65 @@ function useCAMSMSALAuth(options) {
|
|
|
16852
16792
|
}
|
|
16853
16793
|
});
|
|
16854
16794
|
}); }, [instance]);
|
|
16795
|
+
var completeMFA = useCallback(function (mfaToken) {
|
|
16796
|
+
var _a;
|
|
16797
|
+
setToken(mfaToken);
|
|
16798
|
+
setIsMFAPending(false);
|
|
16799
|
+
if (account) {
|
|
16800
|
+
setProfile({
|
|
16801
|
+
type: "AUTH_SUCCESS",
|
|
16802
|
+
userProfile: {
|
|
16803
|
+
name: account.name || "",
|
|
16804
|
+
email: account.username || "",
|
|
16805
|
+
isAuthenticated: true,
|
|
16806
|
+
mfaIsEnabled: true,
|
|
16807
|
+
message: "Authentication successful",
|
|
16808
|
+
userType: "USER",
|
|
16809
|
+
tokens: {
|
|
16810
|
+
Nonce: "",
|
|
16811
|
+
Bearer: token !== null && token !== void 0 ? token : "",
|
|
16812
|
+
},
|
|
16813
|
+
},
|
|
16814
|
+
});
|
|
16815
|
+
}
|
|
16816
|
+
(_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, mfaToken);
|
|
16817
|
+
}, [account, options]);
|
|
16855
16818
|
return {
|
|
16856
16819
|
login: login,
|
|
16857
16820
|
logout: logout,
|
|
16858
|
-
|
|
16821
|
+
completeMFA: completeMFA,
|
|
16859
16822
|
isAuthenticated: isAuthenticated,
|
|
16860
16823
|
isLoading: isLoading,
|
|
16824
|
+
isMFAPending: isMFAPending,
|
|
16861
16825
|
error: error,
|
|
16862
16826
|
token: token,
|
|
16863
|
-
|
|
16864
|
-
|
|
16827
|
+
profile: profile,
|
|
16828
|
+
account: account,
|
|
16865
16829
|
};
|
|
16866
16830
|
}
|
|
16867
16831
|
|
|
16868
16832
|
var jsxRuntime = {exports: {}};
|
|
16869
16833
|
|
|
16870
|
-
var
|
|
16834
|
+
var reactJsxRuntime_production_min = {};
|
|
16871
16835
|
|
|
16872
16836
|
/**
|
|
16873
16837
|
* @license React
|
|
16874
|
-
* react-jsx-runtime.production.js
|
|
16838
|
+
* react-jsx-runtime.production.min.js
|
|
16875
16839
|
*
|
|
16876
|
-
* Copyright (c)
|
|
16840
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16877
16841
|
*
|
|
16878
16842
|
* This source code is licensed under the MIT license found in the
|
|
16879
16843
|
* LICENSE file in the root directory of this source tree.
|
|
16880
16844
|
*/
|
|
16881
16845
|
|
|
16882
|
-
var
|
|
16883
|
-
|
|
16884
|
-
function
|
|
16885
|
-
if (
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
|
|
16890
|
-
var key = null;
|
|
16891
|
-
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
16892
|
-
void 0 !== config.key && (key = "" + config.key);
|
|
16893
|
-
if ("key" in config) {
|
|
16894
|
-
maybeKey = {};
|
|
16895
|
-
for (var propName in config)
|
|
16896
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
16897
|
-
} else maybeKey = config;
|
|
16898
|
-
config = maybeKey.ref;
|
|
16899
|
-
return {
|
|
16900
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
16901
|
-
type: type,
|
|
16902
|
-
key: key,
|
|
16903
|
-
ref: void 0 !== config ? config : null,
|
|
16904
|
-
props: maybeKey
|
|
16905
|
-
};
|
|
16906
|
-
}
|
|
16907
|
-
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
16908
|
-
reactJsxRuntime_production.jsx = jsxProd;
|
|
16909
|
-
reactJsxRuntime_production.jsxs = jsxProd;
|
|
16910
|
-
return reactJsxRuntime_production;
|
|
16846
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
16847
|
+
|
|
16848
|
+
function requireReactJsxRuntime_production_min () {
|
|
16849
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
16850
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
16851
|
+
var f=React__default__default,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
|
|
16852
|
+
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
16853
|
+
return reactJsxRuntime_production_min;
|
|
16911
16854
|
}
|
|
16912
16855
|
|
|
16913
16856
|
var reactJsxRuntime_development = {};
|
|
@@ -16916,7 +16859,7 @@ var reactJsxRuntime_development = {};
|
|
|
16916
16859
|
* @license React
|
|
16917
16860
|
* react-jsx-runtime.development.js
|
|
16918
16861
|
*
|
|
16919
|
-
* Copyright (c)
|
|
16862
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16920
16863
|
*
|
|
16921
16864
|
* This source code is licensed under the MIT license found in the
|
|
16922
16865
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -16927,357 +16870,1314 @@ var hasRequiredReactJsxRuntime_development;
|
|
|
16927
16870
|
function requireReactJsxRuntime_development () {
|
|
16928
16871
|
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
16929
16872
|
hasRequiredReactJsxRuntime_development = 1;
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
|
|
16950
|
-
|
|
16951
|
-
|
|
16873
|
+
|
|
16874
|
+
if (process.env.NODE_ENV !== "production") {
|
|
16875
|
+
(function() {
|
|
16876
|
+
|
|
16877
|
+
var React = React__default__default;
|
|
16878
|
+
|
|
16879
|
+
// ATTENTION
|
|
16880
|
+
// When adding new symbols to this file,
|
|
16881
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
16882
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
16883
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
16884
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
16885
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
16886
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
16887
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
16888
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
16889
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
16890
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
16891
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
16892
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
16893
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
16894
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
16895
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
16896
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
16897
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
16898
|
+
function getIteratorFn(maybeIterable) {
|
|
16899
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
16900
|
+
return null;
|
|
16901
|
+
}
|
|
16902
|
+
|
|
16903
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
16904
|
+
|
|
16905
|
+
if (typeof maybeIterator === 'function') {
|
|
16906
|
+
return maybeIterator;
|
|
16907
|
+
}
|
|
16908
|
+
|
|
16909
|
+
return null;
|
|
16910
|
+
}
|
|
16911
|
+
|
|
16912
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
16913
|
+
|
|
16914
|
+
function error(format) {
|
|
16915
|
+
{
|
|
16916
|
+
{
|
|
16917
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
16918
|
+
args[_key2 - 1] = arguments[_key2];
|
|
16952
16919
|
}
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
|
|
16977
|
-
|
|
16978
|
-
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
|
|
16982
|
-
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
|
|
16920
|
+
|
|
16921
|
+
printWarning('error', format, args);
|
|
16922
|
+
}
|
|
16923
|
+
}
|
|
16924
|
+
}
|
|
16925
|
+
|
|
16926
|
+
function printWarning(level, format, args) {
|
|
16927
|
+
// When changing this logic, you might want to also
|
|
16928
|
+
// update consoleWithStackDev.www.js as well.
|
|
16929
|
+
{
|
|
16930
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
16931
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
16932
|
+
|
|
16933
|
+
if (stack !== '') {
|
|
16934
|
+
format += '%s';
|
|
16935
|
+
args = args.concat([stack]);
|
|
16936
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
16937
|
+
|
|
16938
|
+
|
|
16939
|
+
var argsWithFormat = args.map(function (item) {
|
|
16940
|
+
return String(item);
|
|
16941
|
+
}); // Careful: RN currently depends on this prefix
|
|
16942
|
+
|
|
16943
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
16944
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
16945
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
16946
|
+
|
|
16947
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
16948
|
+
}
|
|
16949
|
+
}
|
|
16950
|
+
|
|
16951
|
+
// -----------------------------------------------------------------------------
|
|
16952
|
+
|
|
16953
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
16954
|
+
var enableCacheElement = false;
|
|
16955
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
16956
|
+
|
|
16957
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
16958
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
16959
|
+
// issues in DEV builds.
|
|
16960
|
+
|
|
16961
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
16962
|
+
|
|
16963
|
+
var REACT_MODULE_REFERENCE;
|
|
16964
|
+
|
|
16965
|
+
{
|
|
16966
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
16967
|
+
}
|
|
16968
|
+
|
|
16969
|
+
function isValidElementType(type) {
|
|
16970
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
16971
|
+
return true;
|
|
16972
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
16973
|
+
|
|
16974
|
+
|
|
16975
|
+
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 ) {
|
|
16976
|
+
return true;
|
|
16977
|
+
}
|
|
16978
|
+
|
|
16979
|
+
if (typeof type === 'object' && type !== null) {
|
|
16980
|
+
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
|
|
16981
|
+
// types supported by any Flight configuration anywhere since
|
|
16982
|
+
// we don't know which Flight build this will end up being used
|
|
16983
|
+
// with.
|
|
16984
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
16985
|
+
return true;
|
|
16986
|
+
}
|
|
16987
|
+
}
|
|
16988
|
+
|
|
16989
|
+
return false;
|
|
16990
|
+
}
|
|
16991
|
+
|
|
16992
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
16993
|
+
var displayName = outerType.displayName;
|
|
16994
|
+
|
|
16995
|
+
if (displayName) {
|
|
16996
|
+
return displayName;
|
|
16997
|
+
}
|
|
16998
|
+
|
|
16999
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
17000
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
17001
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
17002
|
+
|
|
17003
|
+
|
|
17004
|
+
function getContextName(type) {
|
|
17005
|
+
return type.displayName || 'Context';
|
|
17006
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
17007
|
+
|
|
17008
|
+
|
|
17009
|
+
function getComponentNameFromType(type) {
|
|
17010
|
+
if (type == null) {
|
|
17011
|
+
// Host root, text node or just invalid type.
|
|
17012
|
+
return null;
|
|
17013
|
+
}
|
|
17014
|
+
|
|
17015
|
+
{
|
|
17016
|
+
if (typeof type.tag === 'number') {
|
|
17017
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
17018
|
+
}
|
|
17019
|
+
}
|
|
17020
|
+
|
|
17021
|
+
if (typeof type === 'function') {
|
|
17022
|
+
return type.displayName || type.name || null;
|
|
17023
|
+
}
|
|
17024
|
+
|
|
17025
|
+
if (typeof type === 'string') {
|
|
17026
|
+
return type;
|
|
17027
|
+
}
|
|
17028
|
+
|
|
17029
|
+
switch (type) {
|
|
17030
|
+
case REACT_FRAGMENT_TYPE:
|
|
17031
|
+
return 'Fragment';
|
|
17032
|
+
|
|
17033
|
+
case REACT_PORTAL_TYPE:
|
|
17034
|
+
return 'Portal';
|
|
17035
|
+
|
|
17036
|
+
case REACT_PROFILER_TYPE:
|
|
17037
|
+
return 'Profiler';
|
|
17038
|
+
|
|
17039
|
+
case REACT_STRICT_MODE_TYPE:
|
|
17040
|
+
return 'StrictMode';
|
|
17041
|
+
|
|
17042
|
+
case REACT_SUSPENSE_TYPE:
|
|
17043
|
+
return 'Suspense';
|
|
17044
|
+
|
|
17045
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
17046
|
+
return 'SuspenseList';
|
|
17047
|
+
|
|
17048
|
+
}
|
|
17049
|
+
|
|
17050
|
+
if (typeof type === 'object') {
|
|
17051
|
+
switch (type.$$typeof) {
|
|
17052
|
+
case REACT_CONTEXT_TYPE:
|
|
17053
|
+
var context = type;
|
|
17054
|
+
return getContextName(context) + '.Consumer';
|
|
17055
|
+
|
|
17056
|
+
case REACT_PROVIDER_TYPE:
|
|
17057
|
+
var provider = type;
|
|
17058
|
+
return getContextName(provider._context) + '.Provider';
|
|
17059
|
+
|
|
17060
|
+
case REACT_FORWARD_REF_TYPE:
|
|
17061
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
17062
|
+
|
|
17063
|
+
case REACT_MEMO_TYPE:
|
|
17064
|
+
var outerName = type.displayName || null;
|
|
17065
|
+
|
|
17066
|
+
if (outerName !== null) {
|
|
17067
|
+
return outerName;
|
|
16987
17068
|
}
|
|
16988
|
-
|
|
17069
|
+
|
|
17070
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
17071
|
+
|
|
17072
|
+
case REACT_LAZY_TYPE:
|
|
17073
|
+
{
|
|
17074
|
+
var lazyComponent = type;
|
|
17075
|
+
var payload = lazyComponent._payload;
|
|
17076
|
+
var init = lazyComponent._init;
|
|
17077
|
+
|
|
17078
|
+
try {
|
|
17079
|
+
return getComponentNameFromType(init(payload));
|
|
17080
|
+
} catch (x) {
|
|
17081
|
+
return null;
|
|
17082
|
+
}
|
|
17083
|
+
}
|
|
17084
|
+
|
|
17085
|
+
// eslint-disable-next-line no-fallthrough
|
|
16989
17086
|
}
|
|
16990
|
-
|
|
16991
|
-
|
|
17087
|
+
}
|
|
17088
|
+
|
|
17089
|
+
return null;
|
|
17090
|
+
}
|
|
17091
|
+
|
|
17092
|
+
var assign = Object.assign;
|
|
17093
|
+
|
|
17094
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
17095
|
+
// replaying on render function. This currently only patches the object
|
|
17096
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
17097
|
+
// We could also eagerly patch the method.
|
|
17098
|
+
var disabledDepth = 0;
|
|
17099
|
+
var prevLog;
|
|
17100
|
+
var prevInfo;
|
|
17101
|
+
var prevWarn;
|
|
17102
|
+
var prevError;
|
|
17103
|
+
var prevGroup;
|
|
17104
|
+
var prevGroupCollapsed;
|
|
17105
|
+
var prevGroupEnd;
|
|
17106
|
+
|
|
17107
|
+
function disabledLog() {}
|
|
17108
|
+
|
|
17109
|
+
disabledLog.__reactDisabledLog = true;
|
|
17110
|
+
function disableLogs() {
|
|
17111
|
+
{
|
|
17112
|
+
if (disabledDepth === 0) {
|
|
17113
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
17114
|
+
prevLog = console.log;
|
|
17115
|
+
prevInfo = console.info;
|
|
17116
|
+
prevWarn = console.warn;
|
|
17117
|
+
prevError = console.error;
|
|
17118
|
+
prevGroup = console.group;
|
|
17119
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
17120
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
17121
|
+
|
|
17122
|
+
var props = {
|
|
17123
|
+
configurable: true,
|
|
17124
|
+
enumerable: true,
|
|
17125
|
+
value: disabledLog,
|
|
17126
|
+
writable: true
|
|
17127
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
17128
|
+
|
|
17129
|
+
Object.defineProperties(console, {
|
|
17130
|
+
info: props,
|
|
17131
|
+
log: props,
|
|
17132
|
+
warn: props,
|
|
17133
|
+
error: props,
|
|
17134
|
+
group: props,
|
|
17135
|
+
groupCollapsed: props,
|
|
17136
|
+
groupEnd: props
|
|
17137
|
+
});
|
|
17138
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
17139
|
+
}
|
|
17140
|
+
|
|
17141
|
+
disabledDepth++;
|
|
17142
|
+
}
|
|
17143
|
+
}
|
|
17144
|
+
function reenableLogs() {
|
|
17145
|
+
{
|
|
17146
|
+
disabledDepth--;
|
|
17147
|
+
|
|
17148
|
+
if (disabledDepth === 0) {
|
|
17149
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
17150
|
+
var props = {
|
|
17151
|
+
configurable: true,
|
|
17152
|
+
enumerable: true,
|
|
17153
|
+
writable: true
|
|
17154
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
17155
|
+
|
|
17156
|
+
Object.defineProperties(console, {
|
|
17157
|
+
log: assign({}, props, {
|
|
17158
|
+
value: prevLog
|
|
17159
|
+
}),
|
|
17160
|
+
info: assign({}, props, {
|
|
17161
|
+
value: prevInfo
|
|
17162
|
+
}),
|
|
17163
|
+
warn: assign({}, props, {
|
|
17164
|
+
value: prevWarn
|
|
17165
|
+
}),
|
|
17166
|
+
error: assign({}, props, {
|
|
17167
|
+
value: prevError
|
|
17168
|
+
}),
|
|
17169
|
+
group: assign({}, props, {
|
|
17170
|
+
value: prevGroup
|
|
17171
|
+
}),
|
|
17172
|
+
groupCollapsed: assign({}, props, {
|
|
17173
|
+
value: prevGroupCollapsed
|
|
17174
|
+
}),
|
|
17175
|
+
groupEnd: assign({}, props, {
|
|
17176
|
+
value: prevGroupEnd
|
|
17177
|
+
})
|
|
17178
|
+
});
|
|
17179
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
17180
|
+
}
|
|
17181
|
+
|
|
17182
|
+
if (disabledDepth < 0) {
|
|
17183
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
16992
17184
|
}
|
|
16993
|
-
|
|
17185
|
+
}
|
|
17186
|
+
}
|
|
17187
|
+
|
|
17188
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
17189
|
+
var prefix;
|
|
17190
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
17191
|
+
{
|
|
17192
|
+
if (prefix === undefined) {
|
|
17193
|
+
// Extract the VM specific prefix used by each line.
|
|
16994
17194
|
try {
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
}
|
|
17000
|
-
if (JSCompiler_inline_result) {
|
|
17001
|
-
JSCompiler_inline_result = console;
|
|
17002
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
17003
|
-
var JSCompiler_inline_result$jscomp$0 =
|
|
17004
|
-
("function" === typeof Symbol &&
|
|
17005
|
-
Symbol.toStringTag &&
|
|
17006
|
-
value[Symbol.toStringTag]) ||
|
|
17007
|
-
value.constructor.name ||
|
|
17008
|
-
"Object";
|
|
17009
|
-
JSCompiler_temp_const.call(
|
|
17010
|
-
JSCompiler_inline_result,
|
|
17011
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
17012
|
-
JSCompiler_inline_result$jscomp$0
|
|
17013
|
-
);
|
|
17014
|
-
return testStringCoercion(value);
|
|
17195
|
+
throw Error();
|
|
17196
|
+
} catch (x) {
|
|
17197
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
17198
|
+
prefix = match && match[1] || '';
|
|
17015
17199
|
}
|
|
17200
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
17201
|
+
|
|
17202
|
+
|
|
17203
|
+
return '\n' + prefix + name;
|
|
17204
|
+
}
|
|
17205
|
+
}
|
|
17206
|
+
var reentry = false;
|
|
17207
|
+
var componentFrameCache;
|
|
17208
|
+
|
|
17209
|
+
{
|
|
17210
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
17211
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
17212
|
+
}
|
|
17213
|
+
|
|
17214
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
17215
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
17216
|
+
if ( !fn || reentry) {
|
|
17217
|
+
return '';
|
|
17218
|
+
}
|
|
17219
|
+
|
|
17220
|
+
{
|
|
17221
|
+
var frame = componentFrameCache.get(fn);
|
|
17222
|
+
|
|
17223
|
+
if (frame !== undefined) {
|
|
17224
|
+
return frame;
|
|
17016
17225
|
}
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17226
|
+
}
|
|
17227
|
+
|
|
17228
|
+
var control;
|
|
17229
|
+
reentry = true;
|
|
17230
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
17231
|
+
|
|
17232
|
+
Error.prepareStackTrace = undefined;
|
|
17233
|
+
var previousDispatcher;
|
|
17234
|
+
|
|
17235
|
+
{
|
|
17236
|
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
17237
|
+
// for warnings.
|
|
17238
|
+
|
|
17239
|
+
ReactCurrentDispatcher.current = null;
|
|
17240
|
+
disableLogs();
|
|
17241
|
+
}
|
|
17242
|
+
|
|
17243
|
+
try {
|
|
17244
|
+
// This should throw.
|
|
17245
|
+
if (construct) {
|
|
17246
|
+
// Something should be setting the props in the constructor.
|
|
17247
|
+
var Fake = function () {
|
|
17248
|
+
throw Error();
|
|
17249
|
+
}; // $FlowFixMe
|
|
17250
|
+
|
|
17251
|
+
|
|
17252
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
17253
|
+
set: function () {
|
|
17254
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
17255
|
+
// because that won't throw in a non-strict mode function.
|
|
17256
|
+
throw Error();
|
|
17257
|
+
}
|
|
17258
|
+
});
|
|
17259
|
+
|
|
17260
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
17261
|
+
// We construct a different control for this case to include any extra
|
|
17262
|
+
// frames added by the construct call.
|
|
17263
|
+
try {
|
|
17264
|
+
Reflect.construct(Fake, []);
|
|
17265
|
+
} catch (x) {
|
|
17266
|
+
control = x;
|
|
17267
|
+
}
|
|
17268
|
+
|
|
17269
|
+
Reflect.construct(fn, [], Fake);
|
|
17270
|
+
} else {
|
|
17271
|
+
try {
|
|
17272
|
+
Fake.call();
|
|
17273
|
+
} catch (x) {
|
|
17274
|
+
control = x;
|
|
17275
|
+
}
|
|
17276
|
+
|
|
17277
|
+
fn.call(Fake.prototype);
|
|
17278
|
+
}
|
|
17279
|
+
} else {
|
|
17025
17280
|
try {
|
|
17026
|
-
|
|
17027
|
-
return name ? "<" + name + ">" : "<...>";
|
|
17281
|
+
throw Error();
|
|
17028
17282
|
} catch (x) {
|
|
17029
|
-
|
|
17283
|
+
control = x;
|
|
17030
17284
|
}
|
|
17285
|
+
|
|
17286
|
+
fn();
|
|
17031
17287
|
}
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17288
|
+
} catch (sample) {
|
|
17289
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
17290
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
17291
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
17292
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
17293
|
+
var sampleLines = sample.stack.split('\n');
|
|
17294
|
+
var controlLines = control.stack.split('\n');
|
|
17295
|
+
var s = sampleLines.length - 1;
|
|
17296
|
+
var c = controlLines.length - 1;
|
|
17297
|
+
|
|
17298
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
17299
|
+
// We expect at least one stack frame to be shared.
|
|
17300
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
17301
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
17302
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
17303
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
17304
|
+
// the sample somewhere in the control.
|
|
17305
|
+
c--;
|
|
17306
|
+
}
|
|
17307
|
+
|
|
17308
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
17309
|
+
// Next we find the first one that isn't the same which should be the
|
|
17310
|
+
// frame that called our sample function and the control.
|
|
17311
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
17312
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
17313
|
+
// If we're about to return the first line, and the control is also on the same
|
|
17314
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
17315
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
17316
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
17317
|
+
if (s !== 1 || c !== 1) {
|
|
17318
|
+
do {
|
|
17319
|
+
s--;
|
|
17320
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
17321
|
+
// The next one that isn't the same should be our match though.
|
|
17322
|
+
|
|
17323
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
17324
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
17325
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
17326
|
+
// but we have a user-provided "displayName"
|
|
17327
|
+
// splice it in to make the stack more readable.
|
|
17328
|
+
|
|
17329
|
+
|
|
17330
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
17331
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
17332
|
+
}
|
|
17333
|
+
|
|
17334
|
+
{
|
|
17335
|
+
if (typeof fn === 'function') {
|
|
17336
|
+
componentFrameCache.set(fn, _frame);
|
|
17337
|
+
}
|
|
17338
|
+
} // Return the line we found.
|
|
17339
|
+
|
|
17340
|
+
|
|
17341
|
+
return _frame;
|
|
17342
|
+
}
|
|
17343
|
+
} while (s >= 1 && c >= 0);
|
|
17344
|
+
}
|
|
17345
|
+
|
|
17346
|
+
break;
|
|
17347
|
+
}
|
|
17348
|
+
}
|
|
17035
17349
|
}
|
|
17036
|
-
|
|
17037
|
-
|
|
17350
|
+
} finally {
|
|
17351
|
+
reentry = false;
|
|
17352
|
+
|
|
17353
|
+
{
|
|
17354
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
17355
|
+
reenableLogs();
|
|
17038
17356
|
}
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
17042
|
-
|
|
17043
|
-
|
|
17044
|
-
|
|
17357
|
+
|
|
17358
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
17359
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
17360
|
+
|
|
17361
|
+
|
|
17362
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
17363
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
17364
|
+
|
|
17365
|
+
{
|
|
17366
|
+
if (typeof fn === 'function') {
|
|
17367
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
17368
|
+
}
|
|
17369
|
+
}
|
|
17370
|
+
|
|
17371
|
+
return syntheticFrame;
|
|
17372
|
+
}
|
|
17373
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
17374
|
+
{
|
|
17375
|
+
return describeNativeComponentFrame(fn, false);
|
|
17376
|
+
}
|
|
17377
|
+
}
|
|
17378
|
+
|
|
17379
|
+
function shouldConstruct(Component) {
|
|
17380
|
+
var prototype = Component.prototype;
|
|
17381
|
+
return !!(prototype && prototype.isReactComponent);
|
|
17382
|
+
}
|
|
17383
|
+
|
|
17384
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
17385
|
+
|
|
17386
|
+
if (type == null) {
|
|
17387
|
+
return '';
|
|
17388
|
+
}
|
|
17389
|
+
|
|
17390
|
+
if (typeof type === 'function') {
|
|
17391
|
+
{
|
|
17392
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
17393
|
+
}
|
|
17394
|
+
}
|
|
17395
|
+
|
|
17396
|
+
if (typeof type === 'string') {
|
|
17397
|
+
return describeBuiltInComponentFrame(type);
|
|
17398
|
+
}
|
|
17399
|
+
|
|
17400
|
+
switch (type) {
|
|
17401
|
+
case REACT_SUSPENSE_TYPE:
|
|
17402
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
17403
|
+
|
|
17404
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
17405
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
17406
|
+
}
|
|
17407
|
+
|
|
17408
|
+
if (typeof type === 'object') {
|
|
17409
|
+
switch (type.$$typeof) {
|
|
17410
|
+
case REACT_FORWARD_REF_TYPE:
|
|
17411
|
+
return describeFunctionComponentFrame(type.render);
|
|
17412
|
+
|
|
17413
|
+
case REACT_MEMO_TYPE:
|
|
17414
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
17415
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
17416
|
+
|
|
17417
|
+
case REACT_LAZY_TYPE:
|
|
17418
|
+
{
|
|
17419
|
+
var lazyComponent = type;
|
|
17420
|
+
var payload = lazyComponent._payload;
|
|
17421
|
+
var init = lazyComponent._init;
|
|
17422
|
+
|
|
17423
|
+
try {
|
|
17424
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
17425
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
17426
|
+
} catch (x) {}
|
|
17427
|
+
}
|
|
17428
|
+
}
|
|
17429
|
+
}
|
|
17430
|
+
|
|
17431
|
+
return '';
|
|
17432
|
+
}
|
|
17433
|
+
|
|
17434
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
17435
|
+
|
|
17436
|
+
var loggedTypeFailures = {};
|
|
17437
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
17438
|
+
|
|
17439
|
+
function setCurrentlyValidatingElement(element) {
|
|
17440
|
+
{
|
|
17441
|
+
if (element) {
|
|
17442
|
+
var owner = element._owner;
|
|
17443
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
17444
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
17445
|
+
} else {
|
|
17446
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
17045
17447
|
}
|
|
17046
|
-
|
|
17047
|
-
|
|
17048
|
-
|
|
17049
|
-
|
|
17050
|
-
|
|
17051
|
-
|
|
17052
|
-
|
|
17053
|
-
|
|
17448
|
+
}
|
|
17449
|
+
}
|
|
17450
|
+
|
|
17451
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
17452
|
+
{
|
|
17453
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
17454
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
17455
|
+
|
|
17456
|
+
for (var typeSpecName in typeSpecs) {
|
|
17457
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
17458
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
17459
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
17460
|
+
// After these have been cleaned up, we'll let them throw.
|
|
17461
|
+
|
|
17462
|
+
try {
|
|
17463
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
17464
|
+
// behavior as without this statement except with a better message.
|
|
17465
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
17466
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
|
17467
|
+
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`.');
|
|
17468
|
+
err.name = 'Invariant Violation';
|
|
17469
|
+
throw err;
|
|
17470
|
+
}
|
|
17471
|
+
|
|
17472
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
17473
|
+
} catch (ex) {
|
|
17474
|
+
error$1 = ex;
|
|
17475
|
+
}
|
|
17476
|
+
|
|
17477
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
17478
|
+
setCurrentlyValidatingElement(element);
|
|
17479
|
+
|
|
17480
|
+
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);
|
|
17481
|
+
|
|
17482
|
+
setCurrentlyValidatingElement(null);
|
|
17483
|
+
}
|
|
17484
|
+
|
|
17485
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
17486
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
17487
|
+
// same error.
|
|
17488
|
+
loggedTypeFailures[error$1.message] = true;
|
|
17489
|
+
setCurrentlyValidatingElement(element);
|
|
17490
|
+
|
|
17491
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
17492
|
+
|
|
17493
|
+
setCurrentlyValidatingElement(null);
|
|
17494
|
+
}
|
|
17054
17495
|
}
|
|
17055
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
17056
|
-
Object.defineProperty(props, "key", {
|
|
17057
|
-
get: warnAboutAccessingKey,
|
|
17058
|
-
configurable: true
|
|
17059
|
-
});
|
|
17060
17496
|
}
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17497
|
+
}
|
|
17498
|
+
}
|
|
17499
|
+
|
|
17500
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
17501
|
+
|
|
17502
|
+
function isArray(a) {
|
|
17503
|
+
return isArrayImpl(a);
|
|
17504
|
+
}
|
|
17505
|
+
|
|
17506
|
+
/*
|
|
17507
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
17508
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
17509
|
+
*
|
|
17510
|
+
* The functions in this module will throw an easier-to-understand,
|
|
17511
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
|
17512
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
17513
|
+
* of the `value` object).
|
|
17514
|
+
*/
|
|
17515
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
17516
|
+
function typeName(value) {
|
|
17517
|
+
{
|
|
17518
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
17519
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
17520
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
17521
|
+
return type;
|
|
17522
|
+
}
|
|
17523
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
17524
|
+
|
|
17525
|
+
|
|
17526
|
+
function willCoercionThrow(value) {
|
|
17527
|
+
{
|
|
17528
|
+
try {
|
|
17529
|
+
testStringCoercion(value);
|
|
17530
|
+
return false;
|
|
17531
|
+
} catch (e) {
|
|
17532
|
+
return true;
|
|
17070
17533
|
}
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17103
|
-
|
|
17104
|
-
|
|
17105
|
-
|
|
17106
|
-
value: null
|
|
17107
|
-
});
|
|
17108
|
-
Object.defineProperty(type, "_debugStack", {
|
|
17109
|
-
configurable: false,
|
|
17110
|
-
enumerable: false,
|
|
17111
|
-
writable: true,
|
|
17112
|
-
value: debugStack
|
|
17113
|
-
});
|
|
17114
|
-
Object.defineProperty(type, "_debugTask", {
|
|
17115
|
-
configurable: false,
|
|
17116
|
-
enumerable: false,
|
|
17117
|
-
writable: true,
|
|
17118
|
-
value: debugTask
|
|
17119
|
-
});
|
|
17120
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
17121
|
-
return type;
|
|
17534
|
+
}
|
|
17535
|
+
}
|
|
17536
|
+
|
|
17537
|
+
function testStringCoercion(value) {
|
|
17538
|
+
// If you ended up here by following an exception call stack, here's what's
|
|
17539
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
17540
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
17541
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
17542
|
+
//
|
|
17543
|
+
// The most common types that will cause this exception are `Symbol` instances
|
|
17544
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
17545
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
17546
|
+
// exception. (Library authors do this to prevent users from using built-in
|
|
17547
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
17548
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
|
17549
|
+
//
|
|
17550
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
|
17551
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
|
17552
|
+
//
|
|
17553
|
+
// To find which value is throwing, check the browser or debugger console.
|
|
17554
|
+
// Before this exception was thrown, there should be `console.error` output
|
|
17555
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
17556
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
17557
|
+
// In most cases, this console output also shows the component and its
|
|
17558
|
+
// ancestor components where the exception happened.
|
|
17559
|
+
//
|
|
17560
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
17561
|
+
return '' + value;
|
|
17562
|
+
}
|
|
17563
|
+
function checkKeyStringCoercion(value) {
|
|
17564
|
+
{
|
|
17565
|
+
if (willCoercionThrow(value)) {
|
|
17566
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
17567
|
+
|
|
17568
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
17122
17569
|
}
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
Object.freeze && Object.freeze(children);
|
|
17144
|
-
} else
|
|
17145
|
-
console.error(
|
|
17146
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
17147
|
-
);
|
|
17148
|
-
else validateChildKeys(children);
|
|
17149
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
17150
|
-
children = getComponentNameFromType(type);
|
|
17151
|
-
var keys = Object.keys(config).filter(function (k) {
|
|
17152
|
-
return "key" !== k;
|
|
17153
|
-
});
|
|
17154
|
-
isStaticChildren =
|
|
17155
|
-
0 < keys.length
|
|
17156
|
-
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
17157
|
-
: "{key: someKey}";
|
|
17158
|
-
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
17159
|
-
((keys =
|
|
17160
|
-
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
17161
|
-
console.error(
|
|
17162
|
-
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
17163
|
-
isStaticChildren,
|
|
17164
|
-
children,
|
|
17165
|
-
keys,
|
|
17166
|
-
children
|
|
17167
|
-
),
|
|
17168
|
-
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
17570
|
+
}
|
|
17571
|
+
}
|
|
17572
|
+
|
|
17573
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
17574
|
+
var RESERVED_PROPS = {
|
|
17575
|
+
key: true,
|
|
17576
|
+
ref: true,
|
|
17577
|
+
__self: true,
|
|
17578
|
+
__source: true
|
|
17579
|
+
};
|
|
17580
|
+
var specialPropKeyWarningShown;
|
|
17581
|
+
var specialPropRefWarningShown;
|
|
17582
|
+
|
|
17583
|
+
function hasValidRef(config) {
|
|
17584
|
+
{
|
|
17585
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
17586
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
17587
|
+
|
|
17588
|
+
if (getter && getter.isReactWarning) {
|
|
17589
|
+
return false;
|
|
17169
17590
|
}
|
|
17170
|
-
children = null;
|
|
17171
|
-
void 0 !== maybeKey &&
|
|
17172
|
-
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
17173
|
-
hasValidKey(config) &&
|
|
17174
|
-
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
17175
|
-
if ("key" in config) {
|
|
17176
|
-
maybeKey = {};
|
|
17177
|
-
for (var propName in config)
|
|
17178
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
17179
|
-
} else maybeKey = config;
|
|
17180
|
-
children &&
|
|
17181
|
-
defineKeyPropWarningGetter(
|
|
17182
|
-
maybeKey,
|
|
17183
|
-
"function" === typeof type
|
|
17184
|
-
? type.displayName || type.name || "Unknown"
|
|
17185
|
-
: type
|
|
17186
|
-
);
|
|
17187
|
-
return ReactElement(
|
|
17188
|
-
type,
|
|
17189
|
-
children,
|
|
17190
|
-
self,
|
|
17191
|
-
source,
|
|
17192
|
-
getOwner(),
|
|
17193
|
-
maybeKey,
|
|
17194
|
-
debugStack,
|
|
17195
|
-
debugTask
|
|
17196
|
-
);
|
|
17197
17591
|
}
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17592
|
+
}
|
|
17593
|
+
|
|
17594
|
+
return config.ref !== undefined;
|
|
17595
|
+
}
|
|
17596
|
+
|
|
17597
|
+
function hasValidKey(config) {
|
|
17598
|
+
{
|
|
17599
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
17600
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
17601
|
+
|
|
17602
|
+
if (getter && getter.isReactWarning) {
|
|
17603
|
+
return false;
|
|
17604
|
+
}
|
|
17204
17605
|
}
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
isArrayImpl = Array.isArray,
|
|
17224
|
-
createTask = console.createTask
|
|
17225
|
-
? console.createTask
|
|
17226
|
-
: function () {
|
|
17227
|
-
return null;
|
|
17228
|
-
};
|
|
17229
|
-
React = {
|
|
17230
|
-
react_stack_bottom_frame: function (callStackForError) {
|
|
17231
|
-
return callStackForError();
|
|
17606
|
+
}
|
|
17607
|
+
|
|
17608
|
+
return config.key !== undefined;
|
|
17609
|
+
}
|
|
17610
|
+
|
|
17611
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
17612
|
+
{
|
|
17613
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
|
|
17614
|
+
}
|
|
17615
|
+
}
|
|
17616
|
+
|
|
17617
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
17618
|
+
{
|
|
17619
|
+
var warnAboutAccessingKey = function () {
|
|
17620
|
+
if (!specialPropKeyWarningShown) {
|
|
17621
|
+
specialPropKeyWarningShown = true;
|
|
17622
|
+
|
|
17623
|
+
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);
|
|
17232
17624
|
}
|
|
17233
17625
|
};
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
)
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
source,
|
|
17252
|
-
self,
|
|
17253
|
-
trackActualOwner
|
|
17254
|
-
? Error("react-stack-top-frame")
|
|
17255
|
-
: unknownOwnerDebugStack,
|
|
17256
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
17257
|
-
);
|
|
17258
|
-
};
|
|
17259
|
-
reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
|
|
17260
|
-
var trackActualOwner =
|
|
17261
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
17262
|
-
return jsxDEVImpl(
|
|
17263
|
-
type,
|
|
17264
|
-
config,
|
|
17265
|
-
maybeKey,
|
|
17266
|
-
true,
|
|
17267
|
-
source,
|
|
17268
|
-
self,
|
|
17269
|
-
trackActualOwner
|
|
17270
|
-
? Error("react-stack-top-frame")
|
|
17271
|
-
: unknownOwnerDebugStack,
|
|
17272
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
17273
|
-
);
|
|
17626
|
+
|
|
17627
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
17628
|
+
Object.defineProperty(props, 'key', {
|
|
17629
|
+
get: warnAboutAccessingKey,
|
|
17630
|
+
configurable: true
|
|
17631
|
+
});
|
|
17632
|
+
}
|
|
17633
|
+
}
|
|
17634
|
+
|
|
17635
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
17636
|
+
{
|
|
17637
|
+
var warnAboutAccessingRef = function () {
|
|
17638
|
+
if (!specialPropRefWarningShown) {
|
|
17639
|
+
specialPropRefWarningShown = true;
|
|
17640
|
+
|
|
17641
|
+
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);
|
|
17642
|
+
}
|
|
17274
17643
|
};
|
|
17644
|
+
|
|
17645
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
17646
|
+
Object.defineProperty(props, 'ref', {
|
|
17647
|
+
get: warnAboutAccessingRef,
|
|
17648
|
+
configurable: true
|
|
17649
|
+
});
|
|
17650
|
+
}
|
|
17651
|
+
}
|
|
17652
|
+
/**
|
|
17653
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
17654
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
17655
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
17656
|
+
* if something is a React Element.
|
|
17657
|
+
*
|
|
17658
|
+
* @param {*} type
|
|
17659
|
+
* @param {*} props
|
|
17660
|
+
* @param {*} key
|
|
17661
|
+
* @param {string|object} ref
|
|
17662
|
+
* @param {*} owner
|
|
17663
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
17664
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
17665
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
17666
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
17667
|
+
* change in behavior.
|
|
17668
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
17669
|
+
* indicating filename, line number, and/or other information.
|
|
17670
|
+
* @internal
|
|
17671
|
+
*/
|
|
17672
|
+
|
|
17673
|
+
|
|
17674
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
17675
|
+
var element = {
|
|
17676
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
17677
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
17678
|
+
// Built-in properties that belong on the element
|
|
17679
|
+
type: type,
|
|
17680
|
+
key: key,
|
|
17681
|
+
ref: ref,
|
|
17682
|
+
props: props,
|
|
17683
|
+
// Record the component responsible for creating this element.
|
|
17684
|
+
_owner: owner
|
|
17685
|
+
};
|
|
17686
|
+
|
|
17687
|
+
{
|
|
17688
|
+
// The validation flag is currently mutative. We put it on
|
|
17689
|
+
// an external backing store so that we can freeze the whole object.
|
|
17690
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
17691
|
+
// commonly used development environments.
|
|
17692
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
17693
|
+
// the validation flag non-enumerable (where possible, which should
|
|
17694
|
+
// include every environment we run tests in), so the test framework
|
|
17695
|
+
// ignores it.
|
|
17696
|
+
|
|
17697
|
+
Object.defineProperty(element._store, 'validated', {
|
|
17698
|
+
configurable: false,
|
|
17699
|
+
enumerable: false,
|
|
17700
|
+
writable: true,
|
|
17701
|
+
value: false
|
|
17702
|
+
}); // self and source are DEV only properties.
|
|
17703
|
+
|
|
17704
|
+
Object.defineProperty(element, '_self', {
|
|
17705
|
+
configurable: false,
|
|
17706
|
+
enumerable: false,
|
|
17707
|
+
writable: false,
|
|
17708
|
+
value: self
|
|
17709
|
+
}); // Two elements created in two different places should be considered
|
|
17710
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
17711
|
+
|
|
17712
|
+
Object.defineProperty(element, '_source', {
|
|
17713
|
+
configurable: false,
|
|
17714
|
+
enumerable: false,
|
|
17715
|
+
writable: false,
|
|
17716
|
+
value: source
|
|
17717
|
+
});
|
|
17718
|
+
|
|
17719
|
+
if (Object.freeze) {
|
|
17720
|
+
Object.freeze(element.props);
|
|
17721
|
+
Object.freeze(element);
|
|
17722
|
+
}
|
|
17723
|
+
}
|
|
17724
|
+
|
|
17725
|
+
return element;
|
|
17726
|
+
};
|
|
17727
|
+
/**
|
|
17728
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
17729
|
+
* @param {*} type
|
|
17730
|
+
* @param {object} props
|
|
17731
|
+
* @param {string} key
|
|
17732
|
+
*/
|
|
17733
|
+
|
|
17734
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
17735
|
+
{
|
|
17736
|
+
var propName; // Reserved names are extracted
|
|
17737
|
+
|
|
17738
|
+
var props = {};
|
|
17739
|
+
var key = null;
|
|
17740
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
17741
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
17742
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
17743
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
17744
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
17745
|
+
// key is explicitly declared to be undefined or not.
|
|
17746
|
+
|
|
17747
|
+
if (maybeKey !== undefined) {
|
|
17748
|
+
{
|
|
17749
|
+
checkKeyStringCoercion(maybeKey);
|
|
17750
|
+
}
|
|
17751
|
+
|
|
17752
|
+
key = '' + maybeKey;
|
|
17753
|
+
}
|
|
17754
|
+
|
|
17755
|
+
if (hasValidKey(config)) {
|
|
17756
|
+
{
|
|
17757
|
+
checkKeyStringCoercion(config.key);
|
|
17758
|
+
}
|
|
17759
|
+
|
|
17760
|
+
key = '' + config.key;
|
|
17761
|
+
}
|
|
17762
|
+
|
|
17763
|
+
if (hasValidRef(config)) {
|
|
17764
|
+
ref = config.ref;
|
|
17765
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
17766
|
+
} // Remaining properties are added to a new props object
|
|
17767
|
+
|
|
17768
|
+
|
|
17769
|
+
for (propName in config) {
|
|
17770
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
17771
|
+
props[propName] = config[propName];
|
|
17772
|
+
}
|
|
17773
|
+
} // Resolve default props
|
|
17774
|
+
|
|
17775
|
+
|
|
17776
|
+
if (type && type.defaultProps) {
|
|
17777
|
+
var defaultProps = type.defaultProps;
|
|
17778
|
+
|
|
17779
|
+
for (propName in defaultProps) {
|
|
17780
|
+
if (props[propName] === undefined) {
|
|
17781
|
+
props[propName] = defaultProps[propName];
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17784
|
+
}
|
|
17785
|
+
|
|
17786
|
+
if (key || ref) {
|
|
17787
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
17788
|
+
|
|
17789
|
+
if (key) {
|
|
17790
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
17791
|
+
}
|
|
17792
|
+
|
|
17793
|
+
if (ref) {
|
|
17794
|
+
defineRefPropWarningGetter(props, displayName);
|
|
17795
|
+
}
|
|
17796
|
+
}
|
|
17797
|
+
|
|
17798
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
17799
|
+
}
|
|
17800
|
+
}
|
|
17801
|
+
|
|
17802
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
17803
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
17804
|
+
|
|
17805
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
17806
|
+
{
|
|
17807
|
+
if (element) {
|
|
17808
|
+
var owner = element._owner;
|
|
17809
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
17810
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
17811
|
+
} else {
|
|
17812
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
17813
|
+
}
|
|
17814
|
+
}
|
|
17815
|
+
}
|
|
17816
|
+
|
|
17817
|
+
var propTypesMisspellWarningShown;
|
|
17818
|
+
|
|
17819
|
+
{
|
|
17820
|
+
propTypesMisspellWarningShown = false;
|
|
17821
|
+
}
|
|
17822
|
+
/**
|
|
17823
|
+
* Verifies the object is a ReactElement.
|
|
17824
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
17825
|
+
* @param {?object} object
|
|
17826
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
17827
|
+
* @final
|
|
17828
|
+
*/
|
|
17829
|
+
|
|
17830
|
+
|
|
17831
|
+
function isValidElement(object) {
|
|
17832
|
+
{
|
|
17833
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
17834
|
+
}
|
|
17835
|
+
}
|
|
17836
|
+
|
|
17837
|
+
function getDeclarationErrorAddendum() {
|
|
17838
|
+
{
|
|
17839
|
+
if (ReactCurrentOwner$1.current) {
|
|
17840
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
17841
|
+
|
|
17842
|
+
if (name) {
|
|
17843
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
17844
|
+
}
|
|
17845
|
+
}
|
|
17846
|
+
|
|
17847
|
+
return '';
|
|
17848
|
+
}
|
|
17849
|
+
}
|
|
17850
|
+
|
|
17851
|
+
function getSourceInfoErrorAddendum(source) {
|
|
17852
|
+
{
|
|
17853
|
+
|
|
17854
|
+
return '';
|
|
17855
|
+
}
|
|
17856
|
+
}
|
|
17857
|
+
/**
|
|
17858
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
17859
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
17860
|
+
* updates.
|
|
17861
|
+
*/
|
|
17862
|
+
|
|
17863
|
+
|
|
17864
|
+
var ownerHasKeyUseWarning = {};
|
|
17865
|
+
|
|
17866
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
17867
|
+
{
|
|
17868
|
+
var info = getDeclarationErrorAddendum();
|
|
17869
|
+
|
|
17870
|
+
if (!info) {
|
|
17871
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
17872
|
+
|
|
17873
|
+
if (parentName) {
|
|
17874
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
17875
|
+
}
|
|
17876
|
+
}
|
|
17877
|
+
|
|
17878
|
+
return info;
|
|
17879
|
+
}
|
|
17880
|
+
}
|
|
17881
|
+
/**
|
|
17882
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
17883
|
+
* This element is in an array. The array could grow and shrink or be
|
|
17884
|
+
* reordered. All children that haven't already been validated are required to
|
|
17885
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
17886
|
+
* will only be shown once.
|
|
17887
|
+
*
|
|
17888
|
+
* @internal
|
|
17889
|
+
* @param {ReactElement} element Element that requires a key.
|
|
17890
|
+
* @param {*} parentType element's parent's type.
|
|
17891
|
+
*/
|
|
17892
|
+
|
|
17893
|
+
|
|
17894
|
+
function validateExplicitKey(element, parentType) {
|
|
17895
|
+
{
|
|
17896
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
17897
|
+
return;
|
|
17898
|
+
}
|
|
17899
|
+
|
|
17900
|
+
element._store.validated = true;
|
|
17901
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
17902
|
+
|
|
17903
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
17904
|
+
return;
|
|
17905
|
+
}
|
|
17906
|
+
|
|
17907
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
17908
|
+
// property, it may be the creator of the child that's responsible for
|
|
17909
|
+
// assigning it a key.
|
|
17910
|
+
|
|
17911
|
+
var childOwner = '';
|
|
17912
|
+
|
|
17913
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
17914
|
+
// Give the component that originally created this child.
|
|
17915
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
17916
|
+
}
|
|
17917
|
+
|
|
17918
|
+
setCurrentlyValidatingElement$1(element);
|
|
17919
|
+
|
|
17920
|
+
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);
|
|
17921
|
+
|
|
17922
|
+
setCurrentlyValidatingElement$1(null);
|
|
17923
|
+
}
|
|
17924
|
+
}
|
|
17925
|
+
/**
|
|
17926
|
+
* Ensure that every element either is passed in a static location, in an
|
|
17927
|
+
* array with an explicit keys property defined, or in an object literal
|
|
17928
|
+
* with valid key property.
|
|
17929
|
+
*
|
|
17930
|
+
* @internal
|
|
17931
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
17932
|
+
* @param {*} parentType node's parent's type.
|
|
17933
|
+
*/
|
|
17934
|
+
|
|
17935
|
+
|
|
17936
|
+
function validateChildKeys(node, parentType) {
|
|
17937
|
+
{
|
|
17938
|
+
if (typeof node !== 'object') {
|
|
17939
|
+
return;
|
|
17940
|
+
}
|
|
17941
|
+
|
|
17942
|
+
if (isArray(node)) {
|
|
17943
|
+
for (var i = 0; i < node.length; i++) {
|
|
17944
|
+
var child = node[i];
|
|
17945
|
+
|
|
17946
|
+
if (isValidElement(child)) {
|
|
17947
|
+
validateExplicitKey(child, parentType);
|
|
17948
|
+
}
|
|
17949
|
+
}
|
|
17950
|
+
} else if (isValidElement(node)) {
|
|
17951
|
+
// This element was passed in a valid location.
|
|
17952
|
+
if (node._store) {
|
|
17953
|
+
node._store.validated = true;
|
|
17954
|
+
}
|
|
17955
|
+
} else if (node) {
|
|
17956
|
+
var iteratorFn = getIteratorFn(node);
|
|
17957
|
+
|
|
17958
|
+
if (typeof iteratorFn === 'function') {
|
|
17959
|
+
// Entry iterators used to provide implicit keys,
|
|
17960
|
+
// but now we print a separate warning for them later.
|
|
17961
|
+
if (iteratorFn !== node.entries) {
|
|
17962
|
+
var iterator = iteratorFn.call(node);
|
|
17963
|
+
var step;
|
|
17964
|
+
|
|
17965
|
+
while (!(step = iterator.next()).done) {
|
|
17966
|
+
if (isValidElement(step.value)) {
|
|
17967
|
+
validateExplicitKey(step.value, parentType);
|
|
17968
|
+
}
|
|
17969
|
+
}
|
|
17970
|
+
}
|
|
17971
|
+
}
|
|
17972
|
+
}
|
|
17973
|
+
}
|
|
17974
|
+
}
|
|
17975
|
+
/**
|
|
17976
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
17977
|
+
* provided by the type.
|
|
17978
|
+
*
|
|
17979
|
+
* @param {ReactElement} element
|
|
17980
|
+
*/
|
|
17981
|
+
|
|
17982
|
+
|
|
17983
|
+
function validatePropTypes(element) {
|
|
17984
|
+
{
|
|
17985
|
+
var type = element.type;
|
|
17986
|
+
|
|
17987
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
17988
|
+
return;
|
|
17989
|
+
}
|
|
17990
|
+
|
|
17991
|
+
var propTypes;
|
|
17992
|
+
|
|
17993
|
+
if (typeof type === 'function') {
|
|
17994
|
+
propTypes = type.propTypes;
|
|
17995
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
17996
|
+
// Inner props are checked in the reconciler.
|
|
17997
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
17998
|
+
propTypes = type.propTypes;
|
|
17999
|
+
} else {
|
|
18000
|
+
return;
|
|
18001
|
+
}
|
|
18002
|
+
|
|
18003
|
+
if (propTypes) {
|
|
18004
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
18005
|
+
var name = getComponentNameFromType(type);
|
|
18006
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
18007
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
18008
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
18009
|
+
|
|
18010
|
+
var _name = getComponentNameFromType(type);
|
|
18011
|
+
|
|
18012
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
18013
|
+
}
|
|
18014
|
+
|
|
18015
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
18016
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
18017
|
+
}
|
|
18018
|
+
}
|
|
18019
|
+
}
|
|
18020
|
+
/**
|
|
18021
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
18022
|
+
* @param {ReactElement} fragment
|
|
18023
|
+
*/
|
|
18024
|
+
|
|
18025
|
+
|
|
18026
|
+
function validateFragmentProps(fragment) {
|
|
18027
|
+
{
|
|
18028
|
+
var keys = Object.keys(fragment.props);
|
|
18029
|
+
|
|
18030
|
+
for (var i = 0; i < keys.length; i++) {
|
|
18031
|
+
var key = keys[i];
|
|
18032
|
+
|
|
18033
|
+
if (key !== 'children' && key !== 'key') {
|
|
18034
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
18035
|
+
|
|
18036
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
18037
|
+
|
|
18038
|
+
setCurrentlyValidatingElement$1(null);
|
|
18039
|
+
break;
|
|
18040
|
+
}
|
|
18041
|
+
}
|
|
18042
|
+
|
|
18043
|
+
if (fragment.ref !== null) {
|
|
18044
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
18045
|
+
|
|
18046
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
18047
|
+
|
|
18048
|
+
setCurrentlyValidatingElement$1(null);
|
|
18049
|
+
}
|
|
18050
|
+
}
|
|
18051
|
+
}
|
|
18052
|
+
|
|
18053
|
+
var didWarnAboutKeySpread = {};
|
|
18054
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
18055
|
+
{
|
|
18056
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
18057
|
+
// succeed and there will likely be errors in render.
|
|
18058
|
+
|
|
18059
|
+
if (!validType) {
|
|
18060
|
+
var info = '';
|
|
18061
|
+
|
|
18062
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
18063
|
+
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.";
|
|
18064
|
+
}
|
|
18065
|
+
|
|
18066
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
18067
|
+
|
|
18068
|
+
if (sourceInfo) {
|
|
18069
|
+
info += sourceInfo;
|
|
18070
|
+
} else {
|
|
18071
|
+
info += getDeclarationErrorAddendum();
|
|
18072
|
+
}
|
|
18073
|
+
|
|
18074
|
+
var typeString;
|
|
18075
|
+
|
|
18076
|
+
if (type === null) {
|
|
18077
|
+
typeString = 'null';
|
|
18078
|
+
} else if (isArray(type)) {
|
|
18079
|
+
typeString = 'array';
|
|
18080
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
18081
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
18082
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
18083
|
+
} else {
|
|
18084
|
+
typeString = typeof type;
|
|
18085
|
+
}
|
|
18086
|
+
|
|
18087
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
18088
|
+
}
|
|
18089
|
+
|
|
18090
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
18091
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
18092
|
+
|
|
18093
|
+
if (element == null) {
|
|
18094
|
+
return element;
|
|
18095
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
18096
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
18097
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
18098
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
18099
|
+
// fixed, the key warnings will appear.)
|
|
18100
|
+
|
|
18101
|
+
|
|
18102
|
+
if (validType) {
|
|
18103
|
+
var children = props.children;
|
|
18104
|
+
|
|
18105
|
+
if (children !== undefined) {
|
|
18106
|
+
if (isStaticChildren) {
|
|
18107
|
+
if (isArray(children)) {
|
|
18108
|
+
for (var i = 0; i < children.length; i++) {
|
|
18109
|
+
validateChildKeys(children[i], type);
|
|
18110
|
+
}
|
|
18111
|
+
|
|
18112
|
+
if (Object.freeze) {
|
|
18113
|
+
Object.freeze(children);
|
|
18114
|
+
}
|
|
18115
|
+
} else {
|
|
18116
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
18117
|
+
}
|
|
18118
|
+
} else {
|
|
18119
|
+
validateChildKeys(children, type);
|
|
18120
|
+
}
|
|
18121
|
+
}
|
|
18122
|
+
}
|
|
18123
|
+
|
|
18124
|
+
{
|
|
18125
|
+
if (hasOwnProperty.call(props, 'key')) {
|
|
18126
|
+
var componentName = getComponentNameFromType(type);
|
|
18127
|
+
var keys = Object.keys(props).filter(function (k) {
|
|
18128
|
+
return k !== 'key';
|
|
18129
|
+
});
|
|
18130
|
+
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
18131
|
+
|
|
18132
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
18133
|
+
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
18134
|
+
|
|
18135
|
+
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
18136
|
+
|
|
18137
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
18138
|
+
}
|
|
18139
|
+
}
|
|
18140
|
+
}
|
|
18141
|
+
|
|
18142
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
18143
|
+
validateFragmentProps(element);
|
|
18144
|
+
} else {
|
|
18145
|
+
validatePropTypes(element);
|
|
18146
|
+
}
|
|
18147
|
+
|
|
18148
|
+
return element;
|
|
18149
|
+
}
|
|
18150
|
+
} // These two functions exist to still get child warnings in dev
|
|
18151
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
18152
|
+
// opt-in behavior for better messages but that we won't stop
|
|
18153
|
+
// giving you warnings if you use production apis.
|
|
18154
|
+
|
|
18155
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
18156
|
+
{
|
|
18157
|
+
return jsxWithValidation(type, props, key, true);
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
18160
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
18161
|
+
{
|
|
18162
|
+
return jsxWithValidation(type, props, key, false);
|
|
18163
|
+
}
|
|
18164
|
+
}
|
|
18165
|
+
|
|
18166
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
18167
|
+
// for now we can ship identical prod functions
|
|
18168
|
+
|
|
18169
|
+
var jsxs = jsxWithValidationStatic ;
|
|
18170
|
+
|
|
18171
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
18172
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
18173
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
17275
18174
|
})();
|
|
18175
|
+
}
|
|
17276
18176
|
return reactJsxRuntime_development;
|
|
17277
18177
|
}
|
|
17278
18178
|
|
|
17279
18179
|
if (process.env.NODE_ENV === 'production') {
|
|
17280
|
-
jsxRuntime.exports =
|
|
18180
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
17281
18181
|
} else {
|
|
17282
18182
|
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
17283
18183
|
}
|
|
@@ -17286,10 +18186,9 @@ var jsxRuntimeExports = jsxRuntime.exports;
|
|
|
17286
18186
|
|
|
17287
18187
|
var CAMSContext = createContext(null);
|
|
17288
18188
|
function CAMSProvider(_a) {
|
|
17289
|
-
var children = _a.children, defaultConfig = _a.defaultConfig,
|
|
18189
|
+
var children = _a.children, defaultConfig = _a.defaultConfig, authOptions = __rest(_a, ["children", "defaultConfig"]);
|
|
17290
18190
|
var auth = useCAMSAuth(authOptions);
|
|
17291
|
-
var
|
|
17292
|
-
var value = useMemo(function () { return (__assign(__assign({}, auth), { defaultConfig: defaultConfig, isAuthenticated: msalAuth.isAuthenticated, idToken: msalAuth.idToken, accessToken: msalAuth.accessToken })); }, [auth, defaultConfig, msalAuth.isAuthenticated, msalAuth.idToken, msalAuth.accessToken]);
|
|
18191
|
+
var value = useMemo(function () { return (__assign(__assign({}, auth), { defaultConfig: defaultConfig })); }, [auth, defaultConfig]);
|
|
17293
18192
|
return (jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children }));
|
|
17294
18193
|
}
|
|
17295
18194
|
function useCAMSContext() {
|
|
@@ -17316,134 +18215,11 @@ function ProtectedRoute(_a) {
|
|
|
17316
18215
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
17317
18216
|
}
|
|
17318
18217
|
|
|
17319
|
-
|
|
17320
|
-
var
|
|
17321
|
-
var expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
17322
|
-
document.cookie = "".concat(name, "=").concat(encodeURIComponent(value), "; expires=").concat(expires, "; path=/; samesite=Lax");
|
|
17323
|
-
};
|
|
17324
|
-
var getCookie = function (name) {
|
|
17325
|
-
var _a;
|
|
17326
|
-
return ((_a = document.cookie
|
|
17327
|
-
.split("; ")
|
|
17328
|
-
.find(function (row) { return row.startsWith(name + "="); })) === null || _a === void 0 ? void 0 : _a.split("=")[1])
|
|
17329
|
-
? decodeURIComponent(document.cookie
|
|
17330
|
-
.split("; ")
|
|
17331
|
-
.find(function (row) { return row.startsWith(name + "="); })
|
|
17332
|
-
.split("=")[1])
|
|
17333
|
-
: null;
|
|
17334
|
-
};
|
|
17335
|
-
var deleteCookie = function (name) {
|
|
17336
|
-
document.cookie = name + "=; Max-Age=-99999999; path=/";
|
|
17337
|
-
};
|
|
17338
|
-
var isTokenValid = function (token) {
|
|
17339
|
-
try {
|
|
17340
|
-
var payload = JSON.parse(atob(token.split(".")[1]));
|
|
17341
|
-
return payload.exp * 1000 > Date.now();
|
|
17342
|
-
}
|
|
17343
|
-
catch (_a) {
|
|
17344
|
-
return false;
|
|
17345
|
-
}
|
|
17346
|
-
};
|
|
17347
|
-
function CAMSMSALProviderInner(_a) {
|
|
17348
|
-
var _this = this;
|
|
17349
|
-
var children = _a.children, authOptions = __rest(_a, ["children"]);
|
|
17350
|
-
var auth = useCAMSMSALAuth(authOptions);
|
|
17351
|
-
var profileStorageKey = "".concat(auth.storageKey, "-PROFILE");
|
|
17352
|
-
var getInitialProfile = function () {
|
|
17353
|
-
if (typeof window === "undefined") {
|
|
17354
|
-
return null;
|
|
17355
|
-
}
|
|
17356
|
-
try {
|
|
17357
|
-
var storedProfile = getCookie(profileStorageKey);
|
|
17358
|
-
return storedProfile ? JSON.parse(storedProfile) : null;
|
|
17359
|
-
}
|
|
17360
|
-
catch (_a) {
|
|
17361
|
-
return null;
|
|
17362
|
-
}
|
|
17363
|
-
};
|
|
17364
|
-
var _b = useState(getInitialProfile), userProfile = _b[0], setUserProfile = _b[1];
|
|
17365
|
-
// Load profile from storage on mount
|
|
17366
|
-
useEffect(function () {
|
|
17367
|
-
if (typeof window !== "undefined") {
|
|
17368
|
-
// const storedProfile = localStorage.get Item(profileStorageKey);
|
|
17369
|
-
var storedProfile = getCookie(profileStorageKey);
|
|
17370
|
-
if (storedProfile) {
|
|
17371
|
-
try {
|
|
17372
|
-
setUserProfile(JSON.parse(storedProfile));
|
|
17373
|
-
}
|
|
17374
|
-
catch (_a) { }
|
|
17375
|
-
}
|
|
17376
|
-
}
|
|
17377
|
-
}, [profileStorageKey]);
|
|
17378
|
-
// Persist tokens and profile
|
|
17379
|
-
useEffect(function () {
|
|
17380
|
-
if (auth.accessToken &&
|
|
17381
|
-
isTokenValid(auth.accessToken) &&
|
|
17382
|
-
typeof window !== "undefined") {
|
|
17383
|
-
localStorage.setItem(auth.storageKey, JSON.stringify({
|
|
17384
|
-
accessToken: auth.accessToken,
|
|
17385
|
-
idToken: auth.idToken,
|
|
17386
|
-
}));
|
|
17387
|
-
}
|
|
17388
|
-
}, [auth.accessToken, auth.idToken, auth.storageKey]);
|
|
17389
|
-
// Persist profile separately
|
|
17390
|
-
useEffect(function () {
|
|
17391
|
-
if (typeof window !== "undefined") {
|
|
17392
|
-
// if (userProfile) {
|
|
17393
|
-
// localStorage.setItem(profileStorageKey, JSO N.stringify(userProfile));
|
|
17394
|
-
// } else {
|
|
17395
|
-
// localStorage.removeItem(profileStorageKey);
|
|
17396
|
-
// }
|
|
17397
|
-
if (userProfile) {
|
|
17398
|
-
setCookie(profileStorageKey, JSON.stringify(userProfile), 1); // Store for 1 day
|
|
17399
|
-
}
|
|
17400
|
-
else {
|
|
17401
|
-
deleteCookie(profileStorageKey);
|
|
17402
|
-
}
|
|
17403
|
-
}
|
|
17404
|
-
}, [userProfile, profileStorageKey]);
|
|
17405
|
-
// Enhanced logout that also clears profile
|
|
17406
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
17407
|
-
return __generator(this, function (_a) {
|
|
17408
|
-
switch (_a.label) {
|
|
17409
|
-
case 0: return [4 /*yield*/, auth.logout()];
|
|
17410
|
-
case 1:
|
|
17411
|
-
_a.sent();
|
|
17412
|
-
setUserProfile(null);
|
|
17413
|
-
if (typeof window !== "undefined") {
|
|
17414
|
-
deleteCookie(profileStorageKey);
|
|
17415
|
-
}
|
|
17416
|
-
return [2 /*return*/];
|
|
17417
|
-
}
|
|
17418
|
-
});
|
|
17419
|
-
}); };
|
|
17420
|
-
var value = useMemo(function () { return (__assign(__assign({}, auth), { logout: enhancedLogout, userProfile: userProfile, setUserProfile: setUserProfile })); }, [auth, userProfile]);
|
|
17421
|
-
return (jsxRuntimeExports.jsx(CAMSMSALContext.Provider, { value: value, children: children }));
|
|
17422
|
-
}
|
|
17423
|
-
function CAMSMSALProvider(props) {
|
|
17424
|
-
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
18218
|
+
function CAMSMSALProvider(_a) {
|
|
18219
|
+
var children = _a.children, msalConfig = _a.msalConfig, msalInstance = _a.msalInstance;
|
|
17425
18220
|
var instance = msalInstance || new PublicClientApplication(msalConfig);
|
|
17426
|
-
return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children:
|
|
17427
|
-
}
|
|
17428
|
-
function useCAMSMSALContext() {
|
|
17429
|
-
var context = useContext(CAMSMSALContext);
|
|
17430
|
-
if (!context) {
|
|
17431
|
-
throw new Error("useCAMSMSALContext must be used within a CAMSMSALProvider");
|
|
17432
|
-
}
|
|
17433
|
-
return context;
|
|
17434
|
-
}
|
|
17435
|
-
|
|
17436
|
-
function ClientOnly(_a) {
|
|
17437
|
-
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
|
|
17438
|
-
var _c = useState(false), hasMounted = _c[0], setHasMounted = _c[1];
|
|
17439
|
-
useEffect(function () {
|
|
17440
|
-
setHasMounted(true);
|
|
17441
|
-
}, []);
|
|
17442
|
-
if (!hasMounted) {
|
|
17443
|
-
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fallback });
|
|
17444
|
-
}
|
|
17445
|
-
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
18221
|
+
return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: children }));
|
|
17446
18222
|
}
|
|
17447
18223
|
|
|
17448
|
-
export { CAMSMSALProvider, CAMSProvider,
|
|
18224
|
+
export { CAMSMSALProvider, CAMSProvider, ProtectedRoute, useCAMSAuth, useCAMSContext, useCAMSMSALAuth };
|
|
17449
18225
|
//# sourceMappingURL=index.esm.js.map
|