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