| 1 | /**
|
|---|
| 2 | * @license React
|
|---|
| 3 | * react-is.production.js
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|---|
| 6 | *
|
|---|
| 7 | * This source code is licensed under the MIT license found in the
|
|---|
| 8 | * LICENSE file in the root directory of this source tree.
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | "use strict";
|
|---|
| 12 | var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|---|
| 13 | REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|---|
| 14 | REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|---|
| 15 | REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|---|
| 16 | REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|---|
| 17 | REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|---|
| 18 | REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|---|
| 19 | REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|---|
| 20 | REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|---|
| 21 | REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|---|
| 22 | REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|---|
| 23 | REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|---|
| 24 | REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
|
|---|
| 25 | REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|---|
| 26 | function typeOf(object) {
|
|---|
| 27 | if ("object" === typeof object && null !== object) {
|
|---|
| 28 | var $$typeof = object.$$typeof;
|
|---|
| 29 | switch ($$typeof) {
|
|---|
| 30 | case REACT_ELEMENT_TYPE:
|
|---|
| 31 | switch (((object = object.type), object)) {
|
|---|
| 32 | case REACT_FRAGMENT_TYPE:
|
|---|
| 33 | case REACT_PROFILER_TYPE:
|
|---|
| 34 | case REACT_STRICT_MODE_TYPE:
|
|---|
| 35 | case REACT_SUSPENSE_TYPE:
|
|---|
| 36 | case REACT_SUSPENSE_LIST_TYPE:
|
|---|
| 37 | case REACT_VIEW_TRANSITION_TYPE:
|
|---|
| 38 | return object;
|
|---|
| 39 | default:
|
|---|
| 40 | switch (((object = object && object.$$typeof), object)) {
|
|---|
| 41 | case REACT_CONTEXT_TYPE:
|
|---|
| 42 | case REACT_FORWARD_REF_TYPE:
|
|---|
| 43 | case REACT_LAZY_TYPE:
|
|---|
| 44 | case REACT_MEMO_TYPE:
|
|---|
| 45 | return object;
|
|---|
| 46 | case REACT_CONSUMER_TYPE:
|
|---|
| 47 | return object;
|
|---|
| 48 | default:
|
|---|
| 49 | return $$typeof;
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
| 52 | case REACT_PORTAL_TYPE:
|
|---|
| 53 | return $$typeof;
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 | }
|
|---|
| 57 | exports.ContextConsumer = REACT_CONSUMER_TYPE;
|
|---|
| 58 | exports.ContextProvider = REACT_CONTEXT_TYPE;
|
|---|
| 59 | exports.Element = REACT_ELEMENT_TYPE;
|
|---|
| 60 | exports.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|---|
| 61 | exports.Fragment = REACT_FRAGMENT_TYPE;
|
|---|
| 62 | exports.Lazy = REACT_LAZY_TYPE;
|
|---|
| 63 | exports.Memo = REACT_MEMO_TYPE;
|
|---|
| 64 | exports.Portal = REACT_PORTAL_TYPE;
|
|---|
| 65 | exports.Profiler = REACT_PROFILER_TYPE;
|
|---|
| 66 | exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|---|
| 67 | exports.Suspense = REACT_SUSPENSE_TYPE;
|
|---|
| 68 | exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|---|
| 69 | exports.isContextConsumer = function (object) {
|
|---|
| 70 | return typeOf(object) === REACT_CONSUMER_TYPE;
|
|---|
| 71 | };
|
|---|
| 72 | exports.isContextProvider = function (object) {
|
|---|
| 73 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
|---|
| 74 | };
|
|---|
| 75 | exports.isElement = function (object) {
|
|---|
| 76 | return (
|
|---|
| 77 | "object" === typeof object &&
|
|---|
| 78 | null !== object &&
|
|---|
| 79 | object.$$typeof === REACT_ELEMENT_TYPE
|
|---|
| 80 | );
|
|---|
| 81 | };
|
|---|
| 82 | exports.isForwardRef = function (object) {
|
|---|
| 83 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|---|
| 84 | };
|
|---|
| 85 | exports.isFragment = function (object) {
|
|---|
| 86 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|---|
| 87 | };
|
|---|
| 88 | exports.isLazy = function (object) {
|
|---|
| 89 | return typeOf(object) === REACT_LAZY_TYPE;
|
|---|
| 90 | };
|
|---|
| 91 | exports.isMemo = function (object) {
|
|---|
| 92 | return typeOf(object) === REACT_MEMO_TYPE;
|
|---|
| 93 | };
|
|---|
| 94 | exports.isPortal = function (object) {
|
|---|
| 95 | return typeOf(object) === REACT_PORTAL_TYPE;
|
|---|
| 96 | };
|
|---|
| 97 | exports.isProfiler = function (object) {
|
|---|
| 98 | return typeOf(object) === REACT_PROFILER_TYPE;
|
|---|
| 99 | };
|
|---|
| 100 | exports.isStrictMode = function (object) {
|
|---|
| 101 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|---|
| 102 | };
|
|---|
| 103 | exports.isSuspense = function (object) {
|
|---|
| 104 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|---|
| 105 | };
|
|---|
| 106 | exports.isSuspenseList = function (object) {
|
|---|
| 107 | return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|---|
| 108 | };
|
|---|
| 109 | exports.isValidElementType = function (type) {
|
|---|
| 110 | return "string" === typeof type ||
|
|---|
| 111 | "function" === typeof type ||
|
|---|
| 112 | type === REACT_FRAGMENT_TYPE ||
|
|---|
| 113 | type === REACT_PROFILER_TYPE ||
|
|---|
| 114 | type === REACT_STRICT_MODE_TYPE ||
|
|---|
| 115 | type === REACT_SUSPENSE_TYPE ||
|
|---|
| 116 | type === REACT_SUSPENSE_LIST_TYPE ||
|
|---|
| 117 | ("object" === typeof type &&
|
|---|
| 118 | null !== type &&
|
|---|
| 119 | (type.$$typeof === REACT_LAZY_TYPE ||
|
|---|
| 120 | type.$$typeof === REACT_MEMO_TYPE ||
|
|---|
| 121 | type.$$typeof === REACT_CONTEXT_TYPE ||
|
|---|
| 122 | type.$$typeof === REACT_CONSUMER_TYPE ||
|
|---|
| 123 | type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|---|
| 124 | type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|---|
| 125 | void 0 !== type.getModuleId))
|
|---|
| 126 | ? !0
|
|---|
| 127 | : !1;
|
|---|
| 128 | };
|
|---|
| 129 | exports.typeOf = typeOf;
|
|---|