aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react-dom/cjs
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/react-dom/cjs
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/react-dom/cjs')
-rw-r--r--node_modules/react-dom/cjs/react-dom-server.browser.development.js1702
-rw-r--r--node_modules/react-dom/cjs/react-dom-server.browser.production.min.js71
-rw-r--r--node_modules/react-dom/cjs/react-dom-server.node.development.js1702
-rw-r--r--node_modules/react-dom/cjs/react-dom-server.node.production.min.js75
-rw-r--r--node_modules/react-dom/cjs/react-dom-test-utils.development.js710
-rw-r--r--node_modules/react-dom/cjs/react-dom-test-utils.production.min.js52
-rw-r--r--node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js477
-rw-r--r--node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js57
-rw-r--r--node_modules/react-dom/cjs/react-dom.development.js21741
-rw-r--r--node_modules/react-dom/cjs/react-dom.production.min.js444
10 files changed, 15702 insertions, 11329 deletions
diff --git a/node_modules/react-dom/cjs/react-dom-server.browser.development.js b/node_modules/react-dom/cjs/react-dom-server.browser.development.js
index dcf78c70d..dd13e823b 100644
--- a/node_modules/react-dom/cjs/react-dom-server.browser.development.js
+++ b/node_modules/react-dom/cjs/react-dom-server.browser.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-server.browser.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -15,411 +15,656 @@ if (process.env.NODE_ENV !== "production") {
(function() {
'use strict';
-var invariant = require('fbjs/lib/invariant');
var _assign = require('object-assign');
var React = require('react');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var emptyObject = require('fbjs/lib/emptyObject');
-var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
-var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
-var warning = require('fbjs/lib/warning');
var checkPropTypes = require('prop-types/checkPropTypes');
-var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
*/
-// These attributes should be all lowercase to allow for
-// case insensitive checks
-var RESERVED_PROPS = {
- children: true,
- dangerouslySetInnerHTML: true,
- defaultValue: true,
- defaultChecked: true,
- innerHTML: true,
- suppressContentEditableWarning: true,
- suppressHydrationWarning: true,
- style: true
-};
+var validateFormat = function () {};
-function checkMask(value, bitmask) {
- return (value & bitmask) === bitmask;
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
}
-var DOMPropertyInjection = {
- /**
- * Mapping from normalized, camelcased property names to a configuration that
- * specifies how the associated DOM property should be accessed or rendered.
- */
- MUST_USE_PROPERTY: 0x1,
- HAS_BOOLEAN_VALUE: 0x4,
- HAS_NUMERIC_VALUE: 0x8,
- HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
- HAS_STRING_BOOLEAN_VALUE: 0x40,
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
- /**
- * Inject some specialized knowledge about the DOM. This takes a config object
- * with the following properties:
- *
- * Properties: object mapping DOM property name to one of the
- * DOMPropertyInjection constants or null. If your attribute isn't in here,
- * it won't get written to the DOM.
- *
- * DOMAttributeNames: object mapping React attribute name to the DOM
- * attribute name. Attribute names not specified use the **lowercase**
- * normalized name.
- *
- * DOMAttributeNamespaces: object mapping React attribute name to the DOM
- * attribute namespace URL. (Attribute names not specified use no namespace.)
- *
- * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
- * Property names not specified use the normalized name.
- *
- * DOMMutationMethods: Properties that require special mutation methods. If
- * `value` is undefined, the mutation method should unset the property.
- *
- * @param {object} domPropertyConfig the config as described above.
- */
- injectDOMPropertyConfig: function (domPropertyConfig) {
- var Injection = DOMPropertyInjection;
- var Properties = domPropertyConfig.Properties || {};
- var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
- var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
- var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
-
- for (var propName in Properties) {
- !!properties.hasOwnProperty(propName) ? invariant(false, "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.", propName) : void 0;
-
- var lowerCased = propName.toLowerCase();
- var propConfig = Properties[propName];
-
- var propertyInfo = {
- attributeName: lowerCased,
- attributeNamespace: null,
- propertyName: propName,
- mutationMethod: null,
-
- mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
- hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
- hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
- hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
- hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
- hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE)
- };
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant(false, "DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s", propName) : void 0;
-
- if (DOMAttributeNames.hasOwnProperty(propName)) {
- var attributeName = DOMAttributeNames[propName];
-
- propertyInfo.attributeName = attributeName;
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
+
+// TODO: this is special because it gets imported during build.
+
+var ReactVersion = '16.5.2';
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
}
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
+}
+
+var warningWithoutStack$1 = warningWithoutStack;
- if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
- propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var hasSymbol = typeof Symbol === 'function' && Symbol.for;
+
+
+var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
+var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
+var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
+var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
+var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
+var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
+var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
+var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
+var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
+
+var Resolved = 1;
+
+
+
+
+function refineResolvedThenable(thenable) {
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
+}
+
+function getComponentName(type) {
+ if (type == null) {
+ // Host root, text node or just invalid type.
+ return null;
+ }
+ {
+ if (typeof type.tag === 'number') {
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
+ }
+ }
+ if (typeof type === 'function') {
+ return type.displayName || type.name || null;
+ }
+ if (typeof type === 'string') {
+ return type;
+ }
+ switch (type) {
+ case REACT_ASYNC_MODE_TYPE:
+ return 'AsyncMode';
+ case REACT_FRAGMENT_TYPE:
+ return 'Fragment';
+ case REACT_PORTAL_TYPE:
+ return 'Portal';
+ case REACT_PROFILER_TYPE:
+ return 'Profiler';
+ case REACT_STRICT_MODE_TYPE:
+ return 'StrictMode';
+ case REACT_PLACEHOLDER_TYPE:
+ return 'Placeholder';
+ }
+ if (typeof type === 'object') {
+ switch (type.$$typeof) {
+ case REACT_CONTEXT_TYPE:
+ return 'Context.Consumer';
+ case REACT_PROVIDER_TYPE:
+ return 'Context.Provider';
+ case REACT_FORWARD_REF_TYPE:
+ var renderFn = type.render;
+ var functionName = renderFn.displayName || renderFn.name || '';
+ return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
+ }
+ if (typeof type.then === 'function') {
+ var thenable = type;
+ var resolvedThenable = refineResolvedThenable(thenable);
+ if (resolvedThenable) {
+ return getComponentName(resolvedThenable);
}
+ }
+ }
+ return null;
+}
- if (DOMMutationMethods.hasOwnProperty(propName)) {
- propertyInfo.mutationMethod = DOMMutationMethods[propName];
+/**
+ * Forked from fbjs/warning:
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
+ *
+ * Only change is we use console.warn instead of console.error,
+ * and do nothing when 'console' is not supported.
+ * This really simplifies the code.
+ * ---
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var lowPriorityWarning = function () {};
+
+{
+ var printWarning = function (format) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.warn(message);
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ } catch (x) {}
+ };
+
+ lowPriorityWarning = function (condition, format) {
+ if (format === undefined) {
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (!condition) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
}
- // Downcase references to whitelist properties to check for membership
- // without case-sensitivity. This allows the whitelist to pick up
- // `allowfullscreen`, which should be written using the property configuration
- // for `allowFullscreen`
- properties[propName] = propertyInfo;
+ printWarning.apply(undefined, [format].concat(args));
}
+ };
+}
+
+var lowPriorityWarning$1 = lowPriorityWarning;
+
+var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warning = warningWithoutStack$1;
+
+{
+ warning = function (condition, format) {
+ if (condition) {
+ return;
+ }
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
+
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
+ };
+}
+
+var warning$1 = warning;
+
+var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
+
+var describeComponentFrame = function (name, source, ownerName) {
+ var sourceInfo = '';
+ if (source) {
+ var path = source.fileName;
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
+ {
+ // In DEV, include code for a common special case:
+ // prefer "folder/index.js" instead of just "index.js".
+ if (/^index\./.test(fileName)) {
+ var match = path.match(BEFORE_SLASH_RE);
+ if (match) {
+ var pathBeforeSlash = match[1];
+ if (pathBeforeSlash) {
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
+ fileName = folderName + '/' + fileName;
+ }
+ }
+ }
+ }
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
+ } else if (ownerName) {
+ sourceInfo = ' (created by ' + ownerName + ')';
}
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
};
+// Exports ReactDOM.createRoot
+
+
+// Experimental error-boundary API that can recover from errors within a single
+// render phase
+
+// Suspense
+
+// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
+
+
+// In some cases, StrictMode should also double-render lifecycles.
+// This can be confusing for tests though,
+// And it can be bad for performance in production.
+// This feature flag can be used to control the behavior:
+
+
+// To preserve the "Pause on caught exceptions" behavior of the debugger, we
+// replay the begin phase of a failed component inside invokeGuardedCallback.
+
+
+// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
+var warnAboutDeprecatedLifecycles = false;
+
+// Warn about legacy context API
+
+
+// Gather advanced timing metrics for Profiler subtrees.
+
+
+// Trace which interactions trigger each commit.
+
+
+// Only used in www builds.
+var enableSuspenseServerRenderer = false;
+
+// Only used in www builds.
+
+
+// React Fire: prevent the value and checked attributes from syncing
+// with their related DOM properties
+
+// A reserved attribute.
+// It is handled by React separately and shouldn't be written to the DOM.
+var RESERVED = 0;
+
+// A simple string attribute.
+// Attributes that aren't in the whitelist are presumed to have this type.
+var STRING = 1;
+
+// A string attribute that accepts booleans in React. In HTML, these are called
+// "enumerated" attributes with "true" and "false" as possible values.
+// When true, it should be set to a "true" string.
+// When false, it should be set to a "false" string.
+var BOOLEANISH_STRING = 2;
+
+// A real boolean attribute.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+var BOOLEAN = 3;
+
+// An attribute that can be used as a flag as well as with a value.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+// For any other value, should be present with that value.
+var OVERLOADED_BOOLEAN = 4;
+
+// An attribute that must be numeric or parse as a numeric.
+// When falsy, it should be removed.
+var NUMERIC = 5;
+
+// An attribute that must be positive numeric or parse as a positive numeric.
+// When falsy, it should be removed.
+var POSITIVE_NUMERIC = 6;
+
/* eslint-disable max-len */
-var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
+var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
/* eslint-enable max-len */
-var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
+var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-/**
- * Map from property "standard name" to an object with info about how to set
- * the property in the DOM. Each object contains:
- *
- * attributeName:
- * Used when rendering markup or with `*Attribute()`.
- * attributeNamespace
- * propertyName:
- * Used on DOM node instances. (This includes properties that mutate due to
- * external factors.)
- * mutationMethod:
- * If non-null, used instead of the property or `setAttribute()` after
- * initial render.
- * mustUseProperty:
- * Whether the property must be accessed and mutated as an object property.
- * hasBooleanValue:
- * Whether the property should be removed when set to a falsey value.
- * hasNumericValue:
- * Whether the property must be numeric or parse as a numeric and should be
- * removed when set to a falsey value.
- * hasPositiveNumericValue:
- * Whether the property must be positive numeric or parse as a positive
- * numeric and should be removed when set to a falsey value.
- * hasOverloadedBooleanValue:
- * Whether the property can be used as a flag as well as with a value.
- * Removed when strictly equal to false; present without a value when
- * strictly equal to true; present with a value otherwise.
- */
-var properties = {};
+var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
-/**
- * Checks whether a property name is a writeable attribute.
- * @method
- */
-function shouldSetAttribute(name, value) {
- if (isReservedProp(name)) {
+function isAttributeNameSafe(attributeName) {
+ if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
+ return true;
+ }
+ if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
return false;
}
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ {
+ warning$1(false, 'Invalid attribute name: `%s`', attributeName);
+ }
+ return false;
+}
+
+function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null) {
+ return propertyInfo.type === RESERVED;
+ }
+ if (isCustomComponentTag) {
return false;
}
- if (value === null) {
+ if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
return true;
}
+ return false;
+}
+
+function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null && propertyInfo.type === RESERVED) {
+ return false;
+ }
switch (typeof value) {
- case 'boolean':
- return shouldAttributeAcceptBooleanValue(name);
- case 'undefined':
- case 'number':
- case 'string':
- case 'object':
+ case 'function':
+ // $FlowIssue symbol is perfectly valid here
+ case 'symbol':
+ // eslint-disable-line
return true;
+ case 'boolean':
+ {
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ return !propertyInfo.acceptsBooleans;
+ } else {
+ var prefix = name.toLowerCase().slice(0, 5);
+ return prefix !== 'data-' && prefix !== 'aria-';
+ }
+ }
default:
- // function, symbol
return false;
}
}
-function getPropertyInfo(name) {
- return properties.hasOwnProperty(name) ? properties[name] : null;
-}
-
-function shouldAttributeAcceptBooleanValue(name) {
- if (isReservedProp(name)) {
+function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
+ if (value === null || typeof value === 'undefined') {
return true;
}
- var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
+ return true;
}
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix === 'data-' || prefix === 'aria-';
-}
-
-/**
- * Checks to see if a property name is within the list of properties
- * reserved for internal React operations. These properties should
- * not be set on an HTML element.
- *
- * @private
- * @param {string} name
- * @return {boolean} If the name is within reserved props
- */
-function isReservedProp(name) {
- return RESERVED_PROPS.hasOwnProperty(name);
-}
-
-var injection = DOMPropertyInjection;
-
-var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY;
-var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE;
-var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE;
-var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE;
-
-var HTMLDOMPropertyConfig = {
- // When adding attributes to this list, be sure to also add them to
- // the `possibleStandardNames` module to ensure casing and incorrect
- // name warnings.
- Properties: {
- allowFullScreen: HAS_BOOLEAN_VALUE,
- // specifies target context for links with `preload` type
- async: HAS_BOOLEAN_VALUE,
- // Note: there is a special case that prevents it from being written to the DOM
- // on the client side because the browsers are inconsistent. Instead we call focus().
- autoFocus: HAS_BOOLEAN_VALUE,
- autoPlay: HAS_BOOLEAN_VALUE,
- capture: HAS_OVERLOADED_BOOLEAN_VALUE,
- checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- cols: HAS_POSITIVE_NUMERIC_VALUE,
- contentEditable: HAS_STRING_BOOLEAN_VALUE,
- controls: HAS_BOOLEAN_VALUE,
- 'default': HAS_BOOLEAN_VALUE,
- defer: HAS_BOOLEAN_VALUE,
- disabled: HAS_BOOLEAN_VALUE,
- download: HAS_OVERLOADED_BOOLEAN_VALUE,
- draggable: HAS_STRING_BOOLEAN_VALUE,
- formNoValidate: HAS_BOOLEAN_VALUE,
- hidden: HAS_BOOLEAN_VALUE,
- loop: HAS_BOOLEAN_VALUE,
- // Caution; `option.selected` is not updated if `select.multiple` is
- // disabled with `removeAttribute`.
- multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- noValidate: HAS_BOOLEAN_VALUE,
- open: HAS_BOOLEAN_VALUE,
- playsInline: HAS_BOOLEAN_VALUE,
- readOnly: HAS_BOOLEAN_VALUE,
- required: HAS_BOOLEAN_VALUE,
- reversed: HAS_BOOLEAN_VALUE,
- rows: HAS_POSITIVE_NUMERIC_VALUE,
- rowSpan: HAS_NUMERIC_VALUE,
- scoped: HAS_BOOLEAN_VALUE,
- seamless: HAS_BOOLEAN_VALUE,
- selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- size: HAS_POSITIVE_NUMERIC_VALUE,
- start: HAS_NUMERIC_VALUE,
- // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
- span: HAS_POSITIVE_NUMERIC_VALUE,
- spellCheck: HAS_STRING_BOOLEAN_VALUE,
- // Style must be explicitly set in the attribute list. React components
- // expect a style object
- style: 0,
- // Keep it in the whitelist because it is case-sensitive for SVG.
- tabIndex: 0,
- // itemScope is for for Microdata support.
- // See http://schema.org/docs/gs.html
- itemScope: HAS_BOOLEAN_VALUE,
- // These attributes must stay in the white-list because they have
- // different attribute names (see DOMAttributeNames below)
- acceptCharset: 0,
- className: 0,
- htmlFor: 0,
- httpEquiv: 0,
- // Attributes with mutation methods must be specified in the whitelist
- // Set the string boolean flag to allow the behavior
- value: HAS_STRING_BOOLEAN_VALUE
- },
- DOMAttributeNames: {
- acceptCharset: 'accept-charset',
- className: 'class',
- htmlFor: 'for',
- httpEquiv: 'http-equiv'
- },
- DOMMutationMethods: {
- value: function (node, value) {
- if (value == null) {
- return node.removeAttribute('value');
- }
-
- // Number inputs get special treatment due to some edge cases in
- // Chrome. Let everything else assign the value attribute as normal.
- // https://github.com/facebook/react/issues/7253#issuecomment-236074326
- if (node.type !== 'number' || node.hasAttribute('value') === false) {
- node.setAttribute('value', '' + value);
- } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
- // Don't assign an attribute if validation reports bad
- // input. Chrome will clear the value. Additionally, don't
- // operate on inputs that have focus, otherwise Chrome might
- // strip off trailing decimal places and cause the user's
- // cursor position to jump to the beginning of the input.
- //
- // In ReactDOMInput, we have an onBlur event that will trigger
- // this function again when focus is lost.
- node.setAttribute('value', '' + value);
- }
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ switch (propertyInfo.type) {
+ case BOOLEAN:
+ return !value;
+ case OVERLOADED_BOOLEAN:
+ return value === false;
+ case NUMERIC:
+ return isNaN(value);
+ case POSITIVE_NUMERIC:
+ return isNaN(value) || value < 1;
}
}
-};
+ return false;
+}
-var HAS_STRING_BOOLEAN_VALUE$1 = injection.HAS_STRING_BOOLEAN_VALUE;
+function getPropertyInfo(name) {
+ return properties.hasOwnProperty(name) ? properties[name] : null;
+}
+function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
+ this.attributeName = attributeName;
+ this.attributeNamespace = attributeNamespace;
+ this.mustUseProperty = mustUseProperty;
+ this.propertyName = name;
+ this.type = type;
+}
-var NS = {
- xlink: 'http://www.w3.org/1999/xlink',
- xml: 'http://www.w3.org/XML/1998/namespace'
-};
+// When adding attributes to this list, be sure to also add them to
+// the `possibleStandardNames` module to ensure casing and incorrect
+// name warnings.
+var properties = {};
-/**
- * This is a list of all SVG attributes that need special casing,
- * namespacing, or boolean value assignment.
- *
- * When adding attributes to this list, be sure to also add them to
- * the `possibleStandardNames` module to ensure casing and incorrect
- * name warnings.
- *
- * SVG Attributes List:
- * https://www.w3.org/TR/SVG/attindex.html
- * SMIL Spec:
- * https://www.w3.org/TR/smil
- */
-var ATTRS = ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space'];
-
-var SVGDOMPropertyConfig = {
- Properties: {
- autoReverse: HAS_STRING_BOOLEAN_VALUE$1,
- externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1,
- preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1
- },
- DOMAttributeNames: {
- autoReverse: 'autoReverse',
- externalResourcesRequired: 'externalResourcesRequired',
- preserveAlpha: 'preserveAlpha'
- },
- DOMAttributeNamespaces: {
- xlinkActuate: NS.xlink,
- xlinkArcrole: NS.xlink,
- xlinkHref: NS.xlink,
- xlinkRole: NS.xlink,
- xlinkShow: NS.xlink,
- xlinkTitle: NS.xlink,
- xlinkType: NS.xlink,
- xmlBase: NS.xml,
- xmlLang: NS.xml,
- xmlSpace: NS.xml
- }
-};
+// These props are reserved by React. They shouldn't be written to the DOM.
+['children', 'dangerouslySetInnerHTML',
+// TODO: This prevents the assignment of defaultValue to regular
+// elements (not just inputs). Now that ReactDOMInput assigns to the
+// defaultValue property -- do we need this?
+'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// A few React string attributes have a different name.
+// This is a mapping from React prop names to the attribute names.
+[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
+ var name = _ref[0],
+ attributeName = _ref[1];
+
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" HTML attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" SVG attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+// Since these are SVG attributes, their attribute names are case-sensitive.
+['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML boolean attributes.
+['allowFullScreen', 'async',
+// Note: there is a special case that prevents it from being written to the DOM
+// on the client side because the browsers are inconsistent. Instead we call focus().
+'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
+// Microdata
+'itemScope'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are the few React props that we set as DOM properties
+// rather than attributes. These are all booleans.
+['checked',
+// Note: `option.selected` is not updated if `select.multiple` is
+// disabled with `removeAttribute`. We have special logic for handling this.
+'multiple', 'muted', 'selected'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that are "overloaded booleans": they behave like
+// booleans, but can also accept a string value.
+['capture', 'download'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be positive numbers.
+['cols', 'rows', 'size', 'span'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be numbers.
+['rowSpan', 'start'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
var CAMELIZE = /[\-\:]([a-z])/g;
var capitalize = function (token) {
return token[1].toUpperCase();
};
-ATTRS.forEach(function (original) {
- var reactName = original.replace(CAMELIZE, capitalize);
-
- SVGDOMPropertyConfig.Properties[reactName] = 0;
- SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original;
+// This is a list of all SVG attributes that need special casing, namespacing,
+// or boolean value assignment. Regular attributes that just accept strings
+// and have the same names are omitted, just like in the HTML whitelist.
+// Some of these attributes can be hard to find. This list was created by
+// scrapping the MDN documentation.
+['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, null);
+} // attributeNamespace
+);
+
+// String SVG attributes with the xlink namespace.
+['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/1999/xlink');
});
-injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
-injection.injectDOMPropertyConfig(SVGDOMPropertyConfig);
-
-// TODO: this is special because it gets imported during build.
-
-var ReactVersion = '16.2.0';
-
-var describeComponentFrame = function (name, source, ownerName) {
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
-};
-
-var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-
-var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
-var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
-
-
-
-
+// String SVG attributes with the xml namespace.
+['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/XML/1998/namespace');
+});
-var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
+// Special case: this attribute exists both in HTML and SVG.
+// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use
+// its React `tabIndex` name, like we do for attributes that exist only in HTML.
+properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty
+'tabindex', // attributeName
+null);
// code copied and modified from escape-html
/**
@@ -445,7 +690,7 @@ function escapeHtml(string) {
return str;
}
- var escape;
+ var escape = void 0;
var html = '';
var index = 0;
var lastIndex = 0;
@@ -514,35 +759,6 @@ function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextForBrowser(value) + '"';
}
-// isAttributeNameSafe() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
- return true;
- }
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
- return false;
- }
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
- }
- illegalAttributeNameCache[attributeName] = true;
- {
- warning(false, 'Invalid attribute name: `%s`', attributeName);
- }
- return false;
-}
-
-// shouldIgnoreValue() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-function shouldIgnoreValue(propertyInfo, value) {
- return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
-}
-
/**
* Operations for dealing with DOM properties.
*/
@@ -568,23 +784,25 @@ function createMarkupForRoot() {
*/
function createMarkupForProperty(name, value) {
var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- if (shouldIgnoreValue(propertyInfo, value)) {
- return '';
- }
+ if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
+ return '';
+ }
+ if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
+ return '';
+ }
+ if (propertyInfo !== null) {
var attributeName = propertyInfo.attributeName;
- if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ var type = propertyInfo.type;
+
+ if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
return attributeName + '=""';
- } else if (typeof value !== 'boolean' || shouldAttributeAcceptBooleanValue(name)) {
+ } else {
return attributeName + '=' + quoteAttributeValueForBrowser(value);
}
- } else if (shouldSetAttribute(name, value)) {
- if (value == null) {
- return '';
- }
+ } else if (isAttributeNameSafe(name)) {
return name + '=' + quoteAttributeValueForBrowser(value);
}
- return null;
+ return '';
}
/**
@@ -636,11 +854,15 @@ function getChildNamespace(parentNamespace, type) {
return parentNamespace;
}
+var ReactDebugCurrentFrame$1 = null;
+
var ReactControlledValuePropTypes = {
checkPropTypes: null
};
{
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
+
var hasReadOnlyValue = {
button: true,
checkbox: true,
@@ -653,13 +875,13 @@ var ReactControlledValuePropTypes = {
var propTypes = {
value: function (props, propName, componentName) {
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
@@ -670,8 +892,8 @@ var ReactControlledValuePropTypes = {
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
- checkPropTypes(propTypes, props, 'prop', tagName, getStack);
+ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
};
}
@@ -694,6 +916,7 @@ var omittedCloseTags = {
source: true,
track: true,
wbr: true
+ // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
// For HTML, certain tags cannot have children. This has the same purpose as
@@ -703,24 +926,31 @@ var voidElementTags = _assign({
menuitem: true
}, omittedCloseTags);
+// TODO: We can remove this if we add invariantWithStack()
+// or add stack by default to invariants where possible.
var HTML = '__html';
-function assertValidProps(tag, props, getStack) {
+var ReactDebugCurrentFrame$2 = null;
+{
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
+}
+
+function assertValidProps(tag, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (voidElementTags[tag]) {
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
}
{
- warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack());
+ !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
}
- !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
+ !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
}
/**
@@ -742,6 +972,7 @@ var isUnitlessNumber = {
flexShrink: true,
flexNegative: true,
flexOrder: true,
+ gridArea: true,
gridRow: true,
gridRowEnd: true,
gridRowSpan: true,
@@ -828,6 +1059,26 @@ function dangerousStyleValue(name, value, isCustomProperty) {
return ('' + value).trim();
}
+var uppercasePattern = /([A-Z])/g;
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ */
+function hyphenateStyleName(name) {
+ return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
+}
+
function isCustomComponent(tagName, props) {
if (tagName.indexOf('-') === -1) {
return typeof props.is === 'string';
@@ -851,11 +1102,13 @@ function isCustomComponent(tagName, props) {
}
}
-var warnValidStyle = emptyFunction;
+var warnValidStyle = function () {};
{
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
+ var msPattern$1 = /^-ms-/;
+ var hyphenPattern = /-(.)/g;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
@@ -865,65 +1118,75 @@ var warnValidStyle = emptyFunction;
var warnedForNaNValue = false;
var warnedForInfinityValue = false;
- var warnHyphenatedStyleName = function (name, getStack) {
+ var camelize = function (string) {
+ return string.replace(hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
+ };
+
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
+ warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
+ // As Andi Smith suggests
+ // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ // is converted to lowercase `ms`.
+ camelize(name.replace(msPattern$1, 'ms-')));
};
- var warnBadVendoredStyleName = function (name, getStack) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
+ warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
};
- var warnStyleValueWithSemicolon = function (name, value, getStack) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
+ warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
};
- var warnStyleValueIsNaN = function (name, value, getStack) {
+ var warnStyleValueIsNaN = function (name, value) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
- warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
+ warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
};
- var warnStyleValueIsInfinity = function (name, value, getStack) {
+ var warnStyleValueIsInfinity = function (name, value) {
if (warnedForInfinityValue) {
return;
}
warnedForInfinityValue = true;
- warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
+ warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
};
- warnValidStyle = function (name, value, getStack) {
+ warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name, getStack);
+ warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name, getStack);
+ warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value, getStack);
+ warnStyleValueWithSemicolon(name, value);
}
if (typeof value === 'number') {
if (isNaN(value)) {
- warnStyleValueIsNaN(name, value, getStack);
+ warnStyleValueIsNaN(name, value);
} else if (!isFinite(value)) {
- warnStyleValueIsInfinity(name, value, getStack);
+ warnStyleValueIsInfinity(name, value);
}
}
};
@@ -990,15 +1253,10 @@ var warnedProperties = {};
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-function getStackAddendum$1() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
+var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function validateProperty(tagName, name) {
- if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
+ if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
@@ -1009,13 +1267,13 @@ function validateProperty(tagName, name) {
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (correctName == null) {
- warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1());
+ warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
warnedProperties[name] = true;
return true;
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== correctName) {
- warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1());
+ warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
warnedProperties[name] = true;
return true;
}
@@ -1033,7 +1291,7 @@ function validateProperty(tagName, name) {
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== standardName) {
- warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1());
+ warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
warnedProperties[name] = true;
return true;
}
@@ -1057,9 +1315,9 @@ function warnInvalidARIAProps(type, props) {
}).join(', ');
if (invalidProps.length === 1) {
- warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
+ warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
} else if (invalidProps.length > 1) {
- warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
+ warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
}
}
@@ -1072,11 +1330,6 @@ function validateProperties(type, props) {
var didWarnValueNull = false;
-function getStackAddendum$2() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
-
function validateProperties$1(type, props) {
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
return;
@@ -1085,9 +1338,9 @@ function validateProperties$1(type, props) {
if (props != null && props.value === null && !didWarnValueNull) {
didWarnValueNull = true;
if (type === 'select' && props.multiple) {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$2());
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
} else {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2());
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
}
}
}
@@ -1177,7 +1430,7 @@ var possibleStandardNames = {
checked: 'checked',
children: 'children',
cite: 'cite',
- 'class': 'className',
+ class: 'className',
classid: 'classID',
classname: 'className',
cols: 'cols',
@@ -1192,7 +1445,7 @@ var possibleStandardNames = {
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
data: 'data',
datetime: 'dateTime',
- 'default': 'default',
+ default: 'default',
defaultchecked: 'defaultChecked',
defaultvalue: 'defaultValue',
defer: 'defer',
@@ -1201,7 +1454,7 @@ var possibleStandardNames = {
download: 'download',
draggable: 'draggable',
enctype: 'encType',
- 'for': 'htmlFor',
+ for: 'htmlFor',
form: 'form',
formmethod: 'formMethod',
formaction: 'formAction',
@@ -1250,6 +1503,7 @@ var possibleStandardNames = {
multiple: 'multiple',
muted: 'muted',
name: 'name',
+ nomodule: 'noModule',
nonce: 'nonce',
novalidate: 'noValidate',
open: 'open',
@@ -1418,7 +1672,7 @@ var possibleStandardNames = {
imagerendering: 'imageRendering',
'image-rendering': 'imageRendering',
in2: 'in2',
- 'in': 'in',
+ in: 'in',
inlist: 'inlist',
intercept: 'intercept',
k1: 'k1',
@@ -1558,7 +1812,7 @@ var possibleStandardNames = {
'text-rendering': 'textRendering',
to: 'to',
transform: 'transform',
- 'typeof': 'typeof',
+ typeof: 'typeof',
u1: 'u1',
u2: 'u2',
underlineposition: 'underlinePosition',
@@ -1637,27 +1891,24 @@ var possibleStandardNames = {
zoomandpan: 'zoomAndPan'
};
-function getStackAddendum$3() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
+var validateProperty$1 = function () {};
{
var warnedProperties$1 = {};
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
var EVENT_NAME_REGEX = /^on./;
var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
- var validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
- if (hasOwnProperty$1.call(warnedProperties$1, name) && warnedProperties$1[name]) {
+ validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
+ if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
return true;
}
var lowerCasedName = name.toLowerCase();
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
- warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
+ warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
warnedProperties$1[name] = true;
return true;
}
@@ -1669,12 +1920,12 @@ function getStackAddendum$3() {
}
var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
if (registrationName != null) {
- warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3());
+ warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
warnedProperties$1[name] = true;
return true;
}
if (EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3());
+ warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
warnedProperties$1[name] = true;
return true;
}
@@ -1683,7 +1934,7 @@ function getStackAddendum$3() {
// So we can't tell if the event name is correct for sure, but we can filter
// out known bad ones like `onclick`. We can't suggest a specific replacement though.
if (INVALID_EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$3());
+ warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
}
warnedProperties$1[name] = true;
return true;
@@ -1695,52 +1946,53 @@ function getStackAddendum$3() {
}
if (lowerCasedName === 'innerhtml') {
- warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
+ warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'aria') {
- warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
+ warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
- warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3());
+ warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
warnedProperties$1[name] = true;
return true;
}
if (typeof value === 'number' && isNaN(value)) {
- warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3());
+ warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
warnedProperties$1[name] = true;
return true;
}
- var isReserved = isReservedProp(name);
+ var propertyInfo = getPropertyInfo(name);
+ var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
// Known attributes should match the casing specified in the property config.
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
var standardName = possibleStandardNames[lowerCasedName];
if (standardName !== name) {
- warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3());
+ warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
warnedProperties$1[name] = true;
return true;
}
} else if (!isReserved && name !== lowerCasedName) {
// Unknown attributes should have lowercase casing since that's how they
// will be cased anyway with server rendering.
- warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3());
+ warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
warnedProperties$1[name] = true;
return true;
}
- if (typeof value === 'boolean' && !shouldAttributeAcceptBooleanValue(name)) {
+ if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
if (value) {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$3());
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
} else {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$3());
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
}
warnedProperties$1[name] = true;
return true;
@@ -1753,11 +2005,18 @@ function getStackAddendum$3() {
}
// Warn when a known attribute is a bad type
- if (!shouldSetAttribute(name, value)) {
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
warnedProperties$1[name] = true;
return false;
}
+ // Warn when passing the strings 'false' or 'true' into a boolean prop
+ if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
+ warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
return true;
};
}
@@ -1775,9 +2034,9 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
return '`' + prop + '`';
}).join(', ');
if (unknownProps.length === 1) {
- warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
+ warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
} else if (unknownProps.length > 1) {
- warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
+ warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
}
};
@@ -1794,16 +2053,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var toArray = React.Children.toArray;
-var getStackAddendum = emptyFunction.thatReturns('');
+// This is only used in DEV.
+// Each entry is `this.stack` from a currently executing renderer instance.
+// (There may be more than one because ReactDOMServer is reentrant).
+// Each stack is an array of frames which may contain nested stacks of elements.
+var currentDebugStacks = [];
+
+var ReactDebugCurrentFrame = void 0;
+var prevGetCurrentStackImpl = null;
+var getCurrentServerStackImpl = function () {
+ return '';
+};
+var describeStackFrame = function (element) {
+ return '';
+};
+
+var validatePropertiesInDevelopment = function (type, props) {};
+var pushCurrentDebugStack = function (stack) {};
+var pushElementToDebugStack = function (element) {};
+var popCurrentDebugStack = function () {};
{
- var validatePropertiesInDevelopment = function (type, props) {
+ ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+
+ validatePropertiesInDevelopment = function (type, props) {
validateProperties(type, props);
validateProperties$1(type, props);
validateProperties$2(type, props, /* canUseEventSystem */false);
};
- var describeStackFrame = function (element) {
+ describeStackFrame = function (element) {
var source = element._source;
var type = element.type;
var name = getComponentName(type);
@@ -1811,34 +2090,55 @@ var getStackAddendum = emptyFunction.thatReturns('');
return describeComponentFrame(name, source, ownerName);
};
- var currentDebugStack = null;
- var currentDebugElementStack = null;
- var setCurrentDebugStack = function (stack) {
+ pushCurrentDebugStack = function (stack) {
+ currentDebugStacks.push(stack);
+
+ if (currentDebugStacks.length === 1) {
+ // We are entering a server renderer.
+ // Remember the previous (e.g. client) global stack implementation.
+ prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
+ ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
+ }
+ };
+
+ pushElementToDebugStack = function (element) {
+ // For the innermost executing ReactDOMServer call,
+ var stack = currentDebugStacks[currentDebugStacks.length - 1];
+ // Take the innermost executing frame (e.g. <Foo>),
var frame = stack[stack.length - 1];
- currentDebugElementStack = frame.debugElementStack;
- // We are about to enter a new composite stack, reset the array.
- currentDebugElementStack.length = 0;
- currentDebugStack = stack;
- ReactDebugCurrentFrame.getCurrentStack = getStackAddendum;
+ // and record that it has one more element associated with it.
+ frame.debugElementStack.push(element);
+ // We only need this because we tail-optimize single-element
+ // children and directly handle them in an inner loop instead of
+ // creating separate frames for them.
};
- var pushElementToDebugStack = function (element) {
- if (currentDebugElementStack !== null) {
- currentDebugElementStack.push(element);
+
+ popCurrentDebugStack = function () {
+ currentDebugStacks.pop();
+
+ if (currentDebugStacks.length === 0) {
+ // We are exiting the server renderer.
+ // Restore the previous (e.g. client) global stack implementation.
+ ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
+ prevGetCurrentStackImpl = null;
}
};
- var resetCurrentDebugStack = function () {
- currentDebugElementStack = null;
- currentDebugStack = null;
- ReactDebugCurrentFrame.getCurrentStack = null;
- };
- getStackAddendum = function () {
- if (currentDebugStack === null) {
+
+ getCurrentServerStackImpl = function () {
+ if (currentDebugStacks.length === 0) {
+ // Nothing is currently rendering.
return '';
}
+ // ReactDOMServer is reentrant so there may be multiple calls at the same time.
+ // Take the frames from the innermost call which is the last in the array.
+ var frames = currentDebugStacks[currentDebugStacks.length - 1];
var stack = '';
- var debugStack = currentDebugStack;
- for (var i = debugStack.length - 1; i >= 0; i--) {
- var frame = debugStack[i];
+ // Go through every frame in the stack from the innermost one.
+ for (var i = frames.length - 1; i >= 0; i--) {
+ var frame = frames[i];
+ // Every frame might have more than one debug element stack entry associated with it.
+ // This is because single-child nesting doesn't create materialized frames.
+ // Instead it would push them through `pushElementToDebugStack()`.
var _debugElementStack = frame.debugElementStack;
for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
stack += describeStackFrame(_debugElementStack[ii]);
@@ -1854,6 +2154,10 @@ var didWarnDefaultSelectValue = false;
var didWarnDefaultTextareaValue = false;
var didWarnInvalidOptionChildren = false;
var didWarnAboutNoopUpdateForComponent = {};
+var didWarnAboutBadClass = {};
+var didWarnAboutDeprecatedWillMount = {};
+var didWarnAboutUndefinedDerivedState = {};
+var didWarnAboutUninitializedState = {};
var valuePropNames = ['value', 'defaultValue'];
var newlineEatingTags = {
listing: true,
@@ -1861,10 +2165,6 @@ var newlineEatingTags = {
textarea: true
};
-function getComponentName(type) {
- return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
-}
-
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
@@ -1877,9 +2177,15 @@ function validateDangerousTag(tag) {
}
}
-var processStyleName = memoizeStringOnly(function (styleName) {
- return hyphenateStyleName(styleName);
-});
+var styleNameCache = {};
+var processStyleName = function (styleName) {
+ if (styleNameCache.hasOwnProperty(styleName)) {
+ return styleNameCache[styleName];
+ }
+ var result = hyphenateStyleName(styleName);
+ styleNameCache[styleName] = result;
+ return result;
+};
function createMarkupForStyles(styles) {
var serialized = '';
@@ -1892,7 +2198,7 @@ function createMarkupForStyles(styles) {
var styleValue = styles[styleName];
{
if (!isCustomProperty) {
- warnValidStyle$1(styleName, styleValue, getStackAddendum);
+ warnValidStyle$1(styleName, styleValue);
}
}
if (styleValue != null) {
@@ -1907,14 +2213,14 @@ function createMarkupForStyles(styles) {
function warnNoop(publicInstance, callerName) {
{
- var constructor = publicInstance.constructor;
- var componentName = constructor && getComponentName(constructor) || 'ReactClass';
+ var _constructor = publicInstance.constructor;
+ var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
var warningKey = componentName + '.' + callerName;
if (didWarnAboutNoopUpdateForComponent[warningKey]) {
return;
}
- warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
+ warningWithoutStack$1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
didWarnAboutNoopUpdateForComponent[warningKey] = true;
}
}
@@ -1955,6 +2261,9 @@ function flattenTopLevelChildren(children) {
}
function flattenOptionChildren(children) {
+ if (children === undefined || children === null) {
+ return children;
+ }
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
@@ -1962,20 +2271,22 @@ function flattenOptionChildren(children) {
if (child == null) {
return;
}
- if (typeof child === 'string' || typeof child === 'number') {
- content += child;
- } else {
- {
- if (!didWarnInvalidOptionChildren) {
- didWarnInvalidOptionChildren = true;
- warning(false, 'Only strings and numbers are supported as <option> children.');
- }
+ content += child;
+ {
+ if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
+ didWarnInvalidOptionChildren = true;
+ warning$1(false, 'Only strings and numbers are supported as <option> children.');
}
}
});
return content;
}
+var emptyObject = {};
+{
+ Object.freeze(emptyObject);
+}
+
function maskContext(type, context) {
var contextTypes = type.contextTypes;
if (!contextTypes) {
@@ -1990,7 +2301,7 @@ function maskContext(type, context) {
function checkContextTypes(typeSpecs, values, location) {
{
- checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
+ checkPropTypes(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
}
}
@@ -2004,8 +2315,9 @@ function processContext(type, context) {
return maskedContext;
}
+var hasOwnProperty = Object.prototype.hasOwnProperty;
var STYLE = 'style';
-var RESERVED_PROPS$1 = {
+var RESERVED_PROPS = {
children: null,
dangerouslySetInnerHTML: null,
suppressContentEditableWarning: null,
@@ -2016,7 +2328,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
var ret = '<' + tagVerbatim;
for (var propKey in props) {
- if (!props.hasOwnProperty(propKey)) {
+ if (!hasOwnProperty.call(props, propKey)) {
continue;
}
var propValue = props[propKey];
@@ -2028,7 +2340,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
}
var markup = null;
if (isCustomComponent(tagLowercase, props)) {
- if (!RESERVED_PROPS$1.hasOwnProperty(propKey)) {
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
markup = createMarkupForCustomAttribute(propKey, propValue);
}
} else {
@@ -2061,15 +2373,20 @@ function resolve(child, context) {
while (React.isValidElement(child)) {
// Safe because we just checked it's an element.
var element = child;
+ var Component = element.type;
{
pushElementToDebugStack(element);
}
- var Component = element.type;
if (typeof Component !== 'function') {
break;
}
+ processChild(element, Component);
+ }
+
+ // Extra closure so queue and replace can be captured properly
+ function processChild(element, Component) {
var publicContext = processContext(Component, context);
- var inst;
+
var queue = [];
var replace = false;
var updater = {
@@ -2086,23 +2403,62 @@ function resolve(child, context) {
replace = true;
queue = [completeState];
},
- enqueueSetState: function (publicInstance, partialState) {
+ enqueueSetState: function (publicInstance, currentPartialState) {
if (queue === null) {
warnNoop(publicInstance, 'setState');
return null;
}
- queue.push(partialState);
+ queue.push(currentPartialState);
}
};
+ var inst = void 0;
if (shouldConstruct(Component)) {
inst = new Component(element.props, publicContext, updater);
+
+ if (typeof Component.getDerivedStateFromProps === 'function') {
+ {
+ if (inst.state === null || inst.state === undefined) {
+ var componentName = getComponentName(Component) || 'Unknown';
+ if (!didWarnAboutUninitializedState[componentName]) {
+ warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
+ didWarnAboutUninitializedState[componentName] = true;
+ }
+ }
+ }
+
+ var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
+
+ {
+ if (partialState === undefined) {
+ var _componentName = getComponentName(Component) || 'Unknown';
+ if (!didWarnAboutUndefinedDerivedState[_componentName]) {
+ warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
+ didWarnAboutUndefinedDerivedState[_componentName] = true;
+ }
+ }
+ }
+
+ if (partialState != null) {
+ inst.state = _assign({}, inst.state, partialState);
+ }
+ }
} else {
+ {
+ if (Component.prototype && typeof Component.prototype.render === 'function') {
+ var _componentName2 = getComponentName(Component) || 'Unknown';
+
+ if (!didWarnAboutBadClass[_componentName2]) {
+ warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
+ didWarnAboutBadClass[_componentName2] = true;
+ }
+ }
+ }
inst = Component(element.props, publicContext, updater);
if (inst == null || inst.render == null) {
child = inst;
validateRenderResult(child, Component);
- continue;
+ return;
}
}
@@ -2114,8 +2470,30 @@ function resolve(child, context) {
if (initialState === undefined) {
inst.state = initialState = null;
}
- if (inst.componentWillMount) {
- inst.componentWillMount();
+ if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
+ if (typeof inst.componentWillMount === 'function') {
+ {
+ if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
+ var _componentName3 = getComponentName(Component) || 'Unknown';
+
+ if (!didWarnAboutDeprecatedWillMount[_componentName3]) {
+ lowPriorityWarning$1(false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', _componentName3);
+ didWarnAboutDeprecatedWillMount[_componentName3] = true;
+ }
+ }
+ }
+
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
+ if (typeof Component.getDerivedStateFromProps !== 'function') {
+ inst.componentWillMount();
+ }
+ }
+ if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
+ inst.UNSAFE_componentWillMount();
+ }
if (queue.length) {
var oldQueue = queue;
var oldReplace = replace;
@@ -2129,13 +2507,13 @@ function resolve(child, context) {
var dontMutate = true;
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
var partial = oldQueue[i];
- var partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
- if (partialState) {
+ var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
+ if (_partialState != null) {
if (dontMutate) {
dontMutate = false;
- nextState = _assign({}, nextState, partialState);
+ nextState = _assign({}, nextState, _partialState);
} else {
- _assign(nextState, partialState);
+ _assign(nextState, _partialState);
}
}
}
@@ -2156,7 +2534,7 @@ function resolve(child, context) {
}
validateRenderResult(child, Component);
- var childContext;
+ var childContext = void 0;
if (typeof inst.getChildContext === 'function') {
var childContextTypes = Component.childContextTypes;
if (typeof childContextTypes === 'object') {
@@ -2165,7 +2543,7 @@ function resolve(child, context) {
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
}
} else {
- warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
+ warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
}
}
if (childContext) {
@@ -2176,12 +2554,15 @@ function resolve(child, context) {
}
var ReactDOMServerRenderer = function () {
+ // DEV-only
+
function ReactDOMServerRenderer(children, makeStaticMarkup) {
_classCallCheck(this, ReactDOMServerRenderer);
var flatChildren = flattenTopLevelChildren(children);
var topFrame = {
+ type: null,
// Assume all trees start in the HTML namespace (not totally true, but
// this is what we did historically)
domNamespace: Namespaces.html,
@@ -2198,10 +2579,69 @@ var ReactDOMServerRenderer = function () {
this.currentSelectValue = null;
this.previousWasTextNode = false;
this.makeStaticMarkup = makeStaticMarkup;
+
+ // Context (new API)
+ this.contextIndex = -1;
+ this.contextStack = [];
+ this.contextValueStack = [];
+ {
+ this.contextProviderStack = [];
+ }
}
+
+ /**
+ * Note: We use just two stacks regardless of how many context providers you have.
+ * Providers are always popped in the reverse order to how they were pushed
+ * so we always know on the way down which provider you'll encounter next on the way up.
+ * On the way down, we push the current provider, and its context value *before*
+ * we mutated it, onto the stacks. Therefore, on the way up, we always know which
+ * provider needs to be "restored" to which value.
+ * https://github.com/facebook/react/pull/12985#issuecomment-396301248
+ */
+
// TODO: type this more strictly:
+ ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
+ var index = ++this.contextIndex;
+ var context = provider.type._context;
+ var previousValue = context._currentValue;
+
+ // Remember which value to restore this context to on our way up.
+ this.contextStack[index] = context;
+ this.contextValueStack[index] = previousValue;
+ {
+ // Only used for push/pop mismatch warnings.
+ this.contextProviderStack[index] = provider;
+ }
+
+ // Mutate the current value.
+ context._currentValue = provider.props.value;
+ };
+
+ ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
+ var index = this.contextIndex;
+ {
+ !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
+ }
+
+ var context = this.contextStack[index];
+ var previousValue = this.contextValueStack[index];
+
+ // "Hide" these null assignments from Flow by using `any`
+ // because conceptually they are deletions--as long as we
+ // promise to never access values beyond `this.contextIndex`.
+ this.contextStack[index] = null;
+ this.contextValueStack[index] = null;
+ {
+ this.contextProviderStack[index] = null;
+ }
+ this.contextIndex--;
+
+ // Restore to the previous value we stored as we were walking down.
+ context._currentValue = previousValue;
+ };
+
ReactDOMServerRenderer.prototype.read = function read(bytes) {
if (this.exhausted) {
return null;
@@ -2215,25 +2655,31 @@ var ReactDOMServerRenderer = function () {
}
var frame = this.stack[this.stack.length - 1];
if (frame.childIndex >= frame.children.length) {
- var footer = frame.footer;
- out += footer;
- if (footer !== '') {
+ var _footer = frame.footer;
+ out += _footer;
+ if (_footer !== '') {
this.previousWasTextNode = false;
}
this.stack.pop();
- if (frame.tag === 'select') {
+ if (frame.type === 'select') {
this.currentSelectValue = null;
+ } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
+ var provider = frame.type;
+ this.popProvider(provider);
}
continue;
}
var child = frame.children[frame.childIndex++];
{
- setCurrentDebugStack(this.stack);
- }
- out += this.render(child, frame.context, frame.domNamespace);
- {
- // TODO: Handle reentrant server render calls. This doesn't.
- resetCurrentDebugStack();
+ pushCurrentDebugStack(this.stack);
+ // We're starting work on this frame, so reset its inner stack.
+ frame.debugElementStack.length = 0;
+ try {
+ // Be careful! Make sure this matches the PROD path below.
+ out += this.render(child, frame.context, frame.domNamespace);
+ } finally {
+ popCurrentDebugStack();
+ }
}
}
return out;
@@ -2254,7 +2700,7 @@ var ReactDOMServerRenderer = function () {
this.previousWasTextNode = true;
return escapeTextForBrowser(text);
} else {
- var nextChild;
+ var nextChild = void 0;
var _resolve = resolve(child, context);
@@ -2264,8 +2710,16 @@ var ReactDOMServerRenderer = function () {
if (nextChild === null || nextChild === false) {
return '';
} else if (!React.isValidElement(nextChild)) {
+ if (nextChild != null && nextChild.$$typeof != null) {
+ // Catch unexpected special types early.
+ var $$typeof = nextChild.$$typeof;
+ !($$typeof !== REACT_PORTAL_TYPE) ? invariant(false, 'Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.') : void 0;
+ // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
+ invariant(false, 'Unknown element-like object type: %s. This is likely a bug in React. Please file an issue.', $$typeof.toString());
+ }
var nextChildren = toArray(nextChild);
var frame = {
+ type: null,
domNamespace: parentNamespace,
children: nextChildren,
childIndex: 0,
@@ -2277,25 +2731,141 @@ var ReactDOMServerRenderer = function () {
}
this.stack.push(frame);
return '';
- } else if (nextChild.type === REACT_FRAGMENT_TYPE) {
- var _nextChildren = toArray(nextChild.props.children);
- var _frame = {
- domNamespace: parentNamespace,
- children: _nextChildren,
- childIndex: 0,
- context: context,
- footer: ''
- };
- {
- _frame.debugElementStack = [];
- }
- this.stack.push(_frame);
- return '';
- } else {
- // Safe because we just checked it's an element.
- var nextElement = nextChild;
+ }
+ // Safe because we just checked it's an element.
+ var nextElement = nextChild;
+ var elementType = nextElement.type;
+
+ if (typeof elementType === 'string') {
return this.renderDOM(nextElement, context, parentNamespace);
}
+
+ switch (elementType) {
+ case REACT_STRICT_MODE_TYPE:
+ case REACT_ASYNC_MODE_TYPE:
+ case REACT_PROFILER_TYPE:
+ case REACT_FRAGMENT_TYPE:
+ {
+ var _nextChildren = toArray(nextChild.props.children);
+ var _frame = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame.debugElementStack = [];
+ }
+ this.stack.push(_frame);
+ return '';
+ }
+ case REACT_PLACEHOLDER_TYPE:
+ {
+ if (enableSuspenseServerRenderer) {
+ var _nextChildren2 = toArray(
+ // Always use the fallback when synchronously rendering to string.
+ nextChild.props.fallback);
+ var _frame2 = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren2,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame2.debugElementStack = [];
+ }
+ this.stack.push(_frame2);
+ return '';
+ }
+ }
+ // eslint-disable-next-line-no-fallthrough
+ default:
+ break;
+ }
+ if (typeof elementType === 'object' && elementType !== null) {
+ switch (elementType.$$typeof) {
+ case REACT_FORWARD_REF_TYPE:
+ {
+ var element = nextChild;
+ var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
+ var _frame3 = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren3,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame3.debugElementStack = [];
+ }
+ this.stack.push(_frame3);
+ return '';
+ }
+ case REACT_PROVIDER_TYPE:
+ {
+ var provider = nextChild;
+ var nextProps = provider.props;
+ var _nextChildren4 = toArray(nextProps.children);
+ var _frame4 = {
+ type: provider,
+ domNamespace: parentNamespace,
+ children: _nextChildren4,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame4.debugElementStack = [];
+ }
+
+ this.pushProvider(provider);
+
+ this.stack.push(_frame4);
+ return '';
+ }
+ case REACT_CONTEXT_TYPE:
+ {
+ var consumer = nextChild;
+ var _nextProps = consumer.props;
+ var nextValue = consumer.type._currentValue;
+
+ var _nextChildren5 = toArray(_nextProps.children(nextValue));
+ var _frame5 = {
+ type: nextChild,
+ domNamespace: parentNamespace,
+ children: _nextChildren5,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame5.debugElementStack = [];
+ }
+ this.stack.push(_frame5);
+ return '';
+ }
+ default:
+ break;
+ }
+ }
+
+ var info = '';
+ {
+ var owner = nextElement._owner;
+ if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
+ 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.';
+ }
+ var ownerName = owner ? getComponentName(owner) : null;
+ if (ownerName) {
+ info += '\n\nCheck the render method of `' + ownerName + '`.';
+ }
+ }
+ invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', elementType == null ? elementType : typeof elementType, info);
}
};
@@ -2311,7 +2881,7 @@ var ReactDOMServerRenderer = function () {
if (namespace === Namespaces.html) {
// Should this check be gated by parent namespace? Not sure we want to
// allow <SVG> or <mATH>.
- warning(tag === element.type, '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', element.type);
+ !(tag === element.type) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
}
}
@@ -2320,14 +2890,14 @@ var ReactDOMServerRenderer = function () {
var props = element.props;
if (tag === 'input') {
{
- ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('input', props);
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
- warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
+ warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
didWarnDefaultChecked = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
- warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
+ warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
didWarnDefaultInputValue = true;
}
}
@@ -2342,9 +2912,9 @@ var ReactDOMServerRenderer = function () {
});
} else if (tag === 'textarea') {
{
- ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props);
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
- warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning$1(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultTextareaValue = true;
}
}
@@ -2356,7 +2926,7 @@ var ReactDOMServerRenderer = function () {
var textareaChildren = props.children;
if (textareaChildren != null) {
{
- warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
+ warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
}
!(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
if (Array.isArray(textareaChildren)) {
@@ -2378,7 +2948,7 @@ var ReactDOMServerRenderer = function () {
});
} else if (tag === 'select') {
{
- ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('select', props);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
@@ -2387,14 +2957,14 @@ var ReactDOMServerRenderer = function () {
}
var isArray = Array.isArray(props[propName]);
if (props.multiple && !isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '');
+ warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
} else if (!props.multiple && isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '');
+ warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
}
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
- warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultSelectValue = true;
}
}
@@ -2407,7 +2977,7 @@ var ReactDOMServerRenderer = function () {
var selectValue = this.currentSelectValue;
var optionChildren = flattenOptionChildren(props.children);
if (selectValue != null) {
- var value;
+ var value = void 0;
if (props.value != null) {
value = props.value + '';
} else {
@@ -2440,7 +3010,7 @@ var ReactDOMServerRenderer = function () {
validatePropertiesInDevelopment(tag, props);
}
- assertValidProps(tag, props, getStackAddendum);
+ assertValidProps(tag, props);
var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
var footer = '';
@@ -2450,7 +3020,7 @@ var ReactDOMServerRenderer = function () {
out += '>';
footer = '</' + element.type + '>';
}
- var children;
+ var children = void 0;
var innerMarkup = getNonChildrenInnerMarkup(props);
if (innerMarkup != null) {
children = [];
@@ -2473,7 +3043,7 @@ var ReactDOMServerRenderer = function () {
}
var frame = {
domNamespace: getChildNamespace(parentNamespace, element.type),
- tag: tag,
+ type: tag,
children: children,
childIndex: 0,
context: context,
@@ -2537,7 +3107,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest
-var server_browser = ReactDOMServer['default'] ? ReactDOMServer['default'] : ReactDOMServer;
+var server_browser = ReactDOMServer.default || ReactDOMServer;
module.exports = server_browser;
})();
diff --git a/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js b/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
index 8af3cbf35..bad405900 100644
--- a/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
+++ b/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
@@ -1,42 +1,43 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-server.browser.production.min.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var h=require("object-assign"),n=require("react"),aa=require("fbjs/lib/emptyFunction"),t=require("fbjs/lib/emptyObject"),ba=require("fbjs/lib/hyphenateStyleName"),ca=require("fbjs/lib/memoizeStringOnly");
-function w(a){for(var b=arguments.length-1,g="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,c=0;c<b;c++)g+="\x26args[]\x3d"+encodeURIComponent(arguments[c+1]);b=Error(g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}
-var x={children:!0,dangerouslySetInnerHTML:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,style:!0};function z(a,b){return(a&b)===b}
-var B={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,HAS_STRING_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(a){var b=B,g=a.Properties||{},c=a.DOMAttributeNamespaces||{},k=a.DOMAttributeNames||{};a=a.DOMMutationMethods||{};for(var f in g){C.hasOwnProperty(f)?w("48",f):void 0;var e=f.toLowerCase(),d=g[f];e={attributeName:e,attributeNamespace:null,propertyName:f,mutationMethod:null,mustUseProperty:z(d,b.MUST_USE_PROPERTY),
-hasBooleanValue:z(d,b.HAS_BOOLEAN_VALUE),hasNumericValue:z(d,b.HAS_NUMERIC_VALUE),hasPositiveNumericValue:z(d,b.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:z(d,b.HAS_OVERLOADED_BOOLEAN_VALUE),hasStringBooleanValue:z(d,b.HAS_STRING_BOOLEAN_VALUE)};1>=e.hasBooleanValue+e.hasNumericValue+e.hasOverloadedBooleanValue?void 0:w("50",f);k.hasOwnProperty(f)&&(e.attributeName=k[f]);c.hasOwnProperty(f)&&(e.attributeNamespace=c[f]);a.hasOwnProperty(f)&&(e.mutationMethod=a[f]);C[f]=e}}},C={};
-function da(a,b){if(x.hasOwnProperty(a)||2<a.length&&("o"===a[0]||"O"===a[0])&&("n"===a[1]||"N"===a[1]))return!1;if(null===b)return!0;switch(typeof b){case "boolean":return D(a);case "undefined":case "number":case "string":case "object":return!0;default:return!1}}function E(a){return C.hasOwnProperty(a)?C[a]:null}
-function D(a){if(x.hasOwnProperty(a))return!0;var b=E(a);if(b)return b.hasBooleanValue||b.hasStringBooleanValue||b.hasOverloadedBooleanValue;a=a.toLowerCase().slice(0,5);return"data-"===a||"aria-"===a}
-var F=B,G=F.MUST_USE_PROPERTY,H=F.HAS_BOOLEAN_VALUE,I=F.HAS_NUMERIC_VALUE,J=F.HAS_POSITIVE_NUMERIC_VALUE,K=F.HAS_OVERLOADED_BOOLEAN_VALUE,L=F.HAS_STRING_BOOLEAN_VALUE,ea={Properties:{allowFullScreen:H,async:H,autoFocus:H,autoPlay:H,capture:K,checked:G|H,cols:J,contentEditable:L,controls:H,"default":H,defer:H,disabled:H,download:K,draggable:L,formNoValidate:H,hidden:H,loop:H,multiple:G|H,muted:G|H,noValidate:H,open:H,playsInline:H,readOnly:H,required:H,reversed:H,rows:J,rowSpan:I,scoped:H,seamless:H,
-selected:G|H,size:J,start:I,span:J,spellCheck:L,style:0,tabIndex:0,itemScope:H,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:L},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(a,b){if(null==b)return a.removeAttribute("value");"number"!==a.type||!1===a.hasAttribute("value")?a.setAttribute("value",""+b):a.validity&&!a.validity.badInput&&a.ownerDocument.activeElement!==a&&a.setAttribute("value",""+
-b)}}},M=F.HAS_STRING_BOOLEAN_VALUE,N={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},O={Properties:{autoReverse:M,externalResourcesRequired:M,preserveAlpha:M},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:N.xlink,xlinkArcrole:N.xlink,xlinkHref:N.xlink,xlinkRole:N.xlink,xlinkShow:N.xlink,xlinkTitle:N.xlink,xlinkType:N.xlink,xmlBase:N.xml,xmlLang:N.xml,
-xmlSpace:N.xml}},fa=/[\-\:]([a-z])/g;function ha(a){return a[1].toUpperCase()}
-"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(a){var b=a.replace(fa,
-ha);O.Properties[b]=0;O.DOMAttributeNames[b]=a});F.injectDOMPropertyConfig(ea);F.injectDOMPropertyConfig(O);var P="function"===typeof Symbol&&Symbol["for"]?Symbol["for"]("react.fragment"):60107,ia=/["'&<>]/;
-function Q(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ia.exec(a);if(b){var g="",c,k=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b="\x26quot;";break;case 38:b="\x26amp;";break;case 39:b="\x26#x27;";break;case 60:b="\x26lt;";break;case 62:b="\x26gt;";break;default:continue}k!==c&&(g+=a.substring(k,c));k=c+1;g+=b}a=k!==c?g+a.substring(k,c):g}return a}
-var ja=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,R={},S={};function ka(a){if(S.hasOwnProperty(a))return!0;if(R.hasOwnProperty(a))return!1;if(ja.test(a))return S[a]=!0;R[a]=!0;return!1}
-function la(a,b){var g=E(a);if(g){if(null==b||g.hasBooleanValue&&!b||g.hasNumericValue&&isNaN(b)||g.hasPositiveNumericValue&&1>b||g.hasOverloadedBooleanValue&&!1===b)return"";var c=g.attributeName;if(g.hasBooleanValue||g.hasOverloadedBooleanValue&&!0===b)return c+'\x3d""';if("boolean"!==typeof b||D(a))return c+"\x3d"+('"'+Q(b)+'"')}else if(da(a,b))return null==b?"":a+"\x3d"+('"'+Q(b)+'"');return null}var T={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
-function U(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
-var V={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},ma=h({menuitem:!0},V),W={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,
-fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},na=["Webkit","ms","Moz","O"];Object.keys(W).forEach(function(a){na.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);W[b]=W[a]})});var X=n.Children.toArray,Y=aa.thatReturns(""),oa={listing:!0,pre:!0,textarea:!0};
-function pa(a){return"string"===typeof a?a:"function"===typeof a?a.displayName||a.name:null}var qa=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ra={},sa=ca(function(a){return ba(a)});function ta(a){var b="";n.Children.forEach(a,function(a){null==a||"string"!==typeof a&&"number"!==typeof a||(b+=a)});return b}function ua(a,b){if(a=a.contextTypes){var g={},c;for(c in a)g[c]=b[c];b=g}else b=t;return b}var va={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};
-function wa(a,b){void 0===a&&w("152",pa(b)||"Component")}
-function xa(a,b){for(;n.isValidElement(a);){var g=a,c=g.type;if("function"!==typeof c)break;a=ua(c,b);var k=[],f=!1,e={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===k)return null},enqueueReplaceState:function(a,b){f=!0;k=[b]},enqueueSetState:function(a,b){if(null===k)return null;k.push(b)}};if(c.prototype&&c.prototype.isReactComponent)var d=new c(g.props,a,e);else if(d=c(g.props,a,e),null==d||null==d.render){a=d;wa(a,c);continue}d.props=g.props;d.context=a;d.updater=e;e=d.state;
-void 0===e&&(d.state=e=null);if(d.componentWillMount)if(d.componentWillMount(),k.length){e=k;var p=f;k=null;f=!1;if(p&&1===e.length)d.state=e[0];else{var q=p?e[0]:d.state,l=!0;for(p=p?1:0;p<e.length;p++){var m=e[p];if(m="function"===typeof m?m.call(d,q,g.props,a):m)l?(l=!1,q=h({},q,m)):h(q,m)}d.state=q}}else k=null;a=d.render();wa(a,c);if("function"===typeof d.getChildContext&&(g=c.childContextTypes,"object"===typeof g)){var A=d.getChildContext();for(var y in A)y in g?void 0:w("108",pa(c)||"Unknown",
-y)}A&&(b=h({},b,A))}return{child:a,context:b}}
-var ya=function(){function a(b,g){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");n.isValidElement(b)?b.type!==P?b=[b]:(b=b.props.children,b=n.isValidElement(b)?[b]:X(b)):b=X(b);this.stack=[{domNamespace:T.html,children:b,childIndex:0,context:t,footer:""}];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=g}a.prototype.read=function(a){if(this.exhausted)return null;for(var b="";b.length<a;){if(0===this.stack.length){this.exhausted=
-!0;break}var c=this.stack[this.stack.length-1];if(c.childIndex>=c.children.length){var k=c.footer;b+=k;""!==k&&(this.previousWasTextNode=!1);this.stack.pop();"select"===c.tag&&(this.currentSelectValue=null)}else k=c.children[c.childIndex++],b+=this.render(k,c.context,c.domNamespace)}return b};a.prototype.render=function(a,g,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return Q(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+Q(c);this.previousWasTextNode=
-!0;return Q(c)}g=xa(a,g);a=g.child;g=g.context;if(null===a||!1===a)return"";if(n.isValidElement(a))return a.type===P?(a=X(a.props.children),this.stack.push({domNamespace:c,children:a,childIndex:0,context:g,footer:""}),""):this.renderDOM(a,g,c);a=X(a);this.stack.push({domNamespace:c,children:a,childIndex:0,context:g,footer:""});return""};a.prototype.renderDOM=function(a,g,c){var b=a.type.toLowerCase();c===T.html&&U(b);ra.hasOwnProperty(b)||(qa.test(b)?void 0:w("65",b),ra[b]=!0);var f=a.props;if("input"===
-b)f=h({type:void 0},f,{defaultChecked:void 0,defaultValue:void 0,value:null!=f.value?f.value:f.defaultValue,checked:null!=f.checked?f.checked:f.defaultChecked});else if("textarea"===b){var e=f.value;if(null==e){e=f.defaultValue;var d=f.children;null!=d&&(null!=e?w("92"):void 0,Array.isArray(d)&&(1>=d.length?void 0:w("93"),d=d[0]),e=""+d);null==e&&(e="")}f=h({},f,{value:void 0,children:""+e})}else if("select"===b)this.currentSelectValue=null!=f.value?f.value:f.defaultValue,f=h({},f,{value:void 0});
-else if("option"===b){d=this.currentSelectValue;var p=ta(f.children);if(null!=d){var q=null!=f.value?f.value+"":p;e=!1;if(Array.isArray(d))for(var l=0;l<d.length;l++){if(""+d[l]===q){e=!0;break}}else e=""+d===q;f=h({selected:void 0,children:void 0},f,{selected:e,children:p})}}if(e=f)ma[b]&&(null!=e.children||null!=e.dangerouslySetInnerHTML?w("137",b,Y()):void 0),null!=e.dangerouslySetInnerHTML&&(null!=e.children?w("60"):void 0,"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML?
-void 0:w("61")),null!=e.style&&"object"!==typeof e.style?w("62",Y()):void 0;e=f;d=this.makeStaticMarkup;p=1===this.stack.length;q="\x3c"+a.type;for(r in e)if(e.hasOwnProperty(r)){var m=e[r];if(null!=m){if("style"===r){l=void 0;var A="",y="";for(l in m)if(m.hasOwnProperty(l)){var u=0===l.indexOf("--"),v=m[l];null!=v&&(A+=y+sa(l)+":",y=l,u=null==v||"boolean"===typeof v||""===v?"":u||"number"!==typeof v||0===v||W.hasOwnProperty(y)&&W[y]?(""+v).trim():v+"px",A+=u,y=";")}m=A||null}l=null;b:if(u=b,v=e,
--1===u.indexOf("-"))u="string"===typeof v.is;else switch(u){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":u=!1;break b;default:u=!0}u?va.hasOwnProperty(r)||(l=r,l=ka(l)&&null!=m?l+"\x3d"+('"'+Q(m)+'"'):""):l=la(r,m);l&&(q+=" "+l)}}d||p&&(q+=' data-reactroot\x3d""');var r=q;e="";V.hasOwnProperty(b)?r+="/\x3e":(r+="\x3e",e="\x3c/"+a.type+"\x3e");a:{d=f.dangerouslySetInnerHTML;if(null!=
-d){if(null!=d.__html){d=d.__html;break a}}else if(d=f.children,"string"===typeof d||"number"===typeof d){d=Q(d);break a}d=null}null!=d?(f=[],oa[b]&&"\n"===d.charAt(0)&&(r+="\n"),r+=d):f=X(f.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?U(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,tag:b,children:f,childIndex:0,context:g,footer:e});this.previousWasTextNode=!1;return r};return a}(),za={renderToString:function(a){return(new ya(a,
-!1)).read(Infinity)},renderToStaticMarkup:function(a){return(new ya(a,!0)).read(Infinity)},renderToNodeStream:function(){w("207")},renderToStaticNodeStream:function(){w("208")},version:"16.2.0"},Aa=Object.freeze({default:za}),Z=Aa&&za||Aa;module.exports=Z["default"]?Z["default"]:Z;
+'use strict';var p=require("object-assign"),q=require("react");function aa(a,b,d,c,k,f,h,l){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var D=[d,c,k,f,h,l],z=0;a=Error(b.replace(/%s/g,function(){return D[z++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
+function r(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);aa(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}
+var x="function"===typeof Symbol&&Symbol.for,y=x?Symbol.for("react.portal"):60106,A=x?Symbol.for("react.fragment"):60107,B=x?Symbol.for("react.strict_mode"):60108,C=x?Symbol.for("react.profiler"):60114,E=x?Symbol.for("react.provider"):60109,F=x?Symbol.for("react.context"):60110,G=x?Symbol.for("react.async_mode"):60111,H=x?Symbol.for("react.forward_ref"):60112,ba=x?Symbol.for("react.placeholder"):60113;
+function I(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case G:return"AsyncMode";case A:return"Fragment";case y:return"Portal";case C:return"Profiler";case B:return"StrictMode";case ba:return"Placeholder"}if("object"===typeof a){switch(a.$$typeof){case F:return"Context.Consumer";case E:return"Context.Provider";case H:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef")}if("function"===
+typeof a.then&&(a=1===a._reactStatus?a._reactResult:null))return I(a)}return null}var ca=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,J=Object.prototype.hasOwnProperty,K={},L={};
+function M(a){if(J.call(L,a))return!0;if(J.call(K,a))return!1;if(ca.test(a))return L[a]=!0;K[a]=!0;return!1}function da(a,b,d,c){if(null!==d&&0===d.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(c)return!1;if(null!==d)return!d.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}}
+function ea(a,b,d,c){if(null===b||"undefined"===typeof b||da(a,b,d,c))return!0;if(c)return!1;if(null!==d)switch(d.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function N(a,b,d,c,k){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=k;this.mustUseProperty=d;this.propertyName=a;this.type=b}var O={};
+"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){O[a]=new N(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];O[b]=new N(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){O[a]=new N(a,2,!1,a.toLowerCase(),null)});
+["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){O[a]=new N(a,2,!1,a,null)});"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){O[a]=new N(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){O[a]=new N(a,3,!0,a,null)});
+["capture","download"].forEach(function(a){O[a]=new N(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){O[a]=new N(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){O[a]=new N(a,5,!1,a.toLowerCase(),null)});var P=/[\-:]([a-z])/g;function Q(a){return a[1].toUpperCase()}
+"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(P,
+Q);O[b]=new N(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(P,Q);O[b]=new N(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(P,Q);O[b]=new N(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});O.tabIndex=new N("tabIndex",1,!1,"tabindex",null);var fa=/["'&<>]/;
+function R(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=fa.exec(a);if(b){var d="",c,k=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b="&quot;";break;case 38:b="&amp;";break;case 39:b="&#x27;";break;case 60:b="&lt;";break;case 62:b="&gt;";break;default:continue}k!==c&&(d+=a.substring(k,c));k=c+1;d+=b}a=k!==c?d+a.substring(k,c):d}return a}var S={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
+function T(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
+var U={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},ha=p({menuitem:!0},U),V={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,
+gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ia=["Webkit","ms","Moz","O"];Object.keys(V).forEach(function(a){ia.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);V[b]=V[a]})});
+var ja=/([A-Z])/g,ka=/^ms-/,W=q.Children.toArray,la={listing:!0,pre:!0,textarea:!0},ma=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,X={},Y={};function na(a){if(void 0===a||null===a)return a;var b="";q.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}var Z={};function oa(a,b){if(a=a.contextTypes){var d={},c;for(c in a)d[c]=b[c];b=d}else b=Z;return b}var pa=Object.prototype.hasOwnProperty,qa={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};
+function ra(a,b){void 0===a&&r("152",I(b)||"Component")}
+function sa(a,b){function d(c,k){var d=oa(k,b),f=[],h=!1,g={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===f)return null},enqueueReplaceState:function(a,b){h=!0;f=[b]},enqueueSetState:function(a,b){if(null===f)return null;f.push(b)}},e=void 0;if(k.prototype&&k.prototype.isReactComponent){if(e=new k(c.props,d,g),"function"===typeof k.getDerivedStateFromProps){var v=k.getDerivedStateFromProps.call(null,c.props,e.state);null!=v&&(e.state=p({},e.state,v))}}else if(e=k(c.props,
+d,g),null==e||null==e.render){a=e;ra(a,k);return}e.props=c.props;e.context=d;e.updater=g;g=e.state;void 0===g&&(e.state=g=null);if("function"===typeof e.UNSAFE_componentWillMount||"function"===typeof e.componentWillMount)if("function"===typeof e.componentWillMount&&"function"!==typeof k.getDerivedStateFromProps&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&"function"!==typeof k.getDerivedStateFromProps&&e.UNSAFE_componentWillMount(),f.length){g=f;var t=h;f=null;h=!1;if(t&&
+1===g.length)e.state=g[0];else{v=t?g[0]:e.state;var m=!0;for(t=t?1:0;t<g.length;t++){var n=g[t];n="function"===typeof n?n.call(e,v,c.props,d):n;null!=n&&(m?(m=!1,v=p({},v,n)):p(v,n))}e.state=v}}else f=null;a=e.render();ra(a,k);c=void 0;if("function"===typeof e.getChildContext&&(d=k.childContextTypes,"object"===typeof d)){c=e.getChildContext();for(var w in c)w in d?void 0:r("108",I(k)||"Unknown",w)}c&&(b=p({},b,c))}for(;q.isValidElement(a);){var c=a,k=c.type;if("function"!==typeof k)break;d(c,k)}return{child:a,
+context:b}}
+var ta=function(){function a(b,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");q.isValidElement(b)?b.type!==A?b=[b]:(b=b.props.children,b=q.isValidElement(b)?[b]:W(b)):b=W(b);this.stack=[{type:null,domNamespace:S.html,children:b,childIndex:0,context:Z,footer:""}];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=d;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[]}a.prototype.pushProvider=function(a){var b=
+++this.contextIndex,c=a.type._context,k=c._currentValue;this.contextStack[b]=c;this.contextValueStack[b]=k;c._currentValue=a.props.value};a.prototype.popProvider=function(){var a=this.contextIndex,d=this.contextStack[a],c=this.contextValueStack[a];this.contextStack[a]=null;this.contextValueStack[a]=null;this.contextIndex--;d._currentValue=c};a.prototype.read=function(a){if(this.exhausted)return null;for(var b="";b.length<a;){if(0===this.stack.length){this.exhausted=!0;break}var c=this.stack[this.stack.length-
+1];if(c.childIndex>=c.children.length){var k=c.footer;b+=k;""!==k&&(this.previousWasTextNode=!1);this.stack.pop();"select"===c.type?this.currentSelectValue=null:null!=c.type&&null!=c.type.type&&c.type.type.$$typeof===E&&this.popProvider(c.type)}else k=c.children[c.childIndex++],b+=this.render(k,c.context,c.domNamespace)}return b};a.prototype.render=function(a,d,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return R(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+
+R(c);this.previousWasTextNode=!0;return R(c)}d=sa(a,d);a=d.child;d=d.context;if(null===a||!1===a)return"";if(!q.isValidElement(a)){if(null!=a&&null!=a.$$typeof){var b=a.$$typeof;b===y?r("257"):void 0;r("258",b.toString())}a=W(a);this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""});return""}b=a.type;if("string"===typeof b)return this.renderDOM(a,d,c);switch(b){case B:case G:case C:case A:return a=W(a.props.children),this.stack.push({type:null,domNamespace:c,children:a,
+childIndex:0,context:d,footer:""}),""}if("object"===typeof b&&null!==b)switch(b.$$typeof){case H:return a=W(b.render(a.props,a.ref)),this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case E:return b=W(a.props.children),c={type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""},this.pushProvider(a),this.stack.push(c),"";case F:return b=W(a.props.children(a.type._currentValue)),this.stack.push({type:a,domNamespace:c,children:b,childIndex:0,context:d,
+footer:""}),""}r("130",null==b?b:typeof b,"")};a.prototype.renderDOM=function(a,d,c){var b=a.type.toLowerCase();c===S.html&&T(b);X.hasOwnProperty(b)||(ma.test(b)?void 0:r("65",b),X[b]=!0);var f=a.props;if("input"===b)f=p({type:void 0},f,{defaultChecked:void 0,defaultValue:void 0,value:null!=f.value?f.value:f.defaultValue,checked:null!=f.checked?f.checked:f.defaultChecked});else if("textarea"===b){var h=f.value;if(null==h){h=f.defaultValue;var l=f.children;null!=l&&(null!=h?r("92"):void 0,Array.isArray(l)&&
+(1>=l.length?void 0:r("93"),l=l[0]),h=""+l);null==h&&(h="")}f=p({},f,{value:void 0,children:""+h})}else if("select"===b)this.currentSelectValue=null!=f.value?f.value:f.defaultValue,f=p({},f,{value:void 0});else if("option"===b){l=this.currentSelectValue;var D=na(f.children);if(null!=l){var z=null!=f.value?f.value+"":D;h=!1;if(Array.isArray(l))for(var g=0;g<l.length;g++){if(""+l[g]===z){h=!0;break}}else h=""+l===z;f=p({selected:void 0,children:void 0},f,{selected:h,children:D})}}if(h=f)ha[b]&&(null!=
+h.children||null!=h.dangerouslySetInnerHTML?r("137",b,""):void 0),null!=h.dangerouslySetInnerHTML&&(null!=h.children?r("60"):void 0,"object"===typeof h.dangerouslySetInnerHTML&&"__html"in h.dangerouslySetInnerHTML?void 0:r("61")),null!=h.style&&"object"!==typeof h.style?r("62",""):void 0;h=f;l=this.makeStaticMarkup;D=1===this.stack.length;z="<"+a.type;for(u in h)if(pa.call(h,u)){var e=h[u];if(null!=e){if("style"===u){g=void 0;var v="",t="";for(g in e)if(e.hasOwnProperty(g)){var m=0===g.indexOf("--"),
+n=e[g];if(null!=n){var w=g;if(Y.hasOwnProperty(w))w=Y[w];else{var xa=w.replace(ja,"-$1").toLowerCase().replace(ka,"-ms-");w=Y[w]=xa}v+=t+w+":";t=g;m=null==n||"boolean"===typeof n||""===n?"":m||"number"!==typeof n||0===n||V.hasOwnProperty(t)&&V[t]?(""+n).trim():n+"px";v+=m;t=";"}}e=v||null}g=null;b:if(m=b,n=h,-1===m.indexOf("-"))m="string"===typeof n.is;else switch(m){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":m=
+!1;break b;default:m=!0}if(m)qa.hasOwnProperty(u)||(g=u,g=M(g)&&null!=e?g+"="+('"'+R(e)+'"'):"");else{m=u;g=e;e=O.hasOwnProperty(m)?O[m]:null;if(n="style"!==m)n=null!==e?0===e.type:!(2<m.length)||"o"!==m[0]&&"O"!==m[0]||"n"!==m[1]&&"N"!==m[1]?!1:!0;n||ea(m,g,e,!1)?g="":null!==e?(m=e.attributeName,e=e.type,g=3===e||4===e&&!0===g?m+'=""':m+"="+('"'+R(g)+'"')):g=M(m)?m+"="+('"'+R(g)+'"'):""}g&&(z+=" "+g)}}l||D&&(z+=' data-reactroot=""');var u=z;h="";U.hasOwnProperty(b)?u+="/>":(u+=">",h="</"+a.type+
+">");a:{l=f.dangerouslySetInnerHTML;if(null!=l){if(null!=l.__html){l=l.__html;break a}}else if(l=f.children,"string"===typeof l||"number"===typeof l){l=R(l);break a}l=null}null!=l?(f=[],la[b]&&"\n"===l.charAt(0)&&(u+="\n"),u+=l):f=W(f.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?T(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,type:b,children:f,childIndex:0,context:d,footer:h});this.previousWasTextNode=
+!1;return u};return a}(),ua={renderToString:function(a){return(new ta(a,!1)).read(Infinity)},renderToStaticMarkup:function(a){return(new ta(a,!0)).read(Infinity)},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")},version:"16.5.2"},va={default:ua},wa=va&&ua||va;module.exports=wa.default||wa;
diff --git a/node_modules/react-dom/cjs/react-dom-server.node.development.js b/node_modules/react-dom/cjs/react-dom-server.node.development.js
index 2039700ca..350b78da9 100644
--- a/node_modules/react-dom/cjs/react-dom-server.node.development.js
+++ b/node_modules/react-dom/cjs/react-dom-server.node.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-server.node.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -15,412 +15,657 @@ if (process.env.NODE_ENV !== "production") {
(function() {
'use strict';
-var invariant = require('fbjs/lib/invariant');
var _assign = require('object-assign');
var React = require('react');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var emptyObject = require('fbjs/lib/emptyObject');
-var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
-var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
-var warning = require('fbjs/lib/warning');
var checkPropTypes = require('prop-types/checkPropTypes');
-var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
var stream = require('stream');
+// TODO: this is special because it gets imported during build.
+
+var ReactVersion = '16.5.2';
+
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
*/
-// These attributes should be all lowercase to allow for
-// case insensitive checks
-var RESERVED_PROPS = {
- children: true,
- dangerouslySetInnerHTML: true,
- defaultValue: true,
- defaultChecked: true,
- innerHTML: true,
- suppressContentEditableWarning: true,
- suppressHydrationWarning: true,
- style: true
-};
+var validateFormat = function () {};
-function checkMask(value, bitmask) {
- return (value & bitmask) === bitmask;
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
}
-var DOMPropertyInjection = {
- /**
- * Mapping from normalized, camelcased property names to a configuration that
- * specifies how the associated DOM property should be accessed or rendered.
- */
- MUST_USE_PROPERTY: 0x1,
- HAS_BOOLEAN_VALUE: 0x4,
- HAS_NUMERIC_VALUE: 0x8,
- HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
- HAS_STRING_BOOLEAN_VALUE: 0x40,
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
- /**
- * Inject some specialized knowledge about the DOM. This takes a config object
- * with the following properties:
- *
- * Properties: object mapping DOM property name to one of the
- * DOMPropertyInjection constants or null. If your attribute isn't in here,
- * it won't get written to the DOM.
- *
- * DOMAttributeNames: object mapping React attribute name to the DOM
- * attribute name. Attribute names not specified use the **lowercase**
- * normalized name.
- *
- * DOMAttributeNamespaces: object mapping React attribute name to the DOM
- * attribute namespace URL. (Attribute names not specified use no namespace.)
- *
- * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
- * Property names not specified use the normalized name.
- *
- * DOMMutationMethods: Properties that require special mutation methods. If
- * `value` is undefined, the mutation method should unset the property.
- *
- * @param {object} domPropertyConfig the config as described above.
- */
- injectDOMPropertyConfig: function (domPropertyConfig) {
- var Injection = DOMPropertyInjection;
- var Properties = domPropertyConfig.Properties || {};
- var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
- var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
- var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
-
- for (var propName in Properties) {
- !!properties.hasOwnProperty(propName) ? invariant(false, "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.", propName) : void 0;
-
- var lowerCased = propName.toLowerCase();
- var propConfig = Properties[propName];
-
- var propertyInfo = {
- attributeName: lowerCased,
- attributeNamespace: null,
- propertyName: propName,
- mutationMethod: null,
-
- mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
- hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
- hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
- hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
- hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
- hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE)
- };
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant(false, "DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s", propName) : void 0;
-
- if (DOMAttributeNames.hasOwnProperty(propName)) {
- var attributeName = DOMAttributeNames[propName];
-
- propertyInfo.attributeName = attributeName;
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
}
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
+}
+
+var warningWithoutStack$1 = warningWithoutStack;
- if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
- propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var hasSymbol = typeof Symbol === 'function' && Symbol.for;
+
+
+var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
+var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
+var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
+var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
+var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
+var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
+var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
+var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
+var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
+
+var Resolved = 1;
+
+
+
+
+function refineResolvedThenable(thenable) {
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
+}
+
+function getComponentName(type) {
+ if (type == null) {
+ // Host root, text node or just invalid type.
+ return null;
+ }
+ {
+ if (typeof type.tag === 'number') {
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
+ }
+ }
+ if (typeof type === 'function') {
+ return type.displayName || type.name || null;
+ }
+ if (typeof type === 'string') {
+ return type;
+ }
+ switch (type) {
+ case REACT_ASYNC_MODE_TYPE:
+ return 'AsyncMode';
+ case REACT_FRAGMENT_TYPE:
+ return 'Fragment';
+ case REACT_PORTAL_TYPE:
+ return 'Portal';
+ case REACT_PROFILER_TYPE:
+ return 'Profiler';
+ case REACT_STRICT_MODE_TYPE:
+ return 'StrictMode';
+ case REACT_PLACEHOLDER_TYPE:
+ return 'Placeholder';
+ }
+ if (typeof type === 'object') {
+ switch (type.$$typeof) {
+ case REACT_CONTEXT_TYPE:
+ return 'Context.Consumer';
+ case REACT_PROVIDER_TYPE:
+ return 'Context.Provider';
+ case REACT_FORWARD_REF_TYPE:
+ var renderFn = type.render;
+ var functionName = renderFn.displayName || renderFn.name || '';
+ return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
+ }
+ if (typeof type.then === 'function') {
+ var thenable = type;
+ var resolvedThenable = refineResolvedThenable(thenable);
+ if (resolvedThenable) {
+ return getComponentName(resolvedThenable);
}
+ }
+ }
+ return null;
+}
- if (DOMMutationMethods.hasOwnProperty(propName)) {
- propertyInfo.mutationMethod = DOMMutationMethods[propName];
+/**
+ * Forked from fbjs/warning:
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
+ *
+ * Only change is we use console.warn instead of console.error,
+ * and do nothing when 'console' is not supported.
+ * This really simplifies the code.
+ * ---
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var lowPriorityWarning = function () {};
+
+{
+ var printWarning = function (format) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.warn(message);
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ } catch (x) {}
+ };
+
+ lowPriorityWarning = function (condition, format) {
+ if (format === undefined) {
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (!condition) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
}
- // Downcase references to whitelist properties to check for membership
- // without case-sensitivity. This allows the whitelist to pick up
- // `allowfullscreen`, which should be written using the property configuration
- // for `allowFullscreen`
- properties[propName] = propertyInfo;
+ printWarning.apply(undefined, [format].concat(args));
+ }
+ };
+}
+
+var lowPriorityWarning$1 = lowPriorityWarning;
+
+var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warning = warningWithoutStack$1;
+
+{
+ warning = function (condition, format) {
+ if (condition) {
+ return;
+ }
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
+
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
+ };
+}
+
+var warning$1 = warning;
+
+var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
+
+var describeComponentFrame = function (name, source, ownerName) {
+ var sourceInfo = '';
+ if (source) {
+ var path = source.fileName;
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
+ {
+ // In DEV, include code for a common special case:
+ // prefer "folder/index.js" instead of just "index.js".
+ if (/^index\./.test(fileName)) {
+ var match = path.match(BEFORE_SLASH_RE);
+ if (match) {
+ var pathBeforeSlash = match[1];
+ if (pathBeforeSlash) {
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
+ fileName = folderName + '/' + fileName;
+ }
+ }
+ }
}
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
+ } else if (ownerName) {
+ sourceInfo = ' (created by ' + ownerName + ')';
}
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
};
+// Exports ReactDOM.createRoot
+
+
+// Experimental error-boundary API that can recover from errors within a single
+// render phase
+
+// Suspense
+
+// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
+
+
+// In some cases, StrictMode should also double-render lifecycles.
+// This can be confusing for tests though,
+// And it can be bad for performance in production.
+// This feature flag can be used to control the behavior:
+
+
+// To preserve the "Pause on caught exceptions" behavior of the debugger, we
+// replay the begin phase of a failed component inside invokeGuardedCallback.
+
+
+// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
+var warnAboutDeprecatedLifecycles = false;
+
+// Warn about legacy context API
+
+
+// Gather advanced timing metrics for Profiler subtrees.
+
+
+// Trace which interactions trigger each commit.
+
+
+// Only used in www builds.
+var enableSuspenseServerRenderer = false;
+
+// Only used in www builds.
+
+
+// React Fire: prevent the value and checked attributes from syncing
+// with their related DOM properties
+
+// A reserved attribute.
+// It is handled by React separately and shouldn't be written to the DOM.
+var RESERVED = 0;
+
+// A simple string attribute.
+// Attributes that aren't in the whitelist are presumed to have this type.
+var STRING = 1;
+
+// A string attribute that accepts booleans in React. In HTML, these are called
+// "enumerated" attributes with "true" and "false" as possible values.
+// When true, it should be set to a "true" string.
+// When false, it should be set to a "false" string.
+var BOOLEANISH_STRING = 2;
+
+// A real boolean attribute.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+var BOOLEAN = 3;
+
+// An attribute that can be used as a flag as well as with a value.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+// For any other value, should be present with that value.
+var OVERLOADED_BOOLEAN = 4;
+
+// An attribute that must be numeric or parse as a numeric.
+// When falsy, it should be removed.
+var NUMERIC = 5;
+
+// An attribute that must be positive numeric or parse as a positive numeric.
+// When falsy, it should be removed.
+var POSITIVE_NUMERIC = 6;
+
/* eslint-disable max-len */
-var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
+var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
/* eslint-enable max-len */
-var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
+var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-/**
- * Map from property "standard name" to an object with info about how to set
- * the property in the DOM. Each object contains:
- *
- * attributeName:
- * Used when rendering markup or with `*Attribute()`.
- * attributeNamespace
- * propertyName:
- * Used on DOM node instances. (This includes properties that mutate due to
- * external factors.)
- * mutationMethod:
- * If non-null, used instead of the property or `setAttribute()` after
- * initial render.
- * mustUseProperty:
- * Whether the property must be accessed and mutated as an object property.
- * hasBooleanValue:
- * Whether the property should be removed when set to a falsey value.
- * hasNumericValue:
- * Whether the property must be numeric or parse as a numeric and should be
- * removed when set to a falsey value.
- * hasPositiveNumericValue:
- * Whether the property must be positive numeric or parse as a positive
- * numeric and should be removed when set to a falsey value.
- * hasOverloadedBooleanValue:
- * Whether the property can be used as a flag as well as with a value.
- * Removed when strictly equal to false; present without a value when
- * strictly equal to true; present with a value otherwise.
- */
-var properties = {};
+var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
-/**
- * Checks whether a property name is a writeable attribute.
- * @method
- */
-function shouldSetAttribute(name, value) {
- if (isReservedProp(name)) {
+function isAttributeNameSafe(attributeName) {
+ if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
+ return true;
+ }
+ if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
return false;
}
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ {
+ warning$1(false, 'Invalid attribute name: `%s`', attributeName);
+ }
+ return false;
+}
+
+function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null) {
+ return propertyInfo.type === RESERVED;
+ }
+ if (isCustomComponentTag) {
return false;
}
- if (value === null) {
+ if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
return true;
}
+ return false;
+}
+
+function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null && propertyInfo.type === RESERVED) {
+ return false;
+ }
switch (typeof value) {
- case 'boolean':
- return shouldAttributeAcceptBooleanValue(name);
- case 'undefined':
- case 'number':
- case 'string':
- case 'object':
+ case 'function':
+ // $FlowIssue symbol is perfectly valid here
+ case 'symbol':
+ // eslint-disable-line
return true;
+ case 'boolean':
+ {
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ return !propertyInfo.acceptsBooleans;
+ } else {
+ var prefix = name.toLowerCase().slice(0, 5);
+ return prefix !== 'data-' && prefix !== 'aria-';
+ }
+ }
default:
- // function, symbol
return false;
}
}
-function getPropertyInfo(name) {
- return properties.hasOwnProperty(name) ? properties[name] : null;
-}
-
-function shouldAttributeAcceptBooleanValue(name) {
- if (isReservedProp(name)) {
+function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
+ if (value === null || typeof value === 'undefined') {
return true;
}
- var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
+ return true;
+ }
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ switch (propertyInfo.type) {
+ case BOOLEAN:
+ return !value;
+ case OVERLOADED_BOOLEAN:
+ return value === false;
+ case NUMERIC:
+ return isNaN(value);
+ case POSITIVE_NUMERIC:
+ return isNaN(value) || value < 1;
+ }
}
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix === 'data-' || prefix === 'aria-';
+ return false;
}
-/**
- * Checks to see if a property name is within the list of properties
- * reserved for internal React operations. These properties should
- * not be set on an HTML element.
- *
- * @private
- * @param {string} name
- * @return {boolean} If the name is within reserved props
- */
-function isReservedProp(name) {
- return RESERVED_PROPS.hasOwnProperty(name);
+function getPropertyInfo(name) {
+ return properties.hasOwnProperty(name) ? properties[name] : null;
}
-var injection = DOMPropertyInjection;
-
-var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY;
-var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE;
-var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE;
-var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE;
-
-var HTMLDOMPropertyConfig = {
- // When adding attributes to this list, be sure to also add them to
- // the `possibleStandardNames` module to ensure casing and incorrect
- // name warnings.
- Properties: {
- allowFullScreen: HAS_BOOLEAN_VALUE,
- // specifies target context for links with `preload` type
- async: HAS_BOOLEAN_VALUE,
- // Note: there is a special case that prevents it from being written to the DOM
- // on the client side because the browsers are inconsistent. Instead we call focus().
- autoFocus: HAS_BOOLEAN_VALUE,
- autoPlay: HAS_BOOLEAN_VALUE,
- capture: HAS_OVERLOADED_BOOLEAN_VALUE,
- checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- cols: HAS_POSITIVE_NUMERIC_VALUE,
- contentEditable: HAS_STRING_BOOLEAN_VALUE,
- controls: HAS_BOOLEAN_VALUE,
- 'default': HAS_BOOLEAN_VALUE,
- defer: HAS_BOOLEAN_VALUE,
- disabled: HAS_BOOLEAN_VALUE,
- download: HAS_OVERLOADED_BOOLEAN_VALUE,
- draggable: HAS_STRING_BOOLEAN_VALUE,
- formNoValidate: HAS_BOOLEAN_VALUE,
- hidden: HAS_BOOLEAN_VALUE,
- loop: HAS_BOOLEAN_VALUE,
- // Caution; `option.selected` is not updated if `select.multiple` is
- // disabled with `removeAttribute`.
- multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- noValidate: HAS_BOOLEAN_VALUE,
- open: HAS_BOOLEAN_VALUE,
- playsInline: HAS_BOOLEAN_VALUE,
- readOnly: HAS_BOOLEAN_VALUE,
- required: HAS_BOOLEAN_VALUE,
- reversed: HAS_BOOLEAN_VALUE,
- rows: HAS_POSITIVE_NUMERIC_VALUE,
- rowSpan: HAS_NUMERIC_VALUE,
- scoped: HAS_BOOLEAN_VALUE,
- seamless: HAS_BOOLEAN_VALUE,
- selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- size: HAS_POSITIVE_NUMERIC_VALUE,
- start: HAS_NUMERIC_VALUE,
- // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
- span: HAS_POSITIVE_NUMERIC_VALUE,
- spellCheck: HAS_STRING_BOOLEAN_VALUE,
- // Style must be explicitly set in the attribute list. React components
- // expect a style object
- style: 0,
- // Keep it in the whitelist because it is case-sensitive for SVG.
- tabIndex: 0,
- // itemScope is for for Microdata support.
- // See http://schema.org/docs/gs.html
- itemScope: HAS_BOOLEAN_VALUE,
- // These attributes must stay in the white-list because they have
- // different attribute names (see DOMAttributeNames below)
- acceptCharset: 0,
- className: 0,
- htmlFor: 0,
- httpEquiv: 0,
- // Attributes with mutation methods must be specified in the whitelist
- // Set the string boolean flag to allow the behavior
- value: HAS_STRING_BOOLEAN_VALUE
- },
- DOMAttributeNames: {
- acceptCharset: 'accept-charset',
- className: 'class',
- htmlFor: 'for',
- httpEquiv: 'http-equiv'
- },
- DOMMutationMethods: {
- value: function (node, value) {
- if (value == null) {
- return node.removeAttribute('value');
- }
-
- // Number inputs get special treatment due to some edge cases in
- // Chrome. Let everything else assign the value attribute as normal.
- // https://github.com/facebook/react/issues/7253#issuecomment-236074326
- if (node.type !== 'number' || node.hasAttribute('value') === false) {
- node.setAttribute('value', '' + value);
- } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
- // Don't assign an attribute if validation reports bad
- // input. Chrome will clear the value. Additionally, don't
- // operate on inputs that have focus, otherwise Chrome might
- // strip off trailing decimal places and cause the user's
- // cursor position to jump to the beginning of the input.
- //
- // In ReactDOMInput, we have an onBlur event that will trigger
- // this function again when focus is lost.
- node.setAttribute('value', '' + value);
- }
- }
- }
-};
-
-var HAS_STRING_BOOLEAN_VALUE$1 = injection.HAS_STRING_BOOLEAN_VALUE;
+function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
+ this.attributeName = attributeName;
+ this.attributeNamespace = attributeNamespace;
+ this.mustUseProperty = mustUseProperty;
+ this.propertyName = name;
+ this.type = type;
+}
+// When adding attributes to this list, be sure to also add them to
+// the `possibleStandardNames` module to ensure casing and incorrect
+// name warnings.
+var properties = {};
-var NS = {
- xlink: 'http://www.w3.org/1999/xlink',
- xml: 'http://www.w3.org/XML/1998/namespace'
-};
-
-/**
- * This is a list of all SVG attributes that need special casing,
- * namespacing, or boolean value assignment.
- *
- * When adding attributes to this list, be sure to also add them to
- * the `possibleStandardNames` module to ensure casing and incorrect
- * name warnings.
- *
- * SVG Attributes List:
- * https://www.w3.org/TR/SVG/attindex.html
- * SMIL Spec:
- * https://www.w3.org/TR/smil
- */
-var ATTRS = ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space'];
-
-var SVGDOMPropertyConfig = {
- Properties: {
- autoReverse: HAS_STRING_BOOLEAN_VALUE$1,
- externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1,
- preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1
- },
- DOMAttributeNames: {
- autoReverse: 'autoReverse',
- externalResourcesRequired: 'externalResourcesRequired',
- preserveAlpha: 'preserveAlpha'
- },
- DOMAttributeNamespaces: {
- xlinkActuate: NS.xlink,
- xlinkArcrole: NS.xlink,
- xlinkHref: NS.xlink,
- xlinkRole: NS.xlink,
- xlinkShow: NS.xlink,
- xlinkTitle: NS.xlink,
- xlinkType: NS.xlink,
- xmlBase: NS.xml,
- xmlLang: NS.xml,
- xmlSpace: NS.xml
- }
-};
+// These props are reserved by React. They shouldn't be written to the DOM.
+['children', 'dangerouslySetInnerHTML',
+// TODO: This prevents the assignment of defaultValue to regular
+// elements (not just inputs). Now that ReactDOMInput assigns to the
+// defaultValue property -- do we need this?
+'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// A few React string attributes have a different name.
+// This is a mapping from React prop names to the attribute names.
+[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
+ var name = _ref[0],
+ attributeName = _ref[1];
+
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" HTML attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" SVG attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+// Since these are SVG attributes, their attribute names are case-sensitive.
+['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML boolean attributes.
+['allowFullScreen', 'async',
+// Note: there is a special case that prevents it from being written to the DOM
+// on the client side because the browsers are inconsistent. Instead we call focus().
+'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
+// Microdata
+'itemScope'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are the few React props that we set as DOM properties
+// rather than attributes. These are all booleans.
+['checked',
+// Note: `option.selected` is not updated if `select.multiple` is
+// disabled with `removeAttribute`. We have special logic for handling this.
+'multiple', 'muted', 'selected'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that are "overloaded booleans": they behave like
+// booleans, but can also accept a string value.
+['capture', 'download'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be positive numbers.
+['cols', 'rows', 'size', 'span'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be numbers.
+['rowSpan', 'start'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
var CAMELIZE = /[\-\:]([a-z])/g;
var capitalize = function (token) {
return token[1].toUpperCase();
};
-ATTRS.forEach(function (original) {
- var reactName = original.replace(CAMELIZE, capitalize);
-
- SVGDOMPropertyConfig.Properties[reactName] = 0;
- SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original;
+// This is a list of all SVG attributes that need special casing, namespacing,
+// or boolean value assignment. Regular attributes that just accept strings
+// and have the same names are omitted, just like in the HTML whitelist.
+// Some of these attributes can be hard to find. This list was created by
+// scrapping the MDN documentation.
+['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, null);
+} // attributeNamespace
+);
+
+// String SVG attributes with the xlink namespace.
+['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/1999/xlink');
});
-injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
-injection.injectDOMPropertyConfig(SVGDOMPropertyConfig);
-
-// TODO: this is special because it gets imported during build.
-
-var ReactVersion = '16.2.0';
-
-var describeComponentFrame = function (name, source, ownerName) {
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
-};
-
-var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-
-var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
-var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
-
-
-
-
+// String SVG attributes with the xml namespace.
+['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/XML/1998/namespace');
+});
-var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
+// Special case: this attribute exists both in HTML and SVG.
+// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use
+// its React `tabIndex` name, like we do for attributes that exist only in HTML.
+properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty
+'tabindex', // attributeName
+null);
// code copied and modified from escape-html
/**
@@ -446,7 +691,7 @@ function escapeHtml(string) {
return str;
}
- var escape;
+ var escape = void 0;
var html = '';
var index = 0;
var lastIndex = 0;
@@ -515,35 +760,6 @@ function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextForBrowser(value) + '"';
}
-// isAttributeNameSafe() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
- return true;
- }
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
- return false;
- }
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
- }
- illegalAttributeNameCache[attributeName] = true;
- {
- warning(false, 'Invalid attribute name: `%s`', attributeName);
- }
- return false;
-}
-
-// shouldIgnoreValue() is currently duplicated in DOMPropertyOperations.
-// TODO: Find a better place for this.
-function shouldIgnoreValue(propertyInfo, value) {
- return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
-}
-
/**
* Operations for dealing with DOM properties.
*/
@@ -569,23 +785,25 @@ function createMarkupForRoot() {
*/
function createMarkupForProperty(name, value) {
var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- if (shouldIgnoreValue(propertyInfo, value)) {
- return '';
- }
+ if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
+ return '';
+ }
+ if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
+ return '';
+ }
+ if (propertyInfo !== null) {
var attributeName = propertyInfo.attributeName;
- if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ var type = propertyInfo.type;
+
+ if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
return attributeName + '=""';
- } else if (typeof value !== 'boolean' || shouldAttributeAcceptBooleanValue(name)) {
+ } else {
return attributeName + '=' + quoteAttributeValueForBrowser(value);
}
- } else if (shouldSetAttribute(name, value)) {
- if (value == null) {
- return '';
- }
+ } else if (isAttributeNameSafe(name)) {
return name + '=' + quoteAttributeValueForBrowser(value);
}
- return null;
+ return '';
}
/**
@@ -637,11 +855,15 @@ function getChildNamespace(parentNamespace, type) {
return parentNamespace;
}
+var ReactDebugCurrentFrame$1 = null;
+
var ReactControlledValuePropTypes = {
checkPropTypes: null
};
{
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
+
var hasReadOnlyValue = {
button: true,
checkbox: true,
@@ -654,13 +876,13 @@ var ReactControlledValuePropTypes = {
var propTypes = {
value: function (props, propName, componentName) {
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
@@ -671,8 +893,8 @@ var ReactControlledValuePropTypes = {
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
- checkPropTypes(propTypes, props, 'prop', tagName, getStack);
+ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
};
}
@@ -695,6 +917,7 @@ var omittedCloseTags = {
source: true,
track: true,
wbr: true
+ // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
// For HTML, certain tags cannot have children. This has the same purpose as
@@ -704,24 +927,31 @@ var voidElementTags = _assign({
menuitem: true
}, omittedCloseTags);
+// TODO: We can remove this if we add invariantWithStack()
+// or add stack by default to invariants where possible.
var HTML = '__html';
-function assertValidProps(tag, props, getStack) {
+var ReactDebugCurrentFrame$2 = null;
+{
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
+}
+
+function assertValidProps(tag, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (voidElementTags[tag]) {
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
}
{
- warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack());
+ !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
}
- !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
+ !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
}
/**
@@ -743,6 +973,7 @@ var isUnitlessNumber = {
flexShrink: true,
flexNegative: true,
flexOrder: true,
+ gridArea: true,
gridRow: true,
gridRowEnd: true,
gridRowSpan: true,
@@ -829,6 +1060,26 @@ function dangerousStyleValue(name, value, isCustomProperty) {
return ('' + value).trim();
}
+var uppercasePattern = /([A-Z])/g;
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ */
+function hyphenateStyleName(name) {
+ return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
+}
+
function isCustomComponent(tagName, props) {
if (tagName.indexOf('-') === -1) {
return typeof props.is === 'string';
@@ -852,11 +1103,13 @@ function isCustomComponent(tagName, props) {
}
}
-var warnValidStyle = emptyFunction;
+var warnValidStyle = function () {};
{
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
+ var msPattern$1 = /^-ms-/;
+ var hyphenPattern = /-(.)/g;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
@@ -866,65 +1119,75 @@ var warnValidStyle = emptyFunction;
var warnedForNaNValue = false;
var warnedForInfinityValue = false;
- var warnHyphenatedStyleName = function (name, getStack) {
+ var camelize = function (string) {
+ return string.replace(hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
+ };
+
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
+ warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
+ // As Andi Smith suggests
+ // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ // is converted to lowercase `ms`.
+ camelize(name.replace(msPattern$1, 'ms-')));
};
- var warnBadVendoredStyleName = function (name, getStack) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
+ warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
};
- var warnStyleValueWithSemicolon = function (name, value, getStack) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
+ warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
};
- var warnStyleValueIsNaN = function (name, value, getStack) {
+ var warnStyleValueIsNaN = function (name, value) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
- warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
+ warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
};
- var warnStyleValueIsInfinity = function (name, value, getStack) {
+ var warnStyleValueIsInfinity = function (name, value) {
if (warnedForInfinityValue) {
return;
}
warnedForInfinityValue = true;
- warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
+ warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
};
- warnValidStyle = function (name, value, getStack) {
+ warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name, getStack);
+ warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name, getStack);
+ warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value, getStack);
+ warnStyleValueWithSemicolon(name, value);
}
if (typeof value === 'number') {
if (isNaN(value)) {
- warnStyleValueIsNaN(name, value, getStack);
+ warnStyleValueIsNaN(name, value);
} else if (!isFinite(value)) {
- warnStyleValueIsInfinity(name, value, getStack);
+ warnStyleValueIsInfinity(name, value);
}
}
};
@@ -991,15 +1254,10 @@ var warnedProperties = {};
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-function getStackAddendum$1() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
+var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function validateProperty(tagName, name) {
- if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
+ if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
@@ -1010,13 +1268,13 @@ function validateProperty(tagName, name) {
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (correctName == null) {
- warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1());
+ warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
warnedProperties[name] = true;
return true;
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== correctName) {
- warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1());
+ warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
warnedProperties[name] = true;
return true;
}
@@ -1034,7 +1292,7 @@ function validateProperty(tagName, name) {
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== standardName) {
- warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1());
+ warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
warnedProperties[name] = true;
return true;
}
@@ -1058,9 +1316,9 @@ function warnInvalidARIAProps(type, props) {
}).join(', ');
if (invalidProps.length === 1) {
- warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
+ warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
} else if (invalidProps.length > 1) {
- warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
+ warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
}
}
@@ -1073,11 +1331,6 @@ function validateProperties(type, props) {
var didWarnValueNull = false;
-function getStackAddendum$2() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
-
function validateProperties$1(type, props) {
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
return;
@@ -1086,9 +1339,9 @@ function validateProperties$1(type, props) {
if (props != null && props.value === null && !didWarnValueNull) {
didWarnValueNull = true;
if (type === 'select' && props.multiple) {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$2());
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
} else {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2());
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
}
}
}
@@ -1178,7 +1431,7 @@ var possibleStandardNames = {
checked: 'checked',
children: 'children',
cite: 'cite',
- 'class': 'className',
+ class: 'className',
classid: 'classID',
classname: 'className',
cols: 'cols',
@@ -1193,7 +1446,7 @@ var possibleStandardNames = {
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
data: 'data',
datetime: 'dateTime',
- 'default': 'default',
+ default: 'default',
defaultchecked: 'defaultChecked',
defaultvalue: 'defaultValue',
defer: 'defer',
@@ -1202,7 +1455,7 @@ var possibleStandardNames = {
download: 'download',
draggable: 'draggable',
enctype: 'encType',
- 'for': 'htmlFor',
+ for: 'htmlFor',
form: 'form',
formmethod: 'formMethod',
formaction: 'formAction',
@@ -1251,6 +1504,7 @@ var possibleStandardNames = {
multiple: 'multiple',
muted: 'muted',
name: 'name',
+ nomodule: 'noModule',
nonce: 'nonce',
novalidate: 'noValidate',
open: 'open',
@@ -1419,7 +1673,7 @@ var possibleStandardNames = {
imagerendering: 'imageRendering',
'image-rendering': 'imageRendering',
in2: 'in2',
- 'in': 'in',
+ in: 'in',
inlist: 'inlist',
intercept: 'intercept',
k1: 'k1',
@@ -1559,7 +1813,7 @@ var possibleStandardNames = {
'text-rendering': 'textRendering',
to: 'to',
transform: 'transform',
- 'typeof': 'typeof',
+ typeof: 'typeof',
u1: 'u1',
u2: 'u2',
underlineposition: 'underlinePosition',
@@ -1638,27 +1892,24 @@ var possibleStandardNames = {
zoomandpan: 'zoomAndPan'
};
-function getStackAddendum$3() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
+var validateProperty$1 = function () {};
{
var warnedProperties$1 = {};
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
var EVENT_NAME_REGEX = /^on./;
var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
- var validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
- if (hasOwnProperty$1.call(warnedProperties$1, name) && warnedProperties$1[name]) {
+ validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
+ if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
return true;
}
var lowerCasedName = name.toLowerCase();
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
- warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
+ warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
warnedProperties$1[name] = true;
return true;
}
@@ -1670,12 +1921,12 @@ function getStackAddendum$3() {
}
var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
if (registrationName != null) {
- warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3());
+ warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
warnedProperties$1[name] = true;
return true;
}
if (EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3());
+ warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
warnedProperties$1[name] = true;
return true;
}
@@ -1684,7 +1935,7 @@ function getStackAddendum$3() {
// So we can't tell if the event name is correct for sure, but we can filter
// out known bad ones like `onclick`. We can't suggest a specific replacement though.
if (INVALID_EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$3());
+ warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
}
warnedProperties$1[name] = true;
return true;
@@ -1696,52 +1947,53 @@ function getStackAddendum$3() {
}
if (lowerCasedName === 'innerhtml') {
- warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
+ warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'aria') {
- warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
+ warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
warnedProperties$1[name] = true;
return true;
}
if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
- warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3());
+ warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
warnedProperties$1[name] = true;
return true;
}
if (typeof value === 'number' && isNaN(value)) {
- warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3());
+ warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
warnedProperties$1[name] = true;
return true;
}
- var isReserved = isReservedProp(name);
+ var propertyInfo = getPropertyInfo(name);
+ var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
// Known attributes should match the casing specified in the property config.
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
var standardName = possibleStandardNames[lowerCasedName];
if (standardName !== name) {
- warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3());
+ warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
warnedProperties$1[name] = true;
return true;
}
} else if (!isReserved && name !== lowerCasedName) {
// Unknown attributes should have lowercase casing since that's how they
// will be cased anyway with server rendering.
- warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3());
+ warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
warnedProperties$1[name] = true;
return true;
}
- if (typeof value === 'boolean' && !shouldAttributeAcceptBooleanValue(name)) {
+ if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
if (value) {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$3());
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
} else {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$3());
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
}
warnedProperties$1[name] = true;
return true;
@@ -1754,11 +2006,18 @@ function getStackAddendum$3() {
}
// Warn when a known attribute is a bad type
- if (!shouldSetAttribute(name, value)) {
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
warnedProperties$1[name] = true;
return false;
}
+ // Warn when passing the strings 'false' or 'true' into a boolean prop
+ if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
+ warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
return true;
};
}
@@ -1776,9 +2035,9 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
return '`' + prop + '`';
}).join(', ');
if (unknownProps.length === 1) {
- warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
+ warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
} else if (unknownProps.length > 1) {
- warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
+ warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
}
};
@@ -1795,16 +2054,36 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var toArray = React.Children.toArray;
-var getStackAddendum = emptyFunction.thatReturns('');
+// This is only used in DEV.
+// Each entry is `this.stack` from a currently executing renderer instance.
+// (There may be more than one because ReactDOMServer is reentrant).
+// Each stack is an array of frames which may contain nested stacks of elements.
+var currentDebugStacks = [];
+
+var ReactDebugCurrentFrame = void 0;
+var prevGetCurrentStackImpl = null;
+var getCurrentServerStackImpl = function () {
+ return '';
+};
+var describeStackFrame = function (element) {
+ return '';
+};
+
+var validatePropertiesInDevelopment = function (type, props) {};
+var pushCurrentDebugStack = function (stack) {};
+var pushElementToDebugStack = function (element) {};
+var popCurrentDebugStack = function () {};
{
- var validatePropertiesInDevelopment = function (type, props) {
+ ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+
+ validatePropertiesInDevelopment = function (type, props) {
validateProperties(type, props);
validateProperties$1(type, props);
validateProperties$2(type, props, /* canUseEventSystem */false);
};
- var describeStackFrame = function (element) {
+ describeStackFrame = function (element) {
var source = element._source;
var type = element.type;
var name = getComponentName(type);
@@ -1812,34 +2091,55 @@ var getStackAddendum = emptyFunction.thatReturns('');
return describeComponentFrame(name, source, ownerName);
};
- var currentDebugStack = null;
- var currentDebugElementStack = null;
- var setCurrentDebugStack = function (stack) {
+ pushCurrentDebugStack = function (stack) {
+ currentDebugStacks.push(stack);
+
+ if (currentDebugStacks.length === 1) {
+ // We are entering a server renderer.
+ // Remember the previous (e.g. client) global stack implementation.
+ prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
+ ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
+ }
+ };
+
+ pushElementToDebugStack = function (element) {
+ // For the innermost executing ReactDOMServer call,
+ var stack = currentDebugStacks[currentDebugStacks.length - 1];
+ // Take the innermost executing frame (e.g. <Foo>),
var frame = stack[stack.length - 1];
- currentDebugElementStack = frame.debugElementStack;
- // We are about to enter a new composite stack, reset the array.
- currentDebugElementStack.length = 0;
- currentDebugStack = stack;
- ReactDebugCurrentFrame.getCurrentStack = getStackAddendum;
+ // and record that it has one more element associated with it.
+ frame.debugElementStack.push(element);
+ // We only need this because we tail-optimize single-element
+ // children and directly handle them in an inner loop instead of
+ // creating separate frames for them.
};
- var pushElementToDebugStack = function (element) {
- if (currentDebugElementStack !== null) {
- currentDebugElementStack.push(element);
+
+ popCurrentDebugStack = function () {
+ currentDebugStacks.pop();
+
+ if (currentDebugStacks.length === 0) {
+ // We are exiting the server renderer.
+ // Restore the previous (e.g. client) global stack implementation.
+ ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
+ prevGetCurrentStackImpl = null;
}
};
- var resetCurrentDebugStack = function () {
- currentDebugElementStack = null;
- currentDebugStack = null;
- ReactDebugCurrentFrame.getCurrentStack = null;
- };
- getStackAddendum = function () {
- if (currentDebugStack === null) {
+
+ getCurrentServerStackImpl = function () {
+ if (currentDebugStacks.length === 0) {
+ // Nothing is currently rendering.
return '';
}
+ // ReactDOMServer is reentrant so there may be multiple calls at the same time.
+ // Take the frames from the innermost call which is the last in the array.
+ var frames = currentDebugStacks[currentDebugStacks.length - 1];
var stack = '';
- var debugStack = currentDebugStack;
- for (var i = debugStack.length - 1; i >= 0; i--) {
- var frame = debugStack[i];
+ // Go through every frame in the stack from the innermost one.
+ for (var i = frames.length - 1; i >= 0; i--) {
+ var frame = frames[i];
+ // Every frame might have more than one debug element stack entry associated with it.
+ // This is because single-child nesting doesn't create materialized frames.
+ // Instead it would push them through `pushElementToDebugStack()`.
var _debugElementStack = frame.debugElementStack;
for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
stack += describeStackFrame(_debugElementStack[ii]);
@@ -1855,6 +2155,10 @@ var didWarnDefaultSelectValue = false;
var didWarnDefaultTextareaValue = false;
var didWarnInvalidOptionChildren = false;
var didWarnAboutNoopUpdateForComponent = {};
+var didWarnAboutBadClass = {};
+var didWarnAboutDeprecatedWillMount = {};
+var didWarnAboutUndefinedDerivedState = {};
+var didWarnAboutUninitializedState = {};
var valuePropNames = ['value', 'defaultValue'];
var newlineEatingTags = {
listing: true,
@@ -1862,10 +2166,6 @@ var newlineEatingTags = {
textarea: true
};
-function getComponentName(type) {
- return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
-}
-
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
@@ -1878,9 +2178,15 @@ function validateDangerousTag(tag) {
}
}
-var processStyleName = memoizeStringOnly(function (styleName) {
- return hyphenateStyleName(styleName);
-});
+var styleNameCache = {};
+var processStyleName = function (styleName) {
+ if (styleNameCache.hasOwnProperty(styleName)) {
+ return styleNameCache[styleName];
+ }
+ var result = hyphenateStyleName(styleName);
+ styleNameCache[styleName] = result;
+ return result;
+};
function createMarkupForStyles(styles) {
var serialized = '';
@@ -1893,7 +2199,7 @@ function createMarkupForStyles(styles) {
var styleValue = styles[styleName];
{
if (!isCustomProperty) {
- warnValidStyle$1(styleName, styleValue, getStackAddendum);
+ warnValidStyle$1(styleName, styleValue);
}
}
if (styleValue != null) {
@@ -1908,14 +2214,14 @@ function createMarkupForStyles(styles) {
function warnNoop(publicInstance, callerName) {
{
- var constructor = publicInstance.constructor;
- var componentName = constructor && getComponentName(constructor) || 'ReactClass';
+ var _constructor = publicInstance.constructor;
+ var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
var warningKey = componentName + '.' + callerName;
if (didWarnAboutNoopUpdateForComponent[warningKey]) {
return;
}
- warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
+ warningWithoutStack$1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
didWarnAboutNoopUpdateForComponent[warningKey] = true;
}
}
@@ -1956,6 +2262,9 @@ function flattenTopLevelChildren(children) {
}
function flattenOptionChildren(children) {
+ if (children === undefined || children === null) {
+ return children;
+ }
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
@@ -1963,20 +2272,22 @@ function flattenOptionChildren(children) {
if (child == null) {
return;
}
- if (typeof child === 'string' || typeof child === 'number') {
- content += child;
- } else {
- {
- if (!didWarnInvalidOptionChildren) {
- didWarnInvalidOptionChildren = true;
- warning(false, 'Only strings and numbers are supported as <option> children.');
- }
+ content += child;
+ {
+ if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
+ didWarnInvalidOptionChildren = true;
+ warning$1(false, 'Only strings and numbers are supported as <option> children.');
}
}
});
return content;
}
+var emptyObject = {};
+{
+ Object.freeze(emptyObject);
+}
+
function maskContext(type, context) {
var contextTypes = type.contextTypes;
if (!contextTypes) {
@@ -1991,7 +2302,7 @@ function maskContext(type, context) {
function checkContextTypes(typeSpecs, values, location) {
{
- checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
+ checkPropTypes(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
}
}
@@ -2005,8 +2316,9 @@ function processContext(type, context) {
return maskedContext;
}
+var hasOwnProperty = Object.prototype.hasOwnProperty;
var STYLE = 'style';
-var RESERVED_PROPS$1 = {
+var RESERVED_PROPS = {
children: null,
dangerouslySetInnerHTML: null,
suppressContentEditableWarning: null,
@@ -2017,7 +2329,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
var ret = '<' + tagVerbatim;
for (var propKey in props) {
- if (!props.hasOwnProperty(propKey)) {
+ if (!hasOwnProperty.call(props, propKey)) {
continue;
}
var propValue = props[propKey];
@@ -2029,7 +2341,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
}
var markup = null;
if (isCustomComponent(tagLowercase, props)) {
- if (!RESERVED_PROPS$1.hasOwnProperty(propKey)) {
+ if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
markup = createMarkupForCustomAttribute(propKey, propValue);
}
} else {
@@ -2062,15 +2374,20 @@ function resolve(child, context) {
while (React.isValidElement(child)) {
// Safe because we just checked it's an element.
var element = child;
+ var Component = element.type;
{
pushElementToDebugStack(element);
}
- var Component = element.type;
if (typeof Component !== 'function') {
break;
}
+ processChild(element, Component);
+ }
+
+ // Extra closure so queue and replace can be captured properly
+ function processChild(element, Component) {
var publicContext = processContext(Component, context);
- var inst;
+
var queue = [];
var replace = false;
var updater = {
@@ -2087,23 +2404,62 @@ function resolve(child, context) {
replace = true;
queue = [completeState];
},
- enqueueSetState: function (publicInstance, partialState) {
+ enqueueSetState: function (publicInstance, currentPartialState) {
if (queue === null) {
warnNoop(publicInstance, 'setState');
return null;
}
- queue.push(partialState);
+ queue.push(currentPartialState);
}
};
+ var inst = void 0;
if (shouldConstruct(Component)) {
inst = new Component(element.props, publicContext, updater);
+
+ if (typeof Component.getDerivedStateFromProps === 'function') {
+ {
+ if (inst.state === null || inst.state === undefined) {
+ var componentName = getComponentName(Component) || 'Unknown';
+ if (!didWarnAboutUninitializedState[componentName]) {
+ warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
+ didWarnAboutUninitializedState[componentName] = true;
+ }
+ }
+ }
+
+ var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
+
+ {
+ if (partialState === undefined) {
+ var _componentName = getComponentName(Component) || 'Unknown';
+ if (!didWarnAboutUndefinedDerivedState[_componentName]) {
+ warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
+ didWarnAboutUndefinedDerivedState[_componentName] = true;
+ }
+ }
+ }
+
+ if (partialState != null) {
+ inst.state = _assign({}, inst.state, partialState);
+ }
+ }
} else {
+ {
+ if (Component.prototype && typeof Component.prototype.render === 'function') {
+ var _componentName2 = getComponentName(Component) || 'Unknown';
+
+ if (!didWarnAboutBadClass[_componentName2]) {
+ warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
+ didWarnAboutBadClass[_componentName2] = true;
+ }
+ }
+ }
inst = Component(element.props, publicContext, updater);
if (inst == null || inst.render == null) {
child = inst;
validateRenderResult(child, Component);
- continue;
+ return;
}
}
@@ -2115,8 +2471,30 @@ function resolve(child, context) {
if (initialState === undefined) {
inst.state = initialState = null;
}
- if (inst.componentWillMount) {
- inst.componentWillMount();
+ if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
+ if (typeof inst.componentWillMount === 'function') {
+ {
+ if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
+ var _componentName3 = getComponentName(Component) || 'Unknown';
+
+ if (!didWarnAboutDeprecatedWillMount[_componentName3]) {
+ lowPriorityWarning$1(false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', _componentName3);
+ didWarnAboutDeprecatedWillMount[_componentName3] = true;
+ }
+ }
+ }
+
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
+ if (typeof Component.getDerivedStateFromProps !== 'function') {
+ inst.componentWillMount();
+ }
+ }
+ if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
+ inst.UNSAFE_componentWillMount();
+ }
if (queue.length) {
var oldQueue = queue;
var oldReplace = replace;
@@ -2130,13 +2508,13 @@ function resolve(child, context) {
var dontMutate = true;
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
var partial = oldQueue[i];
- var partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
- if (partialState) {
+ var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
+ if (_partialState != null) {
if (dontMutate) {
dontMutate = false;
- nextState = _assign({}, nextState, partialState);
+ nextState = _assign({}, nextState, _partialState);
} else {
- _assign(nextState, partialState);
+ _assign(nextState, _partialState);
}
}
}
@@ -2157,7 +2535,7 @@ function resolve(child, context) {
}
validateRenderResult(child, Component);
- var childContext;
+ var childContext = void 0;
if (typeof inst.getChildContext === 'function') {
var childContextTypes = Component.childContextTypes;
if (typeof childContextTypes === 'object') {
@@ -2166,7 +2544,7 @@ function resolve(child, context) {
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
}
} else {
- warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
+ warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
}
}
if (childContext) {
@@ -2177,12 +2555,15 @@ function resolve(child, context) {
}
var ReactDOMServerRenderer = function () {
+ // DEV-only
+
function ReactDOMServerRenderer(children, makeStaticMarkup) {
_classCallCheck(this, ReactDOMServerRenderer);
var flatChildren = flattenTopLevelChildren(children);
var topFrame = {
+ type: null,
// Assume all trees start in the HTML namespace (not totally true, but
// this is what we did historically)
domNamespace: Namespaces.html,
@@ -2199,10 +2580,69 @@ var ReactDOMServerRenderer = function () {
this.currentSelectValue = null;
this.previousWasTextNode = false;
this.makeStaticMarkup = makeStaticMarkup;
+
+ // Context (new API)
+ this.contextIndex = -1;
+ this.contextStack = [];
+ this.contextValueStack = [];
+ {
+ this.contextProviderStack = [];
+ }
}
+
+ /**
+ * Note: We use just two stacks regardless of how many context providers you have.
+ * Providers are always popped in the reverse order to how they were pushed
+ * so we always know on the way down which provider you'll encounter next on the way up.
+ * On the way down, we push the current provider, and its context value *before*
+ * we mutated it, onto the stacks. Therefore, on the way up, we always know which
+ * provider needs to be "restored" to which value.
+ * https://github.com/facebook/react/pull/12985#issuecomment-396301248
+ */
+
// TODO: type this more strictly:
+ ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
+ var index = ++this.contextIndex;
+ var context = provider.type._context;
+ var previousValue = context._currentValue;
+
+ // Remember which value to restore this context to on our way up.
+ this.contextStack[index] = context;
+ this.contextValueStack[index] = previousValue;
+ {
+ // Only used for push/pop mismatch warnings.
+ this.contextProviderStack[index] = provider;
+ }
+
+ // Mutate the current value.
+ context._currentValue = provider.props.value;
+ };
+
+ ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
+ var index = this.contextIndex;
+ {
+ !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
+ }
+
+ var context = this.contextStack[index];
+ var previousValue = this.contextValueStack[index];
+
+ // "Hide" these null assignments from Flow by using `any`
+ // because conceptually they are deletions--as long as we
+ // promise to never access values beyond `this.contextIndex`.
+ this.contextStack[index] = null;
+ this.contextValueStack[index] = null;
+ {
+ this.contextProviderStack[index] = null;
+ }
+ this.contextIndex--;
+
+ // Restore to the previous value we stored as we were walking down.
+ context._currentValue = previousValue;
+ };
+
ReactDOMServerRenderer.prototype.read = function read(bytes) {
if (this.exhausted) {
return null;
@@ -2216,25 +2656,31 @@ var ReactDOMServerRenderer = function () {
}
var frame = this.stack[this.stack.length - 1];
if (frame.childIndex >= frame.children.length) {
- var footer = frame.footer;
- out += footer;
- if (footer !== '') {
+ var _footer = frame.footer;
+ out += _footer;
+ if (_footer !== '') {
this.previousWasTextNode = false;
}
this.stack.pop();
- if (frame.tag === 'select') {
+ if (frame.type === 'select') {
this.currentSelectValue = null;
+ } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
+ var provider = frame.type;
+ this.popProvider(provider);
}
continue;
}
var child = frame.children[frame.childIndex++];
{
- setCurrentDebugStack(this.stack);
- }
- out += this.render(child, frame.context, frame.domNamespace);
- {
- // TODO: Handle reentrant server render calls. This doesn't.
- resetCurrentDebugStack();
+ pushCurrentDebugStack(this.stack);
+ // We're starting work on this frame, so reset its inner stack.
+ frame.debugElementStack.length = 0;
+ try {
+ // Be careful! Make sure this matches the PROD path below.
+ out += this.render(child, frame.context, frame.domNamespace);
+ } finally {
+ popCurrentDebugStack();
+ }
}
}
return out;
@@ -2255,7 +2701,7 @@ var ReactDOMServerRenderer = function () {
this.previousWasTextNode = true;
return escapeTextForBrowser(text);
} else {
- var nextChild;
+ var nextChild = void 0;
var _resolve = resolve(child, context);
@@ -2265,8 +2711,16 @@ var ReactDOMServerRenderer = function () {
if (nextChild === null || nextChild === false) {
return '';
} else if (!React.isValidElement(nextChild)) {
+ if (nextChild != null && nextChild.$$typeof != null) {
+ // Catch unexpected special types early.
+ var $$typeof = nextChild.$$typeof;
+ !($$typeof !== REACT_PORTAL_TYPE) ? invariant(false, 'Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.') : void 0;
+ // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
+ invariant(false, 'Unknown element-like object type: %s. This is likely a bug in React. Please file an issue.', $$typeof.toString());
+ }
var nextChildren = toArray(nextChild);
var frame = {
+ type: null,
domNamespace: parentNamespace,
children: nextChildren,
childIndex: 0,
@@ -2278,25 +2732,141 @@ var ReactDOMServerRenderer = function () {
}
this.stack.push(frame);
return '';
- } else if (nextChild.type === REACT_FRAGMENT_TYPE) {
- var _nextChildren = toArray(nextChild.props.children);
- var _frame = {
- domNamespace: parentNamespace,
- children: _nextChildren,
- childIndex: 0,
- context: context,
- footer: ''
- };
- {
- _frame.debugElementStack = [];
- }
- this.stack.push(_frame);
- return '';
- } else {
- // Safe because we just checked it's an element.
- var nextElement = nextChild;
+ }
+ // Safe because we just checked it's an element.
+ var nextElement = nextChild;
+ var elementType = nextElement.type;
+
+ if (typeof elementType === 'string') {
return this.renderDOM(nextElement, context, parentNamespace);
}
+
+ switch (elementType) {
+ case REACT_STRICT_MODE_TYPE:
+ case REACT_ASYNC_MODE_TYPE:
+ case REACT_PROFILER_TYPE:
+ case REACT_FRAGMENT_TYPE:
+ {
+ var _nextChildren = toArray(nextChild.props.children);
+ var _frame = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame.debugElementStack = [];
+ }
+ this.stack.push(_frame);
+ return '';
+ }
+ case REACT_PLACEHOLDER_TYPE:
+ {
+ if (enableSuspenseServerRenderer) {
+ var _nextChildren2 = toArray(
+ // Always use the fallback when synchronously rendering to string.
+ nextChild.props.fallback);
+ var _frame2 = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren2,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame2.debugElementStack = [];
+ }
+ this.stack.push(_frame2);
+ return '';
+ }
+ }
+ // eslint-disable-next-line-no-fallthrough
+ default:
+ break;
+ }
+ if (typeof elementType === 'object' && elementType !== null) {
+ switch (elementType.$$typeof) {
+ case REACT_FORWARD_REF_TYPE:
+ {
+ var element = nextChild;
+ var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
+ var _frame3 = {
+ type: null,
+ domNamespace: parentNamespace,
+ children: _nextChildren3,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame3.debugElementStack = [];
+ }
+ this.stack.push(_frame3);
+ return '';
+ }
+ case REACT_PROVIDER_TYPE:
+ {
+ var provider = nextChild;
+ var nextProps = provider.props;
+ var _nextChildren4 = toArray(nextProps.children);
+ var _frame4 = {
+ type: provider,
+ domNamespace: parentNamespace,
+ children: _nextChildren4,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame4.debugElementStack = [];
+ }
+
+ this.pushProvider(provider);
+
+ this.stack.push(_frame4);
+ return '';
+ }
+ case REACT_CONTEXT_TYPE:
+ {
+ var consumer = nextChild;
+ var _nextProps = consumer.props;
+ var nextValue = consumer.type._currentValue;
+
+ var _nextChildren5 = toArray(_nextProps.children(nextValue));
+ var _frame5 = {
+ type: nextChild,
+ domNamespace: parentNamespace,
+ children: _nextChildren5,
+ childIndex: 0,
+ context: context,
+ footer: ''
+ };
+ {
+ _frame5.debugElementStack = [];
+ }
+ this.stack.push(_frame5);
+ return '';
+ }
+ default:
+ break;
+ }
+ }
+
+ var info = '';
+ {
+ var owner = nextElement._owner;
+ if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
+ 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.';
+ }
+ var ownerName = owner ? getComponentName(owner) : null;
+ if (ownerName) {
+ info += '\n\nCheck the render method of `' + ownerName + '`.';
+ }
+ }
+ invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', elementType == null ? elementType : typeof elementType, info);
}
};
@@ -2312,7 +2882,7 @@ var ReactDOMServerRenderer = function () {
if (namespace === Namespaces.html) {
// Should this check be gated by parent namespace? Not sure we want to
// allow <SVG> or <mATH>.
- warning(tag === element.type, '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', element.type);
+ !(tag === element.type) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
}
}
@@ -2321,14 +2891,14 @@ var ReactDOMServerRenderer = function () {
var props = element.props;
if (tag === 'input') {
{
- ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('input', props);
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
- warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
+ warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
didWarnDefaultChecked = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
- warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
+ warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
didWarnDefaultInputValue = true;
}
}
@@ -2343,9 +2913,9 @@ var ReactDOMServerRenderer = function () {
});
} else if (tag === 'textarea') {
{
- ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props);
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
- warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning$1(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultTextareaValue = true;
}
}
@@ -2357,7 +2927,7 @@ var ReactDOMServerRenderer = function () {
var textareaChildren = props.children;
if (textareaChildren != null) {
{
- warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
+ warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
}
!(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
if (Array.isArray(textareaChildren)) {
@@ -2379,7 +2949,7 @@ var ReactDOMServerRenderer = function () {
});
} else if (tag === 'select') {
{
- ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
+ ReactControlledValuePropTypes.checkPropTypes('select', props);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
@@ -2388,14 +2958,14 @@ var ReactDOMServerRenderer = function () {
}
var isArray = Array.isArray(props[propName]);
if (props.multiple && !isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '');
+ warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
} else if (!props.multiple && isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '');
+ warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
}
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
- warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
didWarnDefaultSelectValue = true;
}
}
@@ -2408,7 +2978,7 @@ var ReactDOMServerRenderer = function () {
var selectValue = this.currentSelectValue;
var optionChildren = flattenOptionChildren(props.children);
if (selectValue != null) {
- var value;
+ var value = void 0;
if (props.value != null) {
value = props.value + '';
} else {
@@ -2441,7 +3011,7 @@ var ReactDOMServerRenderer = function () {
validatePropertiesInDevelopment(tag, props);
}
- assertValidProps(tag, props, getStackAddendum);
+ assertValidProps(tag, props);
var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
var footer = '';
@@ -2451,7 +3021,7 @@ var ReactDOMServerRenderer = function () {
out += '>';
footer = '</' + element.type + '>';
}
- var children;
+ var children = void 0;
var innerMarkup = getNonChildrenInnerMarkup(props);
if (innerMarkup != null) {
children = [];
@@ -2474,7 +3044,7 @@ var ReactDOMServerRenderer = function () {
}
var frame = {
domNamespace: getChildNamespace(parentNamespace, element.type),
- tag: tag,
+ type: tag,
children: children,
childIndex: 0,
context: context,
@@ -2583,7 +3153,7 @@ var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMS
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest
-var server_node = ReactDOMServer['default'] ? ReactDOMServer['default'] : ReactDOMServer;
+var server_node = ReactDOMServer.default || ReactDOMServer;
module.exports = server_node;
})();
diff --git a/node_modules/react-dom/cjs/react-dom-server.node.production.min.js b/node_modules/react-dom/cjs/react-dom-server.node.production.min.js
index 0abf95bfa..8645a5dfc 100644
--- a/node_modules/react-dom/cjs/react-dom-server.node.production.min.js
+++ b/node_modules/react-dom/cjs/react-dom-server.node.production.min.js
@@ -1,44 +1,45 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-server.node.production.min.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var k=require("object-assign"),r=require("react"),aa=require("fbjs/lib/emptyFunction"),t=require("fbjs/lib/emptyObject"),ba=require("fbjs/lib/hyphenateStyleName"),ca=require("fbjs/lib/memoizeStringOnly"),da=require("stream");
-function w(a){for(var b=arguments.length-1,g="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,c=0;c<b;c++)g+="\x26args[]\x3d"+encodeURIComponent(arguments[c+1]);b=Error(g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}
-var x={children:!0,dangerouslySetInnerHTML:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,style:!0};function z(a,b){return(a&b)===b}
-var B={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,HAS_STRING_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(a){var b=B,g=a.Properties||{},c=a.DOMAttributeNamespaces||{},h=a.DOMAttributeNames||{};a=a.DOMMutationMethods||{};for(var f in g){C.hasOwnProperty(f)?w("48",f):void 0;var e=f.toLowerCase(),d=g[f];e={attributeName:e,attributeNamespace:null,propertyName:f,mutationMethod:null,mustUseProperty:z(d,b.MUST_USE_PROPERTY),
-hasBooleanValue:z(d,b.HAS_BOOLEAN_VALUE),hasNumericValue:z(d,b.HAS_NUMERIC_VALUE),hasPositiveNumericValue:z(d,b.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:z(d,b.HAS_OVERLOADED_BOOLEAN_VALUE),hasStringBooleanValue:z(d,b.HAS_STRING_BOOLEAN_VALUE)};1>=e.hasBooleanValue+e.hasNumericValue+e.hasOverloadedBooleanValue?void 0:w("50",f);h.hasOwnProperty(f)&&(e.attributeName=h[f]);c.hasOwnProperty(f)&&(e.attributeNamespace=c[f]);a.hasOwnProperty(f)&&(e.mutationMethod=a[f]);C[f]=e}}},C={};
-function ea(a,b){if(x.hasOwnProperty(a)||2<a.length&&("o"===a[0]||"O"===a[0])&&("n"===a[1]||"N"===a[1]))return!1;if(null===b)return!0;switch(typeof b){case "boolean":return D(a);case "undefined":case "number":case "string":case "object":return!0;default:return!1}}function E(a){return C.hasOwnProperty(a)?C[a]:null}
-function D(a){if(x.hasOwnProperty(a))return!0;var b=E(a);if(b)return b.hasBooleanValue||b.hasStringBooleanValue||b.hasOverloadedBooleanValue;a=a.toLowerCase().slice(0,5);return"data-"===a||"aria-"===a}
-var F=B,G=F.MUST_USE_PROPERTY,H=F.HAS_BOOLEAN_VALUE,I=F.HAS_NUMERIC_VALUE,J=F.HAS_POSITIVE_NUMERIC_VALUE,K=F.HAS_OVERLOADED_BOOLEAN_VALUE,L=F.HAS_STRING_BOOLEAN_VALUE,fa={Properties:{allowFullScreen:H,async:H,autoFocus:H,autoPlay:H,capture:K,checked:G|H,cols:J,contentEditable:L,controls:H,"default":H,defer:H,disabled:H,download:K,draggable:L,formNoValidate:H,hidden:H,loop:H,multiple:G|H,muted:G|H,noValidate:H,open:H,playsInline:H,readOnly:H,required:H,reversed:H,rows:J,rowSpan:I,scoped:H,seamless:H,
-selected:G|H,size:J,start:I,span:J,spellCheck:L,style:0,tabIndex:0,itemScope:H,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:L},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(a,b){if(null==b)return a.removeAttribute("value");"number"!==a.type||!1===a.hasAttribute("value")?a.setAttribute("value",""+b):a.validity&&!a.validity.badInput&&a.ownerDocument.activeElement!==a&&a.setAttribute("value",""+
-b)}}},M=F.HAS_STRING_BOOLEAN_VALUE,N={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},O={Properties:{autoReverse:M,externalResourcesRequired:M,preserveAlpha:M},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:N.xlink,xlinkArcrole:N.xlink,xlinkHref:N.xlink,xlinkRole:N.xlink,xlinkShow:N.xlink,xlinkTitle:N.xlink,xlinkType:N.xlink,xmlBase:N.xml,xmlLang:N.xml,
-xmlSpace:N.xml}},ha=/[\-\:]([a-z])/g;function ia(a){return a[1].toUpperCase()}
-"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(a){var b=a.replace(ha,
-ia);O.Properties[b]=0;O.DOMAttributeNames[b]=a});F.injectDOMPropertyConfig(fa);F.injectDOMPropertyConfig(O);var P="function"===typeof Symbol&&Symbol["for"]?Symbol["for"]("react.fragment"):60107,ja=/["'&<>]/;
-function Q(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ja.exec(a);if(b){var g="",c,h=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b="\x26quot;";break;case 38:b="\x26amp;";break;case 39:b="\x26#x27;";break;case 60:b="\x26lt;";break;case 62:b="\x26gt;";break;default:continue}h!==c&&(g+=a.substring(h,c));h=c+1;g+=b}a=h!==c?g+a.substring(h,c):g}return a}
-var ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,R={},S={};function la(a){if(S.hasOwnProperty(a))return!0;if(R.hasOwnProperty(a))return!1;if(ka.test(a))return S[a]=!0;R[a]=!0;return!1}
-function ma(a,b){var g=E(a);if(g){if(null==b||g.hasBooleanValue&&!b||g.hasNumericValue&&isNaN(b)||g.hasPositiveNumericValue&&1>b||g.hasOverloadedBooleanValue&&!1===b)return"";var c=g.attributeName;if(g.hasBooleanValue||g.hasOverloadedBooleanValue&&!0===b)return c+'\x3d""';if("boolean"!==typeof b||D(a))return c+"\x3d"+('"'+Q(b)+'"')}else if(ea(a,b))return null==b?"":a+"\x3d"+('"'+Q(b)+'"');return null}var T={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
-function U(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
-var V={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},na=k({menuitem:!0},V),W={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,
-fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},oa=["Webkit","ms","Moz","O"];Object.keys(W).forEach(function(a){oa.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);W[b]=W[a]})});var X=r.Children.toArray,pa=aa.thatReturns(""),qa={listing:!0,pre:!0,textarea:!0};
-function ra(a){return"string"===typeof a?a:"function"===typeof a?a.displayName||a.name:null}var sa=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ta={},ua=ca(function(a){return ba(a)});function va(a){var b="";r.Children.forEach(a,function(a){null==a||"string"!==typeof a&&"number"!==typeof a||(b+=a)});return b}function wa(a,b){if(a=a.contextTypes){var g={},c;for(c in a)g[c]=b[c];b=g}else b=t;return b}var xa={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};
-function ya(a,b){void 0===a&&w("152",ra(b)||"Component")}
-function za(a,b){for(;r.isValidElement(a);){var g=a,c=g.type;if("function"!==typeof c)break;a=wa(c,b);var h=[],f=!1,e={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===h)return null},enqueueReplaceState:function(a,b){f=!0;h=[b]},enqueueSetState:function(a,b){if(null===h)return null;h.push(b)}};if(c.prototype&&c.prototype.isReactComponent)var d=new c(g.props,a,e);else if(d=c(g.props,a,e),null==d||null==d.render){a=d;ya(a,c);continue}d.props=g.props;d.context=a;d.updater=e;e=d.state;
-void 0===e&&(d.state=e=null);if(d.componentWillMount)if(d.componentWillMount(),h.length){e=h;var n=f;h=null;f=!1;if(n&&1===e.length)d.state=e[0];else{var p=n?e[0]:d.state,l=!0;for(n=n?1:0;n<e.length;n++){var m=e[n];if(m="function"===typeof m?m.call(d,p,g.props,a):m)l?(l=!1,p=k({},p,m)):k(p,m)}d.state=p}}else h=null;a=d.render();ya(a,c);if("function"===typeof d.getChildContext&&(g=c.childContextTypes,"object"===typeof g)){var A=d.getChildContext();for(var y in A)y in g?void 0:w("108",ra(c)||"Unknown",
-y)}A&&(b=k({},b,A))}return{child:a,context:b}}
-var Y=function(){function a(b,g){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");r.isValidElement(b)?b.type!==P?b=[b]:(b=b.props.children,b=r.isValidElement(b)?[b]:X(b)):b=X(b);this.stack=[{domNamespace:T.html,children:b,childIndex:0,context:t,footer:""}];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=g}a.prototype.read=function(a){if(this.exhausted)return null;for(var b="";b.length<a;){if(0===this.stack.length){this.exhausted=
-!0;break}var c=this.stack[this.stack.length-1];if(c.childIndex>=c.children.length){var h=c.footer;b+=h;""!==h&&(this.previousWasTextNode=!1);this.stack.pop();"select"===c.tag&&(this.currentSelectValue=null)}else h=c.children[c.childIndex++],b+=this.render(h,c.context,c.domNamespace)}return b};a.prototype.render=function(a,g,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return Q(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+Q(c);this.previousWasTextNode=
-!0;return Q(c)}g=za(a,g);a=g.child;g=g.context;if(null===a||!1===a)return"";if(r.isValidElement(a))return a.type===P?(a=X(a.props.children),this.stack.push({domNamespace:c,children:a,childIndex:0,context:g,footer:""}),""):this.renderDOM(a,g,c);a=X(a);this.stack.push({domNamespace:c,children:a,childIndex:0,context:g,footer:""});return""};a.prototype.renderDOM=function(a,g,c){var b=a.type.toLowerCase();c===T.html&&U(b);ta.hasOwnProperty(b)||(sa.test(b)?void 0:w("65",b),ta[b]=!0);var f=a.props;if("input"===
-b)f=k({type:void 0},f,{defaultChecked:void 0,defaultValue:void 0,value:null!=f.value?f.value:f.defaultValue,checked:null!=f.checked?f.checked:f.defaultChecked});else if("textarea"===b){var e=f.value;if(null==e){e=f.defaultValue;var d=f.children;null!=d&&(null!=e?w("92"):void 0,Array.isArray(d)&&(1>=d.length?void 0:w("93"),d=d[0]),e=""+d);null==e&&(e="")}f=k({},f,{value:void 0,children:""+e})}else if("select"===b)this.currentSelectValue=null!=f.value?f.value:f.defaultValue,f=k({},f,{value:void 0});
-else if("option"===b){d=this.currentSelectValue;var n=va(f.children);if(null!=d){var p=null!=f.value?f.value+"":n;e=!1;if(Array.isArray(d))for(var l=0;l<d.length;l++){if(""+d[l]===p){e=!0;break}}else e=""+d===p;f=k({selected:void 0,children:void 0},f,{selected:e,children:n})}}if(e=f)na[b]&&(null!=e.children||null!=e.dangerouslySetInnerHTML?w("137",b,pa()):void 0),null!=e.dangerouslySetInnerHTML&&(null!=e.children?w("60"):void 0,"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML?
-void 0:w("61")),null!=e.style&&"object"!==typeof e.style?w("62",pa()):void 0;e=f;d=this.makeStaticMarkup;n=1===this.stack.length;p="\x3c"+a.type;for(q in e)if(e.hasOwnProperty(q)){var m=e[q];if(null!=m){if("style"===q){l=void 0;var A="",y="";for(l in m)if(m.hasOwnProperty(l)){var u=0===l.indexOf("--"),v=m[l];null!=v&&(A+=y+ua(l)+":",y=l,u=null==v||"boolean"===typeof v||""===v?"":u||"number"!==typeof v||0===v||W.hasOwnProperty(y)&&W[y]?(""+v).trim():v+"px",A+=u,y=";")}m=A||null}l=null;b:if(u=b,v=e,
--1===u.indexOf("-"))u="string"===typeof v.is;else switch(u){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":u=!1;break b;default:u=!0}u?xa.hasOwnProperty(q)||(l=q,l=la(l)&&null!=m?l+"\x3d"+('"'+Q(m)+'"'):""):l=ma(q,m);l&&(p+=" "+l)}}d||n&&(p+=' data-reactroot\x3d""');var q=p;e="";V.hasOwnProperty(b)?q+="/\x3e":(q+="\x3e",e="\x3c/"+a.type+"\x3e");a:{d=f.dangerouslySetInnerHTML;if(null!=
-d){if(null!=d.__html){d=d.__html;break a}}else if(d=f.children,"string"===typeof d||"number"===typeof d){d=Q(d);break a}d=null}null!=d?(f=[],qa[b]&&"\n"===d.charAt(0)&&(q+="\n"),q+=d):f=X(f.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?U(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,tag:b,children:f,childIndex:0,context:g,footer:e});this.previousWasTextNode=!1;return q};return a}();
-function Aa(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}
-var Ba=function(a){function b(g,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var h=a.call(this,{});if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");h=!h||"object"!==typeof h&&"function"!==typeof h?this:h;h.partialRenderer=new Y(g,c);return h}Aa(b,a);b.prototype._read=function(a){try{this.push(this.partialRenderer.read(a))}catch(c){this.emit("error",c)}};return b}(da.Readable),Ca={renderToString:function(a){return(new Y(a,
-!1)).read(Infinity)},renderToStaticMarkup:function(a){return(new Y(a,!0)).read(Infinity)},renderToNodeStream:function(a){return new Ba(a,!1)},renderToStaticNodeStream:function(a){return new Ba(a,!0)},version:"16.2.0"},Da=Object.freeze({default:Ca}),Z=Da&&Ca||Da;module.exports=Z["default"]?Z["default"]:Z;
+'use strict';var p=require("object-assign"),q=require("react"),aa=require("stream");function ba(a,b,d,c,g,f,k,l){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var D=[d,c,g,f,k,l],z=0;a=Error(b.replace(/%s/g,function(){return D[z++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
+function t(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);ba(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}
+var x="function"===typeof Symbol&&Symbol.for,y=x?Symbol.for("react.portal"):60106,A=x?Symbol.for("react.fragment"):60107,B=x?Symbol.for("react.strict_mode"):60108,C=x?Symbol.for("react.profiler"):60114,E=x?Symbol.for("react.provider"):60109,F=x?Symbol.for("react.context"):60110,G=x?Symbol.for("react.async_mode"):60111,H=x?Symbol.for("react.forward_ref"):60112,ca=x?Symbol.for("react.placeholder"):60113;
+function I(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case G:return"AsyncMode";case A:return"Fragment";case y:return"Portal";case C:return"Profiler";case B:return"StrictMode";case ca:return"Placeholder"}if("object"===typeof a){switch(a.$$typeof){case F:return"Context.Consumer";case E:return"Context.Provider";case H:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef")}if("function"===
+typeof a.then&&(a=1===a._reactStatus?a._reactResult:null))return I(a)}return null}var da=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,J=Object.prototype.hasOwnProperty,K={},L={};
+function M(a){if(J.call(L,a))return!0;if(J.call(K,a))return!1;if(da.test(a))return L[a]=!0;K[a]=!0;return!1}function ea(a,b,d,c){if(null!==d&&0===d.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(c)return!1;if(null!==d)return!d.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}}
+function fa(a,b,d,c){if(null===b||"undefined"===typeof b||ea(a,b,d,c))return!0;if(c)return!1;if(null!==d)switch(d.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function N(a,b,d,c,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=g;this.mustUseProperty=d;this.propertyName=a;this.type=b}var O={};
+"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){O[a]=new N(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];O[b]=new N(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){O[a]=new N(a,2,!1,a.toLowerCase(),null)});
+["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){O[a]=new N(a,2,!1,a,null)});"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){O[a]=new N(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){O[a]=new N(a,3,!0,a,null)});
+["capture","download"].forEach(function(a){O[a]=new N(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){O[a]=new N(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){O[a]=new N(a,5,!1,a.toLowerCase(),null)});var P=/[\-:]([a-z])/g;function Q(a){return a[1].toUpperCase()}
+"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(P,
+Q);O[b]=new N(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(P,Q);O[b]=new N(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(P,Q);O[b]=new N(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});O.tabIndex=new N("tabIndex",1,!1,"tabindex",null);var ha=/["'&<>]/;
+function R(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ha.exec(a);if(b){var d="",c,g=0;for(c=b.index;c<a.length;c++){switch(a.charCodeAt(c)){case 34:b="&quot;";break;case 38:b="&amp;";break;case 39:b="&#x27;";break;case 60:b="&lt;";break;case 62:b="&gt;";break;default:continue}g!==c&&(d+=a.substring(g,c));g=c+1;d+=b}a=g!==c?d+a.substring(g,c):d}return a}var S={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
+function T(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}
+var U={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},ia=p({menuitem:!0},U),V={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,
+gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ja=["Webkit","ms","Moz","O"];Object.keys(V).forEach(function(a){ja.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);V[b]=V[a]})});
+var ka=/([A-Z])/g,la=/^ms-/,W=q.Children.toArray,ma={listing:!0,pre:!0,textarea:!0},na=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,X={},Y={};function oa(a){if(void 0===a||null===a)return a;var b="";q.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}var pa={};function qa(a,b){if(a=a.contextTypes){var d={},c;for(c in a)d[c]=b[c];b=d}else b=pa;return b}var ra=Object.prototype.hasOwnProperty,sa={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};
+function ta(a,b){void 0===a&&t("152",I(b)||"Component")}
+function ua(a,b){function d(c,g){var d=qa(g,b),f=[],k=!1,h={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===f)return null},enqueueReplaceState:function(a,b){k=!0;f=[b]},enqueueSetState:function(a,b){if(null===f)return null;f.push(b)}},e=void 0;if(g.prototype&&g.prototype.isReactComponent){if(e=new g(c.props,d,h),"function"===typeof g.getDerivedStateFromProps){var v=g.getDerivedStateFromProps.call(null,c.props,e.state);null!=v&&(e.state=p({},e.state,v))}}else if(e=g(c.props,
+d,h),null==e||null==e.render){a=e;ta(a,g);return}e.props=c.props;e.context=d;e.updater=h;h=e.state;void 0===h&&(e.state=h=null);if("function"===typeof e.UNSAFE_componentWillMount||"function"===typeof e.componentWillMount)if("function"===typeof e.componentWillMount&&"function"!==typeof g.getDerivedStateFromProps&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&"function"!==typeof g.getDerivedStateFromProps&&e.UNSAFE_componentWillMount(),f.length){h=f;var r=k;f=null;k=!1;if(r&&
+1===h.length)e.state=h[0];else{v=r?h[0]:e.state;var m=!0;for(r=r?1:0;r<h.length;r++){var n=h[r];n="function"===typeof n?n.call(e,v,c.props,d):n;null!=n&&(m?(m=!1,v=p({},v,n)):p(v,n))}e.state=v}}else f=null;a=e.render();ta(a,g);c=void 0;if("function"===typeof e.getChildContext&&(d=g.childContextTypes,"object"===typeof d)){c=e.getChildContext();for(var w in c)w in d?void 0:t("108",I(g)||"Unknown",w)}c&&(b=p({},b,c))}for(;q.isValidElement(a);){var c=a,g=c.type;if("function"!==typeof g)break;d(c,g)}return{child:a,
+context:b}}
+var Z=function(){function a(b,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");q.isValidElement(b)?b.type!==A?b=[b]:(b=b.props.children,b=q.isValidElement(b)?[b]:W(b)):b=W(b);this.stack=[{type:null,domNamespace:S.html,children:b,childIndex:0,context:pa,footer:""}];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=d;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[]}a.prototype.pushProvider=function(a){var b=
+++this.contextIndex,c=a.type._context,g=c._currentValue;this.contextStack[b]=c;this.contextValueStack[b]=g;c._currentValue=a.props.value};a.prototype.popProvider=function(){var a=this.contextIndex,d=this.contextStack[a],c=this.contextValueStack[a];this.contextStack[a]=null;this.contextValueStack[a]=null;this.contextIndex--;d._currentValue=c};a.prototype.read=function(a){if(this.exhausted)return null;for(var b="";b.length<a;){if(0===this.stack.length){this.exhausted=!0;break}var c=this.stack[this.stack.length-
+1];if(c.childIndex>=c.children.length){var g=c.footer;b+=g;""!==g&&(this.previousWasTextNode=!1);this.stack.pop();"select"===c.type?this.currentSelectValue=null:null!=c.type&&null!=c.type.type&&c.type.type.$$typeof===E&&this.popProvider(c.type)}else g=c.children[c.childIndex++],b+=this.render(g,c.context,c.domNamespace)}return b};a.prototype.render=function(a,d,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return R(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+
+R(c);this.previousWasTextNode=!0;return R(c)}d=ua(a,d);a=d.child;d=d.context;if(null===a||!1===a)return"";if(!q.isValidElement(a)){if(null!=a&&null!=a.$$typeof){var b=a.$$typeof;b===y?t("257"):void 0;t("258",b.toString())}a=W(a);this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""});return""}b=a.type;if("string"===typeof b)return this.renderDOM(a,d,c);switch(b){case B:case G:case C:case A:return a=W(a.props.children),this.stack.push({type:null,domNamespace:c,children:a,
+childIndex:0,context:d,footer:""}),""}if("object"===typeof b&&null!==b)switch(b.$$typeof){case H:return a=W(b.render(a.props,a.ref)),this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case E:return b=W(a.props.children),c={type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""},this.pushProvider(a),this.stack.push(c),"";case F:return b=W(a.props.children(a.type._currentValue)),this.stack.push({type:a,domNamespace:c,children:b,childIndex:0,context:d,
+footer:""}),""}t("130",null==b?b:typeof b,"")};a.prototype.renderDOM=function(a,d,c){var b=a.type.toLowerCase();c===S.html&&T(b);X.hasOwnProperty(b)||(na.test(b)?void 0:t("65",b),X[b]=!0);var f=a.props;if("input"===b)f=p({type:void 0},f,{defaultChecked:void 0,defaultValue:void 0,value:null!=f.value?f.value:f.defaultValue,checked:null!=f.checked?f.checked:f.defaultChecked});else if("textarea"===b){var k=f.value;if(null==k){k=f.defaultValue;var l=f.children;null!=l&&(null!=k?t("92"):void 0,Array.isArray(l)&&
+(1>=l.length?void 0:t("93"),l=l[0]),k=""+l);null==k&&(k="")}f=p({},f,{value:void 0,children:""+k})}else if("select"===b)this.currentSelectValue=null!=f.value?f.value:f.defaultValue,f=p({},f,{value:void 0});else if("option"===b){l=this.currentSelectValue;var D=oa(f.children);if(null!=l){var z=null!=f.value?f.value+"":D;k=!1;if(Array.isArray(l))for(var h=0;h<l.length;h++){if(""+l[h]===z){k=!0;break}}else k=""+l===z;f=p({selected:void 0,children:void 0},f,{selected:k,children:D})}}if(k=f)ia[b]&&(null!=
+k.children||null!=k.dangerouslySetInnerHTML?t("137",b,""):void 0),null!=k.dangerouslySetInnerHTML&&(null!=k.children?t("60"):void 0,"object"===typeof k.dangerouslySetInnerHTML&&"__html"in k.dangerouslySetInnerHTML?void 0:t("61")),null!=k.style&&"object"!==typeof k.style?t("62",""):void 0;k=f;l=this.makeStaticMarkup;D=1===this.stack.length;z="<"+a.type;for(u in k)if(ra.call(k,u)){var e=k[u];if(null!=e){if("style"===u){h=void 0;var v="",r="";for(h in e)if(e.hasOwnProperty(h)){var m=0===h.indexOf("--"),
+n=e[h];if(null!=n){var w=h;if(Y.hasOwnProperty(w))w=Y[w];else{var za=w.replace(ka,"-$1").toLowerCase().replace(la,"-ms-");w=Y[w]=za}v+=r+w+":";r=h;m=null==n||"boolean"===typeof n||""===n?"":m||"number"!==typeof n||0===n||V.hasOwnProperty(r)&&V[r]?(""+n).trim():n+"px";v+=m;r=";"}}e=v||null}h=null;b:if(m=b,n=k,-1===m.indexOf("-"))m="string"===typeof n.is;else switch(m){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":m=
+!1;break b;default:m=!0}if(m)sa.hasOwnProperty(u)||(h=u,h=M(h)&&null!=e?h+"="+('"'+R(e)+'"'):"");else{m=u;h=e;e=O.hasOwnProperty(m)?O[m]:null;if(n="style"!==m)n=null!==e?0===e.type:!(2<m.length)||"o"!==m[0]&&"O"!==m[0]||"n"!==m[1]&&"N"!==m[1]?!1:!0;n||fa(m,h,e,!1)?h="":null!==e?(m=e.attributeName,e=e.type,h=3===e||4===e&&!0===h?m+'=""':m+"="+('"'+R(h)+'"')):h=M(m)?m+"="+('"'+R(h)+'"'):""}h&&(z+=" "+h)}}l||D&&(z+=' data-reactroot=""');var u=z;k="";U.hasOwnProperty(b)?u+="/>":(u+=">",k="</"+a.type+
+">");a:{l=f.dangerouslySetInnerHTML;if(null!=l){if(null!=l.__html){l=l.__html;break a}}else if(l=f.children,"string"===typeof l||"number"===typeof l){l=R(l);break a}l=null}null!=l?(f=[],ma[b]&&"\n"===l.charAt(0)&&(u+="\n"),u+=l):f=W(f.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?T(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,type:b,children:f,childIndex:0,context:d,footer:k});this.previousWasTextNode=
+!1;return u};return a}();function va(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}
+var wa=function(a){function b(d,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var g=a.call(this,{});if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.partialRenderer=new Z(d,c);return g}va(b,a);b.prototype._read=function(a){try{this.push(this.partialRenderer.read(a))}catch(c){this.emit("error",c)}};return b}(aa.Readable),xa={renderToString:function(a){return(new Z(a,
+!1)).read(Infinity)},renderToStaticMarkup:function(a){return(new Z(a,!0)).read(Infinity)},renderToNodeStream:function(a){return new wa(a,!1)},renderToStaticNodeStream:function(a){return new wa(a,!0)},version:"16.5.2"},ya={default:xa},Aa=ya&&xa||ya;module.exports=Aa.default||Aa;
diff --git a/node_modules/react-dom/cjs/react-dom-test-utils.development.js b/node_modules/react-dom/cjs/react-dom-test-utils.development.js
index 7296e0eab..b34468c84 100644
--- a/node_modules/react-dom/cjs/react-dom-test-utils.development.js
+++ b/node_modules/react-dom/cjs/react-dom-test-utils.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-test-utils.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -18,18 +18,141 @@ if (process.env.NODE_ENV !== "production") {
var _assign = require('object-assign');
var React = require('react');
var ReactDOM = require('react-dom');
-var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+var validateFormat = function () {};
+
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
+}
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
+
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
*/
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
+}
+
+var warningWithoutStack$1 = warningWithoutStack;
+
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
@@ -51,32 +174,42 @@ function get(key) {
return key._reactInternalFiber;
}
-var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
-var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
+// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
-// Before we know whether it is functional or class
-var FunctionalComponent = 1;
+var FunctionalComponent = 0;
+var FunctionalComponentLazy = 1;
var ClassComponent = 2;
-var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
+var ClassComponentLazy = 3;
+ // Before we know whether it is functional or class
+var HostRoot = 5; // Root of a host tree. Could be nested inside another node.
// A subtree. Could be an entry point to a different renderer.
-var HostComponent = 5;
-var HostText = 6;
+var HostComponent = 7;
+var HostText = 8;
+
+// Don't change these two values. They're used by React Dev Tools.
+var NoEffect = /* */0;
-// Don't change these two values:
-var NoEffect = 0; // 0b00000000
- // 0b00000001
// You can change the rest (and add more).
-var Placement = 2; // 0b00000010
- // 0b00000100
- // 0b00000110
- // 0b00001000
- // 0b00010000
- // 0b00100000
- // 0b01000000
- // 0b10000000
+var Placement = /* */2;
+
+
+
+
+
+
+
+
+
+// Update & Callback & Ref & Snapshot
+
+
+// Union of all host effects
+
+var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var MOUNTING = 1;
var MOUNTED = 2;
@@ -90,15 +223,15 @@ function isFiberMountedImpl(fiber) {
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
}
- while (node['return']) {
- node = node['return'];
+ while (node.return) {
+ node = node.return;
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
}
}
} else {
- while (node['return']) {
- node = node['return'];
+ while (node.return) {
+ node = node.return;
}
}
if (node.tag === HostRoot) {
@@ -136,7 +269,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
var a = fiber;
var b = alternate;
while (true) {
- var parentA = a['return'];
+ var parentA = a.return;
var parentB = parentA ? parentA.alternate : null;
if (!parentA || !parentB) {
// We're at the root.
@@ -166,7 +299,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
invariant(false, 'Unable to find node on an unmounted component.');
}
- if (a['return'] !== b['return']) {
+ if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
@@ -233,12 +366,8 @@ function findCurrentFiberUsingSlowPath(fiber) {
/* eslint valid-typeof: 0 */
-var didWarnForAddedNewProperty = false;
-var isProxySupported = typeof Proxy === 'function';
var EVENT_POOL_SIZE = 10;
-var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
-
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -247,7 +376,9 @@ var EventInterface = {
type: null,
target: null,
// currentTarget is set when dispatching; no use in copying it here
- currentTarget: emptyFunction.thatReturnsNull,
+ currentTarget: function () {
+ return null;
+ },
eventPhase: null,
bubbles: null,
cancelable: null,
@@ -258,6 +389,14 @@ var EventInterface = {
isTrusted: null
};
+function functionThatReturnsTrue() {
+ return true;
+}
+
+function functionThatReturnsFalse() {
+ return false;
+}
+
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
@@ -282,6 +421,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
+ delete this.isDefaultPrevented;
+ delete this.isPropagationStopped;
}
this.dispatchConfig = dispatchConfig;
@@ -310,11 +451,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
} else {
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
+ this.isDefaultPrevented = functionThatReturnsFalse;
}
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
@@ -331,7 +472,7 @@ _assign(SyntheticEvent.prototype, {
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
},
stopPropagation: function () {
@@ -351,7 +492,7 @@ _assign(SyntheticEvent.prototype, {
event.cancelBubble = true;
}
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
+ this.isPropagationStopped = functionThatReturnsTrue;
},
/**
@@ -360,7 +501,7 @@ _assign(SyntheticEvent.prototype, {
* won't be added back into the pool.
*/
persist: function () {
- this.isPersistent = emptyFunction.thatReturnsTrue;
+ this.isPersistent = functionThatReturnsTrue;
},
/**
@@ -368,7 +509,7 @@ _assign(SyntheticEvent.prototype, {
*
* @return {boolean} True if this should not be released, false otherwise.
*/
- isPersistent: emptyFunction.thatReturnsFalse,
+ isPersistent: functionThatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
@@ -380,13 +521,19 @@ _assign(SyntheticEvent.prototype, {
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
}
}
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
- this[shouldBeReleasedProperties[i]] = null;
- }
+ this.dispatchConfig = null;
+ this._targetInst = null;
+ this.nativeEvent = null;
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
+ this._dispatchListeners = null;
+ this._dispatchInstances = null;
{
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
}
}
});
@@ -395,53 +542,27 @@ SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
- *
- * @param {function} Class
- * @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function (Class, Interface) {
+SyntheticEvent.extend = function (Interface) {
var Super = this;
var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();
+ function Class() {
+ return Super.apply(this, arguments);
+ }
_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = _assign({}, Super.Interface, Interface);
- Class.augmentClass = Super.augmentClass;
+ Class.extend = Super.extend;
addEventPoolingTo(Class);
-};
-/** Proxying after everything set on SyntheticEvent
- * to resolve Proxy issue on some WebKit browsers
- * in which some Event properties are set to undefined (GH#10010)
- */
-{
- if (isProxySupported) {
- /*eslint-disable no-func-assign */
- SyntheticEvent = new Proxy(SyntheticEvent, {
- construct: function (target, args) {
- return this.apply(target, Object.create(target.prototype), args);
- },
- apply: function (constructor, that, args) {
- return new Proxy(constructor.apply(that, args), {
- set: function (target, prop, value) {
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
- warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.');
- didWarnForAddedNewProperty = true;
- }
- target[prop] = value;
- return true;
- }
- });
- }
- });
- /*eslint-enable no-func-assign */
- }
-}
+ return Class;
+};
addEventPoolingTo(SyntheticEvent);
@@ -475,7 +596,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
function warn(action, result) {
var warningCondition = false;
- warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
@@ -491,7 +612,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
function releasePooledEvent(event) {
var EventConstructor = this;
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
event.destructor();
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
EventConstructor.eventPool.push(event);
@@ -504,7 +625,74 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent;
}
-var SyntheticEvent$1 = SyntheticEvent;
+/**
+ * Forked from fbjs/warning:
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
+ *
+ * Only change is we use console.warn instead of console.error,
+ * and do nothing when 'console' is not supported.
+ * This really simplifies the code.
+ * ---
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var lowPriorityWarning = function () {};
+
+{
+ var printWarning = function (format) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.warn(message);
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ } catch (x) {}
+ };
+
+ lowPriorityWarning = function (condition, format) {
+ if (format === undefined) {
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (!condition) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ printWarning.apply(undefined, [format].concat(args));
+ }
+ };
+}
+
+var lowPriorityWarning$1 = lowPriorityWarning;
+
+/**
+ * HTML nodeType values that represent the type of the node
+ */
+
+var ELEMENT_NODE = 1;
+
+// Do not uses the below two methods directly!
+// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
+// (It is the only module that is allowed to access these methods.)
+
+function unsafeCastStringToDOMTopLevelType(topLevelType) {
+ return topLevelType;
+}
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Generate a mapping of standard vendor prefixes using the defined style property and event name.
@@ -519,8 +707,6 @@ function makePrefixMap(styleProp, eventName) {
prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
prefixes['Webkit' + styleProp] = 'webkit' + eventName;
prefixes['Moz' + styleProp] = 'moz' + eventName;
- prefixes['ms' + styleProp] = 'MS' + eventName;
- prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
return prefixes;
}
@@ -548,7 +734,7 @@ var style = {};
/**
* Bootstrap if a DOM exists.
*/
-if (ExecutionEnvironment.canUseDOM) {
+if (canUseDOM) {
style = document.createElement('div').style;
// On some platforms, in particular some releases of Android 4.x,
@@ -588,109 +774,152 @@ function getVendorPrefixedEventName(eventName) {
}
}
- return '';
+ return eventName;
}
/**
- * Types of raw signals from the browser caught at the top level.
- *
- * For events like 'submit' which don't consistently bubble (which we
- * trap at a lower node than `document`), binding at `document` would
- * cause duplicate events so we don't include them here.
+ * To identify top level events in ReactDOM, we use constants defined by this
+ * module. This is the only module that uses the unsafe* methods to express
+ * that the constants actually correspond to the browser event names. This lets
+ * us save some bundle size by avoiding a top level type -> event name map.
+ * The rest of ReactDOM code should import top level types from this file.
*/
-var topLevelTypes$1 = {
- topAbort: 'abort',
- topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
- topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
- topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
- topBlur: 'blur',
- topCancel: 'cancel',
- topCanPlay: 'canplay',
- topCanPlayThrough: 'canplaythrough',
- topChange: 'change',
- topClick: 'click',
- topClose: 'close',
- topCompositionEnd: 'compositionend',
- topCompositionStart: 'compositionstart',
- topCompositionUpdate: 'compositionupdate',
- topContextMenu: 'contextmenu',
- topCopy: 'copy',
- topCut: 'cut',
- topDoubleClick: 'dblclick',
- topDrag: 'drag',
- topDragEnd: 'dragend',
- topDragEnter: 'dragenter',
- topDragExit: 'dragexit',
- topDragLeave: 'dragleave',
- topDragOver: 'dragover',
- topDragStart: 'dragstart',
- topDrop: 'drop',
- topDurationChange: 'durationchange',
- topEmptied: 'emptied',
- topEncrypted: 'encrypted',
- topEnded: 'ended',
- topError: 'error',
- topFocus: 'focus',
- topInput: 'input',
- topKeyDown: 'keydown',
- topKeyPress: 'keypress',
- topKeyUp: 'keyup',
- topLoadedData: 'loadeddata',
- topLoad: 'load',
- topLoadedMetadata: 'loadedmetadata',
- topLoadStart: 'loadstart',
- topMouseDown: 'mousedown',
- topMouseMove: 'mousemove',
- topMouseOut: 'mouseout',
- topMouseOver: 'mouseover',
- topMouseUp: 'mouseup',
- topPaste: 'paste',
- topPause: 'pause',
- topPlay: 'play',
- topPlaying: 'playing',
- topProgress: 'progress',
- topRateChange: 'ratechange',
- topScroll: 'scroll',
- topSeeked: 'seeked',
- topSeeking: 'seeking',
- topSelectionChange: 'selectionchange',
- topStalled: 'stalled',
- topSuspend: 'suspend',
- topTextInput: 'textInput',
- topTimeUpdate: 'timeupdate',
- topToggle: 'toggle',
- topTouchCancel: 'touchcancel',
- topTouchEnd: 'touchend',
- topTouchMove: 'touchmove',
- topTouchStart: 'touchstart',
- topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
- topVolumeChange: 'volumechange',
- topWaiting: 'waiting',
- topWheel: 'wheel'
-};
-
-var BrowserEventConstants = {
- topLevelTypes: topLevelTypes$1
-};
+var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
+var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
+var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
+var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
+var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
+var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
+var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
+var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
+var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
+var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
+var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
+var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
+var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
+var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
+var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
+var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
+var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
+var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
+
+var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
+var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
+var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
+var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
+var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
+var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
+var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
+var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
+var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
+var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
+var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
+var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
+var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
+var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
+
+var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
+
+var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
+var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
+var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
+var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
+var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
+var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
+var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
+
+var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
+var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
+var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
+var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
+var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
+var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
+var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
+var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
+var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
+
+
+
+
+
+
+
+
+var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
+var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
+
+var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
+var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
+var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
+var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
+var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
+
+var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
+var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
+var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
+var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
+var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
+var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
+var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
+var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
+var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
+var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
+var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
+var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
+
+// List of events that need to be individually attached to media elements.
+// Note that events in this list will *not* be listened to at the top level
+// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
var findDOMNode = ReactDOM.findDOMNode;
-var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-var EventPluginHub = _ReactDOM$__SECRET_IN.EventPluginHub;
-var EventPluginRegistry = _ReactDOM$__SECRET_IN.EventPluginRegistry;
-var EventPropagators = _ReactDOM$__SECRET_IN.EventPropagators;
-var ReactControlledComponent = _ReactDOM$__SECRET_IN.ReactControlledComponent;
-var ReactDOMComponentTree = _ReactDOM$__SECRET_IN.ReactDOMComponentTree;
-var ReactDOMEventListener = _ReactDOM$__SECRET_IN.ReactDOMEventListener;
+// Keep in sync with ReactDOMUnstableNativeDependencies.js
+// and ReactDOM.js:
+
+var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
+var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
+var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
+var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
+var injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
+var eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4];
+var accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5];
+var accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6];
+var enqueueStateRestore = _ReactDOM$__SECRET_IN[7];
+var restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8];
+var dispatchEvent = _ReactDOM$__SECRET_IN[9];
+var runEventsInBatch = _ReactDOM$__SECRET_IN[10];
-var topLevelTypes = BrowserEventConstants.topLevelTypes;
-
function Event(suffix) {}
+var hasWarnedAboutDeprecatedMockComponent = false;
+
/**
* @class ReactTestUtils
*/
+/**
+ * Simulates a top level event being dispatched from a raw event that occurred
+ * on an `Element` node.
+ * @param {number} topLevelType A number from `TopLevelEventTypes`
+ * @param {!Element} node The dom to simulate an event occurring on.
+ * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
+ */
+function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
+ fakeNativeEvent.target = node;
+ dispatchEvent(topLevelType, fakeNativeEvent);
+}
+
+/**
+ * Simulates a top level event being dispatched from a raw event that occurred
+ * on the `ReactDOMComponent` `comp`.
+ * @param {Object} topLevelType A type from `BrowserEventConstants.topLevelTypes`.
+ * @param {!ReactDOMComponent} comp
+ * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
+ */
+function simulateNativeEventOnDOMComponent(topLevelType, comp, fakeNativeEvent) {
+ simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
+}
+
function findAllInRenderedFiberTreeInternal(fiber, test) {
if (!fiber) {
return [];
@@ -702,14 +931,14 @@ function findAllInRenderedFiberTreeInternal(fiber, test) {
var node = currentParent;
var ret = [];
while (true) {
- if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === FunctionalComponent) {
+ if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === ClassComponentLazy || node.tag === FunctionalComponent || node.tag === FunctionalComponentLazy) {
var publicInst = node.stateNode;
if (test(publicInst)) {
ret.push(publicInst);
}
}
if (node.child) {
- node.child['return'] = node;
+ node.child.return = node;
node = node.child;
continue;
}
@@ -717,16 +946,39 @@ function findAllInRenderedFiberTreeInternal(fiber, test) {
return ret;
}
while (!node.sibling) {
- if (!node['return'] || node['return'] === currentParent) {
+ if (!node.return || node.return === currentParent) {
return ret;
}
- node = node['return'];
+ node = node.return;
}
- node.sibling['return'] = node['return'];
+ node.sibling.return = node.return;
node = node.sibling;
}
}
+function validateClassInstance(inst, methodName) {
+ if (!inst) {
+ // This is probably too relaxed but it's existing behavior.
+ return;
+ }
+ if (get(inst)) {
+ // This is a public instance indeed.
+ return;
+ }
+ var received = void 0;
+ var stringified = '' + inst;
+ if (Array.isArray(inst)) {
+ received = 'an array';
+ } else if (inst && inst.nodeType === ELEMENT_NODE && inst.tagName) {
+ received = 'a DOM node';
+ } else if (stringified === '[object Object]') {
+ received = 'object with keys {' + Object.keys(inst).join(', ') + '}';
+ } else {
+ received = stringified;
+ }
+ invariant(false, '%s(...): the first argument must be a React class instance. Instead received: %s.', methodName, received);
+}
+
/**
* Utilities for making it easy to test React components.
*
@@ -756,7 +1008,7 @@ var ReactTestUtils = {
},
isDOMComponent: function (inst) {
- return !!(inst && inst.nodeType === 1 && inst.tagName);
+ return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName);
},
isDOMComponentElement: function (inst) {
@@ -782,10 +1034,10 @@ var ReactTestUtils = {
},
findAllInRenderedTree: function (inst, test) {
+ validateClassInstance(inst, 'findAllInRenderedTree');
if (!inst) {
return [];
}
- !ReactTestUtils.isCompositeComponent(inst) ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : void 0;
var internalInstance = get(inst);
return findAllInRenderedFiberTreeInternal(internalInstance, test);
},
@@ -796,6 +1048,7 @@ var ReactTestUtils = {
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithClass: function (root, classNames) {
+ validateClassInstance(root, 'scryRenderedDOMComponentsWithClass');
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
if (ReactTestUtils.isDOMComponent(inst)) {
var className = inst.className;
@@ -824,6 +1077,7 @@ var ReactTestUtils = {
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function (root, className) {
+ validateClassInstance(root, 'findRenderedDOMComponentWithClass');
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
@@ -837,6 +1091,7 @@ var ReactTestUtils = {
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithTag: function (root, tagName) {
+ validateClassInstance(root, 'scryRenderedDOMComponentsWithTag');
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
@@ -849,6 +1104,7 @@ var ReactTestUtils = {
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function (root, tagName) {
+ validateClassInstance(root, 'findRenderedDOMComponentWithTag');
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
@@ -861,6 +1117,7 @@ var ReactTestUtils = {
* @return {array} an array of all the matches.
*/
scryRenderedComponentsWithType: function (root, componentType) {
+ validateClassInstance(root, 'scryRenderedComponentsWithType');
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
@@ -873,6 +1130,7 @@ var ReactTestUtils = {
* @return {!ReactComponent} The one match.
*/
findRenderedComponentWithType: function (root, componentType) {
+ validateClassInstance(root, 'findRenderedComponentWithType');
var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
@@ -894,6 +1152,11 @@ var ReactTestUtils = {
* @return {object} the ReactTestUtils object (for chaining)
*/
mockComponent: function (module, mockTagName) {
+ if (!hasWarnedAboutDeprecatedMockComponent) {
+ hasWarnedAboutDeprecatedMockComponent = true;
+ lowPriorityWarning$1(false, 'ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
+ }
+
mockTagName = mockTagName || module.mockTagName || 'div';
module.prototype.render.mockImplementation(function () {
@@ -903,29 +1166,6 @@ var ReactTestUtils = {
return this;
},
- /**
- * Simulates a top level event being dispatched from a raw event that occurred
- * on an `Element` node.
- * @param {Object} topLevelType A type from `BrowserEventConstants.topLevelTypes`
- * @param {!Element} node The dom to simulate an event occurring on.
- * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
- */
- simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
- fakeNativeEvent.target = node;
- ReactDOMEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
- },
-
- /**
- * Simulates a top level event being dispatched from a raw event that occurred
- * on the `ReactDOMComponent` `comp`.
- * @param {Object} topLevelType A type from `BrowserEventConstants.topLevelTypes`.
- * @param {!ReactDOMComponent} comp
- * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
- */
- simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
- ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
- },
-
nativeTouchData: function (x, y) {
return {
touches: [{ pageX: x, pageY: y }]
@@ -949,7 +1189,7 @@ function makeSimulator(eventType) {
!!React.isValidElement(domNode) ? invariant(false, 'TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering.') : void 0;
!!ReactTestUtils.isCompositeComponent(domNode) ? invariant(false, 'TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead.') : void 0;
- var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
+ var dispatchConfig = eventNameDispatchConfigs[eventType];
var fakeNativeEvent = new Event();
fakeNativeEvent.target = domNode;
@@ -957,8 +1197,8 @@ function makeSimulator(eventType) {
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
- var targetInst = ReactDOMComponentTree.getInstanceFromNode(domNode);
- var event = new SyntheticEvent$1(dispatchConfig, targetInst, fakeNativeEvent, domNode);
+ var targetInst = getInstanceFromNode(domNode);
+ var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode);
// Since we aren't using pooling, always persist the event. This will make
// sure it's marked and won't warn when setting additional properties.
@@ -966,27 +1206,26 @@ function makeSimulator(eventType) {
_assign(event, eventData);
if (dispatchConfig.phasedRegistrationNames) {
- EventPropagators.accumulateTwoPhaseDispatches(event);
+ accumulateTwoPhaseDispatches(event);
} else {
- EventPropagators.accumulateDirectDispatches(event);
+ accumulateDirectDispatches(event);
}
ReactDOM.unstable_batchedUpdates(function () {
// Normally extractEvent enqueues a state restore, but we'll just always
// do that since we we're by-passing it here.
- ReactControlledComponent.enqueueStateRestore(domNode);
-
- EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue(true);
+ enqueueStateRestore(domNode);
+ runEventsInBatch(event, true);
});
+ restoreStateIfNeeded();
};
}
function buildSimulators() {
ReactTestUtils.Simulate = {};
- var eventType;
- for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
+ var eventType = void 0;
+ for (eventType in eventNameDispatchConfigs) {
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
@@ -995,18 +1234,6 @@ function buildSimulators() {
}
}
-// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
-var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
-EventPluginHub.injection.injectEventPluginOrder = function () {
- oldInjectEventPluginOrder.apply(this, arguments);
- buildSimulators();
-};
-var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
-EventPluginHub.injection.injectEventPluginsByName = function () {
- oldInjectEventPlugins.apply(this, arguments);
- buildSimulators();
-};
-
buildSimulators();
/**
@@ -1025,27 +1252,28 @@ buildSimulators();
* to dispatch synthetic events.
*/
-function makeNativeSimulator(eventType) {
+function makeNativeSimulator(eventType, topLevelType) {
return function (domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
_assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
+ simulateNativeEventOnDOMComponent(topLevelType, domComponentOrNode, fakeNativeEvent);
} else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
- ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
+ simulateNativeEventOnNode(topLevelType, domComponentOrNode, fakeNativeEvent);
}
};
}
-Object.keys(topLevelTypes).forEach(function (eventType) {
- // Event type is stored as 'topClick' - we transform that to 'click'
- var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
+[[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_BLUR, 'blur'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CANCEL, 'cancel'], [TOP_CHANGE, 'change'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_COMPOSITION_END, 'compositionEnd'], [TOP_COMPOSITION_START, 'compositionStart'], [TOP_COMPOSITION_UPDATE, 'compositionUpdate'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DRAG_START, 'dragStart'], [TOP_DRAG, 'drag'], [TOP_DROP, 'drop'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_LOAD_START, 'loadStart'], [TOP_LOAD_START, 'loadStart'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_PLAYING, 'playing'], [TOP_PROGRESS, 'progress'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_SCROLL, 'scroll'], [TOP_SEEKED, 'seeked'], [TOP_SEEKING, 'seeking'], [TOP_SELECTION_CHANGE, 'selectionChange'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TEXT_INPUT, 'textInput'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TOUCH_START, 'touchStart'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_VOLUME_CHANGE, 'volumeChange'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']].forEach(function (_ref) {
+ var topLevelType = _ref[0],
+ eventType = _ref[1];
+
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
- ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
+ ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(eventType, topLevelType);
});
@@ -1058,7 +1286,7 @@ var ReactTestUtils$3 = ( ReactTestUtils$2 && ReactTestUtils ) || ReactTestUtils$
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
-var testUtils = ReactTestUtils$3['default'] ? ReactTestUtils$3['default'] : ReactTestUtils$3;
+var testUtils = ReactTestUtils$3.default || ReactTestUtils$3;
module.exports = testUtils;
})();
diff --git a/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js b/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
index cc431e134..deb4cecb6 100644
--- a/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
+++ b/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
@@ -1,33 +1,33 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-test-utils.production.min.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var f=require("object-assign"),h=require("react"),m=require("react-dom"),n=require("fbjs/lib/emptyFunction"),p=require("fbjs/lib/ExecutionEnvironment");
-function q(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);b=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}
-function r(a){var b=a;if(a.alternate)for(;b["return"];)b=b["return"];else{if(0!==(b.effectTag&2))return 1;for(;b["return"];)if(b=b["return"],0!==(b.effectTag&2))return 1}return 3===b.tag?2:3}function t(a){2!==r(a)?q("188"):void 0}
-function u(a){var b=a.alternate;if(!b)return b=r(a),3===b?q("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c["return"],l=e?e.alternate:null;if(!e||!l)break;if(e.child===l.child){for(var g=e.child;g;){if(g===c)return t(e),a;if(g===d)return t(e),b;g=g.sibling}q("188")}if(c["return"]!==d["return"])c=e,d=l;else{g=!1;for(var k=e.child;k;){if(k===c){g=!0;c=e;d=l;break}if(k===d){g=!0;d=e;c=l;break}k=k.sibling}if(!g){for(k=l.child;k;){if(k===c){g=!0;c=l;d=e;break}if(k===d){g=!0;d=l;c=e;break}k=k.sibling}g?
-void 0:q("189")}}c.alternate!==d?q("190"):void 0}3!==c.tag?q("188"):void 0;return c.stateNode.current===c?a:b}var v="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),w={type:null,target:null,currentTarget:n.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
-function x(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?n.thatReturnsTrue:n.thatReturnsFalse;this.isPropagationStopped=n.thatReturnsFalse;return this}
-f(x.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=n.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=n.thatReturnsTrue)},persist:function(){this.isPersistent=n.thatReturnsTrue},isPersistent:n.thatReturnsFalse,
-destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<v.length;a++)this[v[a]]=null}});x.Interface=w;x.augmentClass=function(a,b){function c(){}c.prototype=this.prototype;var d=new c;f(d,a.prototype);a.prototype=d;a.prototype.constructor=a;a.Interface=f({},this.Interface,b);a.augmentClass=this.augmentClass;y(a)};y(x);function z(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}
-function A(a){a instanceof this?void 0:q("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function y(a){a.eventPool=[];a.getPooled=z;a.release=A}function B(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;c["ms"+a]="MS"+b;c["O"+a]="o"+b.toLowerCase();return c}
-var C={animationend:B("Animation","AnimationEnd"),animationiteration:B("Animation","AnimationIteration"),animationstart:B("Animation","AnimationStart"),transitionend:B("Transition","TransitionEnd")},D={},E={};p.canUseDOM&&(E=document.createElement("div").style,"AnimationEvent"in window||(delete C.animationend.animation,delete C.animationiteration.animation,delete C.animationstart.animation),"TransitionEvent"in window||delete C.transitionend.transition);
-function F(a){if(D[a])return D[a];if(!C[a])return a;var b=C[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in E)return D[a]=b[c];return""}
-var G={topLevelTypes:{topAbort:"abort",topAnimationEnd:F("animationend")||"animationend",topAnimationIteration:F("animationiteration")||"animationiteration",topAnimationStart:F("animationstart")||"animationstart",topBlur:"blur",topCancel:"cancel",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",
-topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoad:"load",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",
-topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",
-topTouchStart:"touchstart",topTransitionEnd:F("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"}},H=m.findDOMNode,I=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,J=I.EventPluginHub,K=I.EventPluginRegistry,L=I.EventPropagators,M=I.ReactControlledComponent,N=I.ReactDOMComponentTree,O=I.ReactDOMEventListener,P=G.topLevelTypes;function Q(){}
-function R(a,b){if(!a)return[];a=u(a);if(!a)return[];for(var c=a,d=[];;){if(5===c.tag||6===c.tag||2===c.tag||1===c.tag){var e=c.stateNode;b(e)&&d.push(e)}if(c.child)c.child["return"]=c,c=c.child;else{if(c===a)return d;for(;!c.sibling;){if(!c["return"]||c["return"]===a)return d;c=c["return"]}c.sibling["return"]=c["return"];c=c.sibling}}}
-var S={renderIntoDocument:function(a){var b=document.createElement("div");return m.render(a,b)},isElement:function(a){return h.isValidElement(a)},isElementOfType:function(a,b){return h.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&h.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return S.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
-b){return S.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){if(!a)return[];S.isCompositeComponent(a)?void 0:q("10");return R(a._reactInternalFiber,b)},scryRenderedDOMComponentsWithClass:function(a,b){return S.findAllInRenderedTree(a,function(a){if(S.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var e=c.split(/\s+/);Array.isArray(b)||(void 0===b?q("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==
-e.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){a=S.scryRenderedDOMComponentsWithClass(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for class:"+b);return a[0]},scryRenderedDOMComponentsWithTag:function(a,b){return S.findAllInRenderedTree(a,function(a){return S.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){a=S.scryRenderedDOMComponentsWithTag(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+
-a.length+") for tag:"+b);return a[0]},scryRenderedComponentsWithType:function(a,b){return S.findAllInRenderedTree(a,function(a){return S.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){a=S.scryRenderedComponentsWithType(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for componentType:"+b);return a[0]},mockComponent:function(a,b){b=b||a.mockTagName||"div";a.prototype.render.mockImplementation(function(){return h.createElement(b,
-null,this.props.children)});return this},simulateNativeEventOnNode:function(a,b,c){c.target=b;O.dispatchEvent(a,c)},simulateNativeEventOnDOMComponent:function(a,b,c){S.simulateNativeEventOnNode(a,H(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}};
-function T(a){return function(b,c){h.isValidElement(b)?q("228"):void 0;S.isCompositeComponent(b)?q("229"):void 0;var d=K.eventNameDispatchConfigs[a],e=new Q;e.target=b;e.type=a.toLowerCase();var l=N.getInstanceFromNode(b),g=new x(d,l,e,b);g.persist();f(g,c);d.phasedRegistrationNames?L.accumulateTwoPhaseDispatches(g):L.accumulateDirectDispatches(g);m.unstable_batchedUpdates(function(){M.enqueueStateRestore(b);J.enqueueEvents(g);J.processEventQueue(!0)})}}
-function U(){S.Simulate={};for(var a in K.eventNameDispatchConfigs)S.Simulate[a]=T(a)}var V=J.injection.injectEventPluginOrder;J.injection.injectEventPluginOrder=function(){V.apply(this,arguments);U()};var W=J.injection.injectEventPluginsByName;J.injection.injectEventPluginsByName=function(){W.apply(this,arguments);U()};U();function X(a){return function(b,c){var d=new Q(a);f(d,c);S.isDOMComponent(b)?S.simulateNativeEventOnDOMComponent(a,b,d):b.tagName&&S.simulateNativeEventOnNode(a,b,d)}}
-Object.keys(P).forEach(function(a){var b=0===a.indexOf("top")?a.charAt(3).toLowerCase()+a.substr(4):a;S.SimulateNative[b]=X(a)});var Y=Object.freeze({default:S}),Z=Y&&S||Y;module.exports=Z["default"]?Z["default"]:Z;
+'use strict';var g=require("object-assign"),l=require("react"),m=require("react-dom");function n(a,b,c,e,d,k,f,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var L=[c,e,d,k,f,h],M=0;a=Error(b.replace(/%s/g,function(){return L[M++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
+function p(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,e=0;e<b;e++)c+="&args[]="+encodeURIComponent(arguments[e+1]);n(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}
+function q(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 5===b.tag?2:3}function r(a){2!==q(a)?p("188"):void 0}
+function t(a){var b=a.alternate;if(!b)return b=q(a),3===b?p("188"):void 0,1===b?null:a;for(var c=a,e=b;;){var d=c.return,k=d?d.alternate:null;if(!d||!k)break;if(d.child===k.child){for(var f=d.child;f;){if(f===c)return r(d),a;if(f===e)return r(d),b;f=f.sibling}p("188")}if(c.return!==e.return)c=d,e=k;else{f=!1;for(var h=d.child;h;){if(h===c){f=!0;c=d;e=k;break}if(h===e){f=!0;e=d;c=k;break}h=h.sibling}if(!f){for(h=k.child;h;){if(h===c){f=!0;c=k;e=d;break}if(h===e){f=!0;e=k;c=d;break}h=h.sibling}f?void 0:
+p("189")}}c.alternate!==e?p("190"):void 0}5!==c.tag?p("188"):void 0;return c.stateNode.current===c?a:b}function u(){return!0}function v(){return!1}function w(a,b,c,e){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=e:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?u:v;this.isPropagationStopped=v;return this}
+g(w.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=u)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=u)},persist:function(){this.isPersistent=u},isPersistent:v,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=
+null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=v;this._dispatchInstances=this._dispatchListeners=null}});w.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
+w.extend=function(a){function b(){}function c(){return e.apply(this,arguments)}var e=this;b.prototype=e.prototype;var d=new b;g(d,c.prototype);c.prototype=d;c.prototype.constructor=c;c.Interface=g({},e.Interface,a);c.extend=e.extend;x(c);return c};x(w);function y(a,b,c,e){if(this.eventPool.length){var d=this.eventPool.pop();this.call(d,a,b,c,e);return d}return new this(a,b,c,e)}function z(a){a instanceof this?void 0:p("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}
+function x(a){a.eventPool=[];a.getPooled=y;a.release=z}var A=!("undefined"===typeof window||!window.document||!window.document.createElement);function B(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var C={animationend:B("Animation","AnimationEnd"),animationiteration:B("Animation","AnimationIteration"),animationstart:B("Animation","AnimationStart"),transitionend:B("Transition","TransitionEnd")},D={},E={};
+A&&(E=document.createElement("div").style,"AnimationEvent"in window||(delete C.animationend.animation,delete C.animationiteration.animation,delete C.animationstart.animation),"TransitionEvent"in window||delete C.transitionend.transition);function F(a){if(D[a])return D[a];if(!C[a])return a;var b=C[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in E)return D[a]=b[c];return a}
+var G=F("animationend"),H=F("animationiteration"),I=F("animationstart"),J=F("transitionend"),K=m.findDOMNode,N=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,O=N[0],P=N[4],Q=N[5],R=N[6],S=N[7],aa=N[8],T=N[9],ba=N[10];function U(){}
+function ca(a,b){if(!a)return[];a=t(a);if(!a)return[];for(var c=a,e=[];;){if(7===c.tag||8===c.tag||2===c.tag||3===c.tag||0===c.tag||1===c.tag){var d=c.stateNode;b(d)&&e.push(d)}if(c.child)c.child.return=c,c=c.child;else{if(c===a)return e;for(;!c.sibling;){if(!c.return||c.return===a)return e;c=c.return}c.sibling.return=c.return;c=c.sibling}}}
+function V(a,b){if(a&&!a._reactInternalFiber){var c=""+a;a=Array.isArray(a)?"an array":a&&1===a.nodeType&&a.tagName?"a DOM node":"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c;p("286",b,a)}}
+var W={renderIntoDocument:function(a){var b=document.createElement("div");return m.render(a,b)},isElement:function(a){return l.isValidElement(a)},isElementOfType:function(a,b){return l.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&l.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return W.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
+b){return W.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){V(a,"findAllInRenderedTree");return a?ca(a._reactInternalFiber,b):[]},scryRenderedDOMComponentsWithClass:function(a,b){V(a,"scryRenderedDOMComponentsWithClass");return W.findAllInRenderedTree(a,function(a){if(W.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var d=c.split(/\s+/);Array.isArray(b)||(void 0===b?p("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==
+d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){V(a,"findRenderedDOMComponentWithClass");a=W.scryRenderedDOMComponentsWithClass(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for class:"+b);return a[0]},scryRenderedDOMComponentsWithTag:function(a,b){V(a,"scryRenderedDOMComponentsWithTag");return W.findAllInRenderedTree(a,function(a){return W.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,
+b){V(a,"findRenderedDOMComponentWithTag");a=W.scryRenderedDOMComponentsWithTag(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for tag:"+b);return a[0]},scryRenderedComponentsWithType:function(a,b){V(a,"scryRenderedComponentsWithType");return W.findAllInRenderedTree(a,function(a){return W.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){V(a,"findRenderedComponentWithType");a=W.scryRenderedComponentsWithType(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+
+a.length+") for componentType:"+b);return a[0]},mockComponent:function(a,b){b=b||a.mockTagName||"div";a.prototype.render.mockImplementation(function(){return l.createElement(b,null,this.props.children)});return this},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}};
+function da(a){return function(b,c){l.isValidElement(b)?p("228"):void 0;W.isCompositeComponent(b)?p("229"):void 0;var e=P[a],d=new U;d.target=b;d.type=a.toLowerCase();var k=O(b),f=new w(e,k,d,b);f.persist();g(f,c);e.phasedRegistrationNames?Q(f):R(f);m.unstable_batchedUpdates(function(){S(b);ba(f,!0)});aa()}}W.Simulate={};var X=void 0;for(X in P)W.Simulate[X]=da(X);
+function ea(a,b){return function(c,e){var d=new U(a);g(d,e);W.isDOMComponent(c)?(c=K(c),d.target=c,T(b,d)):c.tagName&&(d.target=c,T(b,d))}}
+[["abort","abort"],[G,"animationEnd"],[H,"animationIteration"],[I,"animationStart"],["blur","blur"],["canplaythrough","canPlayThrough"],["canplay","canPlay"],["cancel","cancel"],["change","change"],["click","click"],["close","close"],["compositionend","compositionEnd"],["compositionstart","compositionStart"],["compositionupdate","compositionUpdate"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragenter","dragEnter"],["dragexit","dragExit"],
+["dragleave","dragLeave"],["dragover","dragOver"],["dragstart","dragStart"],["drag","drag"],["drop","drop"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["focus","focus"],["input","input"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["loadstart","loadStart"],["loadstart","loadStart"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["mousedown","mouseDown"],["mousemove","mouseMove"],
+["mouseout","mouseOut"],["mouseover","mouseOver"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["playing","playing"],["progress","progress"],["ratechange","rateChange"],["scroll","scroll"],["seeked","seeked"],["seeking","seeking"],["selectionchange","selectionChange"],["stalled","stalled"],["suspend","suspend"],["textInput","textInput"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchmove","touchMove"],["touchstart",
+"touchStart"],[J,"transitionEnd"],["volumechange","volumeChange"],["waiting","waiting"],["wheel","wheel"]].forEach(function(a){var b=a[1];W.SimulateNative[b]=ea(b,a[0])});var Y={default:W},Z=Y&&W||Y;module.exports=Z.default||Z;
diff --git a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
index 21327c077..febe1d719 100644
--- a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
+++ b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-unstable-native-dependencies.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -16,18 +16,53 @@ if (process.env.NODE_ENV !== "production") {
'use strict';
var ReactDOM = require('react-dom');
-var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
var _assign = require('object-assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
*/
+var validateFormat = function () {};
+
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
+}
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
+
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
+
{
// In DEV mode, we swap out invokeGuardedCallback for a special version
// that plays more nicely with the browser's DevTools. The idea is to preserve
@@ -57,34 +92,141 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
}
}
-var getFiberCurrentPropsFromNode = null;
-var getInstanceFromNode = null;
-var getNodeFromInstance = null;
+/**
+ * Call a function while guarding against errors that happens within it.
+ * Returns an error if it throws, otherwise null.
+ *
+ * In production, this is implemented using a try-catch. The reason we don't
+ * use a try-catch directly is so that we can swap out a different
+ * implementation in DEV mode.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
-var injection = {
- injectComponentTree: function (Injected) {
- getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
- getInstanceFromNode = Injected.getInstanceFromNode;
- getNodeFromInstance = Injected.getNodeFromInstance;
- {
- warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
+/**
+ * Same as invokeGuardedCallback, but instead of returning an error, it stores
+ * it in a global so it can be rethrown by `rethrowCaughtError` later.
+ * TODO: See if caughtError and rethrowError can be unified.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+
+
+/**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warningWithoutStack = function () {};
+
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- }
-};
-function isEndish(topLevelType) {
- return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
}
-function isMoveish(topLevelType) {
- return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
-}
-function isStartish(topLevelType) {
- return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
+var warningWithoutStack$1 = warningWithoutStack;
+
+var getFiberCurrentPropsFromNode$1 = null;
+var getInstanceFromNode$1 = null;
+var getNodeFromInstance$1 = null;
+
+function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
+ getFiberCurrentPropsFromNode$1 = getFiberCurrentPropsFromNodeImpl;
+ getInstanceFromNode$1 = getInstanceFromNodeImpl;
+ getNodeFromInstance$1 = getNodeFromInstanceImpl;
+ {
+ !(getNodeFromInstance$1 && getInstanceFromNode$1) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
+ }
}
-var validateEventDispatches;
+var validateEventDispatches = void 0;
{
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
@@ -96,7 +238,7 @@ var validateEventDispatches;
var instancesIsArr = Array.isArray(dispatchInstances);
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
- warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.');
+ !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
@@ -162,7 +304,7 @@ function executeDirectDispatch(event) {
var dispatchListener = event._dispatchListeners;
var dispatchInstance = event._dispatchInstances;
!!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
- event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
+ event.currentTarget = dispatchListener ? getNodeFromInstance$1(dispatchInstance) : null;
var res = dispatchListener ? dispatchListener(event) : null;
event.currentTarget = null;
event._dispatchListeners = null;
@@ -179,15 +321,13 @@ function hasDispatches(event) {
}
// Before we know whether it is functional or class
-
-
// Root of a host tree. Could be nested inside another node.
// A subtree. Could be an entry point to a different renderer.
-var HostComponent = 5;
+var HostComponent = 7;
function getParent(inst) {
do {
- inst = inst['return'];
+ inst = inst.return;
// TODO: If this is a HostRoot we might want to bail out.
// That is depending on if we want nested subtrees (layers) to bubble
// events to their parent. We could also go through parentNode on the
@@ -267,7 +407,7 @@ function traverseTwoPhase(inst, fn, arg) {
path.push(inst);
inst = getParent(inst);
}
- var i;
+ var i = void 0;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
@@ -453,7 +593,7 @@ function shouldPreventMouseEvent(name, type, props) {
* @return {?function} The stored callback.
*/
function getListener(inst, registrationName) {
- var listener;
+ var listener = void 0;
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
@@ -462,7 +602,7 @@ function getListener(inst, registrationName) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
- var props = getFiberCurrentPropsFromNode(stateNode);
+ var props = getFiberCurrentPropsFromNode$1(stateNode);
if (!props) {
// Work in progress.
return null;
@@ -476,30 +616,6 @@ function getListener(inst, registrationName) {
}
/**
- * Allows registered plugins an opportunity to extract events from top-level
- * native browser events.
- *
- * @return {*} An accumulation of synthetic events.
- * @internal
- */
-
-
-/**
- * Enqueues a synthetic event that should be dispatched when
- * `processEventQueue` is invoked.
- *
- * @param {*} events An accumulation of synthetic events.
- * @internal
- */
-
-
-/**
- * Dispatches all synthetic events on the event queue.
- *
- * @internal
- */
-
-/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
@@ -526,7 +642,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
*/
function accumulateDirectionalDispatches(inst, phase, event) {
{
- warning(inst, 'Dispatching inst must not be null');
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
}
var listener = listenerAtPhase(inst, event, phase);
if (listener) {
@@ -602,12 +718,8 @@ function accumulateDirectDispatches(events) {
/* eslint valid-typeof: 0 */
-var didWarnForAddedNewProperty = false;
-var isProxySupported = typeof Proxy === 'function';
var EVENT_POOL_SIZE = 10;
-var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
-
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -616,7 +728,9 @@ var EventInterface = {
type: null,
target: null,
// currentTarget is set when dispatching; no use in copying it here
- currentTarget: emptyFunction.thatReturnsNull,
+ currentTarget: function () {
+ return null;
+ },
eventPhase: null,
bubbles: null,
cancelable: null,
@@ -627,6 +741,14 @@ var EventInterface = {
isTrusted: null
};
+function functionThatReturnsTrue() {
+ return true;
+}
+
+function functionThatReturnsFalse() {
+ return false;
+}
+
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
@@ -651,6 +773,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
+ delete this.isDefaultPrevented;
+ delete this.isPropagationStopped;
}
this.dispatchConfig = dispatchConfig;
@@ -679,11 +803,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
} else {
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
+ this.isDefaultPrevented = functionThatReturnsFalse;
}
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
@@ -700,7 +824,7 @@ _assign(SyntheticEvent.prototype, {
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
},
stopPropagation: function () {
@@ -720,7 +844,7 @@ _assign(SyntheticEvent.prototype, {
event.cancelBubble = true;
}
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
+ this.isPropagationStopped = functionThatReturnsTrue;
},
/**
@@ -729,7 +853,7 @@ _assign(SyntheticEvent.prototype, {
* won't be added back into the pool.
*/
persist: function () {
- this.isPersistent = emptyFunction.thatReturnsTrue;
+ this.isPersistent = functionThatReturnsTrue;
},
/**
@@ -737,7 +861,7 @@ _assign(SyntheticEvent.prototype, {
*
* @return {boolean} True if this should not be released, false otherwise.
*/
- isPersistent: emptyFunction.thatReturnsFalse,
+ isPersistent: functionThatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
@@ -749,13 +873,19 @@ _assign(SyntheticEvent.prototype, {
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
}
}
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
- this[shouldBeReleasedProperties[i]] = null;
- }
+ this.dispatchConfig = null;
+ this._targetInst = null;
+ this.nativeEvent = null;
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
+ this._dispatchListeners = null;
+ this._dispatchInstances = null;
{
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
}
}
});
@@ -764,53 +894,27 @@ SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
- *
- * @param {function} Class
- * @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function (Class, Interface) {
+SyntheticEvent.extend = function (Interface) {
var Super = this;
var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();
+ function Class() {
+ return Super.apply(this, arguments);
+ }
_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = _assign({}, Super.Interface, Interface);
- Class.augmentClass = Super.augmentClass;
+ Class.extend = Super.extend;
addEventPoolingTo(Class);
-};
-/** Proxying after everything set on SyntheticEvent
- * to resolve Proxy issue on some WebKit browsers
- * in which some Event properties are set to undefined (GH#10010)
- */
-{
- if (isProxySupported) {
- /*eslint-disable no-func-assign */
- SyntheticEvent = new Proxy(SyntheticEvent, {
- construct: function (target, args) {
- return this.apply(target, Object.create(target.prototype), args);
- },
- apply: function (constructor, that, args) {
- return new Proxy(constructor.apply(that, args), {
- set: function (target, prop, value) {
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
- warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.');
- didWarnForAddedNewProperty = true;
- }
- target[prop] = value;
- return true;
- }
- });
- }
- });
- /*eslint-enable no-func-assign */
- }
-}
+ return Class;
+};
addEventPoolingTo(SyntheticEvent);
@@ -844,7 +948,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
function warn(action, result) {
var warningCondition = false;
- warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
@@ -860,7 +964,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
function releasePooledEvent(event) {
var EventConstructor = this;
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
event.destructor();
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
EventConstructor.eventPool.push(event);
@@ -873,30 +977,45 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent;
}
-var SyntheticEvent$1 = SyntheticEvent;
-
/**
* `touchHistory` isn't actually on the native event, but putting it in the
* interface will ensure that it is cleaned up when pooled/destroyed. The
* `ResponderEventPlugin` will populate it appropriately.
*/
-var ResponderEventInterface = {
+var ResponderSyntheticEvent = SyntheticEvent.extend({
touchHistory: function (nativeEvent) {
return null; // Actually doesn't even look at the native event.
}
-};
+});
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native event.
- * @extends {SyntheticEvent}
- */
-function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+// Note: ideally these would be imported from DOMTopLevelEventTypes,
+// but our build system currently doesn't let us do that from a fork.
+
+var TOP_TOUCH_START = 'touchstart';
+var TOP_TOUCH_MOVE = 'touchmove';
+var TOP_TOUCH_END = 'touchend';
+var TOP_TOUCH_CANCEL = 'touchcancel';
+var TOP_SCROLL = 'scroll';
+var TOP_SELECTION_CHANGE = 'selectionchange';
+var TOP_MOUSE_DOWN = 'mousedown';
+var TOP_MOUSE_MOVE = 'mousemove';
+var TOP_MOUSE_UP = 'mouseup';
+
+function isStartish(topLevelType) {
+ return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
}
-SyntheticEvent$1.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
+function isMoveish(topLevelType) {
+ return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
+}
+
+function isEndish(topLevelType) {
+ return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL || topLevelType === TOP_MOUSE_UP;
+}
+
+var startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
+var moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
+var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
/**
* Tracks the position and time of each active touch by `touch.identifier`. We
@@ -961,7 +1080,7 @@ function getTouchIdentifier(_ref) {
!(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
{
- warning(identifier <= MAX_TOUCH_BANK, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK);
+ !(identifier <= MAX_TOUCH_BANK) ? warningWithoutStack$1(false, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
}
return identifier;
}
@@ -1049,7 +1168,7 @@ var ResponderTouchHistoryStore = {
}
{
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
- warning(activeRecord != null && activeRecord.touchActive, 'Cannot find single active touch.');
+ !(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
}
}
}
@@ -1098,11 +1217,6 @@ var responderInst = null;
*/
var trackedTouchCount = 0;
-/**
- * Last reported number of active touches.
- */
-var previousActiveTouches = 0;
-
var changeResponder = function (nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst;
responderInst = nextResponderInst;
@@ -1120,7 +1234,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onStartShouldSetResponder',
captured: 'onStartShouldSetResponderCapture'
- }
+ },
+ dependencies: startDependencies
},
/**
@@ -1136,7 +1251,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onScrollShouldSetResponder',
captured: 'onScrollShouldSetResponderCapture'
- }
+ },
+ dependencies: [TOP_SCROLL]
},
/**
@@ -1150,7 +1266,8 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onSelectionChangeShouldSetResponder',
captured: 'onSelectionChangeShouldSetResponderCapture'
- }
+ },
+ dependencies: [TOP_SELECTION_CHANGE]
},
/**
@@ -1161,22 +1278,45 @@ var eventTypes = {
phasedRegistrationNames: {
bubbled: 'onMoveShouldSetResponder',
captured: 'onMoveShouldSetResponderCapture'
- }
+ },
+ dependencies: moveDependencies
},
/**
* Direct responder events dispatched directly to responder. Do not bubble.
*/
- responderStart: { registrationName: 'onResponderStart' },
- responderMove: { registrationName: 'onResponderMove' },
- responderEnd: { registrationName: 'onResponderEnd' },
- responderRelease: { registrationName: 'onResponderRelease' },
+ responderStart: {
+ registrationName: 'onResponderStart',
+ dependencies: startDependencies
+ },
+ responderMove: {
+ registrationName: 'onResponderMove',
+ dependencies: moveDependencies
+ },
+ responderEnd: {
+ registrationName: 'onResponderEnd',
+ dependencies: endDependencies
+ },
+ responderRelease: {
+ registrationName: 'onResponderRelease',
+ dependencies: endDependencies
+ },
responderTerminationRequest: {
- registrationName: 'onResponderTerminationRequest'
+ registrationName: 'onResponderTerminationRequest',
+ dependencies: []
},
- responderGrant: { registrationName: 'onResponderGrant' },
- responderReject: { registrationName: 'onResponderReject' },
- responderTerminate: { registrationName: 'onResponderTerminate' }
+ responderGrant: {
+ registrationName: 'onResponderGrant',
+ dependencies: []
+ },
+ responderReject: {
+ registrationName: 'onResponderReject',
+ dependencies: []
+ },
+ responderTerminate: {
+ registrationName: 'onResponderTerminate',
+ dependencies: []
+ }
};
/**
@@ -1370,7 +1510,7 @@ to return true:wantsResponderID| |
*/
function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === 'topSelectionChange' ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
+ var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
// TODO: stop one short of the current responder.
var bubbleShouldSetFrom = !responderInst ? targetInst : getLowestCommonAncestor(responderInst, targetInst);
@@ -1395,7 +1535,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
if (!wantsResponderInst || wantsResponderInst === responderInst) {
return null;
}
- var extracted;
+ var extracted = void 0;
var grantEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget);
grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
@@ -1442,7 +1582,7 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
// responderIgnoreScroll: We are trying to migrate away from specifically
// tracking native scroll events here and responderIgnoreScroll indicates we
// will send topTouchCancel to handle canceling touch events instead
- topLevelType === 'topScroll' && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === 'topSelectionChange' || isStartish(topLevelType) || isMoveish(topLevelType));
+ topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE || isStartish(topLevelType) || isMoveish(topLevelType));
}
/**
@@ -1462,7 +1602,7 @@ function noResponderTouches(nativeEvent) {
var target = activeTouch.target;
if (target !== null && target !== undefined && target !== 0) {
// Is the original touch location inside of the current responder?
- var targetInst = getInstanceFromNode(target);
+ var targetInst = getInstanceFromNode$1(target);
if (isAncestor(responderInst, targetInst)) {
return false;
}
@@ -1521,7 +1661,7 @@ var ResponderEventPlugin = {
extracted = accumulate(extracted, gesture);
}
- var isResponderTerminate = responderInst && topLevelType === 'topTouchCancel';
+ var isResponderTerminate = responderInst && topLevelType === TOP_TOUCH_CANCEL;
var isResponderRelease = responderInst && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
if (finalTouch) {
@@ -1532,17 +1672,10 @@ var ResponderEventPlugin = {
changeResponder(null);
}
- var numberActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
- if (ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches) {
- ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches);
- }
- previousActiveTouches = numberActiveTouches;
-
return extracted;
},
GlobalResponderHandler: null,
- GlobalInteractionHandler: null,
injection: {
/**
@@ -1552,29 +1685,27 @@ var ResponderEventPlugin = {
*/
injectGlobalResponderHandler: function (GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
- },
-
- /**
- * @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
- * Object that handles any change in the number of active touches.
- */
- injectGlobalInteractionHandler: function (GlobalInteractionHandler) {
- ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
}
}
};
-// This is used by react-native-web.
-var injectComponentTree = injection.injectComponentTree;
// Inject react-dom's ComponentTree into this module.
-var ReactDOMComponentTree = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree;
+// Keep in sync with ReactDOM.js and ReactTestUtils.js:
+var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
+var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
+var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
+var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
+var injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
+
+
+setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
+
-injectComponentTree(ReactDOMComponentTree);
var ReactDOMUnstableNativeDependencies = Object.freeze({
- injectComponentTree: injectComponentTree,
ResponderEventPlugin: ResponderEventPlugin,
- ResponderTouchHistoryStore: ResponderTouchHistoryStore
+ ResponderTouchHistoryStore: ResponderTouchHistoryStore,
+ injectEventPluginsByName: injectEventPluginsByName
});
var unstableNativeDependencies = ReactDOMUnstableNativeDependencies;
diff --git a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js
index b543865b9..efd5d4e71 100644
--- a/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js
+++ b/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js
@@ -1,35 +1,36 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom-unstable-native-dependencies.production.min.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-'use strict';var h=require("react-dom"),k=require("object-assign"),l=require("fbjs/lib/emptyFunction");
-function n(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,f=0;f<b;f++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[f+1]);b=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}var p=null,q=null,t=null;
-function u(a){return"topMouseUp"===a||"topTouchEnd"===a||"topTouchCancel"===a}function v(a){return"topMouseMove"===a||"topTouchMove"===a}function w(a){return"topMouseDown"===a||"topTouchStart"===a}function x(a){var b=a._dispatchListeners,c=a._dispatchInstances;Array.isArray(b)?n("103"):void 0;a.currentTarget=b?t(c):null;b=b?b(a):null;a.currentTarget=null;a._dispatchListeners=null;a._dispatchInstances=null;return b}function y(a){do a=a["return"];while(a&&5!==a.tag);return a?a:null}
-function z(a,b,c){for(var f=[];a;)f.push(a),a=y(a);for(a=f.length;0<a--;)b(f[a],"captured",c);for(a=0;a<f.length;a++)b(f[a],"bubbled",c)}function A(a,b){null==b?n("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function B(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}
-function C(a,b){var c=a.stateNode;if(!c)return null;var f=p(c);if(!f)return null;c=f[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(f=!f.disabled)||(a=a.type,f=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!f;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?n("231",b,typeof c):void 0;
-return c}function D(a,b,c){if(b=C(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=A(c._dispatchListeners,b),c._dispatchInstances=A(c._dispatchInstances,a)}function E(a){a&&a.dispatchConfig.phasedRegistrationNames&&z(a._targetInst,D,a)}function aa(a){if(a&&a.dispatchConfig.phasedRegistrationNames){var b=a._targetInst;b=b?y(b):null;z(b,D,a)}}
-function F(a){if(a&&a.dispatchConfig.registrationName){var b=a._targetInst;if(b&&a&&a.dispatchConfig.registrationName){var c=C(b,a.dispatchConfig.registrationName);c&&(a._dispatchListeners=A(a._dispatchListeners,c),a._dispatchInstances=A(a._dispatchInstances,b))}}}
-var G="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),ba={type:null,target:null,currentTarget:l.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
-function H(a,b,c,f){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=f:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?l.thatReturnsTrue:l.thatReturnsFalse;this.isPropagationStopped=l.thatReturnsFalse;return this}
-k(H.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=l.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=l.thatReturnsTrue)},persist:function(){this.isPersistent=l.thatReturnsTrue},isPersistent:l.thatReturnsFalse,
-destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<G.length;a++)this[G[a]]=null}});H.Interface=ba;H.augmentClass=function(a,b){function c(){}c.prototype=this.prototype;var f=new c;k(f,a.prototype);a.prototype=f;a.prototype.constructor=a;a.Interface=k({},this.Interface,b);a.augmentClass=this.augmentClass;I(a)};I(H);function ca(a,b,c,f){if(this.eventPool.length){var d=this.eventPool.pop();this.call(d,a,b,c,f);return d}return new this(a,b,c,f)}
-function da(a){a instanceof this?void 0:n("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function I(a){a.eventPool=[];a.getPooled=ca;a.release=da}function J(a,b,c,f){return H.call(this,a,b,c,f)}H.augmentClass(J,{touchHistory:function(){return null}});var L=[],M={touchBank:L,numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0};function N(a){return a.timeStamp||a.timestamp}function O(a){a=a.identifier;null==a?n("138"):void 0;return a}
-function ea(a){var b=O(a),c=L[b];c?(c.touchActive=!0,c.startPageX=a.pageX,c.startPageY=a.pageY,c.startTimeStamp=N(a),c.currentPageX=a.pageX,c.currentPageY=a.pageY,c.currentTimeStamp=N(a),c.previousPageX=a.pageX,c.previousPageY=a.pageY,c.previousTimeStamp=N(a)):(c={touchActive:!0,startPageX:a.pageX,startPageY:a.pageY,startTimeStamp:N(a),currentPageX:a.pageX,currentPageY:a.pageY,currentTimeStamp:N(a),previousPageX:a.pageX,previousPageY:a.pageY,previousTimeStamp:N(a)},L[b]=c);M.mostRecentTimeStamp=N(a)}
-function fa(a){var b=L[O(a)];b?(b.touchActive=!0,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=N(a),M.mostRecentTimeStamp=N(a)):console.error("Cannot record touch move without a touch start.\nTouch Move: %s\n","Touch Bank: %s",P(a),Q())}
-function ha(a){var b=L[O(a)];b?(b.touchActive=!1,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=N(a),M.mostRecentTimeStamp=N(a)):console.error("Cannot record touch end without a touch start.\nTouch End: %s\n","Touch Bank: %s",P(a),Q())}function P(a){return JSON.stringify({identifier:a.identifier,pageX:a.pageX,pageY:a.pageY,timestamp:N(a)})}
-function Q(){var a=JSON.stringify(L.slice(0,20));20<L.length&&(a+=" (original size: "+L.length+")");return a}
-var R={recordTouchTrack:function(a,b){if(v(a))b.changedTouches.forEach(fa);else if(w(a))b.changedTouches.forEach(ea),M.numberActiveTouches=b.touches.length,1===M.numberActiveTouches&&(M.indexOfSingleActiveTouch=b.touches[0].identifier);else if(u(a)&&(b.changedTouches.forEach(ha),M.numberActiveTouches=b.touches.length,1===M.numberActiveTouches))for(a=0;a<L.length;a++)if(b=L[a],null!=b&&b.touchActive){M.indexOfSingleActiveTouch=a;break}},touchHistory:M};
-function S(a,b){null==b?n("29"):void 0;return null==a?b:Array.isArray(a)?a.concat(b):Array.isArray(b)?[a].concat(b):[a,b]}var T=null,U=0,V=0;function W(a,b){var c=T;T=a;if(null!==X.GlobalResponderHandler)X.GlobalResponderHandler.onChange(c,a,b)}
-var Y={startShouldSetResponder:{phasedRegistrationNames:{bubbled:"onStartShouldSetResponder",captured:"onStartShouldSetResponderCapture"}},scrollShouldSetResponder:{phasedRegistrationNames:{bubbled:"onScrollShouldSetResponder",captured:"onScrollShouldSetResponderCapture"}},selectionChangeShouldSetResponder:{phasedRegistrationNames:{bubbled:"onSelectionChangeShouldSetResponder",captured:"onSelectionChangeShouldSetResponderCapture"}},moveShouldSetResponder:{phasedRegistrationNames:{bubbled:"onMoveShouldSetResponder",
-captured:"onMoveShouldSetResponderCapture"}},responderStart:{registrationName:"onResponderStart"},responderMove:{registrationName:"onResponderMove"},responderEnd:{registrationName:"onResponderEnd"},responderRelease:{registrationName:"onResponderRelease"},responderTerminationRequest:{registrationName:"onResponderTerminationRequest"},responderGrant:{registrationName:"onResponderGrant"},responderReject:{registrationName:"onResponderReject"},responderTerminate:{registrationName:"onResponderTerminate"}},
-X={_getResponder:function(){return T},eventTypes:Y,extractEvents:function(a,b,c,f){if(w(a))U+=1;else if(u(a))if(0<=U)--U;else return console.error("Ended a touch event which was not counted in `trackedTouchCount`."),null;R.recordTouchTrack(a,c);if(b&&("topScroll"===a&&!c.responderIgnoreScroll||0<U&&"topSelectionChange"===a||w(a)||v(a))){var d=w(a)?Y.startShouldSetResponder:v(a)?Y.moveShouldSetResponder:"topSelectionChange"===a?Y.selectionChangeShouldSetResponder:Y.scrollShouldSetResponder;if(T)b:{var e=
-T;for(var g=0,r=e;r;r=y(r))g++;r=0;for(var K=b;K;K=y(K))r++;for(;0<g-r;)e=y(e),g--;for(;0<r-g;)b=y(b),r--;for(;g--;){if(e===b||e===b.alternate)break b;e=y(e);b=y(b)}e=null}else e=b;b=e===T;e=J.getPooled(d,e,c,f);e.touchHistory=R.touchHistory;b?B(e,aa):B(e,E);b:{d=e._dispatchListeners;b=e._dispatchInstances;if(Array.isArray(d))for(g=0;g<d.length&&!e.isPropagationStopped();g++){if(d[g](e,b[g])){d=b[g];break b}}else if(d&&d(e,b)){d=b;break b}d=null}e._dispatchInstances=null;e._dispatchListeners=null;
-e.isPersistent()||e.constructor.release(e);if(d&&d!==T)if(e=J.getPooled(Y.responderGrant,d,c,f),e.touchHistory=R.touchHistory,B(e,F),b=!0===x(e),T)if(g=J.getPooled(Y.responderTerminationRequest,T,c,f),g.touchHistory=R.touchHistory,B(g,F),r=!g._dispatchListeners||x(g),g.isPersistent()||g.constructor.release(g),r){g=J.getPooled(Y.responderTerminate,T,c,f);g.touchHistory=R.touchHistory;B(g,F);var m=S(m,[e,g]);W(d,b)}else d=J.getPooled(Y.responderReject,d,c,f),d.touchHistory=R.touchHistory,B(d,F),m=S(m,
-d);else m=S(m,e),W(d,b);else m=null}else m=null;d=T&&w(a);e=T&&v(a);b=T&&u(a);if(d=d?Y.responderStart:e?Y.responderMove:b?Y.responderEnd:null)d=J.getPooled(d,T,c,f),d.touchHistory=R.touchHistory,B(d,F),m=S(m,d);d=T&&"topTouchCancel"===a;if(a=T&&!d&&u(a))a:{if((a=c.touches)&&0!==a.length)for(e=0;e<a.length;e++)if(b=a[e].target,null!==b&&void 0!==b&&0!==b){g=q(b);b:{for(b=T;g;){if(b===g||b===g.alternate){b=!0;break b}g=y(g)}b=!1}if(b){a=!1;break a}}a=!0}if(a=d?Y.responderTerminate:a?Y.responderRelease:
-null)c=J.getPooled(a,T,c,f),c.touchHistory=R.touchHistory,B(c,F),m=S(m,c),W(null);c=R.touchHistory.numberActiveTouches;if(X.GlobalInteractionHandler&&c!==V)X.GlobalInteractionHandler.onChange(c);V=c;return m},GlobalResponderHandler:null,GlobalInteractionHandler:null,injection:{injectGlobalResponderHandler:function(a){X.GlobalResponderHandler=a},injectGlobalInteractionHandler:function(a){X.GlobalInteractionHandler=a}}};
-function Z(a){p=a.getFiberCurrentPropsFromNode;q=a.getInstanceFromNode;t=a.getNodeFromInstance}Z(h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree);var ia=Object.freeze({injectComponentTree:Z,ResponderEventPlugin:X,ResponderTouchHistoryStore:R});module.exports=ia;
+'use strict';var k=require("react-dom"),l=require("object-assign");function aa(a,b,c,f,e,d,g,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[c,f,e,d,g,h],ba=0;a=Error(b.replace(/%s/g,function(){return u[ba++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
+function m(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,f=0;f<b;f++)c+="&args[]="+encodeURIComponent(arguments[f+1]);aa(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}var n=null,p=null,q=null;
+function r(a){var b=a._dispatchListeners,c=a._dispatchInstances;Array.isArray(b)?m("103"):void 0;a.currentTarget=b?q(c):null;b=b?b(a):null;a.currentTarget=null;a._dispatchListeners=null;a._dispatchInstances=null;return b}function t(a){do a=a.return;while(a&&7!==a.tag);return a?a:null}function v(a,b,c){for(var f=[];a;)f.push(a),a=t(a);for(a=f.length;0<a--;)b(f[a],"captured",c);for(a=0;a<f.length;a++)b(f[a],"bubbled",c)}
+function w(a,b){null==b?m("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function x(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}
+function y(a,b){var c=a.stateNode;if(!c)return null;var f=n(c);if(!f)return null;c=f[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(f=!f.disabled)||(a=a.type,f=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!f;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?m("231",b,typeof c):void 0;
+return c}function z(a,b,c){if(b=y(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=w(c._dispatchListeners,b),c._dispatchInstances=w(c._dispatchInstances,a)}function ca(a){a&&a.dispatchConfig.phasedRegistrationNames&&v(a._targetInst,z,a)}function da(a){if(a&&a.dispatchConfig.phasedRegistrationNames){var b=a._targetInst;b=b?t(b):null;v(b,z,a)}}
+function A(a){if(a&&a.dispatchConfig.registrationName){var b=a._targetInst;if(b&&a&&a.dispatchConfig.registrationName){var c=y(b,a.dispatchConfig.registrationName);c&&(a._dispatchListeners=w(a._dispatchListeners,c),a._dispatchInstances=w(a._dispatchInstances,b))}}}function B(){return!0}function C(){return!1}
+function D(a,b,c,f){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=f:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?B:C;this.isPropagationStopped=C;return this}
+l(D.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=B)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=B)},persist:function(){this.isPersistent=B},isPersistent:C,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=
+null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=C;this._dispatchInstances=this._dispatchListeners=null}});D.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
+D.extend=function(a){function b(){}function c(){return f.apply(this,arguments)}var f=this;b.prototype=f.prototype;var e=new b;l(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=l({},f.Interface,a);c.extend=f.extend;E(c);return c};E(D);function ea(a,b,c,f){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,f);return e}return new this(a,b,c,f)}function fa(a){a instanceof this?void 0:m("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}
+function E(a){a.eventPool=[];a.getPooled=ea;a.release=fa}var F=D.extend({touchHistory:function(){return null}});function G(a){return"touchstart"===a||"mousedown"===a}function H(a){return"touchmove"===a||"mousemove"===a}function I(a){return"touchend"===a||"touchcancel"===a||"mouseup"===a}var J=["touchstart","mousedown"],K=["touchmove","mousemove"],L=["touchcancel","touchend","mouseup"],M=[],N={touchBank:M,numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0};
+function O(a){return a.timeStamp||a.timestamp}function P(a){a=a.identifier;null==a?m("138"):void 0;return a}
+function ha(a){var b=P(a),c=M[b];c?(c.touchActive=!0,c.startPageX=a.pageX,c.startPageY=a.pageY,c.startTimeStamp=O(a),c.currentPageX=a.pageX,c.currentPageY=a.pageY,c.currentTimeStamp=O(a),c.previousPageX=a.pageX,c.previousPageY=a.pageY,c.previousTimeStamp=O(a)):(c={touchActive:!0,startPageX:a.pageX,startPageY:a.pageY,startTimeStamp:O(a),currentPageX:a.pageX,currentPageY:a.pageY,currentTimeStamp:O(a),previousPageX:a.pageX,previousPageY:a.pageY,previousTimeStamp:O(a)},M[b]=c);N.mostRecentTimeStamp=O(a)}
+function ia(a){var b=M[P(a)];b?(b.touchActive=!0,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=O(a),N.mostRecentTimeStamp=O(a)):console.error("Cannot record touch move without a touch start.\nTouch Move: %s\n","Touch Bank: %s",Q(a),R())}
+function ja(a){var b=M[P(a)];b?(b.touchActive=!1,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=O(a),N.mostRecentTimeStamp=O(a)):console.error("Cannot record touch end without a touch start.\nTouch End: %s\n","Touch Bank: %s",Q(a),R())}function Q(a){return JSON.stringify({identifier:a.identifier,pageX:a.pageX,pageY:a.pageY,timestamp:O(a)})}
+function R(){var a=JSON.stringify(M.slice(0,20));20<M.length&&(a+=" (original size: "+M.length+")");return a}
+var S={recordTouchTrack:function(a,b){if(H(a))b.changedTouches.forEach(ia);else if(G(a))b.changedTouches.forEach(ha),N.numberActiveTouches=b.touches.length,1===N.numberActiveTouches&&(N.indexOfSingleActiveTouch=b.touches[0].identifier);else if(I(a)&&(b.changedTouches.forEach(ja),N.numberActiveTouches=b.touches.length,1===N.numberActiveTouches))for(a=0;a<M.length;a++)if(b=M[a],null!=b&&b.touchActive){N.indexOfSingleActiveTouch=a;break}},touchHistory:N};
+function T(a,b){null==b?m("29"):void 0;return null==a?b:Array.isArray(a)?a.concat(b):Array.isArray(b)?[a].concat(b):[a,b]}var U=null,V=0;function W(a,b){var c=U;U=a;if(null!==X.GlobalResponderHandler)X.GlobalResponderHandler.onChange(c,a,b)}
+var Y={startShouldSetResponder:{phasedRegistrationNames:{bubbled:"onStartShouldSetResponder",captured:"onStartShouldSetResponderCapture"},dependencies:J},scrollShouldSetResponder:{phasedRegistrationNames:{bubbled:"onScrollShouldSetResponder",captured:"onScrollShouldSetResponderCapture"},dependencies:["scroll"]},selectionChangeShouldSetResponder:{phasedRegistrationNames:{bubbled:"onSelectionChangeShouldSetResponder",captured:"onSelectionChangeShouldSetResponderCapture"},dependencies:["selectionchange"]},
+moveShouldSetResponder:{phasedRegistrationNames:{bubbled:"onMoveShouldSetResponder",captured:"onMoveShouldSetResponderCapture"},dependencies:K},responderStart:{registrationName:"onResponderStart",dependencies:J},responderMove:{registrationName:"onResponderMove",dependencies:K},responderEnd:{registrationName:"onResponderEnd",dependencies:L},responderRelease:{registrationName:"onResponderRelease",dependencies:L},responderTerminationRequest:{registrationName:"onResponderTerminationRequest",dependencies:[]},
+responderGrant:{registrationName:"onResponderGrant",dependencies:[]},responderReject:{registrationName:"onResponderReject",dependencies:[]},responderTerminate:{registrationName:"onResponderTerminate",dependencies:[]}},X={_getResponder:function(){return U},eventTypes:Y,extractEvents:function(a,b,c,f){if(G(a))V+=1;else if(I(a))if(0<=V)--V;else return console.error("Ended a touch event which was not counted in `trackedTouchCount`."),null;S.recordTouchTrack(a,c);if(b&&("scroll"===a&&!c.responderIgnoreScroll||
+0<V&&"selectionchange"===a||G(a)||H(a))){var e=G(a)?Y.startShouldSetResponder:H(a)?Y.moveShouldSetResponder:"selectionchange"===a?Y.selectionChangeShouldSetResponder:Y.scrollShouldSetResponder;if(U)b:{var d=U;for(var g=0,h=d;h;h=t(h))g++;h=0;for(var u=b;u;u=t(u))h++;for(;0<g-h;)d=t(d),g--;for(;0<h-g;)b=t(b),h--;for(;g--;){if(d===b||d===b.alternate)break b;d=t(d);b=t(b)}d=null}else d=b;b=d===U;d=F.getPooled(e,d,c,f);d.touchHistory=S.touchHistory;b?x(d,da):x(d,ca);b:{e=d._dispatchListeners;b=d._dispatchInstances;
+if(Array.isArray(e))for(g=0;g<e.length&&!d.isPropagationStopped();g++){if(e[g](d,b[g])){e=b[g];break b}}else if(e&&e(d,b)){e=b;break b}e=null}d._dispatchInstances=null;d._dispatchListeners=null;d.isPersistent()||d.constructor.release(d);e&&e!==U?(d=void 0,b=F.getPooled(Y.responderGrant,e,c,f),b.touchHistory=S.touchHistory,x(b,A),g=!0===r(b),U?(h=F.getPooled(Y.responderTerminationRequest,U,c,f),h.touchHistory=S.touchHistory,x(h,A),u=!h._dispatchListeners||r(h),h.isPersistent()||h.constructor.release(h),
+u?(h=F.getPooled(Y.responderTerminate,U,c,f),h.touchHistory=S.touchHistory,x(h,A),d=T(d,[b,h]),W(e,g)):(e=F.getPooled(Y.responderReject,e,c,f),e.touchHistory=S.touchHistory,x(e,A),d=T(d,e))):(d=T(d,b),W(e,g)),e=d):e=null}else e=null;d=U&&G(a);b=U&&H(a);g=U&&I(a);if(d=d?Y.responderStart:b?Y.responderMove:g?Y.responderEnd:null)d=F.getPooled(d,U,c,f),d.touchHistory=S.touchHistory,x(d,A),e=T(e,d);d=U&&"touchcancel"===a;if(a=U&&!d&&I(a))a:{if((a=c.touches)&&0!==a.length)for(b=0;b<a.length;b++)if(g=a[b].target,
+null!==g&&void 0!==g&&0!==g){h=p(g);b:{for(g=U;h;){if(g===h||g===h.alternate){g=!0;break b}h=t(h)}g=!1}if(g){a=!1;break a}}a=!0}if(a=d?Y.responderTerminate:a?Y.responderRelease:null)c=F.getPooled(a,U,c,f),c.touchHistory=S.touchHistory,x(c,A),e=T(e,c),W(null);return e},GlobalResponderHandler:null,injection:{injectGlobalResponderHandler:function(a){X.GlobalResponderHandler=a}}},Z=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,ka=Z[3],la=Z[0],ma=Z[1];n=Z[2];p=la;q=ma;
+module.exports={ResponderEventPlugin:X,ResponderTouchHistoryStore:S,injectEventPluginsByName:ka};
diff --git a/node_modules/react-dom/cjs/react-dom.development.js b/node_modules/react-dom/cjs/react-dom.development.js
index eee3388a0..8945b4737 100644
--- a/node_modules/react-dom/cjs/react-dom.development.js
+++ b/node_modules/react-dom/cjs/react-dom.development.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom.development.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -16,482 +16,64 @@ if (process.env.NODE_ENV !== "production") {
'use strict';
var React = require('react');
-var invariant = require('fbjs/lib/invariant');
-var warning = require('fbjs/lib/warning');
-var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var _assign = require('object-assign');
-var emptyFunction = require('fbjs/lib/emptyFunction');
-var EventListener = require('fbjs/lib/EventListener');
-var getActiveElement = require('fbjs/lib/getActiveElement');
-var shallowEqual = require('fbjs/lib/shallowEqual');
-var containsNode = require('fbjs/lib/containsNode');
-var focusNode = require('fbjs/lib/focusNode');
-var emptyObject = require('fbjs/lib/emptyObject');
var checkPropTypes = require('prop-types/checkPropTypes');
-var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
-var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
+var schedule = require('schedule');
+var tracing = require('schedule/tracing');
/**
- * WARNING: DO NOT manually require this module.
- * This is a replacement for `invariant(...)` used by the error code system
- * and will _only_ be required by the corresponding babel pass.
- * It always throws.
- */
-
-!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
-
-// These attributes should be all lowercase to allow for
-// case insensitive checks
-var RESERVED_PROPS = {
- children: true,
- dangerouslySetInnerHTML: true,
- defaultValue: true,
- defaultChecked: true,
- innerHTML: true,
- suppressContentEditableWarning: true,
- suppressHydrationWarning: true,
- style: true
-};
-
-function checkMask(value, bitmask) {
- return (value & bitmask) === bitmask;
-}
-
-var DOMPropertyInjection = {
- /**
- * Mapping from normalized, camelcased property names to a configuration that
- * specifies how the associated DOM property should be accessed or rendered.
- */
- MUST_USE_PROPERTY: 0x1,
- HAS_BOOLEAN_VALUE: 0x4,
- HAS_NUMERIC_VALUE: 0x8,
- HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
- HAS_STRING_BOOLEAN_VALUE: 0x40,
-
- /**
- * Inject some specialized knowledge about the DOM. This takes a config object
- * with the following properties:
- *
- * Properties: object mapping DOM property name to one of the
- * DOMPropertyInjection constants or null. If your attribute isn't in here,
- * it won't get written to the DOM.
- *
- * DOMAttributeNames: object mapping React attribute name to the DOM
- * attribute name. Attribute names not specified use the **lowercase**
- * normalized name.
- *
- * DOMAttributeNamespaces: object mapping React attribute name to the DOM
- * attribute namespace URL. (Attribute names not specified use no namespace.)
- *
- * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
- * Property names not specified use the normalized name.
- *
- * DOMMutationMethods: Properties that require special mutation methods. If
- * `value` is undefined, the mutation method should unset the property.
- *
- * @param {object} domPropertyConfig the config as described above.
- */
- injectDOMPropertyConfig: function (domPropertyConfig) {
- var Injection = DOMPropertyInjection;
- var Properties = domPropertyConfig.Properties || {};
- var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
- var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
- var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
-
- for (var propName in Properties) {
- !!properties.hasOwnProperty(propName) ? invariant(false, "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.", propName) : void 0;
-
- var lowerCased = propName.toLowerCase();
- var propConfig = Properties[propName];
-
- var propertyInfo = {
- attributeName: lowerCased,
- attributeNamespace: null,
- propertyName: propName,
- mutationMethod: null,
-
- mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
- hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
- hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
- hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
- hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE),
- hasStringBooleanValue: checkMask(propConfig, Injection.HAS_STRING_BOOLEAN_VALUE)
- };
- !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? invariant(false, "DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s", propName) : void 0;
-
- if (DOMAttributeNames.hasOwnProperty(propName)) {
- var attributeName = DOMAttributeNames[propName];
-
- propertyInfo.attributeName = attributeName;
- }
-
- if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
- propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
- }
-
- if (DOMMutationMethods.hasOwnProperty(propName)) {
- propertyInfo.mutationMethod = DOMMutationMethods[propName];
- }
-
- // Downcase references to whitelist properties to check for membership
- // without case-sensitivity. This allows the whitelist to pick up
- // `allowfullscreen`, which should be written using the property configuration
- // for `allowFullscreen`
- properties[propName] = propertyInfo;
- }
- }
-};
-
-/* eslint-disable max-len */
-var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
-/* eslint-enable max-len */
-var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
-
-
-var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
-
-/**
- * Map from property "standard name" to an object with info about how to set
- * the property in the DOM. Each object contains:
+ * Use invariant() to assert state which your program assumes to be true.
*
- * attributeName:
- * Used when rendering markup or with `*Attribute()`.
- * attributeNamespace
- * propertyName:
- * Used on DOM node instances. (This includes properties that mutate due to
- * external factors.)
- * mutationMethod:
- * If non-null, used instead of the property or `setAttribute()` after
- * initial render.
- * mustUseProperty:
- * Whether the property must be accessed and mutated as an object property.
- * hasBooleanValue:
- * Whether the property should be removed when set to a falsey value.
- * hasNumericValue:
- * Whether the property must be numeric or parse as a numeric and should be
- * removed when set to a falsey value.
- * hasPositiveNumericValue:
- * Whether the property must be positive numeric or parse as a positive
- * numeric and should be removed when set to a falsey value.
- * hasOverloadedBooleanValue:
- * Whether the property can be used as a flag as well as with a value.
- * Removed when strictly equal to false; present without a value when
- * strictly equal to true; present with a value otherwise.
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
*/
-var properties = {};
-/**
- * Checks whether a property name is a writeable attribute.
- * @method
- */
-function shouldSetAttribute(name, value) {
- if (isReservedProp(name)) {
- return false;
- }
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
- return false;
- }
- if (value === null) {
- return true;
- }
- switch (typeof value) {
- case 'boolean':
- return shouldAttributeAcceptBooleanValue(name);
- case 'undefined':
- case 'number':
- case 'string':
- case 'object':
- return true;
- default:
- // function, symbol
- return false;
- }
-}
+var validateFormat = function () {};
-function getPropertyInfo(name) {
- return properties.hasOwnProperty(name) ? properties[name] : null;
+{
+ validateFormat = function (format) {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ };
}
-function shouldAttributeAcceptBooleanValue(name) {
- if (isReservedProp(name)) {
- return true;
- }
- var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- return propertyInfo.hasBooleanValue || propertyInfo.hasStringBooleanValue || propertyInfo.hasOverloadedBooleanValue;
- }
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix === 'data-' || prefix === 'aria-';
-}
+function invariant(condition, format, a, b, c, d, e, f) {
+ validateFormat(format);
-/**
- * Checks to see if a property name is within the list of properties
- * reserved for internal React operations. These properties should
- * not be set on an HTML element.
- *
- * @private
- * @param {string} name
- * @return {boolean} If the name is within reserved props
- */
-function isReservedProp(name) {
- return RESERVED_PROPS.hasOwnProperty(name);
-}
-
-var injection = DOMPropertyInjection;
-
-var MUST_USE_PROPERTY = injection.MUST_USE_PROPERTY;
-var HAS_BOOLEAN_VALUE = injection.HAS_BOOLEAN_VALUE;
-var HAS_NUMERIC_VALUE = injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE = injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE = injection.HAS_OVERLOADED_BOOLEAN_VALUE;
-var HAS_STRING_BOOLEAN_VALUE = injection.HAS_STRING_BOOLEAN_VALUE;
-
-var HTMLDOMPropertyConfig = {
- // When adding attributes to this list, be sure to also add them to
- // the `possibleStandardNames` module to ensure casing and incorrect
- // name warnings.
- Properties: {
- allowFullScreen: HAS_BOOLEAN_VALUE,
- // specifies target context for links with `preload` type
- async: HAS_BOOLEAN_VALUE,
- // Note: there is a special case that prevents it from being written to the DOM
- // on the client side because the browsers are inconsistent. Instead we call focus().
- autoFocus: HAS_BOOLEAN_VALUE,
- autoPlay: HAS_BOOLEAN_VALUE,
- capture: HAS_OVERLOADED_BOOLEAN_VALUE,
- checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- cols: HAS_POSITIVE_NUMERIC_VALUE,
- contentEditable: HAS_STRING_BOOLEAN_VALUE,
- controls: HAS_BOOLEAN_VALUE,
- 'default': HAS_BOOLEAN_VALUE,
- defer: HAS_BOOLEAN_VALUE,
- disabled: HAS_BOOLEAN_VALUE,
- download: HAS_OVERLOADED_BOOLEAN_VALUE,
- draggable: HAS_STRING_BOOLEAN_VALUE,
- formNoValidate: HAS_BOOLEAN_VALUE,
- hidden: HAS_BOOLEAN_VALUE,
- loop: HAS_BOOLEAN_VALUE,
- // Caution; `option.selected` is not updated if `select.multiple` is
- // disabled with `removeAttribute`.
- multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- noValidate: HAS_BOOLEAN_VALUE,
- open: HAS_BOOLEAN_VALUE,
- playsInline: HAS_BOOLEAN_VALUE,
- readOnly: HAS_BOOLEAN_VALUE,
- required: HAS_BOOLEAN_VALUE,
- reversed: HAS_BOOLEAN_VALUE,
- rows: HAS_POSITIVE_NUMERIC_VALUE,
- rowSpan: HAS_NUMERIC_VALUE,
- scoped: HAS_BOOLEAN_VALUE,
- seamless: HAS_BOOLEAN_VALUE,
- selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
- size: HAS_POSITIVE_NUMERIC_VALUE,
- start: HAS_NUMERIC_VALUE,
- // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
- span: HAS_POSITIVE_NUMERIC_VALUE,
- spellCheck: HAS_STRING_BOOLEAN_VALUE,
- // Style must be explicitly set in the attribute list. React components
- // expect a style object
- style: 0,
- // Keep it in the whitelist because it is case-sensitive for SVG.
- tabIndex: 0,
- // itemScope is for for Microdata support.
- // See http://schema.org/docs/gs.html
- itemScope: HAS_BOOLEAN_VALUE,
- // These attributes must stay in the white-list because they have
- // different attribute names (see DOMAttributeNames below)
- acceptCharset: 0,
- className: 0,
- htmlFor: 0,
- httpEquiv: 0,
- // Attributes with mutation methods must be specified in the whitelist
- // Set the string boolean flag to allow the behavior
- value: HAS_STRING_BOOLEAN_VALUE
- },
- DOMAttributeNames: {
- acceptCharset: 'accept-charset',
- className: 'class',
- htmlFor: 'for',
- httpEquiv: 'http-equiv'
- },
- DOMMutationMethods: {
- value: function (node, value) {
- if (value == null) {
- return node.removeAttribute('value');
- }
-
- // Number inputs get special treatment due to some edge cases in
- // Chrome. Let everything else assign the value attribute as normal.
- // https://github.com/facebook/react/issues/7253#issuecomment-236074326
- if (node.type !== 'number' || node.hasAttribute('value') === false) {
- node.setAttribute('value', '' + value);
- } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
- // Don't assign an attribute if validation reports bad
- // input. Chrome will clear the value. Additionally, don't
- // operate on inputs that have focus, otherwise Chrome might
- // strip off trailing decimal places and cause the user's
- // cursor position to jump to the beginning of the input.
- //
- // In ReactDOMInput, we have an onBlur event that will trigger
- // this function again when focus is lost.
- node.setAttribute('value', '' + value);
- }
+ if (!condition) {
+ var error = void 0;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
}
- }
-};
-
-var HAS_STRING_BOOLEAN_VALUE$1 = injection.HAS_STRING_BOOLEAN_VALUE;
-
-var NS = {
- xlink: 'http://www.w3.org/1999/xlink',
- xml: 'http://www.w3.org/XML/1998/namespace'
-};
-
-/**
- * This is a list of all SVG attributes that need special casing,
- * namespacing, or boolean value assignment.
- *
- * When adding attributes to this list, be sure to also add them to
- * the `possibleStandardNames` module to ensure casing and incorrect
- * name warnings.
- *
- * SVG Attributes List:
- * https://www.w3.org/TR/SVG/attindex.html
- * SMIL Spec:
- * https://www.w3.org/TR/smil
- */
-var ATTRS = ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'x-height', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xmlns:xlink', 'xml:lang', 'xml:space'];
-
-var SVGDOMPropertyConfig = {
- Properties: {
- autoReverse: HAS_STRING_BOOLEAN_VALUE$1,
- externalResourcesRequired: HAS_STRING_BOOLEAN_VALUE$1,
- preserveAlpha: HAS_STRING_BOOLEAN_VALUE$1
- },
- DOMAttributeNames: {
- autoReverse: 'autoReverse',
- externalResourcesRequired: 'externalResourcesRequired',
- preserveAlpha: 'preserveAlpha'
- },
- DOMAttributeNamespaces: {
- xlinkActuate: NS.xlink,
- xlinkArcrole: NS.xlink,
- xlinkHref: NS.xlink,
- xlinkRole: NS.xlink,
- xlinkShow: NS.xlink,
- xlinkTitle: NS.xlink,
- xlinkType: NS.xlink,
- xmlBase: NS.xml,
- xmlLang: NS.xml,
- xmlSpace: NS.xml
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
}
-};
-
-var CAMELIZE = /[\-\:]([a-z])/g;
-var capitalize = function (token) {
- return token[1].toUpperCase();
-};
-
-ATTRS.forEach(function (original) {
- var reactName = original.replace(CAMELIZE, capitalize);
-
- SVGDOMPropertyConfig.Properties[reactName] = 0;
- SVGDOMPropertyConfig.DOMAttributeNames[reactName] = original;
-});
-
-injection.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
-injection.injectDOMPropertyConfig(SVGDOMPropertyConfig);
-
-var ReactErrorUtils = {
- // Used by Fiber to simulate a try-catch.
- _caughtError: null,
- _hasCaughtError: false,
-
- // Used by event system to capture/rethrow the first error.
- _rethrowError: null,
- _hasRethrowError: false,
-
- injection: {
- injectErrorUtils: function (injectedErrorUtils) {
- !(typeof injectedErrorUtils.invokeGuardedCallback === 'function') ? invariant(false, 'Injected invokeGuardedCallback() must be a function.') : void 0;
- invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback;
- }
- },
-
- /**
- * Call a function while guarding against errors that happens within it.
- * Returns an error if it throws, otherwise null.
- *
- * In production, this is implemented using a try-catch. The reason we don't
- * use a try-catch directly is so that we can swap out a different
- * implementation in DEV mode.
- *
- * @param {String} name of the guard to use for logging or debugging
- * @param {Function} func The function to invoke
- * @param {*} context The context to use when calling the function
- * @param {...*} args Arguments for function
- */
- invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) {
- invokeGuardedCallback.apply(ReactErrorUtils, arguments);
- },
-
- /**
- * Same as invokeGuardedCallback, but instead of returning an error, it stores
- * it in a global so it can be rethrown by `rethrowCaughtError` later.
- * TODO: See if _caughtError and _rethrowError can be unified.
- *
- * @param {String} name of the guard to use for logging or debugging
- * @param {Function} func The function to invoke
- * @param {*} context The context to use when calling the function
- * @param {...*} args Arguments for function
- */
- invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) {
- ReactErrorUtils.invokeGuardedCallback.apply(this, arguments);
- if (ReactErrorUtils.hasCaughtError()) {
- var error = ReactErrorUtils.clearCaughtError();
- if (!ReactErrorUtils._hasRethrowError) {
- ReactErrorUtils._hasRethrowError = true;
- ReactErrorUtils._rethrowError = error;
- }
- }
- },
-
- /**
- * During execution of guarded functions we will capture the first error which
- * we will rethrow to be handled by the top level error handler.
- */
- rethrowCaughtError: function () {
- return rethrowCaughtError.apply(ReactErrorUtils, arguments);
- },
+}
- hasCaughtError: function () {
- return ReactErrorUtils._hasCaughtError;
- },
+// Relying on the `invariant()` implementation lets us
+// preserve the format and params in the www builds.
- clearCaughtError: function () {
- if (ReactErrorUtils._hasCaughtError) {
- var error = ReactErrorUtils._caughtError;
- ReactErrorUtils._caughtError = null;
- ReactErrorUtils._hasCaughtError = false;
- return error;
- } else {
- invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
- }
- }
-};
+!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
-var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
- ReactErrorUtils._hasCaughtError = false;
- ReactErrorUtils._caughtError = null;
+var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
var funcArgs = Array.prototype.slice.call(arguments, 3);
try {
func.apply(context, funcArgs);
} catch (error) {
- ReactErrorUtils._caughtError = error;
- ReactErrorUtils._hasCaughtError = true;
+ this.onError(error);
}
};
@@ -521,6 +103,13 @@ var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
var fakeNode = document.createElement('react');
var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
+ // If document doesn't exist we know for sure we will crash in this method
+ // when we call document.createEvent(). However this can cause confusing
+ // errors: https://github.com/facebookincubator/create-react-app/issues/3482
+ // So we preemptively throw with a better message instead.
+ !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0;
+ var evt = document.createEvent('Event');
+
// Keeps track of whether the user-provided callback threw an error. We
// set this to true at the beginning, then set it to false right after
// calling the function. If the function errors, `didError` will never be
@@ -529,6 +118,11 @@ var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
// the error event at all.
var didError = true;
+ // Keeps track of the value of window.event so that we can reset it
+ // during the callback to let user code access window.event in the
+ // browsers that support it.
+ var windowEvent = window.event;
+
// Create an event handler for our fake event. We will synchronously
// dispatch our fake event using `dispatchEvent`. Inside the handler, we
// call the user-provided callback.
@@ -539,6 +133,15 @@ var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
// nested call would trigger the fake event handlers of any call higher
// in the stack.
fakeNode.removeEventListener(evtType, callCallback, false);
+
+ // We check for window.hasOwnProperty('event') to prevent the
+ // window.event assignment in both IE <= 10 as they throw an error
+ // "Member not found" in strict mode, and in Firefox which does not
+ // support window.event.
+ if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
+ window.event = windowEvent;
+ }
+
func.apply(context, funcArgs);
didError = false;
}
@@ -559,24 +162,35 @@ var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
var didSetError = false;
var isCrossOriginError = false;
- function onError(event) {
+ function handleWindowError(event) {
error = event.error;
didSetError = true;
if (error === null && event.colno === 0 && event.lineno === 0) {
isCrossOriginError = true;
}
+ if (event.defaultPrevented) {
+ // Some other error handler has prevented default.
+ // Browsers silence the error report if this happens.
+ // We'll remember this to later decide whether to log it or not.
+ if (error != null && typeof error === 'object') {
+ try {
+ error._suppressLogging = true;
+ } catch (inner) {
+ // Ignore.
+ }
+ }
+ }
}
// Create a fake event type.
var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
// Attach our event handlers
- window.addEventListener('error', onError);
+ window.addEventListener('error', handleWindowError);
fakeNode.addEventListener(evtType, callCallback, false);
// Synchronously dispatch our fake event. If the user-provided function
// errors, it will trigger our global error handler.
- var evt = document.createEvent('Event');
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
@@ -587,31 +201,103 @@ var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
} else if (isCrossOriginError) {
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
}
- ReactErrorUtils._hasCaughtError = true;
- ReactErrorUtils._caughtError = error;
- } else {
- ReactErrorUtils._hasCaughtError = false;
- ReactErrorUtils._caughtError = null;
+ this.onError(error);
}
// Remove our event listeners
- window.removeEventListener('error', onError);
+ window.removeEventListener('error', handleWindowError);
};
- invokeGuardedCallback = invokeGuardedCallbackDev;
+ invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
}
}
-var rethrowCaughtError = function () {
- if (ReactErrorUtils._hasRethrowError) {
- var error = ReactErrorUtils._rethrowError;
- ReactErrorUtils._rethrowError = null;
- ReactErrorUtils._hasRethrowError = false;
- throw error;
+var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
+
+// Used by Fiber to simulate a try-catch.
+var hasError = false;
+var caughtError = null;
+
+// Used by event system to capture/rethrow the first error.
+var hasRethrowError = false;
+var rethrowError = null;
+
+var reporter = {
+ onError: function (error) {
+ hasError = true;
+ caughtError = error;
}
};
/**
+ * Call a function while guarding against errors that happens within it.
+ * Returns an error if it throws, otherwise null.
+ *
+ * In production, this is implemented using a try-catch. The reason we don't
+ * use a try-catch directly is so that we can swap out a different
+ * implementation in DEV mode.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
+ hasError = false;
+ caughtError = null;
+ invokeGuardedCallbackImpl$1.apply(reporter, arguments);
+}
+
+/**
+ * Same as invokeGuardedCallback, but instead of returning an error, it stores
+ * it in a global so it can be rethrown by `rethrowCaughtError` later.
+ * TODO: See if caughtError and rethrowError can be unified.
+ *
+ * @param {String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} context The context to use when calling the function
+ * @param {...*} args Arguments for function
+ */
+function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
+ invokeGuardedCallback.apply(this, arguments);
+ if (hasError) {
+ var error = clearCaughtError();
+ if (!hasRethrowError) {
+ hasRethrowError = true;
+ rethrowError = error;
+ }
+ }
+}
+
+/**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+function rethrowCaughtError() {
+ if (hasRethrowError) {
+ var error = rethrowError;
+ hasRethrowError = false;
+ rethrowError = null;
+ throw error;
+ }
+}
+
+function hasCaughtError() {
+ return hasError;
+}
+
+function clearCaughtError() {
+ if (hasError) {
+ var error = caughtError;
+ hasError = false;
+ caughtError = null;
+ return error;
+ } else {
+ invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
+ }
+}
+
+/**
* Injectable ordering of event plugins.
*/
var eventPluginOrder = null;
@@ -776,38 +462,109 @@ function injectEventPluginsByName(injectedNamesToPlugins) {
}
}
-var EventPluginRegistry = Object.freeze({
- plugins: plugins,
- eventNameDispatchConfigs: eventNameDispatchConfigs,
- registrationNameModules: registrationNameModules,
- registrationNameDependencies: registrationNameDependencies,
- possibleRegistrationNames: possibleRegistrationNames,
- injectEventPluginOrder: injectEventPluginOrder,
- injectEventPluginsByName: injectEventPluginsByName
-});
-
-var getFiberCurrentPropsFromNode = null;
-var getInstanceFromNode = null;
-var getNodeFromInstance = null;
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
-var injection$2 = {
- injectComponentTree: function (Injected) {
- getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
- getInstanceFromNode = Injected.getInstanceFromNode;
- getNodeFromInstance = Injected.getNodeFromInstance;
+var warningWithoutStack = function () {};
- {
- warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
+{
+ warningWithoutStack = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- }
-};
-
+ if (format === undefined) {
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (args.length > 8) {
+ // Check before the condition to catch violations early.
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ if (condition) {
+ return;
+ }
+ if (typeof console !== 'undefined') {
+ var _args$map = args.map(function (item) {
+ return '' + item;
+ }),
+ a = _args$map[0],
+ b = _args$map[1],
+ c = _args$map[2],
+ d = _args$map[3],
+ e = _args$map[4],
+ f = _args$map[5],
+ g = _args$map[6],
+ h = _args$map[7];
+
+ var message = 'Warning: ' + format;
+
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
+ // https://github.com/facebook/react/issues/13610
+ switch (args.length) {
+ case 0:
+ console.error(message);
+ break;
+ case 1:
+ console.error(message, a);
+ break;
+ case 2:
+ console.error(message, a, b);
+ break;
+ case 3:
+ console.error(message, a, b, c);
+ break;
+ case 4:
+ console.error(message, a, b, c, d);
+ break;
+ case 5:
+ console.error(message, a, b, c, d, e);
+ break;
+ case 6:
+ console.error(message, a, b, c, d, e, f);
+ break;
+ case 7:
+ console.error(message, a, b, c, d, e, f, g);
+ break;
+ case 8:
+ console.error(message, a, b, c, d, e, f, g, h);
+ break;
+ default:
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
+ }
+ }
+ try {
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ var argIndex = 0;
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ throw new Error(_message);
+ } catch (x) {}
+ };
+}
+var warningWithoutStack$1 = warningWithoutStack;
+var getFiberCurrentPropsFromNode = null;
+var getInstanceFromNode = null;
+var getNodeFromInstance = null;
+function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
+ getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
+ getInstanceFromNode = getInstanceFromNodeImpl;
+ getNodeFromInstance = getNodeFromInstanceImpl;
+ {
+ !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
+ }
+}
-var validateEventDispatches;
+var validateEventDispatches = void 0;
{
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
@@ -819,7 +576,7 @@ var validateEventDispatches;
var instancesIsArr = Array.isArray(dispatchInstances);
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
- warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.');
+ !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
@@ -833,7 +590,7 @@ var validateEventDispatches;
function executeDispatch(event, simulated, listener, inst) {
var type = event.type || 'unknown-event';
event.currentTarget = getNodeFromInstance(inst);
- ReactErrorUtils.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
+ invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
event.currentTarget = null;
}
@@ -1015,7 +772,7 @@ function shouldPreventMouseEvent(name, type, props) {
/**
* Methods for injecting dependencies.
*/
-var injection$1 = {
+var injection = {
/**
* @param {array} InjectedEventPluginOrder
* @public
@@ -1034,7 +791,7 @@ var injection$1 = {
* @return {?function} The stored callback.
*/
function getListener(inst, registrationName) {
- var listener;
+ var listener = void 0;
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
@@ -1064,7 +821,7 @@ function getListener(inst, registrationName) {
* @internal
*/
function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var events;
+ var events = null;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
@@ -1078,25 +835,11 @@ function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget)
return events;
}
-/**
- * Enqueues a synthetic event that should be dispatched when
- * `processEventQueue` is invoked.
- *
- * @param {*} events An accumulation of synthetic events.
- * @internal
- */
-function enqueueEvents(events) {
- if (events) {
+function runEventsInBatch(events, simulated) {
+ if (events !== null) {
eventQueue = accumulateInto(eventQueue, events);
}
-}
-/**
- * Dispatches all synthetic events on the event queue.
- *
- * @internal
- */
-function processEventQueue(simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
@@ -1113,34 +856,37 @@ function processEventQueue(simulated) {
}
!!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
// This would be a good time to rethrow if any of the event handlers threw.
- ReactErrorUtils.rethrowCaughtError();
+ rethrowCaughtError();
}
-var EventPluginHub = Object.freeze({
- injection: injection$1,
- getListener: getListener,
- extractEvents: extractEvents,
- enqueueEvents: enqueueEvents,
- processEventQueue: processEventQueue
-});
+function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+ runEventsInBatch(events, false);
+}
-var IndeterminateComponent = 0; // Before we know whether it is functional or class
-var FunctionalComponent = 1;
+var FunctionalComponent = 0;
+var FunctionalComponentLazy = 1;
var ClassComponent = 2;
-var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
-var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
-var HostComponent = 5;
-var HostText = 6;
-var CallComponent = 7;
-var CallHandlerPhase = 8;
-var ReturnComponent = 9;
-var Fragment = 10;
+var ClassComponentLazy = 3;
+var IndeterminateComponent = 4; // Before we know whether it is functional or class
+var HostRoot = 5; // Root of a host tree. Could be nested inside another node.
+var HostPortal = 6; // A subtree. Could be an entry point to a different renderer.
+var HostComponent = 7;
+var HostText = 8;
+var Fragment = 9;
+var Mode = 10;
+var ContextConsumer = 11;
+var ContextProvider = 12;
+var ForwardRef = 13;
+var ForwardRefLazy = 14;
+var Profiler = 15;
+var PlaceholderComponent = 16;
var randomKey = Math.random().toString(36).slice(2);
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
-function precacheFiberNode$1(hostInst, node) {
+function precacheFiberNode(hostInst, node) {
node[internalInstanceKey] = hostInst;
}
@@ -1153,10 +899,7 @@ function getClosestInstanceFromNode(node) {
return node[internalInstanceKey];
}
- // Walk up the tree until we find an ancestor whose instance we have cached.
- var parents = [];
while (!node[internalInstanceKey]) {
- parents.push(node);
if (node.parentNode) {
node = node.parentNode;
} else {
@@ -1166,17 +909,13 @@ function getClosestInstanceFromNode(node) {
}
}
- var closest = void 0;
var inst = node[internalInstanceKey];
if (inst.tag === HostComponent || inst.tag === HostText) {
// In Fiber, this will always be the deepest root.
return inst;
}
- for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
- closest = inst;
- }
- return closest;
+ return null;
}
/**
@@ -1215,22 +954,13 @@ function getFiberCurrentPropsFromNode$1(node) {
return node[internalEventHandlersKey] || null;
}
-function updateFiberProps$1(node, props) {
+function updateFiberProps(node, props) {
node[internalEventHandlersKey] = props;
}
-var ReactDOMComponentTree = Object.freeze({
- precacheFiberNode: precacheFiberNode$1,
- getClosestInstanceFromNode: getClosestInstanceFromNode,
- getInstanceFromNode: getInstanceFromNode$1,
- getNodeFromInstance: getNodeFromInstance$1,
- getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode$1,
- updateFiberProps: updateFiberProps$1
-});
-
function getParent(inst) {
do {
- inst = inst['return'];
+ inst = inst.return;
// TODO: If this is a HostRoot we might want to bail out.
// That is depending on if we want nested subtrees (layers) to bubble
// events to their parent. We could also go through parentNode on the
@@ -1289,9 +1019,7 @@ function getLowestCommonAncestor(instA, instB) {
/**
* Return the parent instance of the passed-in instance.
*/
-function getParentInstance(inst) {
- return getParent(inst);
-}
+
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
@@ -1302,7 +1030,7 @@ function traverseTwoPhase(inst, fn, arg) {
path.push(inst);
inst = getParent(inst);
}
- var i;
+ var i = void 0;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
@@ -1385,7 +1113,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
*/
function accumulateDirectionalDispatches(inst, phase, event) {
{
- warning(inst, 'Dispatching inst must not be null');
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
}
var listener = listenerAtPhase(inst, event, phase);
if (listener) {
@@ -1408,17 +1136,6 @@ function accumulateTwoPhaseDispatchesSingle(event) {
}
/**
- * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
- */
-function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
- if (event && event.dispatchConfig.phasedRegistrationNames) {
- var targetInst = event._targetInst;
- var parentInst = targetInst ? getParentInstance(targetInst) : null;
- traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
- }
-}
-
-/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
@@ -1449,9 +1166,7 @@ function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
-function accumulateTwoPhaseDispatchesSkipTarget(events) {
- forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
-}
+
function accumulateEnterLeaveDispatches(leave, enter, from, to) {
traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
@@ -1461,32 +1176,204 @@ function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
-var EventPropagators = Object.freeze({
- accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
- accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
- accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches,
- accumulateDirectDispatches: accumulateDirectDispatches
-});
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+// Do not uses the below two methods directly!
+// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
+// (It is the only module that is allowed to access these methods.)
-var contentKey = null;
+function unsafeCastStringToDOMTopLevelType(topLevelType) {
+ return topLevelType;
+}
+
+function unsafeCastDOMTopLevelTypeToString(topLevelType) {
+ return topLevelType;
+}
/**
- * Gets the key used to access text content on a DOM node.
+ * Generate a mapping of standard vendor prefixes using the defined style property and event name.
*
- * @return {?string} Key used to access text content.
- * @internal
+ * @param {string} styleProp
+ * @param {string} eventName
+ * @returns {object}
*/
-function getTextContentAccessor() {
- if (!contentKey && ExecutionEnvironment.canUseDOM) {
- // Prefer textContent to innerText because many browsers support both but
- // SVG <text> elements don't support innerText even when <div> does.
- contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
+function makePrefixMap(styleProp, eventName) {
+ var prefixes = {};
+
+ prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
+ prefixes['Webkit' + styleProp] = 'webkit' + eventName;
+ prefixes['Moz' + styleProp] = 'moz' + eventName;
+
+ return prefixes;
+}
+
+/**
+ * A list of event names to a configurable list of vendor prefixes.
+ */
+var vendorPrefixes = {
+ animationend: makePrefixMap('Animation', 'AnimationEnd'),
+ animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
+ animationstart: makePrefixMap('Animation', 'AnimationStart'),
+ transitionend: makePrefixMap('Transition', 'TransitionEnd')
+};
+
+/**
+ * Event names that have already been detected and prefixed (if applicable).
+ */
+var prefixedEventNames = {};
+
+/**
+ * Element to check for prefixes on.
+ */
+var style = {};
+
+/**
+ * Bootstrap if a DOM exists.
+ */
+if (canUseDOM) {
+ style = document.createElement('div').style;
+
+ // On some platforms, in particular some releases of Android 4.x,
+ // the un-prefixed "animation" and "transition" properties are defined on the
+ // style object but the events that fire will still be prefixed, so we need
+ // to check if the un-prefixed events are usable, and if not remove them from the map.
+ if (!('AnimationEvent' in window)) {
+ delete vendorPrefixes.animationend.animation;
+ delete vendorPrefixes.animationiteration.animation;
+ delete vendorPrefixes.animationstart.animation;
+ }
+
+ // Same as above
+ if (!('TransitionEvent' in window)) {
+ delete vendorPrefixes.transitionend.transition;
+ }
+}
+
+/**
+ * Attempts to determine the correct vendor prefixed event name.
+ *
+ * @param {string} eventName
+ * @returns {string}
+ */
+function getVendorPrefixedEventName(eventName) {
+ if (prefixedEventNames[eventName]) {
+ return prefixedEventNames[eventName];
+ } else if (!vendorPrefixes[eventName]) {
+ return eventName;
+ }
+
+ var prefixMap = vendorPrefixes[eventName];
+
+ for (var styleProp in prefixMap) {
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
}
- return contentKey;
+
+ return eventName;
}
/**
- * This helper object stores information about text content of a target node,
+ * To identify top level events in ReactDOM, we use constants defined by this
+ * module. This is the only module that uses the unsafe* methods to express
+ * that the constants actually correspond to the browser event names. This lets
+ * us save some bundle size by avoiding a top level type -> event name map.
+ * The rest of ReactDOM code should import top level types from this file.
+ */
+var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
+var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
+var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
+var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
+var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
+var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
+var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
+var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
+var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
+var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
+var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
+var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
+var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
+var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
+var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
+var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
+var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
+var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
+var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
+var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
+var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
+var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
+var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
+var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
+var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
+var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
+var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
+var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
+var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
+var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
+var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
+var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
+var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
+var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
+var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
+var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
+var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
+var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
+var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
+var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
+var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
+var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
+var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
+var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
+var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
+var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
+var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
+var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
+var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
+var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
+var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
+var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
+var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
+var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
+var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
+
+
+var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
+var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
+var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
+var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
+var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
+var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
+var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
+var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
+var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
+var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
+var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
+var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
+var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
+var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
+var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
+var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
+var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
+var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
+var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
+var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
+var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
+var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
+var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
+var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
+var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
+
+// List of events that need to be individually attached to media elements.
+// Note that events in this list will *not* be listened to at the top level
+// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
+var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
+
+function getRawEventName(topLevelType) {
+ return unsafeCastDOMTopLevelTypeToString(topLevelType);
+}
+
+/**
+ * These variables store information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
@@ -1496,33 +1383,32 @@ function getTextContentAccessor() {
*
*
*/
-var compositionState = {
- _root: null,
- _startText: null,
- _fallbackText: null
-};
+
+var root = null;
+var startText = null;
+var fallbackText = null;
function initialize(nativeEventTarget) {
- compositionState._root = nativeEventTarget;
- compositionState._startText = getText();
+ root = nativeEventTarget;
+ startText = getText();
return true;
}
function reset() {
- compositionState._root = null;
- compositionState._startText = null;
- compositionState._fallbackText = null;
+ root = null;
+ startText = null;
+ fallbackText = null;
}
function getData() {
- if (compositionState._fallbackText) {
- return compositionState._fallbackText;
+ if (fallbackText) {
+ return fallbackText;
}
- var start;
- var startValue = compositionState._startText;
+ var start = void 0;
+ var startValue = startText;
var startLength = startValue.length;
- var end;
+ var end = void 0;
var endValue = getText();
var endLength = endValue.length;
@@ -1540,25 +1426,21 @@ function getData() {
}
var sliceTail = end > 1 ? 1 - end : undefined;
- compositionState._fallbackText = endValue.slice(start, sliceTail);
- return compositionState._fallbackText;
+ fallbackText = endValue.slice(start, sliceTail);
+ return fallbackText;
}
function getText() {
- if ('value' in compositionState._root) {
- return compositionState._root.value;
+ if ('value' in root) {
+ return root.value;
}
- return compositionState._root[getTextContentAccessor()];
+ return root.textContent;
}
/* eslint valid-typeof: 0 */
-var didWarnForAddedNewProperty = false;
-var isProxySupported = typeof Proxy === 'function';
var EVENT_POOL_SIZE = 10;
-var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
-
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -1567,7 +1449,9 @@ var EventInterface = {
type: null,
target: null,
// currentTarget is set when dispatching; no use in copying it here
- currentTarget: emptyFunction.thatReturnsNull,
+ currentTarget: function () {
+ return null;
+ },
eventPhase: null,
bubbles: null,
cancelable: null,
@@ -1578,6 +1462,14 @@ var EventInterface = {
isTrusted: null
};
+function functionThatReturnsTrue() {
+ return true;
+}
+
+function functionThatReturnsFalse() {
+ return false;
+}
+
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
@@ -1602,6 +1494,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
+ delete this.isDefaultPrevented;
+ delete this.isPropagationStopped;
}
this.dispatchConfig = dispatchConfig;
@@ -1630,11 +1524,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
} else {
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
+ this.isDefaultPrevented = functionThatReturnsFalse;
}
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
@@ -1651,7 +1545,7 @@ _assign(SyntheticEvent.prototype, {
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
+ this.isDefaultPrevented = functionThatReturnsTrue;
},
stopPropagation: function () {
@@ -1671,7 +1565,7 @@ _assign(SyntheticEvent.prototype, {
event.cancelBubble = true;
}
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
+ this.isPropagationStopped = functionThatReturnsTrue;
},
/**
@@ -1680,7 +1574,7 @@ _assign(SyntheticEvent.prototype, {
* won't be added back into the pool.
*/
persist: function () {
- this.isPersistent = emptyFunction.thatReturnsTrue;
+ this.isPersistent = functionThatReturnsTrue;
},
/**
@@ -1688,7 +1582,7 @@ _assign(SyntheticEvent.prototype, {
*
* @return {boolean} True if this should not be released, false otherwise.
*/
- isPersistent: emptyFunction.thatReturnsFalse,
+ isPersistent: functionThatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
@@ -1700,13 +1594,19 @@ _assign(SyntheticEvent.prototype, {
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
}
}
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
- this[shouldBeReleasedProperties[i]] = null;
- }
+ this.dispatchConfig = null;
+ this._targetInst = null;
+ this.nativeEvent = null;
+ this.isDefaultPrevented = functionThatReturnsFalse;
+ this.isPropagationStopped = functionThatReturnsFalse;
+ this._dispatchListeners = null;
+ this._dispatchInstances = null;
{
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
}
}
});
@@ -1715,53 +1615,27 @@ SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
- *
- * @param {function} Class
- * @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function (Class, Interface) {
+SyntheticEvent.extend = function (Interface) {
var Super = this;
var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();
+ function Class() {
+ return Super.apply(this, arguments);
+ }
_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = _assign({}, Super.Interface, Interface);
- Class.augmentClass = Super.augmentClass;
+ Class.extend = Super.extend;
addEventPoolingTo(Class);
-};
-/** Proxying after everything set on SyntheticEvent
- * to resolve Proxy issue on some WebKit browsers
- * in which some Event properties are set to undefined (GH#10010)
- */
-{
- if (isProxySupported) {
- /*eslint-disable no-func-assign */
- SyntheticEvent = new Proxy(SyntheticEvent, {
- construct: function (target, args) {
- return this.apply(target, Object.create(target.prototype), args);
- },
- apply: function (constructor, that, args) {
- return new Proxy(constructor.apply(that, args), {
- set: function (target, prop, value) {
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
- warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.');
- didWarnForAddedNewProperty = true;
- }
- target[prop] = value;
- return true;
- }
- });
- }
- });
- /*eslint-enable no-func-assign */
- }
-}
+ return Class;
+};
addEventPoolingTo(SyntheticEvent);
@@ -1795,7 +1669,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
function warn(action, result) {
var warningCondition = false;
- warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
@@ -1811,7 +1685,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
function releasePooledEvent(event) {
var EventConstructor = this;
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
event.destructor();
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
EventConstructor.eventPool.push(event);
@@ -1824,77 +1698,42 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent;
}
-var SyntheticEvent$1 = SyntheticEvent;
-
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
-var CompositionEventInterface = {
+var SyntheticCompositionEvent = SyntheticEvent.extend({
data: null
-};
-
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
- */
-function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
-
-SyntheticEvent$1.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
+});
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
-var InputEventInterface = {
+var SyntheticInputEvent = SyntheticEvent.extend({
data: null
-};
-
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
- */
-function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
-
-SyntheticEvent$1.augmentClass(SyntheticInputEvent, InputEventInterface);
+});
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
+var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
-if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
+if (canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
+var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
-
-/**
- * Opera <= 12 includes TextEvent in window, but does not fire
- * text input events. Rely on keypress instead.
- */
-function isPresto() {
- var opera = window.opera;
- return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
-}
+var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
@@ -1906,28 +1745,28 @@ var eventTypes = {
bubbled: 'onBeforeInput',
captured: 'onBeforeInputCapture'
},
- dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
+ dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: 'onCompositionEnd',
captured: 'onCompositionEndCapture'
},
- dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: 'onCompositionStart',
captured: 'onCompositionStartCapture'
},
- dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: 'onCompositionUpdate',
captured: 'onCompositionUpdateCapture'
},
- dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
+ dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
}
};
@@ -1953,11 +1792,11 @@ function isKeypressCommand(nativeEvent) {
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
- case 'topCompositionStart':
+ case TOP_COMPOSITION_START:
return eventTypes.compositionStart;
- case 'topCompositionEnd':
+ case TOP_COMPOSITION_END:
return eventTypes.compositionEnd;
- case 'topCompositionUpdate':
+ case TOP_COMPOSITION_UPDATE:
return eventTypes.compositionUpdate;
}
}
@@ -1971,7 +1810,7 @@ function getCompositionEventType(topLevelType) {
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
+ return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -1983,16 +1822,16 @@ function isFallbackCompositionStart(topLevelType, nativeEvent) {
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
- case 'topKeyUp':
+ case TOP_KEY_UP:
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
- case 'topKeyDown':
+ case TOP_KEY_DOWN:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return nativeEvent.keyCode !== START_KEYCODE;
- case 'topKeyPress':
- case 'topMouseDown':
- case 'topBlur':
+ case TOP_KEY_PRESS:
+ case TOP_MOUSE_DOWN:
+ case TOP_BLUR:
// Events are not possible without cancelling IME.
return true;
default:
@@ -2017,6 +1856,20 @@ function getDataFromCustomEvent(nativeEvent) {
return null;
}
+/**
+ * Check if a composition event was triggered by Korean IME.
+ * Our fallback mode does not work well with IE's Korean IME,
+ * so just use native composition events when Korean IME is used.
+ * Although CompositionEvent.locale property is deprecated,
+ * it is available in IE, where our fallback mode is enabled.
+ *
+ * @param {object} nativeEvent
+ * @return {boolean}
+ */
+function isUsingKoreanIME(nativeEvent) {
+ return nativeEvent.locale === 'ko';
+}
+
// Track the current IME composition status, if any.
var isComposing = false;
@@ -2024,8 +1877,8 @@ var isComposing = false;
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var eventType;
- var fallbackData;
+ var eventType = void 0;
+ var fallbackData = void 0;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
@@ -2041,7 +1894,7 @@ function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEv
return null;
}
- if (useFallbackCompositionData) {
+ if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!isComposing && eventType === eventTypes.compositionStart) {
@@ -2071,15 +1924,15 @@ function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEv
}
/**
- * @param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`.
+ * @param {TopLevelType} topLevelType Number from `TopLevelType`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
- case 'topCompositionEnd':
+ case TOP_COMPOSITION_END:
return getDataFromCustomEvent(nativeEvent);
- case 'topKeyPress':
+ case TOP_KEY_PRESS:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
@@ -2102,13 +1955,13 @@ function getNativeBeforeInputChars(topLevelType, nativeEvent) {
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
- case 'topTextInput':
+ case TOP_TEXT_INPUT:
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
- // doesn't give us keycodes, so we need to blacklist it.
+ // doesn't give us keycodes, so we need to ignore it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
@@ -2125,7 +1978,7 @@ function getNativeBeforeInputChars(topLevelType, nativeEvent) {
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
- * @param {string} topLevelType Record from `BrowserEventConstants`.
+ * @param {number} topLevelType Number from `TopLevelEventTypes`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
@@ -2135,7 +1988,7 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If composition event is available, we extract a string only at
// compositionevent, otherwise extract it at fallback events.
if (isComposing) {
- if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
+ if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = getData();
reset();
isComposing = false;
@@ -2145,11 +1998,11 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
}
switch (topLevelType) {
- case 'topPaste':
+ case TOP_PASTE:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
- case 'topKeyPress':
+ case TOP_KEY_PRESS:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
@@ -2180,8 +2033,8 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
}
}
return null;
- case 'topCompositionEnd':
- return useFallbackCompositionData ? null : nativeEvent.data;
+ case TOP_COMPOSITION_END:
+ return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
default:
return null;
}
@@ -2194,7 +2047,7 @@ function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var chars;
+ var chars = void 0;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
@@ -2237,22 +2090,25 @@ var BeforeInputEventPlugin = {
eventTypes: eventTypes,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
- }
-};
+ var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
-// Use to restore controlled state after a change event has fired.
+ var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
+
+ if (composition === null) {
+ return beforeInput;
+ }
-var fiberHostComponent = null;
+ if (beforeInput === null) {
+ return composition;
+ }
-var ReactControlledComponentInjection = {
- injectFiberControlledHostComponent: function (hostComponentImpl) {
- // The fiber implementation doesn't use dynamic dispatch so we need to
- // inject the implementation.
- fiberHostComponent = hostComponentImpl;
+ return [composition, beforeInput];
}
};
+// Use to restore controlled state after a change event has fired.
+
+var restoreImpl = null;
var restoreTarget = null;
var restoreQueue = null;
@@ -2264,12 +2120,14 @@ function restoreStateOfTarget(target) {
// Unmounted
return;
}
- !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
- fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props);
+ restoreImpl(internalInstance.stateNode, internalInstance.type, props);
}
-var injection$3 = ReactControlledComponentInjection;
+function setRestoreImplementation(impl) {
+ restoreImpl = impl;
+}
function enqueueStateRestore(target) {
if (restoreTarget) {
@@ -2283,6 +2141,10 @@ function enqueueStateRestore(target) {
}
}
+function needsStateRestore() {
+ return restoreTarget !== null || restoreQueue !== null;
+}
+
function restoreStateIfNeeded() {
if (!restoreTarget) {
return;
@@ -2300,12 +2162,6 @@ function restoreStateIfNeeded() {
}
}
-var ReactControlledComponent = Object.freeze({
- injection: injection$3,
- enqueueStateRestore: enqueueStateRestore,
- restoreStateIfNeeded: restoreStateIfNeeded
-});
-
// Used as a way to call batchedUpdates when we don't have a reference to
// the renderer. Such as when we're dispatching events or if third party
// libraries need to call batchedUpdates. Eventually, this API will go away when
@@ -2313,38 +2169,52 @@ var ReactControlledComponent = Object.freeze({
// scheduled work and instead do synchronous work.
// Defaults
-var fiberBatchedUpdates = function (fn, bookkeeping) {
+var _batchedUpdatesImpl = function (fn, bookkeeping) {
return fn(bookkeeping);
};
+var _interactiveUpdatesImpl = function (fn, a, b) {
+ return fn(a, b);
+};
+var _flushInteractiveUpdatesImpl = function () {};
-var isNestingBatched = false;
+var isBatching = false;
function batchedUpdates(fn, bookkeeping) {
- if (isNestingBatched) {
+ if (isBatching) {
// If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state. Therefore, we add the target to
- // a queue of work.
- return fiberBatchedUpdates(fn, bookkeeping);
+ // fully completes before restoring state.
+ return fn(bookkeeping);
}
- isNestingBatched = true;
+ isBatching = true;
try {
- return fiberBatchedUpdates(fn, bookkeeping);
+ return _batchedUpdatesImpl(fn, bookkeeping);
} finally {
// Here we wait until all updates have propagated, which is important
// when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
// Then we restore state of any controlled component.
- isNestingBatched = false;
- restoreStateIfNeeded();
+ isBatching = false;
+ var controlledComponentsHavePendingUpdates = needsStateRestore();
+ if (controlledComponentsHavePendingUpdates) {
+ // If a controlled event was fired, we may need to restore the state of
+ // the DOM node back to the controlled value. This is necessary when React
+ // bails out of the update without touching the DOM.
+ _flushInteractiveUpdatesImpl();
+ restoreStateIfNeeded();
+ }
}
}
-var ReactGenericBatchingInjection = {
- injectFiberBatchedUpdates: function (_batchedUpdates) {
- fiberBatchedUpdates = _batchedUpdates;
- }
-};
+function interactiveUpdates(fn, a, b) {
+ return _interactiveUpdatesImpl(fn, a, b);
+}
-var injection$4 = ReactGenericBatchingInjection;
+
+
+function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) {
+ _batchedUpdatesImpl = batchedUpdatesImpl;
+ _interactiveUpdatesImpl = interactiveUpdatesImpl;
+ _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl;
+}
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
@@ -2399,6 +2269,8 @@ var DOCUMENT_FRAGMENT_NODE = 11;
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
+ // Fallback to nativeEvent.srcElement for IE9
+ // https://github.com/facebook/react/issues/12506
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Normalize SVG <use> element events #4963
@@ -2411,14 +2283,6 @@ function getEventTarget(nativeEvent) {
return target.nodeType === TEXT_NODE ? target.parentNode : target;
}
-var useHasFeature;
-if (ExecutionEnvironment.canUseDOM) {
- useHasFeature = document.implementation && document.implementation.hasFeature &&
- // always returns true in newer browsers as per the standard.
- // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
- document.implementation.hasFeature('', '') !== true;
-}
-
/**
* Checks if an event is supported in the current execution environment.
*
@@ -2428,13 +2292,12 @@ if (ExecutionEnvironment.canUseDOM) {
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
- * @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
-function isEventSupported(eventNameSuffix, capture) {
- if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
+function isEventSupported(eventNameSuffix) {
+ if (!canUseDOM) {
return false;
}
@@ -2447,11 +2310,6 @@ function isEventSupported(eventNameSuffix, capture) {
isSupported = typeof element[eventName] === 'function';
}
- if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
- // This is the only way to test support for the `wheel` event in IE9+.
- isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
- }
-
return isSupported;
}
@@ -2494,21 +2352,29 @@ function trackValueOnNode(node) {
// and don't track value will cause over reporting of changes,
// but it's better then a hard failure
// (needed for certain tests that spyOn input values and Safari)
- if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
+ if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
return;
}
+ var get = descriptor.get,
+ set = descriptor.set;
Object.defineProperty(node, valueField, {
- enumerable: descriptor.enumerable,
configurable: true,
get: function () {
- return descriptor.get.call(this);
+ return get.call(this);
},
set: function (value) {
currentValue = '' + value;
- descriptor.set.call(this, value);
+ set.call(this, value);
}
});
+ // We could've passed this the first time
+ // but it triggers a bug in IE11 and Edge 14/15.
+ // Calling defineProperty() again should be equivalent.
+ // https://github.com/facebook/react/issues/11768
+ Object.defineProperty(node, valueField, {
+ enumerable: descriptor.enumerable
+ });
var tracker = {
getValue: function () {
@@ -2555,18 +2421,1114 @@ function updateValueIfChanged(node) {
return false;
}
+var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
+
+var describeComponentFrame = function (name, source, ownerName) {
+ var sourceInfo = '';
+ if (source) {
+ var path = source.fileName;
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
+ {
+ // In DEV, include code for a common special case:
+ // prefer "folder/index.js" instead of just "index.js".
+ if (/^index\./.test(fileName)) {
+ var match = path.match(BEFORE_SLASH_RE);
+ if (match) {
+ var pathBeforeSlash = match[1];
+ if (pathBeforeSlash) {
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
+ fileName = folderName + '/' + fileName;
+ }
+ }
+ }
+ }
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
+ } else if (ownerName) {
+ sourceInfo = ' (created by ' + ownerName + ')';
+ }
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
+};
+
+// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var hasSymbol = typeof Symbol === 'function' && Symbol.for;
+
+var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
+var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
+var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
+var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
+var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
+var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
+var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
+var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
+var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
+var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
+
+var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
+var FAUX_ITERATOR_SYMBOL = '@@iterator';
+
+function getIteratorFn(maybeIterable) {
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
+ return null;
+ }
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
+ if (typeof maybeIterator === 'function') {
+ return maybeIterator;
+ }
+ return null;
+}
+
+var Pending = 0;
+var Resolved = 1;
+var Rejected = 2;
+
+function getResultFromResolvedThenable(thenable) {
+ return thenable._reactResult;
+}
+
+function refineResolvedThenable(thenable) {
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
+}
+
+function getComponentName(type) {
+ if (type == null) {
+ // Host root, text node or just invalid type.
+ return null;
+ }
+ {
+ if (typeof type.tag === 'number') {
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
+ }
+ }
+ if (typeof type === 'function') {
+ return type.displayName || type.name || null;
+ }
+ if (typeof type === 'string') {
+ return type;
+ }
+ switch (type) {
+ case REACT_ASYNC_MODE_TYPE:
+ return 'AsyncMode';
+ case REACT_FRAGMENT_TYPE:
+ return 'Fragment';
+ case REACT_PORTAL_TYPE:
+ return 'Portal';
+ case REACT_PROFILER_TYPE:
+ return 'Profiler';
+ case REACT_STRICT_MODE_TYPE:
+ return 'StrictMode';
+ case REACT_PLACEHOLDER_TYPE:
+ return 'Placeholder';
+ }
+ if (typeof type === 'object') {
+ switch (type.$$typeof) {
+ case REACT_CONTEXT_TYPE:
+ return 'Context.Consumer';
+ case REACT_PROVIDER_TYPE:
+ return 'Context.Provider';
+ case REACT_FORWARD_REF_TYPE:
+ var renderFn = type.render;
+ var functionName = renderFn.displayName || renderFn.name || '';
+ return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
+ }
+ if (typeof type.then === 'function') {
+ var thenable = type;
+ var resolvedThenable = refineResolvedThenable(thenable);
+ if (resolvedThenable) {
+ return getComponentName(resolvedThenable);
+ }
+ }
+ }
+ return null;
+}
+
+var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+
+function describeFiber(fiber) {
+ switch (fiber.tag) {
+ case IndeterminateComponent:
+ case FunctionalComponent:
+ case FunctionalComponentLazy:
+ case ClassComponent:
+ case ClassComponentLazy:
+ case HostComponent:
+ case Mode:
+ var owner = fiber._debugOwner;
+ var source = fiber._debugSource;
+ var name = getComponentName(fiber.type);
+ var ownerName = null;
+ if (owner) {
+ ownerName = getComponentName(owner.type);
+ }
+ return describeComponentFrame(name, source, ownerName);
+ default:
+ return '';
+ }
+}
+
+function getStackByFiberInDevAndProd(workInProgress) {
+ var info = '';
+ var node = workInProgress;
+ do {
+ info += describeFiber(node);
+ node = node.return;
+ } while (node);
+ return info;
+}
+
+var current = null;
+var phase = null;
+
+function getCurrentFiberOwnerNameInDevOrNull() {
+ {
+ if (current === null) {
+ return null;
+ }
+ var owner = current._debugOwner;
+ if (owner !== null && typeof owner !== 'undefined') {
+ return getComponentName(owner.type);
+ }
+ }
+ return null;
+}
+
+function getCurrentFiberStackInDev() {
+ {
+ if (current === null) {
+ return '';
+ }
+ // Safe because if current fiber exists, we are reconciling,
+ // and it is guaranteed to be the work-in-progress version.
+ return getStackByFiberInDevAndProd(current);
+ }
+ return '';
+}
+
+function resetCurrentFiber() {
+ {
+ ReactDebugCurrentFrame.getCurrentStack = null;
+ current = null;
+ phase = null;
+ }
+}
+
+function setCurrentFiber(fiber) {
+ {
+ ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
+ current = fiber;
+ phase = null;
+ }
+}
+
+function setCurrentPhase(lifeCyclePhase) {
+ {
+ phase = lifeCyclePhase;
+ }
+}
+
+/**
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
+
+var warning = warningWithoutStack$1;
+
+{
+ warning = function (condition, format) {
+ if (condition) {
+ return;
+ }
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
+
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
+ }
+
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
+ };
+}
+
+var warning$1 = warning;
+
+// A reserved attribute.
+// It is handled by React separately and shouldn't be written to the DOM.
+var RESERVED = 0;
+
+// A simple string attribute.
+// Attributes that aren't in the whitelist are presumed to have this type.
+var STRING = 1;
+
+// A string attribute that accepts booleans in React. In HTML, these are called
+// "enumerated" attributes with "true" and "false" as possible values.
+// When true, it should be set to a "true" string.
+// When false, it should be set to a "false" string.
+var BOOLEANISH_STRING = 2;
+
+// A real boolean attribute.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+var BOOLEAN = 3;
+
+// An attribute that can be used as a flag as well as with a value.
+// When true, it should be present (set either to an empty string or its name).
+// When false, it should be omitted.
+// For any other value, should be present with that value.
+var OVERLOADED_BOOLEAN = 4;
+
+// An attribute that must be numeric or parse as a numeric.
+// When falsy, it should be removed.
+var NUMERIC = 5;
+
+// An attribute that must be positive numeric or parse as a positive numeric.
+// When falsy, it should be removed.
+var POSITIVE_NUMERIC = 6;
+
+/* eslint-disable max-len */
+var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
+/* eslint-enable max-len */
+var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
+
+
+var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
+ return true;
+ }
+ if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ {
+ warning$1(false, 'Invalid attribute name: `%s`', attributeName);
+ }
+ return false;
+}
+
+function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null) {
+ return propertyInfo.type === RESERVED;
+ }
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
+ return true;
+ }
+ return false;
+}
+
+function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
+ if (propertyInfo !== null && propertyInfo.type === RESERVED) {
+ return false;
+ }
+ switch (typeof value) {
+ case 'function':
+ // $FlowIssue symbol is perfectly valid here
+ case 'symbol':
+ // eslint-disable-line
+ return true;
+ case 'boolean':
+ {
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ return !propertyInfo.acceptsBooleans;
+ } else {
+ var prefix = name.toLowerCase().slice(0, 5);
+ return prefix !== 'data-' && prefix !== 'aria-';
+ }
+ }
+ default:
+ return false;
+ }
+}
+
+function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
+ if (value === null || typeof value === 'undefined') {
+ return true;
+ }
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
+ return true;
+ }
+ if (isCustomComponentTag) {
+ return false;
+ }
+ if (propertyInfo !== null) {
+ switch (propertyInfo.type) {
+ case BOOLEAN:
+ return !value;
+ case OVERLOADED_BOOLEAN:
+ return value === false;
+ case NUMERIC:
+ return isNaN(value);
+ case POSITIVE_NUMERIC:
+ return isNaN(value) || value < 1;
+ }
+ }
+ return false;
+}
+
+function getPropertyInfo(name) {
+ return properties.hasOwnProperty(name) ? properties[name] : null;
+}
+
+function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
+ this.attributeName = attributeName;
+ this.attributeNamespace = attributeNamespace;
+ this.mustUseProperty = mustUseProperty;
+ this.propertyName = name;
+ this.type = type;
+}
+
+// When adding attributes to this list, be sure to also add them to
+// the `possibleStandardNames` module to ensure casing and incorrect
+// name warnings.
+var properties = {};
+
+// These props are reserved by React. They shouldn't be written to the DOM.
+['children', 'dangerouslySetInnerHTML',
+// TODO: This prevents the assignment of defaultValue to regular
+// elements (not just inputs). Now that ReactDOMInput assigns to the
+// defaultValue property -- do we need this?
+'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// A few React string attributes have a different name.
+// This is a mapping from React prop names to the attribute names.
+[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
+ var name = _ref[0],
+ attributeName = _ref[1];
+
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" HTML attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are "enumerated" SVG attributes that accept "true" and "false".
+// In React, we let users pass `true` and `false` even though technically
+// these aren't boolean attributes (they are coerced to strings).
+// Since these are SVG attributes, their attribute names are case-sensitive.
+['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML boolean attributes.
+['allowFullScreen', 'async',
+// Note: there is a special case that prevents it from being written to the DOM
+// on the client side because the browsers are inconsistent. Instead we call focus().
+'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
+// Microdata
+'itemScope'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are the few React props that we set as DOM properties
+// rather than attributes. These are all booleans.
+['checked',
+// Note: `option.selected` is not updated if `select.multiple` is
+// disabled with `removeAttribute`. We have special logic for handling this.
+'multiple', 'muted', 'selected'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that are "overloaded booleans": they behave like
+// booleans, but can also accept a string value.
+['capture', 'download'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be positive numbers.
+['cols', 'rows', 'size', 'span'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
+ name, // attributeName
+ null);
+} // attributeNamespace
+);
+
+// These are HTML attributes that must be numbers.
+['rowSpan', 'start'].forEach(function (name) {
+ properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
+ name.toLowerCase(), // attributeName
+ null);
+} // attributeNamespace
+);
+
+var CAMELIZE = /[\-\:]([a-z])/g;
+var capitalize = function (token) {
+ return token[1].toUpperCase();
+};
+
+// This is a list of all SVG attributes that need special casing, namespacing,
+// or boolean value assignment. Regular attributes that just accept strings
+// and have the same names are omitted, just like in the HTML whitelist.
+// Some of these attributes can be hard to find. This list was created by
+// scrapping the MDN documentation.
+['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, null);
+} // attributeNamespace
+);
+
+// String SVG attributes with the xlink namespace.
+['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/1999/xlink');
+});
+
+// String SVG attributes with the xml namespace.
+['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
+ var name = attributeName.replace(CAMELIZE, capitalize);
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
+ attributeName, 'http://www.w3.org/XML/1998/namespace');
+});
+
+// Special case: this attribute exists both in HTML and SVG.
+// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use
+// its React `tabIndex` name, like we do for attributes that exist only in HTML.
+properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty
+'tabindex', // attributeName
+null);
+
+/**
+ * Get the value for a property on a node. Only used in DEV for SSR validation.
+ * The "expected" argument is used as a hint of what the expected value is.
+ * Some properties have multiple equivalent values.
+ */
+function getValueForProperty(node, name, expected, propertyInfo) {
+ {
+ if (propertyInfo.mustUseProperty) {
+ var propertyName = propertyInfo.propertyName;
+
+ return node[propertyName];
+ } else {
+ var attributeName = propertyInfo.attributeName;
+
+ var stringValue = null;
+
+ if (propertyInfo.type === OVERLOADED_BOOLEAN) {
+ if (node.hasAttribute(attributeName)) {
+ var value = node.getAttribute(attributeName);
+ if (value === '') {
+ return true;
+ }
+ if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
+ return value;
+ }
+ if (value === '' + expected) {
+ return expected;
+ }
+ return value;
+ }
+ } else if (node.hasAttribute(attributeName)) {
+ if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
+ // We had an attribute but shouldn't have had one, so read it
+ // for the error message.
+ return node.getAttribute(attributeName);
+ }
+ if (propertyInfo.type === BOOLEAN) {
+ // If this was a boolean, it doesn't matter what the value is
+ // the fact that we have it is the same as the expected.
+ return expected;
+ }
+ // Even if this property uses a namespace we use getAttribute
+ // because we assume its namespaced name is the same as our config.
+ // To use getAttributeNS we need the local name which we don't have
+ // in our config atm.
+ stringValue = node.getAttribute(attributeName);
+ }
+
+ if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
+ return stringValue === null ? expected : stringValue;
+ } else if (stringValue === '' + expected) {
+ return expected;
+ } else {
+ return stringValue;
+ }
+ }
+ }
+}
+
+/**
+ * Get the value for a attribute on a node. Only used in DEV for SSR validation.
+ * The third argument is used as a hint of what the expected value is. Some
+ * attributes have multiple equivalent values.
+ */
+function getValueForAttribute(node, name, expected) {
+ {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
+ if (!node.hasAttribute(name)) {
+ return expected === undefined ? undefined : null;
+ }
+ var value = node.getAttribute(name);
+ if (value === '' + expected) {
+ return expected;
+ }
+ return value;
+ }
+}
+
+/**
+ * Sets the value for a property on a node.
+ *
+ * @param {DOMElement} node
+ * @param {string} name
+ * @param {*} value
+ */
+function setValueForProperty(node, name, value, isCustomComponentTag) {
+ var propertyInfo = getPropertyInfo(name);
+ if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
+ return;
+ }
+ if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
+ value = null;
+ }
+ // If the prop isn't in the special list, treat it as a simple attribute.
+ if (isCustomComponentTag || propertyInfo === null) {
+ if (isAttributeNameSafe(name)) {
+ var _attributeName = name;
+ if (value === null) {
+ node.removeAttribute(_attributeName);
+ } else {
+ node.setAttribute(_attributeName, '' + value);
+ }
+ }
+ return;
+ }
+ var mustUseProperty = propertyInfo.mustUseProperty;
+
+ if (mustUseProperty) {
+ var propertyName = propertyInfo.propertyName;
+
+ if (value === null) {
+ var type = propertyInfo.type;
+
+ node[propertyName] = type === BOOLEAN ? false : '';
+ } else {
+ // Contrary to `setAttribute`, object properties are properly
+ // `toString`ed by IE8/9.
+ node[propertyName] = value;
+ }
+ return;
+ }
+ // The rest are treated as attributes with special cases.
+ var attributeName = propertyInfo.attributeName,
+ attributeNamespace = propertyInfo.attributeNamespace;
+
+ if (value === null) {
+ node.removeAttribute(attributeName);
+ } else {
+ var _type = propertyInfo.type;
+
+ var attributeValue = void 0;
+ if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
+ attributeValue = '';
+ } else {
+ // `setAttribute` with objects becomes only `[object]` in IE8/9,
+ // ('' + value) makes it output the correct toString()-value.
+ attributeValue = '' + value;
+ }
+ if (attributeNamespace) {
+ node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
+ } else {
+ node.setAttribute(attributeName, attributeValue);
+ }
+ }
+}
+
+// Flow does not allow string concatenation of most non-string types. To work
+// around this limitation, we use an opaque type that can only be obtained by
+// passing the value through getToStringValue first.
+function toString(value) {
+ return '' + value;
+}
+
+function getToStringValue(value) {
+ switch (typeof value) {
+ case 'boolean':
+ case 'number':
+ case 'object':
+ case 'string':
+ case 'undefined':
+ return value;
+ default:
+ // function, symbol are assigned as empty strings
+ return '';
+ }
+}
+
+var ReactDebugCurrentFrame$1 = null;
+
+var ReactControlledValuePropTypes = {
+ checkPropTypes: null
+};
+
+{
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
+
+ var hasReadOnlyValue = {
+ button: true,
+ checkbox: true,
+ image: true,
+ hidden: true,
+ radio: true,
+ reset: true,
+ submit: true
+ };
+
+ var propTypes = {
+ value: function (props, propName, componentName) {
+ if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
+ return null;
+ }
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ checked: function (props, propName, componentName) {
+ if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
+ return null;
+ }
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ }
+ };
+
+ /**
+ * Provide a linked `value` attribute for controlled forms. You should not use
+ * this outside of the ReactDOM controlled form components.
+ */
+ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
+ };
+}
+
+// Exports ReactDOM.createRoot
+var enableUserTimingAPI = true;
+
+// Experimental error-boundary API that can recover from errors within a single
+// render phase
+var enableGetDerivedStateFromCatch = false;
+// Suspense
+var enableSuspense = false;
+// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
+var debugRenderPhaseSideEffects = false;
+
+// In some cases, StrictMode should also double-render lifecycles.
+// This can be confusing for tests though,
+// And it can be bad for performance in production.
+// This feature flag can be used to control the behavior:
+var debugRenderPhaseSideEffectsForStrictMode = true;
+
+// To preserve the "Pause on caught exceptions" behavior of the debugger, we
+// replay the begin phase of a failed component inside invokeGuardedCallback.
+var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
+
+// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
+var warnAboutDeprecatedLifecycles = false;
+
+// Warn about legacy context API
+var warnAboutLegacyContextAPI = false;
+
+// Gather advanced timing metrics for Profiler subtrees.
+var enableProfilerTimer = true;
+
+// Trace which interactions trigger each commit.
+var enableSchedulerTracing = true;
+
+// Only used in www builds.
+
+
+// Only used in www builds.
+
+
+// React Fire: prevent the value and checked attributes from syncing
+// with their related DOM properties
+var disableInputAttributeSyncing = false;
+
+// TODO: direct imports like some-package/src/* are bad. Fix me.
+var didWarnValueDefaultValue = false;
+var didWarnCheckedDefaultChecked = false;
+var didWarnControlledToUncontrolled = false;
+var didWarnUncontrolledToControlled = false;
+
+function isControlled(props) {
+ var usesChecked = props.type === 'checkbox' || props.type === 'radio';
+ return usesChecked ? props.checked != null : props.value != null;
+}
+
+/**
+ * Implements an <input> host component that allows setting these optional
+ * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
+ *
+ * If `checked` or `value` are not supplied (or null/undefined), user actions
+ * that affect the checked state or value will trigger updates to the element.
+ *
+ * If they are supplied (and not null/undefined), the rendered element will not
+ * trigger updates to the element. Instead, the props must change in order for
+ * the rendered element to be updated.
+ *
+ * The rendered element will be initialized as unchecked (or `defaultChecked`)
+ * with an empty value (or `defaultValue`).
+ *
+ * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
+ */
+
+function getHostProps(element, props) {
+ var node = element;
+ var checked = props.checked;
+
+ var hostProps = _assign({}, props, {
+ defaultChecked: undefined,
+ defaultValue: undefined,
+ value: undefined,
+ checked: checked != null ? checked : node._wrapperState.initialChecked
+ });
+
+ return hostProps;
+}
+
+function initWrapperState(element, props) {
+ {
+ ReactControlledValuePropTypes.checkPropTypes('input', props);
+
+ if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
+ warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
+ didWarnCheckedDefaultChecked = true;
+ }
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
+ warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
+ didWarnValueDefaultValue = true;
+ }
+ }
+
+ var node = element;
+ var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
+
+ node._wrapperState = {
+ initialChecked: props.checked != null ? props.checked : props.defaultChecked,
+ initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
+ controlled: isControlled(props)
+ };
+}
+
+function updateChecked(element, props) {
+ var node = element;
+ var checked = props.checked;
+ if (checked != null) {
+ setValueForProperty(node, 'checked', checked, false);
+ }
+}
+
+function updateWrapper(element, props) {
+ var node = element;
+ {
+ var _controlled = isControlled(props);
+
+ if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
+ warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
+ didWarnUncontrolledToControlled = true;
+ }
+ if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
+ warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
+ didWarnControlledToUncontrolled = true;
+ }
+ }
+
+ updateChecked(element, props);
+
+ var value = getToStringValue(props.value);
+ var type = props.type;
+
+ if (value != null) {
+ if (type === 'number') {
+ if (value === 0 && node.value === '' ||
+ // We explicitly want to coerce to number here if possible.
+ // eslint-disable-next-line
+ node.value != value) {
+ node.value = toString(value);
+ }
+ } else if (node.value !== toString(value)) {
+ node.value = toString(value);
+ }
+ } else if (type === 'submit' || type === 'reset') {
+ // Submit/reset inputs need the attribute removed completely to avoid
+ // blank-text buttons.
+ node.removeAttribute('value');
+ return;
+ }
+
+ if (disableInputAttributeSyncing) {
+ // When not syncing the value attribute, React only assigns a new value
+ // whenever the defaultValue React prop has changed. When not present,
+ // React does nothing
+ if (props.hasOwnProperty('defaultValue')) {
+ setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
+ }
+ } else {
+ // When syncing the value attribute, the value comes from a cascade of
+ // properties:
+ // 1. The value React property
+ // 2. The defaultValue React property
+ // 3. Otherwise there should be no change
+ if (props.hasOwnProperty('value')) {
+ setDefaultValue(node, props.type, value);
+ } else if (props.hasOwnProperty('defaultValue')) {
+ setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
+ }
+ }
+
+ if (disableInputAttributeSyncing) {
+ // When not syncing the checked attribute, the attribute is directly
+ // controllable from the defaultValue React property. It needs to be
+ // updated as new props come in.
+ if (props.defaultChecked == null) {
+ node.removeAttribute('checked');
+ } else {
+ node.defaultChecked = !!props.defaultChecked;
+ }
+ } else {
+ // When syncing the checked attribute, it only changes when it needs
+ // to be removed, such as transitioning from a checkbox into a text input
+ if (props.checked == null && props.defaultChecked != null) {
+ node.defaultChecked = !!props.defaultChecked;
+ }
+ }
+}
+
+function postMountWrapper(element, props, isHydrating) {
+ var node = element;
+
+ // Do not assign value if it is already set. This prevents user text input
+ // from being lost during SSR hydration.
+ if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
+ var type = props.type;
+ var isButton = type === 'submit' || type === 'reset';
+
+ // Avoid setting value attribute on submit/reset inputs as it overrides the
+ // default value provided by the browser. See: #12872
+ if (isButton && (props.value === undefined || props.value === null)) {
+ return;
+ }
+
+ var _initialValue = toString(node._wrapperState.initialValue);
+
+ // Do not assign value if it is already set. This prevents user text input
+ // from being lost during SSR hydration.
+ if (!isHydrating) {
+ if (disableInputAttributeSyncing) {
+ var value = getToStringValue(props.value);
+
+ // When not syncing the value attribute, the value property points
+ // directly to the React prop. Only assign it if it exists.
+ if (value != null) {
+ // Always assign on buttons so that it is possible to assign an
+ // empty string to clear button text.
+ //
+ // Otherwise, do not re-assign the value property if is empty. This
+ // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
+ // prematurely marking required inputs as invalid. Equality is compared
+ // to the current value in case the browser provided value is not an
+ // empty string.
+ if (isButton || value !== node.value) {
+ node.value = toString(value);
+ }
+ }
+ } else {
+ // When syncing the value attribute, the value property should use
+ // the the wrapperState._initialValue property. This uses:
+ //
+ // 1. The value React property when present
+ // 2. The defaultValue React property when present
+ // 3. An empty string
+ if (_initialValue !== node.value) {
+ node.value = _initialValue;
+ }
+ }
+ }
+
+ if (disableInputAttributeSyncing) {
+ // When not syncing the value attribute, assign the value attribute
+ // directly from the defaultValue React property (when present)
+ var defaultValue = getToStringValue(props.defaultValue);
+ if (defaultValue != null) {
+ node.defaultValue = toString(defaultValue);
+ }
+ } else {
+ // Otherwise, the value attribute is synchronized to the property,
+ // so we assign defaultValue to the same thing as the value property
+ // assignment step above.
+ node.defaultValue = _initialValue;
+ }
+ }
+
+ // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
+ // this is needed to work around a chrome bug where setting defaultChecked
+ // will sometimes influence the value of checked (even after detachment).
+ // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
+ // We need to temporarily unset name to avoid disrupting radio button groups.
+ var name = node.name;
+ if (name !== '') {
+ node.name = '';
+ }
+
+ if (disableInputAttributeSyncing) {
+ // When not syncing the checked attribute, the checked property
+ // never gets assigned. It must be manually set. We don't want
+ // to do this when hydrating so that existing user input isn't
+ // modified
+ if (!isHydrating) {
+ updateChecked(element, props);
+ }
+
+ // Only assign the checked attribute if it is defined. This saves
+ // a DOM write when controlling the checked attribute isn't needed
+ // (text inputs, submit/reset)
+ if (props.hasOwnProperty('defaultChecked')) {
+ node.defaultChecked = !node.defaultChecked;
+ node.defaultChecked = !!props.defaultChecked;
+ }
+ } else {
+ // When syncing the checked attribute, both the the checked property and
+ // attribute are assigned at the same time using defaultChecked. This uses:
+ //
+ // 1. The checked React property when present
+ // 2. The defaultChecked React property when present
+ // 3. Otherwise, false
+ node.defaultChecked = !node.defaultChecked;
+ node.defaultChecked = !!node._wrapperState.initialChecked;
+ }
+
+ if (name !== '') {
+ node.name = name;
+ }
+}
+
+function restoreControlledState(element, props) {
+ var node = element;
+ updateWrapper(node, props);
+ updateNamedCousins(node, props);
+}
+
+function updateNamedCousins(rootNode, props) {
+ var name = props.name;
+ if (props.type === 'radio' && name != null) {
+ var queryRoot = rootNode;
+
+ while (queryRoot.parentNode) {
+ queryRoot = queryRoot.parentNode;
+ }
+
+ // If `rootNode.form` was non-null, then we could try `form.elements`,
+ // but that sometimes behaves strangely in IE8. We could also try using
+ // `form.getElementsByName`, but that will only return direct children
+ // and won't include inputs that use the HTML5 `form=` attribute. Since
+ // the input might not even be in a form. It might not even be in the
+ // document. Let's just use the local `querySelectorAll` to ensure we don't
+ // miss anything.
+ var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+
+ for (var i = 0; i < group.length; i++) {
+ var otherNode = group[i];
+ if (otherNode === rootNode || otherNode.form !== rootNode.form) {
+ continue;
+ }
+ // This will throw if radio buttons rendered by different copies of React
+ // and the same name are rendered into the same form (same as #1939).
+ // That's probably okay; we don't support it just as we don't support
+ // mixing React radio buttons with non-React ones.
+ var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
+ !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
+
+ // We need update the tracked value on the named cousin since the value
+ // was changed but the input saw no event or value set
+ updateValueIfChanged(otherNode);
+
+ // If this is a controlled radio button group, forcing the input that
+ // was previously checked to update will cause it to be come re-checked
+ // as appropriate.
+ updateWrapper(otherNode, otherProps);
+ }
+ }
+}
+
+// In Chrome, assigning defaultValue to certain input types triggers input validation.
+// For number inputs, the display value loses trailing decimal points. For email inputs,
+// Chrome raises "The specified value <x> is not a valid email address".
+//
+// Here we check to see if the defaultValue has actually changed, avoiding these problems
+// when the user is inputting text
+//
+// https://github.com/facebook/react/issues/7253
+function setDefaultValue(node, type, value) {
+ if (
+ // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
+ type !== 'number' || node.ownerDocument.activeElement !== node) {
+ if (value == null) {
+ node.defaultValue = toString(node._wrapperState.initialValue);
+ } else if (node.defaultValue !== toString(value)) {
+ node.defaultValue = toString(value);
+ }
+ }
+}
+
var eventTypes$1 = {
change: {
phasedRegistrationNames: {
bubbled: 'onChange',
captured: 'onChangeCapture'
},
- dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
+ dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
}
};
function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
- var event = SyntheticEvent$1.getPooled(eventTypes$1.change, inst, nativeEvent, target);
+ var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
event.type = 'change';
// Flag this event loop as needing state restore.
enqueueStateRestore(target);
@@ -2605,8 +3567,7 @@ function manualDispatchChangeEvent(nativeEvent) {
}
function runEventInBatch(event) {
- enqueueEvents(event);
- processEventQueue(false);
+ runEventsInBatch(event, false);
}
function getInstIfValueChanged(targetInst) {
@@ -2617,7 +3578,7 @@ function getInstIfValueChanged(targetInst) {
}
function getTargetInstForChangeEvent(topLevelType, targetInst) {
- if (topLevelType === 'topChange') {
+ if (topLevelType === TOP_CHANGE) {
return targetInst;
}
}
@@ -2626,7 +3587,7 @@ function getTargetInstForChangeEvent(topLevelType, targetInst) {
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
-if (ExecutionEnvironment.canUseDOM) {
+if (canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events.
isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
@@ -2670,7 +3631,7 @@ function handlePropertyChange(nativeEvent) {
}
function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
- if (topLevelType === 'topFocus') {
+ if (topLevelType === TOP_FOCUS) {
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
@@ -2683,14 +3644,14 @@ function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(target, targetInst);
- } else if (topLevelType === 'topBlur') {
+ } else if (topLevelType === TOP_BLUR) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
- if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
+ if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -2717,34 +3678,27 @@ function shouldUseClickEvent(elem) {
}
function getTargetInstForClickEvent(topLevelType, targetInst) {
- if (topLevelType === 'topClick') {
+ if (topLevelType === TOP_CLICK) {
return getInstIfValueChanged(targetInst);
}
}
function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
- if (topLevelType === 'topInput' || topLevelType === 'topChange') {
+ if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
return getInstIfValueChanged(targetInst);
}
}
-function handleControlledInputBlur(inst, node) {
- // TODO: In IE, inst is occasionally null. Why?
- if (inst == null) {
- return;
- }
-
- // Fiber and ReactDOM keep wrapper state in separate places
- var state = inst._wrapperState || node._wrapperState;
+function handleControlledInputBlur(node) {
+ var state = node._wrapperState;
if (!state || !state.controlled || node.type !== 'number') {
return;
}
- // If controlled, assign the value attribute to the current value on blur
- var value = '' + node.value;
- if (node.getAttribute('value') !== value) {
- node.setAttribute('value', value);
+ if (!disableInputAttributeSyncing) {
+ // If controlled, assign the value attribute to the current value on blur
+ setDefaultValue(node, 'number', node.value);
}
}
@@ -2766,7 +3720,8 @@ var ChangeEventPlugin = {
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
- var getTargetInstFunc, handleEventFunc;
+ var getTargetInstFunc = void 0,
+ handleEventFunc = void 0;
if (shouldUseChangeEvent(targetNode)) {
getTargetInstFunc = getTargetInstForChangeEvent;
} else if (isTextInputElement(targetNode)) {
@@ -2793,8 +3748,8 @@ var ChangeEventPlugin = {
}
// When blurring, set the value attribute for number inputs
- if (topLevelType === 'topBlur') {
- handleControlledInputBlur(targetInst, targetNode);
+ if (topLevelType === TOP_BLUR) {
+ handleControlledInputBlur(targetNode);
}
}
};
@@ -2808,28 +3763,12 @@ var ChangeEventPlugin = {
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
+var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
-/**
- * @interface UIEvent
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
- */
-var UIEventInterface = {
+var SyntheticUIEvent = SyntheticEvent.extend({
view: null,
detail: null
-};
-
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
- */
-function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
-
-SyntheticEvent$1.augmentClass(SyntheticUIEvent, UIEventInterface);
+});
/**
* Translation from modifier key to the associated property in the event.
@@ -2860,11 +3799,17 @@ function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
+var previousScreenX = 0;
+var previousScreenY = 0;
+// Use flags to signal movementX/Y has already been set
+var isMovementXSet = false;
+var isMovementYSet = false;
+
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
-var MouseEventInterface = {
+var SyntheticMouseEvent = SyntheticUIEvent.extend({
screenX: null,
screenY: null,
clientX: null,
@@ -2880,29 +3825,72 @@ var MouseEventInterface = {
buttons: null,
relatedTarget: function (event) {
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
+ },
+ movementX: function (event) {
+ if ('movementX' in event) {
+ return event.movementX;
+ }
+
+ var screenX = previousScreenX;
+ previousScreenX = event.screenX;
+
+ if (!isMovementXSet) {
+ isMovementXSet = true;
+ return 0;
+ }
+
+ return event.type === 'mousemove' ? event.screenX - screenX : 0;
+ },
+ movementY: function (event) {
+ if ('movementY' in event) {
+ return event.movementY;
+ }
+
+ var screenY = previousScreenY;
+ previousScreenY = event.screenY;
+
+ if (!isMovementYSet) {
+ isMovementYSet = true;
+ return 0;
+ }
+
+ return event.type === 'mousemove' ? event.screenY - screenY : 0;
}
-};
+});
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticUIEvent}
+ * @interface PointerEvent
+ * @see http://www.w3.org/TR/pointerevents/
*/
-function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
-
-SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
+var SyntheticPointerEvent = SyntheticMouseEvent.extend({
+ pointerId: null,
+ width: null,
+ height: null,
+ pressure: null,
+ tangentialPressure: null,
+ tiltX: null,
+ tiltY: null,
+ twist: null,
+ pointerType: null,
+ isPrimary: null
+});
var eventTypes$2 = {
mouseEnter: {
registrationName: 'onMouseEnter',
- dependencies: ['topMouseOut', 'topMouseOver']
+ dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
},
mouseLeave: {
registrationName: 'onMouseLeave',
- dependencies: ['topMouseOut', 'topMouseOver']
+ dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
+ },
+ pointerEnter: {
+ registrationName: 'onPointerEnter',
+ dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
+ },
+ pointerLeave: {
+ registrationName: 'onPointerLeave',
+ dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
}
};
@@ -2917,15 +3905,19 @@ var EnterLeaveEventPlugin = {
* the `mouseover` top-level event.
*/
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
+ var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
+
+ if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
- // Must not be a mouse in or mouse out - ignoring.
+
+ if (!isOutEvent && !isOverEvent) {
+ // Must not be a mouse or pointer in or out - ignoring.
return null;
}
- var win;
+ var win = void 0;
if (nativeEventTarget.window === nativeEventTarget) {
// `nativeEventTarget` is probably a window object.
win = nativeEventTarget;
@@ -2939,9 +3931,9 @@ var EnterLeaveEventPlugin = {
}
}
- var from;
- var to;
- if (topLevelType === 'topMouseOut') {
+ var from = void 0;
+ var to = void 0;
+ if (isOutEvent) {
from = targetInst;
var related = nativeEvent.relatedTarget || nativeEvent.toElement;
to = related ? getClosestInstanceFromNode(related) : null;
@@ -2956,16 +3948,33 @@ var EnterLeaveEventPlugin = {
return null;
}
+ var eventInterface = void 0,
+ leaveEventType = void 0,
+ enterEventType = void 0,
+ eventTypePrefix = void 0;
+
+ if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
+ eventInterface = SyntheticMouseEvent;
+ leaveEventType = eventTypes$2.mouseLeave;
+ enterEventType = eventTypes$2.mouseEnter;
+ eventTypePrefix = 'mouse';
+ } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
+ eventInterface = SyntheticPointerEvent;
+ leaveEventType = eventTypes$2.pointerLeave;
+ enterEventType = eventTypes$2.pointerEnter;
+ eventTypePrefix = 'pointer';
+ }
+
var fromNode = from == null ? win : getNodeFromInstance$1(from);
var toNode = to == null ? win : getNodeFromInstance$1(to);
- var leave = SyntheticMouseEvent.getPooled(eventTypes$2.mouseLeave, from, nativeEvent, nativeEventTarget);
- leave.type = 'mouseleave';
+ var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
+ leave.type = eventTypePrefix + 'leave';
leave.target = fromNode;
leave.relatedTarget = toNode;
- var enter = SyntheticMouseEvent.getPooled(eventTypes$2.mouseEnter, to, nativeEvent, nativeEventTarget);
- enter.type = 'mouseenter';
+ var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
+ enter.type = eventTypePrefix + 'enter';
enter.target = toNode;
enter.relatedTarget = fromNode;
@@ -2975,6 +3984,58 @@ var EnterLeaveEventPlugin = {
}
};
+/*eslint-disable no-self-compare */
+
+var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+
+/**
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
+ */
+function is(x, y) {
+ // SameValue algorithm
+ if (x === y) {
+ // Steps 1-5, 7-10
+ // Steps 6.b-6.e: +0 != -0
+ // Added the nonzero y check to make Flow happy, but it is redundant
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
+ } else {
+ // Step 6.a: NaN == NaN
+ return x !== x && y !== y;
+ }
+}
+
+/**
+ * Performs equality by iterating through keys on an object and returning false
+ * when any key has values which are not strictly equal between the arguments.
+ * Returns true when the values of all keys are strictly equal.
+ */
+function shallowEqual(objA, objB) {
+ if (is(objA, objB)) {
+ return true;
+ }
+
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
+ return false;
+ }
+
+ var keysA = Object.keys(objA);
+ var keysB = Object.keys(objB);
+
+ if (keysA.length !== keysB.length) {
+ return false;
+ }
+
+ // Test for A's keys different from B.
+ for (var i = 0; i < keysA.length; i++) {
+ if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
@@ -3004,36 +4065,31 @@ function set(key, value) {
key._reactInternalFiber = value;
}
-var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+// Don't change these two values. They're used by React Dev Tools.
+var NoEffect = /* */0;
+var PerformedWork = /* */1;
-var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
-var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
+// You can change the rest (and add more).
+var Placement = /* */2;
+var Update = /* */4;
+var PlacementAndUpdate = /* */6;
+var Deletion = /* */8;
+var ContentReset = /* */16;
+var Callback = /* */32;
+var DidCapture = /* */64;
+var Ref = /* */128;
+var Snapshot = /* */256;
-function getComponentName(fiber) {
- var type = fiber.type;
+// Update & Callback & Ref & Snapshot
+var LifecycleEffectMask = /* */420;
- if (typeof type === 'string') {
- return type;
- }
- if (typeof type === 'function') {
- return type.displayName || type.name;
- }
- return null;
-}
+// Union of all host effects
+var HostEffectMask = /* */511;
-// Don't change these two values:
-var NoEffect = 0; // 0b00000000
-var PerformedWork = 1; // 0b00000001
+var Incomplete = /* */512;
+var ShouldCapture = /* */1024;
-// You can change the rest (and add more).
-var Placement = 2; // 0b00000010
-var Update = 4; // 0b00000100
-var PlacementAndUpdate = 6; // 0b00000110
-var Deletion = 8; // 0b00001000
-var ContentReset = 16; // 0b00010000
-var Callback = 32; // 0b00100000
-var Err = 64; // 0b01000000
-var Ref = 128; // 0b10000000
+var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var MOUNTING = 1;
var MOUNTED = 2;
@@ -3047,15 +4103,15 @@ function isFiberMountedImpl(fiber) {
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
}
- while (node['return']) {
- node = node['return'];
+ while (node.return) {
+ node = node.return;
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
}
}
} else {
- while (node['return']) {
- node = node['return'];
+ while (node.return) {
+ node = node.return;
}
}
if (node.tag === HostRoot) {
@@ -3074,11 +4130,11 @@ function isFiberMounted(fiber) {
function isMounted(component) {
{
- var owner = ReactCurrentOwner.current;
- if (owner !== null && owner.tag === ClassComponent) {
+ var owner = ReactCurrentOwner$1.current;
+ if (owner !== null && (owner.tag === ClassComponent || owner.tag === ClassComponentLazy)) {
var ownerFiber = owner;
var instance = ownerFiber.stateNode;
- warning(instance._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber) || 'A component');
+ !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
instance._warnedAboutRefsInRender = true;
}
}
@@ -3111,7 +4167,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
var a = fiber;
var b = alternate;
while (true) {
- var parentA = a['return'];
+ var parentA = a.return;
var parentB = parentA ? parentA.alternate : null;
if (!parentA || !parentB) {
// We're at the root.
@@ -3141,7 +4197,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
invariant(false, 'Unable to find node on an unmounted component.');
}
- if (a['return'] !== b['return']) {
+ if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
@@ -3218,7 +4274,7 @@ function findCurrentHostFiber(parent) {
if (node.tag === HostComponent || node.tag === HostText) {
return node;
} else if (node.child) {
- node.child['return'] = node;
+ node.child.return = node;
node = node.child;
continue;
}
@@ -3226,12 +4282,12 @@ function findCurrentHostFiber(parent) {
return null;
}
while (!node.sibling) {
- if (!node['return'] || node['return'] === currentParent) {
+ if (!node.return || node.return === currentParent) {
return null;
}
- node = node['return'];
+ node = node.return;
}
- node.sibling['return'] = node['return'];
+ node.sibling.return = node.return;
node = node.sibling;
}
// Flow needs the return null here, but ESLint complains about it.
@@ -3251,7 +4307,7 @@ function findCurrentHostFiberWithNoPortals(parent) {
if (node.tag === HostComponent || node.tag === HostText) {
return node;
} else if (node.child && node.tag !== HostPortal) {
- node.child['return'] = node;
+ node.child.return = node;
node = node.child;
continue;
}
@@ -3259,12 +4315,12 @@ function findCurrentHostFiberWithNoPortals(parent) {
return null;
}
while (!node.sibling) {
- if (!node['return'] || node['return'] === currentParent) {
+ if (!node.return || node.return === currentParent) {
return null;
}
- node = node['return'];
+ node = node.return;
}
- node.sibling['return'] = node['return'];
+ node.sibling.return = node.return;
node = node.sibling;
}
// Flow needs the return null here, but ESLint complains about it.
@@ -3272,6 +4328,460 @@ function findCurrentHostFiberWithNoPortals(parent) {
return null;
}
+function addEventBubbleListener(element, eventType, listener) {
+ element.addEventListener(eventType, listener, false);
+}
+
+function addEventCaptureListener(element, eventType, listener) {
+ element.addEventListener(eventType, listener, true);
+}
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
+ */
+var SyntheticAnimationEvent = SyntheticEvent.extend({
+ animationName: null,
+ elapsedTime: null,
+ pseudoElement: null
+});
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/clipboard-apis/
+ */
+var SyntheticClipboardEvent = SyntheticEvent.extend({
+ clipboardData: function (event) {
+ return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
+ }
+});
+
+/**
+ * @interface FocusEvent
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ */
+var SyntheticFocusEvent = SyntheticUIEvent.extend({
+ relatedTarget: null
+});
+
+/**
+ * `charCode` represents the actual "character code" and is safe to use with
+ * `String.fromCharCode`. As such, only keys that correspond to printable
+ * characters produce a valid `charCode`, the only exception to this is Enter.
+ * The Tab-key is considered non-printable and does not have a `charCode`,
+ * presumably because it does not produce a tab-character in browsers.
+ *
+ * @param {object} nativeEvent Native browser event.
+ * @return {number} Normalized `charCode` property.
+ */
+function getEventCharCode(nativeEvent) {
+ var charCode = void 0;
+ var keyCode = nativeEvent.keyCode;
+
+ if ('charCode' in nativeEvent) {
+ charCode = nativeEvent.charCode;
+
+ // FF does not set `charCode` for the Enter-key, check against `keyCode`.
+ if (charCode === 0 && keyCode === 13) {
+ charCode = 13;
+ }
+ } else {
+ // IE8 does not implement `charCode`, but `keyCode` has the correct value.
+ charCode = keyCode;
+ }
+
+ // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
+ // report Enter as charCode 10 when ctrl is pressed.
+ if (charCode === 10) {
+ charCode = 13;
+ }
+
+ // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
+ // Must not discard the (non-)printable Enter-key.
+ if (charCode >= 32 || charCode === 13) {
+ return charCode;
+ }
+
+ return 0;
+}
+
+/**
+ * Normalization of deprecated HTML5 `key` values
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
+ */
+var normalizeKey = {
+ Esc: 'Escape',
+ Spacebar: ' ',
+ Left: 'ArrowLeft',
+ Up: 'ArrowUp',
+ Right: 'ArrowRight',
+ Down: 'ArrowDown',
+ Del: 'Delete',
+ Win: 'OS',
+ Menu: 'ContextMenu',
+ Apps: 'ContextMenu',
+ Scroll: 'ScrollLock',
+ MozPrintableKey: 'Unidentified'
+};
+
+/**
+ * Translation from legacy `keyCode` to HTML5 `key`
+ * Only special keys supported, all others depend on keyboard layout or browser
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
+ */
+var translateToKey = {
+ '8': 'Backspace',
+ '9': 'Tab',
+ '12': 'Clear',
+ '13': 'Enter',
+ '16': 'Shift',
+ '17': 'Control',
+ '18': 'Alt',
+ '19': 'Pause',
+ '20': 'CapsLock',
+ '27': 'Escape',
+ '32': ' ',
+ '33': 'PageUp',
+ '34': 'PageDown',
+ '35': 'End',
+ '36': 'Home',
+ '37': 'ArrowLeft',
+ '38': 'ArrowUp',
+ '39': 'ArrowRight',
+ '40': 'ArrowDown',
+ '45': 'Insert',
+ '46': 'Delete',
+ '112': 'F1',
+ '113': 'F2',
+ '114': 'F3',
+ '115': 'F4',
+ '116': 'F5',
+ '117': 'F6',
+ '118': 'F7',
+ '119': 'F8',
+ '120': 'F9',
+ '121': 'F10',
+ '122': 'F11',
+ '123': 'F12',
+ '144': 'NumLock',
+ '145': 'ScrollLock',
+ '224': 'Meta'
+};
+
+/**
+ * @param {object} nativeEvent Native browser event.
+ * @return {string} Normalized `key` property.
+ */
+function getEventKey(nativeEvent) {
+ if (nativeEvent.key) {
+ // Normalize inconsistent values reported by browsers due to
+ // implementations of a working draft specification.
+
+ // FireFox implements `key` but returns `MozPrintableKey` for all
+ // printable characters (normalized to `Unidentified`), ignore it.
+ var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
+ if (key !== 'Unidentified') {
+ return key;
+ }
+ }
+
+ // Browser does not implement `key`, polyfill as much of it as we can.
+ if (nativeEvent.type === 'keypress') {
+ var charCode = getEventCharCode(nativeEvent);
+
+ // The enter-key is technically both printable and non-printable and can
+ // thus be captured by `keypress`, no other non-printable key should.
+ return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
+ }
+ if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
+ // While user keyboard layout determines the actual meaning of each
+ // `keyCode` value, almost all function keys have a universal value.
+ return translateToKey[nativeEvent.keyCode] || 'Unidentified';
+ }
+ return '';
+}
+
+/**
+ * @interface KeyboardEvent
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ */
+var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
+ key: getEventKey,
+ location: null,
+ ctrlKey: null,
+ shiftKey: null,
+ altKey: null,
+ metaKey: null,
+ repeat: null,
+ locale: null,
+ getModifierState: getEventModifierState,
+ // Legacy Interface
+ charCode: function (event) {
+ // `charCode` is the result of a KeyPress event and represents the value of
+ // the actual printable character.
+
+ // KeyPress is deprecated, but its replacement is not yet final and not
+ // implemented in any major browser. Only KeyPress has charCode.
+ if (event.type === 'keypress') {
+ return getEventCharCode(event);
+ }
+ return 0;
+ },
+ keyCode: function (event) {
+ // `keyCode` is the result of a KeyDown/Up event and represents the value of
+ // physical keyboard key.
+
+ // The actual meaning of the value depends on the users' keyboard layout
+ // which cannot be detected. Assuming that it is a US keyboard layout
+ // provides a surprisingly accurate mapping for US and European users.
+ // Due to this, it is left to the user to implement at this time.
+ if (event.type === 'keydown' || event.type === 'keyup') {
+ return event.keyCode;
+ }
+ return 0;
+ },
+ which: function (event) {
+ // `which` is an alias for either `keyCode` or `charCode` depending on the
+ // type of the event.
+ if (event.type === 'keypress') {
+ return getEventCharCode(event);
+ }
+ if (event.type === 'keydown' || event.type === 'keyup') {
+ return event.keyCode;
+ }
+ return 0;
+ }
+});
+
+/**
+ * @interface DragEvent
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ */
+var SyntheticDragEvent = SyntheticMouseEvent.extend({
+ dataTransfer: null
+});
+
+/**
+ * @interface TouchEvent
+ * @see http://www.w3.org/TR/touch-events/
+ */
+var SyntheticTouchEvent = SyntheticUIEvent.extend({
+ touches: null,
+ targetTouches: null,
+ changedTouches: null,
+ altKey: null,
+ metaKey: null,
+ ctrlKey: null,
+ shiftKey: null,
+ getModifierState: getEventModifierState
+});
+
+/**
+ * @interface Event
+ * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
+ */
+var SyntheticTransitionEvent = SyntheticEvent.extend({
+ propertyName: null,
+ elapsedTime: null,
+ pseudoElement: null
+});
+
+/**
+ * @interface WheelEvent
+ * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ */
+var SyntheticWheelEvent = SyntheticMouseEvent.extend({
+ deltaX: function (event) {
+ return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
+ 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
+ },
+ deltaY: function (event) {
+ return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
+ 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
+ 'wheelDelta' in event ? -event.wheelDelta : 0;
+ },
+
+ deltaZ: null,
+
+ // Browsers without "deltaMode" is reporting in raw wheel delta where one
+ // notch on the scroll is always +/- 120, roughly equivalent to pixels.
+ // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
+ // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
+ deltaMode: null
+});
+
+/**
+ * Turns
+ * ['abort', ...]
+ * into
+ * eventTypes = {
+ * 'abort': {
+ * phasedRegistrationNames: {
+ * bubbled: 'onAbort',
+ * captured: 'onAbortCapture',
+ * },
+ * dependencies: [TOP_ABORT],
+ * },
+ * ...
+ * };
+ * topLevelEventsToDispatchConfig = new Map([
+ * [TOP_ABORT, { sameConfig }],
+ * ]);
+ */
+
+var interactiveEventTypeNames = [[TOP_BLUR, 'blur'], [TOP_CANCEL, 'cancel'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_AUX_CLICK, 'auxClick'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_START, 'dragStart'], [TOP_DROP, 'drop'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_INVALID, 'invalid'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_POINTER_CANCEL, 'pointerCancel'], [TOP_POINTER_DOWN, 'pointerDown'], [TOP_POINTER_UP, 'pointerUp'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_RESET, 'reset'], [TOP_SEEKED, 'seeked'], [TOP_SUBMIT, 'submit'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_START, 'touchStart'], [TOP_VOLUME_CHANGE, 'volumeChange']];
+var nonInteractiveEventTypeNames = [[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_LOAD_START, 'loadStart'], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']];
+
+var eventTypes$4 = {};
+var topLevelEventsToDispatchConfig = {};
+
+function addEventTypeNameToConfig(_ref, isInteractive) {
+ var topEvent = _ref[0],
+ event = _ref[1];
+
+ var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
+ var onEvent = 'on' + capitalizedEvent;
+
+ var type = {
+ phasedRegistrationNames: {
+ bubbled: onEvent,
+ captured: onEvent + 'Capture'
+ },
+ dependencies: [topEvent],
+ isInteractive: isInteractive
+ };
+ eventTypes$4[event] = type;
+ topLevelEventsToDispatchConfig[topEvent] = type;
+}
+
+interactiveEventTypeNames.forEach(function (eventTuple) {
+ addEventTypeNameToConfig(eventTuple, true);
+});
+nonInteractiveEventTypeNames.forEach(function (eventTuple) {
+ addEventTypeNameToConfig(eventTuple, false);
+});
+
+// Only used in DEV for exhaustiveness validation.
+var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
+
+var SimpleEventPlugin = {
+ eventTypes: eventTypes$4,
+
+ isInteractiveTopLevelEventType: function (topLevelType) {
+ var config = topLevelEventsToDispatchConfig[topLevelType];
+ return config !== undefined && config.isInteractive === true;
+ },
+
+
+ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
+ var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
+ if (!dispatchConfig) {
+ return null;
+ }
+ var EventConstructor = void 0;
+ switch (topLevelType) {
+ case TOP_KEY_PRESS:
+ // Firefox creates a keypress event for function keys too. This removes
+ // the unwanted keypress events. Enter is however both printable and
+ // non-printable. One would expect Tab to be as well (but it isn't).
+ if (getEventCharCode(nativeEvent) === 0) {
+ return null;
+ }
+ /* falls through */
+ case TOP_KEY_DOWN:
+ case TOP_KEY_UP:
+ EventConstructor = SyntheticKeyboardEvent;
+ break;
+ case TOP_BLUR:
+ case TOP_FOCUS:
+ EventConstructor = SyntheticFocusEvent;
+ break;
+ case TOP_CLICK:
+ // Firefox creates a click event on right mouse clicks. This removes the
+ // unwanted click events.
+ if (nativeEvent.button === 2) {
+ return null;
+ }
+ /* falls through */
+ case TOP_AUX_CLICK:
+ case TOP_DOUBLE_CLICK:
+ case TOP_MOUSE_DOWN:
+ case TOP_MOUSE_MOVE:
+ case TOP_MOUSE_UP:
+ // TODO: Disabled elements should not respond to mouse events
+ /* falls through */
+ case TOP_MOUSE_OUT:
+ case TOP_MOUSE_OVER:
+ case TOP_CONTEXT_MENU:
+ EventConstructor = SyntheticMouseEvent;
+ break;
+ case TOP_DRAG:
+ case TOP_DRAG_END:
+ case TOP_DRAG_ENTER:
+ case TOP_DRAG_EXIT:
+ case TOP_DRAG_LEAVE:
+ case TOP_DRAG_OVER:
+ case TOP_DRAG_START:
+ case TOP_DROP:
+ EventConstructor = SyntheticDragEvent;
+ break;
+ case TOP_TOUCH_CANCEL:
+ case TOP_TOUCH_END:
+ case TOP_TOUCH_MOVE:
+ case TOP_TOUCH_START:
+ EventConstructor = SyntheticTouchEvent;
+ break;
+ case TOP_ANIMATION_END:
+ case TOP_ANIMATION_ITERATION:
+ case TOP_ANIMATION_START:
+ EventConstructor = SyntheticAnimationEvent;
+ break;
+ case TOP_TRANSITION_END:
+ EventConstructor = SyntheticTransitionEvent;
+ break;
+ case TOP_SCROLL:
+ EventConstructor = SyntheticUIEvent;
+ break;
+ case TOP_WHEEL:
+ EventConstructor = SyntheticWheelEvent;
+ break;
+ case TOP_COPY:
+ case TOP_CUT:
+ case TOP_PASTE:
+ EventConstructor = SyntheticClipboardEvent;
+ break;
+ case TOP_GOT_POINTER_CAPTURE:
+ case TOP_LOST_POINTER_CAPTURE:
+ case TOP_POINTER_CANCEL:
+ case TOP_POINTER_DOWN:
+ case TOP_POINTER_MOVE:
+ case TOP_POINTER_OUT:
+ case TOP_POINTER_OVER:
+ case TOP_POINTER_UP:
+ EventConstructor = SyntheticPointerEvent;
+ break;
+ default:
+ {
+ if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
+ warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
+ }
+ }
+ // HTML Events
+ // @see http://www.w3.org/TR/html5/index.html#events-0
+ EventConstructor = SyntheticEvent;
+ break;
+ }
+ var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
+ accumulateTwoPhaseDispatches(event);
+ return event;
+ }
+};
+
+var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType;
+
+
var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
var callbackBookkeepingPool = [];
@@ -3284,8 +4794,8 @@ function findRootContainerNode(inst) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
- while (inst['return']) {
- inst = inst['return'];
+ while (inst.return) {
+ inst = inst.return;
}
if (inst.tag !== HostRoot) {
// This can happen if we're in a detached tree.
@@ -3321,7 +4831,7 @@ function releaseTopLevelCallbackBookKeeping(instance) {
}
}
-function handleTopLevelImpl(bookKeeping) {
+function handleTopLevel(bookKeeping) {
var targetInst = bookKeeping.targetInst;
// Loop through the hierarchy, in case there's any nested components.
@@ -3344,17 +4854,12 @@ function handleTopLevelImpl(bookKeeping) {
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
targetInst = bookKeeping.ancestors[i];
- _handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
// TODO: can we stop exporting these?
var _enabled = true;
-var _handleTopLevel = void 0;
-
-function setHandleTopLevel(handleTopLevel) {
- _handleTopLevel = handleTopLevel;
-}
function setEnabled(enabled) {
_enabled = !!enabled;
@@ -3367,35 +4872,45 @@ function isEnabled() {
/**
* Traps top-level events by using event bubbling.
*
- * @param {string} topLevelType Record from `BrowserEventConstants`.
- * @param {string} handlerBaseName Event name (e.g. "click").
+ * @param {number} topLevelType Number from `TopLevelEventTypes`.
* @param {object} element Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
-function trapBubbledEvent(topLevelType, handlerBaseName, element) {
+function trapBubbledEvent(topLevelType, element) {
if (!element) {
return null;
}
- return EventListener.listen(element, handlerBaseName, dispatchEvent.bind(null, topLevelType));
+ var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
+
+ addEventBubbleListener(element, getRawEventName(topLevelType),
+ // Check if interactive and wrap in interactiveUpdates
+ dispatch.bind(null, topLevelType));
}
/**
* Traps a top-level event by using event capturing.
*
- * @param {string} topLevelType Record from `BrowserEventConstants`.
- * @param {string} handlerBaseName Event name (e.g. "click").
+ * @param {number} topLevelType Number from `TopLevelEventTypes`.
* @param {object} element Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
-function trapCapturedEvent(topLevelType, handlerBaseName, element) {
+function trapCapturedEvent(topLevelType, element) {
if (!element) {
return null;
}
- return EventListener.capture(element, handlerBaseName, dispatchEvent.bind(null, topLevelType));
+ var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
+
+ addEventCaptureListener(element, getRawEventName(topLevelType),
+ // Check if interactive and wrap in interactiveUpdates
+ dispatch.bind(null, topLevelType));
+}
+
+function dispatchInteractiveEvent(topLevelType, nativeEvent) {
+ interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);
}
function dispatchEvent(topLevelType, nativeEvent) {
@@ -3418,206 +4933,12 @@ function dispatchEvent(topLevelType, nativeEvent) {
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
- batchedUpdates(handleTopLevelImpl, bookKeeping);
+ batchedUpdates(handleTopLevel, bookKeeping);
} finally {
releaseTopLevelCallbackBookKeeping(bookKeeping);
}
}
-var ReactDOMEventListener = Object.freeze({
- get _enabled () { return _enabled; },
- get _handleTopLevel () { return _handleTopLevel; },
- setHandleTopLevel: setHandleTopLevel,
- setEnabled: setEnabled,
- isEnabled: isEnabled,
- trapBubbledEvent: trapBubbledEvent,
- trapCapturedEvent: trapCapturedEvent,
- dispatchEvent: dispatchEvent
-});
-
-/**
- * Generate a mapping of standard vendor prefixes using the defined style property and event name.
- *
- * @param {string} styleProp
- * @param {string} eventName
- * @returns {object}
- */
-function makePrefixMap(styleProp, eventName) {
- var prefixes = {};
-
- prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
- prefixes['Webkit' + styleProp] = 'webkit' + eventName;
- prefixes['Moz' + styleProp] = 'moz' + eventName;
- prefixes['ms' + styleProp] = 'MS' + eventName;
- prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
-
- return prefixes;
-}
-
-/**
- * A list of event names to a configurable list of vendor prefixes.
- */
-var vendorPrefixes = {
- animationend: makePrefixMap('Animation', 'AnimationEnd'),
- animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
- animationstart: makePrefixMap('Animation', 'AnimationStart'),
- transitionend: makePrefixMap('Transition', 'TransitionEnd')
-};
-
-/**
- * Event names that have already been detected and prefixed (if applicable).
- */
-var prefixedEventNames = {};
-
-/**
- * Element to check for prefixes on.
- */
-var style = {};
-
-/**
- * Bootstrap if a DOM exists.
- */
-if (ExecutionEnvironment.canUseDOM) {
- style = document.createElement('div').style;
-
- // On some platforms, in particular some releases of Android 4.x,
- // the un-prefixed "animation" and "transition" properties are defined on the
- // style object but the events that fire will still be prefixed, so we need
- // to check if the un-prefixed events are usable, and if not remove them from the map.
- if (!('AnimationEvent' in window)) {
- delete vendorPrefixes.animationend.animation;
- delete vendorPrefixes.animationiteration.animation;
- delete vendorPrefixes.animationstart.animation;
- }
-
- // Same as above
- if (!('TransitionEvent' in window)) {
- delete vendorPrefixes.transitionend.transition;
- }
-}
-
-/**
- * Attempts to determine the correct vendor prefixed event name.
- *
- * @param {string} eventName
- * @returns {string}
- */
-function getVendorPrefixedEventName(eventName) {
- if (prefixedEventNames[eventName]) {
- return prefixedEventNames[eventName];
- } else if (!vendorPrefixes[eventName]) {
- return eventName;
- }
-
- var prefixMap = vendorPrefixes[eventName];
-
- for (var styleProp in prefixMap) {
- if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
- return prefixedEventNames[eventName] = prefixMap[styleProp];
- }
- }
-
- return '';
-}
-
-/**
- * Types of raw signals from the browser caught at the top level.
- *
- * For events like 'submit' which don't consistently bubble (which we
- * trap at a lower node than `document`), binding at `document` would
- * cause duplicate events so we don't include them here.
- */
-var topLevelTypes$1 = {
- topAbort: 'abort',
- topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
- topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
- topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
- topBlur: 'blur',
- topCancel: 'cancel',
- topCanPlay: 'canplay',
- topCanPlayThrough: 'canplaythrough',
- topChange: 'change',
- topClick: 'click',
- topClose: 'close',
- topCompositionEnd: 'compositionend',
- topCompositionStart: 'compositionstart',
- topCompositionUpdate: 'compositionupdate',
- topContextMenu: 'contextmenu',
- topCopy: 'copy',
- topCut: 'cut',
- topDoubleClick: 'dblclick',
- topDrag: 'drag',
- topDragEnd: 'dragend',
- topDragEnter: 'dragenter',
- topDragExit: 'dragexit',
- topDragLeave: 'dragleave',
- topDragOver: 'dragover',
- topDragStart: 'dragstart',
- topDrop: 'drop',
- topDurationChange: 'durationchange',
- topEmptied: 'emptied',
- topEncrypted: 'encrypted',
- topEnded: 'ended',
- topError: 'error',
- topFocus: 'focus',
- topInput: 'input',
- topKeyDown: 'keydown',
- topKeyPress: 'keypress',
- topKeyUp: 'keyup',
- topLoadedData: 'loadeddata',
- topLoad: 'load',
- topLoadedMetadata: 'loadedmetadata',
- topLoadStart: 'loadstart',
- topMouseDown: 'mousedown',
- topMouseMove: 'mousemove',
- topMouseOut: 'mouseout',
- topMouseOver: 'mouseover',
- topMouseUp: 'mouseup',
- topPaste: 'paste',
- topPause: 'pause',
- topPlay: 'play',
- topPlaying: 'playing',
- topProgress: 'progress',
- topRateChange: 'ratechange',
- topScroll: 'scroll',
- topSeeked: 'seeked',
- topSeeking: 'seeking',
- topSelectionChange: 'selectionchange',
- topStalled: 'stalled',
- topSuspend: 'suspend',
- topTextInput: 'textInput',
- topTimeUpdate: 'timeupdate',
- topToggle: 'toggle',
- topTouchCancel: 'touchcancel',
- topTouchEnd: 'touchend',
- topTouchMove: 'touchmove',
- topTouchStart: 'touchstart',
- topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
- topVolumeChange: 'volumechange',
- topWaiting: 'waiting',
- topWheel: 'wheel'
-};
-
-var BrowserEventConstants = {
- topLevelTypes: topLevelTypes$1
-};
-
-function runEventQueueInBatch(events) {
- enqueueEvents(events);
- processEventQueue(false);
-}
-
-/**
- * Streams a fired top-level event to `EventPluginHub` where plugins have the
- * opportunity to create `ReactEvent`s to be dispatched.
- */
-function handleTopLevel(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
- runEventQueueInBatch(events);
-}
-
-var topLevelTypes = BrowserEventConstants.topLevelTypes;
-
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
@@ -3711,39 +5032,49 @@ function getListeningForDocument(mountAt) {
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
- * @param {object} contentDocumentHandle Document which owns the container
+ * @param {object} mountAt Container where to mount the listener
*/
-function listenTo(registrationName, contentDocumentHandle) {
- var mountAt = contentDocumentHandle;
+function listenTo(registrationName, mountAt) {
var isListening = getListeningForDocument(mountAt);
var dependencies = registrationNameDependencies[registrationName];
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
- if (dependency === 'topScroll') {
- trapCapturedEvent('topScroll', 'scroll', mountAt);
- } else if (dependency === 'topFocus' || dependency === 'topBlur') {
- trapCapturedEvent('topFocus', 'focus', mountAt);
- trapCapturedEvent('topBlur', 'blur', mountAt);
-
- // to make sure blur and focus event listeners are only attached once
- isListening.topBlur = true;
- isListening.topFocus = true;
- } else if (dependency === 'topCancel') {
- if (isEventSupported('cancel', true)) {
- trapCapturedEvent('topCancel', 'cancel', mountAt);
- }
- isListening.topCancel = true;
- } else if (dependency === 'topClose') {
- if (isEventSupported('close', true)) {
- trapCapturedEvent('topClose', 'close', mountAt);
- }
- isListening.topClose = true;
- } else if (topLevelTypes.hasOwnProperty(dependency)) {
- trapBubbledEvent(dependency, topLevelTypes[dependency], mountAt);
+ switch (dependency) {
+ case TOP_SCROLL:
+ trapCapturedEvent(TOP_SCROLL, mountAt);
+ break;
+ case TOP_FOCUS:
+ case TOP_BLUR:
+ trapCapturedEvent(TOP_FOCUS, mountAt);
+ trapCapturedEvent(TOP_BLUR, mountAt);
+ // We set the flag for a single dependency later in this function,
+ // but this ensures we mark both as attached rather than just one.
+ isListening[TOP_BLUR] = true;
+ isListening[TOP_FOCUS] = true;
+ break;
+ case TOP_CANCEL:
+ case TOP_CLOSE:
+ if (isEventSupported(getRawEventName(dependency))) {
+ trapCapturedEvent(dependency, mountAt);
+ }
+ break;
+ case TOP_INVALID:
+ case TOP_SUBMIT:
+ case TOP_RESET:
+ // We listen to them on the target DOM elements.
+ // Some of them bubble so we don't want them to fire twice.
+ break;
+ default:
+ // By default, listen on the top level to all non-media events.
+ // Media events don't bubble so adding the listener wouldn't do anything.
+ var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1;
+ if (!isMediaEvent) {
+ trapBubbledEvent(dependency, mountAt);
+ }
+ break;
}
-
isListening[dependency] = true;
}
}
@@ -3761,6 +5092,18 @@ function isListeningToAllDependencies(registrationName, mountAt) {
return true;
}
+function getActiveElement(doc) {
+ doc = doc || (typeof document !== 'undefined' ? document : undefined);
+ if (typeof doc === 'undefined') {
+ return null;
+ }
+ try {
+ return doc.activeElement || doc.body;
+ } catch (e) {
+ return doc.body;
+ }
+}
+
/**
* Given any node return the first leaf node without children.
*
@@ -3825,7 +5168,10 @@ function getNodeForCharacterOffset(root, offset) {
* @return {?object}
*/
function getOffsets(outerNode) {
- var selection = window.getSelection && window.getSelection();
+ var ownerDocument = outerNode.ownerDocument;
+
+ var win = ownerDocument && ownerDocument.defaultView || window;
+ var selection = win.getSelection && win.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
@@ -3833,7 +5179,7 @@ function getOffsets(outerNode) {
var anchorNode = selection.anchorNode,
anchorOffset = selection.anchorOffset,
- focusNode$$1 = selection.focusNode,
+ focusNode = selection.focusNode,
focusOffset = selection.focusOffset;
// In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
@@ -3847,13 +5193,13 @@ function getOffsets(outerNode) {
try {
/* eslint-disable no-unused-expressions */
anchorNode.nodeType;
- focusNode$$1.nodeType;
+ focusNode.nodeType;
/* eslint-enable no-unused-expressions */
} catch (e) {
return null;
}
- return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode$$1, focusOffset);
+ return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
}
/**
@@ -3865,7 +5211,7 @@ function getOffsets(outerNode) {
*
* Exported only for testing.
*/
-function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode$$1, focusOffset) {
+function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
var length = 0;
var start = -1;
var end = -1;
@@ -3881,7 +5227,7 @@ function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNo
if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
start = length + anchorOffset;
}
- if (node === focusNode$$1 && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
+ if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
end = length + focusOffset;
}
@@ -3908,7 +5254,7 @@ function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNo
if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
start = length;
}
- if (parentNode === focusNode$$1 && ++indexWithinFocus === focusOffset) {
+ if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
end = length;
}
if ((next = node.nextSibling) !== null) {
@@ -3947,12 +5293,10 @@ function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNo
* @param {object} offsets
*/
function setOffsets(node, offsets) {
- if (!window.getSelection) {
- return;
- }
-
- var selection = window.getSelection();
- var length = node[getTextContentAccessor()].length;
+ var doc = node.ownerDocument || document;
+ var win = doc && doc.defaultView || window;
+ var selection = win.getSelection();
+ var length = node.textContent.length;
var start = Math.min(offsets.start, length);
var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
@@ -3971,7 +5315,7 @@ function setOffsets(node, offsets) {
if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
return;
}
- var range = document.createRange();
+ var range = doc.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
@@ -3985,8 +5329,46 @@ function setOffsets(node, offsets) {
}
}
+function isTextNode(node) {
+ return node && node.nodeType === TEXT_NODE;
+}
+
+function containsNode(outerNode, innerNode) {
+ if (!outerNode || !innerNode) {
+ return false;
+ } else if (outerNode === innerNode) {
+ return true;
+ } else if (isTextNode(outerNode)) {
+ return false;
+ } else if (isTextNode(innerNode)) {
+ return containsNode(outerNode, innerNode.parentNode);
+ } else if ('contains' in outerNode) {
+ return outerNode.contains(innerNode);
+ } else if (outerNode.compareDocumentPosition) {
+ return !!(outerNode.compareDocumentPosition(innerNode) & 16);
+ } else {
+ return false;
+ }
+}
+
function isInDocument(node) {
- return containsNode(document.documentElement, node);
+ return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
+}
+
+function getActiveElementDeep() {
+ var win = window;
+ var element = getActiveElement();
+ while (element instanceof win.HTMLIFrameElement) {
+ // Accessing the contentDocument of a HTMLIframeElement can cause the browser
+ // to throw, e.g. if it has a cross-origin src attribute
+ try {
+ win = element.contentDocument.defaultView;
+ } catch (e) {
+ return element;
+ }
+ element = getActiveElement(win.document);
+ }
+ return element;
}
/**
@@ -3996,13 +5378,18 @@ function isInDocument(node) {
* Input selection module for React.
*/
+/**
+ * @hasSelectionCapabilities: we get the element types that support selection
+ * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
+ * and `selectionEnd` rows.
+ */
function hasSelectionCapabilities(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
- return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
+ return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
}
function getSelectionInformation() {
- var focusedElem = getActiveElement();
+ var focusedElem = getActiveElementDeep();
return {
focusedElem: focusedElem,
selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
@@ -4015,11 +5402,11 @@ function getSelectionInformation() {
* nodes and place them back in, resulting in focus being lost.
*/
function restoreSelection(priorSelectionInformation) {
- var curFocusedElem = getActiveElement();
+ var curFocusedElem = getActiveElementDeep();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
- if (hasSelectionCapabilities(priorFocusedElem)) {
+ if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
setSelection(priorFocusedElem, priorSelectionRange);
}
@@ -4036,7 +5423,9 @@ function restoreSelection(priorSelectionInformation) {
}
}
- focusNode(priorFocusedElem);
+ if (typeof priorFocusedElem.focus === 'function') {
+ priorFocusedElem.focus();
+ }
for (var i = 0; i < ancestors.length; i++) {
var info = ancestors[i];
@@ -4091,7 +5480,7 @@ function setSelection(input, offsets) {
}
}
-var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
+var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes$3 = {
select: {
@@ -4099,7 +5488,7 @@ var eventTypes$3 = {
bubbled: 'onSelect',
captured: 'onSelectCapture'
},
- dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
+ dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
}
};
@@ -4123,8 +5512,9 @@ function getSelection(node) {
start: node.selectionStart,
end: node.selectionEnd
};
- } else if (window.getSelection) {
- var selection = window.getSelection();
+ } else {
+ var win = node.ownerDocument && node.ownerDocument.defaultView || window;
+ var selection = win.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
@@ -4135,9 +5525,20 @@ function getSelection(node) {
}
/**
+ * Get document associated with the event target.
+ *
+ * @param {object} nativeEventTarget
+ * @return {Document}
+ */
+function getEventTargetDocument(eventTarget) {
+ return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
+}
+
+/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
+ * @param {object} nativeEventTarget
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent, nativeEventTarget) {
@@ -4145,7 +5546,9 @@ function constructSelectEvent(nativeEvent, nativeEventTarget) {
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
- if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) {
+ var doc = getEventTargetDocument(nativeEventTarget);
+
+ if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
return null;
}
@@ -4154,7 +5557,7 @@ function constructSelectEvent(nativeEvent, nativeEventTarget) {
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement$1;
@@ -4185,7 +5588,7 @@ var SelectEventPlugin = {
eventTypes: eventTypes$3,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : nativeEventTarget.nodeType === DOCUMENT_NODE ? nativeEventTarget : nativeEventTarget.ownerDocument;
+ var doc = getEventTargetDocument(nativeEventTarget);
// Track whether all listeners exists for this plugin. If none exist, we do
// not extract events. See #3639.
if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
@@ -4196,25 +5599,26 @@ var SelectEventPlugin = {
switch (topLevelType) {
// Track the input node that has focus.
- case 'topFocus':
+ case TOP_FOCUS:
if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
activeElement$1 = targetNode;
activeElementInst$1 = targetInst;
lastSelection = null;
}
break;
- case 'topBlur':
+ case TOP_BLUR:
activeElement$1 = null;
activeElementInst$1 = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
- case 'topMouseDown':
+ case TOP_MOUSE_DOWN:
mouseDown = true;
break;
- case 'topContextMenu':
- case 'topMouseUp':
+ case TOP_CONTEXT_MENU:
+ case TOP_MOUSE_UP:
+ case TOP_DRAG_END:
mouseDown = false;
return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
@@ -4226,13 +5630,13 @@ var SelectEventPlugin = {
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
- case 'topSelectionChange':
+ case TOP_SELECTION_CHANGE:
if (skipSelectionChangeEvent) {
break;
}
// falls through
- case 'topKeyDown':
- case 'topKeyUp':
+ case TOP_KEY_DOWN:
+ case TOP_KEY_UP:
return constructSelectEvent(nativeEvent, nativeEventTarget);
}
@@ -4241,697 +5645,3222 @@ var SelectEventPlugin = {
};
/**
- * @interface Event
- * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
+ * Inject modules for resolving DOM hierarchy and plugin ordering.
*/
-var AnimationEventInterface = {
- animationName: null,
- elapsedTime: null,
- pseudoElement: null
-};
+injection.injectEventPluginOrder(DOMEventPluginOrder);
+setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
+ * Some important event plugins included by default (without having to require
+ * them).
*/
-function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
+injection.injectEventPluginsByName({
+ SimpleEventPlugin: SimpleEventPlugin,
+ EnterLeaveEventPlugin: EnterLeaveEventPlugin,
+ ChangeEventPlugin: ChangeEventPlugin,
+ SelectEventPlugin: SelectEventPlugin,
+ BeforeInputEventPlugin: BeforeInputEventPlugin
+});
+
+var didWarnSelectedSetOnOption = false;
+var didWarnInvalidChild = false;
-SyntheticEvent$1.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
+function flattenChildren(children) {
+ var content = '';
+
+ // Flatten children. We'll warn if they are invalid
+ // during validateProps() which runs for hydration too.
+ // Note that this would throw on non-element objects.
+ // Elements are stringified (which is normally irrelevant
+ // but matters for <fbt>).
+ React.Children.forEach(children, function (child) {
+ if (child == null) {
+ return;
+ }
+ content += child;
+ // Note: we don't warn about invalid children here.
+ // Instead, this is done separately below so that
+ // it happens during the hydration codepath too.
+ });
+
+ return content;
+}
/**
- * @interface Event
- * @see http://www.w3.org/TR/clipboard-apis/
+ * Implements an <option> host component that warns when `selected` is set.
*/
-var ClipboardEventInterface = {
- clipboardData: function (event) {
- return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
+
+function validateProps(element, props) {
+ {
+ // This mirrors the codepath above, but runs for hydration too.
+ // Warn about invalid children here so that client and hydration are consistent.
+ // TODO: this seems like it could cause a DEV-only throw for hydration
+ // if children contains a non-element object. We should try to avoid that.
+ if (typeof props.children === 'object' && props.children !== null) {
+ React.Children.forEach(props.children, function (child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === 'string' || typeof child === 'number') {
+ return;
+ }
+ if (typeof child.type !== 'string') {
+ return;
+ }
+ if (!didWarnInvalidChild) {
+ didWarnInvalidChild = true;
+ warning$1(false, 'Only strings and numbers are supported as <option> children.');
+ }
+ });
+ }
+
+ // TODO: Remove support for `selected` in <option>.
+ if (props.selected != null && !didWarnSelectedSetOnOption) {
+ warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
+ didWarnSelectedSetOnOption = true;
+ }
}
-};
+}
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
- */
-function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+function postMountWrapper$1(element, props) {
+ // value="" should make a value attribute (#6219)
+ if (props.value != null) {
+ element.setAttribute('value', toString(getToStringValue(props.value)));
+ }
}
-SyntheticEvent$1.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
+function getHostProps$1(element, props) {
+ var hostProps = _assign({ children: undefined }, props);
+ var content = flattenChildren(props.children);
-/**
- * @interface FocusEvent
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
- */
-var FocusEventInterface = {
- relatedTarget: null
-};
+ if (content) {
+ hostProps.children = content;
+ }
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticUIEvent}
- */
-function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+ return hostProps;
+}
+
+// TODO: direct imports like some-package/src/* are bad. Fix me.
+var didWarnValueDefaultValue$1 = void 0;
+
+{
+ didWarnValueDefaultValue$1 = false;
+}
+
+function getDeclarationErrorAddendum() {
+ var ownerName = getCurrentFiberOwnerNameInDevOrNull();
+ if (ownerName) {
+ return '\n\nCheck the render method of `' + ownerName + '`.';
+ }
+ return '';
}
-SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
+var valuePropNames = ['value', 'defaultValue'];
/**
- * `charCode` represents the actual "character code" and is safe to use with
- * `String.fromCharCode`. As such, only keys that correspond to printable
- * characters produce a valid `charCode`, the only exception to this is Enter.
- * The Tab-key is considered non-printable and does not have a `charCode`,
- * presumably because it does not produce a tab-character in browsers.
- *
- * @param {object} nativeEvent Native browser event.
- * @return {number} Normalized `charCode` property.
+ * Validation function for `value` and `defaultValue`.
*/
-function getEventCharCode(nativeEvent) {
- var charCode;
- var keyCode = nativeEvent.keyCode;
-
- if ('charCode' in nativeEvent) {
- charCode = nativeEvent.charCode;
+function checkSelectPropTypes(props) {
+ ReactControlledValuePropTypes.checkPropTypes('select', props);
- // FF does not set `charCode` for the Enter-key, check against `keyCode`.
- if (charCode === 0 && keyCode === 13) {
- charCode = 13;
+ for (var i = 0; i < valuePropNames.length; i++) {
+ var propName = valuePropNames[i];
+ if (props[propName] == null) {
+ continue;
+ }
+ var isArray = Array.isArray(props[propName]);
+ if (props.multiple && !isArray) {
+ warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
+ } else if (!props.multiple && isArray) {
+ warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
}
- } else {
- // IE8 does not implement `charCode`, but `keyCode` has the correct value.
- charCode = keyCode;
}
+}
- // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
- // Must not discard the (non-)printable Enter-key.
- if (charCode >= 32 || charCode === 13) {
- return charCode;
- }
+function updateOptions(node, multiple, propValue, setDefaultSelected) {
+ var options = node.options;
- return 0;
+ if (multiple) {
+ var selectedValues = propValue;
+ var selectedValue = {};
+ for (var i = 0; i < selectedValues.length; i++) {
+ // Prefix to avoid chaos with special keys.
+ selectedValue['$' + selectedValues[i]] = true;
+ }
+ for (var _i = 0; _i < options.length; _i++) {
+ var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
+ if (options[_i].selected !== selected) {
+ options[_i].selected = selected;
+ }
+ if (selected && setDefaultSelected) {
+ options[_i].defaultSelected = true;
+ }
+ }
+ } else {
+ // Do not set `select.value` as exact behavior isn't consistent across all
+ // browsers for all cases.
+ var _selectedValue = toString(getToStringValue(propValue));
+ var defaultSelected = null;
+ for (var _i2 = 0; _i2 < options.length; _i2++) {
+ if (options[_i2].value === _selectedValue) {
+ options[_i2].selected = true;
+ if (setDefaultSelected) {
+ options[_i2].defaultSelected = true;
+ }
+ return;
+ }
+ if (defaultSelected === null && !options[_i2].disabled) {
+ defaultSelected = options[_i2];
+ }
+ }
+ if (defaultSelected !== null) {
+ defaultSelected.selected = true;
+ }
+ }
}
/**
- * Normalization of deprecated HTML5 `key` values
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
+ * Implements a <select> host component that allows optionally setting the
+ * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
+ * stringable. If `multiple` is true, the prop must be an array of stringables.
+ *
+ * If `value` is not supplied (or null/undefined), user actions that change the
+ * selected option will trigger updates to the rendered options.
+ *
+ * If it is supplied (and not null/undefined), the rendered options will not
+ * update in response to user actions. Instead, the `value` prop must change in
+ * order for the rendered options to update.
+ *
+ * If `defaultValue` is provided, any options with the supplied values will be
+ * selected.
*/
-var normalizeKey = {
- Esc: 'Escape',
- Spacebar: ' ',
- Left: 'ArrowLeft',
- Up: 'ArrowUp',
- Right: 'ArrowRight',
- Down: 'ArrowDown',
- Del: 'Delete',
- Win: 'OS',
- Menu: 'ContextMenu',
- Apps: 'ContextMenu',
- Scroll: 'ScrollLock',
- MozPrintableKey: 'Unidentified'
-};
-/**
- * Translation from legacy `keyCode` to HTML5 `key`
- * Only special keys supported, all others depend on keyboard layout or browser
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
- */
-var translateToKey = {
- '8': 'Backspace',
- '9': 'Tab',
- '12': 'Clear',
- '13': 'Enter',
- '16': 'Shift',
- '17': 'Control',
- '18': 'Alt',
- '19': 'Pause',
- '20': 'CapsLock',
- '27': 'Escape',
- '32': ' ',
- '33': 'PageUp',
- '34': 'PageDown',
- '35': 'End',
- '36': 'Home',
- '37': 'ArrowLeft',
- '38': 'ArrowUp',
- '39': 'ArrowRight',
- '40': 'ArrowDown',
- '45': 'Insert',
- '46': 'Delete',
- '112': 'F1',
- '113': 'F2',
- '114': 'F3',
- '115': 'F4',
- '116': 'F5',
- '117': 'F6',
- '118': 'F7',
- '119': 'F8',
- '120': 'F9',
- '121': 'F10',
- '122': 'F11',
- '123': 'F12',
- '144': 'NumLock',
- '145': 'ScrollLock',
- '224': 'Meta'
-};
+function getHostProps$2(element, props) {
+ return _assign({}, props, {
+ value: undefined
+ });
+}
-/**
- * @param {object} nativeEvent Native browser event.
- * @return {string} Normalized `key` property.
- */
-function getEventKey(nativeEvent) {
- if (nativeEvent.key) {
- // Normalize inconsistent values reported by browsers due to
- // implementations of a working draft specification.
+function initWrapperState$1(element, props) {
+ var node = element;
+ {
+ checkSelectPropTypes(props);
+ }
- // FireFox implements `key` but returns `MozPrintableKey` for all
- // printable characters (normalized to `Unidentified`), ignore it.
- var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
- if (key !== 'Unidentified') {
- return key;
+ node._wrapperState = {
+ wasMultiple: !!props.multiple
+ };
+
+ {
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
+ warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
+ didWarnValueDefaultValue$1 = true;
}
}
+}
- // Browser does not implement `key`, polyfill as much of it as we can.
- if (nativeEvent.type === 'keypress') {
- var charCode = getEventCharCode(nativeEvent);
+function postMountWrapper$2(element, props) {
+ var node = element;
+ node.multiple = !!props.multiple;
+ var value = props.value;
+ if (value != null) {
+ updateOptions(node, !!props.multiple, value, false);
+ } else if (props.defaultValue != null) {
+ updateOptions(node, !!props.multiple, props.defaultValue, true);
+ }
+}
- // The enter-key is technically both printable and non-printable and can
- // thus be captured by `keypress`, no other non-printable key should.
- return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
+function postUpdateWrapper(element, props) {
+ var node = element;
+ var wasMultiple = node._wrapperState.wasMultiple;
+ node._wrapperState.wasMultiple = !!props.multiple;
+
+ var value = props.value;
+ if (value != null) {
+ updateOptions(node, !!props.multiple, value, false);
+ } else if (wasMultiple !== !!props.multiple) {
+ // For simplicity, reapply `defaultValue` if `multiple` is toggled.
+ if (props.defaultValue != null) {
+ updateOptions(node, !!props.multiple, props.defaultValue, true);
+ } else {
+ // Revert the select back to its default unselected state.
+ updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
+ }
}
- if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
- // While user keyboard layout determines the actual meaning of each
- // `keyCode` value, almost all function keys have a universal value.
- return translateToKey[nativeEvent.keyCode] || 'Unidentified';
+}
+
+function restoreControlledState$2(element, props) {
+ var node = element;
+ var value = props.value;
+
+ if (value != null) {
+ updateOptions(node, !!props.multiple, value, false);
}
- return '';
}
+var didWarnValDefaultVal = false;
+
/**
- * @interface KeyboardEvent
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ * Implements a <textarea> host component that allows setting `value`, and
+ * `defaultValue`. This differs from the traditional DOM API because value is
+ * usually set as PCDATA children.
+ *
+ * If `value` is not supplied (or null/undefined), user actions that affect the
+ * value will trigger updates to the element.
+ *
+ * If `value` is supplied (and not null/undefined), the rendered element will
+ * not trigger updates to the element. Instead, the `value` prop must change in
+ * order for the rendered element to be updated.
+ *
+ * The rendered element will be initialized with an empty value, the prop
+ * `defaultValue` if specified, or the children content (deprecated).
*/
-var KeyboardEventInterface = {
- key: getEventKey,
- location: null,
- ctrlKey: null,
- shiftKey: null,
- altKey: null,
- metaKey: null,
- repeat: null,
- locale: null,
- getModifierState: getEventModifierState,
- // Legacy Interface
- charCode: function (event) {
- // `charCode` is the result of a KeyPress event and represents the value of
- // the actual printable character.
- // KeyPress is deprecated, but its replacement is not yet final and not
- // implemented in any major browser. Only KeyPress has charCode.
- if (event.type === 'keypress') {
- return getEventCharCode(event);
+function getHostProps$3(element, props) {
+ var node = element;
+ !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
+
+ // Always set children to the same thing. In IE9, the selection range will
+ // get reset if `textContent` is mutated. We could add a check in setTextContent
+ // to only set the value if/when the value differs from the node value (which would
+ // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
+ // solution. The value can be a boolean or object so that's why it's forced
+ // to be a string.
+ var hostProps = _assign({}, props, {
+ value: undefined,
+ defaultValue: undefined,
+ children: toString(node._wrapperState.initialValue)
+ });
+
+ return hostProps;
+}
+
+function initWrapperState$2(element, props) {
+ var node = element;
+ {
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props);
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
+ warning$1(false, '%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
+ didWarnValDefaultVal = true;
}
- return 0;
- },
- keyCode: function (event) {
- // `keyCode` is the result of a KeyDown/Up event and represents the value of
- // physical keyboard key.
+ }
- // The actual meaning of the value depends on the users' keyboard layout
- // which cannot be detected. Assuming that it is a US keyboard layout
- // provides a surprisingly accurate mapping for US and European users.
- // Due to this, it is left to the user to implement at this time.
- if (event.type === 'keydown' || event.type === 'keyup') {
- return event.keyCode;
+ var initialValue = props.value;
+
+ // Only bother fetching default value if we're going to use it
+ if (initialValue == null) {
+ var defaultValue = props.defaultValue;
+ // TODO (yungsters): Remove support for children content in <textarea>.
+ var children = props.children;
+ if (children != null) {
+ {
+ warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
+ }
+ !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
+ if (Array.isArray(children)) {
+ !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
+ children = children[0];
+ }
+
+ defaultValue = children;
}
- return 0;
- },
- which: function (event) {
- // `which` is an alias for either `keyCode` or `charCode` depending on the
- // type of the event.
- if (event.type === 'keypress') {
- return getEventCharCode(event);
+ if (defaultValue == null) {
+ defaultValue = '';
}
- if (event.type === 'keydown' || event.type === 'keyup') {
- return event.keyCode;
+ initialValue = defaultValue;
+ }
+
+ node._wrapperState = {
+ initialValue: getToStringValue(initialValue)
+ };
+}
+
+function updateWrapper$1(element, props) {
+ var node = element;
+ var value = getToStringValue(props.value);
+ var defaultValue = getToStringValue(props.defaultValue);
+ if (value != null) {
+ // Cast `value` to a string to ensure the value is set correctly. While
+ // browsers typically do this as necessary, jsdom doesn't.
+ var newValue = toString(value);
+ // To avoid side effects (such as losing text selection), only set value if changed
+ if (newValue !== node.value) {
+ node.value = newValue;
}
- return 0;
+ if (props.defaultValue == null && node.defaultValue !== newValue) {
+ node.defaultValue = newValue;
+ }
+ }
+ if (defaultValue != null) {
+ node.defaultValue = toString(defaultValue);
+ }
+}
+
+function postMountWrapper$3(element, props) {
+ var node = element;
+ // This is in postMount because we need access to the DOM node, which is not
+ // available until after the component has mounted.
+ var textContent = node.textContent;
+
+ // Only set node.value if textContent is equal to the expected
+ // initial value. In IE10/IE11 there is a bug where the placeholder attribute
+ // will populate textContent as well.
+ // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
+ if (textContent === node._wrapperState.initialValue) {
+ node.value = textContent;
}
+}
+
+function restoreControlledState$3(element, props) {
+ // DOM component is still mounted; update
+ updateWrapper$1(element, props);
+}
+
+var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
+var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
+
+var Namespaces = {
+ html: HTML_NAMESPACE$1,
+ mathml: MATH_NAMESPACE,
+ svg: SVG_NAMESPACE
};
-/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticUIEvent}
- */
-function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+// Assumes there is no parent namespace.
+function getIntrinsicNamespace(type) {
+ switch (type) {
+ case 'svg':
+ return SVG_NAMESPACE;
+ case 'math':
+ return MATH_NAMESPACE;
+ default:
+ return HTML_NAMESPACE$1;
+ }
}
-SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
+function getChildNamespace(parentNamespace, type) {
+ if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
+ // No (or default) parent namespace: potential entry point.
+ return getIntrinsicNamespace(type);
+ }
+ if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
+ // We're leaving SVG.
+ return HTML_NAMESPACE$1;
+ }
+ // By default, pass namespace below.
+ return parentNamespace;
+}
+
+/* globals MSApp */
/**
- * @interface DragEvent
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ * Create a function which has 'unsafe' privileges (required by windows8 apps)
*/
-var DragEventInterface = {
- dataTransfer: null
+var createMicrosoftUnsafeLocalFunction = function (func) {
+ if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
+ return function (arg0, arg1, arg2, arg3) {
+ MSApp.execUnsafeLocalFunction(function () {
+ return func(arg0, arg1, arg2, arg3);
+ });
+ };
+ } else {
+ return func;
+ }
};
+// SVG temp container for IE lacking innerHTML
+var reusableSVGContainer = void 0;
+
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticMouseEvent}
+ * Set the innerHTML property of a node
+ *
+ * @param {DOMElement} node
+ * @param {string} html
+ * @internal
*/
-function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
+var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
+ // IE does not have innerHTML for SVG nodes, so instead we inject the
+ // new markup in a temp node and then move the child nodes across into
+ // the target node
-SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
+ if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
+ reusableSVGContainer = reusableSVGContainer || document.createElement('div');
+ reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
+ var svgNode = reusableSVGContainer.firstChild;
+ while (node.firstChild) {
+ node.removeChild(node.firstChild);
+ }
+ while (svgNode.firstChild) {
+ node.appendChild(svgNode.firstChild);
+ }
+ } else {
+ node.innerHTML = html;
+ }
+});
/**
- * @interface TouchEvent
- * @see http://www.w3.org/TR/touch-events/
+ * Set the textContent property of a node. For text updates, it's faster
+ * to set the `nodeValue` of the Text node directly instead of using
+ * `.textContent` which will remove the existing node and create a new one.
+ *
+ * @param {DOMElement} node
+ * @param {string} text
+ * @internal
*/
-var TouchEventInterface = {
- touches: null,
- targetTouches: null,
- changedTouches: null,
- altKey: null,
- metaKey: null,
- ctrlKey: null,
- shiftKey: null,
- getModifierState: getEventModifierState
+var setTextContent = function (node, text) {
+ if (text) {
+ var firstChild = node.firstChild;
+
+ if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
+ firstChild.nodeValue = text;
+ return;
+ }
+ }
+ node.textContent = text;
};
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticUIEvent}
+ * CSS properties which accept numbers but are not in units of "px".
*/
-function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
-}
-
-SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
+var isUnitlessNumber = {
+ animationIterationCount: true,
+ borderImageOutset: true,
+ borderImageSlice: true,
+ borderImageWidth: true,
+ boxFlex: true,
+ boxFlexGroup: true,
+ boxOrdinalGroup: true,
+ columnCount: true,
+ columns: true,
+ flex: true,
+ flexGrow: true,
+ flexPositive: true,
+ flexShrink: true,
+ flexNegative: true,
+ flexOrder: true,
+ gridArea: true,
+ gridRow: true,
+ gridRowEnd: true,
+ gridRowSpan: true,
+ gridRowStart: true,
+ gridColumn: true,
+ gridColumnEnd: true,
+ gridColumnSpan: true,
+ gridColumnStart: true,
+ fontWeight: true,
+ lineClamp: true,
+ lineHeight: true,
+ opacity: true,
+ order: true,
+ orphans: true,
+ tabSize: true,
+ widows: true,
+ zIndex: true,
+ zoom: true,
-/**
- * @interface Event
- * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
- * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
- */
-var TransitionEventInterface = {
- propertyName: null,
- elapsedTime: null,
- pseudoElement: null
+ // SVG-related properties
+ fillOpacity: true,
+ floodOpacity: true,
+ stopOpacity: true,
+ strokeDasharray: true,
+ strokeDashoffset: true,
+ strokeMiterlimit: true,
+ strokeOpacity: true,
+ strokeWidth: true
};
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticEvent}
+ * @param {string} prefix vendor-specific prefix, eg: Webkit
+ * @param {string} key style name, eg: transitionDuration
+ * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
+ * WebkitTransitionDuration
*/
-function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticEvent$1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+function prefixKey(prefix, key) {
+ return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
-SyntheticEvent$1.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
-
/**
- * @interface WheelEvent
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
+ * Support style names that may come passed in prefixed by adding permutations
+ * of vendor prefixes.
*/
-var WheelEventInterface = {
- deltaX: function (event) {
- return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
- },
- deltaY: function (event) {
- return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
- 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
- 'wheelDelta' in event ? -event.wheelDelta : 0;
- },
- deltaZ: null,
+var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
- // Browsers without "deltaMode" is reporting in raw wheel delta where one
- // notch on the scroll is always +/- 120, roughly equivalent to pixels.
- // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
- // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
- deltaMode: null
-};
+// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
+// infinite loop, because it iterates over the newly added props too.
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
+ });
+});
/**
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {string} dispatchMarker Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @extends {SyntheticMouseEvent}
+ * Convert a value into the proper css writable value. The style name `name`
+ * should be logical (no hyphens), as specified
+ * in `CSSProperty.isUnitlessNumber`.
+ *
+ * @param {string} name CSS property name such as `topMargin`.
+ * @param {*} value CSS property value such as `10px`.
+ * @return {string} Normalized style value with dimensions applied.
*/
-function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
- return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+function dangerousStyleValue(name, value, isCustomProperty) {
+ // Note that we've removed escapeTextForBrowser() calls here since the
+ // whole string will be escaped when the attribute is injected into
+ // the markup. If you provide unsafe user data here they can inject
+ // arbitrary CSS which may be problematic (I couldn't repro this):
+ // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
+ // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
+ // This is not an XSS hole but instead a potential CSS injection issue
+ // which has lead to a greater discussion about how we're going to
+ // trust URLs moving forward. See #2115901
+
+ var isEmpty = value == null || typeof value === 'boolean' || value === '';
+ if (isEmpty) {
+ return '';
+ }
+
+ if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
+ return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
+ }
+
+ return ('' + value).trim();
}
-SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
+var uppercasePattern = /([A-Z])/g;
+var msPattern = /^ms-/;
/**
- * Turns
- * ['abort', ...]
- * into
- * eventTypes = {
- * 'abort': {
- * phasedRegistrationNames: {
- * bubbled: 'onAbort',
- * captured: 'onAbortCapture',
- * },
- * dependencies: ['topAbort'],
- * },
- * ...
- * };
- * topLevelEventsToDispatchConfig = {
- * 'topAbort': { sameConfig }
- * };
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
*/
-var eventTypes$4 = {};
-var topLevelEventsToDispatchConfig = {};
-['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'cancel', 'canPlay', 'canPlayThrough', 'click', 'close', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'toggle', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) {
- var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
- var onEvent = 'on' + capitalizedEvent;
- var topEvent = 'top' + capitalizedEvent;
+function hyphenateStyleName(name) {
+ return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
+}
- var type = {
- phasedRegistrationNames: {
- bubbled: onEvent,
- captured: onEvent + 'Capture'
- },
- dependencies: [topEvent]
+var warnValidStyle = function () {};
+
+{
+ // 'msTransform' is correct, but the other prefixes should be capitalized
+ var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
+ var msPattern$1 = /^-ms-/;
+ var hyphenPattern = /-(.)/g;
+
+ // style values shouldn't contain a semicolon
+ var badStyleValueWithSemicolonPattern = /;\s*$/;
+
+ var warnedStyleNames = {};
+ var warnedStyleValues = {};
+ var warnedForNaNValue = false;
+ var warnedForInfinityValue = false;
+
+ var camelize = function (string) {
+ return string.replace(hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
};
- eventTypes$4[event] = type;
- topLevelEventsToDispatchConfig[topEvent] = type;
-});
-// Only used in DEV for exhaustiveness validation.
-var knownHTMLTopLevelTypes = ['topAbort', 'topCancel', 'topCanPlay', 'topCanPlayThrough', 'topClose', 'topDurationChange', 'topEmptied', 'topEncrypted', 'topEnded', 'topError', 'topInput', 'topInvalid', 'topLoad', 'topLoadedData', 'topLoadedMetadata', 'topLoadStart', 'topPause', 'topPlay', 'topPlaying', 'topProgress', 'topRateChange', 'topReset', 'topSeeked', 'topSeeking', 'topStalled', 'topSubmit', 'topSuspend', 'topTimeUpdate', 'topToggle', 'topVolumeChange', 'topWaiting'];
+ var warnHyphenatedStyleName = function (name) {
+ if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
+ return;
+ }
-var SimpleEventPlugin = {
- eventTypes: eventTypes$4,
+ warnedStyleNames[name] = true;
+ warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
+ // As Andi Smith suggests
+ // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ // is converted to lowercase `ms`.
+ camelize(name.replace(msPattern$1, 'ms-')));
+ };
- extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
- if (!dispatchConfig) {
- return null;
+ var warnBadVendoredStyleName = function (name) {
+ if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
+ return;
}
- var EventConstructor;
- switch (topLevelType) {
- case 'topKeyPress':
- // Firefox creates a keypress event for function keys too. This removes
- // the unwanted keypress events. Enter is however both printable and
- // non-printable. One would expect Tab to be as well (but it isn't).
- if (getEventCharCode(nativeEvent) === 0) {
- return null;
- }
- /* falls through */
- case 'topKeyDown':
- case 'topKeyUp':
- EventConstructor = SyntheticKeyboardEvent;
- break;
- case 'topBlur':
- case 'topFocus':
- EventConstructor = SyntheticFocusEvent;
- break;
- case 'topClick':
- // Firefox creates a click event on right mouse clicks. This removes the
- // unwanted click events.
- if (nativeEvent.button === 2) {
- return null;
- }
- /* falls through */
- case 'topDoubleClick':
- case 'topMouseDown':
- case 'topMouseMove':
- case 'topMouseUp':
- // TODO: Disabled elements should not respond to mouse events
- /* falls through */
- case 'topMouseOut':
- case 'topMouseOver':
- case 'topContextMenu':
- EventConstructor = SyntheticMouseEvent;
- break;
- case 'topDrag':
- case 'topDragEnd':
- case 'topDragEnter':
- case 'topDragExit':
- case 'topDragLeave':
- case 'topDragOver':
- case 'topDragStart':
- case 'topDrop':
- EventConstructor = SyntheticDragEvent;
- break;
- case 'topTouchCancel':
- case 'topTouchEnd':
- case 'topTouchMove':
- case 'topTouchStart':
- EventConstructor = SyntheticTouchEvent;
- break;
- case 'topAnimationEnd':
- case 'topAnimationIteration':
- case 'topAnimationStart':
- EventConstructor = SyntheticAnimationEvent;
- break;
- case 'topTransitionEnd':
- EventConstructor = SyntheticTransitionEvent;
- break;
- case 'topScroll':
- EventConstructor = SyntheticUIEvent;
- break;
- case 'topWheel':
- EventConstructor = SyntheticWheelEvent;
- break;
- case 'topCopy':
- case 'topCut':
- case 'topPaste':
- EventConstructor = SyntheticClipboardEvent;
- break;
- default:
- {
- if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
- warning(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
- }
- }
- // HTML Events
- // @see http://www.w3.org/TR/html5/index.html#events-0
- EventConstructor = SyntheticEvent$1;
- break;
+
+ warnedStyleNames[name] = true;
+ warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
+ };
+
+ var warnStyleValueWithSemicolon = function (name, value) {
+ if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
+ return;
}
- var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
- accumulateTwoPhaseDispatches(event);
- return event;
- }
-};
-setHandleTopLevel(handleTopLevel);
+ warnedStyleValues[value] = true;
+ warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
+ };
+
+ var warnStyleValueIsNaN = function (name, value) {
+ if (warnedForNaNValue) {
+ return;
+ }
+
+ warnedForNaNValue = true;
+ warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
+ };
+
+ var warnStyleValueIsInfinity = function (name, value) {
+ if (warnedForInfinityValue) {
+ return;
+ }
+
+ warnedForInfinityValue = true;
+ warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
+ };
+
+ warnValidStyle = function (name, value) {
+ if (name.indexOf('-') > -1) {
+ warnHyphenatedStyleName(name);
+ } else if (badVendoredStyleNamePattern.test(name)) {
+ warnBadVendoredStyleName(name);
+ } else if (badStyleValueWithSemicolonPattern.test(value)) {
+ warnStyleValueWithSemicolon(name, value);
+ }
+
+ if (typeof value === 'number') {
+ if (isNaN(value)) {
+ warnStyleValueIsNaN(name, value);
+ } else if (!isFinite(value)) {
+ warnStyleValueIsInfinity(name, value);
+ }
+ }
+ };
+}
+
+var warnValidStyle$1 = warnValidStyle;
/**
- * Inject modules for resolving DOM hierarchy and plugin ordering.
+ * Operations for dealing with CSS properties.
*/
-injection$1.injectEventPluginOrder(DOMEventPluginOrder);
-injection$2.injectComponentTree(ReactDOMComponentTree);
/**
- * Some important event plugins included by default (without having to require
- * them).
+ * This creates a string that is expected to be equivalent to the style
+ * attribute generated by server-side rendering. It by-passes warnings and
+ * security checks so it's not safe to use this value for anything other than
+ * comparison. It is only used in DEV for SSR validation.
*/
-injection$1.injectEventPluginsByName({
- SimpleEventPlugin: SimpleEventPlugin,
- EnterLeaveEventPlugin: EnterLeaveEventPlugin,
- ChangeEventPlugin: ChangeEventPlugin,
- SelectEventPlugin: SelectEventPlugin,
- BeforeInputEventPlugin: BeforeInputEventPlugin
-});
+function createDangerousStringForStyles(styles) {
+ {
+ var serialized = '';
+ var delimiter = '';
+ for (var styleName in styles) {
+ if (!styles.hasOwnProperty(styleName)) {
+ continue;
+ }
+ var styleValue = styles[styleName];
+ if (styleValue != null) {
+ var isCustomProperty = styleName.indexOf('--') === 0;
+ serialized += delimiter + hyphenateStyleName(styleName) + ':';
+ serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
-var enableAsyncSubtreeAPI = true;
-var enableAsyncSchedulingByDefaultInReactDOM = false;
-// Exports ReactDOM.createRoot
-var enableCreateRoot = false;
-var enableUserTimingAPI = true;
+ delimiter = ';';
+ }
+ }
+ return serialized || null;
+ }
+}
-// Mutating mode (React DOM, React ART, React Native):
-var enableMutatingReconciler = true;
-// Experimental noop mode (currently unused):
-var enableNoopReconciler = false;
-// Experimental persistent mode (CS):
-var enablePersistentReconciler = false;
+/**
+ * Sets the value for multiple styles on a node. If a value is specified as
+ * '' (empty string), the corresponding style property will be unset.
+ *
+ * @param {DOMElement} node
+ * @param {object} styles
+ */
+function setValueForStyles(node, styles) {
+ var style = node.style;
+ for (var styleName in styles) {
+ if (!styles.hasOwnProperty(styleName)) {
+ continue;
+ }
+ var isCustomProperty = styleName.indexOf('--') === 0;
+ {
+ if (!isCustomProperty) {
+ warnValidStyle$1(styleName, styles[styleName]);
+ }
+ }
+ var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
+ if (styleName === 'float') {
+ styleName = 'cssFloat';
+ }
+ if (isCustomProperty) {
+ style.setProperty(styleName, styleValue);
+ } else {
+ style[styleName] = styleValue;
+ }
+ }
+}
-// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
-var debugRenderPhaseSideEffects = false;
+// For HTML, certain tags should omit their close tag. We keep a whitelist for
+// those special-case tags.
-// Only used in www builds.
+var omittedCloseTags = {
+ area: true,
+ base: true,
+ br: true,
+ col: true,
+ embed: true,
+ hr: true,
+ img: true,
+ input: true,
+ keygen: true,
+ link: true,
+ meta: true,
+ param: true,
+ source: true,
+ track: true,
+ wbr: true
+ // NOTE: menuitem's close tag should be omitted, but that causes problems.
+};
-var valueStack = [];
+// For HTML, certain tags cannot have children. This has the same purpose as
+// `omittedCloseTags` except that `menuitem` should still have its closing tag.
+
+var voidElementTags = _assign({
+ menuitem: true
+}, omittedCloseTags);
+
+// TODO: We can remove this if we add invariantWithStack()
+// or add stack by default to invariants where possible.
+var HTML$1 = '__html';
+var ReactDebugCurrentFrame$2 = null;
{
- var fiberStack = [];
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
}
-var index = -1;
+function assertValidProps(tag, props) {
+ if (!props) {
+ return;
+ }
+ // Note the use of `==` which checks for null or undefined.
+ if (voidElementTags[tag]) {
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
+ }
+ if (props.dangerouslySetInnerHTML != null) {
+ !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
+ }
+ {
+ !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
+ }
+ !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
+}
-function createCursor(defaultValue) {
- return {
- current: defaultValue
+function isCustomComponent(tagName, props) {
+ if (tagName.indexOf('-') === -1) {
+ return typeof props.is === 'string';
+ }
+ switch (tagName) {
+ // These are reserved SVG and MathML elements.
+ // We don't mind this whitelist too much because we expect it to never grow.
+ // The alternative is to track the namespace in a few places which is convoluted.
+ // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
+ case 'annotation-xml':
+ case 'color-profile':
+ case 'font-face':
+ case 'font-face-src':
+ case 'font-face-uri':
+ case 'font-face-format':
+ case 'font-face-name':
+ case 'missing-glyph':
+ return false;
+ default:
+ return true;
+ }
+}
+
+// When adding attributes to the HTML or SVG whitelist, be sure to
+// also add them to this module to ensure casing and incorrect name
+// warnings.
+var possibleStandardNames = {
+ // HTML
+ accept: 'accept',
+ acceptcharset: 'acceptCharset',
+ 'accept-charset': 'acceptCharset',
+ accesskey: 'accessKey',
+ action: 'action',
+ allowfullscreen: 'allowFullScreen',
+ alt: 'alt',
+ as: 'as',
+ async: 'async',
+ autocapitalize: 'autoCapitalize',
+ autocomplete: 'autoComplete',
+ autocorrect: 'autoCorrect',
+ autofocus: 'autoFocus',
+ autoplay: 'autoPlay',
+ autosave: 'autoSave',
+ capture: 'capture',
+ cellpadding: 'cellPadding',
+ cellspacing: 'cellSpacing',
+ challenge: 'challenge',
+ charset: 'charSet',
+ checked: 'checked',
+ children: 'children',
+ cite: 'cite',
+ class: 'className',
+ classid: 'classID',
+ classname: 'className',
+ cols: 'cols',
+ colspan: 'colSpan',
+ content: 'content',
+ contenteditable: 'contentEditable',
+ contextmenu: 'contextMenu',
+ controls: 'controls',
+ controlslist: 'controlsList',
+ coords: 'coords',
+ crossorigin: 'crossOrigin',
+ dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
+ data: 'data',
+ datetime: 'dateTime',
+ default: 'default',
+ defaultchecked: 'defaultChecked',
+ defaultvalue: 'defaultValue',
+ defer: 'defer',
+ dir: 'dir',
+ disabled: 'disabled',
+ download: 'download',
+ draggable: 'draggable',
+ enctype: 'encType',
+ for: 'htmlFor',
+ form: 'form',
+ formmethod: 'formMethod',
+ formaction: 'formAction',
+ formenctype: 'formEncType',
+ formnovalidate: 'formNoValidate',
+ formtarget: 'formTarget',
+ frameborder: 'frameBorder',
+ headers: 'headers',
+ height: 'height',
+ hidden: 'hidden',
+ high: 'high',
+ href: 'href',
+ hreflang: 'hrefLang',
+ htmlfor: 'htmlFor',
+ httpequiv: 'httpEquiv',
+ 'http-equiv': 'httpEquiv',
+ icon: 'icon',
+ id: 'id',
+ innerhtml: 'innerHTML',
+ inputmode: 'inputMode',
+ integrity: 'integrity',
+ is: 'is',
+ itemid: 'itemID',
+ itemprop: 'itemProp',
+ itemref: 'itemRef',
+ itemscope: 'itemScope',
+ itemtype: 'itemType',
+ keyparams: 'keyParams',
+ keytype: 'keyType',
+ kind: 'kind',
+ label: 'label',
+ lang: 'lang',
+ list: 'list',
+ loop: 'loop',
+ low: 'low',
+ manifest: 'manifest',
+ marginwidth: 'marginWidth',
+ marginheight: 'marginHeight',
+ max: 'max',
+ maxlength: 'maxLength',
+ media: 'media',
+ mediagroup: 'mediaGroup',
+ method: 'method',
+ min: 'min',
+ minlength: 'minLength',
+ multiple: 'multiple',
+ muted: 'muted',
+ name: 'name',
+ nomodule: 'noModule',
+ nonce: 'nonce',
+ novalidate: 'noValidate',
+ open: 'open',
+ optimum: 'optimum',
+ pattern: 'pattern',
+ placeholder: 'placeholder',
+ playsinline: 'playsInline',
+ poster: 'poster',
+ preload: 'preload',
+ profile: 'profile',
+ radiogroup: 'radioGroup',
+ readonly: 'readOnly',
+ referrerpolicy: 'referrerPolicy',
+ rel: 'rel',
+ required: 'required',
+ reversed: 'reversed',
+ role: 'role',
+ rows: 'rows',
+ rowspan: 'rowSpan',
+ sandbox: 'sandbox',
+ scope: 'scope',
+ scoped: 'scoped',
+ scrolling: 'scrolling',
+ seamless: 'seamless',
+ selected: 'selected',
+ shape: 'shape',
+ size: 'size',
+ sizes: 'sizes',
+ span: 'span',
+ spellcheck: 'spellCheck',
+ src: 'src',
+ srcdoc: 'srcDoc',
+ srclang: 'srcLang',
+ srcset: 'srcSet',
+ start: 'start',
+ step: 'step',
+ style: 'style',
+ summary: 'summary',
+ tabindex: 'tabIndex',
+ target: 'target',
+ title: 'title',
+ type: 'type',
+ usemap: 'useMap',
+ value: 'value',
+ width: 'width',
+ wmode: 'wmode',
+ wrap: 'wrap',
+
+ // SVG
+ about: 'about',
+ accentheight: 'accentHeight',
+ 'accent-height': 'accentHeight',
+ accumulate: 'accumulate',
+ additive: 'additive',
+ alignmentbaseline: 'alignmentBaseline',
+ 'alignment-baseline': 'alignmentBaseline',
+ allowreorder: 'allowReorder',
+ alphabetic: 'alphabetic',
+ amplitude: 'amplitude',
+ arabicform: 'arabicForm',
+ 'arabic-form': 'arabicForm',
+ ascent: 'ascent',
+ attributename: 'attributeName',
+ attributetype: 'attributeType',
+ autoreverse: 'autoReverse',
+ azimuth: 'azimuth',
+ basefrequency: 'baseFrequency',
+ baselineshift: 'baselineShift',
+ 'baseline-shift': 'baselineShift',
+ baseprofile: 'baseProfile',
+ bbox: 'bbox',
+ begin: 'begin',
+ bias: 'bias',
+ by: 'by',
+ calcmode: 'calcMode',
+ capheight: 'capHeight',
+ 'cap-height': 'capHeight',
+ clip: 'clip',
+ clippath: 'clipPath',
+ 'clip-path': 'clipPath',
+ clippathunits: 'clipPathUnits',
+ cliprule: 'clipRule',
+ 'clip-rule': 'clipRule',
+ color: 'color',
+ colorinterpolation: 'colorInterpolation',
+ 'color-interpolation': 'colorInterpolation',
+ colorinterpolationfilters: 'colorInterpolationFilters',
+ 'color-interpolation-filters': 'colorInterpolationFilters',
+ colorprofile: 'colorProfile',
+ 'color-profile': 'colorProfile',
+ colorrendering: 'colorRendering',
+ 'color-rendering': 'colorRendering',
+ contentscripttype: 'contentScriptType',
+ contentstyletype: 'contentStyleType',
+ cursor: 'cursor',
+ cx: 'cx',
+ cy: 'cy',
+ d: 'd',
+ datatype: 'datatype',
+ decelerate: 'decelerate',
+ descent: 'descent',
+ diffuseconstant: 'diffuseConstant',
+ direction: 'direction',
+ display: 'display',
+ divisor: 'divisor',
+ dominantbaseline: 'dominantBaseline',
+ 'dominant-baseline': 'dominantBaseline',
+ dur: 'dur',
+ dx: 'dx',
+ dy: 'dy',
+ edgemode: 'edgeMode',
+ elevation: 'elevation',
+ enablebackground: 'enableBackground',
+ 'enable-background': 'enableBackground',
+ end: 'end',
+ exponent: 'exponent',
+ externalresourcesrequired: 'externalResourcesRequired',
+ fill: 'fill',
+ fillopacity: 'fillOpacity',
+ 'fill-opacity': 'fillOpacity',
+ fillrule: 'fillRule',
+ 'fill-rule': 'fillRule',
+ filter: 'filter',
+ filterres: 'filterRes',
+ filterunits: 'filterUnits',
+ floodopacity: 'floodOpacity',
+ 'flood-opacity': 'floodOpacity',
+ floodcolor: 'floodColor',
+ 'flood-color': 'floodColor',
+ focusable: 'focusable',
+ fontfamily: 'fontFamily',
+ 'font-family': 'fontFamily',
+ fontsize: 'fontSize',
+ 'font-size': 'fontSize',
+ fontsizeadjust: 'fontSizeAdjust',
+ 'font-size-adjust': 'fontSizeAdjust',
+ fontstretch: 'fontStretch',
+ 'font-stretch': 'fontStretch',
+ fontstyle: 'fontStyle',
+ 'font-style': 'fontStyle',
+ fontvariant: 'fontVariant',
+ 'font-variant': 'fontVariant',
+ fontweight: 'fontWeight',
+ 'font-weight': 'fontWeight',
+ format: 'format',
+ from: 'from',
+ fx: 'fx',
+ fy: 'fy',
+ g1: 'g1',
+ g2: 'g2',
+ glyphname: 'glyphName',
+ 'glyph-name': 'glyphName',
+ glyphorientationhorizontal: 'glyphOrientationHorizontal',
+ 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
+ glyphorientationvertical: 'glyphOrientationVertical',
+ 'glyph-orientation-vertical': 'glyphOrientationVertical',
+ glyphref: 'glyphRef',
+ gradienttransform: 'gradientTransform',
+ gradientunits: 'gradientUnits',
+ hanging: 'hanging',
+ horizadvx: 'horizAdvX',
+ 'horiz-adv-x': 'horizAdvX',
+ horizoriginx: 'horizOriginX',
+ 'horiz-origin-x': 'horizOriginX',
+ ideographic: 'ideographic',
+ imagerendering: 'imageRendering',
+ 'image-rendering': 'imageRendering',
+ in2: 'in2',
+ in: 'in',
+ inlist: 'inlist',
+ intercept: 'intercept',
+ k1: 'k1',
+ k2: 'k2',
+ k3: 'k3',
+ k4: 'k4',
+ k: 'k',
+ kernelmatrix: 'kernelMatrix',
+ kernelunitlength: 'kernelUnitLength',
+ kerning: 'kerning',
+ keypoints: 'keyPoints',
+ keysplines: 'keySplines',
+ keytimes: 'keyTimes',
+ lengthadjust: 'lengthAdjust',
+ letterspacing: 'letterSpacing',
+ 'letter-spacing': 'letterSpacing',
+ lightingcolor: 'lightingColor',
+ 'lighting-color': 'lightingColor',
+ limitingconeangle: 'limitingConeAngle',
+ local: 'local',
+ markerend: 'markerEnd',
+ 'marker-end': 'markerEnd',
+ markerheight: 'markerHeight',
+ markermid: 'markerMid',
+ 'marker-mid': 'markerMid',
+ markerstart: 'markerStart',
+ 'marker-start': 'markerStart',
+ markerunits: 'markerUnits',
+ markerwidth: 'markerWidth',
+ mask: 'mask',
+ maskcontentunits: 'maskContentUnits',
+ maskunits: 'maskUnits',
+ mathematical: 'mathematical',
+ mode: 'mode',
+ numoctaves: 'numOctaves',
+ offset: 'offset',
+ opacity: 'opacity',
+ operator: 'operator',
+ order: 'order',
+ orient: 'orient',
+ orientation: 'orientation',
+ origin: 'origin',
+ overflow: 'overflow',
+ overlineposition: 'overlinePosition',
+ 'overline-position': 'overlinePosition',
+ overlinethickness: 'overlineThickness',
+ 'overline-thickness': 'overlineThickness',
+ paintorder: 'paintOrder',
+ 'paint-order': 'paintOrder',
+ panose1: 'panose1',
+ 'panose-1': 'panose1',
+ pathlength: 'pathLength',
+ patterncontentunits: 'patternContentUnits',
+ patterntransform: 'patternTransform',
+ patternunits: 'patternUnits',
+ pointerevents: 'pointerEvents',
+ 'pointer-events': 'pointerEvents',
+ points: 'points',
+ pointsatx: 'pointsAtX',
+ pointsaty: 'pointsAtY',
+ pointsatz: 'pointsAtZ',
+ prefix: 'prefix',
+ preservealpha: 'preserveAlpha',
+ preserveaspectratio: 'preserveAspectRatio',
+ primitiveunits: 'primitiveUnits',
+ property: 'property',
+ r: 'r',
+ radius: 'radius',
+ refx: 'refX',
+ refy: 'refY',
+ renderingintent: 'renderingIntent',
+ 'rendering-intent': 'renderingIntent',
+ repeatcount: 'repeatCount',
+ repeatdur: 'repeatDur',
+ requiredextensions: 'requiredExtensions',
+ requiredfeatures: 'requiredFeatures',
+ resource: 'resource',
+ restart: 'restart',
+ result: 'result',
+ results: 'results',
+ rotate: 'rotate',
+ rx: 'rx',
+ ry: 'ry',
+ scale: 'scale',
+ security: 'security',
+ seed: 'seed',
+ shaperendering: 'shapeRendering',
+ 'shape-rendering': 'shapeRendering',
+ slope: 'slope',
+ spacing: 'spacing',
+ specularconstant: 'specularConstant',
+ specularexponent: 'specularExponent',
+ speed: 'speed',
+ spreadmethod: 'spreadMethod',
+ startoffset: 'startOffset',
+ stddeviation: 'stdDeviation',
+ stemh: 'stemh',
+ stemv: 'stemv',
+ stitchtiles: 'stitchTiles',
+ stopcolor: 'stopColor',
+ 'stop-color': 'stopColor',
+ stopopacity: 'stopOpacity',
+ 'stop-opacity': 'stopOpacity',
+ strikethroughposition: 'strikethroughPosition',
+ 'strikethrough-position': 'strikethroughPosition',
+ strikethroughthickness: 'strikethroughThickness',
+ 'strikethrough-thickness': 'strikethroughThickness',
+ string: 'string',
+ stroke: 'stroke',
+ strokedasharray: 'strokeDasharray',
+ 'stroke-dasharray': 'strokeDasharray',
+ strokedashoffset: 'strokeDashoffset',
+ 'stroke-dashoffset': 'strokeDashoffset',
+ strokelinecap: 'strokeLinecap',
+ 'stroke-linecap': 'strokeLinecap',
+ strokelinejoin: 'strokeLinejoin',
+ 'stroke-linejoin': 'strokeLinejoin',
+ strokemiterlimit: 'strokeMiterlimit',
+ 'stroke-miterlimit': 'strokeMiterlimit',
+ strokewidth: 'strokeWidth',
+ 'stroke-width': 'strokeWidth',
+ strokeopacity: 'strokeOpacity',
+ 'stroke-opacity': 'strokeOpacity',
+ suppresscontenteditablewarning: 'suppressContentEditableWarning',
+ suppresshydrationwarning: 'suppressHydrationWarning',
+ surfacescale: 'surfaceScale',
+ systemlanguage: 'systemLanguage',
+ tablevalues: 'tableValues',
+ targetx: 'targetX',
+ targety: 'targetY',
+ textanchor: 'textAnchor',
+ 'text-anchor': 'textAnchor',
+ textdecoration: 'textDecoration',
+ 'text-decoration': 'textDecoration',
+ textlength: 'textLength',
+ textrendering: 'textRendering',
+ 'text-rendering': 'textRendering',
+ to: 'to',
+ transform: 'transform',
+ typeof: 'typeof',
+ u1: 'u1',
+ u2: 'u2',
+ underlineposition: 'underlinePosition',
+ 'underline-position': 'underlinePosition',
+ underlinethickness: 'underlineThickness',
+ 'underline-thickness': 'underlineThickness',
+ unicode: 'unicode',
+ unicodebidi: 'unicodeBidi',
+ 'unicode-bidi': 'unicodeBidi',
+ unicoderange: 'unicodeRange',
+ 'unicode-range': 'unicodeRange',
+ unitsperem: 'unitsPerEm',
+ 'units-per-em': 'unitsPerEm',
+ unselectable: 'unselectable',
+ valphabetic: 'vAlphabetic',
+ 'v-alphabetic': 'vAlphabetic',
+ values: 'values',
+ vectoreffect: 'vectorEffect',
+ 'vector-effect': 'vectorEffect',
+ version: 'version',
+ vertadvy: 'vertAdvY',
+ 'vert-adv-y': 'vertAdvY',
+ vertoriginx: 'vertOriginX',
+ 'vert-origin-x': 'vertOriginX',
+ vertoriginy: 'vertOriginY',
+ 'vert-origin-y': 'vertOriginY',
+ vhanging: 'vHanging',
+ 'v-hanging': 'vHanging',
+ videographic: 'vIdeographic',
+ 'v-ideographic': 'vIdeographic',
+ viewbox: 'viewBox',
+ viewtarget: 'viewTarget',
+ visibility: 'visibility',
+ vmathematical: 'vMathematical',
+ 'v-mathematical': 'vMathematical',
+ vocab: 'vocab',
+ widths: 'widths',
+ wordspacing: 'wordSpacing',
+ 'word-spacing': 'wordSpacing',
+ writingmode: 'writingMode',
+ 'writing-mode': 'writingMode',
+ x1: 'x1',
+ x2: 'x2',
+ x: 'x',
+ xchannelselector: 'xChannelSelector',
+ xheight: 'xHeight',
+ 'x-height': 'xHeight',
+ xlinkactuate: 'xlinkActuate',
+ 'xlink:actuate': 'xlinkActuate',
+ xlinkarcrole: 'xlinkArcrole',
+ 'xlink:arcrole': 'xlinkArcrole',
+ xlinkhref: 'xlinkHref',
+ 'xlink:href': 'xlinkHref',
+ xlinkrole: 'xlinkRole',
+ 'xlink:role': 'xlinkRole',
+ xlinkshow: 'xlinkShow',
+ 'xlink:show': 'xlinkShow',
+ xlinktitle: 'xlinkTitle',
+ 'xlink:title': 'xlinkTitle',
+ xlinktype: 'xlinkType',
+ 'xlink:type': 'xlinkType',
+ xmlbase: 'xmlBase',
+ 'xml:base': 'xmlBase',
+ xmllang: 'xmlLang',
+ 'xml:lang': 'xmlLang',
+ xmlns: 'xmlns',
+ 'xml:space': 'xmlSpace',
+ xmlnsxlink: 'xmlnsXlink',
+ 'xmlns:xlink': 'xmlnsXlink',
+ xmlspace: 'xmlSpace',
+ y1: 'y1',
+ y2: 'y2',
+ y: 'y',
+ ychannelselector: 'yChannelSelector',
+ z: 'z',
+ zoomandpan: 'zoomAndPan'
+};
+
+var ariaProperties = {
+ 'aria-current': 0, // state
+ 'aria-details': 0,
+ 'aria-disabled': 0, // state
+ 'aria-hidden': 0, // state
+ 'aria-invalid': 0, // state
+ 'aria-keyshortcuts': 0,
+ 'aria-label': 0,
+ 'aria-roledescription': 0,
+ // Widget Attributes
+ 'aria-autocomplete': 0,
+ 'aria-checked': 0,
+ 'aria-expanded': 0,
+ 'aria-haspopup': 0,
+ 'aria-level': 0,
+ 'aria-modal': 0,
+ 'aria-multiline': 0,
+ 'aria-multiselectable': 0,
+ 'aria-orientation': 0,
+ 'aria-placeholder': 0,
+ 'aria-pressed': 0,
+ 'aria-readonly': 0,
+ 'aria-required': 0,
+ 'aria-selected': 0,
+ 'aria-sort': 0,
+ 'aria-valuemax': 0,
+ 'aria-valuemin': 0,
+ 'aria-valuenow': 0,
+ 'aria-valuetext': 0,
+ // Live Region Attributes
+ 'aria-atomic': 0,
+ 'aria-busy': 0,
+ 'aria-live': 0,
+ 'aria-relevant': 0,
+ // Drag-and-Drop Attributes
+ 'aria-dropeffect': 0,
+ 'aria-grabbed': 0,
+ // Relationship Attributes
+ 'aria-activedescendant': 0,
+ 'aria-colcount': 0,
+ 'aria-colindex': 0,
+ 'aria-colspan': 0,
+ 'aria-controls': 0,
+ 'aria-describedby': 0,
+ 'aria-errormessage': 0,
+ 'aria-flowto': 0,
+ 'aria-labelledby': 0,
+ 'aria-owns': 0,
+ 'aria-posinset': 0,
+ 'aria-rowcount': 0,
+ 'aria-rowindex': 0,
+ 'aria-rowspan': 0,
+ 'aria-setsize': 0
+};
+
+var warnedProperties = {};
+var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
+var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
+
+var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
+
+function validateProperty(tagName, name) {
+ if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
+ return true;
+ }
+
+ if (rARIACamel.test(name)) {
+ var ariaName = 'aria-' + name.slice(4).toLowerCase();
+ var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
+
+ // If this is an aria-* attribute, but is not listed in the known DOM
+ // DOM properties, then it is an invalid aria-* attribute.
+ if (correctName == null) {
+ warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
+ warnedProperties[name] = true;
+ return true;
+ }
+ // aria-* attributes should be lowercase; suggest the lowercase version.
+ if (name !== correctName) {
+ warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
+ warnedProperties[name] = true;
+ return true;
+ }
+ }
+
+ if (rARIA.test(name)) {
+ var lowerCasedName = name.toLowerCase();
+ var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
+
+ // If this is an aria-* attribute, but is not listed in the known DOM
+ // DOM properties, then it is an invalid aria-* attribute.
+ if (standardName == null) {
+ warnedProperties[name] = true;
+ return false;
+ }
+ // aria-* attributes should be lowercase; suggest the lowercase version.
+ if (name !== standardName) {
+ warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
+ warnedProperties[name] = true;
+ return true;
+ }
+ }
+
+ return true;
+}
+
+function warnInvalidARIAProps(type, props) {
+ var invalidProps = [];
+
+ for (var key in props) {
+ var isValid = validateProperty(type, key);
+ if (!isValid) {
+ invalidProps.push(key);
+ }
+ }
+
+ var unknownPropString = invalidProps.map(function (prop) {
+ return '`' + prop + '`';
+ }).join(', ');
+
+ if (invalidProps.length === 1) {
+ warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
+ } else if (invalidProps.length > 1) {
+ warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
+ }
+}
+
+function validateProperties(type, props) {
+ if (isCustomComponent(type, props)) {
+ return;
+ }
+ warnInvalidARIAProps(type, props);
+}
+
+var didWarnValueNull = false;
+
+function validateProperties$1(type, props) {
+ if (type !== 'input' && type !== 'textarea' && type !== 'select') {
+ return;
+ }
+
+ if (props != null && props.value === null && !didWarnValueNull) {
+ didWarnValueNull = true;
+ if (type === 'select' && props.multiple) {
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
+ } else {
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
+ }
+ }
+}
+
+var validateProperty$1 = function () {};
+
+{
+ var warnedProperties$1 = {};
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
+ var EVENT_NAME_REGEX = /^on./;
+ var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
+ var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
+ var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
+
+ validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
+ if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
+ return true;
+ }
+
+ var lowerCasedName = name.toLowerCase();
+ if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
+ warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ // We can't rely on the event system being injected on the server.
+ if (canUseEventSystem) {
+ if (registrationNameModules.hasOwnProperty(name)) {
+ return true;
+ }
+ var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
+ if (registrationName != null) {
+ warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+ if (EVENT_NAME_REGEX.test(name)) {
+ warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+ } else if (EVENT_NAME_REGEX.test(name)) {
+ // If no event plugins have been injected, we are in a server environment.
+ // So we can't tell if the event name is correct for sure, but we can filter
+ // out known bad ones like `onclick`. We can't suggest a specific replacement though.
+ if (INVALID_EVENT_NAME_REGEX.test(name)) {
+ warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
+ }
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ // Let the ARIA attribute hook validate ARIA attributes
+ if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
+ return true;
+ }
+
+ if (lowerCasedName === 'innerhtml') {
+ warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ if (lowerCasedName === 'aria') {
+ warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
+ warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ if (typeof value === 'number' && isNaN(value)) {
+ warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ var propertyInfo = getPropertyInfo(name);
+ var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
+
+ // Known attributes should match the casing specified in the property config.
+ if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
+ var standardName = possibleStandardNames[lowerCasedName];
+ if (standardName !== name) {
+ warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+ } else if (!isReserved && name !== lowerCasedName) {
+ // Unknown attributes should have lowercase casing since that's how they
+ // will be cased anyway with server rendering.
+ warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
+ if (value) {
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
+ } else {
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
+ }
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ // Now that we've validated casing, do not validate
+ // data types for reserved props
+ if (isReserved) {
+ return true;
+ }
+
+ // Warn when a known attribute is a bad type
+ if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
+ warnedProperties$1[name] = true;
+ return false;
+ }
+
+ // Warn when passing the strings 'false' or 'true' into a boolean prop
+ if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
+ warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
+ warnedProperties$1[name] = true;
+ return true;
+ }
+
+ return true;
};
}
+var warnUnknownProperties = function (type, props, canUseEventSystem) {
+ var unknownProps = [];
+ for (var key in props) {
+ var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
+ if (!isValid) {
+ unknownProps.push(key);
+ }
+ }
+ var unknownPropString = unknownProps.map(function (prop) {
+ return '`' + prop + '`';
+ }).join(', ');
+ if (unknownProps.length === 1) {
+ warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
+ } else if (unknownProps.length > 1) {
+ warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
+ }
+};
-function pop(cursor, fiber) {
- if (index < 0) {
+function validateProperties$2(type, props, canUseEventSystem) {
+ if (isCustomComponent(type, props)) {
+ return;
+ }
+ warnUnknownProperties(type, props, canUseEventSystem);
+}
+
+// TODO: direct imports like some-package/src/* are bad. Fix me.
+var didWarnInvalidHydration = false;
+var didWarnShadyDOM = false;
+
+var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
+var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
+var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
+var AUTOFOCUS = 'autoFocus';
+var CHILDREN = 'children';
+var STYLE = 'style';
+var HTML = '__html';
+
+var HTML_NAMESPACE = Namespaces.html;
+
+
+var warnedUnknownTags = void 0;
+var suppressHydrationWarning = void 0;
+
+var validatePropertiesInDevelopment = void 0;
+var warnForTextDifference = void 0;
+var warnForPropDifference = void 0;
+var warnForExtraAttributes = void 0;
+var warnForInvalidEventListener = void 0;
+var canDiffStyleForHydrationWarning = void 0;
+
+var normalizeMarkupForTextOrAttribute = void 0;
+var normalizeHTML = void 0;
+
+{
+ warnedUnknownTags = {
+ // Chrome is the only major browser not shipping <time>. But as of July
+ // 2017 it intends to ship it due to widespread usage. We intentionally
+ // *don't* warn for <time> even if it's unrecognized by Chrome because
+ // it soon will be, and many apps have been using it anyway.
+ time: true,
+ // There are working polyfills for <dialog>. Let people use it.
+ dialog: true,
+ // Electron ships a custom <webview> tag to display external web content in
+ // an isolated frame and process.
+ // This tag is not present in non Electron environments such as JSDom which
+ // is often used for testing purposes.
+ // @see https://electronjs.org/docs/api/webview-tag
+ webview: true
+ };
+
+ validatePropertiesInDevelopment = function (type, props) {
+ validateProperties(type, props);
+ validateProperties$1(type, props);
+ validateProperties$2(type, props, /* canUseEventSystem */true);
+ };
+
+ // IE 11 parses & normalizes the style attribute as opposed to other
+ // browsers. It adds spaces and sorts the properties in some
+ // non-alphabetical order. Handling that would require sorting CSS
+ // properties in the client & server versions or applying
+ // `expectedStyle` to a temporary DOM node to read its `style` attribute
+ // normalized. Since it only affects IE, we're skipping style warnings
+ // in that browser completely in favor of doing all that work.
+ // See https://github.com/facebook/react/issues/11807
+ canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
+
+ // HTML parsing normalizes CR and CRLF to LF.
+ // It also can turn \u0000 into \uFFFD inside attributes.
+ // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
+ // If we have a mismatch, it might be caused by that.
+ // We will still patch up in this case but not fire the warning.
+ var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
+ var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
+
+ normalizeMarkupForTextOrAttribute = function (markup) {
+ var markupString = typeof markup === 'string' ? markup : '' + markup;
+ return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
+ };
+
+ warnForTextDifference = function (serverText, clientText) {
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
+ var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
+ if (normalizedServerText === normalizedClientText) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
+ };
+
+ warnForPropDifference = function (propName, serverValue, clientValue) {
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
+ var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
+ if (normalizedServerValue === normalizedClientValue) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
+ };
+
+ warnForExtraAttributes = function (attributeNames) {
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ var names = [];
+ attributeNames.forEach(function (name) {
+ names.push(name);
+ });
+ warningWithoutStack$1(false, 'Extra attributes from the server: %s', names);
+ };
+
+ warnForInvalidEventListener = function (registrationName, listener) {
+ if (listener === false) {
+ warning$1(false, 'Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName);
+ } else {
+ warning$1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
+ }
+ };
+
+ // Parse the HTML and read it back to normalize the HTML string so that it
+ // can be used for comparison.
+ normalizeHTML = function (parent, html) {
+ // We could have created a separate document here to avoid
+ // re-initializing custom elements if they exist. But this breaks
+ // how <noscript> is being handled. So we use the same document.
+ // See the discussion in https://github.com/facebook/react/pull/11157.
+ var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
+ testElement.innerHTML = html;
+ return testElement.innerHTML;
+ };
+}
+
+function ensureListeningTo(rootContainerElement, registrationName) {
+ var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
+ var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
+ listenTo(registrationName, doc);
+}
+
+function getOwnerDocumentFromRootContainer(rootContainerElement) {
+ return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
+}
+
+function noop() {}
+
+function trapClickOnNonInteractiveElement(node) {
+ // Mobile Safari does not fire properly bubble click events on
+ // non-interactive elements, which means delegated click listeners do not
+ // fire. The workaround for this bug involves attaching an empty click
+ // listener on the target node.
+ // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
+ // Just set it using the onclick property so that we don't have to manage any
+ // bookkeeping for it. Not sure if we need to clear it when the listener is
+ // removed.
+ // TODO: Only do this for the relevant Safaris maybe?
+ node.onclick = noop;
+}
+
+function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
+ for (var propKey in nextProps) {
+ if (!nextProps.hasOwnProperty(propKey)) {
+ continue;
+ }
+ var nextProp = nextProps[propKey];
+ if (propKey === STYLE) {
+ {
+ if (nextProp) {
+ // Freeze the next style object so that we can assume it won't be
+ // mutated. We have already warned for this in the past.
+ Object.freeze(nextProp);
+ }
+ }
+ // Relies on `updateStylesByID` not mutating `styleUpdates`.
+ setValueForStyles(domElement, nextProp);
+ } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
+ var nextHtml = nextProp ? nextProp[HTML] : undefined;
+ if (nextHtml != null) {
+ setInnerHTML(domElement, nextHtml);
+ }
+ } else if (propKey === CHILDREN) {
+ if (typeof nextProp === 'string') {
+ // Avoid setting initial textContent when the text is empty. In IE11 setting
+ // textContent on a <textarea> will cause the placeholder to not
+ // show within the <textarea> until it has been focused and blurred again.
+ // https://github.com/facebook/react/issues/6731#issuecomment-254874553
+ var canSetTextContent = tag !== 'textarea' || nextProp !== '';
+ if (canSetTextContent) {
+ setTextContent(domElement, nextProp);
+ }
+ } else if (typeof nextProp === 'number') {
+ setTextContent(domElement, '' + nextProp);
+ }
+ } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
+ // Noop
+ } else if (propKey === AUTOFOCUS) {
+ // We polyfill it separately on the client during commit.
+ // We could have excluded it in the property list instead of
+ // adding a special case here, but then it wouldn't be emitted
+ // on server rendering (but we *do* want to emit it in SSR).
+ } else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (nextProp != null) {
+ if (true && typeof nextProp !== 'function') {
+ warnForInvalidEventListener(propKey, nextProp);
+ }
+ ensureListeningTo(rootContainerElement, propKey);
+ }
+ } else if (nextProp != null) {
+ setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
+ }
+ }
+}
+
+function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
+ // TODO: Handle wasCustomComponentTag
+ for (var i = 0; i < updatePayload.length; i += 2) {
+ var propKey = updatePayload[i];
+ var propValue = updatePayload[i + 1];
+ if (propKey === STYLE) {
+ setValueForStyles(domElement, propValue);
+ } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
+ setInnerHTML(domElement, propValue);
+ } else if (propKey === CHILDREN) {
+ setTextContent(domElement, propValue);
+ } else {
+ setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
+ }
+ }
+}
+
+function createElement(type, props, rootContainerElement, parentNamespace) {
+ var isCustomComponentTag = void 0;
+
+ // We create tags in the namespace of their parent container, except HTML
+ // tags get no namespace.
+ var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
+ var domElement = void 0;
+ var namespaceURI = parentNamespace;
+ if (namespaceURI === HTML_NAMESPACE) {
+ namespaceURI = getIntrinsicNamespace(type);
+ }
+ if (namespaceURI === HTML_NAMESPACE) {
{
- warning(false, 'Unexpected pop.');
+ isCustomComponentTag = isCustomComponent(type, props);
+ // Should this check be gated by parent namespace? Not sure we want to
+ // allow <SVG> or <mATH>.
+ !(isCustomComponentTag || type === type.toLowerCase()) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
}
- return;
+
+ if (type === 'script') {
+ // Create the script via .innerHTML so its "parser-inserted" flag is
+ // set to true and it does not execute
+ var div = ownerDocument.createElement('div');
+ div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
+ // This is guaranteed to yield a script element.
+ var firstChild = div.firstChild;
+ domElement = div.removeChild(firstChild);
+ } else if (typeof props.is === 'string') {
+ // $FlowIssue `createElement` should be updated for Web Components
+ domElement = ownerDocument.createElement(type, { is: props.is });
+ } else {
+ // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
+ // See discussion in https://github.com/facebook/react/pull/6896
+ // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
+ domElement = ownerDocument.createElement(type);
+ // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
+ // attribute on `select`s needs to be added before `option`s are inserted. This prevents
+ // a bug where the `select` does not scroll to the correct option because singular
+ // `select` elements automatically pick the first item.
+ // See https://github.com/facebook/react/issues/13222
+ if (type === 'select' && props.multiple) {
+ var node = domElement;
+ node.multiple = true;
+ }
+ }
+ } else {
+ domElement = ownerDocument.createElementNS(namespaceURI, type);
}
{
- if (fiber !== fiberStack[index]) {
- warning(false, 'Unexpected Fiber popped.');
+ if (namespaceURI === HTML_NAMESPACE) {
+ if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
+ warnedUnknownTags[type] = true;
+ warning$1(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
+ }
}
}
- cursor.current = valueStack[index];
+ return domElement;
+}
- valueStack[index] = null;
+function createTextNode(text, rootContainerElement) {
+ return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
+}
+function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
+ var isCustomComponentTag = isCustomComponent(tag, rawProps);
{
- fiberStack[index] = null;
+ validatePropertiesInDevelopment(tag, rawProps);
+ if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
+ warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
+ didWarnShadyDOM = true;
+ }
}
- index--;
+ // TODO: Make sure that we check isMounted before firing any of these events.
+ var props = void 0;
+ switch (tag) {
+ case 'iframe':
+ case 'object':
+ trapBubbledEvent(TOP_LOAD, domElement);
+ props = rawProps;
+ break;
+ case 'video':
+ case 'audio':
+ // Create listener for each media event
+ for (var i = 0; i < mediaEventTypes.length; i++) {
+ trapBubbledEvent(mediaEventTypes[i], domElement);
+ }
+ props = rawProps;
+ break;
+ case 'source':
+ trapBubbledEvent(TOP_ERROR, domElement);
+ props = rawProps;
+ break;
+ case 'img':
+ case 'image':
+ case 'link':
+ trapBubbledEvent(TOP_ERROR, domElement);
+ trapBubbledEvent(TOP_LOAD, domElement);
+ props = rawProps;
+ break;
+ case 'form':
+ trapBubbledEvent(TOP_RESET, domElement);
+ trapBubbledEvent(TOP_SUBMIT, domElement);
+ props = rawProps;
+ break;
+ case 'details':
+ trapBubbledEvent(TOP_TOGGLE, domElement);
+ props = rawProps;
+ break;
+ case 'input':
+ initWrapperState(domElement, rawProps);
+ props = getHostProps(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ case 'option':
+ validateProps(domElement, rawProps);
+ props = getHostProps$1(domElement, rawProps);
+ break;
+ case 'select':
+ initWrapperState$1(domElement, rawProps);
+ props = getHostProps$2(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ case 'textarea':
+ initWrapperState$2(domElement, rawProps);
+ props = getHostProps$3(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ default:
+ props = rawProps;
+ }
+
+ assertValidProps(tag, props);
+
+ setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
+
+ switch (tag) {
+ case 'input':
+ // TODO: Make sure we check if this is still unmounted or do any clean
+ // up necessary since we never stop tracking anymore.
+ track(domElement);
+ postMountWrapper(domElement, rawProps, false);
+ break;
+ case 'textarea':
+ // TODO: Make sure we check if this is still unmounted or do any clean
+ // up necessary since we never stop tracking anymore.
+ track(domElement);
+ postMountWrapper$3(domElement, rawProps);
+ break;
+ case 'option':
+ postMountWrapper$1(domElement, rawProps);
+ break;
+ case 'select':
+ postMountWrapper$2(domElement, rawProps);
+ break;
+ default:
+ if (typeof props.onClick === 'function') {
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
+ trapClickOnNonInteractiveElement(domElement);
+ }
+ break;
+ }
}
-function push(cursor, value, fiber) {
- index++;
+// Calculate the diff between the two objects.
+function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
+ {
+ validatePropertiesInDevelopment(tag, nextRawProps);
+ }
- valueStack[index] = cursor.current;
+ var updatePayload = null;
+
+ var lastProps = void 0;
+ var nextProps = void 0;
+ switch (tag) {
+ case 'input':
+ lastProps = getHostProps(domElement, lastRawProps);
+ nextProps = getHostProps(domElement, nextRawProps);
+ updatePayload = [];
+ break;
+ case 'option':
+ lastProps = getHostProps$1(domElement, lastRawProps);
+ nextProps = getHostProps$1(domElement, nextRawProps);
+ updatePayload = [];
+ break;
+ case 'select':
+ lastProps = getHostProps$2(domElement, lastRawProps);
+ nextProps = getHostProps$2(domElement, nextRawProps);
+ updatePayload = [];
+ break;
+ case 'textarea':
+ lastProps = getHostProps$3(domElement, lastRawProps);
+ nextProps = getHostProps$3(domElement, nextRawProps);
+ updatePayload = [];
+ break;
+ default:
+ lastProps = lastRawProps;
+ nextProps = nextRawProps;
+ if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
+ trapClickOnNonInteractiveElement(domElement);
+ }
+ break;
+ }
+ assertValidProps(tag, nextProps);
+
+ var propKey = void 0;
+ var styleName = void 0;
+ var styleUpdates = null;
+ for (propKey in lastProps) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
+ continue;
+ }
+ if (propKey === STYLE) {
+ var lastStyle = lastProps[propKey];
+ for (styleName in lastStyle) {
+ if (lastStyle.hasOwnProperty(styleName)) {
+ if (!styleUpdates) {
+ styleUpdates = {};
+ }
+ styleUpdates[styleName] = '';
+ }
+ }
+ } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
+ // Noop. This is handled by the clear text mechanism.
+ } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
+ // Noop
+ } else if (propKey === AUTOFOCUS) {
+ // Noop. It doesn't work on updates anyway.
+ } else if (registrationNameModules.hasOwnProperty(propKey)) {
+ // This is a special case. If any listener updates we need to ensure
+ // that the "current" fiber pointer gets updated so we need a commit
+ // to update this element.
+ if (!updatePayload) {
+ updatePayload = [];
+ }
+ } else {
+ // For all other deleted properties we add it to the queue. We use
+ // the whitelist in the commit phase instead.
+ (updatePayload = updatePayload || []).push(propKey, null);
+ }
+ }
+ for (propKey in nextProps) {
+ var nextProp = nextProps[propKey];
+ var lastProp = lastProps != null ? lastProps[propKey] : undefined;
+ if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
+ continue;
+ }
+ if (propKey === STYLE) {
+ {
+ if (nextProp) {
+ // Freeze the next style object so that we can assume it won't be
+ // mutated. We have already warned for this in the past.
+ Object.freeze(nextProp);
+ }
+ }
+ if (lastProp) {
+ // Unset styles on `lastProp` but not on `nextProp`.
+ for (styleName in lastProp) {
+ if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
+ if (!styleUpdates) {
+ styleUpdates = {};
+ }
+ styleUpdates[styleName] = '';
+ }
+ }
+ // Update styles that changed since `lastProp`.
+ for (styleName in nextProp) {
+ if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
+ if (!styleUpdates) {
+ styleUpdates = {};
+ }
+ styleUpdates[styleName] = nextProp[styleName];
+ }
+ }
+ } else {
+ // Relies on `updateStylesByID` not mutating `styleUpdates`.
+ if (!styleUpdates) {
+ if (!updatePayload) {
+ updatePayload = [];
+ }
+ updatePayload.push(propKey, styleUpdates);
+ }
+ styleUpdates = nextProp;
+ }
+ } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
+ var nextHtml = nextProp ? nextProp[HTML] : undefined;
+ var lastHtml = lastProp ? lastProp[HTML] : undefined;
+ if (nextHtml != null) {
+ if (lastHtml !== nextHtml) {
+ (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
+ }
+ } else {
+ // TODO: It might be too late to clear this if we have children
+ // inserted already.
+ }
+ } else if (propKey === CHILDREN) {
+ if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
+ (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
+ }
+ } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
+ // Noop
+ } else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (nextProp != null) {
+ // We eagerly listen to this even though we haven't committed yet.
+ if (true && typeof nextProp !== 'function') {
+ warnForInvalidEventListener(propKey, nextProp);
+ }
+ ensureListeningTo(rootContainerElement, propKey);
+ }
+ if (!updatePayload && lastProp !== nextProp) {
+ // This is a special case. If any listener updates we need to ensure
+ // that the "current" props pointer gets updated so we need a commit
+ // to update this element.
+ updatePayload = [];
+ }
+ } else {
+ // For any other property we always add it to the queue and then we
+ // filter it out using the whitelist during the commit.
+ (updatePayload = updatePayload || []).push(propKey, nextProp);
+ }
+ }
+ if (styleUpdates) {
+ (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
+ }
+ return updatePayload;
+}
+
+// Apply the diff.
+function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
+ // Update checked *before* name.
+ // In the middle of an update, it is possible to have multiple checked.
+ // When a checked radio tries to change name, browser makes another radio's checked false.
+ if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
+ updateChecked(domElement, nextRawProps);
+ }
+
+ var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
+ var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
+ // Apply the diff.
+ updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
+
+ // TODO: Ensure that an update gets scheduled if any of the special props
+ // changed.
+ switch (tag) {
+ case 'input':
+ // Update the wrapper around inputs *after* updating props. This has to
+ // happen after `updateDOMProperties`. Otherwise HTML5 input validations
+ // raise warnings and prevent the new value from being assigned.
+ updateWrapper(domElement, nextRawProps);
+ break;
+ case 'textarea':
+ updateWrapper$1(domElement, nextRawProps);
+ break;
+ case 'select':
+ // <select> value update needs to occur after <option> children
+ // reconciliation
+ postUpdateWrapper(domElement, nextRawProps);
+ break;
+ }
+}
+
+function getPossibleStandardName(propName) {
{
- fiberStack[index] = fiber;
+ var lowerCasedName = propName.toLowerCase();
+ if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
+ return null;
+ }
+ return possibleStandardNames[lowerCasedName] || null;
}
+ return null;
+}
- cursor.current = value;
+function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
+ var isCustomComponentTag = void 0;
+ var extraAttributeNames = void 0;
+
+ {
+ suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
+ isCustomComponentTag = isCustomComponent(tag, rawProps);
+ validatePropertiesInDevelopment(tag, rawProps);
+ if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
+ warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
+ didWarnShadyDOM = true;
+ }
+ }
+
+ // TODO: Make sure that we check isMounted before firing any of these events.
+ switch (tag) {
+ case 'iframe':
+ case 'object':
+ trapBubbledEvent(TOP_LOAD, domElement);
+ break;
+ case 'video':
+ case 'audio':
+ // Create listener for each media event
+ for (var i = 0; i < mediaEventTypes.length; i++) {
+ trapBubbledEvent(mediaEventTypes[i], domElement);
+ }
+ break;
+ case 'source':
+ trapBubbledEvent(TOP_ERROR, domElement);
+ break;
+ case 'img':
+ case 'image':
+ case 'link':
+ trapBubbledEvent(TOP_ERROR, domElement);
+ trapBubbledEvent(TOP_LOAD, domElement);
+ break;
+ case 'form':
+ trapBubbledEvent(TOP_RESET, domElement);
+ trapBubbledEvent(TOP_SUBMIT, domElement);
+ break;
+ case 'details':
+ trapBubbledEvent(TOP_TOGGLE, domElement);
+ break;
+ case 'input':
+ initWrapperState(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ case 'option':
+ validateProps(domElement, rawProps);
+ break;
+ case 'select':
+ initWrapperState$1(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ case 'textarea':
+ initWrapperState$2(domElement, rawProps);
+ trapBubbledEvent(TOP_INVALID, domElement);
+ // For controlled components we always need to ensure we're listening
+ // to onChange. Even if there is no listener.
+ ensureListeningTo(rootContainerElement, 'onChange');
+ break;
+ }
+
+ assertValidProps(tag, rawProps);
+
+ {
+ extraAttributeNames = new Set();
+ var attributes = domElement.attributes;
+ for (var _i = 0; _i < attributes.length; _i++) {
+ var name = attributes[_i].name.toLowerCase();
+ switch (name) {
+ // Built-in SSR attribute is whitelisted
+ case 'data-reactroot':
+ break;
+ // Controlled attributes are not validated
+ // TODO: Only ignore them on controlled tags.
+ case 'value':
+ break;
+ case 'checked':
+ break;
+ case 'selected':
+ break;
+ default:
+ // Intentionally use the original name.
+ // See discussion in https://github.com/facebook/react/pull/10676.
+ extraAttributeNames.add(attributes[_i].name);
+ }
+ }
+ }
+
+ var updatePayload = null;
+ for (var propKey in rawProps) {
+ if (!rawProps.hasOwnProperty(propKey)) {
+ continue;
+ }
+ var nextProp = rawProps[propKey];
+ if (propKey === CHILDREN) {
+ // For text content children we compare against textContent. This
+ // might match additional HTML that is hidden when we read it using
+ // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
+ // satisfies our requirement. Our requirement is not to produce perfect
+ // HTML and attributes. Ideally we should preserve structure but it's
+ // ok not to if the visible content is still enough to indicate what
+ // even listeners these nodes might be wired up to.
+ // TODO: Warn if there is more than a single textNode as a child.
+ // TODO: Should we use domElement.firstChild.nodeValue to compare?
+ if (typeof nextProp === 'string') {
+ if (domElement.textContent !== nextProp) {
+ if (true && !suppressHydrationWarning) {
+ warnForTextDifference(domElement.textContent, nextProp);
+ }
+ updatePayload = [CHILDREN, nextProp];
+ }
+ } else if (typeof nextProp === 'number') {
+ if (domElement.textContent !== '' + nextProp) {
+ if (true && !suppressHydrationWarning) {
+ warnForTextDifference(domElement.textContent, nextProp);
+ }
+ updatePayload = [CHILDREN, '' + nextProp];
+ }
+ }
+ } else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (nextProp != null) {
+ if (true && typeof nextProp !== 'function') {
+ warnForInvalidEventListener(propKey, nextProp);
+ }
+ ensureListeningTo(rootContainerElement, propKey);
+ }
+ } else if (true &&
+ // Convince Flow we've calculated it (it's DEV-only in this method.)
+ typeof isCustomComponentTag === 'boolean') {
+ // Validate that the properties correspond to their expected values.
+ var serverValue = void 0;
+ var propertyInfo = getPropertyInfo(propKey);
+ if (suppressHydrationWarning) {
+ // Don't bother comparing. We're ignoring all these warnings.
+ } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
+ // Controlled attributes are not validated
+ // TODO: Only ignore them on controlled tags.
+ propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
+ // Noop
+ } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
+ var serverHTML = domElement.innerHTML;
+ var nextHtml = nextProp ? nextProp[HTML] : undefined;
+ var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
+ if (expectedHTML !== serverHTML) {
+ warnForPropDifference(propKey, serverHTML, expectedHTML);
+ }
+ } else if (propKey === STYLE) {
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(propKey);
+
+ if (canDiffStyleForHydrationWarning) {
+ var expectedStyle = createDangerousStringForStyles(nextProp);
+ serverValue = domElement.getAttribute('style');
+ if (expectedStyle !== serverValue) {
+ warnForPropDifference(propKey, serverValue, expectedStyle);
+ }
+ }
+ } else if (isCustomComponentTag) {
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(propKey.toLowerCase());
+ serverValue = getValueForAttribute(domElement, propKey, nextProp);
+
+ if (nextProp !== serverValue) {
+ warnForPropDifference(propKey, serverValue, nextProp);
+ }
+ } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
+ var isMismatchDueToBadCasing = false;
+ if (propertyInfo !== null) {
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(propertyInfo.attributeName);
+ serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
+ } else {
+ var ownNamespace = parentNamespace;
+ if (ownNamespace === HTML_NAMESPACE) {
+ ownNamespace = getIntrinsicNamespace(tag);
+ }
+ if (ownNamespace === HTML_NAMESPACE) {
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(propKey.toLowerCase());
+ } else {
+ var standardName = getPossibleStandardName(propKey);
+ if (standardName !== null && standardName !== propKey) {
+ // If an SVG prop is supplied with bad casing, it will
+ // be successfully parsed from HTML, but will produce a mismatch
+ // (and would be incorrectly rendered on the client).
+ // However, we already warn about bad casing elsewhere.
+ // So we'll skip the misleading extra mismatch warning in this case.
+ isMismatchDueToBadCasing = true;
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(standardName);
+ }
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.delete(propKey);
+ }
+ serverValue = getValueForAttribute(domElement, propKey, nextProp);
+ }
+
+ if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
+ warnForPropDifference(propKey, serverValue, nextProp);
+ }
+ }
+ }
+ }
+
+ {
+ // $FlowFixMe - Should be inferred as not undefined.
+ if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
+ // $FlowFixMe - Should be inferred as not undefined.
+ warnForExtraAttributes(extraAttributeNames);
+ }
+ }
+
+ switch (tag) {
+ case 'input':
+ // TODO: Make sure we check if this is still unmounted or do any clean
+ // up necessary since we never stop tracking anymore.
+ track(domElement);
+ postMountWrapper(domElement, rawProps, true);
+ break;
+ case 'textarea':
+ // TODO: Make sure we check if this is still unmounted or do any clean
+ // up necessary since we never stop tracking anymore.
+ track(domElement);
+ postMountWrapper$3(domElement, rawProps);
+ break;
+ case 'select':
+ case 'option':
+ // For input and textarea we current always set the value property at
+ // post mount to force it to diverge from attributes. However, for
+ // option and select we don't quite do the same thing and select
+ // is not resilient to the DOM state changing so we don't do that here.
+ // TODO: Consider not doing this for input and textarea.
+ break;
+ default:
+ if (typeof rawProps.onClick === 'function') {
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
+ trapClickOnNonInteractiveElement(domElement);
+ }
+ break;
+ }
+
+ return updatePayload;
}
-function reset$1() {
- while (index > -1) {
- valueStack[index] = null;
+function diffHydratedText(textNode, text) {
+ var isDifferent = textNode.nodeValue !== text;
+ return isDifferent;
+}
- {
- fiberStack[index] = null;
+function warnForUnmatchedText(textNode, text) {
+ {
+ warnForTextDifference(textNode.nodeValue, text);
+ }
+}
+
+function warnForDeletedHydratableElement(parentNode, child) {
+ {
+ if (didWarnInvalidHydration) {
+ return;
}
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
+ }
+}
- index--;
+function warnForDeletedHydratableText(parentNode, child) {
+ {
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
}
}
-var describeComponentFrame = function (name, source, ownerName) {
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
-};
+function warnForInsertedHydratedElement(parentNode, tag, props) {
+ {
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
+ }
+}
-function describeFiber(fiber) {
- switch (fiber.tag) {
- case IndeterminateComponent:
- case FunctionalComponent:
- case ClassComponent:
- case HostComponent:
- var owner = fiber._debugOwner;
- var source = fiber._debugSource;
- var name = getComponentName(fiber);
- var ownerName = null;
- if (owner) {
- ownerName = getComponentName(owner);
+function warnForInsertedHydratedText(parentNode, text) {
+ {
+ if (text === '') {
+ // We expect to insert empty text nodes since they're not represented in
+ // the HTML.
+ // TODO: Remove this special case if we can just avoid inserting empty
+ // text nodes.
+ return;
+ }
+ if (didWarnInvalidHydration) {
+ return;
+ }
+ didWarnInvalidHydration = true;
+ warningWithoutStack$1(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
+ }
+}
+
+function restoreControlledState$1(domElement, tag, props) {
+ switch (tag) {
+ case 'input':
+ restoreControlledState(domElement, props);
+ return;
+ case 'textarea':
+ restoreControlledState$3(domElement, props);
+ return;
+ case 'select':
+ restoreControlledState$2(domElement, props);
+ return;
+ }
+}
+
+// TODO: direct imports like some-package/src/* are bad. Fix me.
+var validateDOMNesting = function () {};
+var updatedAncestorInfo = function () {};
+
+{
+ // This validation code was written based on the HTML5 parsing spec:
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ //
+ // Note: this does not catch all invalid nesting, nor does it try to (as it's
+ // not clear what practical benefit doing so provides); instead, we warn only
+ // for cases where the parser will give a parse tree differing from what React
+ // intended. For example, <b><div></div></b> is invalid but we don't warn
+ // because it still parses correctly; we do warn for other cases like nested
+ // <p> tags where the beginning of the second element implicitly closes the
+ // first, causing a confusing mess.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#special
+ var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
+ // TODO: Distinguish by namespace here -- for <title>, including it here
+ // errs on the side of fewer warnings
+ 'foreignObject', 'desc', 'title'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
+ var buttonScopeTags = inScopeTags.concat(['button']);
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
+ var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
+
+ var emptyAncestorInfo = {
+ current: null,
+
+ formTag: null,
+ aTagInScope: null,
+ buttonTagInScope: null,
+ nobrTagInScope: null,
+ pTagInButtonScope: null,
+
+ listItemTagAutoclosing: null,
+ dlItemTagAutoclosing: null
+ };
+
+ updatedAncestorInfo = function (oldInfo, tag) {
+ var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
+ var info = { tag: tag };
+
+ if (inScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.aTagInScope = null;
+ ancestorInfo.buttonTagInScope = null;
+ ancestorInfo.nobrTagInScope = null;
+ }
+ if (buttonScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.pTagInButtonScope = null;
+ }
+
+ // See rules for 'li', 'dd', 'dt' start tags in
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
+ ancestorInfo.listItemTagAutoclosing = null;
+ ancestorInfo.dlItemTagAutoclosing = null;
+ }
+
+ ancestorInfo.current = info;
+
+ if (tag === 'form') {
+ ancestorInfo.formTag = info;
+ }
+ if (tag === 'a') {
+ ancestorInfo.aTagInScope = info;
+ }
+ if (tag === 'button') {
+ ancestorInfo.buttonTagInScope = info;
+ }
+ if (tag === 'nobr') {
+ ancestorInfo.nobrTagInScope = info;
+ }
+ if (tag === 'p') {
+ ancestorInfo.pTagInButtonScope = info;
+ }
+ if (tag === 'li') {
+ ancestorInfo.listItemTagAutoclosing = info;
+ }
+ if (tag === 'dd' || tag === 'dt') {
+ ancestorInfo.dlItemTagAutoclosing = info;
+ }
+
+ return ancestorInfo;
+ };
+
+ /**
+ * Returns whether
+ */
+ var isTagValidWithParent = function (tag, parentTag) {
+ // First, let's check if we're in an unusual parsing mode...
+ switch (parentTag) {
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
+ case 'select':
+ return tag === 'option' || tag === 'optgroup' || tag === '#text';
+ case 'optgroup':
+ return tag === 'option' || tag === '#text';
+ // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
+ // but
+ case 'option':
+ return tag === '#text';
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
+ // No special behavior since these rules fall back to "in body" mode for
+ // all except special table nodes which cause bad parsing behavior anyway.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
+ case 'tr':
+ return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
+ case 'colgroup':
+ return tag === 'col' || tag === 'template';
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
+ case 'table':
+ return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
+ case 'head':
+ return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
+ // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
+ case 'html':
+ return tag === 'head' || tag === 'body';
+ case '#document':
+ return tag === 'html';
+ }
+
+ // Probably in the "in body" parsing mode, so we outlaw only tag combos
+ // where the parsing rules cause implicit opens or closes to be added.
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ switch (tag) {
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
+
+ case 'rp':
+ case 'rt':
+ return impliedEndTags.indexOf(parentTag) === -1;
+
+ case 'body':
+ case 'caption':
+ case 'col':
+ case 'colgroup':
+ case 'frame':
+ case 'head':
+ case 'html':
+ case 'tbody':
+ case 'td':
+ case 'tfoot':
+ case 'th':
+ case 'thead':
+ case 'tr':
+ // These tags are only valid with a few parents that have special child
+ // parsing rules -- if we're down here, then none of those matched and
+ // so we allow it only if we don't know what the parent is, as all other
+ // cases are invalid.
+ return parentTag == null;
+ }
+
+ return true;
+ };
+
+ /**
+ * Returns whether
+ */
+ var findInvalidAncestorForTag = function (tag, ancestorInfo) {
+ switch (tag) {
+ case 'address':
+ case 'article':
+ case 'aside':
+ case 'blockquote':
+ case 'center':
+ case 'details':
+ case 'dialog':
+ case 'dir':
+ case 'div':
+ case 'dl':
+ case 'fieldset':
+ case 'figcaption':
+ case 'figure':
+ case 'footer':
+ case 'header':
+ case 'hgroup':
+ case 'main':
+ case 'menu':
+ case 'nav':
+ case 'ol':
+ case 'p':
+ case 'section':
+ case 'summary':
+ case 'ul':
+ case 'pre':
+ case 'listing':
+ case 'table':
+ case 'hr':
+ case 'xmp':
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return ancestorInfo.pTagInButtonScope;
+
+ case 'form':
+ return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
+
+ case 'li':
+ return ancestorInfo.listItemTagAutoclosing;
+
+ case 'dd':
+ case 'dt':
+ return ancestorInfo.dlItemTagAutoclosing;
+
+ case 'button':
+ return ancestorInfo.buttonTagInScope;
+
+ case 'a':
+ // Spec says something about storing a list of markers, but it sounds
+ // equivalent to this check.
+ return ancestorInfo.aTagInScope;
+
+ case 'nobr':
+ return ancestorInfo.nobrTagInScope;
+ }
+
+ return null;
+ };
+
+ var didWarn = {};
+
+ validateDOMNesting = function (childTag, childText, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.current;
+ var parentTag = parentInfo && parentInfo.tag;
+
+ if (childText != null) {
+ !(childTag == null) ? warningWithoutStack$1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
+ childTag = '#text';
+ }
+
+ var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
+ var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
+ var invalidParentOrAncestor = invalidParent || invalidAncestor;
+ if (!invalidParentOrAncestor) {
+ return;
+ }
+
+ var ancestorTag = invalidParentOrAncestor.tag;
+ var addendum = getCurrentFiberStackInDev();
+
+ var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
+ if (didWarn[warnKey]) {
+ return;
+ }
+ didWarn[warnKey] = true;
+
+ var tagDisplayName = childTag;
+ var whitespaceInfo = '';
+ if (childTag === '#text') {
+ if (/\S/.test(childText)) {
+ tagDisplayName = 'Text nodes';
+ } else {
+ tagDisplayName = 'Whitespace text nodes';
+ whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
+ }
+ } else {
+ tagDisplayName = '<' + childTag + '>';
+ }
+
+ if (invalidParent) {
+ var info = '';
+ if (ancestorTag === 'table' && childTag === 'tr') {
+ info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
+ }
+ warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
+ } else {
+ warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
+ }
+ };
+}
+
+// Renderers that don't support persistence
+// can re-export everything from this module.
+
+function shim() {
+ invariant(false, 'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.');
+}
+
+// Persistence (when unsupported)
+var supportsPersistence = false;
+var cloneInstance = shim;
+var createContainerChildSet = shim;
+var appendChildToContainerChildSet = shim;
+var finalizeContainerChildren = shim;
+var replaceContainerChildren = shim;
+
+var SUPPRESS_HYDRATION_WARNING = void 0;
+{
+ SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
+}
+
+var eventsEnabled = null;
+var selectionInformation = null;
+
+function shouldAutoFocusHostComponent(type, props) {
+ switch (type) {
+ case 'button':
+ case 'input':
+ case 'select':
+ case 'textarea':
+ return !!props.autoFocus;
+ }
+ return false;
+}
+
+function getRootHostContext(rootContainerInstance) {
+ var type = void 0;
+ var namespace = void 0;
+ var nodeType = rootContainerInstance.nodeType;
+ switch (nodeType) {
+ case DOCUMENT_NODE:
+ case DOCUMENT_FRAGMENT_NODE:
+ {
+ type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
+ var root = rootContainerInstance.documentElement;
+ namespace = root ? root.namespaceURI : getChildNamespace(null, '');
+ break;
}
- return describeComponentFrame(name, source, ownerName);
default:
- return '';
+ {
+ var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
+ var ownNamespace = container.namespaceURI || null;
+ type = container.tagName;
+ namespace = getChildNamespace(ownNamespace, type);
+ break;
+ }
}
+ {
+ var validatedTag = type.toLowerCase();
+ var _ancestorInfo = updatedAncestorInfo(null, validatedTag);
+ return { namespace: namespace, ancestorInfo: _ancestorInfo };
+ }
+ return namespace;
}
-// This function can only be called with a work-in-progress fiber and
-// only during begin or complete phase. Do not call it under any other
-// circumstances.
-function getStackAddendumByWorkInProgressFiber(workInProgress) {
- var info = '';
- var node = workInProgress;
- do {
- info += describeFiber(node);
- // Otherwise this return pointer might point to the wrong tree:
- node = node['return'];
- } while (node);
- return info;
+function getChildHostContext(parentHostContext, type, rootContainerInstance) {
+ {
+ var parentHostContextDev = parentHostContext;
+ var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
+ var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
+ return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
+ }
+ var parentNamespace = parentHostContext;
+ return getChildNamespace(parentNamespace, type);
}
-function getCurrentFiberOwnerName() {
+function getPublicInstance(instance) {
+ return instance;
+}
+
+function prepareForCommit(containerInfo) {
+ eventsEnabled = isEnabled();
+ selectionInformation = getSelectionInformation();
+ setEnabled(false);
+}
+
+function resetAfterCommit(containerInfo) {
+ restoreSelection(selectionInformation);
+ selectionInformation = null;
+ setEnabled(eventsEnabled);
+ eventsEnabled = null;
+}
+
+function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
+ var parentNamespace = void 0;
{
- var fiber = ReactDebugCurrentFiber.current;
- if (fiber === null) {
- return null;
- }
- var owner = fiber._debugOwner;
- if (owner !== null && typeof owner !== 'undefined') {
- return getComponentName(owner);
+ // TODO: take namespace into account when validating.
+ var hostContextDev = hostContext;
+ validateDOMNesting(type, null, hostContextDev.ancestorInfo);
+ if (typeof props.children === 'string' || typeof props.children === 'number') {
+ var string = '' + props.children;
+ var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
+ validateDOMNesting(null, string, ownAncestorInfo);
+ }
+ parentNamespace = hostContextDev.namespace;
+ }
+ var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
+ precacheFiberNode(internalInstanceHandle, domElement);
+ updateFiberProps(domElement, props);
+ return domElement;
+}
+
+function appendInitialChild(parentInstance, child) {
+ parentInstance.appendChild(child);
+}
+
+function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
+ setInitialProperties(domElement, type, props, rootContainerInstance);
+ return shouldAutoFocusHostComponent(type, props);
+}
+
+function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
+ {
+ var hostContextDev = hostContext;
+ if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
+ var string = '' + newProps.children;
+ var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
+ validateDOMNesting(null, string, ownAncestorInfo);
}
}
- return null;
+ return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
}
-function getCurrentFiberStackAddendum() {
+function shouldSetTextContent(type, props) {
+ return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
+}
+
+function shouldDeprioritizeSubtree(type, props) {
+ return !!props.hidden;
+}
+
+function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
{
- var fiber = ReactDebugCurrentFiber.current;
- if (fiber === null) {
- return null;
+ var hostContextDev = hostContext;
+ validateDOMNesting(null, text, hostContextDev.ancestorInfo);
+ }
+ var textNode = createTextNode(text, rootContainerInstance);
+ precacheFiberNode(internalInstanceHandle, textNode);
+ return textNode;
+}
+
+var isPrimaryRenderer = true;
+var scheduleTimeout = setTimeout;
+var cancelTimeout = clearTimeout;
+var noTimeout = -1;
+
+// -------------------
+// Mutation
+// -------------------
+
+var supportsMutation = true;
+
+function commitMount(domElement, type, newProps, internalInstanceHandle) {
+ // Despite the naming that might imply otherwise, this method only
+ // fires if there is an `Update` effect scheduled during mounting.
+ // This happens if `finalizeInitialChildren` returns `true` (which it
+ // does to implement the `autoFocus` attribute on the client). But
+ // there are also other cases when this might happen (such as patching
+ // up text content during hydration mismatch). So we'll check this again.
+ if (shouldAutoFocusHostComponent(type, newProps)) {
+ domElement.focus();
+ }
+}
+
+function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
+ // Update the props handle so that we know which props are the ones with
+ // with current event handlers.
+ updateFiberProps(domElement, newProps);
+ // Apply the diff to the DOM node.
+ updateProperties(domElement, updatePayload, type, oldProps, newProps);
+}
+
+function resetTextContent(domElement) {
+ setTextContent(domElement, '');
+}
+
+function commitTextUpdate(textInstance, oldText, newText) {
+ textInstance.nodeValue = newText;
+}
+
+function appendChild(parentInstance, child) {
+ parentInstance.appendChild(child);
+}
+
+function appendChildToContainer(container, child) {
+ var parentNode = void 0;
+ if (container.nodeType === COMMENT_NODE) {
+ parentNode = container.parentNode;
+ parentNode.insertBefore(child, container);
+ } else {
+ parentNode = container;
+ parentNode.appendChild(child);
+ }
+ // This container might be used for a portal.
+ // If something inside a portal is clicked, that click should bubble
+ // through the React tree. However, on Mobile Safari the click would
+ // never bubble through the *DOM* tree unless an ancestor with onclick
+ // event exists. So we wouldn't see it and dispatch it.
+ // This is why we ensure that containers have inline onclick defined.
+ // https://github.com/facebook/react/issues/11918
+ if (parentNode.onclick === null) {
+ // TODO: This cast may not be sound for SVG, MathML or custom elements.
+ trapClickOnNonInteractiveElement(parentNode);
+ }
+}
+
+function insertBefore(parentInstance, child, beforeChild) {
+ parentInstance.insertBefore(child, beforeChild);
+}
+
+function insertInContainerBefore(container, child, beforeChild) {
+ if (container.nodeType === COMMENT_NODE) {
+ container.parentNode.insertBefore(child, beforeChild);
+ } else {
+ container.insertBefore(child, beforeChild);
+ }
+}
+
+function removeChild(parentInstance, child) {
+ parentInstance.removeChild(child);
+}
+
+function removeChildFromContainer(container, child) {
+ if (container.nodeType === COMMENT_NODE) {
+ container.parentNode.removeChild(child);
+ } else {
+ container.removeChild(child);
+ }
+}
+
+// -------------------
+// Hydration
+// -------------------
+
+var supportsHydration = true;
+
+function canHydrateInstance(instance, type, props) {
+ if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
+ return null;
+ }
+ // This has now been refined to an element node.
+ return instance;
+}
+
+function canHydrateTextInstance(instance, text) {
+ if (text === '' || instance.nodeType !== TEXT_NODE) {
+ // Empty strings are not parsed by HTML so there won't be a correct match here.
+ return null;
+ }
+ // This has now been refined to a text node.
+ return instance;
+}
+
+function getNextHydratableSibling(instance) {
+ var node = instance.nextSibling;
+ // Skip non-hydratable nodes.
+ while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
+ node = node.nextSibling;
+ }
+ return node;
+}
+
+function getFirstHydratableChild(parentInstance) {
+ var next = parentInstance.firstChild;
+ // Skip non-hydratable nodes.
+ while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
+ next = next.nextSibling;
+ }
+ return next;
+}
+
+function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
+ precacheFiberNode(internalInstanceHandle, instance);
+ // TODO: Possibly defer this until the commit phase where all the events
+ // get attached.
+ updateFiberProps(instance, props);
+ var parentNamespace = void 0;
+ {
+ var hostContextDev = hostContext;
+ parentNamespace = hostContextDev.namespace;
+ }
+ return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
+}
+
+function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
+ precacheFiberNode(internalInstanceHandle, textInstance);
+ return diffHydratedText(textInstance, text);
+}
+
+function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
+ {
+ warnForUnmatchedText(textInstance, text);
+ }
+}
+
+function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
+ if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ warnForUnmatchedText(textInstance, text);
+ }
+}
+
+function didNotHydrateContainerInstance(parentContainer, instance) {
+ {
+ if (instance.nodeType === ELEMENT_NODE) {
+ warnForDeletedHydratableElement(parentContainer, instance);
+ } else {
+ warnForDeletedHydratableText(parentContainer, instance);
}
- // Safe because if current fiber exists, we are reconciling,
- // and it is guaranteed to be the work-in-progress version.
- return getStackAddendumByWorkInProgressFiber(fiber);
}
- return null;
}
-function resetCurrentFiber() {
- ReactDebugCurrentFrame.getCurrentStack = null;
- ReactDebugCurrentFiber.current = null;
- ReactDebugCurrentFiber.phase = null;
+function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
+ if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ if (instance.nodeType === ELEMENT_NODE) {
+ warnForDeletedHydratableElement(parentInstance, instance);
+ } else {
+ warnForDeletedHydratableText(parentInstance, instance);
+ }
+ }
}
-function setCurrentFiber(fiber) {
- ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum;
- ReactDebugCurrentFiber.current = fiber;
- ReactDebugCurrentFiber.phase = null;
+function didNotFindHydratableContainerInstance(parentContainer, type, props) {
+ {
+ warnForInsertedHydratedElement(parentContainer, type, props);
+ }
+}
+
+function didNotFindHydratableContainerTextInstance(parentContainer, text) {
+ {
+ warnForInsertedHydratedText(parentContainer, text);
+ }
}
-function setCurrentPhase(phase) {
- ReactDebugCurrentFiber.phase = phase;
+function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
+ if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ warnForInsertedHydratedElement(parentInstance, type, props);
+ }
}
-var ReactDebugCurrentFiber = {
- current: null,
- phase: null,
- resetCurrentFiber: resetCurrentFiber,
- setCurrentFiber: setCurrentFiber,
- setCurrentPhase: setCurrentPhase,
- getCurrentFiberOwnerName: getCurrentFiberOwnerName,
- getCurrentFiberStackAddendum: getCurrentFiberStackAddendum
-};
+function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
+ if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ warnForInsertedHydratedText(parentInstance, text);
+ }
+}
// Prefix measurements so that it's possible to filter them.
// Longer prefixes are hard to read in DevTools.
@@ -4965,9 +8894,9 @@ var formatMarkName = function (markName) {
return reactEmoji + ' ' + markName;
};
-var formatLabel = function (label, warning$$1) {
- var prefix = warning$$1 ? warningEmoji + ' ' : reactEmoji + ' ';
- var suffix = warning$$1 ? ' Warning: ' + warning$$1 : '';
+var formatLabel = function (label, warning) {
+ var prefix = warning ? warningEmoji + ' ' : reactEmoji + ' ';
+ var suffix = warning ? ' Warning: ' + warning : '';
return '' + prefix + label + suffix;
};
@@ -4979,9 +8908,9 @@ var clearMark = function (markName) {
performance.clearMarks(formatMarkName(markName));
};
-var endMark = function (label, markName, warning$$1) {
+var endMark = function (label, markName, warning) {
var formattedMarkName = formatMarkName(markName);
- var formattedLabel = formatLabel(label, warning$$1);
+ var formattedLabel = formatLabel(label, warning);
try {
performance.measure(formattedLabel, formattedMarkName);
} catch (err) {}
@@ -5009,7 +8938,7 @@ var getFiberLabel = function (componentName, isMounted, phase) {
};
var beginFiberMark = function (fiber, phase) {
- var componentName = getComponentName(fiber) || 'Unknown';
+ var componentName = getComponentName(fiber.type) || 'Unknown';
var debugID = fiber._debugID;
var isMounted = fiber.alternate !== null;
var label = getFiberLabel(componentName, isMounted, phase);
@@ -5028,7 +8957,7 @@ var beginFiberMark = function (fiber, phase) {
};
var clearFiberMark = function (fiber, phase) {
- var componentName = getComponentName(fiber) || 'Unknown';
+ var componentName = getComponentName(fiber.type) || 'Unknown';
var debugID = fiber._debugID;
var isMounted = fiber.alternate !== null;
var label = getFiberLabel(componentName, isMounted, phase);
@@ -5036,13 +8965,13 @@ var clearFiberMark = function (fiber, phase) {
clearMark(markName);
};
-var endFiberMark = function (fiber, phase, warning$$1) {
- var componentName = getComponentName(fiber) || 'Unknown';
+var endFiberMark = function (fiber, phase, warning) {
+ var componentName = getComponentName(fiber.type) || 'Unknown';
var debugID = fiber._debugID;
var isMounted = fiber.alternate !== null;
var label = getFiberLabel(componentName, isMounted, phase);
var markName = getFiberMarkName(label, debugID);
- endMark(label, markName, warning$$1);
+ endMark(label, markName, warning);
};
var shouldIgnoreFiber = function (fiber) {
@@ -5053,8 +8982,10 @@ var shouldIgnoreFiber = function (fiber) {
case HostComponent:
case HostText:
case HostPortal:
- case ReturnComponent:
case Fragment:
+ case ContextProvider:
+ case ContextConsumer:
+ case Mode:
return true;
default:
return false;
@@ -5078,13 +9009,13 @@ var pauseTimers = function () {
if (fiber._debugIsCurrentlyTiming) {
endFiberMark(fiber, null, null);
}
- fiber = fiber['return'];
+ fiber = fiber.return;
}
};
var resumeTimersRecursively = function (fiber) {
- if (fiber['return'] !== null) {
- resumeTimersRecursively(fiber['return']);
+ if (fiber.return !== null) {
+ resumeTimersRecursively(fiber.return);
}
if (fiber._debugIsCurrentlyTiming) {
beginFiberMark(fiber, null);
@@ -5124,12 +9055,12 @@ function startRequestCallbackTimer() {
}
}
-function stopRequestCallbackTimer(didExpire) {
+function stopRequestCallbackTimer(didExpire, expirationTime) {
if (enableUserTimingAPI) {
if (supportsUserTiming) {
isWaitingForCallback = false;
- var warning$$1 = didExpire ? 'React was blocked by main thread' : null;
- endMark('(Waiting for async callback...)', '(Waiting for async callback...)', warning$$1);
+ var warning = didExpire ? 'React was blocked by main thread' : null;
+ endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
}
}
}
@@ -5166,7 +9097,7 @@ function stopWorkTimer(fiber) {
return;
}
// If we pause, its parent is the fiber to unwind from.
- currentFiber = fiber['return'];
+ currentFiber = fiber.return;
if (!fiber._debugIsCurrentlyTiming) {
return;
}
@@ -5181,13 +9112,13 @@ function stopFailedWorkTimer(fiber) {
return;
}
// If we pause, its parent is the fiber to unwind from.
- currentFiber = fiber['return'];
+ currentFiber = fiber.return;
if (!fiber._debugIsCurrentlyTiming) {
return;
}
fiber._debugIsCurrentlyTiming = false;
- var warning$$1 = 'An error was thrown inside this error boundary';
- endFiberMark(fiber, null, warning$$1);
+ var warning = 'An error was thrown inside this error boundary';
+ endFiberMark(fiber, null, warning);
}
}
@@ -5211,8 +9142,8 @@ function stopPhaseTimer() {
return;
}
if (currentPhase !== null && currentPhaseFiber !== null) {
- var warning$$1 = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
- endFiberMark(currentPhaseFiber, currentPhase, warning$$1);
+ var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
+ endFiberMark(currentPhaseFiber, currentPhase, warning);
}
currentPhase = null;
currentPhaseFiber = null;
@@ -5234,26 +9165,27 @@ function startWorkLoopTimer(nextUnitOfWork) {
}
}
-function stopWorkLoopTimer(interruptedBy) {
+function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
if (enableUserTimingAPI) {
if (!supportsUserTiming) {
return;
}
- var warning$$1 = null;
+ var warning = null;
if (interruptedBy !== null) {
if (interruptedBy.tag === HostRoot) {
- warning$$1 = 'A top-level update interrupted the previous render';
+ warning = 'A top-level update interrupted the previous render';
} else {
- var componentName = getComponentName(interruptedBy) || 'Unknown';
- warning$$1 = 'An update to ' + componentName + ' interrupted the previous render';
+ var componentName = getComponentName(interruptedBy.type) || 'Unknown';
+ warning = 'An update to ' + componentName + ' interrupted the previous render';
}
} else if (commitCountInCurrentWorkLoop > 1) {
- warning$$1 = 'There were cascading updates';
+ warning = 'There were cascading updates';
}
commitCountInCurrentWorkLoop = 0;
+ var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
// Pause any measurements until the next loop.
pauseTimers();
- endMark('(React Tree Reconciliation)', '(React Tree Reconciliation)', warning$$1);
+ endMark(label, '(React Tree Reconciliation)', warning);
}
}
@@ -5275,18 +9207,39 @@ function stopCommitTimer() {
return;
}
- var warning$$1 = null;
+ var warning = null;
if (hasScheduledUpdateInCurrentCommit) {
- warning$$1 = 'Lifecycle hook scheduled a cascading update';
+ warning = 'Lifecycle hook scheduled a cascading update';
} else if (commitCountInCurrentWorkLoop > 0) {
- warning$$1 = 'Caused by a cascading update in earlier commit';
+ warning = 'Caused by a cascading update in earlier commit';
}
hasScheduledUpdateInCurrentCommit = false;
commitCountInCurrentWorkLoop++;
isCommitting = false;
labelsInCurrentCommit.clear();
- endMark('(Committing Changes)', '(Committing Changes)', warning$$1);
+ endMark('(Committing Changes)', '(Committing Changes)', warning);
+ }
+}
+
+function startCommitSnapshotEffectsTimer() {
+ if (enableUserTimingAPI) {
+ if (!supportsUserTiming) {
+ return;
+ }
+ effectCountInCurrentCommit = 0;
+ beginMark('(Committing Snapshot Effects)');
+ }
+}
+
+function stopCommitSnapshotEffectsTimer() {
+ if (enableUserTimingAPI) {
+ if (!supportsUserTiming) {
+ return;
+ }
+ var count = effectCountInCurrentCommit;
+ effectCountInCurrentCommit = 0;
+ endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
}
}
@@ -5332,24 +9285,99 @@ function stopCommitLifeCyclesTimer() {
}
}
+var valueStack = [];
+
+var fiberStack = void 0;
+
+{
+ fiberStack = [];
+}
+
+var index = -1;
+
+function createCursor(defaultValue) {
+ return {
+ current: defaultValue
+ };
+}
+
+function pop(cursor, fiber) {
+ if (index < 0) {
+ {
+ warningWithoutStack$1(false, 'Unexpected pop.');
+ }
+ return;
+ }
+
+ {
+ if (fiber !== fiberStack[index]) {
+ warningWithoutStack$1(false, 'Unexpected Fiber popped.');
+ }
+ }
+
+ cursor.current = valueStack[index];
+
+ valueStack[index] = null;
+
+ {
+ fiberStack[index] = null;
+ }
+
+ index--;
+}
+
+function push(cursor, value, fiber) {
+ index++;
+
+ valueStack[index] = cursor.current;
+
+ {
+ fiberStack[index] = fiber;
+ }
+
+ cursor.current = value;
+}
+
+function checkThatStackIsEmpty() {
+ {
+ if (index !== -1) {
+ warningWithoutStack$1(false, 'Expected an empty stack. Something was not reset properly.');
+ }
+ }
+}
+
+function resetStackAfterFatalErrorInDev() {
+ {
+ index = -1;
+ valueStack.length = 0;
+ fiberStack.length = 0;
+ }
+}
+
+var warnedAboutMissingGetChildContext = void 0;
+
{
- var warnedAboutMissingGetChildContext = {};
+ warnedAboutMissingGetChildContext = {};
+}
+
+var emptyContextObject = {};
+{
+ Object.freeze(emptyContextObject);
}
// A cursor to the current merged context object on the stack.
-var contextStackCursor = createCursor(emptyObject);
+var contextStackCursor = createCursor(emptyContextObject);
// A cursor to a boolean indicating whether the context has changed.
var didPerformWorkStackCursor = createCursor(false);
// Keep track of the previous context object that was on the stack.
// We use this to get access to the parent context after we have already
// pushed the next context provider, and now need to merge their contexts.
-var previousContext = emptyObject;
+var previousContext = emptyContextObject;
-function getUnmaskedContext(workInProgress) {
- var hasOwnContext = isContextProvider(workInProgress);
- if (hasOwnContext) {
+function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
+ if (didPushOwnContextIfProvider && isContextProvider(Component)) {
// If the fiber is a context provider itself, when we read its context
- // we have already pushed its own child context on the stack. A context
+ // we may have already pushed its own child context on the stack. A context
// provider should not "see" its own child context. Therefore we read the
// previous (parent) context instead for a context provider.
return previousContext;
@@ -5367,7 +9395,7 @@ function getMaskedContext(workInProgress, unmaskedContext) {
var type = workInProgress.type;
var contextTypes = type.contextTypes;
if (!contextTypes) {
- return emptyObject;
+ return emptyContextObject;
}
// Avoid recreating masked context unless unmasked context has changed.
@@ -5384,8 +9412,8 @@ function getMaskedContext(workInProgress, unmaskedContext) {
}
{
- var name = getComponentName(workInProgress) || 'Unknown';
- checkPropTypes(contextTypes, context, 'context', name, ReactDebugCurrentFiber.getCurrentFiberStackAddendum);
+ var name = getComponentName(type) || 'Unknown';
+ checkPropTypes(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
}
// Cache unmasked context so we can avoid recreating masked context unless necessary.
@@ -5401,19 +9429,12 @@ function hasContextChanged() {
return didPerformWorkStackCursor.current;
}
-function isContextConsumer(fiber) {
- return fiber.tag === ClassComponent && fiber.type.contextTypes != null;
-}
-
-function isContextProvider(fiber) {
- return fiber.tag === ClassComponent && fiber.type.childContextTypes != null;
+function isContextProvider(type) {
+ var childContextTypes = type.childContextTypes;
+ return childContextTypes !== null && childContextTypes !== undefined;
}
-function popContextProvider(fiber) {
- if (!isContextProvider(fiber)) {
- return;
- }
-
+function popContext(fiber) {
pop(didPerformWorkStackCursor, fiber);
pop(contextStackCursor, fiber);
}
@@ -5424,25 +9445,25 @@ function popTopLevelContextObject(fiber) {
}
function pushTopLevelContextObject(fiber, context, didChange) {
- !(contextStackCursor.cursor == null) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ !(contextStackCursor.current === emptyContextObject) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
push(contextStackCursor, context, fiber);
push(didPerformWorkStackCursor, didChange, fiber);
}
-function processChildContext(fiber, parentContext) {
+function processChildContext(fiber, type, parentContext) {
var instance = fiber.stateNode;
- var childContextTypes = fiber.type.childContextTypes;
+ var childContextTypes = type.childContextTypes;
// TODO (bvaughn) Replace this behavior with an invariant() in the future.
// It has only been added in Fiber to match the (unintentional) behavior in Stack.
if (typeof instance.getChildContext !== 'function') {
{
- var componentName = getComponentName(fiber) || 'Unknown';
+ var componentName = getComponentName(type) || 'Unknown';
if (!warnedAboutMissingGetChildContext[componentName]) {
warnedAboutMissingGetChildContext[componentName] = true;
- warning(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
+ warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
}
}
return parentContext;
@@ -5450,41 +9471,37 @@ function processChildContext(fiber, parentContext) {
var childContext = void 0;
{
- ReactDebugCurrentFiber.setCurrentPhase('getChildContext');
+ setCurrentPhase('getChildContext');
}
startPhaseTimer(fiber, 'getChildContext');
childContext = instance.getChildContext();
stopPhaseTimer();
{
- ReactDebugCurrentFiber.setCurrentPhase(null);
+ setCurrentPhase(null);
}
for (var contextKey in childContext) {
- !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(fiber) || 'Unknown', contextKey) : void 0;
+ !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(type) || 'Unknown', contextKey) : void 0;
}
{
- var name = getComponentName(fiber) || 'Unknown';
+ var name = getComponentName(type) || 'Unknown';
checkPropTypes(childContextTypes, childContext, 'child context', name,
// In practice, there is one case in which we won't get a stack. It's when
// somebody calls unstable_renderSubtreeIntoContainer() and we process
// context from the parent component instance. The stack will be missing
// because it's outside of the reconciliation, and so the pointer has not
// been set. This is rare and doesn't matter. We'll also remove that API.
- ReactDebugCurrentFiber.getCurrentFiberStackAddendum);
+ getCurrentFiberStackInDev);
}
return _assign({}, parentContext, childContext);
}
function pushContextProvider(workInProgress) {
- if (!isContextProvider(workInProgress)) {
- return false;
- }
-
var instance = workInProgress.stateNode;
// We push the context as early as possible to ensure stack integrity.
// If the instance does not exist yet, we will push null at first,
// and replace it on the stack later when invalidating the context.
- var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyObject;
+ var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
// Remember the parent context so we can merge with it later.
// Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
@@ -5495,7 +9512,7 @@ function pushContextProvider(workInProgress) {
return true;
}
-function invalidateContextProvider(workInProgress, didChange) {
+function invalidateContextProvider(workInProgress, type, didChange) {
var instance = workInProgress.stateNode;
!instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0;
@@ -5503,7 +9520,7 @@ function invalidateContextProvider(workInProgress, didChange) {
// Merge parent and own context.
// Skip this if we're not updating due to sCU.
// This avoids unnecessarily recomputing memoized values.
- var mergedContext = processChildContext(workInProgress, previousContext);
+ var mergedContext = processChildContext(workInProgress, type, previousContext);
instance.__reactInternalMemoizedMergedChildContext = mergedContext;
// Replace the old (or empty) context with the new one.
@@ -5519,33 +9536,115 @@ function invalidateContextProvider(workInProgress, didChange) {
}
}
-function resetContext() {
- previousContext = emptyObject;
- contextStackCursor.current = emptyObject;
- didPerformWorkStackCursor.current = false;
-}
-
function findCurrentUnmaskedContext(fiber) {
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
// makes sense elsewhere
- !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ !(isFiberMounted(fiber) && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
var node = fiber;
- while (node.tag !== HostRoot) {
- if (isContextProvider(node)) {
- return node.stateNode.__reactInternalMemoizedMergedChildContext;
+ do {
+ switch (node.tag) {
+ case HostRoot:
+ return node.stateNode.context;
+ case ClassComponent:
+ {
+ var Component = node.type;
+ if (isContextProvider(Component)) {
+ return node.stateNode.__reactInternalMemoizedMergedChildContext;
+ }
+ break;
+ }
+ case ClassComponentLazy:
+ {
+ var _Component = getResultFromResolvedThenable(node.type);
+ if (isContextProvider(_Component)) {
+ return node.stateNode.__reactInternalMemoizedMergedChildContext;
+ }
+ break;
+ }
+ }
+ node = node.return;
+ } while (node !== null);
+ invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.');
+}
+
+var onCommitFiberRoot = null;
+var onCommitFiberUnmount = null;
+var hasLoggedError = false;
+
+function catchErrors(fn) {
+ return function (arg) {
+ try {
+ return fn(arg);
+ } catch (err) {
+ if (true && !hasLoggedError) {
+ hasLoggedError = true;
+ warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
+ }
}
- var parent = node['return'];
- !parent ? invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- node = parent;
+ };
+}
+
+var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
+
+function injectInternals(internals) {
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
+ // No DevTools
+ return false;
+ }
+ var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
+ if (hook.isDisabled) {
+ // This isn't a real property on the hook, but it can be set to opt out
+ // of DevTools integration and associated warnings and logs.
+ // https://github.com/facebook/react/issues/3877
+ return true;
+ }
+ if (!hook.supportsFiber) {
+ {
+ warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
+ }
+ // DevTools exists, even though it doesn't support Fiber.
+ return true;
}
- return node.stateNode.context;
+ try {
+ var rendererID = hook.inject(internals);
+ // We have successfully injected, so now it is safe to set up hooks.
+ onCommitFiberRoot = catchErrors(function (root) {
+ return hook.onCommitFiberRoot(rendererID, root);
+ });
+ onCommitFiberUnmount = catchErrors(function (fiber) {
+ return hook.onCommitFiberUnmount(rendererID, fiber);
+ });
+ } catch (err) {
+ // Catch all errors because it is unsafe to throw during initialization.
+ {
+ warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
+ }
+ }
+ // DevTools exists
+ return true;
}
-var NoWork = 0; // TODO: Use an opaque type once ESLint et al support the syntax
+function onCommitRoot(root) {
+ if (typeof onCommitFiberRoot === 'function') {
+ onCommitFiberRoot(root);
+ }
+}
+
+function onCommitUnmount(fiber) {
+ if (typeof onCommitFiberUnmount === 'function') {
+ onCommitFiberUnmount(fiber);
+ }
+}
+
+// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
+// Math.pow(2, 30) - 1
+// 0b111111111111111111111111111111
+var maxSigned31BitInt = 1073741823;
+var NoWork = 0;
var Sync = 1;
-var Never = 2147483647; // Max int32: Math.pow(2, 31) - 1
+var Never = maxSigned31BitInt;
var UNIT_SIZE = 10;
var MAGIC_NUMBER_OFFSET = 2;
@@ -5565,19 +9664,52 @@ function ceiling(num, precision) {
}
function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
- return ceiling(currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
+ return MAGIC_NUMBER_OFFSET + ceiling(currentTime - MAGIC_NUMBER_OFFSET + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
+}
+
+var LOW_PRIORITY_EXPIRATION = 5000;
+var LOW_PRIORITY_BATCH_SIZE = 250;
+
+function computeAsyncExpiration(currentTime) {
+ return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
+}
+
+// We intentionally set a higher expiration time for interactive updates in
+// dev than in production.
+//
+// If the main thread is being blocked so long that you hit the expiration,
+// it's a problem that could be solved with better scheduling.
+//
+// People will be more likely to notice this and fix it with the long
+// expiration time in development.
+//
+// In production we opt for better UX at the risk of masking scheduling
+// problems, by expiring fast.
+var HIGH_PRIORITY_EXPIRATION = 500;
+var HIGH_PRIORITY_BATCH_SIZE = 100;
+
+function computeInteractiveExpiration(currentTime) {
+ return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
}
var NoContext = 0;
-var AsyncUpdates = 1;
+var AsyncMode = 1;
+var StrictMode = 2;
+var ProfileMode = 4;
+
+var hasBadMapPolyfill = void 0;
{
- var hasBadMapPolyfill = false;
+ hasBadMapPolyfill = false;
try {
var nonExtensibleObject = Object.preventExtensions({});
- /* eslint-disable no-new */
-
- /* eslint-enable no-new */
+ var testMap = new Map([[nonExtensibleObject, null]]);
+ var testSet = new Set([nonExtensibleObject]);
+ // This is necessary for Rollup to not consider these unused.
+ // https://github.com/rollup/rollup/issues/1771
+ // TODO: we can remove these if Rollup fixes the bug.
+ testMap.set(0, 0);
+ testSet.add(0);
} catch (e) {
// TODO: Consider warning about bad polyfills
hasBadMapPolyfill = true;
@@ -5588,11 +9720,13 @@ var AsyncUpdates = 1;
// be more than one per component.
+var debugCounter = void 0;
+
{
- var debugCounter = 1;
+ debugCounter = 1;
}
-function FiberNode(tag, key, internalContextTag) {
+function FiberNode(tag, pendingProps, key, mode) {
// Instance
this.tag = tag;
this.key = key;
@@ -5600,19 +9734,20 @@ function FiberNode(tag, key, internalContextTag) {
this.stateNode = null;
// Fiber
- this['return'] = null;
+ this.return = null;
this.child = null;
this.sibling = null;
this.index = 0;
this.ref = null;
- this.pendingProps = null;
+ this.pendingProps = pendingProps;
this.memoizedProps = null;
this.updateQueue = null;
this.memoizedState = null;
+ this.firstContextDependency = null;
- this.internalContextTag = internalContextTag;
+ this.mode = mode;
// Effects
this.effectTag = NoEffect;
@@ -5622,9 +9757,17 @@ function FiberNode(tag, key, internalContextTag) {
this.lastEffect = null;
this.expirationTime = NoWork;
+ this.childExpirationTime = NoWork;
this.alternate = null;
+ if (enableProfilerTimer) {
+ this.actualDuration = 0;
+ this.actualStartTime = -1;
+ this.selfBaseDuration = 0;
+ this.treeBaseDuration = 0;
+ }
+
{
this._debugID = debugCounter++;
this._debugSource = null;
@@ -5649,13 +9792,23 @@ function FiberNode(tag, key, internalContextTag) {
// is faster.
// 5) It should be easy to port this to a C struct and keep a C implementation
// compatible.
-var createFiber = function (tag, key, internalContextTag) {
+var createFiber = function (tag, pendingProps, key, mode) {
// $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
- return new FiberNode(tag, key, internalContextTag);
+ return new FiberNode(tag, pendingProps, key, mode);
};
function shouldConstruct(Component) {
- return !!(Component.prototype && Component.prototype.isReactComponent);
+ var prototype = Component.prototype;
+ return !!(prototype && prototype.isReactComponent);
+}
+
+function resolveLazyComponentTag(fiber, Component) {
+ if (typeof Component === 'function') {
+ return shouldConstruct(Component) ? ClassComponentLazy : FunctionalComponentLazy;
+ } else if (Component !== undefined && Component !== null && Component.$$typeof) {
+ return ForwardRefLazy;
+ }
+ return IndeterminateComponent;
}
// This is used to create an alternate fiber to do work on.
@@ -5667,7 +9820,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
// node that we're free to reuse. This is lazily created to avoid allocating
// extra objects for things that are never updated. It also allow us to
// reclaim the extra memory if needed.
- workInProgress = createFiber(current.tag, current.key, current.internalContextTag);
+ workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
workInProgress.type = current.type;
workInProgress.stateNode = current.stateNode;
@@ -5681,6 +9834,8 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
workInProgress.alternate = current;
current.alternate = workInProgress;
} else {
+ workInProgress.pendingProps = pendingProps;
+
// We already have an alternate.
// Reset the effect tag.
workInProgress.effectTag = NoEffect;
@@ -5689,117 +9844,177 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
workInProgress.nextEffect = null;
workInProgress.firstEffect = null;
workInProgress.lastEffect = null;
+
+ if (enableProfilerTimer) {
+ // We intentionally reset, rather than copy, actualDuration & actualStartTime.
+ // This prevents time from endlessly accumulating in new commits.
+ // This has the downside of resetting values for different priority renders,
+ // But works for yielding (the common case) and should support resuming.
+ workInProgress.actualDuration = 0;
+ workInProgress.actualStartTime = -1;
+ }
}
- workInProgress.expirationTime = expirationTime;
- workInProgress.pendingProps = pendingProps;
+ // Don't touching the subtree's expiration time, which has not changed.
+ workInProgress.childExpirationTime = current.childExpirationTime;
+ if (pendingProps !== current.pendingProps) {
+ // This fiber has new props.
+ workInProgress.expirationTime = expirationTime;
+ } else {
+ // This fiber's props have not changed.
+ workInProgress.expirationTime = current.expirationTime;
+ }
workInProgress.child = current.child;
workInProgress.memoizedProps = current.memoizedProps;
workInProgress.memoizedState = current.memoizedState;
workInProgress.updateQueue = current.updateQueue;
+ workInProgress.firstContextDependency = current.firstContextDependency;
// These will be overridden during the parent's reconciliation
workInProgress.sibling = current.sibling;
workInProgress.index = current.index;
workInProgress.ref = current.ref;
+ if (enableProfilerTimer) {
+ workInProgress.selfBaseDuration = current.selfBaseDuration;
+ workInProgress.treeBaseDuration = current.treeBaseDuration;
+ }
+
return workInProgress;
}
-function createHostRootFiber() {
- var fiber = createFiber(HostRoot, null, NoContext);
- return fiber;
+function createHostRootFiber(isAsync) {
+ var mode = isAsync ? AsyncMode | StrictMode : NoContext;
+
+ if (enableProfilerTimer && isDevToolsPresent) {
+ // Always collect profile timings when DevTools are present.
+ // This enables DevTools to start capturing timing at any point–
+ // Without some nodes in the tree having empty base times.
+ mode |= ProfileMode;
+ }
+
+ return createFiber(HostRoot, null, null, mode);
}
-function createFiberFromElement(element, internalContextTag, expirationTime) {
+function createFiberFromElement(element, mode, expirationTime) {
var owner = null;
{
owner = element._owner;
}
var fiber = void 0;
- var type = element.type,
- key = element.key;
+ var type = element.type;
+ var key = element.key;
+ var pendingProps = element.props;
+ var fiberTag = void 0;
if (typeof type === 'function') {
- fiber = shouldConstruct(type) ? createFiber(ClassComponent, key, internalContextTag) : createFiber(IndeterminateComponent, key, internalContextTag);
- fiber.type = type;
- fiber.pendingProps = element.props;
+ fiberTag = shouldConstruct(type) ? ClassComponent : IndeterminateComponent;
} else if (typeof type === 'string') {
- fiber = createFiber(HostComponent, key, internalContextTag);
- fiber.type = type;
- fiber.pendingProps = element.props;
- } else if (typeof type === 'object' && type !== null && typeof type.tag === 'number') {
- // Currently assumed to be a continuation and therefore is a fiber already.
- // TODO: The yield system is currently broken for updates in some cases.
- // The reified yield stores a fiber, but we don't know which fiber that is;
- // the current or a workInProgress? When the continuation gets rendered here
- // we don't know if we can reuse that fiber or if we need to clone it.
- // There is probably a clever way to restructure this.
- fiber = type;
- fiber.pendingProps = element.props;
+ fiberTag = HostComponent;
} else {
- var info = '';
- {
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
- 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.";
- }
- var ownerName = owner ? getComponentName(owner) : null;
- if (ownerName) {
- info += '\n\nCheck the render method of `' + ownerName + '`.';
- }
+ getTag: switch (type) {
+ case REACT_FRAGMENT_TYPE:
+ return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
+ case REACT_ASYNC_MODE_TYPE:
+ fiberTag = Mode;
+ mode |= AsyncMode | StrictMode;
+ break;
+ case REACT_STRICT_MODE_TYPE:
+ fiberTag = Mode;
+ mode |= StrictMode;
+ break;
+ case REACT_PROFILER_TYPE:
+ return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
+ case REACT_PLACEHOLDER_TYPE:
+ fiberTag = PlaceholderComponent;
+ break;
+ default:
+ {
+ if (typeof type === 'object' && type !== null) {
+ switch (type.$$typeof) {
+ case REACT_PROVIDER_TYPE:
+ fiberTag = ContextProvider;
+ break getTag;
+ case REACT_CONTEXT_TYPE:
+ // This is a consumer
+ fiberTag = ContextConsumer;
+ break getTag;
+ case REACT_FORWARD_REF_TYPE:
+ fiberTag = ForwardRef;
+ break getTag;
+ default:
+ {
+ if (typeof type.then === 'function') {
+ fiberTag = IndeterminateComponent;
+ break getTag;
+ }
+ }
+ }
+ }
+ var info = '';
+ {
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
+ 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.';
+ }
+ var ownerName = owner ? getComponentName(owner.type) : null;
+ if (ownerName) {
+ info += '\n\nCheck the render method of `' + ownerName + '`.';
+ }
+ }
+ invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info);
+ }
}
- invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info);
}
+ fiber = createFiber(fiberTag, pendingProps, key, mode);
+ fiber.type = type;
+ fiber.expirationTime = expirationTime;
+
{
fiber._debugSource = element._source;
fiber._debugOwner = element._owner;
}
- fiber.expirationTime = expirationTime;
-
return fiber;
}
-function createFiberFromFragment(elements, internalContextTag, expirationTime, key) {
- var fiber = createFiber(Fragment, key, internalContextTag);
- fiber.pendingProps = elements;
+function createFiberFromFragment(elements, mode, expirationTime, key) {
+ var fiber = createFiber(Fragment, elements, key, mode);
fiber.expirationTime = expirationTime;
return fiber;
}
-function createFiberFromText(content, internalContextTag, expirationTime) {
- var fiber = createFiber(HostText, null, internalContextTag);
- fiber.pendingProps = content;
+function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
+ {
+ if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
+ warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
+ }
+ }
+
+ var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
+ fiber.type = REACT_PROFILER_TYPE;
fiber.expirationTime = expirationTime;
- return fiber;
-}
-function createFiberFromHostInstanceForDeletion() {
- var fiber = createFiber(HostComponent, null, NoContext);
- fiber.type = 'DELETED';
return fiber;
}
-function createFiberFromCall(call, internalContextTag, expirationTime) {
- var fiber = createFiber(CallComponent, call.key, internalContextTag);
- fiber.type = call.handler;
- fiber.pendingProps = call;
+function createFiberFromText(content, mode, expirationTime) {
+ var fiber = createFiber(HostText, content, null, mode);
fiber.expirationTime = expirationTime;
return fiber;
}
-function createFiberFromReturn(returnNode, internalContextTag, expirationTime) {
- var fiber = createFiber(ReturnComponent, null, internalContextTag);
- fiber.expirationTime = expirationTime;
+function createFiberFromHostInstanceForDeletion() {
+ var fiber = createFiber(HostComponent, null, null, NoContext);
+ fiber.type = 'DELETED';
return fiber;
}
-function createFiberFromPortal(portal, internalContextTag, expirationTime) {
- var fiber = createFiber(HostPortal, portal.key, internalContextTag);
- fiber.pendingProps = portal.children || [];
+function createFiberFromPortal(portal, mode, expirationTime) {
+ var pendingProps = portal.children !== null ? portal.children : [];
+ var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
fiber.expirationTime = expirationTime;
fiber.stateNode = {
containerInfo: portal.containerInfo,
@@ -5809,369 +10024,1542 @@ function createFiberFromPortal(portal, internalContextTag, expirationTime) {
return fiber;
}
-function createFiberRoot(containerInfo, hydrate) {
+// Used for stashing WIP properties to replay failed work in DEV.
+function assignFiberPropertiesInDEV(target, source) {
+ if (target === null) {
+ // This Fiber's initial properties will always be overwritten.
+ // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
+ target = createFiber(IndeterminateComponent, null, null, NoContext);
+ }
+
+ // This is intentionally written as a list of all properties.
+ // We tried to use Object.assign() instead but this is called in
+ // the hottest path, and Object.assign() was too slow:
+ // https://github.com/facebook/react/issues/12502
+ // This code is DEV-only so size is not a concern.
+
+ target.tag = source.tag;
+ target.key = source.key;
+ target.type = source.type;
+ target.stateNode = source.stateNode;
+ target.return = source.return;
+ target.child = source.child;
+ target.sibling = source.sibling;
+ target.index = source.index;
+ target.ref = source.ref;
+ target.pendingProps = source.pendingProps;
+ target.memoizedProps = source.memoizedProps;
+ target.updateQueue = source.updateQueue;
+ target.memoizedState = source.memoizedState;
+ target.firstContextDependency = source.firstContextDependency;
+ target.mode = source.mode;
+ target.effectTag = source.effectTag;
+ target.nextEffect = source.nextEffect;
+ target.firstEffect = source.firstEffect;
+ target.lastEffect = source.lastEffect;
+ target.expirationTime = source.expirationTime;
+ target.childExpirationTime = source.childExpirationTime;
+ target.alternate = source.alternate;
+ if (enableProfilerTimer) {
+ target.actualDuration = source.actualDuration;
+ target.actualStartTime = source.actualStartTime;
+ target.selfBaseDuration = source.selfBaseDuration;
+ target.treeBaseDuration = source.treeBaseDuration;
+ }
+ target._debugID = source._debugID;
+ target._debugSource = source._debugSource;
+ target._debugOwner = source._debugOwner;
+ target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
+ return target;
+}
+
+/* eslint-disable no-use-before-define */
+// TODO: This should be lifted into the renderer.
+
+
+// The following attributes are only used by interaction tracing builds.
+// They enable interactions to be associated with their async work,
+// And expose interaction metadata to the React DevTools Profiler plugin.
+// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
+
+
+// Exported FiberRoot type includes all properties,
+// To avoid requiring potentially error-prone :any casts throughout the project.
+// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
+// The types are defined separately within this file to ensure they stay in sync.
+// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
+
+/* eslint-enable no-use-before-define */
+
+function createFiberRoot(containerInfo, isAsync, hydrate) {
// Cyclic construction. This cheats the type system right now because
// stateNode is any.
- var uninitializedFiber = createHostRootFiber();
- var root = {
- current: uninitializedFiber,
- containerInfo: containerInfo,
- pendingChildren: null,
- remainingExpirationTime: NoWork,
- isReadyForCommit: false,
- finishedWork: null,
- context: null,
- pendingContext: null,
- hydrate: hydrate,
- nextScheduledRoot: null
- };
+ var uninitializedFiber = createHostRootFiber(isAsync);
+
+ var root = void 0;
+ if (enableSchedulerTracing) {
+ root = {
+ current: uninitializedFiber,
+ containerInfo: containerInfo,
+ pendingChildren: null,
+
+ earliestPendingTime: NoWork,
+ latestPendingTime: NoWork,
+ earliestSuspendedTime: NoWork,
+ latestSuspendedTime: NoWork,
+ latestPingedTime: NoWork,
+
+ didError: false,
+
+ pendingCommitExpirationTime: NoWork,
+ finishedWork: null,
+ timeoutHandle: noTimeout,
+ context: null,
+ pendingContext: null,
+ hydrate: hydrate,
+ nextExpirationTimeToWorkOn: NoWork,
+ expirationTime: NoWork,
+ firstBatch: null,
+ nextScheduledRoot: null,
+
+ interactionThreadID: tracing.unstable_getThreadID(),
+ memoizedInteractions: new Set(),
+ pendingInteractionMap: new Map()
+ };
+ } else {
+ root = {
+ current: uninitializedFiber,
+ containerInfo: containerInfo,
+ pendingChildren: null,
+
+ earliestPendingTime: NoWork,
+ latestPendingTime: NoWork,
+ earliestSuspendedTime: NoWork,
+ latestSuspendedTime: NoWork,
+ latestPingedTime: NoWork,
+
+ didError: false,
+
+ pendingCommitExpirationTime: NoWork,
+ finishedWork: null,
+ timeoutHandle: noTimeout,
+ context: null,
+ pendingContext: null,
+ hydrate: hydrate,
+ nextExpirationTimeToWorkOn: NoWork,
+ expirationTime: NoWork,
+ firstBatch: null,
+ nextScheduledRoot: null
+ };
+ }
+
uninitializedFiber.stateNode = root;
+
+ // The reason for the way the Flow types are structured in this file,
+ // Is to avoid needing :any casts everywhere interaction tracing fields are used.
+ // Unfortunately that requires an :any cast for non-interaction tracing capable builds.
+ // $FlowFixMe Remove this :any cast and replace it with something better.
return root;
}
-var onCommitFiberRoot = null;
-var onCommitFiberUnmount = null;
-var hasLoggedError = false;
+/**
+ * Forked from fbjs/warning:
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
+ *
+ * Only change is we use console.warn instead of console.error,
+ * and do nothing when 'console' is not supported.
+ * This really simplifies the code.
+ * ---
+ * Similar to invariant but only logs a warning if the condition is not met.
+ * This can be used to log issues in development environments in critical
+ * paths. Removing the logging code for production environments will keep the
+ * same logic and follow the same code paths.
+ */
-function catchErrors(fn) {
- return function (arg) {
+var lowPriorityWarning = function () {};
+
+{
+ var printWarning = function (format) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var argIndex = 0;
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.warn(message);
+ }
try {
- return fn(arg);
- } catch (err) {
- if (true && !hasLoggedError) {
- hasLoggedError = true;
- warning(false, 'React DevTools encountered an error: %s', err);
+ // --- Welcome to debugging React ---
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ } catch (x) {}
+ };
+
+ lowPriorityWarning = function (condition, format) {
+ if (format === undefined) {
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
+ }
+ if (!condition) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
}
+
+ printWarning.apply(undefined, [format].concat(args));
}
};
}
-function injectInternals(internals) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
- // No DevTools
- return false;
+var lowPriorityWarning$1 = lowPriorityWarning;
+
+var ReactStrictModeWarnings = {
+ discardPendingWarnings: function () {},
+ flushPendingDeprecationWarnings: function () {},
+ flushPendingUnsafeLifecycleWarnings: function () {},
+ recordDeprecationWarnings: function (fiber, instance) {},
+ recordUnsafeLifecycleWarnings: function (fiber, instance) {},
+ recordLegacyContextWarning: function (fiber, instance) {},
+ flushLegacyContextWarning: function () {}
+};
+
+{
+ var LIFECYCLE_SUGGESTIONS = {
+ UNSAFE_componentWillMount: 'componentDidMount',
+ UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps',
+ UNSAFE_componentWillUpdate: 'componentDidUpdate'
+ };
+
+ var pendingComponentWillMountWarnings = [];
+ var pendingComponentWillReceivePropsWarnings = [];
+ var pendingComponentWillUpdateWarnings = [];
+ var pendingUnsafeLifecycleWarnings = new Map();
+ var pendingLegacyContextWarning = new Map();
+
+ // Tracks components we have already warned about.
+ var didWarnAboutDeprecatedLifecycles = new Set();
+ var didWarnAboutUnsafeLifecycles = new Set();
+ var didWarnAboutLegacyContext = new Set();
+
+ var setToSortedString = function (set) {
+ var array = [];
+ set.forEach(function (value) {
+ array.push(value);
+ });
+ return array.sort().join(', ');
+ };
+
+ ReactStrictModeWarnings.discardPendingWarnings = function () {
+ pendingComponentWillMountWarnings = [];
+ pendingComponentWillReceivePropsWarnings = [];
+ pendingComponentWillUpdateWarnings = [];
+ pendingUnsafeLifecycleWarnings = new Map();
+ pendingLegacyContextWarning = new Map();
+ };
+
+ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
+ pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) {
+ var lifecyclesWarningMesages = [];
+
+ Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) {
+ var lifecycleWarnings = lifecycleWarningsMap[lifecycle];
+ if (lifecycleWarnings.length > 0) {
+ var componentNames = new Set();
+ lifecycleWarnings.forEach(function (fiber) {
+ componentNames.add(getComponentName(fiber.type) || 'Component');
+ didWarnAboutUnsafeLifecycles.add(fiber.type);
+ });
+
+ var formatted = lifecycle.replace('UNSAFE_', '');
+ var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
+ var sortedComponentNames = setToSortedString(componentNames);
+
+ lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
+ }
+ });
+
+ if (lifecyclesWarningMesages.length > 0) {
+ var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
+
+ warningWithoutStack$1(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMesages.join('\n\n'));
+ }
+ });
+
+ pendingUnsafeLifecycleWarnings = new Map();
+ };
+
+ var findStrictRoot = function (fiber) {
+ var maybeStrictRoot = null;
+
+ var node = fiber;
+ while (node !== null) {
+ if (node.mode & StrictMode) {
+ maybeStrictRoot = node;
+ }
+ node = node.return;
+ }
+
+ return maybeStrictRoot;
+ };
+
+ ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () {
+ if (pendingComponentWillMountWarnings.length > 0) {
+ var uniqueNames = new Set();
+ pendingComponentWillMountWarnings.forEach(function (fiber) {
+ uniqueNames.add(getComponentName(fiber.type) || 'Component');
+ didWarnAboutDeprecatedLifecycles.add(fiber.type);
+ });
+
+ var sortedNames = setToSortedString(uniqueNames);
+
+ lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames);
+
+ pendingComponentWillMountWarnings = [];
+ }
+
+ if (pendingComponentWillReceivePropsWarnings.length > 0) {
+ var _uniqueNames = new Set();
+ pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
+ _uniqueNames.add(getComponentName(fiber.type) || 'Component');
+ didWarnAboutDeprecatedLifecycles.add(fiber.type);
+ });
+
+ var _sortedNames = setToSortedString(_uniqueNames);
+
+ lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames);
+
+ pendingComponentWillReceivePropsWarnings = [];
+ }
+
+ if (pendingComponentWillUpdateWarnings.length > 0) {
+ var _uniqueNames2 = new Set();
+ pendingComponentWillUpdateWarnings.forEach(function (fiber) {
+ _uniqueNames2.add(getComponentName(fiber.type) || 'Component');
+ didWarnAboutDeprecatedLifecycles.add(fiber.type);
+ });
+
+ var _sortedNames2 = setToSortedString(_uniqueNames2);
+
+ lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2);
+
+ pendingComponentWillUpdateWarnings = [];
+ }
+ };
+
+ ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) {
+ // Dedup strategy: Warn once per component.
+ if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) {
+ return;
+ }
+
+ // Don't warn about react-lifecycles-compat polyfilled components.
+ if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
+ pendingComponentWillMountWarnings.push(fiber);
+ }
+ if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
+ pendingComponentWillReceivePropsWarnings.push(fiber);
+ }
+ if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
+ pendingComponentWillUpdateWarnings.push(fiber);
+ }
+ };
+
+ ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
+ var strictRoot = findStrictRoot(fiber);
+ if (strictRoot === null) {
+ warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
+ return;
+ }
+
+ // Dedup strategy: Warn once per component.
+ // This is difficult to track any other way since component names
+ // are often vague and are likely to collide between 3rd party libraries.
+ // An expand property is probably okay to use here since it's DEV-only,
+ // and will only be set in the event of serious warnings.
+ if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
+ return;
+ }
+
+ var warningsForRoot = void 0;
+ if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) {
+ warningsForRoot = {
+ UNSAFE_componentWillMount: [],
+ UNSAFE_componentWillReceiveProps: [],
+ UNSAFE_componentWillUpdate: []
+ };
+
+ pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot);
+ } else {
+ warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot);
+ }
+
+ var unsafeLifecycles = [];
+ if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillMount === 'function') {
+ unsafeLifecycles.push('UNSAFE_componentWillMount');
+ }
+ if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
+ unsafeLifecycles.push('UNSAFE_componentWillReceiveProps');
+ }
+ if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillUpdate === 'function') {
+ unsafeLifecycles.push('UNSAFE_componentWillUpdate');
+ }
+
+ if (unsafeLifecycles.length > 0) {
+ unsafeLifecycles.forEach(function (lifecycle) {
+ warningsForRoot[lifecycle].push(fiber);
+ });
+ }
+ };
+
+ ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
+ var strictRoot = findStrictRoot(fiber);
+ if (strictRoot === null) {
+ warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
+ return;
+ }
+
+ // Dedup strategy: Warn once per component.
+ if (didWarnAboutLegacyContext.has(fiber.type)) {
+ return;
+ }
+
+ var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
+
+ if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
+ if (warningsForRoot === undefined) {
+ warningsForRoot = [];
+ pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
+ }
+ warningsForRoot.push(fiber);
+ }
+ };
+
+ ReactStrictModeWarnings.flushLegacyContextWarning = function () {
+ pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
+ var uniqueNames = new Set();
+ fiberArray.forEach(function (fiber) {
+ uniqueNames.add(getComponentName(fiber.type) || 'Component');
+ didWarnAboutLegacyContext.add(fiber.type);
+ });
+
+ var sortedNames = setToSortedString(uniqueNames);
+ var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
+
+ warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, sortedNames);
+ });
+ };
+}
+
+// This lets us hook into Fiber to debug what it's doing.
+// See https://github.com/facebook/react/pull/8033.
+// This is not part of the public API, not even for React DevTools.
+// You may only inject a debugTool if you work on React Fiber itself.
+var ReactFiberInstrumentation = {
+ debugTool: null
+};
+
+var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
+
+// TODO: Offscreen updates should never suspend. However, a promise that
+// suspended inside an offscreen subtree should be able to ping at the priority
+// of the outer render.
+
+function markPendingPriorityLevel(root, expirationTime) {
+ // If there's a gap between completing a failed root and retrying it,
+ // additional updates may be scheduled. Clear `didError`, in case the update
+ // is sufficient to fix the error.
+ root.didError = false;
+
+ // Update the latest and earliest pending times
+ var earliestPendingTime = root.earliestPendingTime;
+ if (earliestPendingTime === NoWork) {
+ // No other pending updates.
+ root.earliestPendingTime = root.latestPendingTime = expirationTime;
+ } else {
+ if (earliestPendingTime > expirationTime) {
+ // This is the earliest pending update.
+ root.earliestPendingTime = expirationTime;
+ } else {
+ var latestPendingTime = root.latestPendingTime;
+ if (latestPendingTime < expirationTime) {
+ // This is the latest pending update
+ root.latestPendingTime = expirationTime;
+ }
+ }
}
- var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
- if (hook.isDisabled) {
- // This isn't a real property on the hook, but it can be set to opt out
- // of DevTools integration and associated warnings and logs.
- // https://github.com/facebook/react/issues/3877
- return true;
+ findNextExpirationTimeToWorkOn(expirationTime, root);
+}
+
+function markCommittedPriorityLevels(root, earliestRemainingTime) {
+ root.didError = false;
+
+ if (earliestRemainingTime === NoWork) {
+ // Fast path. There's no remaining work. Clear everything.
+ root.earliestPendingTime = NoWork;
+ root.latestPendingTime = NoWork;
+ root.earliestSuspendedTime = NoWork;
+ root.latestSuspendedTime = NoWork;
+ root.latestPingedTime = NoWork;
+ findNextExpirationTimeToWorkOn(NoWork, root);
+ return;
}
- if (!hook.supportsFiber) {
- {
- warning(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
+
+ // Let's see if the previous latest known pending level was just flushed.
+ var latestPendingTime = root.latestPendingTime;
+ if (latestPendingTime !== NoWork) {
+ if (latestPendingTime < earliestRemainingTime) {
+ // We've flushed all the known pending levels.
+ root.earliestPendingTime = root.latestPendingTime = NoWork;
+ } else {
+ var earliestPendingTime = root.earliestPendingTime;
+ if (earliestPendingTime < earliestRemainingTime) {
+ // We've flushed the earliest known pending level. Set this to the
+ // latest pending time.
+ root.earliestPendingTime = root.latestPendingTime;
+ }
}
- // DevTools exists, even though it doesn't support Fiber.
- return true;
}
- try {
- var rendererID = hook.inject(internals);
- // We have successfully injected, so now it is safe to set up hooks.
- onCommitFiberRoot = catchErrors(function (root) {
- return hook.onCommitFiberRoot(rendererID, root);
- });
- onCommitFiberUnmount = catchErrors(function (fiber) {
- return hook.onCommitFiberUnmount(rendererID, fiber);
- });
- } catch (err) {
- // Catch all errors because it is unsafe to throw during initialization.
- {
- warning(false, 'React DevTools encountered an error: %s.', err);
+
+ // Now let's handle the earliest remaining level in the whole tree. We need to
+ // decide whether to treat it as a pending level or as suspended. Check
+ // it falls within the range of known suspended levels.
+
+ var earliestSuspendedTime = root.earliestSuspendedTime;
+ if (earliestSuspendedTime === NoWork) {
+ // There's no suspended work. Treat the earliest remaining level as a
+ // pending level.
+ markPendingPriorityLevel(root, earliestRemainingTime);
+ findNextExpirationTimeToWorkOn(NoWork, root);
+ return;
+ }
+
+ var latestSuspendedTime = root.latestSuspendedTime;
+ if (earliestRemainingTime > latestSuspendedTime) {
+ // The earliest remaining level is later than all the suspended work. That
+ // means we've flushed all the suspended work.
+ root.earliestSuspendedTime = NoWork;
+ root.latestSuspendedTime = NoWork;
+ root.latestPingedTime = NoWork;
+
+ // There's no suspended work. Treat the earliest remaining level as a
+ // pending level.
+ markPendingPriorityLevel(root, earliestRemainingTime);
+ findNextExpirationTimeToWorkOn(NoWork, root);
+ return;
+ }
+
+ if (earliestRemainingTime < earliestSuspendedTime) {
+ // The earliest remaining time is earlier than all the suspended work.
+ // Treat it as a pending update.
+ markPendingPriorityLevel(root, earliestRemainingTime);
+ findNextExpirationTimeToWorkOn(NoWork, root);
+ return;
+ }
+
+ // The earliest remaining time falls within the range of known suspended
+ // levels. We should treat this as suspended work.
+ findNextExpirationTimeToWorkOn(NoWork, root);
+}
+
+function hasLowerPriorityWork(root, erroredExpirationTime) {
+ var latestPendingTime = root.latestPendingTime;
+ var latestSuspendedTime = root.latestSuspendedTime;
+ var latestPingedTime = root.latestPingedTime;
+ return latestPendingTime !== NoWork && latestPendingTime > erroredExpirationTime || latestSuspendedTime !== NoWork && latestSuspendedTime > erroredExpirationTime || latestPingedTime !== NoWork && latestPingedTime > erroredExpirationTime;
+}
+
+function isPriorityLevelSuspended(root, expirationTime) {
+ var earliestSuspendedTime = root.earliestSuspendedTime;
+ var latestSuspendedTime = root.latestSuspendedTime;
+ return earliestSuspendedTime !== NoWork && expirationTime >= earliestSuspendedTime && expirationTime <= latestSuspendedTime;
+}
+
+function markSuspendedPriorityLevel(root, suspendedTime) {
+ root.didError = false;
+ clearPing(root, suspendedTime);
+
+ // First, check the known pending levels and update them if needed.
+ var earliestPendingTime = root.earliestPendingTime;
+ var latestPendingTime = root.latestPendingTime;
+ if (earliestPendingTime === suspendedTime) {
+ if (latestPendingTime === suspendedTime) {
+ // Both known pending levels were suspended. Clear them.
+ root.earliestPendingTime = root.latestPendingTime = NoWork;
+ } else {
+ // The earliest pending level was suspended. Clear by setting it to the
+ // latest pending level.
+ root.earliestPendingTime = latestPendingTime;
+ }
+ } else if (latestPendingTime === suspendedTime) {
+ // The latest pending level was suspended. Clear by setting it to the
+ // latest pending level.
+ root.latestPendingTime = earliestPendingTime;
+ }
+
+ // Finally, update the known suspended levels.
+ var earliestSuspendedTime = root.earliestSuspendedTime;
+ var latestSuspendedTime = root.latestSuspendedTime;
+ if (earliestSuspendedTime === NoWork) {
+ // No other suspended levels.
+ root.earliestSuspendedTime = root.latestSuspendedTime = suspendedTime;
+ } else {
+ if (earliestSuspendedTime > suspendedTime) {
+ // This is the earliest suspended level.
+ root.earliestSuspendedTime = suspendedTime;
+ } else if (latestSuspendedTime < suspendedTime) {
+ // This is the latest suspended level
+ root.latestSuspendedTime = suspendedTime;
}
}
- // DevTools exists
- return true;
+
+ findNextExpirationTimeToWorkOn(suspendedTime, root);
}
-function onCommitRoot(root) {
- if (typeof onCommitFiberRoot === 'function') {
- onCommitFiberRoot(root);
+function markPingedPriorityLevel(root, pingedTime) {
+ root.didError = false;
+
+ // TODO: When we add back resuming, we need to ensure the progressed work
+ // is thrown out and not reused during the restarted render. One way to
+ // invalidate the progressed work is to restart at expirationTime + 1.
+ var latestPingedTime = root.latestPingedTime;
+ if (latestPingedTime === NoWork || latestPingedTime < pingedTime) {
+ root.latestPingedTime = pingedTime;
}
+ findNextExpirationTimeToWorkOn(pingedTime, root);
}
-function onCommitUnmount(fiber) {
- if (typeof onCommitFiberUnmount === 'function') {
- onCommitFiberUnmount(fiber);
+function clearPing(root, completedTime) {
+ // TODO: Track whether the root was pinged during the render phase. If so,
+ // we need to make sure we don't lose track of it.
+ var latestPingedTime = root.latestPingedTime;
+ if (latestPingedTime !== NoWork && latestPingedTime <= completedTime) {
+ root.latestPingedTime = NoWork;
}
}
-{
- var didWarnUpdateInsideUpdate = false;
+function findEarliestOutstandingPriorityLevel(root, renderExpirationTime) {
+ var earliestExpirationTime = renderExpirationTime;
+
+ var earliestPendingTime = root.earliestPendingTime;
+ var earliestSuspendedTime = root.earliestSuspendedTime;
+ if (earliestExpirationTime === NoWork || earliestPendingTime !== NoWork && earliestPendingTime < earliestExpirationTime) {
+ earliestExpirationTime = earliestPendingTime;
+ }
+ if (earliestExpirationTime === NoWork || earliestSuspendedTime !== NoWork && earliestSuspendedTime < earliestExpirationTime) {
+ earliestExpirationTime = earliestSuspendedTime;
+ }
+ return earliestExpirationTime;
}
-// Callbacks are not validated until invocation
+function didExpireAtExpirationTime(root, currentTime) {
+ var expirationTime = root.expirationTime;
+ if (expirationTime !== NoWork && currentTime >= expirationTime) {
+ // The root has expired. Flush all work up to the current time.
+ root.nextExpirationTimeToWorkOn = currentTime;
+ }
+}
+
+function findNextExpirationTimeToWorkOn(completedExpirationTime, root) {
+ var earliestSuspendedTime = root.earliestSuspendedTime;
+ var latestSuspendedTime = root.latestSuspendedTime;
+ var earliestPendingTime = root.earliestPendingTime;
+ var latestPingedTime = root.latestPingedTime;
+
+ // Work on the earliest pending time. Failing that, work on the latest
+ // pinged time.
+ var nextExpirationTimeToWorkOn = earliestPendingTime !== NoWork ? earliestPendingTime : latestPingedTime;
+
+ // If there is no pending or pinged work, check if there's suspended work
+ // that's lower priority than what we just completed.
+ if (nextExpirationTimeToWorkOn === NoWork && (completedExpirationTime === NoWork || latestSuspendedTime > completedExpirationTime)) {
+ // The lowest priority suspended work is the work most likely to be
+ // committed next. Let's start rendering it again, so that if it times out,
+ // it's ready to commit.
+ nextExpirationTimeToWorkOn = latestSuspendedTime;
+ }
+ var expirationTime = nextExpirationTimeToWorkOn;
+ if (expirationTime !== NoWork && earliestSuspendedTime !== NoWork && earliestSuspendedTime < expirationTime) {
+ // Expire using the earliest known expiration time.
+ expirationTime = earliestSuspendedTime;
+ }
-// Singly linked-list of updates. When an update is scheduled, it is added to
-// the queue of the current fiber and the work-in-progress fiber. The two queues
-// are separate but they share a persistent structure.
+ root.nextExpirationTimeToWorkOn = nextExpirationTimeToWorkOn;
+ root.expirationTime = expirationTime;
+}
+
+// UpdateQueue is a linked list of prioritized updates.
//
-// During reconciliation, updates are removed from the work-in-progress fiber,
-// but they remain on the current fiber. That ensures that if a work-in-progress
-// is aborted, the aborted updates are recovered by cloning from current.
+// Like fibers, update queues come in pairs: a current queue, which represents
+// the visible state of the screen, and a work-in-progress queue, which is
+// can be mutated and processed asynchronously before it is committed — a form
+// of double buffering. If a work-in-progress render is discarded before
+// finishing, we create a new work-in-progress by cloning the current queue.
//
-// The work-in-progress queue is always a subset of the current queue.
+// Both queues share a persistent, singly-linked list structure. To schedule an
+// update, we append it to the end of both queues. Each queue maintains a
+// pointer to first update in the persistent list that hasn't been processed.
+// The work-in-progress pointer always has a position equal to or greater than
+// the current queue, since we always work on that one. The current queue's
+// pointer is only updated during the commit phase, when we swap in the
+// work-in-progress.
//
-// When the tree is committed, the work-in-progress becomes the current.
-
+// For example:
+//
+// Current pointer: A - B - C - D - E - F
+// Work-in-progress pointer: D - E - F
+// ^
+// The work-in-progress queue has
+// processed more updates than current.
+//
+// The reason we append to both queues is because otherwise we might drop
+// updates without ever processing them. For example, if we only add updates to
+// the work-in-progress queue, some updates could be lost whenever a work-in
+// -progress render restarts by cloning from current. Similarly, if we only add
+// updates to the current queue, the updates will be lost whenever an already
+// in-progress queue commits and swaps with the current queue. However, by
+// adding to both queues, we guarantee that the update will be part of the next
+// work-in-progress. (And because the work-in-progress queue becomes the
+// current queue once it commits, there's no danger of applying the same
+// update twice.)
+//
+// Prioritization
+// --------------
+//
+// Updates are not sorted by priority, but by insertion; new updates are always
+// appended to the end of the list.
+//
+// The priority is still important, though. When processing the update queue
+// during the render phase, only the updates with sufficient priority are
+// included in the result. If we skip an update because it has insufficient
+// priority, it remains in the queue to be processed later, during a lower
+// priority render. Crucially, all updates subsequent to a skipped update also
+// remain in the queue *regardless of their priority*. That means high priority
+// updates are sometimes processed twice, at two separate priorities. We also
+// keep track of a base state, that represents the state before the first
+// update in the queue is applied.
+//
+// For example:
+//
+// Given a base state of '', and the following queue of updates
+//
+// A1 - B2 - C1 - D2
+//
+// where the number indicates the priority, and the update is applied to the
+// previous state by appending a letter, React will process these updates as
+// two separate renders, one per distinct priority level:
+//
+// First render, at priority 1:
+// Base state: ''
+// Updates: [A1, C1]
+// Result state: 'AC'
+//
+// Second render, at priority 2:
+// Base state: 'A' <- The base state does not include C1,
+// because B2 was skipped.
+// Updates: [B2, C1, D2] <- C1 was rebased on top of B2
+// Result state: 'ABCD'
+//
+// Because we process updates in insertion order, and rebase high priority
+// updates when preceding updates are skipped, the final result is deterministic
+// regardless of priority. Intermediate state may vary according to system
+// resources, but the final state is always the same.
+
+var UpdateState = 0;
+var ReplaceState = 1;
+var ForceUpdate = 2;
+var CaptureUpdate = 3;
+
+// Global state that is reset at the beginning of calling `processUpdateQueue`.
+// It should only be read right after calling `processUpdateQueue`, via
+// `checkHasForceUpdateAfterProcessing`.
+var hasForceUpdate = false;
+
+var didWarnUpdateInsideUpdate = void 0;
+var currentlyProcessingQueue = void 0;
+var resetCurrentlyProcessingQueue = void 0;
+{
+ didWarnUpdateInsideUpdate = false;
+ currentlyProcessingQueue = null;
+ resetCurrentlyProcessingQueue = function () {
+ currentlyProcessingQueue = null;
+ };
+}
function createUpdateQueue(baseState) {
var queue = {
baseState: baseState,
- expirationTime: NoWork,
- first: null,
- last: null,
- callbackList: null,
- hasForceUpdate: false,
- isInitialized: false
+ firstUpdate: null,
+ lastUpdate: null,
+ firstCapturedUpdate: null,
+ lastCapturedUpdate: null,
+ firstEffect: null,
+ lastEffect: null,
+ firstCapturedEffect: null,
+ lastCapturedEffect: null
+ };
+ return queue;
+}
+
+function cloneUpdateQueue(currentQueue) {
+ var queue = {
+ baseState: currentQueue.baseState,
+ firstUpdate: currentQueue.firstUpdate,
+ lastUpdate: currentQueue.lastUpdate,
+
+ // TODO: With resuming, if we bail out and resuse the child tree, we should
+ // keep these effects.
+ firstCapturedUpdate: null,
+ lastCapturedUpdate: null,
+
+ firstEffect: null,
+ lastEffect: null,
+
+ firstCapturedEffect: null,
+ lastCapturedEffect: null
};
- {
- queue.isProcessing = false;
- }
return queue;
}
-function insertUpdateIntoQueue(queue, update) {
+function createUpdate(expirationTime) {
+ return {
+ expirationTime: expirationTime,
+
+ tag: UpdateState,
+ payload: null,
+ callback: null,
+
+ next: null,
+ nextEffect: null
+ };
+}
+
+function appendUpdateToQueue(queue, update) {
// Append the update to the end of the list.
- if (queue.last === null) {
+ if (queue.lastUpdate === null) {
// Queue is empty
- queue.first = queue.last = update;
+ queue.firstUpdate = queue.lastUpdate = update;
} else {
- queue.last.next = update;
- queue.last = update;
- }
- if (queue.expirationTime === NoWork || queue.expirationTime > update.expirationTime) {
- queue.expirationTime = update.expirationTime;
+ queue.lastUpdate.next = update;
+ queue.lastUpdate = update;
}
}
-function insertUpdateIntoFiber(fiber, update) {
- // We'll have at least one and at most two distinct update queues.
- var alternateFiber = fiber.alternate;
- var queue1 = fiber.updateQueue;
- if (queue1 === null) {
- // TODO: We don't know what the base state will be until we begin work.
- // It depends on which fiber is the next current. Initialize with an empty
- // base state, then set to the memoizedState when rendering. Not super
- // happy with this approach.
- queue1 = fiber.updateQueue = createUpdateQueue(null);
- }
-
+function enqueueUpdate(fiber, update) {
+ // Update queues are created lazily.
+ var alternate = fiber.alternate;
+ var queue1 = void 0;
var queue2 = void 0;
- if (alternateFiber !== null) {
- queue2 = alternateFiber.updateQueue;
- if (queue2 === null) {
- queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
+ if (alternate === null) {
+ // There's only one fiber.
+ queue1 = fiber.updateQueue;
+ queue2 = null;
+ if (queue1 === null) {
+ queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
}
} else {
- queue2 = null;
+ // There are two owners.
+ queue1 = fiber.updateQueue;
+ queue2 = alternate.updateQueue;
+ if (queue1 === null) {
+ if (queue2 === null) {
+ // Neither fiber has an update queue. Create new ones.
+ queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
+ queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
+ } else {
+ // Only one fiber has an update queue. Clone to create a new one.
+ queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
+ }
+ } else {
+ if (queue2 === null) {
+ // Only one fiber has an update queue. Clone to create a new one.
+ queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
+ } else {
+ // Both owners have an update queue.
+ }
+ }
+ }
+ if (queue2 === null || queue1 === queue2) {
+ // There's only a single queue.
+ appendUpdateToQueue(queue1, update);
+ } else {
+ // There are two queues. We need to append the update to both queues,
+ // while accounting for the persistent structure of the list — we don't
+ // want the same update to be added multiple times.
+ if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
+ // One of the queues is not empty. We must add the update to both queues.
+ appendUpdateToQueue(queue1, update);
+ appendUpdateToQueue(queue2, update);
+ } else {
+ // Both queues are non-empty. The last update is the same in both lists,
+ // because of structural sharing. So, only append to one of the lists.
+ appendUpdateToQueue(queue1, update);
+ // But we still need to update the `lastUpdate` pointer of queue2.
+ queue2.lastUpdate = update;
+ }
}
- queue2 = queue2 !== queue1 ? queue2 : null;
- // Warn if an update is scheduled from inside an updater function.
{
- if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) {
- warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
+ if ((fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
+ warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
didWarnUpdateInsideUpdate = true;
}
}
+}
- // If there's only one queue, add the update to that queue and exit.
- if (queue2 === null) {
- insertUpdateIntoQueue(queue1, update);
- return;
+function enqueueCapturedUpdate(workInProgress, update) {
+ // Captured updates go into a separate list, and only on the work-in-
+ // progress queue.
+ var workInProgressQueue = workInProgress.updateQueue;
+ if (workInProgressQueue === null) {
+ workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
+ } else {
+ // TODO: I put this here rather than createWorkInProgress so that we don't
+ // clone the queue unnecessarily. There's probably a better way to
+ // structure this.
+ workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
}
- // If either queue is empty, we need to add to both queues.
- if (queue1.last === null || queue2.last === null) {
- insertUpdateIntoQueue(queue1, update);
- insertUpdateIntoQueue(queue2, update);
- return;
+ // Append the update to the end of the list.
+ if (workInProgressQueue.lastCapturedUpdate === null) {
+ // This is the first render phase update
+ workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
+ } else {
+ workInProgressQueue.lastCapturedUpdate.next = update;
+ workInProgressQueue.lastCapturedUpdate = update;
}
-
- // If both lists are not empty, the last update is the same for both lists
- // because of structural sharing. So, we should only append to one of
- // the lists.
- insertUpdateIntoQueue(queue1, update);
- // But we still need to update the `last` pointer of queue2.
- queue2.last = update;
}
-function getUpdateExpirationTime(fiber) {
- if (fiber.tag !== ClassComponent && fiber.tag !== HostRoot) {
- return NoWork;
- }
- var updateQueue = fiber.updateQueue;
- if (updateQueue === null) {
- return NoWork;
+function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
+ var current = workInProgress.alternate;
+ if (current !== null) {
+ // If the work-in-progress queue is equal to the current queue,
+ // we need to clone it first.
+ if (queue === current.updateQueue) {
+ queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
+ }
}
- return updateQueue.expirationTime;
+ return queue;
}
-function getStateFromUpdate(update, instance, prevState, props) {
- var partialState = update.partialState;
- if (typeof partialState === 'function') {
- var updateFn = partialState;
+function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
+ switch (update.tag) {
+ case ReplaceState:
+ {
+ var _payload = update.payload;
+ if (typeof _payload === 'function') {
+ // Updater function
+ {
+ if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
+ _payload.call(instance, prevState, nextProps);
+ }
+ }
+ return _payload.call(instance, prevState, nextProps);
+ }
+ // State object
+ return _payload;
+ }
+ case CaptureUpdate:
+ {
+ workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
+ }
+ // Intentional fallthrough
+ case UpdateState:
+ {
+ var _payload2 = update.payload;
+ var partialState = void 0;
+ if (typeof _payload2 === 'function') {
+ // Updater function
+ {
+ if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
+ _payload2.call(instance, prevState, nextProps);
+ }
+ }
+ partialState = _payload2.call(instance, prevState, nextProps);
+ } else {
+ // Partial state object
+ partialState = _payload2;
+ }
+ if (partialState === null || partialState === undefined) {
+ // Null and undefined are treated as no-ops.
+ return prevState;
+ }
+ // Merge the partial state and the previous state.
+ return _assign({}, prevState, partialState);
+ }
+ case ForceUpdate:
+ {
+ hasForceUpdate = true;
+ return prevState;
+ }
+ }
+ return prevState;
+}
- // Invoke setState callback an extra time to help detect side-effects.
- if (debugRenderPhaseSideEffects) {
- updateFn.call(instance, prevState, props);
- }
+function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
+ hasForceUpdate = false;
- return updateFn.call(instance, prevState, props);
- } else {
- return partialState;
- }
-}
-
-function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) {
- if (current !== null && current.updateQueue === queue) {
- // We need to create a work-in-progress queue, by cloning the current queue.
- var currentQueue = queue;
- queue = workInProgress.updateQueue = {
- baseState: currentQueue.baseState,
- expirationTime: currentQueue.expirationTime,
- first: currentQueue.first,
- last: currentQueue.last,
- isInitialized: currentQueue.isInitialized,
- // These fields are no longer valid because they were already committed.
- // Reset them.
- callbackList: null,
- hasForceUpdate: false
- };
- }
+ queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
{
- // Set this flag so we can warn if setState is called inside the update
- // function of another setState.
- queue.isProcessing = true;
- }
-
- // Reset the remaining expiration time. If we skip over any updates, we'll
- // increase this accordingly.
- queue.expirationTime = NoWork;
-
- // TODO: We don't know what the base state will be until we begin work.
- // It depends on which fiber is the next current. Initialize with an empty
- // base state, then set to the memoizedState when rendering. Not super
- // happy with this approach.
- var state = void 0;
- if (queue.isInitialized) {
- state = queue.baseState;
- } else {
- state = queue.baseState = workInProgress.memoizedState;
- queue.isInitialized = true;
+ currentlyProcessingQueue = queue;
}
- var dontMutatePrevState = true;
- var update = queue.first;
- var didSkip = false;
+
+ // These values may change as we process the queue.
+ var newBaseState = queue.baseState;
+ var newFirstUpdate = null;
+ var newExpirationTime = NoWork;
+
+ // Iterate through the list of updates to compute the result.
+ var update = queue.firstUpdate;
+ var resultState = newBaseState;
while (update !== null) {
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime > renderExpirationTime) {
// This update does not have sufficient priority. Skip it.
- var remainingExpirationTime = queue.expirationTime;
- if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) {
- // Update the remaining expiration time.
- queue.expirationTime = updateExpirationTime;
+ if (newFirstUpdate === null) {
+ // This is the first skipped update. It will be the first update in
+ // the new list.
+ newFirstUpdate = update;
+ // Since this is the first update that was skipped, the current result
+ // is the new base state.
+ newBaseState = resultState;
+ }
+ // Since this update will remain in the list, update the remaining
+ // expiration time.
+ if (newExpirationTime === NoWork || newExpirationTime > updateExpirationTime) {
+ newExpirationTime = updateExpirationTime;
}
- if (!didSkip) {
- didSkip = true;
- queue.baseState = state;
+ } else {
+ // This update does have sufficient priority. Process it and compute
+ // a new result.
+ resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
+ var _callback = update.callback;
+ if (_callback !== null) {
+ workInProgress.effectTag |= Callback;
+ // Set this to null, in case it was mutated during an aborted render.
+ update.nextEffect = null;
+ if (queue.lastEffect === null) {
+ queue.firstEffect = queue.lastEffect = update;
+ } else {
+ queue.lastEffect.nextEffect = update;
+ queue.lastEffect = update;
+ }
}
- // Continue to the next update.
- update = update.next;
- continue;
}
+ // Continue to the next update.
+ update = update.next;
+ }
- // This update does have sufficient priority.
-
- // If no previous updates were skipped, drop this update from the queue by
- // advancing the head of the list.
- if (!didSkip) {
- queue.first = update.next;
- if (queue.first === null) {
- queue.last = null;
+ // Separately, iterate though the list of captured updates.
+ var newFirstCapturedUpdate = null;
+ update = queue.firstCapturedUpdate;
+ while (update !== null) {
+ var _updateExpirationTime = update.expirationTime;
+ if (_updateExpirationTime > renderExpirationTime) {
+ // This update does not have sufficient priority. Skip it.
+ if (newFirstCapturedUpdate === null) {
+ // This is the first skipped captured update. It will be the first
+ // update in the new list.
+ newFirstCapturedUpdate = update;
+ // If this is the first update that was skipped, the current result is
+ // the new base state.
+ if (newFirstUpdate === null) {
+ newBaseState = resultState;
+ }
+ }
+ // Since this update will remain in the list, update the remaining
+ // expiration time.
+ if (newExpirationTime === NoWork || newExpirationTime > _updateExpirationTime) {
+ newExpirationTime = _updateExpirationTime;
}
- }
-
- // Process the update
- var _partialState = void 0;
- if (update.isReplace) {
- state = getStateFromUpdate(update, instance, state, props);
- dontMutatePrevState = true;
} else {
- _partialState = getStateFromUpdate(update, instance, state, props);
- if (_partialState) {
- if (dontMutatePrevState) {
- // $FlowFixMe: Idk how to type this properly.
- state = _assign({}, state, _partialState);
+ // This update does have sufficient priority. Process it and compute
+ // a new result.
+ resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
+ var _callback2 = update.callback;
+ if (_callback2 !== null) {
+ workInProgress.effectTag |= Callback;
+ // Set this to null, in case it was mutated during an aborted render.
+ update.nextEffect = null;
+ if (queue.lastCapturedEffect === null) {
+ queue.firstCapturedEffect = queue.lastCapturedEffect = update;
} else {
- state = _assign(state, _partialState);
+ queue.lastCapturedEffect.nextEffect = update;
+ queue.lastCapturedEffect = update;
}
- dontMutatePrevState = false;
}
}
- if (update.isForced) {
- queue.hasForceUpdate = true;
+ update = update.next;
+ }
+
+ if (newFirstUpdate === null) {
+ queue.lastUpdate = null;
+ }
+ if (newFirstCapturedUpdate === null) {
+ queue.lastCapturedUpdate = null;
+ } else {
+ workInProgress.effectTag |= Callback;
+ }
+ if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
+ // We processed every update, without skipping. That means the new base
+ // state is the same as the result state.
+ newBaseState = resultState;
+ }
+
+ queue.baseState = newBaseState;
+ queue.firstUpdate = newFirstUpdate;
+ queue.firstCapturedUpdate = newFirstCapturedUpdate;
+
+ // Set the remaining expiration time to be whatever is remaining in the queue.
+ // This should be fine because the only two other things that contribute to
+ // expiration time are props and context. We're already in the middle of the
+ // begin phase by the time we start processing the queue, so we've already
+ // dealt with the props. Context in components that specify
+ // shouldComponentUpdate is tricky; but we'll have to account for
+ // that regardless.
+ workInProgress.expirationTime = newExpirationTime;
+ workInProgress.memoizedState = resultState;
+
+ {
+ currentlyProcessingQueue = null;
+ }
+}
+
+function callCallback(callback, context) {
+ !(typeof callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', callback) : void 0;
+ callback.call(context);
+}
+
+function resetHasForceUpdateBeforeProcessing() {
+ hasForceUpdate = false;
+}
+
+function checkHasForceUpdateAfterProcessing() {
+ return hasForceUpdate;
+}
+
+function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
+ // If the finished render included captured updates, and there are still
+ // lower priority updates left over, we need to keep the captured updates
+ // in the queue so that they are rebased and not dropped once we process the
+ // queue again at the lower priority.
+ if (finishedQueue.firstCapturedUpdate !== null) {
+ // Join the captured update list to the end of the normal list.
+ if (finishedQueue.lastUpdate !== null) {
+ finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
+ finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
+ }
+ // Clear the list of captured updates.
+ finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
+ }
+
+ // Commit the effects
+ commitUpdateEffects(finishedQueue.firstEffect, instance);
+ finishedQueue.firstEffect = finishedQueue.lastEffect = null;
+
+ commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
+ finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
+}
+
+function commitUpdateEffects(effect, instance) {
+ while (effect !== null) {
+ var _callback3 = effect.callback;
+ if (_callback3 !== null) {
+ effect.callback = null;
+ callCallback(_callback3, instance);
}
- if (update.callback !== null) {
- // Append to list of callbacks.
- var _callbackList = queue.callbackList;
- if (_callbackList === null) {
- _callbackList = queue.callbackList = [];
+ effect = effect.nextEffect;
+ }
+}
+
+function createCapturedValue(value, source) {
+ // If the value is an error, call this function immediately after it is thrown
+ // so the stack is accurate.
+ return {
+ value: value,
+ source: source,
+ stack: getStackByFiberInDevAndProd(source)
+ };
+}
+
+var valueCursor = createCursor(null);
+
+var rendererSigil = void 0;
+{
+ // Use this to detect multiple renderers using the same context
+ rendererSigil = {};
+}
+
+var currentlyRenderingFiber = null;
+var lastContextDependency = null;
+var lastContextWithAllBitsObserved = null;
+
+function resetContextDependences() {
+ // This is called right before React yields execution, to ensure `readContext`
+ // cannot be called outside the render phase.
+ currentlyRenderingFiber = null;
+ lastContextDependency = null;
+ lastContextWithAllBitsObserved = null;
+}
+
+function pushProvider(providerFiber, nextValue) {
+ var context = providerFiber.type._context;
+
+ if (isPrimaryRenderer) {
+ push(valueCursor, context._currentValue, providerFiber);
+
+ context._currentValue = nextValue;
+ {
+ !(context._currentRenderer === undefined || context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
+ context._currentRenderer = rendererSigil;
+ }
+ } else {
+ push(valueCursor, context._currentValue2, providerFiber);
+
+ context._currentValue2 = nextValue;
+ {
+ !(context._currentRenderer2 === undefined || context._currentRenderer2 === null || context._currentRenderer2 === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
+ context._currentRenderer2 = rendererSigil;
+ }
+ }
+}
+
+function popProvider(providerFiber) {
+ var currentValue = valueCursor.current;
+
+ pop(valueCursor, providerFiber);
+
+ var context = providerFiber.type._context;
+ if (isPrimaryRenderer) {
+ context._currentValue = currentValue;
+ } else {
+ context._currentValue2 = currentValue;
+ }
+}
+
+function calculateChangedBits(context, newValue, oldValue) {
+ // Use Object.is to compare the new context value to the old value. Inlined
+ // Object.is polyfill.
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
+ if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare
+ ) {
+ // No change
+ return 0;
+ } else {
+ var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : maxSigned31BitInt;
+
+ {
+ !((changedBits & maxSigned31BitInt) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
+ }
+ return changedBits | 0;
+ }
+}
+
+function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
+ var fiber = workInProgress.child;
+ if (fiber !== null) {
+ // Set the return pointer of the child to the work-in-progress fiber.
+ fiber.return = workInProgress;
+ }
+ while (fiber !== null) {
+ var nextFiber = void 0;
+
+ // Visit this fiber.
+ var dependency = fiber.firstContextDependency;
+ if (dependency !== null) {
+ do {
+ // Check if the context matches.
+ if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
+ // Match! Schedule an update on this fiber.
+
+ if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
+ // Schedule a force update on the work-in-progress.
+ var update = createUpdate(renderExpirationTime);
+ update.tag = ForceUpdate;
+ // TODO: Because we don't have a work-in-progress, this will add the
+ // update to the current fiber, too, which means it will persist even if
+ // this render is thrown away. Since it's a race condition, not sure it's
+ // worth fixing.
+ enqueueUpdate(fiber, update);
+ }
+
+ if (fiber.expirationTime === NoWork || fiber.expirationTime > renderExpirationTime) {
+ fiber.expirationTime = renderExpirationTime;
+ }
+ var alternate = fiber.alternate;
+ if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) {
+ alternate.expirationTime = renderExpirationTime;
+ }
+ // Update the child expiration time of all the ancestors, including
+ // the alternates.
+ var node = fiber.return;
+ while (node !== null) {
+ alternate = node.alternate;
+ if (node.childExpirationTime === NoWork || node.childExpirationTime > renderExpirationTime) {
+ node.childExpirationTime = renderExpirationTime;
+ if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > renderExpirationTime)) {
+ alternate.childExpirationTime = renderExpirationTime;
+ }
+ } else if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > renderExpirationTime)) {
+ alternate.childExpirationTime = renderExpirationTime;
+ } else {
+ // Neither alternate was updated, which means the rest of the
+ // ancestor path already has sufficient priority.
+ break;
+ }
+ node = node.return;
+ }
+ }
+ nextFiber = fiber.child;
+ dependency = dependency.next;
+ } while (dependency !== null);
+ } else if (fiber.tag === ContextProvider) {
+ // Don't scan deeper if this is a matching provider
+ nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
+ } else {
+ // Traverse down.
+ nextFiber = fiber.child;
+ }
+
+ if (nextFiber !== null) {
+ // Set the return pointer of the child to the work-in-progress fiber.
+ nextFiber.return = fiber;
+ } else {
+ // No child. Traverse to next sibling.
+ nextFiber = fiber;
+ while (nextFiber !== null) {
+ if (nextFiber === workInProgress) {
+ // We're back to the root of this subtree. Exit.
+ nextFiber = null;
+ break;
+ }
+ var sibling = nextFiber.sibling;
+ if (sibling !== null) {
+ // Set the return pointer of the sibling to the work-in-progress fiber.
+ sibling.return = nextFiber.return;
+ nextFiber = sibling;
+ break;
+ }
+ // No more siblings. Traverse up.
+ nextFiber = nextFiber.return;
}
- _callbackList.push(update);
}
- update = update.next;
+ fiber = nextFiber;
}
+}
- if (queue.callbackList !== null) {
- workInProgress.effectTag |= Callback;
- } else if (queue.first === null && !queue.hasForceUpdate) {
- // The queue is empty. We can reset it.
- workInProgress.updateQueue = null;
+function prepareToReadContext(workInProgress, renderExpirationTime) {
+ currentlyRenderingFiber = workInProgress;
+ lastContextDependency = null;
+ lastContextWithAllBitsObserved = null;
+
+ // Reset the work-in-progress list
+ workInProgress.firstContextDependency = null;
+}
+
+function readContext(context, observedBits) {
+ if (lastContextWithAllBitsObserved === context) {
+ // Nothing to do. We already observe everything in this context.
+ } else if (observedBits === false || observedBits === 0) {
+ // Do not observe any updates.
+ } else {
+ var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
+ if (typeof observedBits !== 'number' || observedBits === maxSigned31BitInt) {
+ // Observe all updates.
+ lastContextWithAllBitsObserved = context;
+ resolvedObservedBits = maxSigned31BitInt;
+ } else {
+ resolvedObservedBits = observedBits;
+ }
+
+ var contextItem = {
+ context: context,
+ observedBits: resolvedObservedBits,
+ next: null
+ };
+
+ if (lastContextDependency === null) {
+ !(currentlyRenderingFiber !== null) ? invariant(false, 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
+ // This is the first dependency in the list
+ currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
+ } else {
+ // Append a new context item.
+ lastContextDependency = lastContextDependency.next = contextItem;
+ }
}
+ return isPrimaryRenderer ? context._currentValue : context._currentValue2;
+}
+
+var NO_CONTEXT = {};
+
+var contextStackCursor$1 = createCursor(NO_CONTEXT);
+var contextFiberStackCursor = createCursor(NO_CONTEXT);
+var rootInstanceStackCursor = createCursor(NO_CONTEXT);
+
+function requiredContext(c) {
+ !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ return c;
+}
+
+function getRootHostContainer() {
+ var rootInstance = requiredContext(rootInstanceStackCursor.current);
+ return rootInstance;
+}
+
+function pushHostContainer(fiber, nextRootInstance) {
+ // Push current root instance onto the stack;
+ // This allows us to reset root when portals are popped.
+ push(rootInstanceStackCursor, nextRootInstance, fiber);
+ // Track the context and the Fiber that provided it.
+ // This enables us to pop only Fibers that provide unique contexts.
+ push(contextFiberStackCursor, fiber, fiber);
- if (!didSkip) {
- didSkip = true;
- queue.baseState = state;
+ // Finally, we need to push the host context to the stack.
+ // However, we can't just call getRootHostContext() and push it because
+ // we'd have a different number of entries on the stack depending on
+ // whether getRootHostContext() throws somewhere in renderer code or not.
+ // So we push an empty value first. This lets us safely unwind on errors.
+ push(contextStackCursor$1, NO_CONTEXT, fiber);
+ var nextRootContext = getRootHostContext(nextRootInstance);
+ // Now that we know this function doesn't throw, replace it.
+ pop(contextStackCursor$1, fiber);
+ push(contextStackCursor$1, nextRootContext, fiber);
+}
+
+function popHostContainer(fiber) {
+ pop(contextStackCursor$1, fiber);
+ pop(contextFiberStackCursor, fiber);
+ pop(rootInstanceStackCursor, fiber);
+}
+
+function getHostContext() {
+ var context = requiredContext(contextStackCursor$1.current);
+ return context;
+}
+
+function pushHostContext(fiber) {
+ var rootInstance = requiredContext(rootInstanceStackCursor.current);
+ var context = requiredContext(contextStackCursor$1.current);
+ var nextContext = getChildHostContext(context, fiber.type, rootInstance);
+
+ // Don't push this Fiber's context unless it's unique.
+ if (context === nextContext) {
+ return;
}
- {
- // No longer processing.
- queue.isProcessing = false;
+ // Track the context and the Fiber that provided it.
+ // This enables us to pop only Fibers that provide unique contexts.
+ push(contextFiberStackCursor, fiber, fiber);
+ push(contextStackCursor$1, nextContext, fiber);
+}
+
+function popHostContext(fiber) {
+ // Do not pop unless this Fiber provided the current context.
+ // pushHostContext() only pushes Fibers that provide unique contexts.
+ if (contextFiberStackCursor.current !== fiber) {
+ return;
}
- return state;
+ pop(contextStackCursor$1, fiber);
+ pop(contextFiberStackCursor, fiber);
+}
+
+var commitTime = 0;
+var profilerStartTime = -1;
+
+function getCommitTime() {
+ return commitTime;
}
-function commitCallbacks(queue, context) {
- var callbackList = queue.callbackList;
- if (callbackList === null) {
+function recordCommitTime() {
+ if (!enableProfilerTimer) {
return;
}
- // Set the list to null to make sure they don't get called more than once.
- queue.callbackList = null;
- for (var i = 0; i < callbackList.length; i++) {
- var update = callbackList[i];
- var _callback = update.callback;
- // This update might be processed again. Clear the callback so it's only
- // called once.
- update.callback = null;
- !(typeof _callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback) : void 0;
- _callback.call(context);
+ commitTime = schedule.unstable_now();
+}
+
+function startProfilerTimer(fiber) {
+ if (!enableProfilerTimer) {
+ return;
+ }
+
+ profilerStartTime = schedule.unstable_now();
+
+ if (fiber.actualStartTime < 0) {
+ fiber.actualStartTime = schedule.unstable_now();
+ }
+}
+
+function stopProfilerTimerIfRunning(fiber) {
+ if (!enableProfilerTimer) {
+ return;
+ }
+ profilerStartTime = -1;
+}
+
+function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
+ if (!enableProfilerTimer) {
+ return;
+ }
+
+ if (profilerStartTime >= 0) {
+ var elapsedTime = schedule.unstable_now() - profilerStartTime;
+ fiber.actualDuration += elapsedTime;
+ if (overrideBaseTime) {
+ fiber.selfBaseDuration = elapsedTime;
+ }
+ profilerStartTime = -1;
}
}
var fakeInternalInstance = {};
var isArray = Array.isArray;
+// React.Component uses a shared frozen object by default.
+// We'll use it to determine whether we need to initialize legacy refs.
+var emptyRefsObject = new React.Component().refs;
+
+var didWarnAboutStateAssignmentForComponent = void 0;
+var didWarnAboutUninitializedState = void 0;
+var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
+var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
+var didWarnAboutUndefinedDerivedState = void 0;
+var warnOnUndefinedDerivedState = void 0;
+var warnOnInvalidCallback$1 = void 0;
+var didWarnAboutDirectlyAssigningPropsToState = void 0;
+
{
- var didWarnAboutStateAssignmentForComponent = {};
+ didWarnAboutStateAssignmentForComponent = new Set();
+ didWarnAboutUninitializedState = new Set();
+ didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
+ didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
+ didWarnAboutDirectlyAssigningPropsToState = new Set();
+ didWarnAboutUndefinedDerivedState = new Set();
+
+ var didWarnOnInvalidCallback = new Set();
+
+ warnOnInvalidCallback$1 = function (callback, callerName) {
+ if (callback === null || typeof callback === 'function') {
+ return;
+ }
+ var key = callerName + '_' + callback;
+ if (!didWarnOnInvalidCallback.has(key)) {
+ didWarnOnInvalidCallback.add(key);
+ warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
+ }
+ };
- var warnOnInvalidCallback = function (callback, callerName) {
- warning(callback === null || typeof callback === 'function', '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
+ warnOnUndefinedDerivedState = function (type, partialState) {
+ if (partialState === undefined) {
+ var componentName = getComponentName(type) || 'Component';
+ if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
+ didWarnAboutUndefinedDerivedState.add(componentName);
+ warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
+ }
+ }
};
// This is so gross but it's at least non-critical and can be removed if
@@ -6188,501 +11576,575 @@ var isArray = Array.isArray;
Object.freeze(fakeInternalInstance);
}
-var ReactFiberClassComponent = function (scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState) {
- // Class component state updater
- var updater = {
- isMounted: isMounted,
- enqueueSetState: function (instance, partialState, callback) {
- var fiber = get(instance);
- callback = callback === undefined ? null : callback;
- {
- warnOnInvalidCallback(callback, 'setState');
- }
- var expirationTime = computeExpirationForFiber(fiber);
- var update = {
- expirationTime: expirationTime,
- partialState: partialState,
- callback: callback,
- isReplace: false,
- isForced: false,
- nextCallback: null,
- next: null
- };
- insertUpdateIntoFiber(fiber, update);
- scheduleWork(fiber, expirationTime);
- },
- enqueueReplaceState: function (instance, state, callback) {
- var fiber = get(instance);
- callback = callback === undefined ? null : callback;
- {
- warnOnInvalidCallback(callback, 'replaceState');
- }
- var expirationTime = computeExpirationForFiber(fiber);
- var update = {
- expirationTime: expirationTime,
- partialState: state,
- callback: callback,
- isReplace: true,
- isForced: false,
- nextCallback: null,
- next: null
- };
- insertUpdateIntoFiber(fiber, update);
- scheduleWork(fiber, expirationTime);
- },
- enqueueForceUpdate: function (instance, callback) {
- var fiber = get(instance);
- callback = callback === undefined ? null : callback;
- {
- warnOnInvalidCallback(callback, 'forceUpdate');
- }
- var expirationTime = computeExpirationForFiber(fiber);
- var update = {
- expirationTime: expirationTime,
- partialState: null,
- callback: callback,
- isReplace: false,
- isForced: true,
- nextCallback: null,
- next: null
- };
- insertUpdateIntoFiber(fiber, update);
- scheduleWork(fiber, expirationTime);
- }
- };
+function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
+ var prevState = workInProgress.memoizedState;
- function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) {
- if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) {
- // If the workInProgress already has an Update effect, return true
- return true;
+ {
+ if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
+ // Invoke the function an extra time to help detect side-effects.
+ getDerivedStateFromProps(nextProps, prevState);
}
+ }
- var instance = workInProgress.stateNode;
- var type = workInProgress.type;
- if (typeof instance.shouldComponentUpdate === 'function') {
- startPhaseTimer(workInProgress, 'shouldComponentUpdate');
- var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext);
- stopPhaseTimer();
+ var partialState = getDerivedStateFromProps(nextProps, prevState);
- // Simulate an async bailout/interruption by invoking lifecycle twice.
- if (debugRenderPhaseSideEffects) {
- instance.shouldComponentUpdate(newProps, newState, newContext);
- }
+ {
+ warnOnUndefinedDerivedState(ctor, partialState);
+ }
+ // Merge the partial state and the previous state.
+ var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
+ workInProgress.memoizedState = memoizedState;
+ // Once the update queue is empty, persist the derived state onto the
+ // base state.
+ var updateQueue = workInProgress.updateQueue;
+ if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
+ updateQueue.baseState = memoizedState;
+ }
+}
+
+var classComponentUpdater = {
+ isMounted: isMounted,
+ enqueueSetState: function (inst, payload, callback) {
+ var fiber = get(inst);
+ var currentTime = requestCurrentTime();
+ var expirationTime = computeExpirationForFiber(currentTime, fiber);
+
+ var update = createUpdate(expirationTime);
+ update.payload = payload;
+ if (callback !== undefined && callback !== null) {
{
- warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Unknown');
+ warnOnInvalidCallback$1(callback, 'setState');
}
+ update.callback = callback;
+ }
- return shouldUpdate;
+ enqueueUpdate(fiber, update);
+ scheduleWork(fiber, expirationTime);
+ },
+ enqueueReplaceState: function (inst, payload, callback) {
+ var fiber = get(inst);
+ var currentTime = requestCurrentTime();
+ var expirationTime = computeExpirationForFiber(currentTime, fiber);
+
+ var update = createUpdate(expirationTime);
+ update.tag = ReplaceState;
+ update.payload = payload;
+
+ if (callback !== undefined && callback !== null) {
+ {
+ warnOnInvalidCallback$1(callback, 'replaceState');
+ }
+ update.callback = callback;
}
- if (type.prototype && type.prototype.isPureReactComponent) {
- return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
+ enqueueUpdate(fiber, update);
+ scheduleWork(fiber, expirationTime);
+ },
+ enqueueForceUpdate: function (inst, callback) {
+ var fiber = get(inst);
+ var currentTime = requestCurrentTime();
+ var expirationTime = computeExpirationForFiber(currentTime, fiber);
+
+ var update = createUpdate(expirationTime);
+ update.tag = ForceUpdate;
+
+ if (callback !== undefined && callback !== null) {
+ {
+ warnOnInvalidCallback$1(callback, 'forceUpdate');
+ }
+ update.callback = callback;
}
- return true;
+ enqueueUpdate(fiber, update);
+ scheduleWork(fiber, expirationTime);
}
+};
+
+function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextLegacyContext) {
+ var instance = workInProgress.stateNode;
+ if (typeof instance.shouldComponentUpdate === 'function') {
+ startPhaseTimer(workInProgress, 'shouldComponentUpdate');
+ var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextLegacyContext);
+ stopPhaseTimer();
- function checkClassInstance(workInProgress) {
- var instance = workInProgress.stateNode;
- var type = workInProgress.type;
{
- var name = getComponentName(workInProgress);
- var renderPresent = instance.render;
+ !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
+ }
- if (!renderPresent) {
- if (type.prototype && typeof type.prototype.render === 'function') {
- warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
- } else {
- warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
- }
- }
-
- var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
- warning(noGetInitialStateOnES6, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name);
- var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
- warning(noGetDefaultPropsOnES6, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name);
- var noInstancePropTypes = !instance.propTypes;
- warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name);
- var noInstanceContextTypes = !instance.contextTypes;
- warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name);
- var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
- warning(noComponentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name);
- if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
- warning(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component');
- }
- var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
- warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
- var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
- warning(noComponentDidReceiveProps, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name);
- var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
- warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name);
- var hasMutatedProps = instance.props !== workInProgress.pendingProps;
- warning(instance.props === undefined || !hasMutatedProps, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
- var noInstanceDefaultProps = !instance.defaultProps;
- warning(noInstanceDefaultProps, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name);
- }
-
- var state = instance.state;
- if (state && (typeof state !== 'object' || isArray(state))) {
- warning(false, '%s.state: must be set to an object or null', getComponentName(workInProgress));
+ return shouldUpdate;
+ }
+
+ if (ctor.prototype && ctor.prototype.isPureReactComponent) {
+ return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
+ }
+
+ return true;
+}
+
+function checkClassInstance(workInProgress, ctor, newProps) {
+ var instance = workInProgress.stateNode;
+ {
+ var name = getComponentName(ctor) || 'Component';
+ var renderPresent = instance.render;
+
+ if (!renderPresent) {
+ if (ctor.prototype && typeof ctor.prototype.render === 'function') {
+ warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
+ } else {
+ warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
+ }
+ }
+
+ var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
+ !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
+ var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
+ !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
+ var noInstancePropTypes = !instance.propTypes;
+ !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
+ var noInstanceContextTypes = !instance.contextTypes;
+ !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
+ var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
+ !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
+ if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
+ warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
+ }
+ var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
+ !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
+ var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
+ !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
+ var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
+ !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
+ var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
+ !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
+ var hasMutatedProps = instance.props !== newProps;
+ !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
+ var noInstanceDefaultProps = !instance.defaultProps;
+ !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
+
+ if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
+ didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
+ warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
+ }
+
+ var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
+ !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
+ var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function';
+ !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
+ var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
+ !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
+ var _state = instance.state;
+ if (_state && (typeof _state !== 'object' || isArray(_state))) {
+ warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
}
if (typeof instance.getChildContext === 'function') {
- warning(typeof workInProgress.type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(workInProgress));
+ !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
}
}
+}
- function resetInputPointers(workInProgress, instance) {
- instance.props = workInProgress.memoizedProps;
- instance.state = workInProgress.memoizedState;
+function adoptClassInstance(workInProgress, instance) {
+ instance.updater = classComponentUpdater;
+ workInProgress.stateNode = instance;
+ // The instance needs access to the fiber so that it can schedule updates
+ set(instance, workInProgress);
+ {
+ instance._reactInternalInstance = fakeInternalInstance;
}
+}
- function adoptClassInstance(workInProgress, instance) {
- instance.updater = updater;
- workInProgress.stateNode = instance;
- // The instance needs access to the fiber so that it can schedule updates
- set(instance, workInProgress);
- {
- instance._reactInternalInstance = fakeInternalInstance;
+function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
+ var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
+ var contextTypes = ctor.contextTypes;
+ var isContextConsumer = contextTypes !== null && contextTypes !== undefined;
+ var context = isContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
+
+ // Instantiate twice to help detect side-effects.
+ {
+ if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
+ new ctor(props, context); // eslint-disable-line no-new
}
}
- function constructClassInstance(workInProgress, props) {
- var ctor = workInProgress.type;
- var unmaskedContext = getUnmaskedContext(workInProgress);
- var needsContext = isContextConsumer(workInProgress);
- var context = needsContext ? getMaskedContext(workInProgress, unmaskedContext) : emptyObject;
- var instance = new ctor(props, context);
- adoptClassInstance(workInProgress, instance);
+ var instance = new ctor(props, context);
+ var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
+ adoptClassInstance(workInProgress, instance);
- // Cache unmasked context so we can avoid recreating masked context unless necessary.
- // ReactFiberContext usually updates this cache but can't for newly-created instances.
- if (needsContext) {
- cacheContext(workInProgress, unmaskedContext, context);
+ {
+ if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
+ var componentName = getComponentName(ctor) || 'Component';
+ if (!didWarnAboutUninitializedState.has(componentName)) {
+ didWarnAboutUninitializedState.add(componentName);
+ warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
+ }
+ }
+
+ // If new component APIs are defined, "unsafe" lifecycles won't be called.
+ // Warn about these lifecycles if they are present.
+ // Don't warn about react-lifecycles-compat polyfilled methods though.
+ if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
+ var foundWillMountName = null;
+ var foundWillReceivePropsName = null;
+ var foundWillUpdateName = null;
+ if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
+ foundWillMountName = 'componentWillMount';
+ } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
+ foundWillMountName = 'UNSAFE_componentWillMount';
+ }
+ if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
+ foundWillReceivePropsName = 'componentWillReceiveProps';
+ } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
+ foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
+ }
+ if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
+ foundWillUpdateName = 'componentWillUpdate';
+ } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
+ foundWillUpdateName = 'UNSAFE_componentWillUpdate';
+ }
+ if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
+ var _componentName = getComponentName(ctor) || 'Component';
+ var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
+ if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
+ didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
+ warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '');
+ }
+ }
}
+ }
- return instance;
+ // Cache unmasked context so we can avoid recreating masked context unless necessary.
+ // ReactFiberContext usually updates this cache but can't for newly-created instances.
+ if (isContextConsumer) {
+ cacheContext(workInProgress, unmaskedContext, context);
}
- function callComponentWillMount(workInProgress, instance) {
- startPhaseTimer(workInProgress, 'componentWillMount');
- var oldState = instance.state;
+ return instance;
+}
+
+function callComponentWillMount(workInProgress, instance) {
+ startPhaseTimer(workInProgress, 'componentWillMount');
+ var oldState = instance.state;
+
+ if (typeof instance.componentWillMount === 'function') {
instance.componentWillMount();
- stopPhaseTimer();
+ }
+ if (typeof instance.UNSAFE_componentWillMount === 'function') {
+ instance.UNSAFE_componentWillMount();
+ }
+
+ stopPhaseTimer();
- // Simulate an async bailout/interruption by invoking lifecycle twice.
- if (debugRenderPhaseSideEffects) {
- instance.componentWillMount();
+ if (oldState !== instance.state) {
+ {
+ warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
}
+ classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
+ }
+}
- if (oldState !== instance.state) {
- {
- warning(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress));
+function callComponentWillReceiveProps(workInProgress, instance, newProps, nextLegacyContext) {
+ var oldState = instance.state;
+ startPhaseTimer(workInProgress, 'componentWillReceiveProps');
+ if (typeof instance.componentWillReceiveProps === 'function') {
+ instance.componentWillReceiveProps(newProps, nextLegacyContext);
+ }
+ if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
+ instance.UNSAFE_componentWillReceiveProps(newProps, nextLegacyContext);
+ }
+ stopPhaseTimer();
+
+ if (instance.state !== oldState) {
+ {
+ var componentName = getComponentName(workInProgress.type) || 'Component';
+ if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
+ didWarnAboutStateAssignmentForComponent.add(componentName);
+ warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
}
- updater.enqueueReplaceState(instance, instance.state, null);
}
+ classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
}
+}
- function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) {
- startPhaseTimer(workInProgress, 'componentWillReceiveProps');
- var oldState = instance.state;
- instance.componentWillReceiveProps(newProps, newContext);
- stopPhaseTimer();
+// Invokes the mount life-cycles on a previously never rendered instance.
+function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
+ {
+ checkClassInstance(workInProgress, ctor, newProps);
+ }
- // Simulate an async bailout/interruption by invoking lifecycle twice.
- if (debugRenderPhaseSideEffects) {
- instance.componentWillReceiveProps(newProps, newContext);
- }
+ var instance = workInProgress.stateNode;
+ var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
- if (instance.state !== oldState) {
- {
- var componentName = getComponentName(workInProgress) || 'Component';
- if (!didWarnAboutStateAssignmentForComponent[componentName]) {
- warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
- didWarnAboutStateAssignmentForComponent[componentName] = true;
- }
+ instance.props = newProps;
+ instance.state = workInProgress.memoizedState;
+ instance.refs = emptyRefsObject;
+ instance.context = getMaskedContext(workInProgress, unmaskedContext);
+
+ {
+ if (instance.state === newProps) {
+ var componentName = getComponentName(ctor) || 'Component';
+ if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
+ didWarnAboutDirectlyAssigningPropsToState.add(componentName);
+ warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
}
- updater.enqueueReplaceState(instance, instance.state, null);
+ }
+
+ if (workInProgress.mode & StrictMode) {
+ ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
+
+ ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
+ }
+
+ if (warnAboutDeprecatedLifecycles) {
+ ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
}
}
- // Invokes the mount life-cycles on a previously never rendered instance.
- function mountClassInstance(workInProgress, renderExpirationTime) {
- var current = workInProgress.alternate;
+ var updateQueue = workInProgress.updateQueue;
+ if (updateQueue !== null) {
+ processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
+ instance.state = workInProgress.memoizedState;
+ }
- {
- checkClassInstance(workInProgress);
+ var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
+ if (typeof getDerivedStateFromProps === 'function') {
+ applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
+ instance.state = workInProgress.memoizedState;
+ }
+
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
+ if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
+ callComponentWillMount(workInProgress, instance);
+ // If we had additional state updates during this life-cycle, let's
+ // process them now.
+ updateQueue = workInProgress.updateQueue;
+ if (updateQueue !== null) {
+ processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
+ instance.state = workInProgress.memoizedState;
}
+ }
- var instance = workInProgress.stateNode;
- var state = instance.state || null;
+ if (typeof instance.componentDidMount === 'function') {
+ workInProgress.effectTag |= Update;
+ }
+}
+
+function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
+ var instance = workInProgress.stateNode;
+
+ var oldProps = workInProgress.memoizedProps;
+ instance.props = oldProps;
- var props = workInProgress.pendingProps;
- !props ? invariant(false, 'There must be pending props for an initial mount. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var oldContext = instance.context;
+ var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
+ var nextLegacyContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
- var unmaskedContext = getUnmaskedContext(workInProgress);
+ var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
+ var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
- instance.props = props;
- instance.state = workInProgress.memoizedState = state;
- instance.refs = emptyObject;
- instance.context = getMaskedContext(workInProgress, unmaskedContext);
+ // Note: During these life-cycles, instance.props/instance.state are what
+ // ever the previously attempted to render - not the "current". However,
+ // during componentDidUpdate we pass the "current" props.
- if (enableAsyncSubtreeAPI && workInProgress.type != null && workInProgress.type.prototype != null && workInProgress.type.prototype.unstable_isAsyncReactComponent === true) {
- workInProgress.internalContextTag |= AsyncUpdates;
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
+ if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
+ if (oldProps !== newProps || oldContext !== nextLegacyContext) {
+ callComponentWillReceiveProps(workInProgress, instance, newProps, nextLegacyContext);
+ }
+ }
+
+ resetHasForceUpdateBeforeProcessing();
+
+ var oldState = workInProgress.memoizedState;
+ var newState = instance.state = oldState;
+ var updateQueue = workInProgress.updateQueue;
+ if (updateQueue !== null) {
+ processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
+ newState = workInProgress.memoizedState;
+ }
+ if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
+ // If an update was already in progress, we should schedule an Update
+ // effect even though we're bailing out, so that cWU/cDU are called.
+ if (typeof instance.componentDidMount === 'function') {
+ workInProgress.effectTag |= Update;
}
+ return false;
+ }
+
+ if (typeof getDerivedStateFromProps === 'function') {
+ applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
+ newState = workInProgress.memoizedState;
+ }
+
+ var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextLegacyContext);
- if (typeof instance.componentWillMount === 'function') {
- callComponentWillMount(workInProgress, instance);
- // If we had additional state updates during this life-cycle, let's
- // process them now.
- var updateQueue = workInProgress.updateQueue;
- if (updateQueue !== null) {
- instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
+ if (shouldUpdate) {
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
+ if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
+ startPhaseTimer(workInProgress, 'componentWillMount');
+ if (typeof instance.componentWillMount === 'function') {
+ instance.componentWillMount();
+ }
+ if (typeof instance.UNSAFE_componentWillMount === 'function') {
+ instance.UNSAFE_componentWillMount();
}
+ stopPhaseTimer();
+ }
+ if (typeof instance.componentDidMount === 'function') {
+ workInProgress.effectTag |= Update;
}
+ } else {
+ // If an update was already in progress, we should schedule an Update
+ // effect even though we're bailing out, so that cWU/cDU are called.
if (typeof instance.componentDidMount === 'function') {
workInProgress.effectTag |= Update;
}
+
+ // If shouldComponentUpdate returned false, we should still update the
+ // memoized state to indicate that this work can be reused.
+ workInProgress.memoizedProps = newProps;
+ workInProgress.memoizedState = newState;
}
- // Called on a preexisting class instance. Returns false if a resumed render
- // could be reused.
- // function resumeMountClassInstance(
- // workInProgress: Fiber,
- // priorityLevel: PriorityLevel,
- // ): boolean {
- // const instance = workInProgress.stateNode;
- // resetInputPointers(workInProgress, instance);
-
- // let newState = workInProgress.memoizedState;
- // let newProps = workInProgress.pendingProps;
- // if (!newProps) {
- // // If there isn't any new props, then we'll reuse the memoized props.
- // // This could be from already completed work.
- // newProps = workInProgress.memoizedProps;
- // invariant(
- // newProps != null,
- // 'There should always be pending or memoized props. This error is ' +
- // 'likely caused by a bug in React. Please file an issue.',
- // );
- // }
- // const newUnmaskedContext = getUnmaskedContext(workInProgress);
- // const newContext = getMaskedContext(workInProgress, newUnmaskedContext);
-
- // const oldContext = instance.context;
- // const oldProps = workInProgress.memoizedProps;
-
- // if (
- // typeof instance.componentWillReceiveProps === 'function' &&
- // (oldProps !== newProps || oldContext !== newContext)
- // ) {
- // callComponentWillReceiveProps(
- // workInProgress,
- // instance,
- // newProps,
- // newContext,
- // );
- // }
-
- // // Process the update queue before calling shouldComponentUpdate
- // const updateQueue = workInProgress.updateQueue;
- // if (updateQueue !== null) {
- // newState = processUpdateQueue(
- // workInProgress,
- // updateQueue,
- // instance,
- // newState,
- // newProps,
- // priorityLevel,
- // );
- // }
-
- // // TODO: Should we deal with a setState that happened after the last
- // // componentWillMount and before this componentWillMount? Probably
- // // unsupported anyway.
-
- // if (
- // !checkShouldComponentUpdate(
- // workInProgress,
- // workInProgress.memoizedProps,
- // newProps,
- // workInProgress.memoizedState,
- // newState,
- // newContext,
- // )
- // ) {
- // // Update the existing instance's state, props, and context pointers even
- // // though we're bailing out.
- // instance.props = newProps;
- // instance.state = newState;
- // instance.context = newContext;
- // return false;
- // }
-
- // // Update the input pointers now so that they are correct when we call
- // // componentWillMount
- // instance.props = newProps;
- // instance.state = newState;
- // instance.context = newContext;
-
- // if (typeof instance.componentWillMount === 'function') {
- // callComponentWillMount(workInProgress, instance);
- // // componentWillMount may have called setState. Process the update queue.
- // const newUpdateQueue = workInProgress.updateQueue;
- // if (newUpdateQueue !== null) {
- // newState = processUpdateQueue(
- // workInProgress,
- // newUpdateQueue,
- // instance,
- // newState,
- // newProps,
- // priorityLevel,
- // );
- // }
- // }
-
- // if (typeof instance.componentDidMount === 'function') {
- // workInProgress.effectTag |= Update;
- // }
-
- // instance.state = newState;
-
- // return true;
- // }
-
- // Invokes the update life-cycles and returns false if it shouldn't rerender.
- function updateClassInstance(current, workInProgress, renderExpirationTime) {
- var instance = workInProgress.stateNode;
- resetInputPointers(workInProgress, instance);
-
- var oldProps = workInProgress.memoizedProps;
- var newProps = workInProgress.pendingProps;
- if (!newProps) {
- // If there aren't any new props, then we'll reuse the memoized props.
- // This could be from already completed work.
- newProps = oldProps;
- !(newProps != null) ? invariant(false, 'There should always be pending or memoized props. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- }
- var oldContext = instance.context;
- var newUnmaskedContext = getUnmaskedContext(workInProgress);
- var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
-
- // Note: During these life-cycles, instance.props/instance.state are what
- // ever the previously attempted to render - not the "current". However,
- // during componentDidUpdate we pass the "current" props.
-
- if (typeof instance.componentWillReceiveProps === 'function' && (oldProps !== newProps || oldContext !== newContext)) {
- callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
- }
-
- // Compute the next state using the memoized state and the update queue.
- var oldState = workInProgress.memoizedState;
- // TODO: Previous state can be null.
- var newState = void 0;
- if (workInProgress.updateQueue !== null) {
- newState = processUpdateQueue(current, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
- } else {
- newState = oldState;
- }
+ // Update the existing instance's state, props, and context pointers even
+ // if shouldComponentUpdate returns false.
+ instance.props = newProps;
+ instance.state = newState;
+ instance.context = nextLegacyContext;
- if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) {
- // If an update was already in progress, we should schedule an Update
- // effect even though we're bailing out, so that cWU/cDU are called.
- if (typeof instance.componentDidUpdate === 'function') {
- if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
- workInProgress.effectTag |= Update;
- }
- }
- return false;
+ return shouldUpdate;
+}
+
+// Invokes the update life-cycles and returns false if it shouldn't rerender.
+function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
+ var instance = workInProgress.stateNode;
+
+ var oldProps = workInProgress.memoizedProps;
+ instance.props = oldProps;
+
+ var oldContext = instance.context;
+ var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
+ var nextLegacyContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
+
+ var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
+ var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
+
+ // Note: During these life-cycles, instance.props/instance.state are what
+ // ever the previously attempted to render - not the "current". However,
+ // during componentDidUpdate we pass the "current" props.
+
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
+ if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
+ if (oldProps !== newProps || oldContext !== nextLegacyContext) {
+ callComponentWillReceiveProps(workInProgress, instance, newProps, nextLegacyContext);
}
+ }
- var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext);
+ resetHasForceUpdateBeforeProcessing();
- if (shouldUpdate) {
- if (typeof instance.componentWillUpdate === 'function') {
- startPhaseTimer(workInProgress, 'componentWillUpdate');
- instance.componentWillUpdate(newProps, newState, newContext);
- stopPhaseTimer();
+ var oldState = workInProgress.memoizedState;
+ var newState = instance.state = oldState;
+ var updateQueue = workInProgress.updateQueue;
+ if (updateQueue !== null) {
+ processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
+ newState = workInProgress.memoizedState;
+ }
- // Simulate an async bailout/interruption by invoking lifecycle twice.
- if (debugRenderPhaseSideEffects) {
- instance.componentWillUpdate(newProps, newState, newContext);
- }
- }
- if (typeof instance.componentDidUpdate === 'function') {
+ if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
+ // If an update was already in progress, we should schedule an Update
+ // effect even though we're bailing out, so that cWU/cDU are called.
+ if (typeof instance.componentDidUpdate === 'function') {
+ if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
workInProgress.effectTag |= Update;
}
- } else {
- // If an update was already in progress, we should schedule an Update
- // effect even though we're bailing out, so that cWU/cDU are called.
- if (typeof instance.componentDidUpdate === 'function') {
- if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
- workInProgress.effectTag |= Update;
- }
+ }
+ if (typeof instance.getSnapshotBeforeUpdate === 'function') {
+ if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
+ workInProgress.effectTag |= Snapshot;
}
-
- // If shouldComponentUpdate returned false, we should still update the
- // memoized props/state to indicate that this work can be reused.
- memoizeProps(workInProgress, newProps);
- memoizeState(workInProgress, newState);
}
+ return false;
+ }
- // Update the existing instance's state, props, and context pointers even
- // if shouldComponentUpdate returns false.
- instance.props = newProps;
- instance.state = newState;
- instance.context = newContext;
-
- return shouldUpdate;
+ if (typeof getDerivedStateFromProps === 'function') {
+ applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
+ newState = workInProgress.memoizedState;
}
- return {
- adoptClassInstance: adoptClassInstance,
- constructClassInstance: constructClassInstance,
- mountClassInstance: mountClassInstance,
- // resumeMountClassInstance,
- updateClassInstance: updateClassInstance
- };
-};
+ var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextLegacyContext);
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
+ if (shouldUpdate) {
+ // In order to support react-lifecycles-compat polyfilled components,
+ // Unsafe lifecycles should not be invoked for components using the new APIs.
+ if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
+ startPhaseTimer(workInProgress, 'componentWillUpdate');
+ if (typeof instance.componentWillUpdate === 'function') {
+ instance.componentWillUpdate(newProps, newState, nextLegacyContext);
+ }
+ if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
+ instance.UNSAFE_componentWillUpdate(newProps, newState, nextLegacyContext);
+ }
+ stopPhaseTimer();
+ }
+ if (typeof instance.componentDidUpdate === 'function') {
+ workInProgress.effectTag |= Update;
+ }
+ if (typeof instance.getSnapshotBeforeUpdate === 'function') {
+ workInProgress.effectTag |= Snapshot;
+ }
+ } else {
+ // If an update was already in progress, we should schedule an Update
+ // effect even though we're bailing out, so that cWU/cDU are called.
+ if (typeof instance.componentDidUpdate === 'function') {
+ if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
+ workInProgress.effectTag |= Update;
+ }
+ }
+ if (typeof instance.getSnapshotBeforeUpdate === 'function') {
+ if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
+ workInProgress.effectTag |= Snapshot;
+ }
+ }
-var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
-var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
-var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
-var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
-var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
+ // If shouldComponentUpdate returned false, we should still update the
+ // memoized props/state to indicate that this work can be reused.
+ workInProgress.memoizedProps = newProps;
+ workInProgress.memoizedState = newState;
+ }
-var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
-var FAUX_ITERATOR_SYMBOL = '@@iterator';
+ // Update the existing instance's state, props, and context pointers even
+ // if shouldComponentUpdate returns false.
+ instance.props = newProps;
+ instance.state = newState;
+ instance.context = nextLegacyContext;
-function getIteratorFn(maybeIterable) {
- if (maybeIterable === null || typeof maybeIterable === 'undefined') {
- return null;
- }
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
- if (typeof maybeIterator === 'function') {
- return maybeIterator;
- }
- return null;
+ return shouldUpdate;
}
-var getCurrentFiberStackAddendum$1 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
-
+var didWarnAboutMaps = void 0;
+var didWarnAboutGenerators = void 0;
+var didWarnAboutStringRefInStrictMode = void 0;
+var ownerHasKeyUseWarning = void 0;
+var ownerHasFunctionTypeWarning = void 0;
+var warnForMissingKey = function (child) {};
{
- var didWarnAboutMaps = false;
+ didWarnAboutMaps = false;
+ didWarnAboutGenerators = false;
+ didWarnAboutStringRefInStrictMode = {};
+
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
- var ownerHasKeyUseWarning = {};
- var ownerHasFunctionTypeWarning = {};
+ ownerHasKeyUseWarning = {};
+ ownerHasFunctionTypeWarning = {};
- var warnForMissingKey = function (child) {
+ warnForMissingKey = function (child) {
if (child === null || typeof child !== 'object') {
return;
}
@@ -6692,37 +12154,51 @@ var getCurrentFiberStackAddendum$1 = ReactDebugCurrentFiber.getCurrentFiberStack
!(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0;
child._store.validated = true;
- var currentComponentErrorInfo = 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + (getCurrentFiberStackAddendum$1() || '');
+ var currentComponentErrorInfo = 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
return;
}
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
- warning(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.%s', getCurrentFiberStackAddendum$1());
+ warning$1(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
};
}
var isArray$1 = Array.isArray;
-function coerceRef(current, element) {
+function coerceRef(returnFiber, current$$1, element) {
var mixedRef = element.ref;
- if (mixedRef !== null && typeof mixedRef !== 'function') {
+ if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
+ {
+ if (returnFiber.mode & StrictMode) {
+ var componentName = getComponentName(returnFiber.type) || 'Component';
+ if (!didWarnAboutStringRefInStrictMode[componentName]) {
+ warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackByFiberInDevAndProd(returnFiber));
+ didWarnAboutStringRefInStrictMode[componentName] = true;
+ }
+ }
+ }
+
if (element._owner) {
var owner = element._owner;
var inst = void 0;
if (owner) {
var ownerFiber = owner;
- !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0;
+ !(ownerFiber.tag === ClassComponent || ownerFiber.tag === ClassComponentLazy) ? invariant(false, 'Stateless function components cannot have refs.') : void 0;
inst = ownerFiber.stateNode;
}
!inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
var stringRef = '' + mixedRef;
// Check if previous string ref matches new string ref
- if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) {
- return current.ref;
+ if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
+ return current$$1.ref;
}
var ref = function (value) {
- var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
+ var refs = inst.refs;
+ if (refs === emptyRefsObject) {
+ // This is a lazy pooled frozen object, so we need to initialize.
+ refs = inst.refs = {};
+ }
if (value === null) {
delete refs[stringRef];
} else {
@@ -6732,8 +12208,8 @@ function coerceRef(current, element) {
ref._stringRef = stringRef;
return ref;
} else {
- !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0;
- !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. You may have multiple copies of React loaded. (details: https://fb.me/react-refs-must-have-owner).', mixedRef) : void 0;
+ !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
+ !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a functional component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0;
}
}
return mixedRef;
@@ -6743,21 +12219,21 @@ function throwOnInvalidObjectType(returnFiber, newChild) {
if (returnFiber.type !== 'textarea') {
var addendum = '';
{
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + (getCurrentFiberStackAddendum$1() || '');
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
}
invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum);
}
}
function warnOnFunctionType() {
- var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + (getCurrentFiberStackAddendum$1() || '');
+ var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
return;
}
ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
- warning(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.%s', getCurrentFiberStackAddendum$1() || '');
+ warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
}
// This wrapper function exists because I expect to clone the code in each path
@@ -6834,9 +12310,9 @@ function ChildReconciler(shouldTrackSideEffects) {
// Noop.
return lastPlacedIndex;
}
- var current = newFiber.alternate;
- if (current !== null) {
- var oldIndex = current.index;
+ var current$$1 = newFiber.alternate;
+ if (current$$1 !== null) {
+ var oldIndex = current$$1.index;
if (oldIndex < lastPlacedIndex) {
// This is a move.
newFiber.effectTag = Placement;
@@ -6861,26 +12337,26 @@ function ChildReconciler(shouldTrackSideEffects) {
return newFiber;
}
- function updateTextNode(returnFiber, current, textContent, expirationTime) {
- if (current === null || current.tag !== HostText) {
+ function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
+ if (current$$1 === null || current$$1.tag !== HostText) {
// Insert
- var created = createFiberFromText(textContent, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
+ var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
+ created.return = returnFiber;
return created;
} else {
// Update
- var existing = useFiber(current, textContent, expirationTime);
- existing['return'] = returnFiber;
+ var existing = useFiber(current$$1, textContent, expirationTime);
+ existing.return = returnFiber;
return existing;
}
}
- function updateElement(returnFiber, current, element, expirationTime) {
- if (current !== null && current.type === element.type) {
+ function updateElement(returnFiber, current$$1, element, expirationTime) {
+ if (current$$1 !== null && current$$1.type === element.type) {
// Move based on index
- var existing = useFiber(current, element.props, expirationTime);
- existing.ref = coerceRef(current, element);
- existing['return'] = returnFiber;
+ var existing = useFiber(current$$1, element.props, expirationTime);
+ existing.ref = coerceRef(returnFiber, current$$1, element);
+ existing.return = returnFiber;
{
existing._debugSource = element._source;
existing._debugOwner = element._owner;
@@ -6888,68 +12364,37 @@ function ChildReconciler(shouldTrackSideEffects) {
return existing;
} else {
// Insert
- var created = createFiberFromElement(element, returnFiber.internalContextTag, expirationTime);
- created.ref = coerceRef(current, element);
- created['return'] = returnFiber;
- return created;
- }
- }
-
- function updateCall(returnFiber, current, call, expirationTime) {
- // TODO: Should this also compare handler to determine whether to reuse?
- if (current === null || current.tag !== CallComponent) {
- // Insert
- var created = createFiberFromCall(call, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
- return created;
- } else {
- // Move based on index
- var existing = useFiber(current, call, expirationTime);
- existing['return'] = returnFiber;
- return existing;
- }
- }
-
- function updateReturn(returnFiber, current, returnNode, expirationTime) {
- if (current === null || current.tag !== ReturnComponent) {
- // Insert
- var created = createFiberFromReturn(returnNode, returnFiber.internalContextTag, expirationTime);
- created.type = returnNode.value;
- created['return'] = returnFiber;
+ var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
+ created.ref = coerceRef(returnFiber, current$$1, element);
+ created.return = returnFiber;
return created;
- } else {
- // Move based on index
- var existing = useFiber(current, null, expirationTime);
- existing.type = returnNode.value;
- existing['return'] = returnFiber;
- return existing;
}
}
- function updatePortal(returnFiber, current, portal, expirationTime) {
- if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
+ function updatePortal(returnFiber, current$$1, portal, expirationTime) {
+ if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
// Insert
- var created = createFiberFromPortal(portal, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
+ var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
+ created.return = returnFiber;
return created;
} else {
// Update
- var existing = useFiber(current, portal.children || [], expirationTime);
- existing['return'] = returnFiber;
+ var existing = useFiber(current$$1, portal.children || [], expirationTime);
+ existing.return = returnFiber;
return existing;
}
}
- function updateFragment(returnFiber, current, fragment, expirationTime, key) {
- if (current === null || current.tag !== Fragment) {
+ function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
+ if (current$$1 === null || current$$1.tag !== Fragment) {
// Insert
- var created = createFiberFromFragment(fragment, returnFiber.internalContextTag, expirationTime, key);
- created['return'] = returnFiber;
+ var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
+ created.return = returnFiber;
return created;
} else {
// Update
- var existing = useFiber(current, fragment, expirationTime);
- existing['return'] = returnFiber;
+ var existing = useFiber(current$$1, fragment, expirationTime);
+ existing.return = returnFiber;
return existing;
}
}
@@ -6959,8 +12404,8 @@ function ChildReconciler(shouldTrackSideEffects) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
- var created = createFiberFromText('' + newChild, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
+ var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
+ created.return = returnFiber;
return created;
}
@@ -6968,45 +12413,23 @@ function ChildReconciler(shouldTrackSideEffects) {
switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
{
- if (newChild.type === REACT_FRAGMENT_TYPE) {
- var _created = createFiberFromFragment(newChild.props.children, returnFiber.internalContextTag, expirationTime, newChild.key);
- _created['return'] = returnFiber;
- return _created;
- } else {
- var _created2 = createFiberFromElement(newChild, returnFiber.internalContextTag, expirationTime);
- _created2.ref = coerceRef(null, newChild);
- _created2['return'] = returnFiber;
- return _created2;
- }
+ var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
+ _created.ref = coerceRef(returnFiber, null, newChild);
+ _created.return = returnFiber;
+ return _created;
}
-
- case REACT_CALL_TYPE:
- {
- var _created3 = createFiberFromCall(newChild, returnFiber.internalContextTag, expirationTime);
- _created3['return'] = returnFiber;
- return _created3;
- }
-
- case REACT_RETURN_TYPE:
- {
- var _created4 = createFiberFromReturn(newChild, returnFiber.internalContextTag, expirationTime);
- _created4.type = newChild.value;
- _created4['return'] = returnFiber;
- return _created4;
- }
-
case REACT_PORTAL_TYPE:
{
- var _created5 = createFiberFromPortal(newChild, returnFiber.internalContextTag, expirationTime);
- _created5['return'] = returnFiber;
- return _created5;
+ var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
+ _created2.return = returnFiber;
+ return _created2;
}
}
if (isArray$1(newChild) || getIteratorFn(newChild)) {
- var _created6 = createFiberFromFragment(newChild, returnFiber.internalContextTag, expirationTime, null);
- _created6['return'] = returnFiber;
- return _created6;
+ var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
+ _created3.return = returnFiber;
+ return _created3;
}
throwOnInvalidObjectType(returnFiber, newChild);
@@ -7049,28 +12472,6 @@ function ChildReconciler(shouldTrackSideEffects) {
return null;
}
}
-
- case REACT_CALL_TYPE:
- {
- if (newChild.key === key) {
- return updateCall(returnFiber, oldFiber, newChild, expirationTime);
- } else {
- return null;
- }
- }
-
- case REACT_RETURN_TYPE:
- {
- // Returns don't have keys. If the previous node is implicitly keyed
- // we can continue to replace it without aborting even if it is not a
- // yield.
- if (key === null) {
- return updateReturn(returnFiber, oldFiber, newChild, expirationTime);
- } else {
- return null;
- }
- }
-
case REACT_PORTAL_TYPE:
{
if (newChild.key === key) {
@@ -7119,31 +12520,16 @@ function ChildReconciler(shouldTrackSideEffects) {
}
return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
}
-
- case REACT_CALL_TYPE:
- {
- var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
- return updateCall(returnFiber, _matchedFiber2, newChild, expirationTime);
- }
-
- case REACT_RETURN_TYPE:
- {
- // Returns don't have keys, so we neither have to check the old nor
- // new node for the key. If both are returns, they match.
- var _matchedFiber3 = existingChildren.get(newIdx) || null;
- return updateReturn(returnFiber, _matchedFiber3, newChild, expirationTime);
- }
-
case REACT_PORTAL_TYPE:
{
- var _matchedFiber4 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
- return updatePortal(returnFiber, _matchedFiber4, newChild, expirationTime);
+ var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
+ return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
}
}
if (isArray$1(newChild) || getIteratorFn(newChild)) {
- var _matchedFiber5 = existingChildren.get(newIdx) || null;
- return updateFragment(returnFiber, _matchedFiber5, newChild, expirationTime, null);
+ var _matchedFiber3 = existingChildren.get(newIdx) || null;
+ return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
}
throwOnInvalidObjectType(returnFiber, newChild);
@@ -7168,7 +12554,6 @@ function ChildReconciler(shouldTrackSideEffects) {
}
switch (child.$$typeof) {
case REACT_ELEMENT_TYPE:
- case REACT_CALL_TYPE:
case REACT_PORTAL_TYPE:
warnForMissingKey(child);
var key = child.key;
@@ -7184,7 +12569,7 @@ function ChildReconciler(shouldTrackSideEffects) {
knownKeys.add(key);
break;
}
- warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$1());
+ warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
break;
default:
break;
@@ -7308,7 +12693,7 @@ function ChildReconciler(shouldTrackSideEffects) {
// current, that means that we reused the fiber. We need to delete
// it from the child list so that we don't add it to the deletion
// list.
- existingChildren['delete'](_newFiber2.key === null ? newIdx : _newFiber2.key);
+ existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
}
}
lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
@@ -7340,13 +12725,19 @@ function ChildReconciler(shouldTrackSideEffects) {
!(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0;
{
+ // We don't support rendering Generators because it's a mutation.
+ // See https://github.com/facebook/react/issues/12995
+ if (typeof Symbol === 'function' &&
+ // $FlowFixMe Flow doesn't know about toStringTag
+ newChildrenIterable[Symbol.toStringTag] === 'Generator') {
+ !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
+ didWarnAboutGenerators = true;
+ }
+
// Warn about using Maps as children
- if (typeof newChildrenIterable.entries === 'function') {
- var possibleMap = newChildrenIterable;
- if (possibleMap.entries === iteratorFn) {
- warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$1());
- didWarnAboutMaps = true;
- }
+ if (newChildrenIterable.entries === iteratorFn) {
+ !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
+ didWarnAboutMaps = true;
}
// First, validate keys.
@@ -7453,7 +12844,7 @@ function ChildReconciler(shouldTrackSideEffects) {
// current, that means that we reused the fiber. We need to delete
// it from the child list so that we don't add it to the deletion
// list.
- existingChildren['delete'](_newFiber4.key === null ? newIdx : _newFiber4.key);
+ existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
}
}
lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
@@ -7485,14 +12876,14 @@ function ChildReconciler(shouldTrackSideEffects) {
// the rest.
deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
var existing = useFiber(currentFirstChild, textContent, expirationTime);
- existing['return'] = returnFiber;
+ existing.return = returnFiber;
return existing;
}
// The existing first child is not a text node so we need to create one
// and delete the existing ones.
deleteRemainingChildren(returnFiber, currentFirstChild);
- var created = createFiberFromText(textContent, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
+ var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
+ created.return = returnFiber;
return created;
}
@@ -7506,8 +12897,8 @@ function ChildReconciler(shouldTrackSideEffects) {
if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {
deleteRemainingChildren(returnFiber, child.sibling);
var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
- existing.ref = coerceRef(child, element);
- existing['return'] = returnFiber;
+ existing.ref = coerceRef(returnFiber, child, element);
+ existing.return = returnFiber;
{
existing._debugSource = element._source;
existing._debugOwner = element._owner;
@@ -7524,63 +12915,15 @@ function ChildReconciler(shouldTrackSideEffects) {
}
if (element.type === REACT_FRAGMENT_TYPE) {
- var created = createFiberFromFragment(element.props.children, returnFiber.internalContextTag, expirationTime, element.key);
- created['return'] = returnFiber;
+ var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
+ created.return = returnFiber;
return created;
} else {
- var _created7 = createFiberFromElement(element, returnFiber.internalContextTag, expirationTime);
- _created7.ref = coerceRef(currentFirstChild, element);
- _created7['return'] = returnFiber;
- return _created7;
- }
- }
-
- function reconcileSingleCall(returnFiber, currentFirstChild, call, expirationTime) {
- var key = call.key;
- var child = currentFirstChild;
- while (child !== null) {
- // TODO: If key === null and child.key === null, then this only applies to
- // the first item in the list.
- if (child.key === key) {
- if (child.tag === CallComponent) {
- deleteRemainingChildren(returnFiber, child.sibling);
- var existing = useFiber(child, call, expirationTime);
- existing['return'] = returnFiber;
- return existing;
- } else {
- deleteRemainingChildren(returnFiber, child);
- break;
- }
- } else {
- deleteChild(returnFiber, child);
- }
- child = child.sibling;
+ var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
+ _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
+ _created4.return = returnFiber;
+ return _created4;
}
-
- var created = createFiberFromCall(call, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
- return created;
- }
-
- function reconcileSingleReturn(returnFiber, currentFirstChild, returnNode, expirationTime) {
- // There's no need to check for keys on yields since they're stateless.
- var child = currentFirstChild;
- if (child !== null) {
- if (child.tag === ReturnComponent) {
- deleteRemainingChildren(returnFiber, child.sibling);
- var existing = useFiber(child, null, expirationTime);
- existing.type = returnNode.value;
- existing['return'] = returnFiber;
- return existing;
- } else {
- deleteRemainingChildren(returnFiber, child);
- }
- }
-
- var created = createFiberFromReturn(returnNode, returnFiber.internalContextTag, expirationTime);
- created.type = returnNode.value;
- created['return'] = returnFiber;
- return created;
}
function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
@@ -7593,7 +12936,7 @@ function ChildReconciler(shouldTrackSideEffects) {
if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
deleteRemainingChildren(returnFiber, child.sibling);
var existing = useFiber(child, portal.children || [], expirationTime);
- existing['return'] = returnFiber;
+ existing.return = returnFiber;
return existing;
} else {
deleteRemainingChildren(returnFiber, child);
@@ -7605,8 +12948,8 @@ function ChildReconciler(shouldTrackSideEffects) {
child = child.sibling;
}
- var created = createFiberFromPortal(portal, returnFiber.internalContextTag, expirationTime);
- created['return'] = returnFiber;
+ var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
+ created.return = returnFiber;
return created;
}
@@ -7622,7 +12965,8 @@ function ChildReconciler(shouldTrackSideEffects) {
// Handle top level unkeyed fragments as if they were arrays.
// This leads to an ambiguity between <>{[...]}</> and <>...</>.
// We treat the ambiguous cases above the same.
- if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) {
+ var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
+ if (isUnkeyedTopLevelFragment) {
newChild = newChild.props.children;
}
@@ -7633,11 +12977,6 @@ function ChildReconciler(shouldTrackSideEffects) {
switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
-
- case REACT_CALL_TYPE:
- return placeSingleChild(reconcileSingleCall(returnFiber, currentFirstChild, newChild, expirationTime));
- case REACT_RETURN_TYPE:
- return placeSingleChild(reconcileSingleReturn(returnFiber, currentFirstChild, newChild, expirationTime));
case REACT_PORTAL_TYPE:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
}
@@ -7664,12 +13003,13 @@ function ChildReconciler(shouldTrackSideEffects) {
warnOnFunctionType();
}
}
- if (typeof newChild === 'undefined') {
+ if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
// If the new child is undefined, and the return fiber is a composite
// component, throw an error. If Fiber return types are disabled,
// we already threw above.
switch (returnFiber.tag) {
case ClassComponent:
+ case ClassComponentLazy:
{
{
var instance = returnFiber.stateNode;
@@ -7700,8 +13040,8 @@ function ChildReconciler(shouldTrackSideEffects) {
var reconcileChildFibers = ChildReconciler(true);
var mountChildFibers = ChildReconciler(false);
-function cloneChildFibers(current, workInProgress) {
- !(current === null || workInProgress.child === current.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
+function cloneChildFibers(current$$1, workInProgress) {
+ !(current$$1 === null || workInProgress.child === current$$1.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
if (workInProgress.child === null) {
return;
@@ -7711,435 +13051,908 @@ function cloneChildFibers(current, workInProgress) {
var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
workInProgress.child = newChild;
- newChild['return'] = workInProgress;
+ newChild.return = workInProgress;
while (currentChild.sibling !== null) {
currentChild = currentChild.sibling;
newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
- newChild['return'] = workInProgress;
+ newChild.return = workInProgress;
}
newChild.sibling = null;
}
-{
- var warnedAboutStatelessRefs = {};
-}
+// The deepest Fiber on the stack involved in a hydration context.
+// This may have been an insertion or a hydration.
+var hydrationParentFiber = null;
+var nextHydratableInstance = null;
+var isHydrating = false;
+
+function enterHydrationState(fiber) {
+ if (!supportsHydration) {
+ return false;
+ }
-var ReactFiberBeginWork = function (config, hostContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
- var shouldSetTextContent = config.shouldSetTextContent,
- useSyncScheduling = config.useSyncScheduling,
- shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
- var pushHostContext = hostContext.pushHostContext,
- pushHostContainer = hostContext.pushHostContainer;
- var enterHydrationState = hydrationContext.enterHydrationState,
- resetHydrationState = hydrationContext.resetHydrationState,
- tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
+ var parentInstance = fiber.stateNode.containerInfo;
+ nextHydratableInstance = getFirstHydratableChild(parentInstance);
+ hydrationParentFiber = fiber;
+ isHydrating = true;
+ return true;
+}
- var _ReactFiberClassCompo = ReactFiberClassComponent(scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
- adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
- constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
- mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
- updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
+function deleteHydratableInstance(returnFiber, instance) {
+ {
+ switch (returnFiber.tag) {
+ case HostRoot:
+ didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
+ break;
+ case HostComponent:
+ didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
+ break;
+ }
+ }
- // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
+ var childToDelete = createFiberFromHostInstanceForDeletion();
+ childToDelete.stateNode = instance;
+ childToDelete.return = returnFiber;
+ childToDelete.effectTag = Deletion;
+ // This might seem like it belongs on progressedFirstDeletion. However,
+ // these children are not part of the reconciliation list of children.
+ // Even if we abort and rereconcile the children, that will try to hydrate
+ // again and the nodes are still in the host tree so these will be
+ // recreated.
+ if (returnFiber.lastEffect !== null) {
+ returnFiber.lastEffect.nextEffect = childToDelete;
+ returnFiber.lastEffect = childToDelete;
+ } else {
+ returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
+ }
+}
- function reconcileChildren(current, workInProgress, nextChildren) {
- reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
+function insertNonHydratedInstance(returnFiber, fiber) {
+ fiber.effectTag |= Placement;
+ {
+ switch (returnFiber.tag) {
+ case HostRoot:
+ {
+ var parentContainer = returnFiber.stateNode.containerInfo;
+ switch (fiber.tag) {
+ case HostComponent:
+ var type = fiber.type;
+ var props = fiber.pendingProps;
+ didNotFindHydratableContainerInstance(parentContainer, type, props);
+ break;
+ case HostText:
+ var text = fiber.pendingProps;
+ didNotFindHydratableContainerTextInstance(parentContainer, text);
+ break;
+ }
+ break;
+ }
+ case HostComponent:
+ {
+ var parentType = returnFiber.type;
+ var parentProps = returnFiber.memoizedProps;
+ var parentInstance = returnFiber.stateNode;
+ switch (fiber.tag) {
+ case HostComponent:
+ var _type = fiber.type;
+ var _props = fiber.pendingProps;
+ didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
+ break;
+ case HostText:
+ var _text = fiber.pendingProps;
+ didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
+ break;
+ }
+ break;
+ }
+ default:
+ return;
+ }
}
+}
- function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
- if (current === null) {
- // If this is a fresh new component that hasn't been rendered yet, we
- // won't update its child set by applying minimal side-effects. Instead,
- // we will add them all to the child before it gets rendered. That means
- // we can optimize this reconciliation pass by not tracking side-effects.
- workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
- } else {
- // If the current child is the same as the work in progress, it means that
- // we haven't yet started any work on these children. Therefore, we use
- // the clone algorithm to create a copy of all the current children.
+function tryHydrate(fiber, nextInstance) {
+ switch (fiber.tag) {
+ case HostComponent:
+ {
+ var type = fiber.type;
+ var props = fiber.pendingProps;
+ var instance = canHydrateInstance(nextInstance, type, props);
+ if (instance !== null) {
+ fiber.stateNode = instance;
+ return true;
+ }
+ return false;
+ }
+ case HostText:
+ {
+ var text = fiber.pendingProps;
+ var textInstance = canHydrateTextInstance(nextInstance, text);
+ if (textInstance !== null) {
+ fiber.stateNode = textInstance;
+ return true;
+ }
+ return false;
+ }
+ default:
+ return false;
+ }
+}
- // If we had any progressed work already, that is invalid at this point so
- // let's throw it out.
- workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
+function tryToClaimNextHydratableInstance(fiber) {
+ if (!isHydrating) {
+ return;
+ }
+ var nextInstance = nextHydratableInstance;
+ if (!nextInstance) {
+ // Nothing to hydrate. Make it an insertion.
+ insertNonHydratedInstance(hydrationParentFiber, fiber);
+ isHydrating = false;
+ hydrationParentFiber = fiber;
+ return;
+ }
+ var firstAttemptedInstance = nextInstance;
+ if (!tryHydrate(fiber, nextInstance)) {
+ // If we can't hydrate this instance let's try the next one.
+ // We use this as a heuristic. It's based on intuition and not data so it
+ // might be flawed or unnecessary.
+ nextInstance = getNextHydratableSibling(firstAttemptedInstance);
+ if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
+ // Nothing to hydrate. Make it an insertion.
+ insertNonHydratedInstance(hydrationParentFiber, fiber);
+ isHydrating = false;
+ hydrationParentFiber = fiber;
+ return;
}
+ // We matched the next one, we'll now assume that the first one was
+ // superfluous and we'll delete it. Since we can't eagerly delete it
+ // we'll have to schedule a deletion. To do that, this node needs a dummy
+ // fiber associated with it.
+ deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
+ }
+ hydrationParentFiber = fiber;
+ nextHydratableInstance = getFirstHydratableChild(nextInstance);
+}
+
+function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
+ if (!supportsHydration) {
+ invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
+ }
+
+ var instance = fiber.stateNode;
+ var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
+ // TODO: Type this specific to this type of component.
+ fiber.updateQueue = updatePayload;
+ // If the update payload indicates that there is a change or if there
+ // is a new ref we mark this as an update.
+ if (updatePayload !== null) {
+ return true;
+ }
+ return false;
+}
+
+function prepareToHydrateHostTextInstance(fiber) {
+ if (!supportsHydration) {
+ invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
}
- function updateFragment(current, workInProgress) {
- var nextChildren = workInProgress.pendingProps;
- if (hasContextChanged()) {
- // Normally we can bail out on props equality but if context has changed
- // we don't do the bailout and we have to reuse existing props instead.
- if (nextChildren === null) {
- nextChildren = workInProgress.memoizedProps;
+ var textInstance = fiber.stateNode;
+ var textContent = fiber.memoizedProps;
+ var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
+ {
+ if (shouldUpdate) {
+ // We assume that prepareToHydrateHostTextInstance is called in a context where the
+ // hydration parent is the parent host component of this host text.
+ var returnFiber = hydrationParentFiber;
+ if (returnFiber !== null) {
+ switch (returnFiber.tag) {
+ case HostRoot:
+ {
+ var parentContainer = returnFiber.stateNode.containerInfo;
+ didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
+ break;
+ }
+ case HostComponent:
+ {
+ var parentType = returnFiber.type;
+ var parentProps = returnFiber.memoizedProps;
+ var parentInstance = returnFiber.stateNode;
+ didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
+ break;
+ }
+ }
}
- } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
- reconcileChildren(current, workInProgress, nextChildren);
- memoizeProps(workInProgress, nextChildren);
- return workInProgress.child;
+ }
+ return shouldUpdate;
+}
+
+function popToNextHostParent(fiber) {
+ var parent = fiber.return;
+ while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
+ parent = parent.return;
+ }
+ hydrationParentFiber = parent;
+}
+
+function popHydrationState(fiber) {
+ if (!supportsHydration) {
+ return false;
+ }
+ if (fiber !== hydrationParentFiber) {
+ // We're deeper than the current hydration context, inside an inserted
+ // tree.
+ return false;
+ }
+ if (!isHydrating) {
+ // If we're not currently hydrating but we're in a hydration context, then
+ // we were an insertion and now need to pop up reenter hydration of our
+ // siblings.
+ popToNextHostParent(fiber);
+ isHydrating = true;
+ return false;
}
- function markRef(current, workInProgress) {
- var ref = workInProgress.ref;
- if (ref !== null && (!current || current.ref !== ref)) {
- // Schedule a Ref effect
- workInProgress.effectTag |= Ref;
+ var type = fiber.type;
+
+ // If we have any remaining hydratable nodes, we need to delete them now.
+ // We only do this deeper than head and body since they tend to have random
+ // other nodes in them. We also ignore components with pure text content in
+ // side of them.
+ // TODO: Better heuristic.
+ if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
+ var nextInstance = nextHydratableInstance;
+ while (nextInstance) {
+ deleteHydratableInstance(fiber, nextInstance);
+ nextInstance = getNextHydratableSibling(nextInstance);
}
}
- function updateFunctionalComponent(current, workInProgress) {
- var fn = workInProgress.type;
- var nextProps = workInProgress.pendingProps;
+ popToNextHostParent(fiber);
+ nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
+ return true;
+}
- var memoizedProps = workInProgress.memoizedProps;
- if (hasContextChanged()) {
- // Normally we can bail out on props equality but if context has changed
- // we don't do the bailout and we have to reuse existing props instead.
- if (nextProps === null) {
- nextProps = memoizedProps;
- }
- } else {
- if (nextProps === null || memoizedProps === nextProps) {
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
+function resetHydrationState() {
+ if (!supportsHydration) {
+ return;
+ }
+
+ hydrationParentFiber = null;
+ nextHydratableInstance = null;
+ isHydrating = false;
+}
+
+function readLazyComponentType(thenable) {
+ var status = thenable._reactStatus;
+ switch (status) {
+ case Resolved:
+ var Component = thenable._reactResult;
+ return Component;
+ case Rejected:
+ throw thenable._reactResult;
+ case Pending:
+ throw thenable;
+ default:
+ {
+ thenable._reactStatus = Pending;
+ thenable.then(function (resolvedValue) {
+ if (thenable._reactStatus === Pending) {
+ thenable._reactStatus = Resolved;
+ if (typeof resolvedValue === 'object' && resolvedValue !== null) {
+ // If the `default` property is not empty, assume it's the result
+ // of an async import() and use that. Otherwise, use the
+ // resolved value itself.
+ var defaultExport = resolvedValue.default;
+ resolvedValue = defaultExport !== undefined && defaultExport !== null ? defaultExport : resolvedValue;
+ } else {
+ resolvedValue = resolvedValue;
+ }
+ thenable._reactResult = resolvedValue;
+ }
+ }, function (error) {
+ if (thenable._reactStatus === Pending) {
+ thenable._reactStatus = Rejected;
+ thenable._reactResult = error;
+ }
+ });
+ throw thenable;
}
- // TODO: consider bringing fn.shouldComponentUpdate() back.
- // It used to be here.
+ }
+}
+
+var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
+
+var didWarnAboutBadClass = void 0;
+var didWarnAboutGetDerivedStateOnFunctionalComponent = void 0;
+var didWarnAboutStatelessRefs = void 0;
+
+{
+ didWarnAboutBadClass = {};
+ didWarnAboutGetDerivedStateOnFunctionalComponent = {};
+ didWarnAboutStatelessRefs = {};
+}
+
+function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
+ if (current$$1 === null) {
+ // If this is a fresh new component that hasn't been rendered yet, we
+ // won't update its child set by applying minimal side-effects. Instead,
+ // we will add them all to the child before it gets rendered. That means
+ // we can optimize this reconciliation pass by not tracking side-effects.
+ workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
+ } else {
+ // If the current child is the same as the work in progress, it means that
+ // we haven't yet started any work on these children. Therefore, we use
+ // the clone algorithm to create a copy of all the current children.
+
+ // If we had any progressed work already, that is invalid at this point so
+ // let's throw it out.
+ workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
+ }
+}
+
+function updateForwardRef(current$$1, workInProgress, type, nextProps, renderExpirationTime) {
+ var render = type.render;
+ var ref = workInProgress.ref;
+ if (hasContextChanged()) {
+ // Normally we can bail out on props equality but if context has changed
+ // we don't do the bailout and we have to reuse existing props instead.
+ } else if (workInProgress.memoizedProps === nextProps) {
+ var currentRef = current$$1 !== null ? current$$1.ref : null;
+ if (ref === currentRef) {
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
}
+ }
- var unmaskedContext = getUnmaskedContext(workInProgress);
- var context = getMaskedContext(workInProgress, unmaskedContext);
+ var nextChildren = void 0;
+ {
+ ReactCurrentOwner$3.current = workInProgress;
+ setCurrentPhase('render');
+ nextChildren = render(nextProps, ref);
+ setCurrentPhase(null);
+ }
- var nextChildren;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextProps);
+ return workInProgress.child;
+}
- {
- ReactCurrentOwner.current = workInProgress;
- ReactDebugCurrentFiber.setCurrentPhase('render');
- nextChildren = fn(nextProps, context);
- ReactDebugCurrentFiber.setCurrentPhase(null);
- }
- // React DevTools reads this flag.
- workInProgress.effectTag |= PerformedWork;
- reconcileChildren(current, workInProgress, nextChildren);
- memoizeProps(workInProgress, nextProps);
- return workInProgress.child;
+function updateFragment(current$$1, workInProgress, renderExpirationTime) {
+ var nextChildren = workInProgress.pendingProps;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextChildren);
+ return workInProgress.child;
+}
+
+function updateMode(current$$1, workInProgress, renderExpirationTime) {
+ var nextChildren = workInProgress.pendingProps.children;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextChildren);
+ return workInProgress.child;
+}
+
+function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
+ if (enableProfilerTimer) {
+ workInProgress.effectTag |= Update;
}
+ var nextProps = workInProgress.pendingProps;
+ var nextChildren = nextProps.children;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextProps);
+ return workInProgress.child;
+}
- function updateClassComponent(current, workInProgress, renderExpirationTime) {
- // Push context providers early to prevent context stack mismatches.
- // During mounting we don't know the child context yet as the instance doesn't exist.
- // We will invalidate the child context in finishClassComponent() right after rendering.
- var hasContext = pushContextProvider(workInProgress);
+function markRef(current$$1, workInProgress) {
+ var ref = workInProgress.ref;
+ if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
+ // Schedule a Ref effect
+ workInProgress.effectTag |= Ref;
+ }
+}
- var shouldUpdate = void 0;
- if (current === null) {
- if (!workInProgress.stateNode) {
- // In the initial pass we might need to construct the instance.
- constructClassInstance(workInProgress, workInProgress.pendingProps);
- mountClassInstance(workInProgress, renderExpirationTime);
- shouldUpdate = true;
- } else {
- invariant(false, 'Resuming work not yet implemented.');
- // In a resume, we'll already have an instance we can reuse.
- // shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
- }
+function updateFunctionalComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
+ var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
+ var context = getMaskedContext(workInProgress, unmaskedContext);
+
+ var nextChildren = void 0;
+ prepareToReadContext(workInProgress, renderExpirationTime);
+ {
+ ReactCurrentOwner$3.current = workInProgress;
+ setCurrentPhase('render');
+ nextChildren = Component(nextProps, context);
+ setCurrentPhase(null);
+ }
+
+ // React DevTools reads this flag.
+ workInProgress.effectTag |= PerformedWork;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextProps);
+ return workInProgress.child;
+}
+
+function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
+ // Push context providers early to prevent context stack mismatches.
+ // During mounting we don't know the child context yet as the instance doesn't exist.
+ // We will invalidate the child context in finishClassComponent() right after rendering.
+ var hasContext = void 0;
+ if (isContextProvider(Component)) {
+ hasContext = true;
+ pushContextProvider(workInProgress);
+ } else {
+ hasContext = false;
+ }
+ prepareToReadContext(workInProgress, renderExpirationTime);
+
+ var shouldUpdate = void 0;
+ if (current$$1 === null) {
+ if (workInProgress.stateNode === null) {
+ // In the initial pass we might need to construct the instance.
+ constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
+ mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
+ shouldUpdate = true;
} else {
- shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
+ // In a resume, we'll already have an instance we can reuse.
+ shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
}
- return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);
+ } else {
+ shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
}
+ return finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
+}
- function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {
- // Refs should update even if shouldComponentUpdate returns false
- markRef(current, workInProgress);
+function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
+ // Refs should update even if shouldComponentUpdate returns false
+ markRef(current$$1, workInProgress);
- if (!shouldUpdate) {
- // Context providers should defer to sCU for rendering
- if (hasContext) {
- invalidateContextProvider(workInProgress, false);
- }
+ var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
+ if (!shouldUpdate && !didCaptureError) {
+ // Context providers should defer to sCU for rendering
+ if (hasContext) {
+ invalidateContextProvider(workInProgress, Component, false);
}
- var instance = workInProgress.stateNode;
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
+ }
- // Rerender
- ReactCurrentOwner.current = workInProgress;
- var nextChildren = void 0;
+ var instance = workInProgress.stateNode;
+
+ // Rerender
+ ReactCurrentOwner$3.current = workInProgress;
+ var nextChildren = void 0;
+ if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof Component.getDerivedStateFromCatch !== 'function')) {
+ // If we captured an error, but getDerivedStateFrom catch is not defined,
+ // unmount all the children. componentDidCatch will schedule an update to
+ // re-render a fallback. This is temporary until we migrate everyone to
+ // the new API.
+ // TODO: Warn in a future release.
+ nextChildren = null;
+
+ if (enableProfilerTimer) {
+ stopProfilerTimerIfRunning(workInProgress);
+ }
+ } else {
{
- ReactDebugCurrentFiber.setCurrentPhase('render');
+ setCurrentPhase('render');
nextChildren = instance.render();
- if (debugRenderPhaseSideEffects) {
+ if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
instance.render();
}
- ReactDebugCurrentFiber.setCurrentPhase(null);
- }
- // React DevTools reads this flag.
- workInProgress.effectTag |= PerformedWork;
- reconcileChildren(current, workInProgress, nextChildren);
- // Memoize props and state using the values we just used to render.
- // TODO: Restructure so we never read values from the instance.
- memoizeState(workInProgress, instance.state);
- memoizeProps(workInProgress, instance.props);
+ setCurrentPhase(null);
+ }
+ }
+
+ // React DevTools reads this flag.
+ workInProgress.effectTag |= PerformedWork;
+ if (current$$1 !== null && didCaptureError) {
+ // If we're recovering from an error, reconcile twice: first to delete
+ // all the existing children.
+ reconcileChildren(current$$1, workInProgress, null, renderExpirationTime);
+ workInProgress.child = null;
+ // Now we can continue reconciling like normal. This has the effect of
+ // remounting all children regardless of whether their their
+ // identity matches.
+ }
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ // Memoize props and state using the values we just used to render.
+ // TODO: Restructure so we never read values from the instance.
+ memoizeState(workInProgress, instance.state);
+ memoizeProps(workInProgress, instance.props);
+
+ // The context might have changed so we need to recalculate it.
+ if (hasContext) {
+ invalidateContextProvider(workInProgress, Component, true);
+ }
+
+ return workInProgress.child;
+}
+
+function pushHostRootContext(workInProgress) {
+ var root = workInProgress.stateNode;
+ if (root.pendingContext) {
+ pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
+ } else if (root.context) {
+ // Should always be set
+ pushTopLevelContextObject(workInProgress, root.context, false);
+ }
+ pushHostContainer(workInProgress, root.containerInfo);
+}
+
+function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
+ pushHostRootContext(workInProgress);
+ var updateQueue = workInProgress.updateQueue;
+ !(updateQueue !== null) ? invariant(false, 'If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var nextProps = workInProgress.pendingProps;
+ var prevState = workInProgress.memoizedState;
+ var prevChildren = prevState !== null ? prevState.element : null;
+ processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
+ var nextState = workInProgress.memoizedState;
+ // Caution: React DevTools currently depends on this property
+ // being called "element".
+ var nextChildren = nextState.element;
+ if (nextChildren === prevChildren) {
+ // If the state is the same as before, that's a bailout because we had
+ // no work that expires at this time.
+ resetHydrationState();
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
+ }
+ var root = workInProgress.stateNode;
+ if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
+ // If we don't have any current children this might be the first pass.
+ // We always try to hydrate. If this isn't a hydration pass there won't
+ // be any children to hydrate which is effectively the same thing as
+ // not hydrating.
+
+ // This is a bit of a hack. We track the host root as a placement to
+ // know that we're currently in a mounting state. That way isMounted
+ // works as expected. We must reset this before committing.
+ // TODO: Delete this when we delete isMounted and findDOMNode.
+ workInProgress.effectTag |= Placement;
+
+ // Ensure that children mount into this root without tracking
+ // side-effects. This ensures that we don't store Placement effects on
+ // nodes that will be hydrated.
+ workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
+ } else {
+ // Otherwise reset hydration state in case we aborted and resumed another
+ // root.
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ resetHydrationState();
+ }
+ return workInProgress.child;
+}
- // The context might have changed so we need to recalculate it.
- if (hasContext) {
- invalidateContextProvider(workInProgress, true);
- }
+function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
+ pushHostContext(workInProgress);
- return workInProgress.child;
+ if (current$$1 === null) {
+ tryToClaimNextHydratableInstance(workInProgress);
}
- function pushHostRootContext(workInProgress) {
- var root = workInProgress.stateNode;
- if (root.pendingContext) {
- pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
- } else if (root.context) {
- // Should always be set
- pushTopLevelContextObject(workInProgress, root.context, false);
- }
- pushHostContainer(workInProgress, root.containerInfo);
+ var type = workInProgress.type;
+ var nextProps = workInProgress.pendingProps;
+ var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
+
+ var nextChildren = nextProps.children;
+ var isDirectTextChild = shouldSetTextContent(type, nextProps);
+
+ if (isDirectTextChild) {
+ // We special case a direct text child of a host node. This is a common
+ // case. We won't handle it as a reified child. We will instead handle
+ // this in the host environment that also have access to this prop. That
+ // avoids allocating another HostText fiber and traversing it.
+ nextChildren = null;
+ } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
+ // If we're switching from a direct text child to a normal child, or to
+ // empty, we need to schedule the text content to be reset.
+ workInProgress.effectTag |= ContentReset;
+ }
+
+ markRef(current$$1, workInProgress);
+
+ // Check the host config to see if the children are offscreen/hidden.
+ if (renderExpirationTime !== Never && workInProgress.mode & AsyncMode && shouldDeprioritizeSubtree(type, nextProps)) {
+ // Schedule this fiber to re-render at offscreen priority. Then bailout.
+ workInProgress.expirationTime = Never;
+ workInProgress.memoizedProps = nextProps;
+ return null;
}
- function updateHostRoot(current, workInProgress, renderExpirationTime) {
- pushHostRootContext(workInProgress);
- var updateQueue = workInProgress.updateQueue;
- if (updateQueue !== null) {
- var prevState = workInProgress.memoizedState;
- var state = processUpdateQueue(current, workInProgress, updateQueue, null, null, renderExpirationTime);
- if (prevState === state) {
- // If the state is the same as before, that's a bailout because we had
- // no work that expires at this time.
- resetHydrationState();
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
- }
- var element = state.element;
- var root = workInProgress.stateNode;
- if ((current === null || current.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
- // If we don't have any current children this might be the first pass.
- // We always try to hydrate. If this isn't a hydration pass there won't
- // be any children to hydrate which is effectively the same thing as
- // not hydrating.
-
- // This is a bit of a hack. We track the host root as a placement to
- // know that we're currently in a mounting state. That way isMounted
- // works as expected. We must reset this before committing.
- // TODO: Delete this when we delete isMounted and findDOMNode.
- workInProgress.effectTag |= Placement;
-
- // Ensure that children mount into this root without tracking
- // side-effects. This ensures that we don't store Placement effects on
- // nodes that will be hydrated.
- workInProgress.child = mountChildFibers(workInProgress, null, element, renderExpirationTime);
- } else {
- // Otherwise reset hydration state in case we aborted and resumed another
- // root.
- resetHydrationState();
- reconcileChildren(current, workInProgress, element);
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextProps);
+ return workInProgress.child;
+}
+
+function updateHostText(current$$1, workInProgress) {
+ if (current$$1 === null) {
+ tryToClaimNextHydratableInstance(workInProgress);
+ }
+ var nextProps = workInProgress.pendingProps;
+ memoizeProps(workInProgress, nextProps);
+ // Nothing to do here. This is terminal. We'll do the completion step
+ // immediately after.
+ return null;
+}
+
+function resolveDefaultProps(Component, baseProps) {
+ if (Component && Component.defaultProps) {
+ // Resolve default props. Taken from ReactElement
+ var props = _assign({}, baseProps);
+ var defaultProps = Component.defaultProps;
+ for (var propName in defaultProps) {
+ if (props[propName] === undefined) {
+ props[propName] = defaultProps[propName];
}
- memoizeState(workInProgress, state);
- return workInProgress.child;
}
- resetHydrationState();
- // If there is no update queue, that's a bailout because the root has no props.
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
+ return props;
}
+ return baseProps;
+}
- function updateHostComponent(current, workInProgress, renderExpirationTime) {
- pushHostContext(workInProgress);
+function mountIndeterminateComponent(current$$1, workInProgress, Component, renderExpirationTime) {
+ !(current$$1 === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- if (current === null) {
- tryToClaimNextHydratableInstance(workInProgress);
+ var props = workInProgress.pendingProps;
+ if (typeof Component === 'object' && Component !== null && typeof Component.then === 'function') {
+ Component = readLazyComponentType(Component);
+ var resolvedTag = workInProgress.tag = resolveLazyComponentTag(workInProgress, Component);
+ var resolvedProps = resolveDefaultProps(Component, props);
+ switch (resolvedTag) {
+ case FunctionalComponentLazy:
+ {
+ return updateFunctionalComponent(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
+ }
+ case ClassComponentLazy:
+ {
+ return updateClassComponent(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
+ }
+ case ForwardRefLazy:
+ {
+ return updateForwardRef(current$$1, workInProgress, Component, resolvedProps, renderExpirationTime);
+ }
+ default:
+ {
+ // This message intentionally doesn't metion ForwardRef because the
+ // fact that it's a separate type of work is an implementation detail.
+ invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.', Component);
+ }
}
+ }
- var type = workInProgress.type;
- var memoizedProps = workInProgress.memoizedProps;
- var nextProps = workInProgress.pendingProps;
- if (nextProps === null) {
- nextProps = memoizedProps;
- !(nextProps !== null) ? invariant(false, 'We should always have pending or current props. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- }
- var prevProps = current !== null ? current.memoizedProps : null;
+ var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
+ var context = getMaskedContext(workInProgress, unmaskedContext);
- if (hasContextChanged()) {
- // Normally we can bail out on props equality but if context has changed
- // we don't do the bailout and we have to reuse existing props instead.
- } else if (nextProps === null || memoizedProps === nextProps) {
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
- }
+ prepareToReadContext(workInProgress, renderExpirationTime);
- var nextChildren = nextProps.children;
- var isDirectTextChild = shouldSetTextContent(type, nextProps);
+ var value = void 0;
- if (isDirectTextChild) {
- // We special case a direct text child of a host node. This is a common
- // case. We won't handle it as a reified child. We will instead handle
- // this in the host environment that also have access to this prop. That
- // avoids allocating another HostText fiber and traversing it.
- nextChildren = null;
- } else if (prevProps && shouldSetTextContent(type, prevProps)) {
- // If we're switching from a direct text child to a normal child, or to
- // empty, we need to schedule the text content to be reset.
- workInProgress.effectTag |= ContentReset;
- }
+ {
+ if (Component.prototype && typeof Component.prototype.render === 'function') {
+ var componentName = getComponentName(Component) || 'Unknown';
- markRef(current, workInProgress);
+ if (!didWarnAboutBadClass[componentName]) {
+ warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
+ didWarnAboutBadClass[componentName] = true;
+ }
+ }
- // Check the host config to see if the children are offscreen/hidden.
- if (renderExpirationTime !== Never && !useSyncScheduling && shouldDeprioritizeSubtree(type, nextProps)) {
- // Down-prioritize the children.
- workInProgress.expirationTime = Never;
- // Bailout and come back to this fiber later.
- return null;
+ if (workInProgress.mode & StrictMode) {
+ ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
}
- reconcileChildren(current, workInProgress, nextChildren);
- memoizeProps(workInProgress, nextProps);
- return workInProgress.child;
+ ReactCurrentOwner$3.current = workInProgress;
+ value = Component(props, context);
}
+ // React DevTools reads this flag.
+ workInProgress.effectTag |= PerformedWork;
- function updateHostText(current, workInProgress) {
- if (current === null) {
- tryToClaimNextHydratableInstance(workInProgress);
- }
- var nextProps = workInProgress.pendingProps;
- if (nextProps === null) {
- nextProps = workInProgress.memoizedProps;
+ if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
+ // Proceed under the assumption that this is a class instance
+ workInProgress.tag = ClassComponent;
+
+ // Push context providers early to prevent context stack mismatches.
+ // During mounting we don't know the child context yet as the instance doesn't exist.
+ // We will invalidate the child context in finishClassComponent() right after rendering.
+ var hasContext = false;
+ if (isContextProvider(Component)) {
+ hasContext = true;
+ pushContextProvider(workInProgress);
+ } else {
+ hasContext = false;
}
- memoizeProps(workInProgress, nextProps);
- // Nothing to do here. This is terminal. We'll do the completion step
- // immediately after.
- return null;
- }
- function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
- !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- var fn = workInProgress.type;
- var props = workInProgress.pendingProps;
- var unmaskedContext = getUnmaskedContext(workInProgress);
- var context = getMaskedContext(workInProgress, unmaskedContext);
+ workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
- var value;
+ var getDerivedStateFromProps = Component.getDerivedStateFromProps;
+ if (typeof getDerivedStateFromProps === 'function') {
+ applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
+ }
+ adoptClassInstance(workInProgress, value);
+ mountClassInstance(workInProgress, Component, props, renderExpirationTime);
+ return finishClassComponent(current$$1, workInProgress, Component, true, hasContext, renderExpirationTime);
+ } else {
+ // Proceed under the assumption that this is a functional component
+ workInProgress.tag = FunctionalComponent;
{
- if (fn.prototype && typeof fn.prototype.render === 'function') {
- var componentName = getComponentName(workInProgress);
- warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
- }
- ReactCurrentOwner.current = workInProgress;
- value = fn(props, context);
- }
- // React DevTools reads this flag.
- workInProgress.effectTag |= PerformedWork;
-
- if (typeof value === 'object' && value !== null && typeof value.render === 'function') {
- // Proceed under the assumption that this is a class instance
- workInProgress.tag = ClassComponent;
-
- // Push context providers early to prevent context stack mismatches.
- // During mounting we don't know the child context yet as the instance doesn't exist.
- // We will invalidate the child context in finishClassComponent() right after rendering.
- var hasContext = pushContextProvider(workInProgress);
- adoptClassInstance(workInProgress, value);
- mountClassInstance(workInProgress, renderExpirationTime);
- return finishClassComponent(current, workInProgress, true, hasContext);
- } else {
- // Proceed under the assumption that this is a functional component
- workInProgress.tag = FunctionalComponent;
- {
- var Component = workInProgress.type;
+ if (Component) {
+ !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
+ }
+ if (workInProgress.ref !== null) {
+ var info = '';
+ var ownerName = getCurrentFiberOwnerNameInDevOrNull();
+ if (ownerName) {
+ info += '\n\nCheck the render method of `' + ownerName + '`.';
+ }
- if (Component) {
- warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');
+ var warningKey = ownerName || workInProgress._debugID || '';
+ var debugSource = workInProgress._debugSource;
+ if (debugSource) {
+ warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
}
- if (workInProgress.ref !== null) {
- var info = '';
- var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();
- if (ownerName) {
- info += '\n\nCheck the render method of `' + ownerName + '`.';
- }
+ if (!didWarnAboutStatelessRefs[warningKey]) {
+ didWarnAboutStatelessRefs[warningKey] = true;
+ warning$1(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
+ }
+ }
- var warningKey = ownerName || workInProgress._debugID || '';
- var debugSource = workInProgress._debugSource;
- if (debugSource) {
- warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
- }
- if (!warnedAboutStatelessRefs[warningKey]) {
- warnedAboutStatelessRefs[warningKey] = true;
- warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());
- }
+ if (typeof Component.getDerivedStateFromProps === 'function') {
+ var _componentName = getComponentName(Component) || 'Unknown';
+
+ if (!didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName]) {
+ warningWithoutStack$1(false, '%s: Stateless functional components do not support getDerivedStateFromProps.', _componentName);
+ didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName] = true;
}
}
- reconcileChildren(current, workInProgress, value);
- memoizeProps(workInProgress, props);
- return workInProgress.child;
}
+ reconcileChildren(current$$1, workInProgress, value, renderExpirationTime);
+ memoizeProps(workInProgress, props);
+ return workInProgress.child;
}
+}
- function updateCallComponent(current, workInProgress, renderExpirationTime) {
- var nextCall = workInProgress.pendingProps;
- if (hasContextChanged()) {
- // Normally we can bail out on props equality but if context has changed
- // we don't do the bailout and we have to reuse existing props instead.
- if (nextCall === null) {
- nextCall = current && current.memoizedProps;
- !(nextCall !== null) ? invariant(false, 'We should always have pending or current props. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- }
- } else if (nextCall === null || workInProgress.memoizedProps === nextCall) {
- nextCall = workInProgress.memoizedProps;
- // TODO: When bailing out, we might need to return the stateNode instead
- // of the child. To check it for work.
- // return bailoutOnAlreadyFinishedWork(current, workInProgress);
+function updatePlaceholderComponent(current$$1, workInProgress, renderExpirationTime) {
+ if (enableSuspense) {
+ var nextProps = workInProgress.pendingProps;
+
+ // Check if we already attempted to render the normal state. If we did,
+ // and we timed out, render the placeholder state.
+ var alreadyCaptured = (workInProgress.effectTag & DidCapture) === NoEffect;
+
+ var nextDidTimeout = void 0;
+ if (current$$1 !== null && workInProgress.updateQueue !== null) {
+ // We're outside strict mode. Something inside this Placeholder boundary
+ // suspended during the last commit. Switch to the placholder.
+ workInProgress.updateQueue = null;
+ nextDidTimeout = true;
+ // If we're recovering from an error, reconcile twice: first to delete
+ // all the existing children.
+ reconcileChildren(current$$1, workInProgress, null, renderExpirationTime);
+ current$$1.child = null;
+ // Now we can continue reconciling like normal. This has the effect of
+ // remounting all children regardless of whether their their
+ // identity matches.
+ } else {
+ nextDidTimeout = !alreadyCaptured;
}
- var nextChildren = nextCall.children;
+ if ((workInProgress.mode & StrictMode) !== NoEffect) {
+ if (nextDidTimeout) {
+ // If the timed-out view commits, schedule an update effect to record
+ // the committed time.
+ workInProgress.effectTag |= Update;
+ } else {
+ // The state node points to the time at which placeholder timed out.
+ // We can clear it once we switch back to the normal children.
+ workInProgress.stateNode = null;
+ }
+ }
- // The following is a fork of reconcileChildrenAtExpirationTime but using
- // stateNode to store the child.
- if (current === null) {
- workInProgress.stateNode = mountChildFibers(workInProgress, workInProgress.stateNode, nextChildren, renderExpirationTime);
+ // If the `children` prop is a function, treat it like a render prop.
+ // TODO: This is temporary until we finalize a lower level API.
+ var children = nextProps.children;
+ var nextChildren = void 0;
+ if (typeof children === 'function') {
+ nextChildren = children(nextDidTimeout);
} else {
- workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, renderExpirationTime);
+ nextChildren = nextDidTimeout ? nextProps.fallback : children;
}
- memoizeProps(workInProgress, nextCall);
- // This doesn't take arbitrary time so we could synchronously just begin
- // eagerly do the work of workInProgress.child as an optimization.
- return workInProgress.stateNode;
+ workInProgress.memoizedProps = nextProps;
+ workInProgress.memoizedState = nextDidTimeout;
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ return workInProgress.child;
+ } else {
+ return null;
+ }
+}
+
+function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
+ pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
+ var nextChildren = workInProgress.pendingProps;
+ if (current$$1 === null) {
+ // Portals are special because we don't append the children during mount
+ // but at commit. Therefore we need to track insertions which the normal
+ // flow doesn't do during mount. This doesn't happen at the root because
+ // the root always starts with a "current" with a null child.
+ // TODO: Consider unifying this with how the root works.
+ workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextChildren);
+ } else {
+ reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
+ memoizeProps(workInProgress, nextChildren);
}
+ return workInProgress.child;
+}
- function updatePortalComponent(current, workInProgress, renderExpirationTime) {
- pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
- var nextChildren = workInProgress.pendingProps;
- if (hasContextChanged()) {
- // Normally we can bail out on props equality but if context has changed
- // we don't do the bailout and we have to reuse existing props instead.
- if (nextChildren === null) {
- nextChildren = current && current.memoizedProps;
- !(nextChildren != null) ? invariant(false, 'We should always have pending or current props. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- }
- } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {
- return bailoutOnAlreadyFinishedWork(current, workInProgress);
+function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
+ var providerType = workInProgress.type;
+ var context = providerType._context;
+
+ var newProps = workInProgress.pendingProps;
+ var oldProps = workInProgress.memoizedProps;
+
+ var newValue = newProps.value;
+ workInProgress.memoizedProps = newProps;
+
+ {
+ var providerPropTypes = workInProgress.type.propTypes;
+
+ if (providerPropTypes) {
+ checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
}
+ }
- if (current === null) {
- // Portals are special because we don't append the children during mount
- // but at commit. Therefore we need to track insertions which the normal
- // flow doesn't do during mount. This doesn't happen at the root because
- // the root always starts with a "current" with a null child.
- // TODO: Consider unifying this with how the root works.
- workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
- memoizeProps(workInProgress, nextChildren);
+ pushProvider(workInProgress, newValue);
+
+ if (oldProps !== null) {
+ var oldValue = oldProps.value;
+ var changedBits = calculateChangedBits(context, newValue, oldValue);
+ if (changedBits === 0) {
+ // No change. Bailout early if children are the same.
+ if (oldProps.children === newProps.children && !hasContextChanged()) {
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
+ }
} else {
- reconcileChildren(current, workInProgress, nextChildren);
- memoizeProps(workInProgress, nextChildren);
+ // The context value changed. Search for matching consumers and schedule
+ // them to update.
+ propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
}
- return workInProgress.child;
}
- /*
+ var newChildren = newProps.children;
+ reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
+ return workInProgress.child;
+}
+
+function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
+ var context = workInProgress.type;
+ var newProps = workInProgress.pendingProps;
+ var render = newProps.children;
+
+ {
+ !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
+ }
+
+ prepareToReadContext(workInProgress, renderExpirationTime);
+ var newValue = readContext(context, newProps.unstable_observedBits);
+ var newChildren = void 0;
+ {
+ ReactCurrentOwner$3.current = workInProgress;
+ setCurrentPhase('render');
+ newChildren = render(newValue);
+ setCurrentPhase(null);
+ }
+
+ // React DevTools reads this flag.
+ workInProgress.effectTag |= PerformedWork;
+ reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
+ workInProgress.memoizedProps = newProps;
+ return workInProgress.child;
+}
+
+/*
function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) {
let child = firstChild;
do {
@@ -8158,243 +13971,270 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
}
*/
- function bailoutOnAlreadyFinishedWork(current, workInProgress) {
- cancelWorkTimer(workInProgress);
-
- // TODO: We should ideally be able to bail out early if the children have no
- // more work to do. However, since we don't have a separation of this
- // Fiber's priority and its children yet - we don't know without doing lots
- // of the same work we do anyway. Once we have that separation we can just
- // bail out here if the children has no more work at this priority level.
- // if (workInProgress.priorityOfChildren <= priorityLevel) {
- // // If there are side-effects in these children that have not yet been
- // // committed we need to ensure that they get properly transferred up.
- // if (current && current.child !== workInProgress.child) {
- // reuseChildrenEffects(workInProgress, child);
- // }
- // return null;
- // }
-
- cloneChildFibers(current, workInProgress);
+function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
+ cancelWorkTimer(workInProgress);
+
+ if (current$$1 !== null) {
+ // Reuse previous context list
+ workInProgress.firstContextDependency = current$$1.firstContextDependency;
+ }
+
+ if (enableProfilerTimer) {
+ // Don't update "base" render times for bailouts.
+ stopProfilerTimerIfRunning(workInProgress);
+ }
+
+ // Check if the children have any pending work.
+ var childExpirationTime = workInProgress.childExpirationTime;
+ if (childExpirationTime === NoWork || childExpirationTime > renderExpirationTime) {
+ // The children don't have any work either. We can skip them.
+ // TODO: Once we add back resuming, we should check if the children are
+ // a work-in-progress set. If so, we need to transfer their effects.
+ return null;
+ } else {
+ // This fiber doesn't have work, but its subtree does. Clone the child
+ // fibers and continue.
+ cloneChildFibers(current$$1, workInProgress);
return workInProgress.child;
}
+}
- function bailoutOnLowPriority(current, workInProgress) {
- cancelWorkTimer(workInProgress);
+// TODO: Delete memoizeProps/State and move to reconcile/bailout instead
+function memoizeProps(workInProgress, nextProps) {
+ workInProgress.memoizedProps = nextProps;
+}
- // TODO: Handle HostComponent tags here as well and call pushHostContext()?
- // See PR 8590 discussion for context
+function memoizeState(workInProgress, nextState) {
+ workInProgress.memoizedState = nextState;
+ // Don't reset the updateQueue, in case there are pending updates. Resetting
+ // is handled by processUpdateQueue.
+}
+
+function beginWork(current$$1, workInProgress, renderExpirationTime) {
+ var updateExpirationTime = workInProgress.expirationTime;
+ if (!hasContextChanged() && (updateExpirationTime === NoWork || updateExpirationTime > renderExpirationTime)) {
+ // This fiber does not have any pending work. Bailout without entering
+ // the begin phase. There's still some bookkeeping we that needs to be done
+ // in this optimized path, mostly pushing stuff onto the stack.
switch (workInProgress.tag) {
case HostRoot:
pushHostRootContext(workInProgress);
+ resetHydrationState();
break;
- case ClassComponent:
- pushContextProvider(workInProgress);
+ case HostComponent:
+ pushHostContext(workInProgress);
break;
+ case ClassComponent:
+ {
+ var Component = workInProgress.type;
+ if (isContextProvider(Component)) {
+ pushContextProvider(workInProgress);
+ }
+ break;
+ }
+ case ClassComponentLazy:
+ {
+ var thenable = workInProgress.type;
+ var _Component = getResultFromResolvedThenable(thenable);
+ if (isContextProvider(_Component)) {
+ pushContextProvider(workInProgress);
+ }
+ break;
+ }
case HostPortal:
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
break;
+ case ContextProvider:
+ {
+ var newValue = workInProgress.memoizedProps.value;
+ pushProvider(workInProgress, newValue);
+ break;
+ }
+ case Profiler:
+ if (enableProfilerTimer) {
+ workInProgress.effectTag |= Update;
+ }
+ break;
}
- // TODO: What if this is currently in progress?
- // How can that happen? How is this not being cloned?
- return null;
- }
-
- // TODO: Delete memoizeProps/State and move to reconcile/bailout instead
- function memoizeProps(workInProgress, nextProps) {
- workInProgress.memoizedProps = nextProps;
+ return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
}
- function memoizeState(workInProgress, nextState) {
- workInProgress.memoizedState = nextState;
- // Don't reset the updateQueue, in case there are pending updates. Resetting
- // is handled by processUpdateQueue.
- }
+ // Before entering the begin phase, clear the expiration time.
+ workInProgress.expirationTime = NoWork;
- function beginWork(current, workInProgress, renderExpirationTime) {
- if (workInProgress.expirationTime === NoWork || workInProgress.expirationTime > renderExpirationTime) {
- return bailoutOnLowPriority(current, workInProgress);
- }
-
- switch (workInProgress.tag) {
- case IndeterminateComponent:
- return mountIndeterminateComponent(current, workInProgress, renderExpirationTime);
- case FunctionalComponent:
- return updateFunctionalComponent(current, workInProgress);
- case ClassComponent:
- return updateClassComponent(current, workInProgress, renderExpirationTime);
- case HostRoot:
- return updateHostRoot(current, workInProgress, renderExpirationTime);
- case HostComponent:
- return updateHostComponent(current, workInProgress, renderExpirationTime);
- case HostText:
- return updateHostText(current, workInProgress);
- case CallHandlerPhase:
- // This is a restart. Reset the tag to the initial phase.
- workInProgress.tag = CallComponent;
- // Intentionally fall through since this is now the same.
- case CallComponent:
- return updateCallComponent(current, workInProgress, renderExpirationTime);
- case ReturnComponent:
- // A return component is just a placeholder, we can just run through the
- // next one immediately.
- return null;
- case HostPortal:
- return updatePortalComponent(current, workInProgress, renderExpirationTime);
- case Fragment:
- return updateFragment(current, workInProgress);
- default:
- invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
- }
+ switch (workInProgress.tag) {
+ case IndeterminateComponent:
+ {
+ var _Component3 = workInProgress.type;
+ return mountIndeterminateComponent(current$$1, workInProgress, _Component3, renderExpirationTime);
+ }
+ case FunctionalComponent:
+ {
+ var _Component4 = workInProgress.type;
+ var _unresolvedProps = workInProgress.pendingProps;
+ return updateFunctionalComponent(current$$1, workInProgress, _Component4, _unresolvedProps, renderExpirationTime);
+ }
+ case FunctionalComponentLazy:
+ {
+ var _thenable2 = workInProgress.type;
+ var _Component5 = getResultFromResolvedThenable(_thenable2);
+ var _unresolvedProps2 = workInProgress.pendingProps;
+ var _child = updateFunctionalComponent(current$$1, workInProgress, _Component5, resolveDefaultProps(_Component5, _unresolvedProps2), renderExpirationTime);
+ workInProgress.memoizedProps = _unresolvedProps2;
+ return _child;
+ }
+ case ClassComponent:
+ {
+ var _Component6 = workInProgress.type;
+ var _unresolvedProps3 = workInProgress.pendingProps;
+ return updateClassComponent(current$$1, workInProgress, _Component6, _unresolvedProps3, renderExpirationTime);
+ }
+ case ClassComponentLazy:
+ {
+ var _thenable3 = workInProgress.type;
+ var _Component7 = getResultFromResolvedThenable(_thenable3);
+ var _unresolvedProps4 = workInProgress.pendingProps;
+ var _child2 = updateClassComponent(current$$1, workInProgress, _Component7, resolveDefaultProps(_Component7, _unresolvedProps4), renderExpirationTime);
+ workInProgress.memoizedProps = _unresolvedProps4;
+ return _child2;
+ }
+ case HostRoot:
+ return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
+ case HostComponent:
+ return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
+ case HostText:
+ return updateHostText(current$$1, workInProgress);
+ case PlaceholderComponent:
+ return updatePlaceholderComponent(current$$1, workInProgress, renderExpirationTime);
+ case HostPortal:
+ return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
+ case ForwardRef:
+ {
+ var type = workInProgress.type;
+ return updateForwardRef(current$$1, workInProgress, type, workInProgress.pendingProps, renderExpirationTime);
+ }
+ case ForwardRefLazy:
+ var _thenable = workInProgress.type;
+ var _Component2 = getResultFromResolvedThenable(_thenable);
+ var unresolvedProps = workInProgress.pendingProps;
+ var child = updateForwardRef(current$$1, workInProgress, _Component2, resolveDefaultProps(_Component2, unresolvedProps), renderExpirationTime);
+ workInProgress.memoizedProps = unresolvedProps;
+ return child;
+ case Fragment:
+ return updateFragment(current$$1, workInProgress, renderExpirationTime);
+ case Mode:
+ return updateMode(current$$1, workInProgress, renderExpirationTime);
+ case Profiler:
+ return updateProfiler(current$$1, workInProgress, renderExpirationTime);
+ case ContextProvider:
+ return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
+ case ContextConsumer:
+ return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
+ default:
+ invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
}
+}
- function beginFailedWork(current, workInProgress, renderExpirationTime) {
- // Push context providers here to avoid a push/pop context mismatch.
- switch (workInProgress.tag) {
- case ClassComponent:
- pushContextProvider(workInProgress);
- break;
- case HostRoot:
- pushHostRootContext(workInProgress);
- break;
- default:
- invariant(false, 'Invalid type of work. This error is likely caused by a bug in React. Please file an issue.');
- }
+function markUpdate(workInProgress) {
+ // Tag the fiber with an update effect. This turns a Placement into
+ // a PlacementAndUpdate.
+ workInProgress.effectTag |= Update;
+}
- // Add an error effect so we can handle the error during the commit phase
- workInProgress.effectTag |= Err;
+function markRef$1(workInProgress) {
+ workInProgress.effectTag |= Ref;
+}
- // This is a weird case where we do "resume" work — work that failed on
- // our first attempt. Because we no longer have a notion of "progressed
- // deletions," reset the child to the current child to make sure we delete
- // it again. TODO: Find a better way to handle this, perhaps during a more
- // general overhaul of error handling.
- if (current === null) {
- workInProgress.child = null;
- } else if (workInProgress.child !== current.child) {
- workInProgress.child = current.child;
+function appendAllChildren(parent, workInProgress) {
+ // We only have the top Fiber that was created but we need recurse down its
+ // children to find all the terminal nodes.
+ var node = workInProgress.child;
+ while (node !== null) {
+ if (node.tag === HostComponent || node.tag === HostText) {
+ appendInitialChild(parent, node.stateNode);
+ } else if (node.tag === HostPortal) {
+ // If we have a portal child, then we don't want to traverse
+ // down its children. Instead, we'll get insertions from each child in
+ // the portal directly.
+ } else if (node.child !== null) {
+ node.child.return = node;
+ node = node.child;
+ continue;
}
-
- if (workInProgress.expirationTime === NoWork || workInProgress.expirationTime > renderExpirationTime) {
- return bailoutOnLowPriority(current, workInProgress);
+ if (node === workInProgress) {
+ return;
}
-
- // If we don't bail out, we're going be recomputing our children so we need
- // to drop our effect list.
- workInProgress.firstEffect = null;
- workInProgress.lastEffect = null;
-
- // Unmount the current children as if the component rendered null
- var nextChildren = null;
- reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime);
-
- if (workInProgress.tag === ClassComponent) {
- var instance = workInProgress.stateNode;
- workInProgress.memoizedProps = instance.props;
- workInProgress.memoizedState = instance.state;
+ while (node.sibling === null) {
+ if (node.return === null || node.return === workInProgress) {
+ return;
+ }
+ node = node.return;
}
-
- return workInProgress.child;
+ node.sibling.return = node.return;
+ node = node.sibling;
}
+}
- return {
- beginWork: beginWork,
- beginFailedWork: beginFailedWork
- };
-};
-
-var ReactFiberCompleteWork = function (config, hostContext, hydrationContext) {
- var createInstance = config.createInstance,
- createTextInstance = config.createTextInstance,
- appendInitialChild = config.appendInitialChild,
- finalizeInitialChildren = config.finalizeInitialChildren,
- prepareUpdate = config.prepareUpdate,
- mutation = config.mutation,
- persistence = config.persistence;
- var getRootHostContainer = hostContext.getRootHostContainer,
- popHostContext = hostContext.popHostContext,
- getHostContext = hostContext.getHostContext,
- popHostContainer = hostContext.popHostContainer;
- var prepareToHydrateHostInstance = hydrationContext.prepareToHydrateHostInstance,
- prepareToHydrateHostTextInstance = hydrationContext.prepareToHydrateHostTextInstance,
- popHydrationState = hydrationContext.popHydrationState;
-
-
- function markUpdate(workInProgress) {
- // Tag the fiber with an update effect. This turns a Placement into
- // an UpdateAndPlacement.
- workInProgress.effectTag |= Update;
- }
+var updateHostContainer = void 0;
+var updateHostComponent$1 = void 0;
+var updateHostText$1 = void 0;
+if (supportsMutation) {
+ // Mutation mode
- function markRef(workInProgress) {
- workInProgress.effectTag |= Ref;
- }
+ updateHostContainer = function (workInProgress) {
+ // Noop
+ };
+ updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
+ // If we have an alternate, that means this is an update and we need to
+ // schedule a side-effect to do the updates.
+ var oldProps = current.memoizedProps;
+ if (oldProps === newProps) {
+ // In mutation mode, this is sufficient for a bailout because
+ // we won't touch this node even if children changed.
+ return;
+ }
- function appendAllReturns(returns, workInProgress) {
- var node = workInProgress.stateNode;
- if (node) {
- node['return'] = workInProgress;
+ // If we get updated because one of our children updated, we don't
+ // have newProps so we'll have to reuse them.
+ // TODO: Split the update API as separate for the props vs. children.
+ // Even better would be if children weren't special cased at all tho.
+ var instance = workInProgress.stateNode;
+ var currentHostContext = getHostContext();
+ // TODO: Experiencing an error where oldProps is null. Suggests a host
+ // component is hitting the resume path. Figure out why. Possibly
+ // related to `hidden`.
+ var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
+ // TODO: Type this specific to this type of component.
+ workInProgress.updateQueue = updatePayload;
+ // If the update payload indicates that there is a change or if there
+ // is a new ref we mark this as an update. All the work is done in commitWork.
+ if (updatePayload) {
+ markUpdate(workInProgress);
}
- while (node !== null) {
- if (node.tag === HostComponent || node.tag === HostText || node.tag === HostPortal) {
- invariant(false, 'A call cannot have host component children.');
- } else if (node.tag === ReturnComponent) {
- returns.push(node.type);
- } else if (node.child !== null) {
- node.child['return'] = node;
- node = node.child;
- continue;
- }
- while (node.sibling === null) {
- if (node['return'] === null || node['return'] === workInProgress) {
- return;
- }
- node = node['return'];
- }
- node.sibling['return'] = node['return'];
- node = node.sibling;
+ };
+ updateHostText$1 = function (current, workInProgress, oldText, newText) {
+ // If the text differs, mark it as an update. All the work in done in commitWork.
+ if (oldText !== newText) {
+ markUpdate(workInProgress);
}
- }
-
- function moveCallToHandlerPhase(current, workInProgress, renderExpirationTime) {
- var call = workInProgress.memoizedProps;
- !call ? invariant(false, 'Should be resolved by now. This error is likely caused by a bug in React. Please file an issue.') : void 0;
-
- // First step of the call has completed. Now we need to do the second.
- // TODO: It would be nice to have a multi stage call represented by a
- // single component, or at least tail call optimize nested ones. Currently
- // that requires additional fields that we don't want to add to the fiber.
- // So this requires nested handlers.
- // Note: This doesn't mutate the alternate node. I don't think it needs to
- // since this stage is reset for every pass.
- workInProgress.tag = CallHandlerPhase;
-
- // Build up the returns.
- // TODO: Compare this to a generator or opaque helpers like Children.
- var returns = [];
- appendAllReturns(returns, workInProgress);
- var fn = call.handler;
- var props = call.props;
- var nextChildren = fn(props, returns);
-
- var currentFirstChild = current !== null ? current.child : null;
- workInProgress.child = reconcileChildFibers(workInProgress, currentFirstChild, nextChildren, renderExpirationTime);
- return workInProgress.child;
- }
+ };
+} else if (supportsPersistence) {
+ // Persistent host tree mode
- function appendAllChildren(parent, workInProgress) {
+ // An unfortunate fork of appendAllChildren because we have two different parent types.
+ var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
// We only have the top Fiber that was created but we need recurse down its
// children to find all the terminal nodes.
var node = workInProgress.child;
while (node !== null) {
if (node.tag === HostComponent || node.tag === HostText) {
- appendInitialChild(parent, node.stateNode);
+ appendChildToContainerChildSet(containerChildSet, node.stateNode);
} else if (node.tag === HostPortal) {
// If we have a portal child, then we don't want to traverse
// down its children. Instead, we'll get insertions from each child in
// the portal directly.
} else if (node.child !== null) {
- node.child['return'] = node;
+ node.child.return = node;
node = node.child;
continue;
}
@@ -8402,1743 +14242,2016 @@ var ReactFiberCompleteWork = function (config, hostContext, hydrationContext) {
return;
}
while (node.sibling === null) {
- if (node['return'] === null || node['return'] === workInProgress) {
+ if (node.return === null || node.return === workInProgress) {
return;
}
- node = node['return'];
+ node = node.return;
}
- node.sibling['return'] = node['return'];
+ node.sibling.return = node.return;
node = node.sibling;
}
- }
-
- var updateHostContainer = void 0;
- var updateHostComponent = void 0;
- var updateHostText = void 0;
- if (mutation) {
- if (enableMutatingReconciler) {
- // Mutation mode
- updateHostContainer = function (workInProgress) {
- // Noop
- };
- updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance) {
- // TODO: Type this specific to this type of component.
- workInProgress.updateQueue = updatePayload;
- // If the update payload indicates that there is a change or if there
- // is a new ref we mark this as an update. All the work is done in commitWork.
- if (updatePayload) {
- markUpdate(workInProgress);
- }
- };
- updateHostText = function (current, workInProgress, oldText, newText) {
- // If the text differs, mark it as an update. All the work in done in commitWork.
- if (oldText !== newText) {
- markUpdate(workInProgress);
- }
- };
- } else {
- invariant(false, 'Mutating reconciler is disabled.');
- }
- } else if (persistence) {
- if (enablePersistentReconciler) {
- // Persistent host tree mode
- var cloneInstance = persistence.cloneInstance,
- createContainerChildSet = persistence.createContainerChildSet,
- appendChildToContainerChildSet = persistence.appendChildToContainerChildSet,
- finalizeContainerChildren = persistence.finalizeContainerChildren;
-
- // An unfortunate fork of appendAllChildren because we have two different parent types.
-
- var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
- // We only have the top Fiber that was created but we need recurse down its
- // children to find all the terminal nodes.
- var node = workInProgress.child;
- while (node !== null) {
- if (node.tag === HostComponent || node.tag === HostText) {
- appendChildToContainerChildSet(containerChildSet, node.stateNode);
- } else if (node.tag === HostPortal) {
- // If we have a portal child, then we don't want to traverse
- // down its children. Instead, we'll get insertions from each child in
- // the portal directly.
- } else if (node.child !== null) {
- node.child['return'] = node;
- node = node.child;
- continue;
- }
- if (node === workInProgress) {
- return;
- }
- while (node.sibling === null) {
- if (node['return'] === null || node['return'] === workInProgress) {
- return;
- }
- node = node['return'];
- }
- node.sibling['return'] = node['return'];
- node = node.sibling;
- }
- };
- updateHostContainer = function (workInProgress) {
- var portalOrRoot = workInProgress.stateNode;
- var childrenUnchanged = workInProgress.firstEffect === null;
- if (childrenUnchanged) {
- // No changes, just reuse the existing instance.
- } else {
- var container = portalOrRoot.containerInfo;
- var newChildSet = createContainerChildSet(container);
- if (finalizeContainerChildren(container, newChildSet)) {
- markUpdate(workInProgress);
- }
- portalOrRoot.pendingChildren = newChildSet;
- // If children might have changed, we have to add them all to the set.
- appendAllChildrenToContainer(newChildSet, workInProgress);
- // Schedule an update on the container to swap out the container.
- markUpdate(workInProgress);
- }
- };
- updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance) {
- // If there are no effects associated with this node, then none of our children had any updates.
- // This guarantees that we can reuse all of them.
- var childrenUnchanged = workInProgress.firstEffect === null;
- var currentInstance = current.stateNode;
- if (childrenUnchanged && updatePayload === null) {
- // No changes, just reuse the existing instance.
- // Note that this might release a previous clone.
- workInProgress.stateNode = currentInstance;
- } else {
- var recyclableInstance = workInProgress.stateNode;
- var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
- if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance)) {
- markUpdate(workInProgress);
- }
- workInProgress.stateNode = newInstance;
- if (childrenUnchanged) {
- // If there are no other effects in this tree, we need to flag this node as having one.
- // Even though we're not going to use it for anything.
- // Otherwise parents won't know that there are new children to propagate upwards.
- markUpdate(workInProgress);
- } else {
- // If children might have changed, we have to add them all to the set.
- appendAllChildren(newInstance, workInProgress);
- }
- }
- };
- updateHostText = function (current, workInProgress, oldText, newText) {
- if (oldText !== newText) {
- // If the text content differs, we'll create a new text instance for it.
- var rootContainerInstance = getRootHostContainer();
- var currentHostContext = getHostContext();
- workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
- // We'll have to mark it as having an effect, even though we won't use the effect for anything.
- // This lets the parents know that at least one of their children has changed.
- markUpdate(workInProgress);
- }
- };
+ };
+ updateHostContainer = function (workInProgress) {
+ var portalOrRoot = workInProgress.stateNode;
+ var childrenUnchanged = workInProgress.firstEffect === null;
+ if (childrenUnchanged) {
+ // No changes, just reuse the existing instance.
} else {
- invariant(false, 'Persistent reconciler is disabled.');
+ var container = portalOrRoot.containerInfo;
+ var newChildSet = createContainerChildSet(container);
+ // If children might have changed, we have to add them all to the set.
+ appendAllChildrenToContainer(newChildSet, workInProgress);
+ portalOrRoot.pendingChildren = newChildSet;
+ // Schedule an update on the container to swap out the container.
+ markUpdate(workInProgress);
+ finalizeContainerChildren(container, newChildSet);
}
- } else {
- if (enableNoopReconciler) {
- // No host operations
- updateHostContainer = function (workInProgress) {
- // Noop
- };
- updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance) {
- // Noop
- };
- updateHostText = function (current, workInProgress, oldText, newText) {
- // Noop
- };
+ };
+ updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
+ var currentInstance = current.stateNode;
+ var oldProps = current.memoizedProps;
+ // If there are no effects associated with this node, then none of our children had any updates.
+ // This guarantees that we can reuse all of them.
+ var childrenUnchanged = workInProgress.firstEffect === null;
+ if (childrenUnchanged && oldProps === newProps) {
+ // No changes, just reuse the existing instance.
+ // Note that this might release a previous clone.
+ workInProgress.stateNode = currentInstance;
+ return;
+ }
+ var recyclableInstance = workInProgress.stateNode;
+ var currentHostContext = getHostContext();
+ var updatePayload = null;
+ if (oldProps !== newProps) {
+ updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
+ }
+ if (childrenUnchanged && updatePayload === null) {
+ // No changes, just reuse the existing instance.
+ // Note that this might release a previous clone.
+ workInProgress.stateNode = currentInstance;
+ return;
+ }
+ var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
+ if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
+ markUpdate(workInProgress);
+ }
+ workInProgress.stateNode = newInstance;
+ if (childrenUnchanged) {
+ // If there are no other effects in this tree, we need to flag this node as having one.
+ // Even though we're not going to use it for anything.
+ // Otherwise parents won't know that there are new children to propagate upwards.
+ markUpdate(workInProgress);
} else {
- invariant(false, 'Noop reconciler is disabled.');
+ // If children might have changed, we have to add them all to the set.
+ appendAllChildren(newInstance, workInProgress);
}
- }
-
- function completeWork(current, workInProgress, renderExpirationTime) {
- // Get the latest props.
- var newProps = workInProgress.pendingProps;
- if (newProps === null) {
- newProps = workInProgress.memoizedProps;
- } else if (workInProgress.expirationTime !== Never || renderExpirationTime === Never) {
- // Reset the pending props, unless this was a down-prioritization.
- workInProgress.pendingProps = null;
+ };
+ updateHostText$1 = function (current, workInProgress, oldText, newText) {
+ if (oldText !== newText) {
+ // If the text content differs, we'll create a new text instance for it.
+ var rootContainerInstance = getRootHostContainer();
+ var currentHostContext = getHostContext();
+ workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
+ // We'll have to mark it as having an effect, even though we won't use the effect for anything.
+ // This lets the parents know that at least one of their children has changed.
+ markUpdate(workInProgress);
}
+ };
+} else {
+ // No host operations
+ updateHostContainer = function (workInProgress) {
+ // Noop
+ };
+ updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
+ // Noop
+ };
+ updateHostText$1 = function (current, workInProgress, oldText, newText) {
+ // Noop
+ };
+}
- switch (workInProgress.tag) {
- case FunctionalComponent:
- return null;
- case ClassComponent:
- {
- // We are leaving this subtree, so pop context if any.
- popContextProvider(workInProgress);
- return null;
+function completeWork(current, workInProgress, renderExpirationTime) {
+ var newProps = workInProgress.pendingProps;
+
+ switch (workInProgress.tag) {
+ case FunctionalComponent:
+ case FunctionalComponentLazy:
+ break;
+ case ClassComponent:
+ {
+ var Component = workInProgress.type;
+ if (isContextProvider(Component)) {
+ popContext(workInProgress);
}
- case HostRoot:
- {
- popHostContainer(workInProgress);
- popTopLevelContextObject(workInProgress);
- var fiberRoot = workInProgress.stateNode;
- if (fiberRoot.pendingContext) {
- fiberRoot.context = fiberRoot.pendingContext;
- fiberRoot.pendingContext = null;
+ break;
+ }
+ case ClassComponentLazy:
+ {
+ var _Component = getResultFromResolvedThenable(workInProgress.type);
+ if (isContextProvider(_Component)) {
+ popContext(workInProgress);
+ }
+ break;
+ }
+ case HostRoot:
+ {
+ popHostContainer(workInProgress);
+ popTopLevelContextObject(workInProgress);
+ var fiberRoot = workInProgress.stateNode;
+ if (fiberRoot.pendingContext) {
+ fiberRoot.context = fiberRoot.pendingContext;
+ fiberRoot.pendingContext = null;
+ }
+ if (current === null || current.child === null) {
+ // If we hydrated, pop so that we can delete any remaining children
+ // that weren't hydrated.
+ popHydrationState(workInProgress);
+ // This resets the hacky state to fix isMounted before committing.
+ // TODO: Delete this when we delete isMounted and findDOMNode.
+ workInProgress.effectTag &= ~Placement;
+ }
+ updateHostContainer(workInProgress);
+ break;
+ }
+ case HostComponent:
+ {
+ popHostContext(workInProgress);
+ var rootContainerInstance = getRootHostContainer();
+ var type = workInProgress.type;
+ if (current !== null && workInProgress.stateNode != null) {
+ updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
+
+ if (current.ref !== workInProgress.ref) {
+ markRef$1(workInProgress);
}
-
- if (current === null || current.child === null) {
- // If we hydrated, pop so that we can delete any remaining children
- // that weren't hydrated.
- popHydrationState(workInProgress);
- // This resets the hacky state to fix isMounted before committing.
- // TODO: Delete this when we delete isMounted and findDOMNode.
- workInProgress.effectTag &= ~Placement;
+ } else {
+ if (!newProps) {
+ !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ // This can happen when we abort work.
+ break;
}
- updateHostContainer(workInProgress);
- return null;
- }
- case HostComponent:
- {
- popHostContext(workInProgress);
- var rootContainerInstance = getRootHostContainer();
- var type = workInProgress.type;
- if (current !== null && workInProgress.stateNode != null) {
- // If we have an alternate, that means this is an update and we need to
- // schedule a side-effect to do the updates.
- var oldProps = current.memoizedProps;
- // If we get updated because one of our children updated, we don't
- // have newProps so we'll have to reuse them.
- // TODO: Split the update API as separate for the props vs. children.
- // Even better would be if children weren't special cased at all tho.
- var instance = workInProgress.stateNode;
- var currentHostContext = getHostContext();
- var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
-
- updateHostComponent(current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance);
-
- if (current.ref !== workInProgress.ref) {
- markRef(workInProgress);
+
+ var currentHostContext = getHostContext();
+ // TODO: Move createInstance to beginWork and keep it on a context
+ // "stack" as the parent. Then append children as we go in beginWork
+ // or completeWork depending on we want to add then top->down or
+ // bottom->up. Top->down is faster in IE11.
+ var wasHydrated = popHydrationState(workInProgress);
+ if (wasHydrated) {
+ // TODO: Move this and createInstance step into the beginPhase
+ // to consolidate.
+ if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
+ // If changes to the hydrated node needs to be applied at the
+ // commit-phase we mark this as such.
+ markUpdate(workInProgress);
}
} else {
- if (!newProps) {
- !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- // This can happen when we abort work.
- return null;
- }
+ var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
- var _currentHostContext = getHostContext();
- // TODO: Move createInstance to beginWork and keep it on a context
- // "stack" as the parent. Then append children as we go in beginWork
- // or completeWork depending on we want to add then top->down or
- // bottom->up. Top->down is faster in IE11.
- var wasHydrated = popHydrationState(workInProgress);
- if (wasHydrated) {
- // TODO: Move this and createInstance step into the beginPhase
- // to consolidate.
- if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, _currentHostContext)) {
- // If changes to the hydrated node needs to be applied at the
- // commit-phase we mark this as such.
- markUpdate(workInProgress);
- }
- } else {
- var _instance = createInstance(type, newProps, rootContainerInstance, _currentHostContext, workInProgress);
+ appendAllChildren(instance, workInProgress);
- appendAllChildren(_instance, workInProgress);
-
- // Certain renderers require commit-time effects for initial mount.
- // (eg DOM renderer supports auto-focus for certain elements).
- // Make sure such renderers get scheduled for later work.
- if (finalizeInitialChildren(_instance, type, newProps, rootContainerInstance)) {
- markUpdate(workInProgress);
- }
- workInProgress.stateNode = _instance;
+ // Certain renderers require commit-time effects for initial mount.
+ // (eg DOM renderer supports auto-focus for certain elements).
+ // Make sure such renderers get scheduled for later work.
+ if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance, currentHostContext)) {
+ markUpdate(workInProgress);
}
+ workInProgress.stateNode = instance;
+ }
- if (workInProgress.ref !== null) {
- // If there is a ref on a host node we need to schedule a callback
- markRef(workInProgress);
- }
+ if (workInProgress.ref !== null) {
+ // If there is a ref on a host node we need to schedule a callback
+ markRef$1(workInProgress);
}
- return null;
}
- case HostText:
- {
- var newText = newProps;
- if (current && workInProgress.stateNode != null) {
- var oldText = current.memoizedProps;
- // If we have an alternate, that means this is an update and we need
- // to schedule a side-effect to do the updates.
- updateHostText(current, workInProgress, oldText, newText);
- } else {
- if (typeof newText !== 'string') {
- !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- // This can happen when we abort work.
- return null;
- }
- var _rootContainerInstance = getRootHostContainer();
- var _currentHostContext2 = getHostContext();
- var _wasHydrated = popHydrationState(workInProgress);
- if (_wasHydrated) {
- if (prepareToHydrateHostTextInstance(workInProgress)) {
- markUpdate(workInProgress);
- }
- } else {
- workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext2, workInProgress);
+ break;
+ }
+ case HostText:
+ {
+ var newText = newProps;
+ if (current && workInProgress.stateNode != null) {
+ var oldText = current.memoizedProps;
+ // If we have an alternate, that means this is an update and we need
+ // to schedule a side-effect to do the updates.
+ updateHostText$1(current, workInProgress, oldText, newText);
+ } else {
+ if (typeof newText !== 'string') {
+ !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ // This can happen when we abort work.
+ }
+ var _rootContainerInstance = getRootHostContainer();
+ var _currentHostContext = getHostContext();
+ var _wasHydrated = popHydrationState(workInProgress);
+ if (_wasHydrated) {
+ if (prepareToHydrateHostTextInstance(workInProgress)) {
+ markUpdate(workInProgress);
}
+ } else {
+ workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
}
- return null;
}
- case CallComponent:
- return moveCallToHandlerPhase(current, workInProgress, renderExpirationTime);
- case CallHandlerPhase:
- // Reset the tag to now be a first phase call.
- workInProgress.tag = CallComponent;
- return null;
- case ReturnComponent:
- // Does nothing.
- return null;
- case Fragment:
- return null;
- case HostPortal:
- popHostContainer(workInProgress);
- updateHostContainer(workInProgress);
- return null;
- // Error cases
- case IndeterminateComponent:
- invariant(false, 'An indeterminate component should have become determinate before completing. This error is likely caused by a bug in React. Please file an issue.');
- // eslint-disable-next-line no-fallthrough
- default:
- invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
- }
+ break;
+ }
+ case ForwardRef:
+ case ForwardRefLazy:
+ break;
+ case PlaceholderComponent:
+ break;
+ case Fragment:
+ break;
+ case Mode:
+ break;
+ case Profiler:
+ break;
+ case HostPortal:
+ popHostContainer(workInProgress);
+ updateHostContainer(workInProgress);
+ break;
+ case ContextProvider:
+ // Pop provider fiber
+ popProvider(workInProgress);
+ break;
+ case ContextConsumer:
+ break;
+ // Error cases
+ case IndeterminateComponent:
+ invariant(false, 'An indeterminate component should have become determinate before completing. This error is likely caused by a bug in React. Please file an issue.');
+ // eslint-disable-next-line no-fallthrough
+ default:
+ invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
}
- return {
- completeWork: completeWork
- };
-};
+ return null;
+}
-var invokeGuardedCallback$2 = ReactErrorUtils.invokeGuardedCallback;
-var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;
-var clearCaughtError$1 = ReactErrorUtils.clearCaughtError;
+// This module is forked in different environments.
+// By default, return `true` to log errors to the console.
+// Forks can return `false` if this isn't desirable.
+function showErrorDialog(capturedError) {
+ return true;
+}
+function logCapturedError(capturedError) {
+ var logError = showErrorDialog(capturedError);
-var ReactFiberCommitWork = function (config, captureError) {
- var getPublicInstance = config.getPublicInstance,
- mutation = config.mutation,
- persistence = config.persistence;
+ // Allow injected showErrorDialog() to prevent default console.error logging.
+ // This enables renderers like ReactNative to better manage redbox behavior.
+ if (logError === false) {
+ return;
+ }
+ var error = capturedError.error;
+ {
+ var componentName = capturedError.componentName,
+ componentStack = capturedError.componentStack,
+ errorBoundaryName = capturedError.errorBoundaryName,
+ errorBoundaryFound = capturedError.errorBoundaryFound,
+ willRetry = capturedError.willRetry;
- var callComponentWillUnmountWithTimer = function (current, instance) {
- startPhaseTimer(current, 'componentWillUnmount');
- instance.props = current.memoizedProps;
- instance.state = current.memoizedState;
- instance.componentWillUnmount();
- stopPhaseTimer();
- };
+ // Browsers support silencing uncaught errors by calling
+ // `preventDefault()` in window `error` handler.
+ // We record this information as an expando on the error.
- // Capture errors so they don't interrupt unmounting.
- function safelyCallComponentWillUnmount(current, instance) {
- {
- invokeGuardedCallback$2(null, callComponentWillUnmountWithTimer, null, current, instance);
- if (hasCaughtError$1()) {
- var unmountError = clearCaughtError$1();
- captureError(current, unmountError);
+ if (error != null && error._suppressLogging) {
+ if (errorBoundaryFound && willRetry) {
+ // The error is recoverable and was silenced.
+ // Ignore it and don't print the stack addendum.
+ // This is handy for testing error boundaries without noise.
+ return;
}
+ // The error is fatal. Since the silencing might have
+ // been accidental, we'll surface it anyway.
+ // However, the browser would have silenced the original error
+ // so we'll print it first, and then print the stack addendum.
+ console.error(error);
+ // For a more detailed description of this block, see:
+ // https://github.com/facebook/react/pull/13384
}
- }
- function safelyDetachRef(current) {
- var ref = current.ref;
- if (ref !== null) {
- {
- invokeGuardedCallback$2(null, ref, null, null);
- if (hasCaughtError$1()) {
- var refError = clearCaughtError$1();
- captureError(current, refError);
- }
+ var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
+
+ var errorBoundaryMessage = void 0;
+ // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
+ if (errorBoundaryFound && errorBoundaryName) {
+ if (willRetry) {
+ errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
+ } else {
+ errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
}
+ } else {
+ errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
}
+ var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
+
+ // In development, we provide our own message with just the component stack.
+ // We don't include the original error message and JS stack because the browser
+ // has already printed it. Even if the application swallows the error, it is still
+ // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
+ console.error(combinedMessage);
}
+}
- function commitLifeCycles(current, finishedWork) {
- switch (finishedWork.tag) {
- case ClassComponent:
- {
- var instance = finishedWork.stateNode;
- if (finishedWork.effectTag & Update) {
- if (current === null) {
- startPhaseTimer(finishedWork, 'componentDidMount');
- instance.props = finishedWork.memoizedProps;
- instance.state = finishedWork.memoizedState;
- instance.componentDidMount();
- stopPhaseTimer();
- } else {
- var prevProps = current.memoizedProps;
- var prevState = current.memoizedState;
- startPhaseTimer(finishedWork, 'componentDidUpdate');
- instance.props = finishedWork.memoizedProps;
- instance.state = finishedWork.memoizedState;
- instance.componentDidUpdate(prevProps, prevState);
- stopPhaseTimer();
- }
- }
- var updateQueue = finishedWork.updateQueue;
- if (updateQueue !== null) {
- commitCallbacks(updateQueue, instance);
- }
- return;
- }
- case HostRoot:
- {
- var _updateQueue = finishedWork.updateQueue;
- if (_updateQueue !== null) {
- var _instance = finishedWork.child !== null ? finishedWork.child.stateNode : null;
- commitCallbacks(_updateQueue, _instance);
- }
- return;
- }
- case HostComponent:
- {
- var _instance2 = finishedWork.stateNode;
-
- // Renderers may schedule work to be done after host components are mounted
- // (eg DOM renderer may schedule auto-focus for inputs and form controls).
- // These effects should only be committed when components are first mounted,
- // aka when there is no current/alternate.
- if (current === null && finishedWork.effectTag & Update) {
- var type = finishedWork.type;
- var props = finishedWork.memoizedProps;
- commitMount(_instance2, type, props, finishedWork);
- }
+var emptyObject = {};
- return;
- }
- case HostText:
- {
- // We have no life-cycles associated with text.
- return;
- }
- case HostPortal:
- {
- // We have no life-cycles associated with portals.
- return;
- }
- default:
- {
- invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
- }
- }
+var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
+{
+ didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
+}
+
+function logError(boundary, errorInfo) {
+ var source = errorInfo.source;
+ var stack = errorInfo.stack;
+ if (stack === null && source !== null) {
+ stack = getStackByFiberInDevAndProd(source);
}
- function commitAttachRef(finishedWork) {
- var ref = finishedWork.ref;
- if (ref !== null) {
- var instance = finishedWork.stateNode;
- switch (finishedWork.tag) {
- case HostComponent:
- ref(getPublicInstance(instance));
- break;
- default:
- ref(instance);
- }
- }
+ var capturedError = {
+ componentName: source !== null ? getComponentName(source.type) : null,
+ componentStack: stack !== null ? stack : '',
+ error: errorInfo.value,
+ errorBoundary: null,
+ errorBoundaryName: null,
+ errorBoundaryFound: false,
+ willRetry: false
+ };
+
+ if (boundary !== null && boundary.tag === ClassComponent) {
+ capturedError.errorBoundary = boundary.stateNode;
+ capturedError.errorBoundaryName = getComponentName(boundary.type);
+ capturedError.errorBoundaryFound = true;
+ capturedError.willRetry = true;
}
- function commitDetachRef(current) {
- var currentRef = current.ref;
- if (currentRef !== null) {
- currentRef(null);
- }
+ try {
+ logCapturedError(capturedError);
+ } catch (e) {
+ // This method must not throw, or React internal state will get messed up.
+ // If console.error is overridden, or logCapturedError() shows a dialog that throws,
+ // we want to report this error outside of the normal stack as a last resort.
+ // https://github.com/facebook/react/issues/13188
+ setTimeout(function () {
+ throw e;
+ });
}
+}
- // User-originating errors (lifecycles and refs) should not interrupt
- // deletion, so don't let them throw. Host-originating errors should
- // interrupt deletion, so it's okay
- function commitUnmount(current) {
- if (typeof onCommitUnmount === 'function') {
- onCommitUnmount(current);
- }
+var callComponentWillUnmountWithTimer = function (current$$1, instance) {
+ startPhaseTimer(current$$1, 'componentWillUnmount');
+ instance.props = current$$1.memoizedProps;
+ instance.state = current$$1.memoizedState;
+ instance.componentWillUnmount();
+ stopPhaseTimer();
+};
- switch (current.tag) {
- case ClassComponent:
- {
- safelyDetachRef(current);
- var instance = current.stateNode;
- if (typeof instance.componentWillUnmount === 'function') {
- safelyCallComponentWillUnmount(current, instance);
- }
- return;
- }
- case HostComponent:
- {
- safelyDetachRef(current);
- return;
- }
- case CallComponent:
- {
- commitNestedUnmounts(current.stateNode);
- return;
- }
- case HostPortal:
- {
- // TODO: this is recursive.
- // We are also not using this parent because
- // the portal will get pushed immediately.
- if (enableMutatingReconciler && mutation) {
- unmountHostComponents(current);
- } else if (enablePersistentReconciler && persistence) {
- emptyPortalContainer(current);
- }
- return;
- }
+// Capture errors so they don't interrupt unmounting.
+function safelyCallComponentWillUnmount(current$$1, instance) {
+ {
+ invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
+ if (hasCaughtError()) {
+ var unmountError = clearCaughtError();
+ captureCommitPhaseError(current$$1, unmountError);
}
}
+}
- function commitNestedUnmounts(root) {
- // While we're inside a removed host node we don't want to call
- // removeChild on the inner nodes because they're removed by the top
- // call anyway. We also want to call componentWillUnmount on all
- // composites before this host node is removed from the tree. Therefore
- var node = root;
- while (true) {
- commitUnmount(node);
- // Visit children because they may contain more composite or host nodes.
- // Skip portals because commitUnmount() currently visits them recursively.
- if (node.child !== null && (
- // If we use mutation we drill down into portals using commitUnmount above.
- // If we don't use mutation we drill down into portals here instead.
- !mutation || node.tag !== HostPortal)) {
- node.child['return'] = node;
- node = node.child;
- continue;
- }
- if (node === root) {
- return;
- }
- while (node.sibling === null) {
- if (node['return'] === null || node['return'] === root) {
- return;
+function safelyDetachRef(current$$1) {
+ var ref = current$$1.ref;
+ if (ref !== null) {
+ if (typeof ref === 'function') {
+ {
+ invokeGuardedCallback(null, ref, null, null);
+ if (hasCaughtError()) {
+ var refError = clearCaughtError();
+ captureCommitPhaseError(current$$1, refError);
}
- node = node['return'];
}
- node.sibling['return'] = node['return'];
- node = node.sibling;
- }
- }
-
- function detachFiber(current) {
- // Cut off the return pointers to disconnect it from the tree. Ideally, we
- // should clear the child pointer of the parent alternate to let this
- // get GC:ed but we don't know which for sure which parent is the current
- // one so we'll settle for GC:ing the subtree of this child. This child
- // itself will be GC:ed when the parent updates the next time.
- current['return'] = null;
- current.child = null;
- if (current.alternate) {
- current.alternate.child = null;
- current.alternate['return'] = null;
+ } else {
+ ref.current = null;
}
}
+}
- if (!mutation) {
- var commitContainer = void 0;
- if (persistence) {
- var replaceContainerChildren = persistence.replaceContainerChildren,
- createContainerChildSet = persistence.createContainerChildSet;
-
- var emptyPortalContainer = function (current) {
- var portal = current.stateNode;
- var containerInfo = portal.containerInfo;
-
- var emptyChildSet = createContainerChildSet(containerInfo);
- replaceContainerChildren(containerInfo, emptyChildSet);
- };
- commitContainer = function (finishedWork) {
- switch (finishedWork.tag) {
- case ClassComponent:
- {
- return;
- }
- case HostComponent:
- {
- return;
- }
- case HostText:
- {
- return;
- }
- case HostRoot:
- case HostPortal:
- {
- var portalOrRoot = finishedWork.stateNode;
- var containerInfo = portalOrRoot.containerInfo,
- _pendingChildren = portalOrRoot.pendingChildren;
-
- replaceContainerChildren(containerInfo, _pendingChildren);
- return;
- }
- default:
+function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
+ switch (finishedWork.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ {
+ if (finishedWork.effectTag & Snapshot) {
+ if (current$$1 !== null) {
+ var prevProps = current$$1.memoizedProps;
+ var prevState = current$$1.memoizedState;
+ startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
+ var instance = finishedWork.stateNode;
+ instance.props = finishedWork.memoizedProps;
+ instance.state = finishedWork.memoizedState;
+ var snapshot = instance.getSnapshotBeforeUpdate(prevProps, prevState);
{
- invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
+ var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
+ if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
+ didWarnSet.add(finishedWork.type);
+ warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
+ }
}
+ instance.__reactInternalSnapshotBeforeUpdate = snapshot;
+ stopPhaseTimer();
+ }
}
- };
- } else {
- commitContainer = function (finishedWork) {
- // Noop
- };
- }
- if (enablePersistentReconciler || enableNoopReconciler) {
- return {
- commitResetTextContent: function (finishedWork) {},
- commitPlacement: function (finishedWork) {},
- commitDeletion: function (current) {
- // Detach refs and call componentWillUnmount() on the whole subtree.
- commitNestedUnmounts(current);
- detachFiber(current);
- },
- commitWork: function (current, finishedWork) {
- commitContainer(finishedWork);
- },
-
- commitLifeCycles: commitLifeCycles,
- commitAttachRef: commitAttachRef,
- commitDetachRef: commitDetachRef
- };
- } else if (persistence) {
- invariant(false, 'Persistent reconciler is disabled.');
- } else {
- invariant(false, 'Noop reconciler is disabled.');
- }
- }
- var commitMount = mutation.commitMount,
- commitUpdate = mutation.commitUpdate,
- resetTextContent = mutation.resetTextContent,
- commitTextUpdate = mutation.commitTextUpdate,
- appendChild = mutation.appendChild,
- appendChildToContainer = mutation.appendChildToContainer,
- insertBefore = mutation.insertBefore,
- insertInContainerBefore = mutation.insertInContainerBefore,
- removeChild = mutation.removeChild,
- removeChildFromContainer = mutation.removeChildFromContainer;
-
-
- function getHostParentFiber(fiber) {
- var parent = fiber['return'];
- while (parent !== null) {
- if (isHostParent(parent)) {
- return parent;
+ return;
+ }
+ case HostRoot:
+ case HostComponent:
+ case HostText:
+ case HostPortal:
+ // Nothing to do for these component types
+ return;
+ default:
+ {
+ invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
}
- parent = parent['return'];
- }
- invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
- }
-
- function isHostParent(fiber) {
- return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
}
+}
- function getHostSibling(fiber) {
- // We're going to search forward into the tree until we find a sibling host
- // node. Unfortunately, if multiple insertions are done in a row we have to
- // search past them. This leads to exponential search for the next sibling.
- var node = fiber;
- siblings: while (true) {
- // If we didn't find anything, let's try the next sibling.
- while (node.sibling === null) {
- if (node['return'] === null || isHostParent(node['return'])) {
- // If we pop out of the root or hit the parent the fiber we are the
- // last sibling.
- return null;
+function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
+ switch (finishedWork.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ {
+ var instance = finishedWork.stateNode;
+ if (finishedWork.effectTag & Update) {
+ if (current$$1 === null) {
+ startPhaseTimer(finishedWork, 'componentDidMount');
+ instance.props = finishedWork.memoizedProps;
+ instance.state = finishedWork.memoizedState;
+ instance.componentDidMount();
+ stopPhaseTimer();
+ } else {
+ var prevProps = current$$1.memoizedProps;
+ var prevState = current$$1.memoizedState;
+ startPhaseTimer(finishedWork, 'componentDidUpdate');
+ instance.props = finishedWork.memoizedProps;
+ instance.state = finishedWork.memoizedState;
+ instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
+ stopPhaseTimer();
+ }
+ }
+ var updateQueue = finishedWork.updateQueue;
+ if (updateQueue !== null) {
+ instance.props = finishedWork.memoizedProps;
+ instance.state = finishedWork.memoizedState;
+ commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
}
- node = node['return'];
+ return;
}
- node.sibling['return'] = node['return'];
- node = node.sibling;
- while (node.tag !== HostComponent && node.tag !== HostText) {
- // If it is not host node and, we might have a host node inside it.
- // Try to search down until we find one.
- if (node.effectTag & Placement) {
- // If we don't have a child, try the siblings instead.
- continue siblings;
+ case HostRoot:
+ {
+ var _updateQueue = finishedWork.updateQueue;
+ if (_updateQueue !== null) {
+ var _instance = null;
+ if (finishedWork.child !== null) {
+ switch (finishedWork.child.tag) {
+ case HostComponent:
+ _instance = getPublicInstance(finishedWork.child.stateNode);
+ break;
+ case ClassComponent:
+ case ClassComponentLazy:
+ _instance = finishedWork.child.stateNode;
+ break;
+ }
+ }
+ commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
}
- // If we don't have a child, try the siblings instead.
- // We also skip portals because they are not part of this host tree.
- if (node.child === null || node.tag === HostPortal) {
- continue siblings;
- } else {
- node.child['return'] = node;
- node = node.child;
+ return;
+ }
+ case HostComponent:
+ {
+ var _instance2 = finishedWork.stateNode;
+
+ // Renderers may schedule work to be done after host components are mounted
+ // (eg DOM renderer may schedule auto-focus for inputs and form controls).
+ // These effects should only be committed when components are first mounted,
+ // aka when there is no current/alternate.
+ if (current$$1 === null && finishedWork.effectTag & Update) {
+ var type = finishedWork.type;
+ var props = finishedWork.memoizedProps;
+ commitMount(_instance2, type, props, finishedWork);
}
+
+ return;
}
- // Check if this host node is stable or about to be placed.
- if (!(node.effectTag & Placement)) {
- // Found it!
- return node.stateNode;
+ case HostText:
+ {
+ // We have no life-cycles associated with text.
+ return;
}
- }
- }
-
- function commitPlacement(finishedWork) {
- // Recursively insert all host nodes into the parent.
- var parentFiber = getHostParentFiber(finishedWork);
- var parent = void 0;
- var isContainer = void 0;
- switch (parentFiber.tag) {
- case HostComponent:
- parent = parentFiber.stateNode;
- isContainer = false;
- break;
- case HostRoot:
- parent = parentFiber.stateNode.containerInfo;
- isContainer = true;
- break;
- case HostPortal:
- parent = parentFiber.stateNode.containerInfo;
- isContainer = true;
- break;
- default:
- invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
- }
- if (parentFiber.effectTag & ContentReset) {
- // Reset the text content of the parent before doing any insertions
- resetTextContent(parent);
- // Clear ContentReset from the effect tag
- parentFiber.effectTag &= ~ContentReset;
- }
+ case HostPortal:
+ {
+ // We have no life-cycles associated with portals.
+ return;
+ }
+ case Profiler:
+ {
+ if (enableProfilerTimer) {
+ var onRender = finishedWork.memoizedProps.onRender;
- var before = getHostSibling(finishedWork);
- // We only have the top Fiber that was inserted but we need recurse down its
- // children to find all the terminal nodes.
- var node = finishedWork;
- while (true) {
- if (node.tag === HostComponent || node.tag === HostText) {
- if (before) {
- if (isContainer) {
- insertInContainerBefore(parent, node.stateNode, before);
+ if (enableSchedulerTracing) {
+ onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
} else {
- insertBefore(parent, node.stateNode, before);
+ onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
}
- } else {
- if (isContainer) {
- appendChildToContainer(parent, node.stateNode);
+ }
+ return;
+ }
+ case PlaceholderComponent:
+ {
+ if (enableSuspense) {
+ if ((finishedWork.mode & StrictMode) === NoEffect) {
+ // In loose mode, a placeholder times out by scheduling a synchronous
+ // update in the commit phase. Use `updateQueue` field to signal that
+ // the Timeout needs to switch to the placeholder. We don't need an
+ // entire queue. Any non-null value works.
+ // $FlowFixMe - Intentionally using a value other than an UpdateQueue.
+ finishedWork.updateQueue = emptyObject;
+ scheduleWork(finishedWork, Sync);
} else {
- appendChild(parent, node.stateNode);
+ // In strict mode, the Update effect is used to record the time at
+ // which the placeholder timed out.
+ var currentTime = requestCurrentTime();
+ finishedWork.stateNode = { timedOutAt: currentTime };
}
}
- } else if (node.tag === HostPortal) {
- // If the insertion itself is a portal, then we don't want to traverse
- // down its children. Instead, we'll get insertions from each child in
- // the portal directly.
- } else if (node.child !== null) {
- node.child['return'] = node;
- node = node.child;
- continue;
- }
- if (node === finishedWork) {
return;
}
- while (node.sibling === null) {
- if (node['return'] === null || node['return'] === finishedWork) {
- return;
+ default:
+ {
+ invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
+ }
+ }
+}
+
+function commitAttachRef(finishedWork) {
+ var ref = finishedWork.ref;
+ if (ref !== null) {
+ var instance = finishedWork.stateNode;
+ var instanceToUse = void 0;
+ switch (finishedWork.tag) {
+ case HostComponent:
+ instanceToUse = getPublicInstance(instance);
+ break;
+ default:
+ instanceToUse = instance;
+ }
+ if (typeof ref === 'function') {
+ ref(instanceToUse);
+ } else {
+ {
+ if (!ref.hasOwnProperty('current')) {
+ warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
}
- node = node['return'];
}
- node.sibling['return'] = node['return'];
- node = node.sibling;
+
+ ref.current = instanceToUse;
}
}
+}
- function unmountHostComponents(current) {
- // We only have the top Fiber that was inserted but we need recurse down its
- var node = current;
-
- // Each iteration, currentParent is populated with node's host parent if not
- // currentParentIsValid.
- var currentParentIsValid = false;
- var currentParent = void 0;
- var currentParentIsContainer = void 0;
+function commitDetachRef(current$$1) {
+ var currentRef = current$$1.ref;
+ if (currentRef !== null) {
+ if (typeof currentRef === 'function') {
+ currentRef(null);
+ } else {
+ currentRef.current = null;
+ }
+ }
+}
- while (true) {
- if (!currentParentIsValid) {
- var parent = node['return'];
- findParent: while (true) {
- !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- switch (parent.tag) {
- case HostComponent:
- currentParent = parent.stateNode;
- currentParentIsContainer = false;
- break findParent;
- case HostRoot:
- currentParent = parent.stateNode.containerInfo;
- currentParentIsContainer = true;
- break findParent;
- case HostPortal:
- currentParent = parent.stateNode.containerInfo;
- currentParentIsContainer = true;
- break findParent;
- }
- parent = parent['return'];
- }
- currentParentIsValid = true;
- }
+// User-originating errors (lifecycles and refs) should not interrupt
+// deletion, so don't let them throw. Host-originating errors should
+// interrupt deletion, so it's okay
+function commitUnmount(current$$1) {
+ onCommitUnmount(current$$1);
- if (node.tag === HostComponent || node.tag === HostText) {
- commitNestedUnmounts(node);
- // After all the children have unmounted, it is now safe to remove the
- // node from the tree.
- if (currentParentIsContainer) {
- removeChildFromContainer(currentParent, node.stateNode);
- } else {
- removeChild(currentParent, node.stateNode);
- }
- // Don't visit children because we already visited them.
- } else if (node.tag === HostPortal) {
- // When we go into a portal, it becomes the parent to remove from.
- // We will reassign it back when we pop the portal on the way up.
- currentParent = node.stateNode.containerInfo;
- // Visit children because portals might contain host components.
- if (node.child !== null) {
- node.child['return'] = node;
- node = node.child;
- continue;
- }
- } else {
- commitUnmount(node);
- // Visit children because we may find more host components below.
- if (node.child !== null) {
- node.child['return'] = node;
- node = node.child;
- continue;
+ switch (current$$1.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ {
+ safelyDetachRef(current$$1);
+ var instance = current$$1.stateNode;
+ if (typeof instance.componentWillUnmount === 'function') {
+ safelyCallComponentWillUnmount(current$$1, instance);
}
+ return;
}
- if (node === current) {
+ case HostComponent:
+ {
+ safelyDetachRef(current$$1);
return;
}
- while (node.sibling === null) {
- if (node['return'] === null || node['return'] === current) {
- return;
- }
- node = node['return'];
- if (node.tag === HostPortal) {
- // When we go out of the portal, we need to restore the parent.
- // Since we don't keep a stack of them, we will search for it.
- currentParentIsValid = false;
+ case HostPortal:
+ {
+ // TODO: this is recursive.
+ // We are also not using this parent because
+ // the portal will get pushed immediately.
+ if (supportsMutation) {
+ unmountHostComponents(current$$1);
+ } else if (supportsPersistence) {
+ emptyPortalContainer(current$$1);
}
+ return;
}
- node.sibling['return'] = node['return'];
- node = node.sibling;
- }
- }
-
- function commitDeletion(current) {
- // Recursively delete all host nodes from the parent.
- // Detach refs and call componentWillUnmount() on the whole subtree.
- unmountHostComponents(current);
- detachFiber(current);
}
+}
- function commitWork(current, finishedWork) {
- switch (finishedWork.tag) {
- case ClassComponent:
- {
- return;
- }
- case HostComponent:
- {
- var instance = finishedWork.stateNode;
- if (instance != null) {
- // Commit the work prepared earlier.
- var newProps = finishedWork.memoizedProps;
- // For hydration we reuse the update path but we treat the oldProps
- // as the newProps. The updatePayload will contain the real change in
- // this case.
- var oldProps = current !== null ? current.memoizedProps : newProps;
- var type = finishedWork.type;
- // TODO: Type the updateQueue to be specific to host components.
- var updatePayload = finishedWork.updateQueue;
- finishedWork.updateQueue = null;
- if (updatePayload !== null) {
- commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
- }
- }
- return;
- }
- case HostText:
- {
- !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- var textInstance = finishedWork.stateNode;
- var newText = finishedWork.memoizedProps;
- // For hydration we reuse the update path but we treat the oldProps
- // as the newProps. The updatePayload will contain the real change in
- // this case.
- var oldText = current !== null ? current.memoizedProps : newText;
- commitTextUpdate(textInstance, oldText, newText);
- return;
- }
- case HostRoot:
- {
- return;
- }
- default:
- {
- invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
- }
+function commitNestedUnmounts(root) {
+ // While we're inside a removed host node we don't want to call
+ // removeChild on the inner nodes because they're removed by the top
+ // call anyway. We also want to call componentWillUnmount on all
+ // composites before this host node is removed from the tree. Therefore
+ var node = root;
+ while (true) {
+ commitUnmount(node);
+ // Visit children because they may contain more composite or host nodes.
+ // Skip portals because commitUnmount() currently visits them recursively.
+ if (node.child !== null && (
+ // If we use mutation we drill down into portals using commitUnmount above.
+ // If we don't use mutation we drill down into portals here instead.
+ !supportsMutation || node.tag !== HostPortal)) {
+ node.child.return = node;
+ node = node.child;
+ continue;
}
+ if (node === root) {
+ return;
+ }
+ while (node.sibling === null) {
+ if (node.return === null || node.return === root) {
+ return;
+ }
+ node = node.return;
+ }
+ node.sibling.return = node.return;
+ node = node.sibling;
}
+}
- function commitResetTextContent(current) {
- resetTextContent(current.stateNode);
+function detachFiber(current$$1) {
+ // Cut off the return pointers to disconnect it from the tree. Ideally, we
+ // should clear the child pointer of the parent alternate to let this
+ // get GC:ed but we don't know which for sure which parent is the current
+ // one so we'll settle for GC:ing the subtree of this child. This child
+ // itself will be GC:ed when the parent updates the next time.
+ current$$1.return = null;
+ current$$1.child = null;
+ if (current$$1.alternate) {
+ current$$1.alternate.child = null;
+ current$$1.alternate.return = null;
}
+}
- if (enableMutatingReconciler) {
- return {
- commitResetTextContent: commitResetTextContent,
- commitPlacement: commitPlacement,
- commitDeletion: commitDeletion,
- commitWork: commitWork,
- commitLifeCycles: commitLifeCycles,
- commitAttachRef: commitAttachRef,
- commitDetachRef: commitDetachRef
- };
- } else {
- invariant(false, 'Mutating reconciler is disabled.');
+function emptyPortalContainer(current$$1) {
+ if (!supportsPersistence) {
+ return;
}
-};
-
-var NO_CONTEXT = {};
-
-var ReactFiberHostContext = function (config) {
- var getChildHostContext = config.getChildHostContext,
- getRootHostContext = config.getRootHostContext;
+ var portal = current$$1.stateNode;
+ var containerInfo = portal.containerInfo;
- var contextStackCursor = createCursor(NO_CONTEXT);
- var contextFiberStackCursor = createCursor(NO_CONTEXT);
- var rootInstanceStackCursor = createCursor(NO_CONTEXT);
-
- function requiredContext(c) {
- !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- return c;
- }
+ var emptyChildSet = createContainerChildSet(containerInfo);
+ replaceContainerChildren(containerInfo, emptyChildSet);
+}
- function getRootHostContainer() {
- var rootInstance = requiredContext(rootInstanceStackCursor.current);
- return rootInstance;
+function commitContainer(finishedWork) {
+ if (!supportsPersistence) {
+ return;
}
- function pushHostContainer(fiber, nextRootInstance) {
- // Push current root instance onto the stack;
- // This allows us to reset root when portals are popped.
- push(rootInstanceStackCursor, nextRootInstance, fiber);
-
- var nextRootContext = getRootHostContext(nextRootInstance);
-
- // Track the context and the Fiber that provided it.
- // This enables us to pop only Fibers that provide unique contexts.
- push(contextFiberStackCursor, fiber, fiber);
- push(contextStackCursor, nextRootContext, fiber);
- }
+ switch (finishedWork.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ {
+ return;
+ }
+ case HostComponent:
+ {
+ return;
+ }
+ case HostText:
+ {
+ return;
+ }
+ case HostRoot:
+ case HostPortal:
+ {
+ var portalOrRoot = finishedWork.stateNode;
+ var containerInfo = portalOrRoot.containerInfo,
+ _pendingChildren = portalOrRoot.pendingChildren;
- function popHostContainer(fiber) {
- pop(contextStackCursor, fiber);
- pop(contextFiberStackCursor, fiber);
- pop(rootInstanceStackCursor, fiber);
+ replaceContainerChildren(containerInfo, _pendingChildren);
+ return;
+ }
+ default:
+ {
+ invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
+ }
}
+}
- function getHostContext() {
- var context = requiredContext(contextStackCursor.current);
- return context;
+function getHostParentFiber(fiber) {
+ var parent = fiber.return;
+ while (parent !== null) {
+ if (isHostParent(parent)) {
+ return parent;
+ }
+ parent = parent.return;
}
+ invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
+}
- function pushHostContext(fiber) {
- var rootInstance = requiredContext(rootInstanceStackCursor.current);
- var context = requiredContext(contextStackCursor.current);
- var nextContext = getChildHostContext(context, fiber.type, rootInstance);
+function isHostParent(fiber) {
+ return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
+}
- // Don't push this Fiber's context unless it's unique.
- if (context === nextContext) {
- return;
+function getHostSibling(fiber) {
+ // We're going to search forward into the tree until we find a sibling host
+ // node. Unfortunately, if multiple insertions are done in a row we have to
+ // search past them. This leads to exponential search for the next sibling.
+ var node = fiber;
+ siblings: while (true) {
+ // If we didn't find anything, let's try the next sibling.
+ while (node.sibling === null) {
+ if (node.return === null || isHostParent(node.return)) {
+ // If we pop out of the root or hit the parent the fiber we are the
+ // last sibling.
+ return null;
+ }
+ node = node.return;
}
-
- // Track the context and the Fiber that provided it.
- // This enables us to pop only Fibers that provide unique contexts.
- push(contextFiberStackCursor, fiber, fiber);
- push(contextStackCursor, nextContext, fiber);
- }
-
- function popHostContext(fiber) {
- // Do not pop unless this Fiber provided the current context.
- // pushHostContext() only pushes Fibers that provide unique contexts.
- if (contextFiberStackCursor.current !== fiber) {
- return;
+ node.sibling.return = node.return;
+ node = node.sibling;
+ while (node.tag !== HostComponent && node.tag !== HostText) {
+ // If it is not host node and, we might have a host node inside it.
+ // Try to search down until we find one.
+ if (node.effectTag & Placement) {
+ // If we don't have a child, try the siblings instead.
+ continue siblings;
+ }
+ // If we don't have a child, try the siblings instead.
+ // We also skip portals because they are not part of this host tree.
+ if (node.child === null || node.tag === HostPortal) {
+ continue siblings;
+ } else {
+ node.child.return = node;
+ node = node.child;
+ }
+ }
+ // Check if this host node is stable or about to be placed.
+ if (!(node.effectTag & Placement)) {
+ // Found it!
+ return node.stateNode;
}
-
- pop(contextStackCursor, fiber);
- pop(contextFiberStackCursor, fiber);
}
+}
- function resetHostContainer() {
- contextStackCursor.current = NO_CONTEXT;
- rootInstanceStackCursor.current = NO_CONTEXT;
+function commitPlacement(finishedWork) {
+ if (!supportsMutation) {
+ return;
}
- return {
- getHostContext: getHostContext,
- getRootHostContainer: getRootHostContainer,
- popHostContainer: popHostContainer,
- popHostContext: popHostContext,
- pushHostContainer: pushHostContainer,
- pushHostContext: pushHostContext,
- resetHostContainer: resetHostContainer
- };
-};
-
-var ReactFiberHydrationContext = function (config) {
- var shouldSetTextContent = config.shouldSetTextContent,
- hydration = config.hydration;
+ // Recursively insert all host nodes into the parent.
+ var parentFiber = getHostParentFiber(finishedWork);
- // If this doesn't have hydration mode.
+ // Note: these two variables *must* always be updated together.
+ var parent = void 0;
+ var isContainer = void 0;
- if (!hydration) {
- return {
- enterHydrationState: function () {
- return false;
- },
- resetHydrationState: function () {},
- tryToClaimNextHydratableInstance: function () {},
- prepareToHydrateHostInstance: function () {
- invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
- },
- prepareToHydrateHostTextInstance: function () {
- invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
- },
- popHydrationState: function (fiber) {
- return false;
- }
- };
+ switch (parentFiber.tag) {
+ case HostComponent:
+ parent = parentFiber.stateNode;
+ isContainer = false;
+ break;
+ case HostRoot:
+ parent = parentFiber.stateNode.containerInfo;
+ isContainer = true;
+ break;
+ case HostPortal:
+ parent = parentFiber.stateNode.containerInfo;
+ isContainer = true;
+ break;
+ default:
+ invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
}
-
- var canHydrateInstance = hydration.canHydrateInstance,
- canHydrateTextInstance = hydration.canHydrateTextInstance,
- getNextHydratableSibling = hydration.getNextHydratableSibling,
- getFirstHydratableChild = hydration.getFirstHydratableChild,
- hydrateInstance = hydration.hydrateInstance,
- hydrateTextInstance = hydration.hydrateTextInstance,
- didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance,
- didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance,
- didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance,
- didNotHydrateInstance = hydration.didNotHydrateInstance,
- didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance,
- didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance,
- didNotFindHydratableInstance = hydration.didNotFindHydratableInstance,
- didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance;
-
- // The deepest Fiber on the stack involved in a hydration context.
- // This may have been an insertion or a hydration.
-
- var hydrationParentFiber = null;
- var nextHydratableInstance = null;
- var isHydrating = false;
-
- function enterHydrationState(fiber) {
- var parentInstance = fiber.stateNode.containerInfo;
- nextHydratableInstance = getFirstHydratableChild(parentInstance);
- hydrationParentFiber = fiber;
- isHydrating = true;
- return true;
+ if (parentFiber.effectTag & ContentReset) {
+ // Reset the text content of the parent before doing any insertions
+ resetTextContent(parent);
+ // Clear ContentReset from the effect tag
+ parentFiber.effectTag &= ~ContentReset;
}
- function deleteHydratableInstance(returnFiber, instance) {
- {
- switch (returnFiber.tag) {
- case HostRoot:
- didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
- break;
- case HostComponent:
- didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
- break;
+ var before = getHostSibling(finishedWork);
+ // We only have the top Fiber that was inserted but we need recurse down its
+ // children to find all the terminal nodes.
+ var node = finishedWork;
+ while (true) {
+ if (node.tag === HostComponent || node.tag === HostText) {
+ if (before) {
+ if (isContainer) {
+ insertInContainerBefore(parent, node.stateNode, before);
+ } else {
+ insertBefore(parent, node.stateNode, before);
+ }
+ } else {
+ if (isContainer) {
+ appendChildToContainer(parent, node.stateNode);
+ } else {
+ appendChild(parent, node.stateNode);
+ }
}
+ } else if (node.tag === HostPortal) {
+ // If the insertion itself is a portal, then we don't want to traverse
+ // down its children. Instead, we'll get insertions from each child in
+ // the portal directly.
+ } else if (node.child !== null) {
+ node.child.return = node;
+ node = node.child;
+ continue;
}
-
- var childToDelete = createFiberFromHostInstanceForDeletion();
- childToDelete.stateNode = instance;
- childToDelete['return'] = returnFiber;
- childToDelete.effectTag = Deletion;
-
- // This might seem like it belongs on progressedFirstDeletion. However,
- // these children are not part of the reconciliation list of children.
- // Even if we abort and rereconcile the children, that will try to hydrate
- // again and the nodes are still in the host tree so these will be
- // recreated.
- if (returnFiber.lastEffect !== null) {
- returnFiber.lastEffect.nextEffect = childToDelete;
- returnFiber.lastEffect = childToDelete;
- } else {
- returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
+ if (node === finishedWork) {
+ return;
}
- }
-
- function insertNonHydratedInstance(returnFiber, fiber) {
- fiber.effectTag |= Placement;
- {
- switch (returnFiber.tag) {
- case HostRoot:
- {
- var parentContainer = returnFiber.stateNode.containerInfo;
- switch (fiber.tag) {
- case HostComponent:
- var type = fiber.type;
- var props = fiber.pendingProps;
- didNotFindHydratableContainerInstance(parentContainer, type, props);
- break;
- case HostText:
- var text = fiber.pendingProps;
- didNotFindHydratableContainerTextInstance(parentContainer, text);
- break;
- }
- break;
- }
- case HostComponent:
- {
- var parentType = returnFiber.type;
- var parentProps = returnFiber.memoizedProps;
- var parentInstance = returnFiber.stateNode;
- switch (fiber.tag) {
- case HostComponent:
- var _type = fiber.type;
- var _props = fiber.pendingProps;
- didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
- break;
- case HostText:
- var _text = fiber.pendingProps;
- didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
- break;
- }
- break;
- }
- default:
- return;
+ while (node.sibling === null) {
+ if (node.return === null || node.return === finishedWork) {
+ return;
}
+ node = node.return;
}
+ node.sibling.return = node.return;
+ node = node.sibling;
}
+}
- function tryHydrate(fiber, nextInstance) {
- switch (fiber.tag) {
- case HostComponent:
- {
- var type = fiber.type;
- var props = fiber.pendingProps;
- var instance = canHydrateInstance(nextInstance, type, props);
- if (instance !== null) {
- fiber.stateNode = instance;
- return true;
- }
- return false;
- }
- case HostText:
- {
- var text = fiber.pendingProps;
- var textInstance = canHydrateTextInstance(nextInstance, text);
- if (textInstance !== null) {
- fiber.stateNode = textInstance;
- return true;
- }
- return false;
+function unmountHostComponents(current$$1) {
+ // We only have the top Fiber that was deleted but we need recurse down its
+ var node = current$$1;
+
+ // Each iteration, currentParent is populated with node's host parent if not
+ // currentParentIsValid.
+ var currentParentIsValid = false;
+
+ // Note: these two variables *must* always be updated together.
+ var currentParent = void 0;
+ var currentParentIsContainer = void 0;
+
+ while (true) {
+ if (!currentParentIsValid) {
+ var parent = node.return;
+ findParent: while (true) {
+ !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ switch (parent.tag) {
+ case HostComponent:
+ currentParent = parent.stateNode;
+ currentParentIsContainer = false;
+ break findParent;
+ case HostRoot:
+ currentParent = parent.stateNode.containerInfo;
+ currentParentIsContainer = true;
+ break findParent;
+ case HostPortal:
+ currentParent = parent.stateNode.containerInfo;
+ currentParentIsContainer = true;
+ break findParent;
}
- default:
- return false;
+ parent = parent.return;
+ }
+ currentParentIsValid = true;
}
- }
- function tryToClaimNextHydratableInstance(fiber) {
- if (!isHydrating) {
- return;
+ if (node.tag === HostComponent || node.tag === HostText) {
+ commitNestedUnmounts(node);
+ // After all the children have unmounted, it is now safe to remove the
+ // node from the tree.
+ if (currentParentIsContainer) {
+ removeChildFromContainer(currentParent, node.stateNode);
+ } else {
+ removeChild(currentParent, node.stateNode);
+ }
+ // Don't visit children because we already visited them.
+ } else if (node.tag === HostPortal) {
+ // When we go into a portal, it becomes the parent to remove from.
+ // We will reassign it back when we pop the portal on the way up.
+ currentParent = node.stateNode.containerInfo;
+ currentParentIsContainer = true;
+ // Visit children because portals might contain host components.
+ if (node.child !== null) {
+ node.child.return = node;
+ node = node.child;
+ continue;
+ }
+ } else {
+ commitUnmount(node);
+ // Visit children because we may find more host components below.
+ if (node.child !== null) {
+ node.child.return = node;
+ node = node.child;
+ continue;
+ }
}
- var nextInstance = nextHydratableInstance;
- if (!nextInstance) {
- // Nothing to hydrate. Make it an insertion.
- insertNonHydratedInstance(hydrationParentFiber, fiber);
- isHydrating = false;
- hydrationParentFiber = fiber;
+ if (node === current$$1) {
return;
}
- if (!tryHydrate(fiber, nextInstance)) {
- // If we can't hydrate this instance let's try the next one.
- // We use this as a heuristic. It's based on intuition and not data so it
- // might be flawed or unnecessary.
- nextInstance = getNextHydratableSibling(nextInstance);
- if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
- // Nothing to hydrate. Make it an insertion.
- insertNonHydratedInstance(hydrationParentFiber, fiber);
- isHydrating = false;
- hydrationParentFiber = fiber;
+ while (node.sibling === null) {
+ if (node.return === null || node.return === current$$1) {
return;
}
- // We matched the next one, we'll now assume that the first one was
- // superfluous and we'll delete it. Since we can't eagerly delete it
- // we'll have to schedule a deletion. To do that, this node needs a dummy
- // fiber associated with it.
- deleteHydratableInstance(hydrationParentFiber, nextHydratableInstance);
+ node = node.return;
+ if (node.tag === HostPortal) {
+ // When we go out of the portal, we need to restore the parent.
+ // Since we don't keep a stack of them, we will search for it.
+ currentParentIsValid = false;
+ }
}
- hydrationParentFiber = fiber;
- nextHydratableInstance = getFirstHydratableChild(nextInstance);
+ node.sibling.return = node.return;
+ node = node.sibling;
}
+}
- function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
- var instance = fiber.stateNode;
- var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
- // TODO: Type this specific to this type of component.
- fiber.updateQueue = updatePayload;
- // If the update payload indicates that there is a change or if there
- // is a new ref we mark this as an update.
- if (updatePayload !== null) {
- return true;
- }
- return false;
+function commitDeletion(current$$1) {
+ if (supportsMutation) {
+ // Recursively delete all host nodes from the parent.
+ // Detach refs and call componentWillUnmount() on the whole subtree.
+ unmountHostComponents(current$$1);
+ } else {
+ // Detach refs and call componentWillUnmount() on the whole subtree.
+ commitNestedUnmounts(current$$1);
}
+ detachFiber(current$$1);
+}
- function prepareToHydrateHostTextInstance(fiber) {
- var textInstance = fiber.stateNode;
- var textContent = fiber.memoizedProps;
- var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
- {
- if (shouldUpdate) {
- // We assume that prepareToHydrateHostTextInstance is called in a context where the
- // hydration parent is the parent host component of this host text.
- var returnFiber = hydrationParentFiber;
- if (returnFiber !== null) {
- switch (returnFiber.tag) {
- case HostRoot:
- {
- var parentContainer = returnFiber.stateNode.containerInfo;
- didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
- break;
- }
- case HostComponent:
- {
- var parentType = returnFiber.type;
- var parentProps = returnFiber.memoizedProps;
- var parentInstance = returnFiber.stateNode;
- didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
- break;
- }
+function commitWork(current$$1, finishedWork) {
+ if (!supportsMutation) {
+ commitContainer(finishedWork);
+ return;
+ }
+
+ switch (finishedWork.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ {
+ return;
+ }
+ case HostComponent:
+ {
+ var instance = finishedWork.stateNode;
+ if (instance != null) {
+ // Commit the work prepared earlier.
+ var newProps = finishedWork.memoizedProps;
+ // For hydration we reuse the update path but we treat the oldProps
+ // as the newProps. The updatePayload will contain the real change in
+ // this case.
+ var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
+ var type = finishedWork.type;
+ // TODO: Type the updateQueue to be specific to host components.
+ var updatePayload = finishedWork.updateQueue;
+ finishedWork.updateQueue = null;
+ if (updatePayload !== null) {
+ commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
}
}
+ return;
+ }
+ case HostText:
+ {
+ !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var textInstance = finishedWork.stateNode;
+ var newText = finishedWork.memoizedProps;
+ // For hydration we reuse the update path but we treat the oldProps
+ // as the newProps. The updatePayload will contain the real change in
+ // this case.
+ var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
+ commitTextUpdate(textInstance, oldText, newText);
+ return;
+ }
+ case HostRoot:
+ {
+ return;
+ }
+ case Profiler:
+ {
+ return;
+ }
+ case PlaceholderComponent:
+ {
+ return;
+ }
+ default:
+ {
+ invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
}
- }
- return shouldUpdate;
}
+}
- function popToNextHostParent(fiber) {
- var parent = fiber['return'];
- while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
- parent = parent['return'];
- }
- hydrationParentFiber = parent;
+function commitResetTextContent(current$$1) {
+ if (!supportsMutation) {
+ return;
}
+ resetTextContent(current$$1.stateNode);
+}
- function popHydrationState(fiber) {
- if (fiber !== hydrationParentFiber) {
- // We're deeper than the current hydration context, inside an inserted
- // tree.
- return false;
- }
- if (!isHydrating) {
- // If we're not currently hydrating but we're in a hydration context, then
- // we were an insertion and now need to pop up reenter hydration of our
- // siblings.
- popToNextHostParent(fiber);
- isHydrating = true;
- return false;
- }
-
- var type = fiber.type;
+function NoopComponent() {
+ return null;
+}
- // If we have any remaining hydratable nodes, we need to delete them now.
- // We only do this deeper than head and body since they tend to have random
- // other nodes in them. We also ignore components with pure text content in
- // side of them.
- // TODO: Better heuristic.
- if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
- var nextInstance = nextHydratableInstance;
- while (nextInstance) {
- deleteHydratableInstance(fiber, nextInstance);
- nextInstance = getNextHydratableSibling(nextInstance);
- }
- }
+function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
+ var update = createUpdate(expirationTime);
+ // Unmount the root by rendering null.
+ update.tag = CaptureUpdate;
+ // Caution: React DevTools currently depends on this property
+ // being called "element".
+ update.payload = { element: null };
+ var error = errorInfo.value;
+ update.callback = function () {
+ onUncaughtError(error);
+ logError(fiber, errorInfo);
+ };
+ return update;
+}
- popToNextHostParent(fiber);
- nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
- return true;
+function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
+ var update = createUpdate(expirationTime);
+ update.tag = CaptureUpdate;
+ var getDerivedStateFromCatch = fiber.type.getDerivedStateFromCatch;
+ if (enableGetDerivedStateFromCatch && typeof getDerivedStateFromCatch === 'function') {
+ var error = errorInfo.value;
+ update.payload = function () {
+ return getDerivedStateFromCatch(error);
+ };
}
- function resetHydrationState() {
- hydrationParentFiber = null;
- nextHydratableInstance = null;
- isHydrating = false;
+ var inst = fiber.stateNode;
+ if (inst !== null && typeof inst.componentDidCatch === 'function') {
+ update.callback = function callback() {
+ if (!enableGetDerivedStateFromCatch || getDerivedStateFromCatch !== 'function') {
+ // To preserve the preexisting retry behavior of error boundaries,
+ // we keep track of which ones already failed during this batch.
+ // This gets reset before we yield back to the browser.
+ // TODO: Warn in strict mode if getDerivedStateFromCatch is
+ // not defined.
+ markLegacyErrorBoundaryAsFailed(this);
+ }
+ var error = errorInfo.value;
+ var stack = errorInfo.stack;
+ logError(fiber, errorInfo);
+ this.componentDidCatch(error, {
+ componentStack: stack !== null ? stack : ''
+ });
+ };
}
+ return update;
+}
- return {
- enterHydrationState: enterHydrationState,
- resetHydrationState: resetHydrationState,
- tryToClaimNextHydratableInstance: tryToClaimNextHydratableInstance,
- prepareToHydrateHostInstance: prepareToHydrateHostInstance,
- prepareToHydrateHostTextInstance: prepareToHydrateHostTextInstance,
- popHydrationState: popHydrationState
- };
-};
+function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
+ // The source fiber did not complete.
+ sourceFiber.effectTag |= Incomplete;
+ // Its effect list is no longer valid.
+ sourceFiber.firstEffect = sourceFiber.lastEffect = null;
-// This lets us hook into Fiber to debug what it's doing.
-// See https://github.com/facebook/react/pull/8033.
-// This is not part of the public API, not even for React DevTools.
-// You may only inject a debugTool if you work on React Fiber itself.
-var ReactFiberInstrumentation = {
- debugTool: null
-};
+ if (enableSuspense && value !== null && typeof value === 'object' && typeof value.then === 'function') {
+ // This is a thenable.
+ var thenable = value;
-var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
+ // Find the earliest timeout threshold of all the placeholders in the
+ // ancestor path. We could avoid this traversal by storing the thresholds on
+ // the stack, but we choose not to because we only hit this path if we're
+ // IO-bound (i.e. if something suspends). Whereas the stack is used even in
+ // the non-IO- bound case.
+ var _workInProgress = returnFiber;
+ var earliestTimeoutMs = -1;
+ var startTimeMs = -1;
+ do {
+ if (_workInProgress.tag === PlaceholderComponent) {
+ var current = _workInProgress.alternate;
+ if (current !== null && current.memoizedState === true && current.stateNode !== null) {
+ // Reached a placeholder that already timed out. Each timed out
+ // placeholder acts as the root of a new suspense boundary.
+
+ // Use the time at which the placeholder timed out as the start time
+ // for the current render.
+ var timedOutAt = current.stateNode.timedOutAt;
+ startTimeMs = expirationTimeToMs(timedOutAt);
+
+ // Do not search any further.
+ break;
+ }
+ var timeoutPropMs = _workInProgress.pendingProps.delayMs;
+ if (typeof timeoutPropMs === 'number') {
+ if (timeoutPropMs <= 0) {
+ earliestTimeoutMs = 0;
+ } else if (earliestTimeoutMs === -1 || timeoutPropMs < earliestTimeoutMs) {
+ earliestTimeoutMs = timeoutPropMs;
+ }
+ }
+ }
+ _workInProgress = _workInProgress.return;
+ } while (_workInProgress !== null);
-var defaultShowDialog = function (capturedError) {
- return true;
-};
+ // Schedule the nearest Placeholder to re-render the timed out view.
+ _workInProgress = returnFiber;
+ do {
+ if (_workInProgress.tag === PlaceholderComponent) {
+ var didTimeout = _workInProgress.memoizedState;
+ if (!didTimeout) {
+ // Found the nearest boundary.
+
+ // If the boundary is not in async mode, we should not suspend, and
+ // likewise, when the promise resolves, we should ping synchronously.
+ var pingTime = (_workInProgress.mode & AsyncMode) === NoEffect ? Sync : renderExpirationTime;
+
+ // Attach a listener to the promise to "ping" the root and retry.
+ var onResolveOrReject = retrySuspendedRoot.bind(null, root, _workInProgress, pingTime);
+ thenable.then(onResolveOrReject, onResolveOrReject);
+
+ // If the boundary is outside of strict mode, we should *not* suspend
+ // the commit. Pretend as if the suspended component rendered null and
+ // keep rendering. In the commit phase, we'll schedule a subsequent
+ // synchronous update to re-render the Placeholder.
+ //
+ // Note: It doesn't matter whether the component that suspended was
+ // inside a strict mode tree. If the Placeholder is outside of it, we
+ // should *not* suspend the commit.
+ if ((_workInProgress.mode & StrictMode) === NoEffect) {
+ _workInProgress.effectTag |= Update;
+
+ // Unmount the source fiber's children
+ var nextChildren = null;
+ reconcileChildren(sourceFiber.alternate, sourceFiber, nextChildren, renderExpirationTime);
+ sourceFiber.effectTag &= ~Incomplete;
+ if (sourceFiber.tag === IndeterminateComponent) {
+ // Let's just assume it's a functional component. This fiber will
+ // be unmounted in the immediate next commit, anyway.
+ sourceFiber.tag = FunctionalComponent;
+ }
-var showDialog = defaultShowDialog;
+ if (sourceFiber.tag === ClassComponent || sourceFiber.tag === ClassComponentLazy) {
+ // We're going to commit this fiber even though it didn't
+ // complete. But we shouldn't call any lifecycle methods or
+ // callbacks. Remove all lifecycle effect tags.
+ sourceFiber.effectTag &= ~LifecycleEffectMask;
+ if (sourceFiber.alternate === null) {
+ // We're about to mount a class component that doesn't have an
+ // instance. Turn this into a dummy functional component instead,
+ // to prevent type errors. This is a bit weird but it's an edge
+ // case and we're about to synchronously delete this
+ // component, anyway.
+ sourceFiber.tag = FunctionalComponent;
+ sourceFiber.type = NoopComponent;
+ }
+ }
-function logCapturedError(capturedError) {
- var logError = showDialog(capturedError);
+ // Exit without suspending.
+ return;
+ }
- // Allow injected showDialog() to prevent default console.error logging.
- // This enables renderers like ReactNative to better manage redbox behavior.
- if (logError === false) {
- return;
- }
+ // Confirmed that the boundary is in a strict mode tree. Continue with
+ // the normal suspend path.
- var error = capturedError.error;
- var suppressLogging = error && error.suppressReactErrorLogging;
- if (suppressLogging) {
- return;
- }
+ var absoluteTimeoutMs = void 0;
+ if (earliestTimeoutMs === -1) {
+ // If no explicit threshold is given, default to an abitrarily large
+ // value. The actual size doesn't matter because the threshold for the
+ // whole tree will be clamped to the expiration time.
+ absoluteTimeoutMs = maxSigned31BitInt;
+ } else {
+ if (startTimeMs === -1) {
+ // This suspend happened outside of any already timed-out
+ // placeholders. We don't know exactly when the update was scheduled,
+ // but we can infer an approximate start time from the expiration
+ // time. First, find the earliest uncommitted expiration time in the
+ // tree, including work that is suspended. Then subtract the offset
+ // used to compute an async update's expiration time. This will cause
+ // high priority (interactive) work to expire earlier than necessary,
+ // but we can account for this by adjusting for the Just Noticeable
+ // Difference.
+ var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
+ var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
+ startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
+ }
+ absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
+ }
- {
- var componentName = capturedError.componentName,
- componentStack = capturedError.componentStack,
- errorBoundaryName = capturedError.errorBoundaryName,
- errorBoundaryFound = capturedError.errorBoundaryFound,
- willRetry = capturedError.willRetry;
+ // Mark the earliest timeout in the suspended fiber's ancestor path.
+ // After completing the root, we'll take the largest of all the
+ // suspended fiber's timeouts and use it to compute a timeout for the
+ // whole tree.
+ renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
+ _workInProgress.effectTag |= ShouldCapture;
+ _workInProgress.expirationTime = renderExpirationTime;
+ return;
+ }
+ // This boundary already captured during this render. Continue to the
+ // next boundary.
+ }
+ _workInProgress = _workInProgress.return;
+ } while (_workInProgress !== null);
+ // No boundary was found. Fallthrough to error mode.
+ value = new Error('An update was suspended, but no placeholder UI was provided.');
+ }
- var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
+ // We didn't find a boundary that could handle this type of exception. Start
+ // over and traverse parent path again, this time treating the exception
+ // as an error.
+ renderDidError();
+ value = createCapturedValue(value, sourceFiber);
+ var workInProgress = returnFiber;
+ do {
+ switch (workInProgress.tag) {
+ case HostRoot:
+ {
+ var _errorInfo = value;
+ workInProgress.effectTag |= ShouldCapture;
+ workInProgress.expirationTime = renderExpirationTime;
+ var update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
+ enqueueCapturedUpdate(workInProgress, update);
+ return;
+ }
+ case ClassComponent:
+ case ClassComponentLazy:
+ // Capture and retry
+ var errorInfo = value;
+ var ctor = workInProgress.type;
+ var instance = workInProgress.stateNode;
+ if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
+ workInProgress.effectTag |= ShouldCapture;
+ workInProgress.expirationTime = renderExpirationTime;
+ // Schedule the error boundary to re-render using updated state
+ var _update = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
+ enqueueCapturedUpdate(workInProgress, _update);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ workInProgress = workInProgress.return;
+ } while (workInProgress !== null);
+}
- var errorBoundaryMessage = void 0;
- // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
- if (errorBoundaryFound && errorBoundaryName) {
- if (willRetry) {
- errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
- } else {
- errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
+function unwindWork(workInProgress, renderExpirationTime) {
+ switch (workInProgress.tag) {
+ case ClassComponent:
+ {
+ var Component = workInProgress.type;
+ if (isContextProvider(Component)) {
+ popContext(workInProgress);
+ }
+ var effectTag = workInProgress.effectTag;
+ if (effectTag & ShouldCapture) {
+ workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
+ return workInProgress;
+ }
+ return null;
}
- } else {
- errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
- }
- var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
+ case ClassComponentLazy:
+ {
+ var _Component = workInProgress.type._reactResult;
+ if (isContextProvider(_Component)) {
+ popContext(workInProgress);
+ }
+ var _effectTag = workInProgress.effectTag;
+ if (_effectTag & ShouldCapture) {
+ workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
+ return workInProgress;
+ }
+ return null;
+ }
+ case HostRoot:
+ {
+ popHostContainer(workInProgress);
+ popTopLevelContextObject(workInProgress);
+ var _effectTag2 = workInProgress.effectTag;
+ !((_effectTag2 & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
+ workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
+ return workInProgress;
+ }
+ case HostComponent:
+ {
+ popHostContext(workInProgress);
+ return null;
+ }
+ case PlaceholderComponent:
+ {
+ var _effectTag3 = workInProgress.effectTag;
+ if (_effectTag3 & ShouldCapture) {
+ workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
+ return workInProgress;
+ }
+ return null;
+ }
+ case HostPortal:
+ popHostContainer(workInProgress);
+ return null;
+ case ContextProvider:
+ popProvider(workInProgress);
+ return null;
+ default:
+ return null;
+ }
+}
- // In development, we provide our own message with just the component stack.
- // We don't include the original error message and JS stack because the browser
- // has already printed it. Even if the application swallows the error, it is still
- // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
- console.error(combinedMessage);
+function unwindInterruptedWork(interruptedWork) {
+ switch (interruptedWork.tag) {
+ case ClassComponent:
+ {
+ var childContextTypes = interruptedWork.type.childContextTypes;
+ if (childContextTypes !== null && childContextTypes !== undefined) {
+ popContext(interruptedWork);
+ }
+ break;
+ }
+ case ClassComponentLazy:
+ {
+ var _childContextTypes = interruptedWork.type._reactResult.childContextTypes;
+ if (_childContextTypes !== null && _childContextTypes !== undefined) {
+ popContext(interruptedWork);
+ }
+ break;
+ }
+ case HostRoot:
+ {
+ popHostContainer(interruptedWork);
+ popTopLevelContextObject(interruptedWork);
+ break;
+ }
+ case HostComponent:
+ {
+ popHostContext(interruptedWork);
+ break;
+ }
+ case HostPortal:
+ popHostContainer(interruptedWork);
+ break;
+ case ContextProvider:
+ popProvider(interruptedWork);
+ break;
+ default:
+ break;
}
}
-var invokeGuardedCallback$1 = ReactErrorUtils.invokeGuardedCallback;
-var hasCaughtError = ReactErrorUtils.hasCaughtError;
-var clearCaughtError = ReactErrorUtils.clearCaughtError;
+var Dispatcher = {
+ readContext: readContext
+};
+
+var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
+var didWarnAboutStateTransition = void 0;
+var didWarnSetStateChildContext = void 0;
+var warnAboutUpdateOnUnmounted = void 0;
+var warnAboutInvalidUpdates = void 0;
+
+if (enableSchedulerTracing) {
+ // Provide explicit error message when production+profiling bundle of e.g. react-dom
+ // is used with production (non-profiling) bundle of schedule/tracing
+ !(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null) ? invariant(false, 'It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `schedule/tracing` module with `schedule/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling') : void 0;
+}
+
{
- var didWarnAboutStateTransition = false;
- var didWarnSetStateChildContext = false;
+ didWarnAboutStateTransition = false;
+ didWarnSetStateChildContext = false;
var didWarnStateUpdateForUnmountedComponent = {};
- var warnAboutUpdateOnUnmounted = function (fiber) {
- var componentName = getComponentName(fiber) || 'ReactClass';
+ warnAboutUpdateOnUnmounted = function (fiber) {
+ // We show the whole stack but dedupe on the top component's name because
+ // the problematic code almost always lies inside that component.
+ var componentName = getComponentName(fiber.type) || 'ReactClass';
if (didWarnStateUpdateForUnmountedComponent[componentName]) {
return;
}
- warning(false, 'Can only update a mounted or mounting ' + 'component. This usually means you called setState, replaceState, ' + 'or forceUpdate on an unmounted component. This is a no-op.\n\nPlease ' + 'check the code for the %s component.', componentName);
+ warningWithoutStack$1(false, "Can't call setState (or forceUpdate) on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in the ' + 'componentWillUnmount method.%s', getStackByFiberInDevAndProd(fiber));
didWarnStateUpdateForUnmountedComponent[componentName] = true;
};
- var warnAboutInvalidUpdates = function (instance) {
- switch (ReactDebugCurrentFiber.phase) {
+ warnAboutInvalidUpdates = function (instance) {
+ switch (phase) {
case 'getChildContext':
if (didWarnSetStateChildContext) {
return;
}
- warning(false, 'setState(...): Cannot call setState() inside getChildContext()');
+ warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
didWarnSetStateChildContext = true;
break;
case 'render':
if (didWarnAboutStateTransition) {
return;
}
- warning(false, 'Cannot update during an existing state transition (such as within ' + "`render` or another component's constructor). Render methods should " + 'be a pure function of props and state; constructor side-effects are ' + 'an anti-pattern, but can be moved to `componentWillMount`.');
+ warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as within ' + '`render`). Render methods should be a pure function of props and state.');
didWarnAboutStateTransition = true;
break;
}
};
}
-var ReactFiberScheduler = function (config) {
- var hostContext = ReactFiberHostContext(config);
- var hydrationContext = ReactFiberHydrationContext(config);
- var popHostContainer = hostContext.popHostContainer,
- popHostContext = hostContext.popHostContext,
- resetHostContainer = hostContext.resetHostContainer;
-
- var _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleWork, computeExpirationForFiber),
- beginWork = _ReactFiberBeginWork.beginWork,
- beginFailedWork = _ReactFiberBeginWork.beginFailedWork;
-
- var _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext),
- completeWork = _ReactFiberCompleteWo.completeWork;
-
- var _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError),
- commitResetTextContent = _ReactFiberCommitWork.commitResetTextContent,
- commitPlacement = _ReactFiberCommitWork.commitPlacement,
- commitDeletion = _ReactFiberCommitWork.commitDeletion,
- commitWork = _ReactFiberCommitWork.commitWork,
- commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles,
- commitAttachRef = _ReactFiberCommitWork.commitAttachRef,
- commitDetachRef = _ReactFiberCommitWork.commitDetachRef;
-
- var now = config.now,
- scheduleDeferredCallback = config.scheduleDeferredCallback,
- cancelDeferredCallback = config.cancelDeferredCallback,
- useSyncScheduling = config.useSyncScheduling,
- prepareForCommit = config.prepareForCommit,
- resetAfterCommit = config.resetAfterCommit;
-
- // Represents the current time in ms.
-
- var startTime = now();
- var mostRecentCurrentTime = msToExpirationTime(0);
-
- // Represents the expiration time that incoming updates should use. (If this
- // is NoWork, use the default strategy: async updates in async mode, sync
- // updates in sync mode.)
- var expirationContext = NoWork;
-
- var isWorking = false;
-
- // The next work in progress fiber that we're currently working on.
- var nextUnitOfWork = null;
- var nextRoot = null;
- // The time at which we're currently rendering work.
- var nextRenderExpirationTime = NoWork;
-
- // The next fiber with an effect that we're currently committing.
- var nextEffect = null;
-
- // Keep track of which fibers have captured an error that need to be handled.
- // Work is removed from this collection after componentDidCatch is called.
- var capturedErrors = null;
- // Keep track of which fibers have failed during the current batch of work.
- // This is a different set than capturedErrors, because it is not reset until
- // the end of the batch. This is needed to propagate errors correctly if a
- // subtree fails more than once.
- var failedBoundaries = null;
- // Error boundaries that captured an error during the current commit.
- var commitPhaseBoundaries = null;
- var firstUncaughtError = null;
- var didFatal = false;
+// Used to ensure computeUniqueAsyncExpiration is monotonically increasing.
+var lastUniqueAsyncExpiration = 0;
+
+// Represents the expiration time that incoming updates should use. (If this
+// is NoWork, use the default strategy: async updates in async mode, sync
+// updates in sync mode.)
+var expirationContext = NoWork;
+
+var isWorking = false;
+
+// The next work in progress fiber that we're currently working on.
+var nextUnitOfWork = null;
+var nextRoot = null;
+// The time at which we're currently rendering work.
+var nextRenderExpirationTime = NoWork;
+var nextLatestAbsoluteTimeoutMs = -1;
+var nextRenderDidError = false;
+
+// The next fiber with an effect that we're currently committing.
+var nextEffect = null;
+
+var isCommitting$1 = false;
+
+var legacyErrorBoundariesThatAlreadyFailed = null;
+
+// Used for performance tracking.
+var interruptedBy = null;
+
+// Do not decrement interaction counts in the event of suspense timeouts.
+// This would lead to prematurely calling the interaction-complete hook.
+var suspenseDidTimeout = false;
+
+var stashedWorkInProgressProperties = void 0;
+var replayUnitOfWork = void 0;
+var isReplayingFailedUnitOfWork = void 0;
+var originalReplayError = void 0;
+var rethrowOriginalError = void 0;
+if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
+ stashedWorkInProgressProperties = null;
+ isReplayingFailedUnitOfWork = false;
+ originalReplayError = null;
+ replayUnitOfWork = function (failedUnitOfWork, thrownValue, isYieldy) {
+ if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') {
+ // Don't replay promises. Treat everything else like an error.
+ // TODO: Need to figure out a different strategy if/when we add
+ // support for catching other types.
+ return;
+ }
- var isCommitting = false;
- var isUnmounting = false;
+ // Restore the original state of the work-in-progress
+ if (stashedWorkInProgressProperties === null) {
+ // This should never happen. Don't throw because this code is DEV-only.
+ warningWithoutStack$1(false, 'Could not replay rendering after an error. This is likely a bug in React. ' + 'Please file an issue.');
+ return;
+ }
+ assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
- // Used for performance tracking.
- var interruptedBy = null;
+ switch (failedUnitOfWork.tag) {
+ case HostRoot:
+ popHostContainer(failedUnitOfWork);
+ popTopLevelContextObject(failedUnitOfWork);
+ break;
+ case HostComponent:
+ popHostContext(failedUnitOfWork);
+ break;
+ case ClassComponent:
+ {
+ var Component = failedUnitOfWork.type;
+ if (isContextProvider(Component)) {
+ popContext(failedUnitOfWork);
+ }
+ break;
+ }
+ case ClassComponentLazy:
+ {
+ var _Component = getResultFromResolvedThenable(failedUnitOfWork.type);
+ if (isContextProvider(_Component)) {
+ popContext(failedUnitOfWork);
+ }
+ break;
+ }
+ case HostPortal:
+ popHostContainer(failedUnitOfWork);
+ break;
+ case ContextProvider:
+ popProvider(failedUnitOfWork);
+ break;
+ }
+ // Replay the begin phase.
+ isReplayingFailedUnitOfWork = true;
+ originalReplayError = thrownValue;
+ invokeGuardedCallback(null, workLoop, null, isYieldy);
+ isReplayingFailedUnitOfWork = false;
+ originalReplayError = null;
+ if (hasCaughtError()) {
+ var replayError = clearCaughtError();
+ if (replayError != null && thrownValue != null) {
+ try {
+ // Reading the expando property is intentionally
+ // inside `try` because it might be a getter or Proxy.
+ if (replayError._suppressLogging) {
+ // Also suppress logging for the original error.
+ thrownValue._suppressLogging = true;
+ }
+ } catch (inner) {
+ // Ignore.
+ }
+ }
+ } else {
+ // If the begin phase did not fail the second time, set this pointer
+ // back to the original value.
+ nextUnitOfWork = failedUnitOfWork;
+ }
+ };
+ rethrowOriginalError = function () {
+ throw originalReplayError;
+ };
+}
- function resetContextStack() {
- // Reset the stack
- reset$1();
- // Reset the cursors
- resetContext();
- resetHostContainer();
+function resetStack() {
+ if (nextUnitOfWork !== null) {
+ var interruptedWork = nextUnitOfWork.return;
+ while (interruptedWork !== null) {
+ unwindInterruptedWork(interruptedWork);
+ interruptedWork = interruptedWork.return;
+ }
}
- function commitAllHostEffects() {
- while (nextEffect !== null) {
- {
- ReactDebugCurrentFiber.setCurrentFiber(nextEffect);
- }
- recordEffect();
+ {
+ ReactStrictModeWarnings.discardPendingWarnings();
+ checkThatStackIsEmpty();
+ }
- var effectTag = nextEffect.effectTag;
- if (effectTag & ContentReset) {
- commitResetTextContent(nextEffect);
- }
+ nextRoot = null;
+ nextRenderExpirationTime = NoWork;
+ nextLatestAbsoluteTimeoutMs = -1;
+ nextRenderDidError = false;
+ nextUnitOfWork = null;
+}
- if (effectTag & Ref) {
- var current = nextEffect.alternate;
- if (current !== null) {
- commitDetachRef(current);
- }
- }
+function commitAllHostEffects() {
+ while (nextEffect !== null) {
+ {
+ setCurrentFiber(nextEffect);
+ }
+ recordEffect();
- // The following switch statement is only concerned about placement,
- // updates, and deletions. To avoid needing to add a case for every
- // possible bitmap value, we remove the secondary effects from the
- // effect tag and switch on that value.
- var primaryEffectTag = effectTag & ~(Callback | Err | ContentReset | Ref | PerformedWork);
- switch (primaryEffectTag) {
- case Placement:
- {
- commitPlacement(nextEffect);
- // Clear the "placement" from effect tag so that we know that this is inserted, before
- // any life-cycles like componentDidMount gets called.
- // TODO: findDOMNode doesn't rely on this any more but isMounted
- // does and isMounted is deprecated anyway so we should be able
- // to kill this.
- nextEffect.effectTag &= ~Placement;
- break;
- }
- case PlacementAndUpdate:
- {
- // Placement
- commitPlacement(nextEffect);
- // Clear the "placement" from effect tag so that we know that this is inserted, before
- // any life-cycles like componentDidMount gets called.
- nextEffect.effectTag &= ~Placement;
-
- // Update
- var _current = nextEffect.alternate;
- commitWork(_current, nextEffect);
- break;
- }
- case Update:
- {
- var _current2 = nextEffect.alternate;
- commitWork(_current2, nextEffect);
- break;
- }
- case Deletion:
- {
- isUnmounting = true;
- commitDeletion(nextEffect);
- isUnmounting = false;
- break;
- }
+ var effectTag = nextEffect.effectTag;
+
+ if (effectTag & ContentReset) {
+ commitResetTextContent(nextEffect);
+ }
+
+ if (effectTag & Ref) {
+ var current$$1 = nextEffect.alternate;
+ if (current$$1 !== null) {
+ commitDetachRef(current$$1);
}
- nextEffect = nextEffect.nextEffect;
}
+ // The following switch statement is only concerned about placement,
+ // updates, and deletions. To avoid needing to add a case for every
+ // possible bitmap value, we remove the secondary effects from the
+ // effect tag and switch on that value.
+ var primaryEffectTag = effectTag & (Placement | Update | Deletion);
+ switch (primaryEffectTag) {
+ case Placement:
+ {
+ commitPlacement(nextEffect);
+ // Clear the "placement" from effect tag so that we know that this is inserted, before
+ // any life-cycles like componentDidMount gets called.
+ // TODO: findDOMNode doesn't rely on this any more but isMounted
+ // does and isMounted is deprecated anyway so we should be able
+ // to kill this.
+ nextEffect.effectTag &= ~Placement;
+ break;
+ }
+ case PlacementAndUpdate:
+ {
+ // Placement
+ commitPlacement(nextEffect);
+ // Clear the "placement" from effect tag so that we know that this is inserted, before
+ // any life-cycles like componentDidMount gets called.
+ nextEffect.effectTag &= ~Placement;
+
+ // Update
+ var _current = nextEffect.alternate;
+ commitWork(_current, nextEffect);
+ break;
+ }
+ case Update:
+ {
+ var _current2 = nextEffect.alternate;
+ commitWork(_current2, nextEffect);
+ break;
+ }
+ case Deletion:
+ {
+ commitDeletion(nextEffect);
+ break;
+ }
+ }
+ nextEffect = nextEffect.nextEffect;
+ }
+
+ {
+ resetCurrentFiber();
+ }
+}
+
+function commitBeforeMutationLifecycles() {
+ while (nextEffect !== null) {
{
- ReactDebugCurrentFiber.resetCurrentFiber();
+ setCurrentFiber(nextEffect);
}
+
+ var effectTag = nextEffect.effectTag;
+ if (effectTag & Snapshot) {
+ recordEffect();
+ var current$$1 = nextEffect.alternate;
+ commitBeforeMutationLifeCycles(current$$1, nextEffect);
+ }
+
+ // Don't cleanup effects yet;
+ // This will be done by commitAllLifeCycles()
+ nextEffect = nextEffect.nextEffect;
}
- function commitAllLifeCycles() {
- while (nextEffect !== null) {
- var effectTag = nextEffect.effectTag;
+ {
+ resetCurrentFiber();
+ }
+}
- if (effectTag & (Update | Callback)) {
- recordEffect();
- var current = nextEffect.alternate;
- commitLifeCycles(current, nextEffect);
- }
+function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
+ {
+ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
- if (effectTag & Ref) {
- recordEffect();
- commitAttachRef(nextEffect);
- }
+ if (warnAboutDeprecatedLifecycles) {
+ ReactStrictModeWarnings.flushPendingDeprecationWarnings();
+ }
- if (effectTag & Err) {
- recordEffect();
- commitErrorHandling(nextEffect);
- }
+ if (warnAboutLegacyContextAPI) {
+ ReactStrictModeWarnings.flushLegacyContextWarning();
+ }
+ }
+ while (nextEffect !== null) {
+ var effectTag = nextEffect.effectTag;
- var next = nextEffect.nextEffect;
- // Ensure that we clean these up so that we don't accidentally keep them.
- // I'm not actually sure this matters because we can't reset firstEffect
- // and lastEffect since they're on every node, not just the effectful
- // ones. So we have to clean everything as we reuse nodes anyway.
- nextEffect.nextEffect = null;
- // Ensure that we reset the effectTag here so that we can rely on effect
- // tags to reason about the current life-cycle.
- nextEffect = next;
+ if (effectTag & (Update | Callback)) {
+ recordEffect();
+ var current$$1 = nextEffect.alternate;
+ commitLifeCycles(finishedRoot, current$$1, nextEffect, committedExpirationTime);
}
+
+ if (effectTag & Ref) {
+ recordEffect();
+ commitAttachRef(nextEffect);
+ }
+
+ var next = nextEffect.nextEffect;
+ // Ensure that we clean these up so that we don't accidentally keep them.
+ // I'm not actually sure this matters because we can't reset firstEffect
+ // and lastEffect since they're on every node, not just the effectful
+ // ones. So we have to clean everything as we reuse nodes anyway.
+ nextEffect.nextEffect = null;
+ // Ensure that we reset the effectTag here so that we can rely on effect
+ // tags to reason about the current life-cycle.
+ nextEffect = next;
}
+}
- function commitRoot(finishedWork) {
- // We keep track of this so that captureError can collect any boundaries
- // that capture an error during the commit phase. The reason these aren't
- // local to this function is because errors that occur during cWU are
- // captured elsewhere, to prevent the unmount from being interrupted.
- isWorking = true;
- isCommitting = true;
- startCommitTimer();
-
- var root = finishedWork.stateNode;
- !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- root.isReadyForCommit = false;
-
- // Reset this to null before calling lifecycles
- ReactCurrentOwner.current = null;
-
- var firstEffect = void 0;
- if (finishedWork.effectTag > PerformedWork) {
- // A fiber's effect list consists only of its children, not itself. So if
- // the root has an effect, we need to add it to the end of the list. The
- // resulting list is the set that would belong to the root's parent, if
- // it had one; that is, all the effects in the tree including the root.
- if (finishedWork.lastEffect !== null) {
- finishedWork.lastEffect.nextEffect = finishedWork;
- firstEffect = finishedWork.firstEffect;
- } else {
- firstEffect = finishedWork;
+function isAlreadyFailedLegacyErrorBoundary(instance) {
+ return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
+}
+
+function markLegacyErrorBoundaryAsFailed(instance) {
+ if (legacyErrorBoundariesThatAlreadyFailed === null) {
+ legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
+ } else {
+ legacyErrorBoundariesThatAlreadyFailed.add(instance);
+ }
+}
+
+function commitRoot(root, finishedWork) {
+ isWorking = true;
+ isCommitting$1 = true;
+ startCommitTimer();
+
+ !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ var committedExpirationTime = root.pendingCommitExpirationTime;
+ !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ root.pendingCommitExpirationTime = NoWork;
+
+ // Update the pending priority levels to account for the work that we are
+ // about to commit. This needs to happen before calling the lifecycles, since
+ // they may schedule additional updates.
+ var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
+ var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
+ var earliestRemainingTimeBeforeCommit = updateExpirationTimeBeforeCommit === NoWork || childExpirationTimeBeforeCommit !== NoWork && childExpirationTimeBeforeCommit < updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
+ markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
+
+ var prevInteractions = null;
+ var committedInteractions = enableSchedulerTracing ? [] : null;
+ if (enableSchedulerTracing) {
+ // Restore any pending interactions at this point,
+ // So that cascading work triggered during the render phase will be accounted for.
+ prevInteractions = tracing.__interactionsRef.current;
+ tracing.__interactionsRef.current = root.memoizedInteractions;
+
+ // We are potentially finished with the current batch of interactions.
+ // So we should clear them out of the pending interaction map.
+ // We do this at the start of commit in case cascading work is scheduled by commit phase lifecycles.
+ // In that event, interaction data may be added back into the pending map for a future commit.
+ // We also store the interactions we are about to commit so that we can notify subscribers after we're done.
+ // These are stored as an Array rather than a Set,
+ // Because the same interaction may be pending for multiple expiration times,
+ // In which case it's important that we decrement the count the right number of times after finishing.
+ root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
+ if (scheduledExpirationTime <= committedExpirationTime) {
+ committedInteractions.push.apply(committedInteractions, Array.from(scheduledInteractions));
+ root.pendingInteractionMap.delete(scheduledExpirationTime);
}
- } else {
- // There is no effect on the root.
+ });
+ }
+
+ // Reset this to null before calling lifecycles
+ ReactCurrentOwner$2.current = null;
+
+ var firstEffect = void 0;
+ if (finishedWork.effectTag > PerformedWork) {
+ // A fiber's effect list consists only of its children, not itself. So if
+ // the root has an effect, we need to add it to the end of the list. The
+ // resulting list is the set that would belong to the root's parent, if
+ // it had one; that is, all the effects in the tree including the root.
+ if (finishedWork.lastEffect !== null) {
+ finishedWork.lastEffect.nextEffect = finishedWork;
firstEffect = finishedWork.firstEffect;
+ } else {
+ firstEffect = finishedWork;
}
+ } else {
+ // There is no effect on the root.
+ firstEffect = finishedWork.firstEffect;
+ }
- prepareForCommit();
+ prepareForCommit(root.containerInfo);
- // Commit all the side-effects within a tree. We'll do this in two passes.
- // The first pass performs all the host insertions, updates, deletions and
- // ref unmounts.
- nextEffect = firstEffect;
- startCommitHostEffectsTimer();
- while (nextEffect !== null) {
- var didError = false;
- var _error = void 0;
- {
- invokeGuardedCallback$1(null, commitAllHostEffects, null);
- if (hasCaughtError()) {
- didError = true;
- _error = clearCaughtError();
- }
+ // Invoke instances of getSnapshotBeforeUpdate before mutation.
+ nextEffect = firstEffect;
+ startCommitSnapshotEffectsTimer();
+ while (nextEffect !== null) {
+ var didError = false;
+ var error = void 0;
+ {
+ invokeGuardedCallback(null, commitBeforeMutationLifecycles, null);
+ if (hasCaughtError()) {
+ didError = true;
+ error = clearCaughtError();
}
- if (didError) {
- !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- captureError(nextEffect, _error);
- // Clean-up
- if (nextEffect !== null) {
- nextEffect = nextEffect.nextEffect;
- }
+ }
+ if (didError) {
+ !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ captureCommitPhaseError(nextEffect, error);
+ // Clean-up
+ if (nextEffect !== null) {
+ nextEffect = nextEffect.nextEffect;
}
}
- stopCommitHostEffectsTimer();
-
- resetAfterCommit();
+ }
+ stopCommitSnapshotEffectsTimer();
- // The work-in-progress tree is now the current tree. This must come after
- // the first pass of the commit phase, so that the previous tree is still
- // current during componentWillUnmount, but before the second pass, so that
- // the finished work is current during componentDidMount/Update.
- root.current = finishedWork;
+ if (enableProfilerTimer) {
+ // Mark the current commit time to be shared by all Profilers in this batch.
+ // This enables them to be grouped later.
+ recordCommitTime();
+ }
- // In the second pass we'll perform all life-cycles and ref callbacks.
- // Life-cycles happen as a separate pass so that all placements, updates,
- // and deletions in the entire tree have already been invoked.
- // This pass also triggers any renderer-specific initial effects.
- nextEffect = firstEffect;
- startCommitLifeCyclesTimer();
- while (nextEffect !== null) {
- var _didError = false;
- var _error2 = void 0;
- {
- invokeGuardedCallback$1(null, commitAllLifeCycles, null);
- if (hasCaughtError()) {
- _didError = true;
- _error2 = clearCaughtError();
- }
+ // Commit all the side-effects within a tree. We'll do this in two passes.
+ // The first pass performs all the host insertions, updates, deletions and
+ // ref unmounts.
+ nextEffect = firstEffect;
+ startCommitHostEffectsTimer();
+ while (nextEffect !== null) {
+ var _didError = false;
+ var _error = void 0;
+ {
+ invokeGuardedCallback(null, commitAllHostEffects, null);
+ if (hasCaughtError()) {
+ _didError = true;
+ _error = clearCaughtError();
}
- if (_didError) {
- !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- captureError(nextEffect, _error2);
- if (nextEffect !== null) {
- nextEffect = nextEffect.nextEffect;
- }
+ }
+ if (_didError) {
+ !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ captureCommitPhaseError(nextEffect, _error);
+ // Clean-up
+ if (nextEffect !== null) {
+ nextEffect = nextEffect.nextEffect;
}
}
+ }
+ stopCommitHostEffectsTimer();
- isCommitting = false;
- isWorking = false;
- stopCommitLifeCyclesTimer();
- stopCommitTimer();
- if (typeof onCommitRoot === 'function') {
- onCommitRoot(finishedWork.stateNode);
+ resetAfterCommit(root.containerInfo);
+
+ // The work-in-progress tree is now the current tree. This must come after
+ // the first pass of the commit phase, so that the previous tree is still
+ // current during componentWillUnmount, but before the second pass, so that
+ // the finished work is current during componentDidMount/Update.
+ root.current = finishedWork;
+
+ // In the second pass we'll perform all life-cycles and ref callbacks.
+ // Life-cycles happen as a separate pass so that all placements, updates,
+ // and deletions in the entire tree have already been invoked.
+ // This pass also triggers any renderer-specific initial effects.
+ nextEffect = firstEffect;
+ startCommitLifeCyclesTimer();
+ while (nextEffect !== null) {
+ var _didError2 = false;
+ var _error2 = void 0;
+ {
+ invokeGuardedCallback(null, commitAllLifeCycles, null, root, committedExpirationTime);
+ if (hasCaughtError()) {
+ _didError2 = true;
+ _error2 = clearCaughtError();
+ }
}
- if (true && ReactFiberInstrumentation_1.debugTool) {
- ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
+ if (_didError2) {
+ !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ captureCommitPhaseError(nextEffect, _error2);
+ if (nextEffect !== null) {
+ nextEffect = nextEffect.nextEffect;
+ }
}
+ }
- // If we caught any errors during this commit, schedule their boundaries
- // to update.
- if (commitPhaseBoundaries) {
- commitPhaseBoundaries.forEach(scheduleErrorRecovery);
- commitPhaseBoundaries = null;
- }
+ isCommitting$1 = false;
+ isWorking = false;
+ stopCommitLifeCyclesTimer();
+ stopCommitTimer();
+ onCommitRoot(finishedWork.stateNode);
+ if (true && ReactFiberInstrumentation_1.debugTool) {
+ ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
+ }
- if (firstUncaughtError !== null) {
- var _error3 = firstUncaughtError;
- firstUncaughtError = null;
- onUncaughtError(_error3);
- }
+ var updateExpirationTimeAfterCommit = finishedWork.expirationTime;
+ var childExpirationTimeAfterCommit = finishedWork.childExpirationTime;
+ var earliestRemainingTimeAfterCommit = updateExpirationTimeAfterCommit === NoWork || childExpirationTimeAfterCommit !== NoWork && childExpirationTimeAfterCommit < updateExpirationTimeAfterCommit ? childExpirationTimeAfterCommit : updateExpirationTimeAfterCommit;
+ if (earliestRemainingTimeAfterCommit === NoWork) {
+ // If there's no remaining work, we can clear the set of already failed
+ // error boundaries.
+ legacyErrorBoundariesThatAlreadyFailed = null;
+ }
+ onCommit(root, earliestRemainingTimeAfterCommit);
- var remainingTime = root.current.expirationTime;
+ if (enableSchedulerTracing) {
+ tracing.__interactionsRef.current = prevInteractions;
- if (remainingTime === NoWork) {
- capturedErrors = null;
- failedBoundaries = null;
+ var subscriber = void 0;
+
+ try {
+ subscriber = tracing.__subscriberRef.current;
+ if (subscriber !== null && root.memoizedInteractions.size > 0) {
+ var threadID = computeThreadID(committedExpirationTime, root.interactionThreadID);
+ subscriber.onWorkStopped(root.memoizedInteractions, threadID);
+ }
+ } catch (error) {
+ // It's not safe for commitRoot() to throw.
+ // Store the error for now and we'll re-throw in finishRendering().
+ if (!hasUnhandledError) {
+ hasUnhandledError = true;
+ unhandledError = error;
+ }
+ } finally {
+ // Don't update interaction counts if we're frozen due to suspense.
+ // In this case, we can skip the completed-work check entirely.
+ if (!suspenseDidTimeout) {
+ // Now that we're done, check the completed batch of interactions.
+ // If no more work is outstanding for a given interaction,
+ // We need to notify the subscribers that it's finished.
+ committedInteractions.forEach(function (interaction) {
+ interaction.__count--;
+ if (subscriber !== null && interaction.__count === 0) {
+ try {
+ subscriber.onInteractionScheduledWorkCompleted(interaction);
+ } catch (error) {
+ // It's not safe for commitRoot() to throw.
+ // Store the error for now and we'll re-throw in finishRendering().
+ if (!hasUnhandledError) {
+ hasUnhandledError = true;
+ unhandledError = error;
+ }
+ }
+ }
+ });
+ }
}
+ }
+}
- return remainingTime;
+function resetChildExpirationTime(workInProgress, renderTime) {
+ if (renderTime !== Never && workInProgress.childExpirationTime === Never) {
+ // The children of this component are hidden. Don't bubble their
+ // expiration times.
+ return;
}
- function resetExpirationTime(workInProgress, renderTime) {
- if (renderTime !== Never && workInProgress.expirationTime === Never) {
- // The children of this component are hidden. Don't bubble their
- // expiration times.
- return;
- }
+ var newChildExpirationTime = NoWork;
- // Check for pending updates.
- var newExpirationTime = getUpdateExpirationTime(workInProgress);
+ // Bubble up the earliest expiration time.
+ if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
+ // We're in profiling mode.
+ // Let's use this same traversal to update the render durations.
+ var actualDuration = workInProgress.actualDuration;
+ var treeBaseDuration = workInProgress.selfBaseDuration;
- // TODO: Calls need to visit stateNode
+ // When a fiber is cloned, its actualDuration is reset to 0.
+ // This value will only be updated if work is done on the fiber (i.e. it doesn't bailout).
+ // When work is done, it should bubble to the parent's actualDuration.
+ // If the fiber has not been cloned though, (meaning no work was done),
+ // Then this value will reflect the amount of time spent working on a previous render.
+ // In that case it should not bubble.
+ // We determine whether it was cloned by comparing the child pointer.
+ var shouldBubbleActualDurations = workInProgress.alternate === null || workInProgress.child !== workInProgress.alternate.child;
- // Bubble up the earliest expiration time.
var child = workInProgress.child;
while (child !== null) {
- if (child.expirationTime !== NoWork && (newExpirationTime === NoWork || newExpirationTime > child.expirationTime)) {
- newExpirationTime = child.expirationTime;
+ var childUpdateExpirationTime = child.expirationTime;
+ var childChildExpirationTime = child.childExpirationTime;
+ if (newChildExpirationTime === NoWork || childUpdateExpirationTime !== NoWork && childUpdateExpirationTime < newChildExpirationTime) {
+ newChildExpirationTime = childUpdateExpirationTime;
+ }
+ if (newChildExpirationTime === NoWork || childChildExpirationTime !== NoWork && childChildExpirationTime < newChildExpirationTime) {
+ newChildExpirationTime = childChildExpirationTime;
+ }
+ if (shouldBubbleActualDurations) {
+ actualDuration += child.actualDuration;
}
+ treeBaseDuration += child.treeBaseDuration;
child = child.sibling;
}
- workInProgress.expirationTime = newExpirationTime;
+ workInProgress.actualDuration = actualDuration;
+ workInProgress.treeBaseDuration = treeBaseDuration;
+ } else {
+ var _child = workInProgress.child;
+ while (_child !== null) {
+ var _childUpdateExpirationTime = _child.expirationTime;
+ var _childChildExpirationTime = _child.childExpirationTime;
+ if (newChildExpirationTime === NoWork || _childUpdateExpirationTime !== NoWork && _childUpdateExpirationTime < newChildExpirationTime) {
+ newChildExpirationTime = _childUpdateExpirationTime;
+ }
+ if (newChildExpirationTime === NoWork || _childChildExpirationTime !== NoWork && _childChildExpirationTime < newChildExpirationTime) {
+ newChildExpirationTime = _childChildExpirationTime;
+ }
+ _child = _child.sibling;
+ }
}
- function completeUnitOfWork(workInProgress) {
- while (true) {
- // The current, flushed, state of this fiber is the alternate.
- // Ideally nothing should rely on this, but relying on it here
- // means that we don't need an additional field on the work in
- // progress.
- var current = workInProgress.alternate;
- {
- ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
+ workInProgress.childExpirationTime = newChildExpirationTime;
+}
+
+function completeUnitOfWork(workInProgress) {
+ // Attempt to complete the current unit of work, then move to the
+ // next sibling. If there are no more siblings, return to the
+ // parent fiber.
+ while (true) {
+ // The current, flushed, state of this fiber is the alternate.
+ // Ideally nothing should rely on this, but relying on it here
+ // means that we don't need an additional field on the work in
+ // progress.
+ var current$$1 = workInProgress.alternate;
+ {
+ setCurrentFiber(workInProgress);
+ }
+
+ var returnFiber = workInProgress.return;
+ var siblingFiber = workInProgress.sibling;
+
+ if ((workInProgress.effectTag & Incomplete) === NoEffect) {
+ // This fiber completed.
+ if (enableProfilerTimer) {
+ if (workInProgress.mode & ProfileMode) {
+ startProfilerTimer(workInProgress);
+ }
+
+ nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
+
+ if (workInProgress.mode & ProfileMode) {
+ // Update render duration assuming we didn't error.
+ stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
+ }
+ } else {
+ nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
}
- var next = completeWork(current, workInProgress, nextRenderExpirationTime);
+ var next = nextUnitOfWork;
+ stopWorkTimer(workInProgress);
+ resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
{
- ReactDebugCurrentFiber.resetCurrentFiber();
+ resetCurrentFiber();
}
- var returnFiber = workInProgress['return'];
- var siblingFiber = workInProgress.sibling;
-
- resetExpirationTime(workInProgress, nextRenderExpirationTime);
-
if (next !== null) {
stopWorkTimer(workInProgress);
if (true && ReactFiberInstrumentation_1.debugTool) {
@@ -10149,7 +16262,9 @@ var ReactFiberScheduler = function (config) {
return next;
}
- if (returnFiber !== null) {
+ if (returnFiber !== null &&
+ // Do not append effects to parents if a sibling failed to complete
+ (returnFiber.effectTag & Incomplete) === NoEffect) {
// Append all the effects of the subtree and this fiber onto the effect
// list of the parent. The completion order of the children affects the
// side-effect order.
@@ -10182,7 +16297,6 @@ var ReactFiberScheduler = function (config) {
}
}
- stopWorkTimer(workInProgress);
if (true && ReactFiberInstrumentation_1.debugTool) {
ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
}
@@ -10196,4680 +16310,1704 @@ var ReactFiberScheduler = function (config) {
continue;
} else {
// We've reached the root.
- var root = workInProgress.stateNode;
- root.isReadyForCommit = true;
return null;
}
- }
-
- // Without this explicit null return Flow complains of invalid return type
- // TODO Remove the above while(true) loop
- // eslint-disable-next-line no-unreachable
- return null;
- }
-
- function performUnitOfWork(workInProgress) {
- // The current, flushed, state of this fiber is the alternate.
- // Ideally nothing should rely on this, but relying on it here
- // means that we don't need an additional field on the work in
- // progress.
- var current = workInProgress.alternate;
-
- // See if beginning this work spawns more work.
- startWorkTimer(workInProgress);
- {
- ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
- }
-
- var next = beginWork(current, workInProgress, nextRenderExpirationTime);
- {
- ReactDebugCurrentFiber.resetCurrentFiber();
- }
- if (true && ReactFiberInstrumentation_1.debugTool) {
- ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
- }
-
- if (next === null) {
- // If this doesn't spawn new work, complete the current work.
- next = completeUnitOfWork(workInProgress);
- }
-
- ReactCurrentOwner.current = null;
-
- return next;
- }
-
- function performFailedUnitOfWork(workInProgress) {
- // The current, flushed, state of this fiber is the alternate.
- // Ideally nothing should rely on this, but relying on it here
- // means that we don't need an additional field on the work in
- // progress.
- var current = workInProgress.alternate;
-
- // See if beginning this work spawns more work.
- startWorkTimer(workInProgress);
- {
- ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
- }
- var next = beginFailedWork(current, workInProgress, nextRenderExpirationTime);
- {
- ReactDebugCurrentFiber.resetCurrentFiber();
- }
- if (true && ReactFiberInstrumentation_1.debugTool) {
- ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
- }
-
- if (next === null) {
- // If this doesn't spawn new work, complete the current work.
- next = completeUnitOfWork(workInProgress);
- }
-
- ReactCurrentOwner.current = null;
-
- return next;
- }
-
- function workLoop(expirationTime) {
- if (capturedErrors !== null) {
- // If there are unhandled errors, switch to the slow work loop.
- // TODO: How to avoid this check in the fast path? Maybe the renderer
- // could keep track of which roots have unhandled errors and call a
- // forked version of renderRoot.
- slowWorkLoopThatChecksForFailedWork(expirationTime);
- return;
- }
- if (nextRenderExpirationTime === NoWork || nextRenderExpirationTime > expirationTime) {
- return;
- }
-
- if (nextRenderExpirationTime <= mostRecentCurrentTime) {
- // Flush all expired work.
- while (nextUnitOfWork !== null) {
- nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
- }
} else {
- // Flush asynchronous work until the deadline runs out of time.
- while (nextUnitOfWork !== null && !shouldYield()) {
- nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
- }
- }
- }
-
- function slowWorkLoopThatChecksForFailedWork(expirationTime) {
- if (nextRenderExpirationTime === NoWork || nextRenderExpirationTime > expirationTime) {
- return;
- }
-
- if (nextRenderExpirationTime <= mostRecentCurrentTime) {
- // Flush all expired work.
- while (nextUnitOfWork !== null) {
- if (hasCapturedError(nextUnitOfWork)) {
- // Use a forked version of performUnitOfWork
- nextUnitOfWork = performFailedUnitOfWork(nextUnitOfWork);
- } else {
- nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
- }
- }
- } else {
- // Flush asynchronous work until the deadline runs out of time.
- while (nextUnitOfWork !== null && !shouldYield()) {
- if (hasCapturedError(nextUnitOfWork)) {
- // Use a forked version of performUnitOfWork
- nextUnitOfWork = performFailedUnitOfWork(nextUnitOfWork);
- } else {
- nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
- }
- }
- }
- }
-
- function renderRootCatchBlock(root, failedWork, boundary, expirationTime) {
- // We're going to restart the error boundary that captured the error.
- // Conceptually, we're unwinding the stack. We need to unwind the
- // context stack, too.
- unwindContexts(failedWork, boundary);
-
- // Restart the error boundary using a forked version of
- // performUnitOfWork that deletes the boundary's children. The entire
- // failed subree will be unmounted. During the commit phase, a special
- // lifecycle method is called on the error boundary, which triggers
- // a re-render.
- nextUnitOfWork = performFailedUnitOfWork(boundary);
-
- // Continue working.
- workLoop(expirationTime);
- }
-
- function renderRoot(root, expirationTime) {
- !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- isWorking = true;
-
- // We're about to mutate the work-in-progress tree. If the root was pending
- // commit, it no longer is: we'll need to complete it again.
- root.isReadyForCommit = false;
-
- // Check if we're starting from a fresh stack, or if we're resuming from
- // previously yielded work.
- if (root !== nextRoot || expirationTime !== nextRenderExpirationTime || nextUnitOfWork === null) {
- // Reset the stack and start working from the root.
- resetContextStack();
- nextRoot = root;
- nextRenderExpirationTime = expirationTime;
- nextUnitOfWork = createWorkInProgress(nextRoot.current, null, expirationTime);
- }
-
- startWorkLoopTimer(nextUnitOfWork);
-
- var didError = false;
- var error = null;
- {
- invokeGuardedCallback$1(null, workLoop, null, expirationTime);
- if (hasCaughtError()) {
- didError = true;
- error = clearCaughtError();
- }
- }
-
- // An error was thrown during the render phase.
- while (didError) {
- if (didFatal) {
- // This was a fatal error. Don't attempt to recover from it.
- firstUncaughtError = error;
- break;
- }
-
- var failedWork = nextUnitOfWork;
- if (failedWork === null) {
- // An error was thrown but there's no current unit of work. This can
- // happen during the commit phase if there's a bug in the renderer.
- didFatal = true;
- continue;
- }
-
- // "Capture" the error by finding the nearest boundary. If there is no
- // error boundary, we use the root.
- var boundary = captureError(failedWork, error);
- !(boundary !== null) ? invariant(false, 'Should have found an error boundary. This error is likely caused by a bug in React. Please file an issue.') : void 0;
-
- if (didFatal) {
- // The error we just captured was a fatal error. This happens
- // when the error propagates to the root more than once.
- continue;
+ if (workInProgress.mode & ProfileMode) {
+ // Record the render duration for the fiber that errored.
+ stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
+ }
+
+ // This fiber did not complete because something threw. Pop values off
+ // the stack without entering the complete phase. If this is a boundary,
+ // capture values if possible.
+ var _next = unwindWork(workInProgress, nextRenderExpirationTime);
+ // Because this fiber did not complete, don't reset its expiration time.
+ if (workInProgress.effectTag & DidCapture) {
+ // Restarting an error boundary
+ stopFailedWorkTimer(workInProgress);
+ } else {
+ stopWorkTimer(workInProgress);
}
- didError = false;
- error = null;
{
- invokeGuardedCallback$1(null, renderRootCatchBlock, null, root, failedWork, boundary, expirationTime);
- if (hasCaughtError()) {
- didError = true;
- error = clearCaughtError();
- continue;
- }
+ resetCurrentFiber();
}
- // We're finished working. Exit the error loop.
- break;
- }
-
- var uncaughtError = firstUncaughtError;
-
- // We're done performing work. Time to clean up.
- stopWorkLoopTimer(interruptedBy);
- interruptedBy = null;
- isWorking = false;
- didFatal = false;
- firstUncaughtError = null;
-
- if (uncaughtError !== null) {
- onUncaughtError(uncaughtError);
- }
-
- return root.isReadyForCommit ? root.current.alternate : null;
- }
-
- // Returns the boundary that captured the error, or null if the error is ignored
- function captureError(failedWork, error) {
- // It is no longer valid because we exited the user code.
- ReactCurrentOwner.current = null;
- {
- ReactDebugCurrentFiber.resetCurrentFiber();
- }
- // Search for the nearest error boundary.
- var boundary = null;
-
- // Passed to logCapturedError()
- var errorBoundaryFound = false;
- var willRetry = false;
- var errorBoundaryName = null;
-
- // Host containers are a special case. If the failed work itself is a host
- // container, then it acts as its own boundary. In all other cases, we
- // ignore the work itself and only search through the parents.
- if (failedWork.tag === HostRoot) {
- boundary = failedWork;
-
- if (isFailedBoundary(failedWork)) {
- // If this root already failed, there must have been an error when
- // attempting to unmount it. This is a worst-case scenario and
- // should only be possible if there's a bug in the renderer.
- didFatal = true;
- }
- } else {
- var node = failedWork['return'];
- while (node !== null && boundary === null) {
- if (node.tag === ClassComponent) {
- var instance = node.stateNode;
- if (typeof instance.componentDidCatch === 'function') {
- errorBoundaryFound = true;
- errorBoundaryName = getComponentName(node);
-
- // Found an error boundary!
- boundary = node;
- willRetry = true;
- }
- } else if (node.tag === HostRoot) {
- // Treat the root like a no-op error boundary
- boundary = node;
+ if (_next !== null) {
+ stopWorkTimer(workInProgress);
+ if (true && ReactFiberInstrumentation_1.debugTool) {
+ ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
}
- if (isFailedBoundary(node)) {
- // This boundary is already in a failed state.
-
- // If we're currently unmounting, that means this error was
- // thrown while unmounting a failed subtree. We should ignore
- // the error.
- if (isUnmounting) {
- return null;
- }
-
- // If we're in the commit phase, we should check to see if
- // this boundary already captured an error during this commit.
- // This case exists because multiple errors can be thrown during
- // a single commit without interruption.
- if (commitPhaseBoundaries !== null && (commitPhaseBoundaries.has(node) || node.alternate !== null && commitPhaseBoundaries.has(node.alternate))) {
- // If so, we should ignore this error.
- return null;
+ if (enableProfilerTimer) {
+ // Include the time spent working on failed children before continuing.
+ if (_next.mode & ProfileMode) {
+ var actualDuration = _next.actualDuration;
+ var child = _next.child;
+ while (child !== null) {
+ actualDuration += child.actualDuration;
+ child = child.sibling;
+ }
+ _next.actualDuration = actualDuration;
}
-
- // The error should propagate to the next boundary -— we keep looking.
- boundary = null;
- willRetry = false;
}
- node = node['return'];
- }
- }
-
- if (boundary !== null) {
- // Add to the collection of failed boundaries. This lets us know that
- // subsequent errors in this subtree should propagate to the next boundary.
- if (failedBoundaries === null) {
- failedBoundaries = new Set();
+ // If completing this work spawned new work, do that next. We'll come
+ // back here again.
+ // Since we're restarting, remove anything that is not a host effect
+ // from the effect tag.
+ _next.effectTag &= HostEffectMask;
+ return _next;
}
- failedBoundaries.add(boundary);
- // This method is unsafe outside of the begin and complete phases.
- // We might be in the commit phase when an error is captured.
- // The risk is that the return path from this Fiber may not be accurate.
- // That risk is acceptable given the benefit of providing users more context.
- var _componentStack = getStackAddendumByWorkInProgressFiber(failedWork);
- var _componentName = getComponentName(failedWork);
-
- // Add to the collection of captured errors. This is stored as a global
- // map of errors and their component stack location keyed by the boundaries
- // that capture them. We mostly use this Map as a Set; it's a Map only to
- // avoid adding a field to Fiber to store the error.
- if (capturedErrors === null) {
- capturedErrors = new Map();
+ if (returnFiber !== null) {
+ // Mark the parent fiber as incomplete and clear its effect list.
+ returnFiber.firstEffect = returnFiber.lastEffect = null;
+ returnFiber.effectTag |= Incomplete;
}
- var capturedError = {
- componentName: _componentName,
- componentStack: _componentStack,
- error: error,
- errorBoundary: errorBoundaryFound ? boundary.stateNode : null,
- errorBoundaryFound: errorBoundaryFound,
- errorBoundaryName: errorBoundaryName,
- willRetry: willRetry
- };
-
- capturedErrors.set(boundary, capturedError);
-
- try {
- logCapturedError(capturedError);
- } catch (e) {
- // Prevent cycle if logCapturedError() throws.
- // A cycle may still occur if logCapturedError renders a component that throws.
- var suppressLogging = e && e.suppressReactErrorLogging;
- if (!suppressLogging) {
- console.error(e);
- }
+ if (true && ReactFiberInstrumentation_1.debugTool) {
+ ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
}
- // If we're in the commit phase, defer scheduling an update on the
- // boundary until after the commit is complete
- if (isCommitting) {
- if (commitPhaseBoundaries === null) {
- commitPhaseBoundaries = new Set();
- }
- commitPhaseBoundaries.add(boundary);
+ if (siblingFiber !== null) {
+ // If there is more work to do in this returnFiber, do that next.
+ return siblingFiber;
+ } else if (returnFiber !== null) {
+ // If there's no more work in this returnFiber. Complete the returnFiber.
+ workInProgress = returnFiber;
+ continue;
} else {
- // Otherwise, schedule an update now.
- // TODO: Is this actually necessary during the render phase? Is it
- // possible to unwind and continue rendering at the same priority,
- // without corrupting internal state?
- scheduleErrorRecovery(boundary);
+ return null;
}
- return boundary;
- } else if (firstUncaughtError === null) {
- // If no boundary is found, we'll need to throw the error
- firstUncaughtError = error;
}
- return null;
}
- function hasCapturedError(fiber) {
- // TODO: capturedErrors should store the boundary instance, to avoid needing
- // to check the alternate.
- return capturedErrors !== null && (capturedErrors.has(fiber) || fiber.alternate !== null && capturedErrors.has(fiber.alternate));
+ // Without this explicit null return Flow complains of invalid return type
+ // TODO Remove the above while(true) loop
+ // eslint-disable-next-line no-unreachable
+ return null;
+}
+
+function performUnitOfWork(workInProgress) {
+ // The current, flushed, state of this fiber is the alternate.
+ // Ideally nothing should rely on this, but relying on it here
+ // means that we don't need an additional field on the work in
+ // progress.
+ var current$$1 = workInProgress.alternate;
+
+ // See if beginning this work spawns more work.
+ startWorkTimer(workInProgress);
+ {
+ setCurrentFiber(workInProgress);
}
- function isFailedBoundary(fiber) {
- // TODO: failedBoundaries should store the boundary instance, to avoid
- // needing to check the alternate.
- return failedBoundaries !== null && (failedBoundaries.has(fiber) || fiber.alternate !== null && failedBoundaries.has(fiber.alternate));
+ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
+ stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
}
- function commitErrorHandling(effectfulFiber) {
- var capturedError = void 0;
- if (capturedErrors !== null) {
- capturedError = capturedErrors.get(effectfulFiber);
- capturedErrors['delete'](effectfulFiber);
- if (capturedError == null) {
- if (effectfulFiber.alternate !== null) {
- effectfulFiber = effectfulFiber.alternate;
- capturedError = capturedErrors.get(effectfulFiber);
- capturedErrors['delete'](effectfulFiber);
- }
- }
+ var next = void 0;
+ if (enableProfilerTimer) {
+ if (workInProgress.mode & ProfileMode) {
+ startProfilerTimer(workInProgress);
}
- !(capturedError != null) ? invariant(false, 'No error for given unit of work. This error is likely caused by a bug in React. Please file an issue.') : void 0;
-
- switch (effectfulFiber.tag) {
- case ClassComponent:
- var instance = effectfulFiber.stateNode;
-
- var info = {
- componentStack: capturedError.componentStack
- };
+ next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
- // Allow the boundary to handle the error, usually by scheduling
- // an update to itself
- instance.componentDidCatch(capturedError.error, info);
- return;
- case HostRoot:
- if (firstUncaughtError === null) {
- firstUncaughtError = capturedError.error;
- }
- return;
- default:
- invariant(false, 'Invalid type of work. This error is likely caused by a bug in React. Please file an issue.');
+ if (workInProgress.mode & ProfileMode) {
+ // Record the render duration assuming we didn't bailout (or error).
+ stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
}
+ } else {
+ next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
}
- function unwindContexts(from, to) {
- var node = from;
- while (node !== null) {
- switch (node.tag) {
- case ClassComponent:
- popContextProvider(node);
- break;
- case HostComponent:
- popHostContext(node);
- break;
- case HostRoot:
- popHostContainer(node);
- break;
- case HostPortal:
- popHostContainer(node);
- break;
- }
- if (node === to || node.alternate === to) {
- stopFailedWorkTimer(node);
- break;
- } else {
- stopWorkTimer(node);
- }
- node = node['return'];
+ {
+ resetCurrentFiber();
+ if (isReplayingFailedUnitOfWork) {
+ // Currently replaying a failed unit of work. This should be unreachable,
+ // because the render phase is meant to be idempotent, and it should
+ // have thrown again. Since it didn't, rethrow the original error, so
+ // React's internal stack is not misaligned.
+ rethrowOriginalError();
}
}
-
- function computeAsyncExpiration() {
- // Given the current clock time, returns an expiration time. We use rounding
- // to batch like updates together.
- // Should complete within ~1000ms. 1200ms max.
- var currentTime = recalculateCurrentTime();
- var expirationMs = 1000;
- var bucketSizeMs = 200;
- return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs);
- }
-
- function computeExpirationForFiber(fiber) {
- var expirationTime = void 0;
- if (expirationContext !== NoWork) {
- // An explicit expiration context was set;
- expirationTime = expirationContext;
- } else if (isWorking) {
- if (isCommitting) {
- // Updates that occur during the commit phase should have sync priority
- // by default.
- expirationTime = Sync;
- } else {
- // Updates during the render phase should expire at the same time as
- // the work that is being rendered.
- expirationTime = nextRenderExpirationTime;
- }
- } else {
- // No explicit expiration context was set, and we're not currently
- // performing work. Calculate a new expiration time.
- if (useSyncScheduling && !(fiber.internalContextTag & AsyncUpdates)) {
- // This is a sync update
- expirationTime = Sync;
- } else {
- // This is an async update
- expirationTime = computeAsyncExpiration();
- }
- }
- return expirationTime;
+ if (true && ReactFiberInstrumentation_1.debugTool) {
+ ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
}
- function scheduleWork(fiber, expirationTime) {
- return scheduleWorkImpl(fiber, expirationTime, false);
+ if (next === null) {
+ // If this doesn't spawn new work, complete the current work.
+ next = completeUnitOfWork(workInProgress);
}
- function checkRootNeedsClearing(root, fiber, expirationTime) {
- if (!isWorking && root === nextRoot && expirationTime < nextRenderExpirationTime) {
- // Restart the root from the top.
- if (nextUnitOfWork !== null) {
- // This is an interruption. (Used for performance tracking.)
- interruptedBy = fiber;
- }
- nextRoot = null;
- nextUnitOfWork = null;
- nextRenderExpirationTime = NoWork;
- }
- }
+ ReactCurrentOwner$2.current = null;
- function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
- recordScheduleUpdate();
+ return next;
+}
- {
- if (!isErrorRecovery && fiber.tag === ClassComponent) {
- var instance = fiber.stateNode;
- warnAboutInvalidUpdates(instance);
- }
+function workLoop(isYieldy) {
+ if (!isYieldy) {
+ // Flush work without yielding
+ while (nextUnitOfWork !== null) {
+ nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
}
-
- var node = fiber;
- while (node !== null) {
- // Walk the parent path to the root and update each node's
- // expiration time.
- if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
- node.expirationTime = expirationTime;
- }
- if (node.alternate !== null) {
- if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
- node.alternate.expirationTime = expirationTime;
+ } else {
+ // Flush asynchronous work until the deadline runs out of time.
+ while (nextUnitOfWork !== null && !shouldYield()) {
+ nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
+ }
+ }
+}
+
+function renderRoot(root, isYieldy, isExpired) {
+ !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ isWorking = true;
+ ReactCurrentOwner$2.currentDispatcher = Dispatcher;
+
+ var expirationTime = root.nextExpirationTimeToWorkOn;
+
+ var prevInteractions = null;
+ if (enableSchedulerTracing) {
+ // We're about to start new traced work.
+ // Restore pending interactions so cascading work triggered during the render phase will be accounted for.
+ prevInteractions = tracing.__interactionsRef.current;
+ tracing.__interactionsRef.current = root.memoizedInteractions;
+ }
+
+ // Check if we're starting from a fresh stack, or if we're resuming from
+ // previously yielded work.
+ if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
+ // Reset the stack and start working from the root.
+ resetStack();
+ nextRoot = root;
+ nextRenderExpirationTime = expirationTime;
+ nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
+ root.pendingCommitExpirationTime = NoWork;
+
+ if (enableSchedulerTracing) {
+ // Determine which interactions this batch of work currently includes,
+ // So that we can accurately attribute time spent working on it,
+ var interactions = new Set();
+ root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
+ if (scheduledExpirationTime <= expirationTime) {
+ scheduledInteractions.forEach(function (interaction) {
+ return interactions.add(interaction);
+ });
}
- }
- if (node['return'] === null) {
- if (node.tag === HostRoot) {
- var root = node.stateNode;
+ });
- checkRootNeedsClearing(root, fiber, expirationTime);
- requestWork(root, expirationTime);
- checkRootNeedsClearing(root, fiber, expirationTime);
- } else {
- {
- if (!isErrorRecovery && fiber.tag === ClassComponent) {
- warnAboutUpdateOnUnmounted(fiber);
+ // Store the current set of interactions on the FiberRoot for a few reasons:
+ // We can re-use it in hot functions like renderRoot() without having to recalculate it.
+ // We will also use it in commitWork() to pass to any Profiler onRender() hooks.
+ // This also provides DevTools with a way to access it when the onCommitRoot() hook is called.
+ root.memoizedInteractions = interactions;
+
+ if (interactions.size > 0) {
+ var subscriber = tracing.__subscriberRef.current;
+ if (subscriber !== null) {
+ var threadID = computeThreadID(expirationTime, root.interactionThreadID);
+ try {
+ subscriber.onWorkStarted(interactions, threadID);
+ } catch (error) {
+ // Work thrown by an interaction tracing subscriber should be rethrown,
+ // But only once it's safe (to avoid leaveing the scheduler in an invalid state).
+ // Store the error for now and we'll re-throw in finishRendering().
+ if (!hasUnhandledError) {
+ hasUnhandledError = true;
+ unhandledError = error;
}
}
- return;
}
}
- node = node['return'];
}
}
- function scheduleErrorRecovery(fiber) {
- scheduleWorkImpl(fiber, Sync, true);
- }
-
- function recalculateCurrentTime() {
- // Subtract initial time so it fits inside 32bits
- var ms = now() - startTime;
- mostRecentCurrentTime = msToExpirationTime(ms);
- return mostRecentCurrentTime;
- }
+ var didFatal = false;
- function deferredUpdates(fn) {
- var previousExpirationContext = expirationContext;
- expirationContext = computeAsyncExpiration();
- try {
- return fn();
- } finally {
- expirationContext = previousExpirationContext;
- }
- }
+ startWorkLoopTimer(nextUnitOfWork);
- function syncUpdates(fn) {
- var previousExpirationContext = expirationContext;
- expirationContext = Sync;
+ do {
try {
- return fn();
- } finally {
- expirationContext = previousExpirationContext;
- }
- }
-
- // TODO: Everything below this is written as if it has been lifted to the
- // renderers. I'll do this in a follow-up.
-
- // Linked-list of roots
- var firstScheduledRoot = null;
- var lastScheduledRoot = null;
-
- var callbackExpirationTime = NoWork;
- var callbackID = -1;
- var isRendering = false;
- var nextFlushedRoot = null;
- var nextFlushedExpirationTime = NoWork;
- var deadlineDidExpire = false;
- var hasUnhandledError = false;
- var unhandledError = null;
- var deadline = null;
-
- var isBatchingUpdates = false;
- var isUnbatchingUpdates = false;
-
- // Use these to prevent an infinite loop of nested updates
- var NESTED_UPDATE_LIMIT = 1000;
- var nestedUpdateCount = 0;
-
- var timeHeuristicForUnitOfWork = 1;
-
- function scheduleCallbackWithExpiration(expirationTime) {
- if (callbackExpirationTime !== NoWork) {
- // A callback is already scheduled. Check its expiration time (timeout).
- if (expirationTime > callbackExpirationTime) {
- // Existing callback has sufficient timeout. Exit.
- return;
+ workLoop(isYieldy);
+ } catch (thrownValue) {
+ if (nextUnitOfWork === null) {
+ // This is a fatal error.
+ didFatal = true;
+ onUncaughtError(thrownValue);
} else {
- // Existing callback has insufficient timeout. Cancel and schedule a
- // new one.
- cancelDeferredCallback(callbackID);
- }
- // The request callback timer is already running. Don't start a new one.
- } else {
- startRequestCallbackTimer();
- }
-
- // Compute a timeout for the given expiration time.
- var currentMs = now() - startTime;
- var expirationMs = expirationTimeToMs(expirationTime);
- var timeout = expirationMs - currentMs;
-
- callbackExpirationTime = expirationTime;
- callbackID = scheduleDeferredCallback(performAsyncWork, { timeout: timeout });
- }
+ {
+ // Reset global debug state
+ // We assume this is defined in DEV
+ resetCurrentlyProcessingQueue();
+ }
- // requestWork is called by the scheduler whenever a root receives an update.
- // It's up to the renderer to call renderRoot at some point in the future.
- function requestWork(root, expirationTime) {
- if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
- invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
- }
+ var failedUnitOfWork = nextUnitOfWork;
+ if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
+ replayUnitOfWork(failedUnitOfWork, thrownValue, isYieldy);
+ }
- // Add the root to the schedule.
- // Check if this root is already part of the schedule.
- if (root.nextScheduledRoot === null) {
- // This root is not already scheduled. Add it.
- root.remainingExpirationTime = expirationTime;
- if (lastScheduledRoot === null) {
- firstScheduledRoot = lastScheduledRoot = root;
- root.nextScheduledRoot = root;
- } else {
- lastScheduledRoot.nextScheduledRoot = root;
- lastScheduledRoot = root;
- lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
- }
- } else {
- // This root is already scheduled, but its priority may have increased.
- var remainingExpirationTime = root.remainingExpirationTime;
- if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) {
- // Update the priority.
- root.remainingExpirationTime = expirationTime;
+ // TODO: we already know this isn't true in some cases.
+ // At least this shows a nicer error message until we figure out the cause.
+ // https://github.com/facebook/react/issues/12449#issuecomment-386727431
+ !(nextUnitOfWork !== null) ? invariant(false, 'Failed to replay rendering after an error. This is likely caused by a bug in React. Please file an issue with a reproducing case to help us find it.') : void 0;
+
+ var sourceFiber = nextUnitOfWork;
+ var returnFiber = sourceFiber.return;
+ if (returnFiber === null) {
+ // This is the root. The root could capture its own errors. However,
+ // we don't know if it errors before or after we pushed the host
+ // context. This information is needed to avoid a stack mismatch.
+ // Because we're not sure, treat this as a fatal error. We could track
+ // which phase it fails in, but doesn't seem worth it. At least
+ // for now.
+ didFatal = true;
+ onUncaughtError(thrownValue);
+ } else {
+ throwException(root, returnFiber, sourceFiber, thrownValue, nextRenderExpirationTime);
+ nextUnitOfWork = completeUnitOfWork(sourceFiber);
+ continue;
+ }
}
}
+ break;
+ } while (true);
- if (isRendering) {
- // Prevent reentrancy. Remaining work will be scheduled at the end of
- // the currently rendering batch.
- return;
- }
-
- if (isBatchingUpdates) {
- // Flush work at the end of the batch.
- if (isUnbatchingUpdates) {
- // ...unless we're inside unbatchedUpdates, in which case we should
- // flush it now.
- nextFlushedRoot = root;
- nextFlushedExpirationTime = Sync;
- performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime);
- }
- return;
- }
-
- // TODO: Get rid of Sync and use current time?
- if (expirationTime === Sync) {
- performWork(Sync, null);
- } else {
- scheduleCallbackWithExpiration(expirationTime);
- }
+ if (enableSchedulerTracing) {
+ // Traced work is done for now; restore the previous interactions.
+ tracing.__interactionsRef.current = prevInteractions;
}
- function findHighestPriorityRoot() {
- var highestPriorityWork = NoWork;
- var highestPriorityRoot = null;
-
- if (lastScheduledRoot !== null) {
- var previousScheduledRoot = lastScheduledRoot;
- var root = firstScheduledRoot;
- while (root !== null) {
- var remainingExpirationTime = root.remainingExpirationTime;
- if (remainingExpirationTime === NoWork) {
- // This root no longer has work. Remove it from the scheduler.
-
- // TODO: This check is redudant, but Flow is confused by the branch
- // below where we set lastScheduledRoot to null, even though we break
- // from the loop right after.
- !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- if (root === root.nextScheduledRoot) {
- // This is the only root in the list.
- root.nextScheduledRoot = null;
- firstScheduledRoot = lastScheduledRoot = null;
- break;
- } else if (root === firstScheduledRoot) {
- // This is the first root in the list.
- var next = root.nextScheduledRoot;
- firstScheduledRoot = next;
- lastScheduledRoot.nextScheduledRoot = next;
- root.nextScheduledRoot = null;
- } else if (root === lastScheduledRoot) {
- // This is the last root in the list.
- lastScheduledRoot = previousScheduledRoot;
- lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
- root.nextScheduledRoot = null;
- break;
- } else {
- previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
- root.nextScheduledRoot = null;
- }
- root = previousScheduledRoot.nextScheduledRoot;
- } else {
- if (highestPriorityWork === NoWork || remainingExpirationTime < highestPriorityWork) {
- // Update the priority, if it's higher
- highestPriorityWork = remainingExpirationTime;
- highestPriorityRoot = root;
- }
- if (root === lastScheduledRoot) {
- break;
- }
- previousScheduledRoot = root;
- root = root.nextScheduledRoot;
- }
- }
- }
+ // We're done performing work. Time to clean up.
+ isWorking = false;
+ ReactCurrentOwner$2.currentDispatcher = null;
+ resetContextDependences();
- // If the next root is the same as the previous root, this is a nested
- // update. To prevent an infinite loop, increment the nested update count.
- var previousFlushedRoot = nextFlushedRoot;
- if (previousFlushedRoot !== null && previousFlushedRoot === highestPriorityRoot) {
- nestedUpdateCount++;
- } else {
- // Reset whenever we switch roots.
- nestedUpdateCount = 0;
+ // Yield back to main thread.
+ if (didFatal) {
+ var _didCompleteRoot = false;
+ stopWorkLoopTimer(interruptedBy, _didCompleteRoot);
+ interruptedBy = null;
+ // There was a fatal error.
+ {
+ resetStackAfterFatalErrorInDev();
}
- nextFlushedRoot = highestPriorityRoot;
- nextFlushedExpirationTime = highestPriorityWork;
+ // `nextRoot` points to the in-progress root. A non-null value indicates
+ // that we're in the middle of an async render. Set it to null to indicate
+ // there's no more work to be done in the current batch.
+ nextRoot = null;
+ onFatal(root);
+ return;
}
- function performAsyncWork(dl) {
- performWork(NoWork, dl);
+ if (nextUnitOfWork !== null) {
+ // There's still remaining async work in this tree, but we ran out of time
+ // in the current frame. Yield back to the renderer. Unless we're
+ // interrupted by a higher priority update, we'll continue later from where
+ // we left off.
+ var _didCompleteRoot2 = false;
+ stopWorkLoopTimer(interruptedBy, _didCompleteRoot2);
+ interruptedBy = null;
+ onYield(root);
+ return;
}
- function performWork(minExpirationTime, dl) {
- deadline = dl;
-
- // Keep working on roots until there's no more work, or until the we reach
- // the deadline.
- findHighestPriorityRoot();
-
- if (enableUserTimingAPI && deadline !== null) {
- var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
- stopRequestCallbackTimer(didExpire);
- }
-
- while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || nextFlushedExpirationTime <= minExpirationTime) && !deadlineDidExpire) {
- performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime);
- // Find the next highest priority work.
- findHighestPriorityRoot();
+ // We completed the whole tree.
+ var didCompleteRoot = true;
+ stopWorkLoopTimer(interruptedBy, didCompleteRoot);
+ var rootWorkInProgress = root.current.alternate;
+ !(rootWorkInProgress !== null) ? invariant(false, 'Finished root should have a work-in-progress. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+
+ // `nextRoot` points to the in-progress root. A non-null value indicates
+ // that we're in the middle of an async render. Set it to null to indicate
+ // there's no more work to be done in the current batch.
+ nextRoot = null;
+ interruptedBy = null;
+
+ if (nextRenderDidError) {
+ // There was an error
+ if (hasLowerPriorityWork(root, expirationTime)) {
+ // There's lower priority work. If so, it may have the effect of fixing
+ // the exception that was just thrown. Exit without committing. This is
+ // similar to a suspend, but without a timeout because we're not waiting
+ // for a promise to resolve. React will restart at the lower
+ // priority level.
+ markSuspendedPriorityLevel(root, expirationTime);
+ var suspendedExpirationTime = expirationTime;
+ var rootExpirationTime = root.expirationTime;
+ onSuspend(root, rootWorkInProgress, suspendedExpirationTime, rootExpirationTime, -1 // Indicates no timeout
+ );
+ return;
+ } else if (
+ // There's no lower priority work, but we're rendering asynchronously.
+ // Synchronsouly attempt to render the same level one more time. This is
+ // similar to a suspend, but without a timeout because we're not waiting
+ // for a promise to resolve.
+ !root.didError && !isExpired) {
+ root.didError = true;
+ var _suspendedExpirationTime = root.nextExpirationTimeToWorkOn = expirationTime;
+ var _rootExpirationTime = root.expirationTime = Sync;
+ onSuspend(root, rootWorkInProgress, _suspendedExpirationTime, _rootExpirationTime, -1 // Indicates no timeout
+ );
+ return;
}
+ }
- // We're done flushing work. Either we ran out of time in this callback,
- // or there's no more work left with sufficient priority.
+ if (enableSuspense && !isExpired && nextLatestAbsoluteTimeoutMs !== -1) {
+ // The tree was suspended.
+ var _suspendedExpirationTime2 = expirationTime;
+ markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
- // If we're inside a callback, set this to false since we just completed it.
- if (deadline !== null) {
- callbackExpirationTime = NoWork;
- callbackID = -1;
- }
- // If there's work left over, schedule a new callback.
- if (nextFlushedExpirationTime !== NoWork) {
- scheduleCallbackWithExpiration(nextFlushedExpirationTime);
+ // Find the earliest uncommitted expiration time in the tree, including
+ // work that is suspended. The timeout threshold cannot be longer than
+ // the overall expiration.
+ var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, expirationTime);
+ var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
+ if (earliestExpirationTimeMs < nextLatestAbsoluteTimeoutMs) {
+ nextLatestAbsoluteTimeoutMs = earliestExpirationTimeMs;
}
- // Clean-up.
- deadline = null;
- deadlineDidExpire = false;
- nestedUpdateCount = 0;
+ // Subtract the current time from the absolute timeout to get the number
+ // of milliseconds until the timeout. In other words, convert an absolute
+ // timestamp to a relative time. This is the value that is passed
+ // to `setTimeout`.
+ var currentTimeMs = expirationTimeToMs(requestCurrentTime());
+ var msUntilTimeout = nextLatestAbsoluteTimeoutMs - currentTimeMs;
+ msUntilTimeout = msUntilTimeout < 0 ? 0 : msUntilTimeout;
- if (hasUnhandledError) {
- var _error4 = unhandledError;
- unhandledError = null;
- hasUnhandledError = false;
- throw _error4;
- }
+ // TODO: Account for the Just Noticeable Difference
+
+ var _rootExpirationTime2 = root.expirationTime;
+ onSuspend(root, rootWorkInProgress, _suspendedExpirationTime2, _rootExpirationTime2, msUntilTimeout);
+ return;
}
- function performWorkOnRoot(root, expirationTime) {
- !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ // Ready to commit.
+ onComplete(root, rootWorkInProgress, expirationTime);
+}
- isRendering = true;
+function dispatch(sourceFiber, value, expirationTime) {
+ !(!isWorking || isCommitting$1) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
- // Check if this is async work or sync/expired work.
- // TODO: Pass current time as argument to renderRoot, commitRoot
- if (expirationTime <= recalculateCurrentTime()) {
- // Flush sync work.
- var finishedWork = root.finishedWork;
- if (finishedWork !== null) {
- // This root is already complete. We can commit it.
- root.finishedWork = null;
- root.remainingExpirationTime = commitRoot(finishedWork);
- } else {
- root.finishedWork = null;
- finishedWork = renderRoot(root, expirationTime);
- if (finishedWork !== null) {
- // We've completed the root. Commit it.
- root.remainingExpirationTime = commitRoot(finishedWork);
+ var fiber = sourceFiber.return;
+ while (fiber !== null) {
+ switch (fiber.tag) {
+ case ClassComponent:
+ case ClassComponentLazy:
+ var ctor = fiber.type;
+ var instance = fiber.stateNode;
+ if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
+ var errorInfo = createCapturedValue(value, sourceFiber);
+ var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
+ enqueueUpdate(fiber, update);
+ scheduleWork(fiber, expirationTime);
+ return;
}
- }
- } else {
- // Flush async work.
- var _finishedWork = root.finishedWork;
- if (_finishedWork !== null) {
- // This root is already complete. We can commit it.
- root.finishedWork = null;
- root.remainingExpirationTime = commitRoot(_finishedWork);
- } else {
- root.finishedWork = null;
- _finishedWork = renderRoot(root, expirationTime);
- if (_finishedWork !== null) {
- // We've completed the root. Check the deadline one more time
- // before committing.
- if (!shouldYield()) {
- // Still time left. Commit the root.
- root.remainingExpirationTime = commitRoot(_finishedWork);
- } else {
- // There's no time left. Mark this root as complete. We'll come
- // back and commit it later.
- root.finishedWork = _finishedWork;
- }
+ break;
+ case HostRoot:
+ {
+ var _errorInfo = createCapturedValue(value, sourceFiber);
+ var _update = createRootErrorUpdate(fiber, _errorInfo, expirationTime);
+ enqueueUpdate(fiber, _update);
+ scheduleWork(fiber, expirationTime);
+ return;
}
- }
}
-
- isRendering = false;
+ fiber = fiber.return;
}
- // When working on async work, the reconciler asks the renderer if it should
- // yield execution. For DOM, we implement this with requestIdleCallback.
- function shouldYield() {
- if (deadline === null) {
- return false;
- }
- if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
- // Disregard deadline.didTimeout. Only expired work should be flushed
- // during a timeout. This path is only hit for non-expired work.
- return false;
- }
- deadlineDidExpire = true;
- return true;
+ if (sourceFiber.tag === HostRoot) {
+ // Error was thrown at the root. There is no parent, so the root
+ // itself should capture it.
+ var rootFiber = sourceFiber;
+ var _errorInfo2 = createCapturedValue(value, rootFiber);
+ var _update2 = createRootErrorUpdate(rootFiber, _errorInfo2, expirationTime);
+ enqueueUpdate(rootFiber, _update2);
+ scheduleWork(rootFiber, expirationTime);
}
+}
- // TODO: Not happy about this hook. Conceptually, renderRoot should return a
- // tuple of (isReadyForCommit, didError, error)
- function onUncaughtError(error) {
- !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
- // Unschedule this root so we don't work on it again until there's
- // another update.
- nextFlushedRoot.remainingExpirationTime = NoWork;
- if (!hasUnhandledError) {
- hasUnhandledError = true;
- unhandledError = error;
- }
- }
+function captureCommitPhaseError(fiber, error) {
+ return dispatch(fiber, error, Sync);
+}
- // TODO: Batching should be implemented at the renderer level, not inside
- // the reconciler.
- function batchedUpdates(fn, a) {
- var previousIsBatchingUpdates = isBatchingUpdates;
- isBatchingUpdates = true;
- try {
- return fn(a);
- } finally {
- isBatchingUpdates = previousIsBatchingUpdates;
- if (!isBatchingUpdates && !isRendering) {
- performWork(Sync, null);
- }
- }
+function computeThreadID(expirationTime, interactionThreadID) {
+ // Interaction threads are unique per root and expiration time.
+ return expirationTime * 1000 + interactionThreadID;
+}
+
+// Creates a unique async expiration time.
+function computeUniqueAsyncExpiration() {
+ var currentTime = requestCurrentTime();
+ var result = computeAsyncExpiration(currentTime);
+ if (result <= lastUniqueAsyncExpiration) {
+ // Since we assume the current time monotonically increases, we only hit
+ // this branch when computeUniqueAsyncExpiration is fired multiple times
+ // within a 200ms window (or whatever the async bucket size is).
+ result = lastUniqueAsyncExpiration + 1;
}
+ lastUniqueAsyncExpiration = result;
+ return lastUniqueAsyncExpiration;
+}
- // TODO: Batching should be implemented at the renderer level, not inside
- // the reconciler.
- function unbatchedUpdates(fn) {
- if (isBatchingUpdates && !isUnbatchingUpdates) {
- isUnbatchingUpdates = true;
- try {
- return fn();
- } finally {
- isUnbatchingUpdates = false;
+function computeExpirationForFiber(currentTime, fiber) {
+ var expirationTime = void 0;
+ if (expirationContext !== NoWork) {
+ // An explicit expiration context was set;
+ expirationTime = expirationContext;
+ } else if (isWorking) {
+ if (isCommitting$1) {
+ // Updates that occur during the commit phase should have sync priority
+ // by default.
+ expirationTime = Sync;
+ } else {
+ // Updates during the render phase should expire at the same time as
+ // the work that is being rendered.
+ expirationTime = nextRenderExpirationTime;
+ }
+ } else {
+ // No explicit expiration context was set, and we're not currently
+ // performing work. Calculate a new expiration time.
+ if (fiber.mode & AsyncMode) {
+ if (isBatchingInteractiveUpdates) {
+ // This is an interactive update
+ expirationTime = computeInteractiveExpiration(currentTime);
+ } else {
+ // This is an async update
+ expirationTime = computeAsyncExpiration(currentTime);
}
+ // If we're in the middle of rendering a tree, do not update at the same
+ // expiration time that is already rendering.
+ if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
+ expirationTime += 1;
+ }
+ } else {
+ // This is a sync update
+ expirationTime = Sync;
}
- return fn();
}
-
- // TODO: Batching should be implemented at the renderer level, not within
- // the reconciler.
- function flushSync(fn) {
- var previousIsBatchingUpdates = isBatchingUpdates;
- isBatchingUpdates = true;
- try {
- return syncUpdates(fn);
- } finally {
- isBatchingUpdates = previousIsBatchingUpdates;
- !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
- performWork(Sync, null);
+ if (isBatchingInteractiveUpdates) {
+ // This is an interactive update. Keep track of the lowest pending
+ // interactive expiration time. This allows us to synchronously flush
+ // all interactive updates when needed.
+ if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPriorityPendingInteractiveExpirationTime) {
+ lowestPriorityPendingInteractiveExpirationTime = expirationTime;
}
}
-
- return {
- computeAsyncExpiration: computeAsyncExpiration,
- computeExpirationForFiber: computeExpirationForFiber,
- scheduleWork: scheduleWork,
- batchedUpdates: batchedUpdates,
- unbatchedUpdates: unbatchedUpdates,
- flushSync: flushSync,
- deferredUpdates: deferredUpdates
- };
-};
-
-{
- var didWarnAboutNestedUpdates = false;
+ return expirationTime;
}
-// 0 is PROD, 1 is DEV.
-// Might add PROFILE later.
-
-
-function getContextForSubtree(parentComponent) {
- if (!parentComponent) {
- return emptyObject;
+function renderDidSuspend(root, absoluteTimeoutMs, suspendedTime) {
+ // Schedule the timeout.
+ if (absoluteTimeoutMs >= 0 && nextLatestAbsoluteTimeoutMs < absoluteTimeoutMs) {
+ nextLatestAbsoluteTimeoutMs = absoluteTimeoutMs;
}
-
- var fiber = get(parentComponent);
- var parentContext = findCurrentUnmaskedContext(fiber);
- return isContextProvider(fiber) ? processChildContext(fiber, parentContext) : parentContext;
}
-var ReactFiberReconciler$1 = function (config) {
- var getPublicInstance = config.getPublicInstance;
-
- var _ReactFiberScheduler = ReactFiberScheduler(config),
- computeAsyncExpiration = _ReactFiberScheduler.computeAsyncExpiration,
- computeExpirationForFiber = _ReactFiberScheduler.computeExpirationForFiber,
- scheduleWork = _ReactFiberScheduler.scheduleWork,
- batchedUpdates = _ReactFiberScheduler.batchedUpdates,
- unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates,
- flushSync = _ReactFiberScheduler.flushSync,
- deferredUpdates = _ReactFiberScheduler.deferredUpdates;
-
- function scheduleTopLevelUpdate(current, element, callback) {
- {
- if (ReactDebugCurrentFiber.phase === 'render' && ReactDebugCurrentFiber.current !== null && !didWarnAboutNestedUpdates) {
- didWarnAboutNestedUpdates = true;
- warning(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(ReactDebugCurrentFiber.current) || 'Unknown');
- }
- }
+function renderDidError() {
+ nextRenderDidError = true;
+}
- callback = callback === undefined ? null : callback;
- {
- warning(callback === null || typeof callback === 'function', 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback);
- }
+function retrySuspendedRoot(root, fiber, suspendedTime) {
+ if (enableSuspense) {
+ var retryTime = void 0;
- var expirationTime = void 0;
- // Check if the top-level element is an async wrapper component. If so,
- // treat updates to the root as async. This is a bit weird but lets us
- // avoid a separate `renderAsync` API.
- if (enableAsyncSubtreeAPI && element != null && element.type != null && element.type.prototype != null && element.type.prototype.unstable_isAsyncReactComponent === true) {
- expirationTime = computeAsyncExpiration();
+ if (isPriorityLevelSuspended(root, suspendedTime)) {
+ // Ping at the original level
+ retryTime = suspendedTime;
+ markPingedPriorityLevel(root, retryTime);
} else {
- expirationTime = computeExpirationForFiber(current);
+ // Placeholder already timed out. Compute a new expiration time
+ var currentTime = requestCurrentTime();
+ retryTime = computeExpirationForFiber(currentTime, fiber);
+ markPendingPriorityLevel(root, retryTime);
+ }
+
+ scheduleWorkToRoot(fiber, retryTime);
+ var rootExpirationTime = root.expirationTime;
+ if (rootExpirationTime !== NoWork) {
+ if (enableSchedulerTracing) {
+ // Restore previous interactions so that new work is associated with them.
+ var prevInteractions = tracing.__interactionsRef.current;
+ tracing.__interactionsRef.current = root.memoizedInteractions;
+ // Because suspense timeouts do not decrement the interaction count,
+ // Continued suspense work should also not increment the count.
+ storeInteractionsForExpirationTime(root, rootExpirationTime, false);
+ requestWork(root, rootExpirationTime);
+ tracing.__interactionsRef.current = prevInteractions;
+ } else {
+ requestWork(root, rootExpirationTime);
+ }
}
-
- var update = {
- expirationTime: expirationTime,
- partialState: { element: element },
- callback: callback,
- isReplace: false,
- isForced: false,
- nextCallback: null,
- next: null
- };
- insertUpdateIntoFiber(current, update);
- scheduleWork(current, expirationTime);
}
+}
- function findHostInstance(fiber) {
- var hostFiber = findCurrentHostFiber(fiber);
- if (hostFiber === null) {
- return null;
- }
- return hostFiber.stateNode;
+function scheduleWorkToRoot(fiber, expirationTime) {
+ // Update the source fiber's expiration time
+ if (fiber.expirationTime === NoWork || fiber.expirationTime > expirationTime) {
+ fiber.expirationTime = expirationTime;
}
-
- return {
- createContainer: function (containerInfo, hydrate) {
- return createFiberRoot(containerInfo, hydrate);
- },
- updateContainer: function (element, container, parentComponent, callback) {
- // TODO: If this is a nested container, this won't be the root.
- var current = container.current;
-
- {
- if (ReactFiberInstrumentation_1.debugTool) {
- if (current.alternate === null) {
- ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
- } else if (element === null) {
- ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
- } else {
- ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
- }
- }
- }
-
- var context = getContextForSubtree(parentComponent);
- if (container.context === null) {
- container.context = context;
- } else {
- container.pendingContext = context;
- }
-
- scheduleTopLevelUpdate(current, element, callback);
- },
-
-
- batchedUpdates: batchedUpdates,
-
- unbatchedUpdates: unbatchedUpdates,
-
- deferredUpdates: deferredUpdates,
-
- flushSync: flushSync,
-
- getPublicRootInstance: function (container) {
- var containerFiber = container.current;
- if (!containerFiber.child) {
- return null;
- }
- switch (containerFiber.child.tag) {
- case HostComponent:
- return getPublicInstance(containerFiber.child.stateNode);
- default:
- return containerFiber.child.stateNode;
- }
- },
-
-
- findHostInstance: findHostInstance,
-
- findHostInstanceWithNoPortals: function (fiber) {
- var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
- if (hostFiber === null) {
- return null;
+ var alternate = fiber.alternate;
+ if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > expirationTime)) {
+ alternate.expirationTime = expirationTime;
+ }
+ // Walk the parent path to the root and update the child expiration time.
+ var node = fiber.return;
+ if (node === null && fiber.tag === HostRoot) {
+ return fiber.stateNode;
+ }
+ while (node !== null) {
+ alternate = node.alternate;
+ if (node.childExpirationTime === NoWork || node.childExpirationTime > expirationTime) {
+ node.childExpirationTime = expirationTime;
+ if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
+ alternate.childExpirationTime = expirationTime;
}
- return hostFiber.stateNode;
- },
- injectIntoDevTools: function (devToolsConfig) {
- var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
-
- return injectInternals(_assign({}, devToolsConfig, {
- findHostInstanceByFiber: function (fiber) {
- return findHostInstance(fiber);
- },
- findFiberByHostInstance: function (instance) {
- if (!findFiberByHostInstance) {
- // Might not be implemented by the renderer.
- return null;
- }
- return findFiberByHostInstance(instance);
- }
- }));
+ } else if (alternate !== null && (alternate.childExpirationTime === NoWork || alternate.childExpirationTime > expirationTime)) {
+ alternate.childExpirationTime = expirationTime;
}
- };
-};
-
-var ReactFiberReconciler$2 = Object.freeze({
- default: ReactFiberReconciler$1
-});
-
-var ReactFiberReconciler$3 = ( ReactFiberReconciler$2 && ReactFiberReconciler$1 ) || ReactFiberReconciler$2;
-
-// TODO: bundle Flow types with the package.
-
-
-
-// TODO: decide on the top-level export form.
-// This is hacky but makes it work with both Rollup and Jest.
-var reactReconciler = ReactFiberReconciler$3['default'] ? ReactFiberReconciler$3['default'] : ReactFiberReconciler$3;
-
-function createPortal$1(children, containerInfo,
-// TODO: figure out the API for cross-renderer implementation.
-implementation) {
- var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
-
- return {
- // This tag allow us to uniquely identify this as a React Portal
- $$typeof: REACT_PORTAL_TYPE,
- key: key == null ? null : '' + key,
- children: children,
- containerInfo: containerInfo,
- implementation: implementation
- };
-}
-
-// TODO: this is special because it gets imported during build.
-
-var ReactVersion = '16.2.0';
-
-// a requestAnimationFrame, storing the time for the start of the frame, then
-// scheduling a postMessage which gets scheduled after paint. Within the
-// postMessage handler do as much work as possible until time + frame rate.
-// By separating the idle call into a separate event tick we ensure that
-// layout, paint and other browser work is counted against the available time.
-// The frame rate is dynamically adjusted.
-
-{
- if (ExecutionEnvironment.canUseDOM && typeof requestAnimationFrame !== 'function') {
- warning(false, 'React depends on requestAnimationFrame. Make sure that you load a ' + 'polyfill in older browsers. http://fb.me/react-polyfills');
+ if (node.return === null && node.tag === HostRoot) {
+ return node.stateNode;
+ }
+ node = node.return;
}
+ return null;
}
-var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
-
-var now = void 0;
-if (hasNativePerformanceNow) {
- now = function () {
- return performance.now();
- };
-} else {
- now = function () {
- return Date.now();
- };
-}
-
-// TODO: There's no way to cancel, because Fiber doesn't atm.
-var rIC = void 0;
-var cIC = void 0;
-
-if (!ExecutionEnvironment.canUseDOM) {
- rIC = function (frameCallback) {
- return setTimeout(function () {
- frameCallback({
- timeRemaining: function () {
- return Infinity;
- }
- });
- });
- };
- cIC = function (timeoutID) {
- clearTimeout(timeoutID);
- };
-} else if (typeof requestIdleCallback !== 'function' || typeof cancelIdleCallback !== 'function') {
- // Polyfill requestIdleCallback and cancelIdleCallback
-
- var scheduledRICCallback = null;
- var isIdleScheduled = false;
- var timeoutTime = -1;
-
- var isAnimationFrameScheduled = false;
-
- var frameDeadline = 0;
- // We start out assuming that we run at 30fps but then the heuristic tracking
- // will adjust this value to a faster fps if we get more frequent animation
- // frames.
- var previousFrameTime = 33;
- var activeFrameTime = 33;
-
- var frameDeadlineObject;
- if (hasNativePerformanceNow) {
- frameDeadlineObject = {
- didTimeout: false,
- timeRemaining: function () {
- // We assume that if we have a performance timer that the rAF callback
- // gets a performance timer value. Not sure if this is always true.
- var remaining = frameDeadline - performance.now();
- return remaining > 0 ? remaining : 0;
- }
- };
- } else {
- frameDeadlineObject = {
- didTimeout: false,
- timeRemaining: function () {
- // Fallback to Date.now()
- var remaining = frameDeadline - Date.now();
- return remaining > 0 ? remaining : 0;
- }
- };
+function storeInteractionsForExpirationTime(root, expirationTime, updateInteractionCounts) {
+ if (!enableSchedulerTracing) {
+ return;
}
- // We use the postMessage trick to defer idle work until after the repaint.
- var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
- var idleTick = function (event) {
- if (event.source !== window || event.data !== messageKey) {
- return;
- }
-
- isIdleScheduled = false;
-
- var currentTime = now();
- if (frameDeadline - currentTime <= 0) {
- // There's no time left in this idle period. Check if the callback has
- // a timeout and whether it's been exceeded.
- if (timeoutTime !== -1 && timeoutTime <= currentTime) {
- // Exceeded the timeout. Invoke the callback even though there's no
- // time left.
- frameDeadlineObject.didTimeout = true;
- } else {
- // No timeout.
- if (!isAnimationFrameScheduled) {
- // Schedule another animation callback so we retry later.
- isAnimationFrameScheduled = true;
- requestAnimationFrame(animationTick);
+ var interactions = tracing.__interactionsRef.current;
+ if (interactions.size > 0) {
+ var pendingInteractions = root.pendingInteractionMap.get(expirationTime);
+ if (pendingInteractions != null) {
+ interactions.forEach(function (interaction) {
+ if (updateInteractionCounts && !pendingInteractions.has(interaction)) {
+ // Update the pending async work count for previously unscheduled interaction.
+ interaction.__count++;
}
- // Exit without invoking the callback.
- return;
- }
- } else {
- // There's still time left in this idle period.
- frameDeadlineObject.didTimeout = false;
- }
- timeoutTime = -1;
- var callback = scheduledRICCallback;
- scheduledRICCallback = null;
- if (callback !== null) {
- callback(frameDeadlineObject);
- }
- };
- // Assumes that we have addEventListener in this environment. Might need
- // something better for old IE.
- window.addEventListener('message', idleTick, false);
-
- var animationTick = function (rafTime) {
- isAnimationFrameScheduled = false;
- var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
- if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
- if (nextFrameTime < 8) {
- // Defensive coding. We don't support higher frame rates than 120hz.
- // If we get lower than that, it is probably a bug.
- nextFrameTime = 8;
- }
- // If one frame goes long, then the next one can be short to catch up.
- // If two frames are short in a row, then that's an indication that we
- // actually have a higher frame rate than what we're currently optimizing.
- // We adjust our heuristic dynamically accordingly. For example, if we're
- // running on 120hz display or 90hz VR display.
- // Take the max of the two in case one of them was an anomaly due to
- // missed frame deadlines.
- activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
+ pendingInteractions.add(interaction);
+ });
} else {
- previousFrameTime = nextFrameTime;
- }
- frameDeadline = rafTime + activeFrameTime;
- if (!isIdleScheduled) {
- isIdleScheduled = true;
- window.postMessage(messageKey, '*');
- }
- };
+ root.pendingInteractionMap.set(expirationTime, new Set(interactions));
- rIC = function (callback, options) {
- // This assumes that we only schedule one callback at a time because that's
- // how Fiber uses it.
- scheduledRICCallback = callback;
- if (options != null && typeof options.timeout === 'number') {
- timeoutTime = now() + options.timeout;
- }
- if (!isAnimationFrameScheduled) {
- // If rAF didn't already schedule one, we need to schedule a frame.
- // TODO: If this rAF doesn't materialize because the browser throttles, we
- // might want to still have setTimeout trigger rIC as a backup to ensure
- // that we keep performing work.
- isAnimationFrameScheduled = true;
- requestAnimationFrame(animationTick);
+ // Update the pending async work count for the current interactions.
+ if (updateInteractionCounts) {
+ interactions.forEach(function (interaction) {
+ interaction.__count++;
+ });
+ }
}
- return 0;
- };
-
- cIC = function () {
- scheduledRICCallback = null;
- isIdleScheduled = false;
- timeoutTime = -1;
- };
-} else {
- rIC = window.requestIdleCallback;
- cIC = window.cancelIdleCallback;
-}
-
-/**
- * Forked from fbjs/warning:
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
- *
- * Only change is we use console.warn instead of console.error,
- * and do nothing when 'console' is not supported.
- * This really simplifies the code.
- * ---
- * Similar to invariant but only logs a warning if the condition is not met.
- * This can be used to log issues in development environments in critical
- * paths. Removing the logging code for production environments will keep the
- * same logic and follow the same code paths.
- */
-var lowPriorityWarning = function () {};
-
-{
- var printWarning = function (format) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
+ var subscriber = tracing.__subscriberRef.current;
+ if (subscriber !== null) {
+ var threadID = computeThreadID(expirationTime, root.interactionThreadID);
+ subscriber.onWorkScheduled(interactions, threadID);
}
+ }
+}
- var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function () {
- return args[argIndex++];
- });
- if (typeof console !== 'undefined') {
- console.warn(message);
- }
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- throw new Error(message);
- } catch (x) {}
- };
+function scheduleWork(fiber, expirationTime) {
+ recordScheduleUpdate();
- lowPriorityWarning = function (condition, format) {
- if (format === undefined) {
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
+ {
+ if (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy) {
+ var instance = fiber.stateNode;
+ warnAboutInvalidUpdates(instance);
}
- if (!condition) {
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
- args[_key2 - 2] = arguments[_key2];
- }
+ }
- printWarning.apply(undefined, [format].concat(args));
+ var root = scheduleWorkToRoot(fiber, expirationTime);
+ if (root === null) {
+ if (true && (fiber.tag === ClassComponent || fiber.tag === ClassComponentLazy)) {
+ warnAboutUpdateOnUnmounted(fiber);
}
- };
-}
-
-var lowPriorityWarning$1 = lowPriorityWarning;
+ return;
+ }
-// isAttributeNameSafe() is currently duplicated in DOMMarkupOperations.
-// TODO: Find a better place for this.
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
- return true;
+ if (enableSchedulerTracing) {
+ storeInteractionsForExpirationTime(root, expirationTime, true);
}
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
- return false;
+
+ if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
+ // This is an interruption. (Used for performance tracking.)
+ interruptedBy = fiber;
+ resetStack();
}
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
+ markPendingPriorityLevel(root, expirationTime);
+ if (
+ // If we're in the render phase, we don't need to schedule this root
+ // for an update, because we'll do it before we exit...
+ !isWorking || isCommitting$1 ||
+ // ...unless this is a different root than the one we're rendering.
+ nextRoot !== root) {
+ var rootExpirationTime = root.expirationTime;
+ requestWork(root, rootExpirationTime);
}
- illegalAttributeNameCache[attributeName] = true;
- {
- warning(false, 'Invalid attribute name: `%s`', attributeName);
+ if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
+ // Reset this back to zero so subsequent updates don't throw.
+ nestedUpdateCount = 0;
+ invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
}
- return false;
}
-// shouldIgnoreValue() is currently duplicated in DOMMarkupOperations.
-// TODO: Find a better place for this.
-function shouldIgnoreValue(propertyInfo, value) {
- return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
+function syncUpdates(fn, a, b, c, d) {
+ var previousExpirationContext = expirationContext;
+ expirationContext = Sync;
+ try {
+ return fn(a, b, c, d);
+ } finally {
+ expirationContext = previousExpirationContext;
+ }
}
-/**
- * Operations for dealing with DOM properties.
- */
+// TODO: Everything below this is written as if it has been lifted to the
+// renderers. I'll do this in a follow-up.
+// Linked-list of roots
+var firstScheduledRoot = null;
+var lastScheduledRoot = null;
+var callbackExpirationTime = NoWork;
+var callbackID = void 0;
+var isRendering = false;
+var nextFlushedRoot = null;
+var nextFlushedExpirationTime = NoWork;
+var lowestPriorityPendingInteractiveExpirationTime = NoWork;
+var deadlineDidExpire = false;
+var hasUnhandledError = false;
+var unhandledError = null;
+var deadline = null;
+var isBatchingUpdates = false;
+var isUnbatchingUpdates = false;
+var isBatchingInteractiveUpdates = false;
+var completedBatches = null;
-/**
- * Get the value for a property on a node. Only used in DEV for SSR validation.
- * The "expected" argument is used as a hint of what the expected value is.
- * Some properties have multiple equivalent values.
- */
-function getValueForProperty(node, name, expected) {
- {
- var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- var mutationMethod = propertyInfo.mutationMethod;
- if (mutationMethod || propertyInfo.mustUseProperty) {
- return node[propertyInfo.propertyName];
- } else {
- var attributeName = propertyInfo.attributeName;
+var originalStartTimeMs = schedule.unstable_now();
+var currentRendererTime = msToExpirationTime(originalStartTimeMs);
+var currentSchedulerTime = currentRendererTime;
- var stringValue = null;
+// Use these to prevent an infinite loop of nested updates
+var NESTED_UPDATE_LIMIT = 50;
+var nestedUpdateCount = 0;
+var lastCommittedRootDuringThisBatch = null;
- if (propertyInfo.hasOverloadedBooleanValue) {
- if (node.hasAttribute(attributeName)) {
- var value = node.getAttribute(attributeName);
- if (value === '') {
- return true;
- }
- if (shouldIgnoreValue(propertyInfo, expected)) {
- return value;
- }
- if (value === '' + expected) {
- return expected;
- }
- return value;
- }
- } else if (node.hasAttribute(attributeName)) {
- if (shouldIgnoreValue(propertyInfo, expected)) {
- // We had an attribute but shouldn't have had one, so read it
- // for the error message.
- return node.getAttribute(attributeName);
- }
- if (propertyInfo.hasBooleanValue) {
- // If this was a boolean, it doesn't matter what the value is
- // the fact that we have it is the same as the expected.
- return expected;
- }
- // Even if this property uses a namespace we use getAttribute
- // because we assume its namespaced name is the same as our config.
- // To use getAttributeNS we need the local name which we don't have
- // in our config atm.
- stringValue = node.getAttribute(attributeName);
- }
+var timeHeuristicForUnitOfWork = 1;
- if (shouldIgnoreValue(propertyInfo, expected)) {
- return stringValue === null ? expected : stringValue;
- } else if (stringValue === '' + expected) {
- return expected;
- } else {
- return stringValue;
- }
- }
- }
- }
+function recomputeCurrentRendererTime() {
+ var currentTimeMs = schedule.unstable_now() - originalStartTimeMs;
+ currentRendererTime = msToExpirationTime(currentTimeMs);
}
-/**
- * Get the value for a attribute on a node. Only used in DEV for SSR validation.
- * The third argument is used as a hint of what the expected value is. Some
- * attributes have multiple equivalent values.
- */
-function getValueForAttribute(node, name, expected) {
- {
- if (!isAttributeNameSafe(name)) {
- return;
- }
- if (!node.hasAttribute(name)) {
- return expected === undefined ? undefined : null;
- }
- var value = node.getAttribute(name);
- if (value === '' + expected) {
- return expected;
- }
- return value;
- }
-}
-
-/**
- * Sets the value for a property on a node.
- *
- * @param {DOMElement} node
- * @param {string} name
- * @param {*} value
- */
-function setValueForProperty(node, name, value) {
- var propertyInfo = getPropertyInfo(name);
-
- if (propertyInfo && shouldSetAttribute(name, value)) {
- var mutationMethod = propertyInfo.mutationMethod;
- if (mutationMethod) {
- mutationMethod(node, value);
- } else if (shouldIgnoreValue(propertyInfo, value)) {
- deleteValueForProperty(node, name);
+function scheduleCallbackWithExpirationTime(root, expirationTime) {
+ if (callbackExpirationTime !== NoWork) {
+ // A callback is already scheduled. Check its expiration time (timeout).
+ if (expirationTime > callbackExpirationTime) {
+ // Existing callback has sufficient timeout. Exit.
return;
- } else if (propertyInfo.mustUseProperty) {
- // Contrary to `setAttribute`, object properties are properly
- // `toString`ed by IE8/9.
- node[propertyInfo.propertyName] = value;
} else {
- var attributeName = propertyInfo.attributeName;
- var namespace = propertyInfo.attributeNamespace;
- // `setAttribute` with objects becomes only `[object]` in IE8/9,
- // ('' + value) makes it output the correct toString()-value.
- if (namespace) {
- node.setAttributeNS(namespace, attributeName, '' + value);
- } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
- node.setAttribute(attributeName, '');
- } else {
- node.setAttribute(attributeName, '' + value);
+ if (callbackID !== null) {
+ // Existing callback has insufficient timeout. Cancel and schedule a
+ // new one.
+ schedule.unstable_cancelScheduledWork(callbackID);
}
}
+ // The request callback timer is already running. Don't start a new one.
} else {
- setValueForAttribute(node, name, shouldSetAttribute(name, value) ? value : null);
- return;
+ startRequestCallbackTimer();
}
- {
-
- }
+ callbackExpirationTime = expirationTime;
+ var currentMs = schedule.unstable_now() - originalStartTimeMs;
+ var expirationTimeMs = expirationTimeToMs(expirationTime);
+ var timeout = expirationTimeMs - currentMs;
+ callbackID = schedule.unstable_scheduleWork(performAsyncWork, { timeout: timeout });
}
-function setValueForAttribute(node, name, value) {
- if (!isAttributeNameSafe(name)) {
- return;
- }
- if (value == null) {
- node.removeAttribute(name);
- } else {
- node.setAttribute(name, '' + value);
- }
-
- {
-
- }
+// For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
+// onYield is called upon exiting. We use these in lieu of returning a tuple.
+// I've also chosen not to inline them into renderRoot because these will
+// eventually be lifted into the renderer.
+function onFatal(root) {
+ root.finishedWork = null;
}
-/**
- * Deletes an attributes from a node.
- *
- * @param {DOMElement} node
- * @param {string} name
- */
-function deleteValueForAttribute(node, name) {
- node.removeAttribute(name);
+function onComplete(root, finishedWork, expirationTime) {
+ root.pendingCommitExpirationTime = expirationTime;
+ root.finishedWork = finishedWork;
}
-/**
- * Deletes the value for a property on a node.
- *
- * @param {DOMElement} node
- * @param {string} name
- */
-function deleteValueForProperty(node, name) {
- var propertyInfo = getPropertyInfo(name);
- if (propertyInfo) {
- var mutationMethod = propertyInfo.mutationMethod;
- if (mutationMethod) {
- mutationMethod(node, undefined);
- } else if (propertyInfo.mustUseProperty) {
- var propName = propertyInfo.propertyName;
- if (propertyInfo.hasBooleanValue) {
- node[propName] = false;
- } else {
- node[propName] = '';
- }
- } else {
- node.removeAttribute(propertyInfo.attributeName);
- }
- } else {
- node.removeAttribute(name);
+function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
+ root.expirationTime = rootExpirationTime;
+ if (enableSuspense && msUntilTimeout === 0 && !shouldYield()) {
+ // Don't wait an additional tick. Commit the tree immediately.
+ root.pendingCommitExpirationTime = suspendedExpirationTime;
+ root.finishedWork = finishedWork;
+ } else if (msUntilTimeout > 0) {
+ // Wait `msUntilTimeout` milliseconds before committing.
+ root.timeoutHandle = scheduleTimeout(onTimeout.bind(null, root, finishedWork, suspendedExpirationTime), msUntilTimeout);
}
}
-var ReactControlledValuePropTypes = {
- checkPropTypes: null
-};
-
-{
- var hasReadOnlyValue = {
- button: true,
- checkbox: true,
- image: true,
- hidden: true,
- radio: true,
- reset: true,
- submit: true
- };
-
- var propTypes = {
- value: function (props, propName, componentName) {
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
- return null;
- }
- return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
- },
- checked: function (props, propName, componentName) {
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
- return null;
- }
- return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
- }
- };
-
- /**
- * Provide a linked `value` attribute for controlled forms. You should not use
- * this outside of the ReactDOM controlled form components.
- */
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
- checkPropTypes(propTypes, props, 'prop', tagName, getStack);
- };
+function onYield(root) {
+ root.finishedWork = null;
}
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var getCurrentFiberOwnerName$2 = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
-var getCurrentFiberStackAddendum$3 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
-
-var didWarnValueDefaultValue = false;
-var didWarnCheckedDefaultChecked = false;
-var didWarnControlledToUncontrolled = false;
-var didWarnUncontrolledToControlled = false;
-
-function isControlled(props) {
- var usesChecked = props.type === 'checkbox' || props.type === 'radio';
- return usesChecked ? props.checked != null : props.value != null;
-}
+function onTimeout(root, finishedWork, suspendedExpirationTime) {
+ if (enableSuspense) {
+ // The root timed out. Commit it.
+ root.pendingCommitExpirationTime = suspendedExpirationTime;
+ root.finishedWork = finishedWork;
+ // Read the current time before entering the commit phase. We can be
+ // certain this won't cause tearing related to batching of event updates
+ // because we're at the top of a timer event.
+ recomputeCurrentRendererTime();
+ currentSchedulerTime = currentRendererTime;
-/**
- * Implements an <input> host component that allows setting these optional
- * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
- *
- * If `checked` or `value` are not supplied (or null/undefined), user actions
- * that affect the checked state or value will trigger updates to the element.
- *
- * If they are supplied (and not null/undefined), the rendered element will not
- * trigger updates to the element. Instead, the props must change in order for
- * the rendered element to be updated.
- *
- * The rendered element will be initialized as unchecked (or `defaultChecked`)
- * with an empty value (or `defaultValue`).
- *
- * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
- */
-
-function getHostProps(element, props) {
- var node = element;
- var value = props.value;
- var checked = props.checked;
-
- var hostProps = _assign({
- // Make sure we set .type before any other properties (setting .value
- // before .type means .value is lost in IE11 and below)
- type: undefined,
- // Make sure we set .step before .value (setting .value before .step
- // means .value is rounded on mount, based upon step precision)
- step: undefined,
- // Make sure we set .min & .max before .value (to ensure proper order
- // in corner cases such as min or max deriving from value, e.g. Issue #7170)
- min: undefined,
- max: undefined
- }, props, {
- defaultChecked: undefined,
- defaultValue: undefined,
- value: value != null ? value : node._wrapperState.initialValue,
- checked: checked != null ? checked : node._wrapperState.initialChecked
- });
-
- return hostProps;
-}
-
-function initWrapperState(element, props) {
- {
- ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum$3);
-
- if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
- warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName$2() || 'A component', props.type);
- didWarnCheckedDefaultChecked = true;
- }
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
- warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName$2() || 'A component', props.type);
- didWarnValueDefaultValue = true;
+ if (enableSchedulerTracing) {
+ // Don't update pending interaction counts for suspense timeouts,
+ // Because we know we still need to do more work in this case.
+ suspenseDidTimeout = true;
+ flushRoot(root, suspendedExpirationTime);
+ suspenseDidTimeout = false;
+ } else {
+ flushRoot(root, suspendedExpirationTime);
}
}
-
- var defaultValue = props.defaultValue;
- var node = element;
- node._wrapperState = {
- initialChecked: props.checked != null ? props.checked : props.defaultChecked,
- initialValue: props.value != null ? props.value : defaultValue,
- controlled: isControlled(props)
- };
}
-function updateChecked(element, props) {
- var node = element;
- var checked = props.checked;
- if (checked != null) {
- setValueForProperty(node, 'checked', checked);
- }
+function onCommit(root, expirationTime) {
+ root.expirationTime = expirationTime;
+ root.finishedWork = null;
}
-function updateWrapper(element, props) {
- var node = element;
- {
- var controlled = isControlled(props);
+function requestCurrentTime() {
+ // requestCurrentTime is called by the scheduler to compute an expiration
+ // time.
+ //
+ // Expiration times are computed by adding to the current time (the start
+ // time). However, if two updates are scheduled within the same event, we
+ // should treat their start times as simultaneous, even if the actual clock
+ // time has advanced between the first and second call.
+
+ // In other words, because expiration times determine how updates are batched,
+ // we want all updates of like priority that occur within the same event to
+ // receive the same expiration time. Otherwise we get tearing.
+ //
+ // We keep track of two separate times: the current "renderer" time and the
+ // current "scheduler" time. The renderer time can be updated whenever; it
+ // only exists to minimize the calls performance.now.
+ //
+ // But the scheduler time can only be updated if there's no pending work, or
+ // if we know for certain that we're not in the middle of an event.
+
+ if (isRendering) {
+ // We're already rendering. Return the most recently read time.
+ return currentSchedulerTime;
+ }
+ // Check if there's pending work.
+ findHighestPriorityRoot();
+ if (nextFlushedExpirationTime === NoWork || nextFlushedExpirationTime === Never) {
+ // If there's no pending work, or if the pending work is offscreen, we can
+ // read the current time without risk of tearing.
+ recomputeCurrentRendererTime();
+ currentSchedulerTime = currentRendererTime;
+ return currentSchedulerTime;
+ }
+ // There's already pending work. We might be in the middle of a browser
+ // event. If we were to read the current time, it could cause multiple updates
+ // within the same event to receive different expiration times, leading to
+ // tearing. Return the last read time. During the next idle callback, the
+ // time will be updated.
+ return currentSchedulerTime;
+}
+
+// requestWork is called by the scheduler whenever a root receives an update.
+// It's up to the renderer to call renderRoot at some point in the future.
+function requestWork(root, expirationTime) {
+ addRootToSchedule(root, expirationTime);
+ if (isRendering) {
+ // Prevent reentrancy. Remaining work will be scheduled at the end of
+ // the currently rendering batch.
+ return;
+ }
- if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
- warning(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum$3());
- didWarnUncontrolledToControlled = true;
- }
- if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
- warning(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum$3());
- didWarnControlledToUncontrolled = true;
+ if (isBatchingUpdates) {
+ // Flush work at the end of the batch.
+ if (isUnbatchingUpdates) {
+ // ...unless we're inside unbatchedUpdates, in which case we should
+ // flush it now.
+ nextFlushedRoot = root;
+ nextFlushedExpirationTime = Sync;
+ performWorkOnRoot(root, Sync, true);
}
+ return;
}
- updateChecked(element, props);
+ // TODO: Get rid of Sync and use current time?
+ if (expirationTime === Sync) {
+ performSyncWork();
+ } else {
+ scheduleCallbackWithExpirationTime(root, expirationTime);
+ }
+}
- var value = props.value;
- if (value != null) {
- if (value === 0 && node.value === '') {
- node.value = '0';
- // Note: IE9 reports a number inputs as 'text', so check props instead.
- } else if (props.type === 'number') {
- // Simulate `input.valueAsNumber`. IE9 does not support it
- var valueAsNumber = parseFloat(node.value) || 0;
-
- if (
- // eslint-disable-next-line
- value != valueAsNumber ||
- // eslint-disable-next-line
- value == valueAsNumber && node.value != value) {
- // Cast `value` to a string to ensure the value is set correctly. While
- // browsers typically do this as necessary, jsdom doesn't.
- node.value = '' + value;
- }
- } else if (node.value !== '' + value) {
- // Cast `value` to a string to ensure the value is set correctly. While
- // browsers typically do this as necessary, jsdom doesn't.
- node.value = '' + value;
+function addRootToSchedule(root, expirationTime) {
+ // Add the root to the schedule.
+ // Check if this root is already part of the schedule.
+ if (root.nextScheduledRoot === null) {
+ // This root is not already scheduled. Add it.
+ root.expirationTime = expirationTime;
+ if (lastScheduledRoot === null) {
+ firstScheduledRoot = lastScheduledRoot = root;
+ root.nextScheduledRoot = root;
+ } else {
+ lastScheduledRoot.nextScheduledRoot = root;
+ lastScheduledRoot = root;
+ lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
}
} else {
- if (props.value == null && props.defaultValue != null) {
- // In Chrome, assigning defaultValue to certain input types triggers input validation.
- // For number inputs, the display value loses trailing decimal points. For email inputs,
- // Chrome raises "The specified value <x> is not a valid email address".
- //
- // Here we check to see if the defaultValue has actually changed, avoiding these problems
- // when the user is inputting text
- //
- // https://github.com/facebook/react/issues/7253
- if (node.defaultValue !== '' + props.defaultValue) {
- node.defaultValue = '' + props.defaultValue;
+ // This root is already scheduled, but its priority may have increased.
+ var remainingExpirationTime = root.expirationTime;
+ if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) {
+ // Update the priority.
+ root.expirationTime = expirationTime;
+ }
+ }
+}
+
+function findHighestPriorityRoot() {
+ var highestPriorityWork = NoWork;
+ var highestPriorityRoot = null;
+ if (lastScheduledRoot !== null) {
+ var previousScheduledRoot = lastScheduledRoot;
+ var root = firstScheduledRoot;
+ while (root !== null) {
+ var remainingExpirationTime = root.expirationTime;
+ if (remainingExpirationTime === NoWork) {
+ // This root no longer has work. Remove it from the scheduler.
+
+ // TODO: This check is redudant, but Flow is confused by the branch
+ // below where we set lastScheduledRoot to null, even though we break
+ // from the loop right after.
+ !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ if (root === root.nextScheduledRoot) {
+ // This is the only root in the list.
+ root.nextScheduledRoot = null;
+ firstScheduledRoot = lastScheduledRoot = null;
+ break;
+ } else if (root === firstScheduledRoot) {
+ // This is the first root in the list.
+ var next = root.nextScheduledRoot;
+ firstScheduledRoot = next;
+ lastScheduledRoot.nextScheduledRoot = next;
+ root.nextScheduledRoot = null;
+ } else if (root === lastScheduledRoot) {
+ // This is the last root in the list.
+ lastScheduledRoot = previousScheduledRoot;
+ lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
+ root.nextScheduledRoot = null;
+ break;
+ } else {
+ previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
+ root.nextScheduledRoot = null;
+ }
+ root = previousScheduledRoot.nextScheduledRoot;
+ } else {
+ if (highestPriorityWork === NoWork || remainingExpirationTime < highestPriorityWork) {
+ // Update the priority, if it's higher
+ highestPriorityWork = remainingExpirationTime;
+ highestPriorityRoot = root;
+ }
+ if (root === lastScheduledRoot) {
+ break;
+ }
+ if (highestPriorityWork === Sync) {
+ // Sync is highest priority by definition so
+ // we can stop searching.
+ break;
+ }
+ previousScheduledRoot = root;
+ root = root.nextScheduledRoot;
}
}
- if (props.checked == null && props.defaultChecked != null) {
- node.defaultChecked = !!props.defaultChecked;
- }
}
-}
-
-function postMountWrapper(element, props) {
- var node = element;
- // Detach value from defaultValue. We won't do anything if we're working on
- // submit or reset inputs as those values & defaultValues are linked. They
- // are not resetable nodes so this operation doesn't matter and actually
- // removes browser-default values (eg "Submit Query") when no value is
- // provided.
-
- switch (props.type) {
- case 'submit':
- case 'reset':
- break;
- case 'color':
- case 'date':
- case 'datetime':
- case 'datetime-local':
- case 'month':
- case 'time':
- case 'week':
- // This fixes the no-show issue on iOS Safari and Android Chrome:
- // https://github.com/facebook/react/issues/7233
- node.value = '';
- node.value = node.defaultValue;
- break;
- default:
- node.value = node.value;
- break;
- }
+ nextFlushedRoot = highestPriorityRoot;
+ nextFlushedExpirationTime = highestPriorityWork;
+}
- // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
- // this is needed to work around a chrome bug where setting defaultChecked
- // will sometimes influence the value of checked (even after detachment).
- // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
- // We need to temporarily unset name to avoid disrupting radio button groups.
- var name = node.name;
- if (name !== '') {
- node.name = '';
- }
- node.defaultChecked = !node.defaultChecked;
- node.defaultChecked = !node.defaultChecked;
- if (name !== '') {
- node.name = name;
+function performAsyncWork(dl) {
+ if (dl.didTimeout) {
+ // The callback timed out. That means at least one update has expired.
+ // Iterate through the root schedule. If they contain expired work, set
+ // the next render expiration time to the current time. This has the effect
+ // of flushing all expired work in a single batch, instead of flushing each
+ // level one at a time.
+ if (firstScheduledRoot !== null) {
+ recomputeCurrentRendererTime();
+ var root = firstScheduledRoot;
+ do {
+ didExpireAtExpirationTime(root, currentRendererTime);
+ // The root schedule is circular, so this is never null.
+ root = root.nextScheduledRoot;
+ } while (root !== firstScheduledRoot);
+ }
}
+ performWork(NoWork, dl);
}
-function restoreControlledState$1(element, props) {
- var node = element;
- updateWrapper(node, props);
- updateNamedCousins(node, props);
+function performSyncWork() {
+ performWork(Sync, null);
}
-function updateNamedCousins(rootNode, props) {
- var name = props.name;
- if (props.type === 'radio' && name != null) {
- var queryRoot = rootNode;
-
- while (queryRoot.parentNode) {
- queryRoot = queryRoot.parentNode;
- }
-
- // If `rootNode.form` was non-null, then we could try `form.elements`,
- // but that sometimes behaves strangely in IE8. We could also try using
- // `form.getElementsByName`, but that will only return direct children
- // and won't include inputs that use the HTML5 `form=` attribute. Since
- // the input might not even be in a form. It might not even be in the
- // document. Let's just use the local `querySelectorAll` to ensure we don't
- // miss anything.
- var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+function performWork(minExpirationTime, dl) {
+ deadline = dl;
- for (var i = 0; i < group.length; i++) {
- var otherNode = group[i];
- if (otherNode === rootNode || otherNode.form !== rootNode.form) {
- continue;
- }
- // This will throw if radio buttons rendered by different copies of React
- // and the same name are rendered into the same form (same as #1939).
- // That's probably okay; we don't support it just as we don't support
- // mixing React radio buttons with non-React ones.
- var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
- !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
+ // Keep working on roots until there's no more work, or until we reach
+ // the deadline.
+ findHighestPriorityRoot();
- // We need update the tracked value on the named cousin since the value
- // was changed but the input saw no event or value set
- updateValueIfChanged(otherNode);
+ if (deadline !== null) {
+ recomputeCurrentRendererTime();
+ currentSchedulerTime = currentRendererTime;
- // If this is a controlled radio button group, forcing the input that
- // was previously checked to update will cause it to be come re-checked
- // as appropriate.
- updateWrapper(otherNode, otherProps);
+ if (enableUserTimingAPI) {
+ var didExpire = nextFlushedExpirationTime < currentRendererTime;
+ var timeout = expirationTimeToMs(nextFlushedExpirationTime);
+ stopRequestCallbackTimer(didExpire, timeout);
}
- }
-}
-
-function flattenChildren(children) {
- var content = '';
- // Flatten children and warn if they aren't strings or numbers;
- // invalid types are ignored.
- // We can silently skip them because invalid DOM nesting warning
- // catches these cases in Fiber.
- React.Children.forEach(children, function (child) {
- if (child == null) {
- return;
+ while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || currentRendererTime >= nextFlushedExpirationTime)) {
+ performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, currentRendererTime >= nextFlushedExpirationTime);
+ findHighestPriorityRoot();
+ recomputeCurrentRendererTime();
+ currentSchedulerTime = currentRendererTime;
}
- if (typeof child === 'string' || typeof child === 'number') {
- content += child;
+ } else {
+ while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
+ performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, true);
+ findHighestPriorityRoot();
}
- });
-
- return content;
-}
+ }
-/**
- * Implements an <option> host component that warns when `selected` is set.
- */
+ // We're done flushing work. Either we ran out of time in this callback,
+ // or there's no more work left with sufficient priority.
-function validateProps(element, props) {
- // TODO (yungsters): Remove support for `selected` in <option>.
- {
- warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
+ // If we're inside a callback, set this to false since we just completed it.
+ if (deadline !== null) {
+ callbackExpirationTime = NoWork;
+ callbackID = null;
}
-}
-
-function postMountWrapper$1(element, props) {
- // value="" should make a value attribute (#6219)
- if (props.value != null) {
- element.setAttribute('value', props.value);
+ // If there's work left over, schedule a new callback.
+ if (nextFlushedExpirationTime !== NoWork) {
+ scheduleCallbackWithExpirationTime(nextFlushedRoot, nextFlushedExpirationTime);
}
-}
-
-function getHostProps$1(element, props) {
- var hostProps = _assign({ children: undefined }, props);
- var content = flattenChildren(props.children);
- if (content) {
- hostProps.children = content;
- }
+ // Clean-up.
+ deadline = null;
+ deadlineDidExpire = false;
- return hostProps;
+ finishRendering();
}
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var getCurrentFiberOwnerName$3 = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
-var getCurrentFiberStackAddendum$4 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
+function flushRoot(root, expirationTime) {
+ !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;
+ // Perform work on root as if the given expiration time is the current time.
+ // This has the effect of synchronously flushing all work up to and
+ // including the given time.
+ nextFlushedRoot = root;
+ nextFlushedExpirationTime = expirationTime;
+ performWorkOnRoot(root, expirationTime, true);
+ // Flush any sync work that was scheduled by lifecycles
+ performSyncWork();
+}
+function finishRendering() {
+ nestedUpdateCount = 0;
+ lastCommittedRootDuringThisBatch = null;
-{
- var didWarnValueDefaultValue$1 = false;
-}
+ if (completedBatches !== null) {
+ var batches = completedBatches;
+ completedBatches = null;
+ for (var i = 0; i < batches.length; i++) {
+ var batch = batches[i];
+ try {
+ batch._onComplete();
+ } catch (error) {
+ if (!hasUnhandledError) {
+ hasUnhandledError = true;
+ unhandledError = error;
+ }
+ }
+ }
+ }
-function getDeclarationErrorAddendum() {
- var ownerName = getCurrentFiberOwnerName$3();
- if (ownerName) {
- return '\n\nCheck the render method of `' + ownerName + '`.';
+ if (hasUnhandledError) {
+ var error = unhandledError;
+ unhandledError = null;
+ hasUnhandledError = false;
+ throw error;
}
- return '';
}
-var valuePropNames = ['value', 'defaultValue'];
+function performWorkOnRoot(root, expirationTime, isExpired) {
+ !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
-/**
- * Validation function for `value` and `defaultValue`.
- */
-function checkSelectPropTypes(props) {
- ReactControlledValuePropTypes.checkPropTypes('select', props, getCurrentFiberStackAddendum$4);
-
- for (var i = 0; i < valuePropNames.length; i++) {
- var propName = valuePropNames[i];
- if (props[propName] == null) {
- continue;
- }
- var isArray = Array.isArray(props[propName]);
- if (props.multiple && !isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
- } else if (!props.multiple && isArray) {
- warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
- }
- }
-}
+ isRendering = true;
-function updateOptions(node, multiple, propValue, setDefaultSelected) {
- var options = node.options;
+ // Check if this is async work or sync/expired work.
+ if (deadline === null || isExpired) {
+ // Flush work without yielding.
+ // TODO: Non-yieldy work does not necessarily imply expired work. A renderer
+ // may want to perform some work without yielding, but also without
+ // requiring the root to complete (by triggering placeholders).
- if (multiple) {
- var selectedValues = propValue;
- var selectedValue = {};
- for (var i = 0; i < selectedValues.length; i++) {
- // Prefix to avoid chaos with special keys.
- selectedValue['$' + selectedValues[i]] = true;
- }
- for (var _i = 0; _i < options.length; _i++) {
- var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
- if (options[_i].selected !== selected) {
- options[_i].selected = selected;
- }
- if (selected && setDefaultSelected) {
- options[_i].defaultSelected = true;
+ var finishedWork = root.finishedWork;
+ if (finishedWork !== null) {
+ // This root is already complete. We can commit it.
+ completeRoot(root, finishedWork, expirationTime);
+ } else {
+ root.finishedWork = null;
+ // If this root previously suspended, clear its existing timeout, since
+ // we're about to try rendering again.
+ var timeoutHandle = root.timeoutHandle;
+ if (enableSuspense && timeoutHandle !== noTimeout) {
+ root.timeoutHandle = noTimeout;
+ // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
+ cancelTimeout(timeoutHandle);
+ }
+ var isYieldy = false;
+ renderRoot(root, isYieldy, isExpired);
+ finishedWork = root.finishedWork;
+ if (finishedWork !== null) {
+ // We've completed the root. Commit it.
+ completeRoot(root, finishedWork, expirationTime);
}
}
} else {
- // Do not set `select.value` as exact behavior isn't consistent across all
- // browsers for all cases.
- var _selectedValue = '' + propValue;
- var defaultSelected = null;
- for (var _i2 = 0; _i2 < options.length; _i2++) {
- if (options[_i2].value === _selectedValue) {
- options[_i2].selected = true;
- if (setDefaultSelected) {
- options[_i2].defaultSelected = true;
+ // Flush async work.
+ var _finishedWork = root.finishedWork;
+ if (_finishedWork !== null) {
+ // This root is already complete. We can commit it.
+ completeRoot(root, _finishedWork, expirationTime);
+ } else {
+ root.finishedWork = null;
+ // If this root previously suspended, clear its existing timeout, since
+ // we're about to try rendering again.
+ var _timeoutHandle = root.timeoutHandle;
+ if (enableSuspense && _timeoutHandle !== noTimeout) {
+ root.timeoutHandle = noTimeout;
+ // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
+ cancelTimeout(_timeoutHandle);
+ }
+ var _isYieldy = true;
+ renderRoot(root, _isYieldy, isExpired);
+ _finishedWork = root.finishedWork;
+ if (_finishedWork !== null) {
+ // We've completed the root. Check the deadline one more time
+ // before committing.
+ if (!shouldYield()) {
+ // Still time left. Commit the root.
+ completeRoot(root, _finishedWork, expirationTime);
+ } else {
+ // There's no time left. Mark this root as complete. We'll come
+ // back and commit it later.
+ root.finishedWork = _finishedWork;
}
- return;
}
- if (defaultSelected === null && !options[_i2].disabled) {
- defaultSelected = options[_i2];
- }
- }
- if (defaultSelected !== null) {
- defaultSelected.selected = true;
}
}
-}
-
-/**
- * Implements a <select> host component that allows optionally setting the
- * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
- * stringable. If `multiple` is true, the prop must be an array of stringables.
- *
- * If `value` is not supplied (or null/undefined), user actions that change the
- * selected option will trigger updates to the rendered options.
- *
- * If it is supplied (and not null/undefined), the rendered options will not
- * update in response to user actions. Instead, the `value` prop must change in
- * order for the rendered options to update.
- *
- * If `defaultValue` is provided, any options with the supplied values will be
- * selected.
- */
-function getHostProps$2(element, props) {
- return _assign({}, props, {
- value: undefined
- });
+ isRendering = false;
}
-function initWrapperState$1(element, props) {
- var node = element;
- {
- checkSelectPropTypes(props);
+function completeRoot(root, finishedWork, expirationTime) {
+ // Check if there's a batch that matches this expiration time.
+ var firstBatch = root.firstBatch;
+ if (firstBatch !== null && firstBatch._expirationTime <= expirationTime) {
+ if (completedBatches === null) {
+ completedBatches = [firstBatch];
+ } else {
+ completedBatches.push(firstBatch);
+ }
+ if (firstBatch._defer) {
+ // This root is blocked from committing by a batch. Unschedule it until
+ // we receive another update.
+ root.finishedWork = finishedWork;
+ root.expirationTime = NoWork;
+ return;
+ }
}
- var value = props.value;
- node._wrapperState = {
- initialValue: value != null ? value : props.defaultValue,
- wasMultiple: !!props.multiple
- };
+ // Commit the root.
+ root.finishedWork = null;
- {
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
- warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
- didWarnValueDefaultValue$1 = true;
- }
+ // Check if this is a nested update (a sync update scheduled during the
+ // commit phase).
+ if (root === lastCommittedRootDuringThisBatch) {
+ // If the next root is the same as the previous root, this is a nested
+ // update. To prevent an infinite loop, increment the nested update count.
+ nestedUpdateCount++;
+ } else {
+ // Reset whenever we switch roots.
+ lastCommittedRootDuringThisBatch = root;
+ nestedUpdateCount = 0;
}
+ commitRoot(root, finishedWork);
}
-function postMountWrapper$2(element, props) {
- var node = element;
- node.multiple = !!props.multiple;
- var value = props.value;
- if (value != null) {
- updateOptions(node, !!props.multiple, value, false);
- } else if (props.defaultValue != null) {
- updateOptions(node, !!props.multiple, props.defaultValue, true);
+// When working on async work, the reconciler asks the renderer if it should
+// yield execution. For DOM, we implement this with requestIdleCallback.
+function shouldYield() {
+ if (deadlineDidExpire) {
+ return true;
}
-}
-
-function postUpdateWrapper(element, props) {
- var node = element;
- // After the initial mount, we control selected-ness manually so don't pass
- // this value down
- node._wrapperState.initialValue = undefined;
-
- var wasMultiple = node._wrapperState.wasMultiple;
- node._wrapperState.wasMultiple = !!props.multiple;
-
- var value = props.value;
- if (value != null) {
- updateOptions(node, !!props.multiple, value, false);
- } else if (wasMultiple !== !!props.multiple) {
- // For simplicity, reapply `defaultValue` if `multiple` is toggled.
- if (props.defaultValue != null) {
- updateOptions(node, !!props.multiple, props.defaultValue, true);
- } else {
- // Revert the select back to its default unselected state.
- updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
- }
+ if (deadline === null || deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
+ // Disregard deadline.didTimeout. Only expired work should be flushed
+ // during a timeout. This path is only hit for non-expired work.
+ return false;
}
+ deadlineDidExpire = true;
+ return true;
}
-function restoreControlledState$2(element, props) {
- var node = element;
- var value = props.value;
-
- if (value != null) {
- updateOptions(node, !!props.multiple, value, false);
+function onUncaughtError(error) {
+ !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
+ // Unschedule this root so we don't work on it again until there's
+ // another update.
+ nextFlushedRoot.expirationTime = NoWork;
+ if (!hasUnhandledError) {
+ hasUnhandledError = true;
+ unhandledError = error;
}
}
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var getCurrentFiberStackAddendum$5 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
-
-var didWarnValDefaultVal = false;
-
-/**
- * Implements a <textarea> host component that allows setting `value`, and
- * `defaultValue`. This differs from the traditional DOM API because value is
- * usually set as PCDATA children.
- *
- * If `value` is not supplied (or null/undefined), user actions that affect the
- * value will trigger updates to the element.
- *
- * If `value` is supplied (and not null/undefined), the rendered element will
- * not trigger updates to the element. Instead, the `value` prop must change in
- * order for the rendered element to be updated.
- *
- * The rendered element will be initialized with an empty value, the prop
- * `defaultValue` if specified, or the children content (deprecated).
- */
-
-function getHostProps$3(element, props) {
- var node = element;
- !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
-
- // Always set children to the same thing. In IE9, the selection range will
- // get reset if `textContent` is mutated. We could add a check in setTextContent
- // to only set the value if/when the value differs from the node value (which would
- // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
- // solution. The value can be a boolean or object so that's why it's forced
- // to be a string.
- var hostProps = _assign({}, props, {
- value: undefined,
- defaultValue: undefined,
- children: '' + node._wrapperState.initialValue
- });
-
- return hostProps;
-}
-
-function initWrapperState$2(element, props) {
- var node = element;
- {
- ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
- warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
- didWarnValDefaultVal = true;
- }
- }
-
- var initialValue = props.value;
-
- // Only bother fetching default value if we're going to use it
- if (initialValue == null) {
- var defaultValue = props.defaultValue;
- // TODO (yungsters): Remove support for children content in <textarea>.
- var children = props.children;
- if (children != null) {
- {
- warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
- }
- !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
- if (Array.isArray(children)) {
- !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
- children = children[0];
- }
-
- defaultValue = '' + children;
- }
- if (defaultValue == null) {
- defaultValue = '';
+// TODO: Batching should be implemented at the renderer level, not inside
+// the reconciler.
+function batchedUpdates$1(fn, a) {
+ var previousIsBatchingUpdates = isBatchingUpdates;
+ isBatchingUpdates = true;
+ try {
+ return fn(a);
+ } finally {
+ isBatchingUpdates = previousIsBatchingUpdates;
+ if (!isBatchingUpdates && !isRendering) {
+ performSyncWork();
}
- initialValue = defaultValue;
}
-
- node._wrapperState = {
- initialValue: '' + initialValue
- };
}
-function updateWrapper$1(element, props) {
- var node = element;
- var value = props.value;
- if (value != null) {
- // Cast `value` to a string to ensure the value is set correctly. While
- // browsers typically do this as necessary, jsdom doesn't.
- var newValue = '' + value;
-
- // To avoid side effects (such as losing text selection), only set value if changed
- if (newValue !== node.value) {
- node.value = newValue;
- }
- if (props.defaultValue == null) {
- node.defaultValue = newValue;
+// TODO: Batching should be implemented at the renderer level, not inside
+// the reconciler.
+function unbatchedUpdates(fn, a) {
+ if (isBatchingUpdates && !isUnbatchingUpdates) {
+ isUnbatchingUpdates = true;
+ try {
+ return fn(a);
+ } finally {
+ isUnbatchingUpdates = false;
}
}
- if (props.defaultValue != null) {
- node.defaultValue = props.defaultValue;
- }
+ return fn(a);
}
-function postMountWrapper$3(element, props) {
- var node = element;
- // This is in postMount because we need access to the DOM node, which is not
- // available until after the component has mounted.
- var textContent = node.textContent;
-
- // Only set node.value if textContent is equal to the expected
- // initial value. In IE10/IE11 there is a bug where the placeholder attribute
- // will populate textContent as well.
- // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
- if (textContent === node._wrapperState.initialValue) {
- node.value = textContent;
+// TODO: Batching should be implemented at the renderer level, not within
+// the reconciler.
+function flushSync(fn, a) {
+ !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
+ var previousIsBatchingUpdates = isBatchingUpdates;
+ isBatchingUpdates = true;
+ try {
+ return syncUpdates(fn, a);
+ } finally {
+ isBatchingUpdates = previousIsBatchingUpdates;
+ performSyncWork();
}
}
-function restoreControlledState$3(element, props) {
- // DOM component is still mounted; update
- updateWrapper$1(element, props);
-}
-
-var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
-var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
-var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
-
-var Namespaces = {
- html: HTML_NAMESPACE$1,
- mathml: MATH_NAMESPACE,
- svg: SVG_NAMESPACE
-};
-
-// Assumes there is no parent namespace.
-function getIntrinsicNamespace(type) {
- switch (type) {
- case 'svg':
- return SVG_NAMESPACE;
- case 'math':
- return MATH_NAMESPACE;
- default:
- return HTML_NAMESPACE$1;
+function interactiveUpdates$1(fn, a, b) {
+ if (isBatchingInteractiveUpdates) {
+ return fn(a, b);
}
-}
-
-function getChildNamespace(parentNamespace, type) {
- if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
- // No (or default) parent namespace: potential entry point.
- return getIntrinsicNamespace(type);
+ // If there are any pending interactive updates, synchronously flush them.
+ // This needs to happen before we read any handlers, because the effect of
+ // the previous event may influence which handlers are called during
+ // this event.
+ if (!isBatchingUpdates && !isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
+ // Synchronously flush pending interactive updates.
+ performWork(lowestPriorityPendingInteractiveExpirationTime, null);
+ lowestPriorityPendingInteractiveExpirationTime = NoWork;
}
- if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
- // We're leaving SVG.
- return HTML_NAMESPACE$1;
+ var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
+ var previousIsBatchingUpdates = isBatchingUpdates;
+ isBatchingInteractiveUpdates = true;
+ isBatchingUpdates = true;
+ try {
+ return fn(a, b);
+ } finally {
+ isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
+ isBatchingUpdates = previousIsBatchingUpdates;
+ if (!isBatchingUpdates && !isRendering) {
+ performSyncWork();
+ }
}
- // By default, pass namespace below.
- return parentNamespace;
}
-/* globals MSApp */
-
-/**
- * Create a function which has 'unsafe' privileges (required by windows8 apps)
- */
-var createMicrosoftUnsafeLocalFunction = function (func) {
- if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- return function (arg0, arg1, arg2, arg3) {
- MSApp.execUnsafeLocalFunction(function () {
- return func(arg0, arg1, arg2, arg3);
- });
- };
- } else {
- return func;
- }
-};
-
-// SVG temp container for IE lacking innerHTML
-var reusableSVGContainer = void 0;
-
-/**
- * Set the innerHTML property of a node
- *
- * @param {DOMElement} node
- * @param {string} html
- * @internal
- */
-var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
- // IE does not have innerHTML for SVG nodes, so instead we inject the
- // new markup in a temp node and then move the child nodes across into
- // the target node
-
- if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
- reusableSVGContainer = reusableSVGContainer || document.createElement('div');
- reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
- var svgNode = reusableSVGContainer.firstChild;
- while (node.firstChild) {
- node.removeChild(node.firstChild);
- }
- while (svgNode.firstChild) {
- node.appendChild(svgNode.firstChild);
- }
- } else {
- node.innerHTML = html;
+function flushInteractiveUpdates$1() {
+ if (!isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
+ // Synchronously flush pending interactive updates.
+ performWork(lowestPriorityPendingInteractiveExpirationTime, null);
+ lowestPriorityPendingInteractiveExpirationTime = NoWork;
}
-});
-
-/**
- * Set the textContent property of a node, ensuring that whitespace is preserved
- * even in IE8. innerText is a poor substitute for textContent and, among many
- * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
- * as it should.
- *
- * @param {DOMElement} node
- * @param {string} text
- * @internal
- */
-var setTextContent = function (node, text) {
- if (text) {
- var firstChild = node.firstChild;
+}
- if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
- firstChild.nodeValue = text;
- return;
+function flushControlled(fn) {
+ var previousIsBatchingUpdates = isBatchingUpdates;
+ isBatchingUpdates = true;
+ try {
+ syncUpdates(fn);
+ } finally {
+ isBatchingUpdates = previousIsBatchingUpdates;
+ if (!isBatchingUpdates && !isRendering) {
+ performSyncWork();
}
}
- node.textContent = text;
-};
-
-/**
- * CSS properties which accept numbers but are not in units of "px".
- */
-var isUnitlessNumber = {
- animationIterationCount: true,
- borderImageOutset: true,
- borderImageSlice: true,
- borderImageWidth: true,
- boxFlex: true,
- boxFlexGroup: true,
- boxOrdinalGroup: true,
- columnCount: true,
- columns: true,
- flex: true,
- flexGrow: true,
- flexPositive: true,
- flexShrink: true,
- flexNegative: true,
- flexOrder: true,
- gridRow: true,
- gridRowEnd: true,
- gridRowSpan: true,
- gridRowStart: true,
- gridColumn: true,
- gridColumnEnd: true,
- gridColumnSpan: true,
- gridColumnStart: true,
- fontWeight: true,
- lineClamp: true,
- lineHeight: true,
- opacity: true,
- order: true,
- orphans: true,
- tabSize: true,
- widows: true,
- zIndex: true,
- zoom: true,
-
- // SVG-related properties
- fillOpacity: true,
- floodOpacity: true,
- stopOpacity: true,
- strokeDasharray: true,
- strokeDashoffset: true,
- strokeMiterlimit: true,
- strokeOpacity: true,
- strokeWidth: true
-};
-
-/**
- * @param {string} prefix vendor-specific prefix, eg: Webkit
- * @param {string} key style name, eg: transitionDuration
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
- * WebkitTransitionDuration
- */
-function prefixKey(prefix, key) {
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
-/**
- * Support style names that may come passed in prefixed by adding permutations
- * of vendor prefixes.
- */
-var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
-
-// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
-// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function (prop) {
- prefixes.forEach(function (prefix) {
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
- });
-});
-
-/**
- * Convert a value into the proper css writable value. The style name `name`
- * should be logical (no hyphens), as specified
- * in `CSSProperty.isUnitlessNumber`.
- *
- * @param {string} name CSS property name such as `topMargin`.
- * @param {*} value CSS property value such as `10px`.
- * @return {string} Normalized style value with dimensions applied.
- */
-function dangerousStyleValue(name, value, isCustomProperty) {
- // Note that we've removed escapeTextForBrowser() calls here since the
- // whole string will be escaped when the attribute is injected into
- // the markup. If you provide unsafe user data here they can inject
- // arbitrary CSS which may be problematic (I couldn't repro this):
- // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
- // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
- // This is not an XSS hole but instead a potential CSS injection issue
- // which has lead to a greater discussion about how we're going to
- // trust URLs moving forward. See #2115901
-
- var isEmpty = value == null || typeof value === 'boolean' || value === '';
- if (isEmpty) {
- return '';
- }
-
- if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
- return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
- }
+// 0 is PROD, 1 is DEV.
+// Might add PROFILE later.
- return ('' + value).trim();
-}
-var warnValidStyle = emptyFunction;
+var didWarnAboutNestedUpdates = void 0;
{
- // 'msTransform' is correct, but the other prefixes should be capitalized
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
-
- // style values shouldn't contain a semicolon
- var badStyleValueWithSemicolonPattern = /;\s*$/;
-
- var warnedStyleNames = {};
- var warnedStyleValues = {};
- var warnedForNaNValue = false;
- var warnedForInfinityValue = false;
-
- var warnHyphenatedStyleName = function (name, getStack) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
- };
-
- var warnBadVendoredStyleName = function (name, getStack) {
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
- return;
- }
-
- warnedStyleNames[name] = true;
- warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
- };
-
- var warnStyleValueWithSemicolon = function (name, value, getStack) {
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
- return;
- }
-
- warnedStyleValues[value] = true;
- warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
- };
+ didWarnAboutNestedUpdates = false;
+}
- var warnStyleValueIsNaN = function (name, value, getStack) {
- if (warnedForNaNValue) {
- return;
- }
+function getContextForSubtree(parentComponent) {
+ if (!parentComponent) {
+ return emptyContextObject;
+ }
- warnedForNaNValue = true;
- warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
- };
+ var fiber = get(parentComponent);
+ var parentContext = findCurrentUnmaskedContext(fiber);
- var warnStyleValueIsInfinity = function (name, value, getStack) {
- if (warnedForInfinityValue) {
- return;
+ if (fiber.tag === ClassComponent) {
+ var Component = fiber.type;
+ if (isContextProvider(Component)) {
+ return processChildContext(fiber, Component, parentContext);
}
-
- warnedForInfinityValue = true;
- warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
- };
-
- warnValidStyle = function (name, value, getStack) {
- if (name.indexOf('-') > -1) {
- warnHyphenatedStyleName(name, getStack);
- } else if (badVendoredStyleNamePattern.test(name)) {
- warnBadVendoredStyleName(name, getStack);
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
- warnStyleValueWithSemicolon(name, value, getStack);
+ } else if (fiber.tag === ClassComponentLazy) {
+ var _Component = getResultFromResolvedThenable(fiber.type);
+ if (isContextProvider(_Component)) {
+ return processChildContext(fiber, _Component, parentContext);
}
+ }
- if (typeof value === 'number') {
- if (isNaN(value)) {
- warnStyleValueIsNaN(name, value, getStack);
- } else if (!isFinite(value)) {
- warnStyleValueIsInfinity(name, value, getStack);
- }
- }
- };
+ return parentContext;
}
-var warnValidStyle$1 = warnValidStyle;
-
-/**
- * Operations for dealing with CSS properties.
- */
-
-/**
- * This creates a string that is expected to be equivalent to the style
- * attribute generated by server-side rendering. It by-passes warnings and
- * security checks so it's not safe to use this value for anything other than
- * comparison. It is only used in DEV for SSR validation.
- */
-function createDangerousStringForStyles(styles) {
+function scheduleRootUpdate(current$$1, element, expirationTime, callback) {
{
- var serialized = '';
- var delimiter = '';
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- var styleValue = styles[styleName];
- if (styleValue != null) {
- var isCustomProperty = styleName.indexOf('--') === 0;
- serialized += delimiter + hyphenateStyleName(styleName) + ':';
- serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
-
- delimiter = ';';
- }
- }
- return serialized || null;
- }
-}
-
-/**
- * Sets the value for multiple styles on a node. If a value is specified as
- * '' (empty string), the corresponding style property will be unset.
- *
- * @param {DOMElement} node
- * @param {object} styles
- */
-function setValueForStyles(node, styles, getStack) {
- var style = node.style;
- for (var styleName in styles) {
- if (!styles.hasOwnProperty(styleName)) {
- continue;
- }
- var isCustomProperty = styleName.indexOf('--') === 0;
- {
- if (!isCustomProperty) {
- warnValidStyle$1(styleName, styles[styleName], getStack);
- }
- }
- var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
- if (styleName === 'float') {
- styleName = 'cssFloat';
- }
- if (isCustomProperty) {
- style.setProperty(styleName, styleValue);
- } else {
- style[styleName] = styleValue;
+ if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
+ didWarnAboutNestedUpdates = true;
+ warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
}
}
-}
-// For HTML, certain tags should omit their close tag. We keep a whitelist for
-// those special-case tags.
+ var update = createUpdate(expirationTime);
+ // Caution: React DevTools currently depends on this property
+ // being called "element".
+ update.payload = { element: element };
-var omittedCloseTags = {
- area: true,
- base: true,
- br: true,
- col: true,
- embed: true,
- hr: true,
- img: true,
- input: true,
- keygen: true,
- link: true,
- meta: true,
- param: true,
- source: true,
- track: true,
- wbr: true
-};
-
-// For HTML, certain tags cannot have children. This has the same purpose as
-// `omittedCloseTags` except that `menuitem` should still have its closing tag.
-
-var voidElementTags = _assign({
- menuitem: true
-}, omittedCloseTags);
-
-var HTML$1 = '__html';
-
-function assertValidProps(tag, props, getStack) {
- if (!props) {
- return;
+ callback = callback === undefined ? null : callback;
+ if (callback !== null) {
+ !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
+ update.callback = callback;
}
- // Note the use of `==` which checks for null or undefined.
- if (voidElementTags[tag]) {
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
- }
- if (props.dangerouslySetInnerHTML != null) {
- !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
- !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
- }
- {
- warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack());
- }
- !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
-}
+ enqueueUpdate(current$$1, update);
-function isCustomComponent(tagName, props) {
- if (tagName.indexOf('-') === -1) {
- return typeof props.is === 'string';
- }
- switch (tagName) {
- // These are reserved SVG and MathML elements.
- // We don't mind this whitelist too much because we expect it to never grow.
- // The alternative is to track the namespace in a few places which is convoluted.
- // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
- case 'annotation-xml':
- case 'color-profile':
- case 'font-face':
- case 'font-face-src':
- case 'font-face-uri':
- case 'font-face-format':
- case 'font-face-name':
- case 'missing-glyph':
- return false;
- default:
- return true;
- }
+ scheduleWork(current$$1, expirationTime);
+ return expirationTime;
}
-var ariaProperties = {
- 'aria-current': 0, // state
- 'aria-details': 0,
- 'aria-disabled': 0, // state
- 'aria-hidden': 0, // state
- 'aria-invalid': 0, // state
- 'aria-keyshortcuts': 0,
- 'aria-label': 0,
- 'aria-roledescription': 0,
- // Widget Attributes
- 'aria-autocomplete': 0,
- 'aria-checked': 0,
- 'aria-expanded': 0,
- 'aria-haspopup': 0,
- 'aria-level': 0,
- 'aria-modal': 0,
- 'aria-multiline': 0,
- 'aria-multiselectable': 0,
- 'aria-orientation': 0,
- 'aria-placeholder': 0,
- 'aria-pressed': 0,
- 'aria-readonly': 0,
- 'aria-required': 0,
- 'aria-selected': 0,
- 'aria-sort': 0,
- 'aria-valuemax': 0,
- 'aria-valuemin': 0,
- 'aria-valuenow': 0,
- 'aria-valuetext': 0,
- // Live Region Attributes
- 'aria-atomic': 0,
- 'aria-busy': 0,
- 'aria-live': 0,
- 'aria-relevant': 0,
- // Drag-and-Drop Attributes
- 'aria-dropeffect': 0,
- 'aria-grabbed': 0,
- // Relationship Attributes
- 'aria-activedescendant': 0,
- 'aria-colcount': 0,
- 'aria-colindex': 0,
- 'aria-colspan': 0,
- 'aria-controls': 0,
- 'aria-describedby': 0,
- 'aria-errormessage': 0,
- 'aria-flowto': 0,
- 'aria-labelledby': 0,
- 'aria-owns': 0,
- 'aria-posinset': 0,
- 'aria-rowcount': 0,
- 'aria-rowindex': 0,
- 'aria-rowspan': 0,
- 'aria-setsize': 0
-};
+function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback) {
+ // TODO: If this is a nested container, this won't be the root.
+ var current$$1 = container.current;
-var warnedProperties = {};
-var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
-var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-function getStackAddendum() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
-}
-
-function validateProperty(tagName, name) {
- if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
- return true;
- }
-
- if (rARIACamel.test(name)) {
- var ariaName = 'aria-' + name.slice(4).toLowerCase();
- var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
-
- // If this is an aria-* attribute, but is not listed in the known DOM
- // DOM properties, then it is an invalid aria-* attribute.
- if (correctName == null) {
- warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum());
- warnedProperties[name] = true;
- return true;
- }
- // aria-* attributes should be lowercase; suggest the lowercase version.
- if (name !== correctName) {
- warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum());
- warnedProperties[name] = true;
- return true;
+ {
+ if (ReactFiberInstrumentation_1.debugTool) {
+ if (current$$1.alternate === null) {
+ ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
+ } else if (element === null) {
+ ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
+ } else {
+ ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
+ }
}
}
- if (rARIA.test(name)) {
- var lowerCasedName = name.toLowerCase();
- var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
-
- // If this is an aria-* attribute, but is not listed in the known DOM
- // DOM properties, then it is an invalid aria-* attribute.
- if (standardName == null) {
- warnedProperties[name] = true;
- return false;
- }
- // aria-* attributes should be lowercase; suggest the lowercase version.
- if (name !== standardName) {
- warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum());
- warnedProperties[name] = true;
- return true;
- }
+ var context = getContextForSubtree(parentComponent);
+ if (container.context === null) {
+ container.context = context;
+ } else {
+ container.pendingContext = context;
}
- return true;
+ return scheduleRootUpdate(current$$1, element, expirationTime, callback);
}
-function warnInvalidARIAProps(type, props) {
- var invalidProps = [];
-
- for (var key in props) {
- var isValid = validateProperty(type, key);
- if (!isValid) {
- invalidProps.push(key);
+function findHostInstance(component) {
+ var fiber = get(component);
+ if (fiber === undefined) {
+ if (typeof component.render === 'function') {
+ invariant(false, 'Unable to find node on an unmounted component.');
+ } else {
+ invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
}
}
-
- var unknownPropString = invalidProps.map(function (prop) {
- return '`' + prop + '`';
- }).join(', ');
-
- if (invalidProps.length === 1) {
- warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum());
- } else if (invalidProps.length > 1) {
- warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum());
+ var hostFiber = findCurrentHostFiber(fiber);
+ if (hostFiber === null) {
+ return null;
}
+ return hostFiber.stateNode;
}
-function validateProperties(type, props) {
- if (isCustomComponent(type, props)) {
- return;
- }
- warnInvalidARIAProps(type, props);
+function createContainer(containerInfo, isAsync, hydrate) {
+ return createFiberRoot(containerInfo, isAsync, hydrate);
}
-var didWarnValueNull = false;
-
-function getStackAddendum$1() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
+function updateContainer(element, container, parentComponent, callback) {
+ var current$$1 = container.current;
+ var currentTime = requestCurrentTime();
+ var expirationTime = computeExpirationForFiber(currentTime, current$$1);
+ return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback);
}
-function validateProperties$1(type, props) {
- if (type !== 'input' && type !== 'textarea' && type !== 'select') {
- return;
+function getPublicRootInstance(container) {
+ var containerFiber = container.current;
+ if (!containerFiber.child) {
+ return null;
}
-
- if (props != null && props.value === null && !didWarnValueNull) {
- didWarnValueNull = true;
- if (type === 'select' && props.multiple) {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$1());
- } else {
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$1());
- }
+ switch (containerFiber.child.tag) {
+ case HostComponent:
+ return getPublicInstance(containerFiber.child.stateNode);
+ default:
+ return containerFiber.child.stateNode;
}
}
-// When adding attributes to the HTML or SVG whitelist, be sure to
-// also add them to this module to ensure casing and incorrect name
-// warnings.
-var possibleStandardNames = {
- // HTML
- accept: 'accept',
- acceptcharset: 'acceptCharset',
- 'accept-charset': 'acceptCharset',
- accesskey: 'accessKey',
- action: 'action',
- allowfullscreen: 'allowFullScreen',
- alt: 'alt',
- as: 'as',
- async: 'async',
- autocapitalize: 'autoCapitalize',
- autocomplete: 'autoComplete',
- autocorrect: 'autoCorrect',
- autofocus: 'autoFocus',
- autoplay: 'autoPlay',
- autosave: 'autoSave',
- capture: 'capture',
- cellpadding: 'cellPadding',
- cellspacing: 'cellSpacing',
- challenge: 'challenge',
- charset: 'charSet',
- checked: 'checked',
- children: 'children',
- cite: 'cite',
- 'class': 'className',
- classid: 'classID',
- classname: 'className',
- cols: 'cols',
- colspan: 'colSpan',
- content: 'content',
- contenteditable: 'contentEditable',
- contextmenu: 'contextMenu',
- controls: 'controls',
- controlslist: 'controlsList',
- coords: 'coords',
- crossorigin: 'crossOrigin',
- dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
- data: 'data',
- datetime: 'dateTime',
- 'default': 'default',
- defaultchecked: 'defaultChecked',
- defaultvalue: 'defaultValue',
- defer: 'defer',
- dir: 'dir',
- disabled: 'disabled',
- download: 'download',
- draggable: 'draggable',
- enctype: 'encType',
- 'for': 'htmlFor',
- form: 'form',
- formmethod: 'formMethod',
- formaction: 'formAction',
- formenctype: 'formEncType',
- formnovalidate: 'formNoValidate',
- formtarget: 'formTarget',
- frameborder: 'frameBorder',
- headers: 'headers',
- height: 'height',
- hidden: 'hidden',
- high: 'high',
- href: 'href',
- hreflang: 'hrefLang',
- htmlfor: 'htmlFor',
- httpequiv: 'httpEquiv',
- 'http-equiv': 'httpEquiv',
- icon: 'icon',
- id: 'id',
- innerhtml: 'innerHTML',
- inputmode: 'inputMode',
- integrity: 'integrity',
- is: 'is',
- itemid: 'itemID',
- itemprop: 'itemProp',
- itemref: 'itemRef',
- itemscope: 'itemScope',
- itemtype: 'itemType',
- keyparams: 'keyParams',
- keytype: 'keyType',
- kind: 'kind',
- label: 'label',
- lang: 'lang',
- list: 'list',
- loop: 'loop',
- low: 'low',
- manifest: 'manifest',
- marginwidth: 'marginWidth',
- marginheight: 'marginHeight',
- max: 'max',
- maxlength: 'maxLength',
- media: 'media',
- mediagroup: 'mediaGroup',
- method: 'method',
- min: 'min',
- minlength: 'minLength',
- multiple: 'multiple',
- muted: 'muted',
- name: 'name',
- nonce: 'nonce',
- novalidate: 'noValidate',
- open: 'open',
- optimum: 'optimum',
- pattern: 'pattern',
- placeholder: 'placeholder',
- playsinline: 'playsInline',
- poster: 'poster',
- preload: 'preload',
- profile: 'profile',
- radiogroup: 'radioGroup',
- readonly: 'readOnly',
- referrerpolicy: 'referrerPolicy',
- rel: 'rel',
- required: 'required',
- reversed: 'reversed',
- role: 'role',
- rows: 'rows',
- rowspan: 'rowSpan',
- sandbox: 'sandbox',
- scope: 'scope',
- scoped: 'scoped',
- scrolling: 'scrolling',
- seamless: 'seamless',
- selected: 'selected',
- shape: 'shape',
- size: 'size',
- sizes: 'sizes',
- span: 'span',
- spellcheck: 'spellCheck',
- src: 'src',
- srcdoc: 'srcDoc',
- srclang: 'srcLang',
- srcset: 'srcSet',
- start: 'start',
- step: 'step',
- style: 'style',
- summary: 'summary',
- tabindex: 'tabIndex',
- target: 'target',
- title: 'title',
- type: 'type',
- usemap: 'useMap',
- value: 'value',
- width: 'width',
- wmode: 'wmode',
- wrap: 'wrap',
-
- // SVG
- about: 'about',
- accentheight: 'accentHeight',
- 'accent-height': 'accentHeight',
- accumulate: 'accumulate',
- additive: 'additive',
- alignmentbaseline: 'alignmentBaseline',
- 'alignment-baseline': 'alignmentBaseline',
- allowreorder: 'allowReorder',
- alphabetic: 'alphabetic',
- amplitude: 'amplitude',
- arabicform: 'arabicForm',
- 'arabic-form': 'arabicForm',
- ascent: 'ascent',
- attributename: 'attributeName',
- attributetype: 'attributeType',
- autoreverse: 'autoReverse',
- azimuth: 'azimuth',
- basefrequency: 'baseFrequency',
- baselineshift: 'baselineShift',
- 'baseline-shift': 'baselineShift',
- baseprofile: 'baseProfile',
- bbox: 'bbox',
- begin: 'begin',
- bias: 'bias',
- by: 'by',
- calcmode: 'calcMode',
- capheight: 'capHeight',
- 'cap-height': 'capHeight',
- clip: 'clip',
- clippath: 'clipPath',
- 'clip-path': 'clipPath',
- clippathunits: 'clipPathUnits',
- cliprule: 'clipRule',
- 'clip-rule': 'clipRule',
- color: 'color',
- colorinterpolation: 'colorInterpolation',
- 'color-interpolation': 'colorInterpolation',
- colorinterpolationfilters: 'colorInterpolationFilters',
- 'color-interpolation-filters': 'colorInterpolationFilters',
- colorprofile: 'colorProfile',
- 'color-profile': 'colorProfile',
- colorrendering: 'colorRendering',
- 'color-rendering': 'colorRendering',
- contentscripttype: 'contentScriptType',
- contentstyletype: 'contentStyleType',
- cursor: 'cursor',
- cx: 'cx',
- cy: 'cy',
- d: 'd',
- datatype: 'datatype',
- decelerate: 'decelerate',
- descent: 'descent',
- diffuseconstant: 'diffuseConstant',
- direction: 'direction',
- display: 'display',
- divisor: 'divisor',
- dominantbaseline: 'dominantBaseline',
- 'dominant-baseline': 'dominantBaseline',
- dur: 'dur',
- dx: 'dx',
- dy: 'dy',
- edgemode: 'edgeMode',
- elevation: 'elevation',
- enablebackground: 'enableBackground',
- 'enable-background': 'enableBackground',
- end: 'end',
- exponent: 'exponent',
- externalresourcesrequired: 'externalResourcesRequired',
- fill: 'fill',
- fillopacity: 'fillOpacity',
- 'fill-opacity': 'fillOpacity',
- fillrule: 'fillRule',
- 'fill-rule': 'fillRule',
- filter: 'filter',
- filterres: 'filterRes',
- filterunits: 'filterUnits',
- floodopacity: 'floodOpacity',
- 'flood-opacity': 'floodOpacity',
- floodcolor: 'floodColor',
- 'flood-color': 'floodColor',
- focusable: 'focusable',
- fontfamily: 'fontFamily',
- 'font-family': 'fontFamily',
- fontsize: 'fontSize',
- 'font-size': 'fontSize',
- fontsizeadjust: 'fontSizeAdjust',
- 'font-size-adjust': 'fontSizeAdjust',
- fontstretch: 'fontStretch',
- 'font-stretch': 'fontStretch',
- fontstyle: 'fontStyle',
- 'font-style': 'fontStyle',
- fontvariant: 'fontVariant',
- 'font-variant': 'fontVariant',
- fontweight: 'fontWeight',
- 'font-weight': 'fontWeight',
- format: 'format',
- from: 'from',
- fx: 'fx',
- fy: 'fy',
- g1: 'g1',
- g2: 'g2',
- glyphname: 'glyphName',
- 'glyph-name': 'glyphName',
- glyphorientationhorizontal: 'glyphOrientationHorizontal',
- 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
- glyphorientationvertical: 'glyphOrientationVertical',
- 'glyph-orientation-vertical': 'glyphOrientationVertical',
- glyphref: 'glyphRef',
- gradienttransform: 'gradientTransform',
- gradientunits: 'gradientUnits',
- hanging: 'hanging',
- horizadvx: 'horizAdvX',
- 'horiz-adv-x': 'horizAdvX',
- horizoriginx: 'horizOriginX',
- 'horiz-origin-x': 'horizOriginX',
- ideographic: 'ideographic',
- imagerendering: 'imageRendering',
- 'image-rendering': 'imageRendering',
- in2: 'in2',
- 'in': 'in',
- inlist: 'inlist',
- intercept: 'intercept',
- k1: 'k1',
- k2: 'k2',
- k3: 'k3',
- k4: 'k4',
- k: 'k',
- kernelmatrix: 'kernelMatrix',
- kernelunitlength: 'kernelUnitLength',
- kerning: 'kerning',
- keypoints: 'keyPoints',
- keysplines: 'keySplines',
- keytimes: 'keyTimes',
- lengthadjust: 'lengthAdjust',
- letterspacing: 'letterSpacing',
- 'letter-spacing': 'letterSpacing',
- lightingcolor: 'lightingColor',
- 'lighting-color': 'lightingColor',
- limitingconeangle: 'limitingConeAngle',
- local: 'local',
- markerend: 'markerEnd',
- 'marker-end': 'markerEnd',
- markerheight: 'markerHeight',
- markermid: 'markerMid',
- 'marker-mid': 'markerMid',
- markerstart: 'markerStart',
- 'marker-start': 'markerStart',
- markerunits: 'markerUnits',
- markerwidth: 'markerWidth',
- mask: 'mask',
- maskcontentunits: 'maskContentUnits',
- maskunits: 'maskUnits',
- mathematical: 'mathematical',
- mode: 'mode',
- numoctaves: 'numOctaves',
- offset: 'offset',
- opacity: 'opacity',
- operator: 'operator',
- order: 'order',
- orient: 'orient',
- orientation: 'orientation',
- origin: 'origin',
- overflow: 'overflow',
- overlineposition: 'overlinePosition',
- 'overline-position': 'overlinePosition',
- overlinethickness: 'overlineThickness',
- 'overline-thickness': 'overlineThickness',
- paintorder: 'paintOrder',
- 'paint-order': 'paintOrder',
- panose1: 'panose1',
- 'panose-1': 'panose1',
- pathlength: 'pathLength',
- patterncontentunits: 'patternContentUnits',
- patterntransform: 'patternTransform',
- patternunits: 'patternUnits',
- pointerevents: 'pointerEvents',
- 'pointer-events': 'pointerEvents',
- points: 'points',
- pointsatx: 'pointsAtX',
- pointsaty: 'pointsAtY',
- pointsatz: 'pointsAtZ',
- prefix: 'prefix',
- preservealpha: 'preserveAlpha',
- preserveaspectratio: 'preserveAspectRatio',
- primitiveunits: 'primitiveUnits',
- property: 'property',
- r: 'r',
- radius: 'radius',
- refx: 'refX',
- refy: 'refY',
- renderingintent: 'renderingIntent',
- 'rendering-intent': 'renderingIntent',
- repeatcount: 'repeatCount',
- repeatdur: 'repeatDur',
- requiredextensions: 'requiredExtensions',
- requiredfeatures: 'requiredFeatures',
- resource: 'resource',
- restart: 'restart',
- result: 'result',
- results: 'results',
- rotate: 'rotate',
- rx: 'rx',
- ry: 'ry',
- scale: 'scale',
- security: 'security',
- seed: 'seed',
- shaperendering: 'shapeRendering',
- 'shape-rendering': 'shapeRendering',
- slope: 'slope',
- spacing: 'spacing',
- specularconstant: 'specularConstant',
- specularexponent: 'specularExponent',
- speed: 'speed',
- spreadmethod: 'spreadMethod',
- startoffset: 'startOffset',
- stddeviation: 'stdDeviation',
- stemh: 'stemh',
- stemv: 'stemv',
- stitchtiles: 'stitchTiles',
- stopcolor: 'stopColor',
- 'stop-color': 'stopColor',
- stopopacity: 'stopOpacity',
- 'stop-opacity': 'stopOpacity',
- strikethroughposition: 'strikethroughPosition',
- 'strikethrough-position': 'strikethroughPosition',
- strikethroughthickness: 'strikethroughThickness',
- 'strikethrough-thickness': 'strikethroughThickness',
- string: 'string',
- stroke: 'stroke',
- strokedasharray: 'strokeDasharray',
- 'stroke-dasharray': 'strokeDasharray',
- strokedashoffset: 'strokeDashoffset',
- 'stroke-dashoffset': 'strokeDashoffset',
- strokelinecap: 'strokeLinecap',
- 'stroke-linecap': 'strokeLinecap',
- strokelinejoin: 'strokeLinejoin',
- 'stroke-linejoin': 'strokeLinejoin',
- strokemiterlimit: 'strokeMiterlimit',
- 'stroke-miterlimit': 'strokeMiterlimit',
- strokewidth: 'strokeWidth',
- 'stroke-width': 'strokeWidth',
- strokeopacity: 'strokeOpacity',
- 'stroke-opacity': 'strokeOpacity',
- suppresscontenteditablewarning: 'suppressContentEditableWarning',
- suppresshydrationwarning: 'suppressHydrationWarning',
- surfacescale: 'surfaceScale',
- systemlanguage: 'systemLanguage',
- tablevalues: 'tableValues',
- targetx: 'targetX',
- targety: 'targetY',
- textanchor: 'textAnchor',
- 'text-anchor': 'textAnchor',
- textdecoration: 'textDecoration',
- 'text-decoration': 'textDecoration',
- textlength: 'textLength',
- textrendering: 'textRendering',
- 'text-rendering': 'textRendering',
- to: 'to',
- transform: 'transform',
- 'typeof': 'typeof',
- u1: 'u1',
- u2: 'u2',
- underlineposition: 'underlinePosition',
- 'underline-position': 'underlinePosition',
- underlinethickness: 'underlineThickness',
- 'underline-thickness': 'underlineThickness',
- unicode: 'unicode',
- unicodebidi: 'unicodeBidi',
- 'unicode-bidi': 'unicodeBidi',
- unicoderange: 'unicodeRange',
- 'unicode-range': 'unicodeRange',
- unitsperem: 'unitsPerEm',
- 'units-per-em': 'unitsPerEm',
- unselectable: 'unselectable',
- valphabetic: 'vAlphabetic',
- 'v-alphabetic': 'vAlphabetic',
- values: 'values',
- vectoreffect: 'vectorEffect',
- 'vector-effect': 'vectorEffect',
- version: 'version',
- vertadvy: 'vertAdvY',
- 'vert-adv-y': 'vertAdvY',
- vertoriginx: 'vertOriginX',
- 'vert-origin-x': 'vertOriginX',
- vertoriginy: 'vertOriginY',
- 'vert-origin-y': 'vertOriginY',
- vhanging: 'vHanging',
- 'v-hanging': 'vHanging',
- videographic: 'vIdeographic',
- 'v-ideographic': 'vIdeographic',
- viewbox: 'viewBox',
- viewtarget: 'viewTarget',
- visibility: 'visibility',
- vmathematical: 'vMathematical',
- 'v-mathematical': 'vMathematical',
- vocab: 'vocab',
- widths: 'widths',
- wordspacing: 'wordSpacing',
- 'word-spacing': 'wordSpacing',
- writingmode: 'writingMode',
- 'writing-mode': 'writingMode',
- x1: 'x1',
- x2: 'x2',
- x: 'x',
- xchannelselector: 'xChannelSelector',
- xheight: 'xHeight',
- 'x-height': 'xHeight',
- xlinkactuate: 'xlinkActuate',
- 'xlink:actuate': 'xlinkActuate',
- xlinkarcrole: 'xlinkArcrole',
- 'xlink:arcrole': 'xlinkArcrole',
- xlinkhref: 'xlinkHref',
- 'xlink:href': 'xlinkHref',
- xlinkrole: 'xlinkRole',
- 'xlink:role': 'xlinkRole',
- xlinkshow: 'xlinkShow',
- 'xlink:show': 'xlinkShow',
- xlinktitle: 'xlinkTitle',
- 'xlink:title': 'xlinkTitle',
- xlinktype: 'xlinkType',
- 'xlink:type': 'xlinkType',
- xmlbase: 'xmlBase',
- 'xml:base': 'xmlBase',
- xmllang: 'xmlLang',
- 'xml:lang': 'xmlLang',
- xmlns: 'xmlns',
- 'xml:space': 'xmlSpace',
- xmlnsxlink: 'xmlnsXlink',
- 'xmlns:xlink': 'xmlnsXlink',
- xmlspace: 'xmlSpace',
- y1: 'y1',
- y2: 'y2',
- y: 'y',
- ychannelselector: 'yChannelSelector',
- z: 'z',
- zoomandpan: 'zoomAndPan'
-};
-
-function getStackAddendum$2() {
- var stack = ReactDebugCurrentFrame.getStackAddendum();
- return stack != null ? stack : '';
+function findHostInstanceWithNoPortals(fiber) {
+ var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
+ if (hostFiber === null) {
+ return null;
+ }
+ return hostFiber.stateNode;
}
-{
- var warnedProperties$1 = {};
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
- var EVENT_NAME_REGEX = /^on./;
- var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
- var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
- var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
-
- var validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
- if (hasOwnProperty$1.call(warnedProperties$1, name) && warnedProperties$1[name]) {
- return true;
- }
-
- var lowerCasedName = name.toLowerCase();
- if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
- warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
- warnedProperties$1[name] = true;
- return true;
- }
-
- // We can't rely on the event system being injected on the server.
- if (canUseEventSystem) {
- if (registrationNameModules.hasOwnProperty(name)) {
- return true;
- }
- var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
- if (registrationName != null) {
- warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
- }
- if (EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
- }
- } else if (EVENT_NAME_REGEX.test(name)) {
- // If no event plugins have been injected, we are in a server environment.
- // So we can't tell if the event name is correct for sure, but we can filter
- // out known bad ones like `onclick`. We can't suggest a specific replacement though.
- if (INVALID_EVENT_NAME_REGEX.test(name)) {
- warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$2());
- }
- warnedProperties$1[name] = true;
- return true;
- }
+function injectIntoDevTools(devToolsConfig) {
+ var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
- // Let the ARIA attribute hook validate ARIA attributes
- if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
- return true;
- }
-
- if (lowerCasedName === 'innerhtml') {
- warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
- warnedProperties$1[name] = true;
- return true;
- }
-
- if (lowerCasedName === 'aria') {
- warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
- warnedProperties$1[name] = true;
- return true;
- }
-
- if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
- warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
- }
-
- if (typeof value === 'number' && isNaN(value)) {
- warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
- }
-
- var isReserved = isReservedProp(name);
-
- // Known attributes should match the casing specified in the property config.
- if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
- var standardName = possibleStandardNames[lowerCasedName];
- if (standardName !== name) {
- warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
+ return injectInternals(_assign({}, devToolsConfig, {
+ findHostInstanceByFiber: function (fiber) {
+ var hostFiber = findCurrentHostFiber(fiber);
+ if (hostFiber === null) {
+ return null;
}
- } else if (!isReserved && name !== lowerCasedName) {
- // Unknown attributes should have lowercase casing since that's how they
- // will be cased anyway with server rendering.
- warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$2());
- warnedProperties$1[name] = true;
- return true;
- }
-
- if (typeof value === 'boolean' && !shouldAttributeAcceptBooleanValue(name)) {
- if (value) {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$2());
- } else {
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$2());
+ return hostFiber.stateNode;
+ },
+ findFiberByHostInstance: function (instance) {
+ if (!findFiberByHostInstance) {
+ // Might not be implemented by the renderer.
+ return null;
}
- warnedProperties$1[name] = true;
- return true;
- }
-
- // Now that we've validated casing, do not validate
- // data types for reserved props
- if (isReserved) {
- return true;
- }
-
- // Warn when a known attribute is a bad type
- if (!shouldSetAttribute(name, value)) {
- warnedProperties$1[name] = true;
- return false;
+ return findFiberByHostInstance(instance);
}
-
- return true;
- };
+ }));
}
-var warnUnknownProperties = function (type, props, canUseEventSystem) {
- var unknownProps = [];
- for (var key in props) {
- var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
- if (!isValid) {
- unknownProps.push(key);
- }
- }
+// This file intentionally does *not* have the Flow annotation.
+// Don't add it. See `./inline-typed.js` for an explanation.
- var unknownPropString = unknownProps.map(function (prop) {
- return '`' + prop + '`';
- }).join(', ');
- if (unknownProps.length === 1) {
- warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$2());
- } else if (unknownProps.length > 1) {
- warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$2());
- }
-};
+function createPortal$1(children, containerInfo,
+// TODO: figure out the API for cross-renderer implementation.
+implementation) {
+ var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
-function validateProperties$2(type, props, canUseEventSystem) {
- if (isCustomComponent(type, props)) {
- return;
- }
- warnUnknownProperties(type, props, canUseEventSystem);
+ return {
+ // This tag allow us to uniquely identify this as a React Portal
+ $$typeof: REACT_PORTAL_TYPE,
+ key: key == null ? null : '' + key,
+ children: children,
+ containerInfo: containerInfo,
+ implementation: implementation
+ };
}
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var getCurrentFiberOwnerName$1 = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
-var getCurrentFiberStackAddendum$2 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
-
-var didWarnInvalidHydration = false;
-var didWarnShadyDOM = false;
-
-var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
-var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
-var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
-var AUTOFOCUS = 'autoFocus';
-var CHILDREN = 'children';
-var STYLE = 'style';
-var HTML = '__html';
+// TODO: this is special because it gets imported during build.
-var HTML_NAMESPACE = Namespaces.html;
+var ReactVersion = '16.5.2';
+// TODO: This type is shared between the reconciler and ReactDOM, but will
+// eventually be lifted out to the renderer.
+var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
-var getStack = emptyFunction.thatReturns('');
+var topLevelUpdateWarnings = void 0;
+var warnOnInvalidCallback = void 0;
+var didWarnAboutUnstableCreatePortal = false;
{
- getStack = getCurrentFiberStackAddendum$2;
-
- var warnedUnknownTags = {
- // Chrome is the only major browser not shipping <time>. But as of July
- // 2017 it intends to ship it due to widespread usage. We intentionally
- // *don't* warn for <time> even if it's unrecognized by Chrome because
- // it soon will be, and many apps have been using it anyway.
- time: true,
- // There are working polyfills for <dialog>. Let people use it.
- dialog: true
- };
-
- var validatePropertiesInDevelopment = function (type, props) {
- validateProperties(type, props);
- validateProperties$1(type, props);
- validateProperties$2(type, props, /* canUseEventSystem */true);
- };
-
- // HTML parsing normalizes CR and CRLF to LF.
- // It also can turn \u0000 into \uFFFD inside attributes.
- // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
- // If we have a mismatch, it might be caused by that.
- // We will still patch up in this case but not fire the warning.
- var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
- var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
-
- var normalizeMarkupForTextOrAttribute = function (markup) {
- var markupString = typeof markup === 'string' ? markup : '' + markup;
- return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
- };
+ if (typeof Map !== 'function' ||
+ // $FlowIssue Flow incorrectly thinks Map has no prototype
+ Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' ||
+ // $FlowIssue Flow incorrectly thinks Set has no prototype
+ Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
+ warningWithoutStack$1(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
+ }
- var warnForTextDifference = function (serverText, clientText) {
- if (didWarnInvalidHydration) {
- return;
- }
- var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
- var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
- if (normalizedServerText === normalizedClientText) {
- return;
+ topLevelUpdateWarnings = function (container) {
+ if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
+ var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
+ if (hostInstance) {
+ !(hostInstance.parentNode === container) ? warningWithoutStack$1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
+ }
}
- didWarnInvalidHydration = true;
- warning(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
- };
- var warnForPropDifference = function (propName, serverValue, clientValue) {
- if (didWarnInvalidHydration) {
- return;
- }
- var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
- var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
- if (normalizedServerValue === normalizedClientValue) {
- return;
- }
- didWarnInvalidHydration = true;
- warning(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
- };
+ var isRootRenderedBySomeReact = !!container._reactRootContainer;
+ var rootEl = getReactRootElementInContainer(container);
+ var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
- var warnForExtraAttributes = function (attributeNames) {
- if (didWarnInvalidHydration) {
- return;
- }
- didWarnInvalidHydration = true;
- var names = [];
- attributeNames.forEach(function (name) {
- names.push(name);
- });
- warning(false, 'Extra attributes from the server: %s', names);
- };
+ !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
- var warnForInvalidEventListener = function (registrationName, listener) {
- if (listener === false) {
- warning(false, 'Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', registrationName, registrationName, registrationName, getCurrentFiberStackAddendum$2());
- } else {
- warning(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.%s', registrationName, typeof listener, getCurrentFiberStackAddendum$2());
- }
+ !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
};
- // Parse the HTML and read it back to normalize the HTML string so that it
- // can be used for comparison.
- var normalizeHTML = function (parent, html) {
- // We could have created a separate document here to avoid
- // re-initializing custom elements if they exist. But this breaks
- // how <noscript> is being handled. So we use the same document.
- // See the discussion in https://github.com/facebook/react/pull/11157.
- var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
- testElement.innerHTML = html;
- return testElement.innerHTML;
+ warnOnInvalidCallback = function (callback, callerName) {
+ !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
};
}
-function ensureListeningTo(rootContainerElement, registrationName) {
- var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
- var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
- listenTo(registrationName, doc);
-}
-
-function getOwnerDocumentFromRootContainer(rootContainerElement) {
- return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
-}
-
-// There are so many media events, it makes sense to just
-// maintain a list rather than create a `trapBubbledEvent` for each
-var mediaEvents = {
- topAbort: 'abort',
- topCanPlay: 'canplay',
- topCanPlayThrough: 'canplaythrough',
- topDurationChange: 'durationchange',
- topEmptied: 'emptied',
- topEncrypted: 'encrypted',
- topEnded: 'ended',
- topError: 'error',
- topLoadedData: 'loadeddata',
- topLoadedMetadata: 'loadedmetadata',
- topLoadStart: 'loadstart',
- topPause: 'pause',
- topPlay: 'play',
- topPlaying: 'playing',
- topProgress: 'progress',
- topRateChange: 'ratechange',
- topSeeked: 'seeked',
- topSeeking: 'seeking',
- topStalled: 'stalled',
- topSuspend: 'suspend',
- topTimeUpdate: 'timeupdate',
- topVolumeChange: 'volumechange',
- topWaiting: 'waiting'
+setRestoreImplementation(restoreControlledState$1);
+
+/* eslint-disable no-use-before-define */
+
+/* eslint-enable no-use-before-define */
+
+function ReactBatch(root) {
+ var expirationTime = computeUniqueAsyncExpiration();
+ this._expirationTime = expirationTime;
+ this._root = root;
+ this._next = null;
+ this._callbacks = null;
+ this._didComplete = false;
+ this._hasChildren = false;
+ this._children = null;
+ this._defer = true;
+}
+ReactBatch.prototype.render = function (children) {
+ !this._defer ? invariant(false, 'batch.render: Cannot render a batch that already committed.') : void 0;
+ this._hasChildren = true;
+ this._children = children;
+ var internalRoot = this._root._internalRoot;
+ var expirationTime = this._expirationTime;
+ var work = new ReactWork();
+ updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, work._onCommit);
+ return work;
};
-
-function trapClickOnNonInteractiveElement(node) {
- // Mobile Safari does not fire properly bubble click events on
- // non-interactive elements, which means delegated click listeners do not
- // fire. The workaround for this bug involves attaching an empty click
- // listener on the target node.
- // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
- // Just set it using the onclick property so that we don't have to manage any
- // bookkeeping for it. Not sure if we need to clear it when the listener is
- // removed.
- // TODO: Only do this for the relevant Safaris maybe?
- node.onclick = emptyFunction;
-}
-
-function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
- for (var propKey in nextProps) {
- if (!nextProps.hasOwnProperty(propKey)) {
- continue;
- }
- var nextProp = nextProps[propKey];
- if (propKey === STYLE) {
- {
- if (nextProp) {
- // Freeze the next style object so that we can assume it won't be
- // mutated. We have already warned for this in the past.
- Object.freeze(nextProp);
- }
- }
- // Relies on `updateStylesByID` not mutating `styleUpdates`.
- setValueForStyles(domElement, nextProp, getStack);
- } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
- var nextHtml = nextProp ? nextProp[HTML] : undefined;
- if (nextHtml != null) {
- setInnerHTML(domElement, nextHtml);
- }
- } else if (propKey === CHILDREN) {
- if (typeof nextProp === 'string') {
- // Avoid setting initial textContent when the text is empty. In IE11 setting
- // textContent on a <textarea> will cause the placeholder to not
- // show within the <textarea> until it has been focused and blurred again.
- // https://github.com/facebook/react/issues/6731#issuecomment-254874553
- var canSetTextContent = tag !== 'textarea' || nextProp !== '';
- if (canSetTextContent) {
- setTextContent(domElement, nextProp);
- }
- } else if (typeof nextProp === 'number') {
- setTextContent(domElement, '' + nextProp);
- }
- } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
- // Noop
- } else if (propKey === AUTOFOCUS) {
- // We polyfill it separately on the client during commit.
- // We blacklist it here rather than in the property list because we emit it in SSR.
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
- if (nextProp != null) {
- if (true && typeof nextProp !== 'function') {
- warnForInvalidEventListener(propKey, nextProp);
- }
- ensureListeningTo(rootContainerElement, propKey);
- }
- } else if (isCustomComponentTag) {
- setValueForAttribute(domElement, propKey, nextProp);
- } else if (nextProp != null) {
- // If we're updating to null or undefined, we should remove the property
- // from the DOM node instead of inadvertently setting to a string. This
- // brings us in line with the same behavior we have on initial render.
- setValueForProperty(domElement, propKey, nextProp);
- }
+ReactBatch.prototype.then = function (onComplete) {
+ if (this._didComplete) {
+ onComplete();
+ return;
}
-}
-
-function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
- // TODO: Handle wasCustomComponentTag
- for (var i = 0; i < updatePayload.length; i += 2) {
- var propKey = updatePayload[i];
- var propValue = updatePayload[i + 1];
- if (propKey === STYLE) {
- setValueForStyles(domElement, propValue, getStack);
- } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
- setInnerHTML(domElement, propValue);
- } else if (propKey === CHILDREN) {
- setTextContent(domElement, propValue);
- } else if (isCustomComponentTag) {
- if (propValue != null) {
- setValueForAttribute(domElement, propKey, propValue);
- } else {
- deleteValueForAttribute(domElement, propKey);
- }
- } else if (propValue != null) {
- setValueForProperty(domElement, propKey, propValue);
- } else {
- // If we're updating to null or undefined, we should remove the property
- // from the DOM node instead of inadvertently setting to a string. This
- // brings us in line with the same behavior we have on initial render.
- deleteValueForProperty(domElement, propKey);
- }
+ var callbacks = this._callbacks;
+ if (callbacks === null) {
+ callbacks = this._callbacks = [];
}
-}
-
-function createElement$1(type, props, rootContainerElement, parentNamespace) {
- // We create tags in the namespace of their parent container, except HTML
- var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
- var domElement;
- var namespaceURI = parentNamespace;
- if (namespaceURI === HTML_NAMESPACE) {
- namespaceURI = getIntrinsicNamespace(type);
+ callbacks.push(onComplete);
+};
+ReactBatch.prototype.commit = function () {
+ var internalRoot = this._root._internalRoot;
+ var firstBatch = internalRoot.firstBatch;
+ !(this._defer && firstBatch !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
+
+ if (!this._hasChildren) {
+ // This batch is empty. Return.
+ this._next = null;
+ this._defer = false;
+ return;
}
- if (namespaceURI === HTML_NAMESPACE) {
- {
- var isCustomComponentTag = isCustomComponent(type, props);
- // Should this check be gated by parent namespace? Not sure we want to
- // allow <SVG> or <mATH>.
- warning(isCustomComponentTag || type === type.toLowerCase(), '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', type);
- }
- if (type === 'script') {
- // Create the script via .innerHTML so its "parser-inserted" flag is
- // set to true and it does not execute
- var div = ownerDocument.createElement('div');
- div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
- // This is guaranteed to yield a script element.
- var firstChild = div.firstChild;
- domElement = div.removeChild(firstChild);
- } else if (typeof props.is === 'string') {
- // $FlowIssue `createElement` should be updated for Web Components
- domElement = ownerDocument.createElement(type, { is: props.is });
- } else {
- // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
- // See discussion in https://github.com/facebook/react/pull/6896
- // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
- domElement = ownerDocument.createElement(type);
- }
- } else {
- domElement = ownerDocument.createElementNS(namespaceURI, type);
- }
+ var expirationTime = this._expirationTime;
- {
- if (namespaceURI === HTML_NAMESPACE) {
- if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
- warnedUnknownTags[type] = true;
- warning(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
- }
+ // Ensure this is the first batch in the list.
+ if (firstBatch !== this) {
+ // This batch is not the earliest batch. We need to move it to the front.
+ // Update its expiration time to be the expiration time of the earliest
+ // batch, so that we can flush it without flushing the other batches.
+ if (this._hasChildren) {
+ expirationTime = this._expirationTime = firstBatch._expirationTime;
+ // Rendering this batch again ensures its children will be the final state
+ // when we flush (updates are processed in insertion order: last
+ // update wins).
+ // TODO: This forces a restart. Should we print a warning?
+ this.render(this._children);
}
- }
-
- return domElement;
-}
-function createTextNode$1(text, rootContainerElement) {
- return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
-}
-
-function setInitialProperties$1(domElement, tag, rawProps, rootContainerElement) {
- var isCustomComponentTag = isCustomComponent(tag, rawProps);
- {
- validatePropertiesInDevelopment(tag, rawProps);
- if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
- warning(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerName$1() || 'A component');
- didWarnShadyDOM = true;
+ // Remove the batch from the list.
+ var previous = null;
+ var batch = firstBatch;
+ while (batch !== this) {
+ previous = batch;
+ batch = batch._next;
}
- }
+ !(previous !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
+ previous._next = batch._next;
- // TODO: Make sure that we check isMounted before firing any of these events.
- var props;
- switch (tag) {
- case 'iframe':
- case 'object':
- trapBubbledEvent('topLoad', 'load', domElement);
- props = rawProps;
- break;
- case 'video':
- case 'audio':
- // Create listener for each media event
- for (var event in mediaEvents) {
- if (mediaEvents.hasOwnProperty(event)) {
- trapBubbledEvent(event, mediaEvents[event], domElement);
- }
- }
- props = rawProps;
- break;
- case 'source':
- trapBubbledEvent('topError', 'error', domElement);
- props = rawProps;
- break;
- case 'img':
- case 'image':
- trapBubbledEvent('topError', 'error', domElement);
- trapBubbledEvent('topLoad', 'load', domElement);
- props = rawProps;
- break;
- case 'form':
- trapBubbledEvent('topReset', 'reset', domElement);
- trapBubbledEvent('topSubmit', 'submit', domElement);
- props = rawProps;
- break;
- case 'details':
- trapBubbledEvent('topToggle', 'toggle', domElement);
- props = rawProps;
- break;
- case 'input':
- initWrapperState(domElement, rawProps);
- props = getHostProps(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
- case 'option':
- validateProps(domElement, rawProps);
- props = getHostProps$1(domElement, rawProps);
- break;
- case 'select':
- initWrapperState$1(domElement, rawProps);
- props = getHostProps$2(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
- case 'textarea':
- initWrapperState$2(domElement, rawProps);
- props = getHostProps$3(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
- default:
- props = rawProps;
- }
-
- assertValidProps(tag, props, getStack);
-
- setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
-
- switch (tag) {
- case 'input':
- // TODO: Make sure we check if this is still unmounted or do any clean
- // up necessary since we never stop tracking anymore.
- track(domElement);
- postMountWrapper(domElement, rawProps);
- break;
- case 'textarea':
- // TODO: Make sure we check if this is still unmounted or do any clean
- // up necessary since we never stop tracking anymore.
- track(domElement);
- postMountWrapper$3(domElement, rawProps);
- break;
- case 'option':
- postMountWrapper$1(domElement, rawProps);
- break;
- case 'select':
- postMountWrapper$2(domElement, rawProps);
- break;
- default:
- if (typeof props.onClick === 'function') {
- // TODO: This cast may not be sound for SVG, MathML or custom elements.
- trapClickOnNonInteractiveElement(domElement);
- }
- break;
- }
-}
-
-// Calculate the diff between the two objects.
-function diffProperties$1(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
- {
- validatePropertiesInDevelopment(tag, nextRawProps);
+ // Add it to the front.
+ this._next = firstBatch;
+ firstBatch = internalRoot.firstBatch = this;
}
- var updatePayload = null;
+ // Synchronously flush all the work up to this batch's expiration time.
+ this._defer = false;
+ flushRoot(internalRoot, expirationTime);
- var lastProps;
- var nextProps;
- switch (tag) {
- case 'input':
- lastProps = getHostProps(domElement, lastRawProps);
- nextProps = getHostProps(domElement, nextRawProps);
- updatePayload = [];
- break;
- case 'option':
- lastProps = getHostProps$1(domElement, lastRawProps);
- nextProps = getHostProps$1(domElement, nextRawProps);
- updatePayload = [];
- break;
- case 'select':
- lastProps = getHostProps$2(domElement, lastRawProps);
- nextProps = getHostProps$2(domElement, nextRawProps);
- updatePayload = [];
- break;
- case 'textarea':
- lastProps = getHostProps$3(domElement, lastRawProps);
- nextProps = getHostProps$3(domElement, nextRawProps);
- updatePayload = [];
- break;
- default:
- lastProps = lastRawProps;
- nextProps = nextRawProps;
- if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
- // TODO: This cast may not be sound for SVG, MathML or custom elements.
- trapClickOnNonInteractiveElement(domElement);
- }
- break;
- }
-
- assertValidProps(tag, nextProps, getStack);
+ // Pop the batch from the list.
+ var next = this._next;
+ this._next = null;
+ firstBatch = internalRoot.firstBatch = next;
- var propKey;
- var styleName;
- var styleUpdates = null;
- for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
- continue;
- }
- if (propKey === STYLE) {
- var lastStyle = lastProps[propKey];
- for (styleName in lastStyle) {
- if (lastStyle.hasOwnProperty(styleName)) {
- if (!styleUpdates) {
- styleUpdates = {};
- }
- styleUpdates[styleName] = '';
- }
- }
- } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
- // Noop. This is handled by the clear text mechanism.
- } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
- // Noop
- } else if (propKey === AUTOFOCUS) {
- // Noop. It doesn't work on updates anyway.
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
- // This is a special case. If any listener updates we need to ensure
- // that the "current" fiber pointer gets updated so we need a commit
- // to update this element.
- if (!updatePayload) {
- updatePayload = [];
- }
- } else {
- // For all other deleted properties we add it to the queue. We use
- // the whitelist in the commit phase instead.
- (updatePayload = updatePayload || []).push(propKey, null);
- }
+ // Append the next earliest batch's children to the update queue.
+ if (firstBatch !== null && firstBatch._hasChildren) {
+ firstBatch.render(firstBatch._children);
}
- for (propKey in nextProps) {
- var nextProp = nextProps[propKey];
- var lastProp = lastProps != null ? lastProps[propKey] : undefined;
- if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
- continue;
- }
- if (propKey === STYLE) {
- {
- if (nextProp) {
- // Freeze the next style object so that we can assume it won't be
- // mutated. We have already warned for this in the past.
- Object.freeze(nextProp);
- }
- }
- if (lastProp) {
- // Unset styles on `lastProp` but not on `nextProp`.
- for (styleName in lastProp) {
- if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
- if (!styleUpdates) {
- styleUpdates = {};
- }
- styleUpdates[styleName] = '';
- }
- }
- // Update styles that changed since `lastProp`.
- for (styleName in nextProp) {
- if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
- if (!styleUpdates) {
- styleUpdates = {};
- }
- styleUpdates[styleName] = nextProp[styleName];
- }
- }
- } else {
- // Relies on `updateStylesByID` not mutating `styleUpdates`.
- if (!styleUpdates) {
- if (!updatePayload) {
- updatePayload = [];
- }
- updatePayload.push(propKey, styleUpdates);
- }
- styleUpdates = nextProp;
- }
- } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
- var nextHtml = nextProp ? nextProp[HTML] : undefined;
- var lastHtml = lastProp ? lastProp[HTML] : undefined;
- if (nextHtml != null) {
- if (lastHtml !== nextHtml) {
- (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
- }
- } else {
- // TODO: It might be too late to clear this if we have children
- // inserted already.
- }
- } else if (propKey === CHILDREN) {
- if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
- (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
- }
- } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
- // Noop
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
- if (nextProp != null) {
- // We eagerly listen to this even though we haven't committed yet.
- if (true && typeof nextProp !== 'function') {
- warnForInvalidEventListener(propKey, nextProp);
- }
- ensureListeningTo(rootContainerElement, propKey);
- }
- if (!updatePayload && lastProp !== nextProp) {
- // This is a special case. If any listener updates we need to ensure
- // that the "current" props pointer gets updated so we need a commit
- // to update this element.
- updatePayload = [];
- }
- } else {
- // For any other property we always add it to the queue and then we
- // filter it out using the whitelist during the commit.
- (updatePayload = updatePayload || []).push(propKey, nextProp);
- }
+};
+ReactBatch.prototype._onComplete = function () {
+ if (this._didComplete) {
+ return;
}
- if (styleUpdates) {
- (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
+ this._didComplete = true;
+ var callbacks = this._callbacks;
+ if (callbacks === null) {
+ return;
}
- return updatePayload;
-}
-
-// Apply the diff.
-function updateProperties$1(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
- // Update checked *before* name.
- // In the middle of an update, it is possible to have multiple checked.
- // When a checked radio tries to change name, browser makes another radio's checked false.
- if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
- updateChecked(domElement, nextRawProps);
+ // TODO: Error handling.
+ for (var i = 0; i < callbacks.length; i++) {
+ var _callback = callbacks[i];
+ _callback();
}
+};
- var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
- var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
- // Apply the diff.
- updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
-
- // TODO: Ensure that an update gets scheduled if any of the special props
- // changed.
- switch (tag) {
- case 'input':
- // Update the wrapper around inputs *after* updating props. This has to
- // happen after `updateDOMProperties`. Otherwise HTML5 input validations
- // raise warnings and prevent the new value from being assigned.
- updateWrapper(domElement, nextRawProps);
- break;
- case 'textarea':
- updateWrapper$1(domElement, nextRawProps);
- break;
- case 'select':
- // <select> value update needs to occur after <option> children
- // reconciliation
- postUpdateWrapper(domElement, nextRawProps);
- break;
- }
+function ReactWork() {
+ this._callbacks = null;
+ this._didCommit = false;
+ // TODO: Avoid need to bind by replacing callbacks in the update queue with
+ // list of Work objects.
+ this._onCommit = this._onCommit.bind(this);
}
-
-function diffHydratedProperties$1(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
- {
- var suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
- var isCustomComponentTag = isCustomComponent(tag, rawProps);
- validatePropertiesInDevelopment(tag, rawProps);
- if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
- warning(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerName$1() || 'A component');
- didWarnShadyDOM = true;
- }
- }
-
- // TODO: Make sure that we check isMounted before firing any of these events.
- switch (tag) {
- case 'iframe':
- case 'object':
- trapBubbledEvent('topLoad', 'load', domElement);
- break;
- case 'video':
- case 'audio':
- // Create listener for each media event
- for (var event in mediaEvents) {
- if (mediaEvents.hasOwnProperty(event)) {
- trapBubbledEvent(event, mediaEvents[event], domElement);
- }
- }
- break;
- case 'source':
- trapBubbledEvent('topError', 'error', domElement);
- break;
- case 'img':
- case 'image':
- trapBubbledEvent('topError', 'error', domElement);
- trapBubbledEvent('topLoad', 'load', domElement);
- break;
- case 'form':
- trapBubbledEvent('topReset', 'reset', domElement);
- trapBubbledEvent('topSubmit', 'submit', domElement);
- break;
- case 'details':
- trapBubbledEvent('topToggle', 'toggle', domElement);
- break;
- case 'input':
- initWrapperState(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
- case 'option':
- validateProps(domElement, rawProps);
- break;
- case 'select':
- initWrapperState$1(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
- case 'textarea':
- initWrapperState$2(domElement, rawProps);
- trapBubbledEvent('topInvalid', 'invalid', domElement);
- // For controlled components we always need to ensure we're listening
- // to onChange. Even if there is no listener.
- ensureListeningTo(rootContainerElement, 'onChange');
- break;
+ReactWork.prototype.then = function (onCommit) {
+ if (this._didCommit) {
+ onCommit();
+ return;
}
-
- assertValidProps(tag, rawProps, getStack);
-
- {
- var extraAttributeNames = new Set();
- var attributes = domElement.attributes;
- for (var i = 0; i < attributes.length; i++) {
- var name = attributes[i].name.toLowerCase();
- switch (name) {
- // Built-in SSR attribute is whitelisted
- case 'data-reactroot':
- break;
- // Controlled attributes are not validated
- // TODO: Only ignore them on controlled tags.
- case 'value':
- break;
- case 'checked':
- break;
- case 'selected':
- break;
- default:
- // Intentionally use the original name.
- // See discussion in https://github.com/facebook/react/pull/10676.
- extraAttributeNames.add(attributes[i].name);
- }
- }
+ var callbacks = this._callbacks;
+ if (callbacks === null) {
+ callbacks = this._callbacks = [];
}
-
- var updatePayload = null;
- for (var propKey in rawProps) {
- if (!rawProps.hasOwnProperty(propKey)) {
- continue;
- }
- var nextProp = rawProps[propKey];
- if (propKey === CHILDREN) {
- // For text content children we compare against textContent. This
- // might match additional HTML that is hidden when we read it using
- // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
- // satisfies our requirement. Our requirement is not to produce perfect
- // HTML and attributes. Ideally we should preserve structure but it's
- // ok not to if the visible content is still enough to indicate what
- // even listeners these nodes might be wired up to.
- // TODO: Warn if there is more than a single textNode as a child.
- // TODO: Should we use domElement.firstChild.nodeValue to compare?
- if (typeof nextProp === 'string') {
- if (domElement.textContent !== nextProp) {
- if (true && !suppressHydrationWarning) {
- warnForTextDifference(domElement.textContent, nextProp);
- }
- updatePayload = [CHILDREN, nextProp];
- }
- } else if (typeof nextProp === 'number') {
- if (domElement.textContent !== '' + nextProp) {
- if (true && !suppressHydrationWarning) {
- warnForTextDifference(domElement.textContent, nextProp);
- }
- updatePayload = [CHILDREN, '' + nextProp];
- }
- }
- } else if (registrationNameModules.hasOwnProperty(propKey)) {
- if (nextProp != null) {
- if (true && typeof nextProp !== 'function') {
- warnForInvalidEventListener(propKey, nextProp);
- }
- ensureListeningTo(rootContainerElement, propKey);
- }
- } else {
- // Validate that the properties correspond to their expected values.
- var serverValue;
- var propertyInfo;
- if (suppressHydrationWarning) {
- // Don't bother comparing. We're ignoring all these warnings.
- } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
- // Controlled attributes are not validated
- // TODO: Only ignore them on controlled tags.
- propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
- // Noop
- } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
- var rawHtml = nextProp ? nextProp[HTML] || '' : '';
- var serverHTML = domElement.innerHTML;
- var expectedHTML = normalizeHTML(domElement, rawHtml);
- if (expectedHTML !== serverHTML) {
- warnForPropDifference(propKey, serverHTML, expectedHTML);
- }
- } else if (propKey === STYLE) {
- // $FlowFixMe - Should be inferred as not undefined.
- extraAttributeNames['delete'](propKey);
- var expectedStyle = createDangerousStringForStyles(nextProp);
- serverValue = domElement.getAttribute('style');
- if (expectedStyle !== serverValue) {
- warnForPropDifference(propKey, serverValue, expectedStyle);
- }
- } else if (isCustomComponentTag) {
- // $FlowFixMe - Should be inferred as not undefined.
- extraAttributeNames['delete'](propKey.toLowerCase());
- serverValue = getValueForAttribute(domElement, propKey, nextProp);
-
- if (nextProp !== serverValue) {
- warnForPropDifference(propKey, serverValue, nextProp);
- }
- } else if (shouldSetAttribute(propKey, nextProp)) {
- if (propertyInfo = getPropertyInfo(propKey)) {
- // $FlowFixMe - Should be inferred as not undefined.
- extraAttributeNames['delete'](propertyInfo.attributeName);
- serverValue = getValueForProperty(domElement, propKey, nextProp);
- } else {
- var ownNamespace = parentNamespace;
- if (ownNamespace === HTML_NAMESPACE) {
- ownNamespace = getIntrinsicNamespace(tag);
- }
- if (ownNamespace === HTML_NAMESPACE) {
- // $FlowFixMe - Should be inferred as not undefined.
- extraAttributeNames['delete'](propKey.toLowerCase());
- } else {
- // $FlowFixMe - Should be inferred as not undefined.
- extraAttributeNames['delete'](propKey);
- }
- serverValue = getValueForAttribute(domElement, propKey, nextProp);
- }
-
- if (nextProp !== serverValue) {
- warnForPropDifference(propKey, serverValue, nextProp);
- }
- }
- }
+ callbacks.push(onCommit);
+};
+ReactWork.prototype._onCommit = function () {
+ if (this._didCommit) {
+ return;
}
-
- {
- // $FlowFixMe - Should be inferred as not undefined.
- if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
- // $FlowFixMe - Should be inferred as not undefined.
- warnForExtraAttributes(extraAttributeNames);
- }
+ this._didCommit = true;
+ var callbacks = this._callbacks;
+ if (callbacks === null) {
+ return;
}
-
- switch (tag) {
- case 'input':
- // TODO: Make sure we check if this is still unmounted or do any clean
- // up necessary since we never stop tracking anymore.
- track(domElement);
- postMountWrapper(domElement, rawProps);
- break;
- case 'textarea':
- // TODO: Make sure we check if this is still unmounted or do any clean
- // up necessary since we never stop tracking anymore.
- track(domElement);
- postMountWrapper$3(domElement, rawProps);
- break;
- case 'select':
- case 'option':
- // For input and textarea we current always set the value property at
- // post mount to force it to diverge from attributes. However, for
- // option and select we don't quite do the same thing and select
- // is not resilient to the DOM state changing so we don't do that here.
- // TODO: Consider not doing this for input and textarea.
- break;
- default:
- if (typeof rawProps.onClick === 'function') {
- // TODO: This cast may not be sound for SVG, MathML or custom elements.
- trapClickOnNonInteractiveElement(domElement);
- }
- break;
+ // TODO: Error handling.
+ for (var i = 0; i < callbacks.length; i++) {
+ var _callback2 = callbacks[i];
+ !(typeof _callback2 === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback2) : void 0;
+ _callback2();
}
+};
- return updatePayload;
-}
-
-function diffHydratedText$1(textNode, text) {
- var isDifferent = textNode.nodeValue !== text;
- return isDifferent;
+function ReactRoot(container, isAsync, hydrate) {
+ var root = createContainer(container, isAsync, hydrate);
+ this._internalRoot = root;
}
-
-function warnForUnmatchedText$1(textNode, text) {
+ReactRoot.prototype.render = function (children, callback) {
+ var root = this._internalRoot;
+ var work = new ReactWork();
+ callback = callback === undefined ? null : callback;
{
- warnForTextDifference(textNode.nodeValue, text);
+ warnOnInvalidCallback(callback, 'render');
}
-}
-
-function warnForDeletedHydratableElement$1(parentNode, child) {
- {
- if (didWarnInvalidHydration) {
- return;
- }
- didWarnInvalidHydration = true;
- warning(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
+ if (callback !== null) {
+ work.then(callback);
}
-}
-
-function warnForDeletedHydratableText$1(parentNode, child) {
+ updateContainer(children, root, null, work._onCommit);
+ return work;
+};
+ReactRoot.prototype.unmount = function (callback) {
+ var root = this._internalRoot;
+ var work = new ReactWork();
+ callback = callback === undefined ? null : callback;
{
- if (didWarnInvalidHydration) {
- return;
- }
- didWarnInvalidHydration = true;
- warning(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
+ warnOnInvalidCallback(callback, 'render');
}
-}
-
-function warnForInsertedHydratedElement$1(parentNode, tag, props) {
- {
- if (didWarnInvalidHydration) {
- return;
- }
- didWarnInvalidHydration = true;
- warning(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
+ if (callback !== null) {
+ work.then(callback);
}
-}
-
-function warnForInsertedHydratedText$1(parentNode, text) {
+ updateContainer(null, root, null, work._onCommit);
+ return work;
+};
+ReactRoot.prototype.legacy_renderSubtreeIntoContainer = function (parentComponent, children, callback) {
+ var root = this._internalRoot;
+ var work = new ReactWork();
+ callback = callback === undefined ? null : callback;
{
- if (text === '') {
- // We expect to insert empty text nodes since they're not represented in
- // the HTML.
- // TODO: Remove this special case if we can just avoid inserting empty
- // text nodes.
- return;
- }
- if (didWarnInvalidHydration) {
- return;
- }
- didWarnInvalidHydration = true;
- warning(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
+ warnOnInvalidCallback(callback, 'render');
}
-}
-
-function restoreControlledState(domElement, tag, props) {
- switch (tag) {
- case 'input':
- restoreControlledState$1(domElement, props);
- return;
- case 'textarea':
- restoreControlledState$3(domElement, props);
- return;
- case 'select':
- restoreControlledState$2(domElement, props);
- return;
+ if (callback !== null) {
+ work.then(callback);
}
-}
-
-var ReactDOMFiberComponent = Object.freeze({
- createElement: createElement$1,
- createTextNode: createTextNode$1,
- setInitialProperties: setInitialProperties$1,
- diffProperties: diffProperties$1,
- updateProperties: updateProperties$1,
- diffHydratedProperties: diffHydratedProperties$1,
- diffHydratedText: diffHydratedText$1,
- warnForUnmatchedText: warnForUnmatchedText$1,
- warnForDeletedHydratableElement: warnForDeletedHydratableElement$1,
- warnForDeletedHydratableText: warnForDeletedHydratableText$1,
- warnForInsertedHydratedElement: warnForInsertedHydratedElement$1,
- warnForInsertedHydratedText: warnForInsertedHydratedText$1,
- restoreControlledState: restoreControlledState
-});
-
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var getCurrentFiberStackAddendum$6 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
-
-var validateDOMNesting = emptyFunction;
-
-{
- // This validation code was written based on the HTML5 parsing spec:
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
- //
- // Note: this does not catch all invalid nesting, nor does it try to (as it's
- // not clear what practical benefit doing so provides); instead, we warn only
- // for cases where the parser will give a parse tree differing from what React
- // intended. For example, <b><div></div></b> is invalid but we don't warn
- // because it still parses correctly; we do warn for other cases like nested
- // <p> tags where the beginning of the second element implicitly closes the
- // first, causing a confusing mess.
-
- // https://html.spec.whatwg.org/multipage/syntax.html#special
- var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
-
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
- var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
-
- // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
- // TODO: Distinguish by namespace here -- for <title>, including it here
- // errs on the side of fewer warnings
- 'foreignObject', 'desc', 'title'];
-
- // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
- var buttonScopeTags = inScopeTags.concat(['button']);
-
- // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
- var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
-
- var emptyAncestorInfo = {
- current: null,
-
- formTag: null,
- aTagInScope: null,
- buttonTagInScope: null,
- nobrTagInScope: null,
- pTagInButtonScope: null,
-
- listItemTagAutoclosing: null,
- dlItemTagAutoclosing: null
- };
-
- var updatedAncestorInfo$1 = function (oldInfo, tag, instance) {
- var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
- var info = { tag: tag, instance: instance };
-
- if (inScopeTags.indexOf(tag) !== -1) {
- ancestorInfo.aTagInScope = null;
- ancestorInfo.buttonTagInScope = null;
- ancestorInfo.nobrTagInScope = null;
- }
- if (buttonScopeTags.indexOf(tag) !== -1) {
- ancestorInfo.pTagInButtonScope = null;
- }
-
- // See rules for 'li', 'dd', 'dt' start tags in
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
- if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
- ancestorInfo.listItemTagAutoclosing = null;
- ancestorInfo.dlItemTagAutoclosing = null;
- }
-
- ancestorInfo.current = info;
-
- if (tag === 'form') {
- ancestorInfo.formTag = info;
- }
- if (tag === 'a') {
- ancestorInfo.aTagInScope = info;
- }
- if (tag === 'button') {
- ancestorInfo.buttonTagInScope = info;
- }
- if (tag === 'nobr') {
- ancestorInfo.nobrTagInScope = info;
- }
- if (tag === 'p') {
- ancestorInfo.pTagInButtonScope = info;
- }
- if (tag === 'li') {
- ancestorInfo.listItemTagAutoclosing = info;
- }
- if (tag === 'dd' || tag === 'dt') {
- ancestorInfo.dlItemTagAutoclosing = info;
- }
-
- return ancestorInfo;
- };
-
- /**
- * Returns whether
- */
- var isTagValidWithParent = function (tag, parentTag) {
- // First, let's check if we're in an unusual parsing mode...
- switch (parentTag) {
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
- case 'select':
- return tag === 'option' || tag === 'optgroup' || tag === '#text';
- case 'optgroup':
- return tag === 'option' || tag === '#text';
- // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
- // but
- case 'option':
- return tag === '#text';
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
- // No special behavior since these rules fall back to "in body" mode for
- // all except special table nodes which cause bad parsing behavior anyway.
-
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
- case 'tr':
- return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
- case 'tbody':
- case 'thead':
- case 'tfoot':
- return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
- case 'colgroup':
- return tag === 'col' || tag === 'template';
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
- case 'table':
- return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
- case 'head':
- return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
- // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
- case 'html':
- return tag === 'head' || tag === 'body';
- case '#document':
- return tag === 'html';
- }
-
- // Probably in the "in body" parsing mode, so we outlaw only tag combos
- // where the parsing rules cause implicit opens or closes to be added.
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
- switch (tag) {
- case 'h1':
- case 'h2':
- case 'h3':
- case 'h4':
- case 'h5':
- case 'h6':
- return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
-
- case 'rp':
- case 'rt':
- return impliedEndTags.indexOf(parentTag) === -1;
-
- case 'body':
- case 'caption':
- case 'col':
- case 'colgroup':
- case 'frame':
- case 'head':
- case 'html':
- case 'tbody':
- case 'td':
- case 'tfoot':
- case 'th':
- case 'thead':
- case 'tr':
- // These tags are only valid with a few parents that have special child
- // parsing rules -- if we're down here, then none of those matched and
- // so we allow it only if we don't know what the parent is, as all other
- // cases are invalid.
- return parentTag == null;
- }
-
- return true;
- };
-
- /**
- * Returns whether
- */
- var findInvalidAncestorForTag = function (tag, ancestorInfo) {
- switch (tag) {
- case 'address':
- case 'article':
- case 'aside':
- case 'blockquote':
- case 'center':
- case 'details':
- case 'dialog':
- case 'dir':
- case 'div':
- case 'dl':
- case 'fieldset':
- case 'figcaption':
- case 'figure':
- case 'footer':
- case 'header':
- case 'hgroup':
- case 'main':
- case 'menu':
- case 'nav':
- case 'ol':
- case 'p':
- case 'section':
- case 'summary':
- case 'ul':
- case 'pre':
- case 'listing':
- case 'table':
- case 'hr':
- case 'xmp':
- case 'h1':
- case 'h2':
- case 'h3':
- case 'h4':
- case 'h5':
- case 'h6':
- return ancestorInfo.pTagInButtonScope;
-
- case 'form':
- return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
-
- case 'li':
- return ancestorInfo.listItemTagAutoclosing;
-
- case 'dd':
- case 'dt':
- return ancestorInfo.dlItemTagAutoclosing;
-
- case 'button':
- return ancestorInfo.buttonTagInScope;
-
- case 'a':
- // Spec says something about storing a list of markers, but it sounds
- // equivalent to this check.
- return ancestorInfo.aTagInScope;
-
- case 'nobr':
- return ancestorInfo.nobrTagInScope;
- }
-
- return null;
- };
-
- var didWarn = {};
-
- validateDOMNesting = function (childTag, childText, ancestorInfo) {
- ancestorInfo = ancestorInfo || emptyAncestorInfo;
- var parentInfo = ancestorInfo.current;
- var parentTag = parentInfo && parentInfo.tag;
-
- if (childText != null) {
- warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null');
- childTag = '#text';
- }
-
- var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
- var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
- var invalidParentOrAncestor = invalidParent || invalidAncestor;
- if (!invalidParentOrAncestor) {
- return;
- }
-
- var ancestorTag = invalidParentOrAncestor.tag;
- var addendum = getCurrentFiberStackAddendum$6();
-
- var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
- if (didWarn[warnKey]) {
- return;
- }
- didWarn[warnKey] = true;
-
- var tagDisplayName = childTag;
- var whitespaceInfo = '';
- if (childTag === '#text') {
- if (/\S/.test(childText)) {
- tagDisplayName = 'Text nodes';
- } else {
- tagDisplayName = 'Whitespace text nodes';
- whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
- }
- } else {
- tagDisplayName = '<' + childTag + '>';
+ updateContainer(children, root, parentComponent, work._onCommit);
+ return work;
+};
+ReactRoot.prototype.createBatch = function () {
+ var batch = new ReactBatch(this);
+ var expirationTime = batch._expirationTime;
+
+ var internalRoot = this._internalRoot;
+ var firstBatch = internalRoot.firstBatch;
+ if (firstBatch === null) {
+ internalRoot.firstBatch = batch;
+ batch._next = null;
+ } else {
+ // Insert sorted by expiration time then insertion order
+ var insertAfter = null;
+ var insertBefore = firstBatch;
+ while (insertBefore !== null && insertBefore._expirationTime <= expirationTime) {
+ insertAfter = insertBefore;
+ insertBefore = insertBefore._next;
}
-
- if (invalidParent) {
- var info = '';
- if (ancestorTag === 'table' && childTag === 'tr') {
- info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
- }
- warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
- } else {
- warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
+ batch._next = insertBefore;
+ if (insertAfter !== null) {
+ insertAfter._next = batch;
}
- };
-
- // TODO: turn this into a named export
- validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo$1;
-
- // For testing
- validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
- ancestorInfo = ancestorInfo || emptyAncestorInfo;
- var parentInfo = ancestorInfo.current;
- var parentTag = parentInfo && parentInfo.tag;
- return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
- };
-}
-
-var validateDOMNesting$1 = validateDOMNesting;
-
-// TODO: direct imports like some-package/src/* are bad. Fix me.
-var createElement = createElement$1;
-var createTextNode = createTextNode$1;
-var setInitialProperties = setInitialProperties$1;
-var diffProperties = diffProperties$1;
-var updateProperties = updateProperties$1;
-var diffHydratedProperties = diffHydratedProperties$1;
-var diffHydratedText = diffHydratedText$1;
-var warnForUnmatchedText = warnForUnmatchedText$1;
-var warnForDeletedHydratableElement = warnForDeletedHydratableElement$1;
-var warnForDeletedHydratableText = warnForDeletedHydratableText$1;
-var warnForInsertedHydratedElement = warnForInsertedHydratedElement$1;
-var warnForInsertedHydratedText = warnForInsertedHydratedText$1;
-var updatedAncestorInfo = validateDOMNesting$1.updatedAncestorInfo;
-var precacheFiberNode = precacheFiberNode$1;
-var updateFiberProps = updateFiberProps$1;
-
-
-{
- var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
- if (typeof Map !== 'function' || Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
- warning(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. http://fb.me/react-polyfills');
}
-}
-injection$3.injectFiberControlledHostComponent(ReactDOMFiberComponent);
-
-var eventsEnabled = null;
-var selectionInformation = null;
+ return batch;
+};
/**
* True if the supplied DOM node is a valid node element.
@@ -14899,336 +18037,82 @@ function shouldHydrateDueToLegacyHeuristic(container) {
return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
}
-function shouldAutoFocusHostComponent(type, props) {
- switch (type) {
- case 'button':
- case 'input':
- case 'select':
- case 'textarea':
- return !!props.autoFocus;
- }
- return false;
-}
+setBatchingImplementation(batchedUpdates$1, interactiveUpdates$1, flushInteractiveUpdates$1);
-var DOMRenderer = reactReconciler({
- getRootHostContext: function (rootContainerInstance) {
- var type = void 0;
- var namespace = void 0;
- var nodeType = rootContainerInstance.nodeType;
- switch (nodeType) {
- case DOCUMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- {
- type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
- var root = rootContainerInstance.documentElement;
- namespace = root ? root.namespaceURI : getChildNamespace(null, '');
- break;
- }
- default:
- {
- var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
- var ownNamespace = container.namespaceURI || null;
- type = container.tagName;
- namespace = getChildNamespace(ownNamespace, type);
- break;
- }
- }
- {
- var validatedTag = type.toLowerCase();
- var _ancestorInfo = updatedAncestorInfo(null, validatedTag, null);
- return { namespace: namespace, ancestorInfo: _ancestorInfo };
- }
- return namespace;
- },
- getChildHostContext: function (parentHostContext, type) {
- {
- var parentHostContextDev = parentHostContext;
- var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
- var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type, null);
- return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
- }
- var parentNamespace = parentHostContext;
- return getChildNamespace(parentNamespace, type);
- },
- getPublicInstance: function (instance) {
- return instance;
- },
- prepareForCommit: function () {
- eventsEnabled = isEnabled();
- selectionInformation = getSelectionInformation();
- setEnabled(false);
- },
- resetAfterCommit: function () {
- restoreSelection(selectionInformation);
- selectionInformation = null;
- setEnabled(eventsEnabled);
- eventsEnabled = null;
- },
- createInstance: function (type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
- var parentNamespace = void 0;
- {
- // TODO: take namespace into account when validating.
- var hostContextDev = hostContext;
- validateDOMNesting$1(type, null, hostContextDev.ancestorInfo);
- if (typeof props.children === 'string' || typeof props.children === 'number') {
- var string = '' + props.children;
- var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type, null);
- validateDOMNesting$1(null, string, ownAncestorInfo);
- }
- parentNamespace = hostContextDev.namespace;
- }
- var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
- precacheFiberNode(internalInstanceHandle, domElement);
- updateFiberProps(domElement, props);
- return domElement;
- },
- appendInitialChild: function (parentInstance, child) {
- parentInstance.appendChild(child);
- },
- finalizeInitialChildren: function (domElement, type, props, rootContainerInstance) {
- setInitialProperties(domElement, type, props, rootContainerInstance);
- return shouldAutoFocusHostComponent(type, props);
- },
- prepareUpdate: function (domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
- {
- var hostContextDev = hostContext;
- if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
- var string = '' + newProps.children;
- var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type, null);
- validateDOMNesting$1(null, string, ownAncestorInfo);
- }
- }
- return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
- },
- shouldSetTextContent: function (type, props) {
- return type === 'textarea' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && typeof props.dangerouslySetInnerHTML.__html === 'string';
- },
- shouldDeprioritizeSubtree: function (type, props) {
- return !!props.hidden;
- },
- createTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {
- {
- var hostContextDev = hostContext;
- validateDOMNesting$1(null, text, hostContextDev.ancestorInfo);
- }
- var textNode = createTextNode(text, rootContainerInstance);
- precacheFiberNode(internalInstanceHandle, textNode);
- return textNode;
- },
-
-
- now: now,
-
- mutation: {
- commitMount: function (domElement, type, newProps, internalInstanceHandle) {
- domElement.focus();
- },
- commitUpdate: function (domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
- // Update the props handle so that we know which props are the ones with
- // with current event handlers.
- updateFiberProps(domElement, newProps);
- // Apply the diff to the DOM node.
- updateProperties(domElement, updatePayload, type, oldProps, newProps);
- },
- resetTextContent: function (domElement) {
- domElement.textContent = '';
- },
- commitTextUpdate: function (textInstance, oldText, newText) {
- textInstance.nodeValue = newText;
- },
- appendChild: function (parentInstance, child) {
- parentInstance.appendChild(child);
- },
- appendChildToContainer: function (container, child) {
- if (container.nodeType === COMMENT_NODE) {
- container.parentNode.insertBefore(child, container);
- } else {
- container.appendChild(child);
- }
- },
- insertBefore: function (parentInstance, child, beforeChild) {
- parentInstance.insertBefore(child, beforeChild);
- },
- insertInContainerBefore: function (container, child, beforeChild) {
- if (container.nodeType === COMMENT_NODE) {
- container.parentNode.insertBefore(child, beforeChild);
- } else {
- container.insertBefore(child, beforeChild);
- }
- },
- removeChild: function (parentInstance, child) {
- parentInstance.removeChild(child);
- },
- removeChildFromContainer: function (container, child) {
- if (container.nodeType === COMMENT_NODE) {
- container.parentNode.removeChild(child);
- } else {
- container.removeChild(child);
- }
- }
- },
+var warnedAboutHydrateAPI = false;
- hydration: {
- canHydrateInstance: function (instance, type, props) {
- if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
- return null;
- }
- // This has now been refined to an element node.
- return instance;
- },
- canHydrateTextInstance: function (instance, text) {
- if (text === '' || instance.nodeType !== TEXT_NODE) {
- // Empty strings are not parsed by HTML so there won't be a correct match here.
- return null;
- }
- // This has now been refined to a text node.
- return instance;
- },
- getNextHydratableSibling: function (instance) {
- var node = instance.nextSibling;
- // Skip non-hydratable nodes.
- while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
- node = node.nextSibling;
- }
- return node;
- },
- getFirstHydratableChild: function (parentInstance) {
- var next = parentInstance.firstChild;
- // Skip non-hydratable nodes.
- while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
- next = next.nextSibling;
- }
- return next;
- },
- hydrateInstance: function (instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
- precacheFiberNode(internalInstanceHandle, instance);
- // TODO: Possibly defer this until the commit phase where all the events
- // get attached.
- updateFiberProps(instance, props);
- var parentNamespace = void 0;
- {
- var hostContextDev = hostContext;
- parentNamespace = hostContextDev.namespace;
- }
- return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
- },
- hydrateTextInstance: function (textInstance, text, internalInstanceHandle) {
- precacheFiberNode(internalInstanceHandle, textInstance);
- return diffHydratedText(textInstance, text);
- },
- didNotMatchHydratedContainerTextInstance: function (parentContainer, textInstance, text) {
- {
- warnForUnmatchedText(textInstance, text);
- }
- },
- didNotMatchHydratedTextInstance: function (parentType, parentProps, parentInstance, textInstance, text) {
- if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
- warnForUnmatchedText(textInstance, text);
- }
- },
- didNotHydrateContainerInstance: function (parentContainer, instance) {
+function legacyCreateRootFromDOMContainer(container, forceHydrate) {
+ var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
+ // First clear any existing content.
+ if (!shouldHydrate) {
+ var warned = false;
+ var rootSibling = void 0;
+ while (rootSibling = container.lastChild) {
{
- if (instance.nodeType === 1) {
- warnForDeletedHydratableElement(parentContainer, instance);
- } else {
- warnForDeletedHydratableText(parentContainer, instance);
- }
- }
- },
- didNotHydrateInstance: function (parentType, parentProps, parentInstance, instance) {
- if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
- if (instance.nodeType === 1) {
- warnForDeletedHydratableElement(parentInstance, instance);
- } else {
- warnForDeletedHydratableText(parentInstance, instance);
+ if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
+ warned = true;
+ warningWithoutStack$1(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
}
}
- },
- didNotFindHydratableContainerInstance: function (parentContainer, type, props) {
- {
- warnForInsertedHydratedElement(parentContainer, type, props);
- }
- },
- didNotFindHydratableContainerTextInstance: function (parentContainer, text) {
- {
- warnForInsertedHydratedText(parentContainer, text);
- }
- },
- didNotFindHydratableInstance: function (parentType, parentProps, parentInstance, type, props) {
- if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
- warnForInsertedHydratedElement(parentInstance, type, props);
- }
- },
- didNotFindHydratableTextInstance: function (parentType, parentProps, parentInstance, text) {
- if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
- warnForInsertedHydratedText(parentInstance, text);
- }
+ container.removeChild(rootSibling);
}
- },
-
- scheduleDeferredCallback: rIC,
- cancelDeferredCallback: cIC,
-
- useSyncScheduling: !enableAsyncSchedulingByDefaultInReactDOM
-});
-
-injection$4.injectFiberBatchedUpdates(DOMRenderer.batchedUpdates);
-
-var warnedAboutHydrateAPI = false;
-
-function renderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
- !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
-
+ }
{
- if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
- var hostInstance = DOMRenderer.findHostInstanceWithNoPortals(container._reactRootContainer.current);
- if (hostInstance) {
- warning(hostInstance.parentNode === container, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.');
- }
+ if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
+ warnedAboutHydrateAPI = true;
+ lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
}
+ }
+ // Legacy roots are not async by default.
+ var isAsync = false;
+ return new ReactRoot(container, isAsync, shouldHydrate);
+}
- var isRootRenderedBySomeReact = !!container._reactRootContainer;
- var rootEl = getReactRootElementInContainer(container);
- var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
-
- warning(!hasNonRootReactChild || isRootRenderedBySomeReact, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.');
+function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
+ // TODO: Ensure all entry points contain this check
+ !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
- warning(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.');
+ {
+ topLevelUpdateWarnings(container);
}
+ // TODO: Without `any` type, Flow says "Property cannot be accessed on any
+ // member of intersection type." Whyyyyyy.
var root = container._reactRootContainer;
if (!root) {
- var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
- // First clear any existing content.
- if (!shouldHydrate) {
- var warned = false;
- var rootSibling = void 0;
- while (rootSibling = container.lastChild) {
- {
- if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
- warned = true;
- warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
- }
- }
- container.removeChild(rootSibling);
- }
- }
- {
- if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
- warnedAboutHydrateAPI = true;
- lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
- }
+ // Initial mount
+ root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
+ if (typeof callback === 'function') {
+ var originalCallback = callback;
+ callback = function () {
+ var instance = getPublicRootInstance(root._internalRoot);
+ originalCallback.call(instance);
+ };
}
- var newRoot = DOMRenderer.createContainer(container, shouldHydrate);
- root = container._reactRootContainer = newRoot;
// Initial mount should not be batched.
- DOMRenderer.unbatchedUpdates(function () {
- DOMRenderer.updateContainer(children, newRoot, parentComponent, callback);
+ unbatchedUpdates(function () {
+ if (parentComponent != null) {
+ root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
+ } else {
+ root.render(children, callback);
+ }
});
} else {
- DOMRenderer.updateContainer(children, root, parentComponent, callback);
+ if (typeof callback === 'function') {
+ var _originalCallback = callback;
+ callback = function () {
+ var instance = getPublicRootInstance(root._internalRoot);
+ _originalCallback.call(instance);
+ };
+ }
+ // Update
+ if (parentComponent != null) {
+ root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
+ } else {
+ root.render(children, callback);
+ }
}
- return DOMRenderer.getPublicRootInstance(root);
+ return getPublicRootInstance(root._internalRoot);
}
function createPortal(children, container) {
@@ -15239,28 +18123,15 @@ function createPortal(children, container) {
return createPortal$1(children, container, null, key);
}
-function ReactRoot(container, hydrate) {
- var root = DOMRenderer.createContainer(container, hydrate);
- this._reactRootContainer = root;
-}
-ReactRoot.prototype.render = function (children, callback) {
- var root = this._reactRootContainer;
- DOMRenderer.updateContainer(children, root, null, callback);
-};
-ReactRoot.prototype.unmount = function (callback) {
- var root = this._reactRootContainer;
- DOMRenderer.updateContainer(null, root, null, callback);
-};
-
var ReactDOM = {
createPortal: createPortal,
findDOMNode: function (componentOrElement) {
{
var owner = ReactCurrentOwner.current;
- if (owner !== null) {
+ if (owner !== null && owner.stateNode !== null) {
var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
- warning(warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner) || 'A component');
+ !warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component') : void 0;
owner.stateNode._warnedAboutRefsInRender = true;
}
}
@@ -15271,27 +18142,18 @@ var ReactDOM = {
return componentOrElement;
}
- var inst = get(componentOrElement);
- if (inst) {
- return DOMRenderer.findHostInstance(inst);
- }
-
- if (typeof componentOrElement.render === 'function') {
- invariant(false, 'Unable to find node on an unmounted component.');
- } else {
- invariant(false, 'Element appears to be neither ReactComponent nor DOMNode. Keys: %s', Object.keys(componentOrElement));
- }
+ return findHostInstance(componentOrElement);
},
hydrate: function (element, container, callback) {
// TODO: throw or warn if we couldn't hydrate?
- return renderSubtreeIntoContainer(null, element, container, true, callback);
+ return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
},
render: function (element, container, callback) {
- return renderSubtreeIntoContainer(null, element, container, false, callback);
+ return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
},
unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
!(parentComponent != null && has(parentComponent)) ? invariant(false, 'parentComponent must be a valid React Component') : void 0;
- return renderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
+ return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
},
unmountComponentAtNode: function (container) {
!isValidContainer(container) ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : void 0;
@@ -15300,12 +18162,12 @@ var ReactDOM = {
{
var rootEl = getReactRootElementInContainer(container);
var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
- warning(!renderedByDifferentReact, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.');
+ !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
}
// Unmount should not be batched.
- DOMRenderer.unbatchedUpdates(function () {
- renderSubtreeIntoContainer(null, null, container, false, function () {
+ unbatchedUpdates(function () {
+ legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
container._reactRootContainer = null;
});
});
@@ -15318,9 +18180,9 @@ var ReactDOM = {
var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
// Check if the container itself is a React root node.
- var isContainerReactRoot = container.nodeType === 1 && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
+ var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
- warning(!hasNonRootReactChild, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.');
+ !!hasNonRootReactChild ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
}
return false;
@@ -15330,34 +18192,37 @@ var ReactDOM = {
// Temporary alias since we already shipped React 16 RC with it.
// TODO: remove in React 17.
- unstable_createPortal: createPortal,
+ unstable_createPortal: function () {
+ if (!didWarnAboutUnstableCreatePortal) {
+ didWarnAboutUnstableCreatePortal = true;
+ lowPriorityWarning$1(false, 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
+ }
+ return createPortal.apply(undefined, arguments);
+ },
- unstable_batchedUpdates: batchedUpdates,
- unstable_deferredUpdates: DOMRenderer.deferredUpdates,
+ unstable_batchedUpdates: batchedUpdates$1,
- flushSync: DOMRenderer.flushSync,
+ unstable_interactiveUpdates: interactiveUpdates$1,
+
+ flushSync: flushSync,
+
+ unstable_flushControlled: flushControlled,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
- // For TapEventPlugin which is popular in open source
- EventPluginHub: EventPluginHub,
- // Used by test-utils
- EventPluginRegistry: EventPluginRegistry,
- EventPropagators: EventPropagators,
- ReactControlledComponent: ReactControlledComponent,
- ReactDOMComponentTree: ReactDOMComponentTree,
- ReactDOMEventListener: ReactDOMEventListener
+ // Keep in sync with ReactDOMUnstableNativeDependencies.js
+ // and ReactTestUtils.js. This is an array for better minification.
+ Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch]
}
};
-if (enableCreateRoot) {
- ReactDOM.createRoot = function createRoot(container, options) {
- var hydrate = options != null && options.hydrate === true;
- return new ReactRoot(container, hydrate);
- };
-}
+ReactDOM.unstable_createRoot = function createRoot(container, options) {
+ !isValidContainer(container) ? invariant(false, 'unstable_createRoot(...): Target container is not a DOM element.') : void 0;
+ var hydrate = options != null && options.hydrate === true;
+ return new ReactRoot(container, true, hydrate);
+};
-var foundDevTools = DOMRenderer.injectIntoDevTools({
+var foundDevTools = injectIntoDevTools({
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 1,
version: ReactVersion,
@@ -15365,7 +18230,7 @@ var foundDevTools = DOMRenderer.injectIntoDevTools({
});
{
- if (!foundDevTools && ExecutionEnvironment.canUseDOM && window.top === window.self) {
+ if (!foundDevTools && canUseDOM && window.top === window.self) {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
var protocol = window.location.protocol;
@@ -15387,7 +18252,7 @@ var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
-var reactDom = ReactDOM$3['default'] ? ReactDOM$3['default'] : ReactDOM$3;
+var reactDom = ReactDOM$3.default || ReactDOM$3;
module.exports = reactDom;
})();
diff --git a/node_modules/react-dom/cjs/react-dom.production.min.js b/node_modules/react-dom/cjs/react-dom.production.min.js
index 92e7e4e79..7dc24cc24 100644
--- a/node_modules/react-dom/cjs/react-dom.production.min.js
+++ b/node_modules/react-dom/cjs/react-dom.production.min.js
@@ -1,7 +1,7 @@
-/** @license React v16.2.0
+/** @license React v16.5.2
* react-dom.production.min.js
*
- * Copyright (c) 2013-present, Facebook, Inc.
+ * Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -10,220 +10,226 @@
/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
-'use strict';var aa=require("react"),l=require("fbjs/lib/ExecutionEnvironment"),B=require("object-assign"),C=require("fbjs/lib/emptyFunction"),ba=require("fbjs/lib/EventListener"),da=require("fbjs/lib/getActiveElement"),ea=require("fbjs/lib/shallowEqual"),fa=require("fbjs/lib/containsNode"),ia=require("fbjs/lib/focusNode"),D=require("fbjs/lib/emptyObject");
-function E(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);b=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}aa?void 0:E("227");
-var oa={children:!0,dangerouslySetInnerHTML:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,style:!0};function pa(a,b){return(a&b)===b}
-var ta={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,HAS_STRING_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(a){var b=ta,c=a.Properties||{},d=a.DOMAttributeNamespaces||{},e=a.DOMAttributeNames||{};a=a.DOMMutationMethods||{};for(var f in c){ua.hasOwnProperty(f)?E("48",f):void 0;var g=f.toLowerCase(),h=c[f];g={attributeName:g,attributeNamespace:null,propertyName:f,mutationMethod:null,mustUseProperty:pa(h,b.MUST_USE_PROPERTY),
-hasBooleanValue:pa(h,b.HAS_BOOLEAN_VALUE),hasNumericValue:pa(h,b.HAS_NUMERIC_VALUE),hasPositiveNumericValue:pa(h,b.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:pa(h,b.HAS_OVERLOADED_BOOLEAN_VALUE),hasStringBooleanValue:pa(h,b.HAS_STRING_BOOLEAN_VALUE)};1>=g.hasBooleanValue+g.hasNumericValue+g.hasOverloadedBooleanValue?void 0:E("50",f);e.hasOwnProperty(f)&&(g.attributeName=e[f]);d.hasOwnProperty(f)&&(g.attributeNamespace=d[f]);a.hasOwnProperty(f)&&(g.mutationMethod=a[f]);ua[f]=g}}},ua={};
-function va(a,b){if(oa.hasOwnProperty(a)||2<a.length&&("o"===a[0]||"O"===a[0])&&("n"===a[1]||"N"===a[1]))return!1;if(null===b)return!0;switch(typeof b){case "boolean":return oa.hasOwnProperty(a)?a=!0:(b=wa(a))?a=b.hasBooleanValue||b.hasStringBooleanValue||b.hasOverloadedBooleanValue:(a=a.toLowerCase().slice(0,5),a="data-"===a||"aria-"===a),a;case "undefined":case "number":case "string":case "object":return!0;default:return!1}}function wa(a){return ua.hasOwnProperty(a)?ua[a]:null}
-var xa=ta,ya=xa.MUST_USE_PROPERTY,K=xa.HAS_BOOLEAN_VALUE,za=xa.HAS_NUMERIC_VALUE,Aa=xa.HAS_POSITIVE_NUMERIC_VALUE,Ba=xa.HAS_OVERLOADED_BOOLEAN_VALUE,Ca=xa.HAS_STRING_BOOLEAN_VALUE,Da={Properties:{allowFullScreen:K,async:K,autoFocus:K,autoPlay:K,capture:Ba,checked:ya|K,cols:Aa,contentEditable:Ca,controls:K,"default":K,defer:K,disabled:K,download:Ba,draggable:Ca,formNoValidate:K,hidden:K,loop:K,multiple:ya|K,muted:ya|K,noValidate:K,open:K,playsInline:K,readOnly:K,required:K,reversed:K,rows:Aa,rowSpan:za,
-scoped:K,seamless:K,selected:ya|K,size:Aa,start:za,span:Aa,spellCheck:Ca,style:0,tabIndex:0,itemScope:K,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:Ca},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(a,b){if(null==b)return a.removeAttribute("value");"number"!==a.type||!1===a.hasAttribute("value")?a.setAttribute("value",""+b):a.validity&&!a.validity.badInput&&a.ownerDocument.activeElement!==a&&
-a.setAttribute("value",""+b)}}},Ea=xa.HAS_STRING_BOOLEAN_VALUE,M={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Ga={Properties:{autoReverse:Ea,externalResourcesRequired:Ea,preserveAlpha:Ea},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:M.xlink,xlinkArcrole:M.xlink,xlinkHref:M.xlink,xlinkRole:M.xlink,xlinkShow:M.xlink,xlinkTitle:M.xlink,xlinkType:M.xlink,
-xmlBase:M.xml,xmlLang:M.xml,xmlSpace:M.xml}},Ha=/[\-\:]([a-z])/g;function Ia(a){return a[1].toUpperCase()}
-"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(a){var b=a.replace(Ha,
-Ia);Ga.Properties[b]=0;Ga.DOMAttributeNames[b]=a});xa.injectDOMPropertyConfig(Da);xa.injectDOMPropertyConfig(Ga);
-var P={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,injection:{injectErrorUtils:function(a){"function"!==typeof a.invokeGuardedCallback?E("197"):void 0;Ja=a.invokeGuardedCallback}},invokeGuardedCallback:function(a,b,c,d,e,f,g,h,k){Ja.apply(P,arguments)},invokeGuardedCallbackAndCatchFirstError:function(a,b,c,d,e,f,g,h,k){P.invokeGuardedCallback.apply(this,arguments);if(P.hasCaughtError()){var q=P.clearCaughtError();P._hasRethrowError||(P._hasRethrowError=!0,P._rethrowError=
-q)}},rethrowCaughtError:function(){return Ka.apply(P,arguments)},hasCaughtError:function(){return P._hasCaughtError},clearCaughtError:function(){if(P._hasCaughtError){var a=P._caughtError;P._caughtError=null;P._hasCaughtError=!1;return a}E("198")}};function Ja(a,b,c,d,e,f,g,h,k){P._hasCaughtError=!1;P._caughtError=null;var q=Array.prototype.slice.call(arguments,3);try{b.apply(c,q)}catch(v){P._caughtError=v,P._hasCaughtError=!0}}
-function Ka(){if(P._hasRethrowError){var a=P._rethrowError;P._rethrowError=null;P._hasRethrowError=!1;throw a;}}var La=null,Ma={};
-function Na(){if(La)for(var a in Ma){var b=Ma[a],c=La.indexOf(a);-1<c?void 0:E("96",a);if(!Oa[c]){b.extractEvents?void 0:E("97",a);Oa[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],g=b,h=d;Pa.hasOwnProperty(h)?E("99",h):void 0;Pa[h]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&Qa(k[e],g,h);e=!0}else f.registrationName?(Qa(f.registrationName,g,h),e=!0):e=!1;e?void 0:E("98",d,a)}}}}
-function Qa(a,b,c){Ra[a]?E("100",a):void 0;Ra[a]=b;Sa[a]=b.eventTypes[c].dependencies}var Oa=[],Pa={},Ra={},Sa={};function Ta(a){La?E("101"):void 0;La=Array.prototype.slice.call(a);Na()}function Ua(a){var b=!1,c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];Ma.hasOwnProperty(c)&&Ma[c]===d||(Ma[c]?E("102",c):void 0,Ma[c]=d,b=!0)}b&&Na()}
-var Va=Object.freeze({plugins:Oa,eventNameDispatchConfigs:Pa,registrationNameModules:Ra,registrationNameDependencies:Sa,possibleRegistrationNames:null,injectEventPluginOrder:Ta,injectEventPluginsByName:Ua}),Wa=null,Xa=null,Ya=null;function Za(a,b,c,d){b=a.type||"unknown-event";a.currentTarget=Ya(d);P.invokeGuardedCallbackAndCatchFirstError(b,c,void 0,a);a.currentTarget=null}
-function $a(a,b){null==b?E("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function ab(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}var bb=null;
-function cb(a,b){if(a){var c=a._dispatchListeners,d=a._dispatchInstances;if(Array.isArray(c))for(var e=0;e<c.length&&!a.isPropagationStopped();e++)Za(a,b,c[e],d[e]);else c&&Za(a,b,c,d);a._dispatchListeners=null;a._dispatchInstances=null;a.isPersistent()||a.constructor.release(a)}}function db(a){return cb(a,!0)}function gb(a){return cb(a,!1)}var hb={injectEventPluginOrder:Ta,injectEventPluginsByName:Ua};
-function ib(a,b){var c=a.stateNode;if(!c)return null;var d=Wa(c);if(!d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?E("231",b,typeof c):void 0;
-return c}function jb(a,b,c,d){for(var e,f=0;f<Oa.length;f++){var g=Oa[f];g&&(g=g.extractEvents(a,b,c,d))&&(e=$a(e,g))}return e}function kb(a){a&&(bb=$a(bb,a))}function lb(a){var b=bb;bb=null;b&&(a?ab(b,db):ab(b,gb),bb?E("95"):void 0,P.rethrowCaughtError())}var mb=Object.freeze({injection:hb,getListener:ib,extractEvents:jb,enqueueEvents:kb,processEventQueue:lb}),nb=Math.random().toString(36).slice(2),Q="__reactInternalInstance$"+nb,ob="__reactEventHandlers$"+nb;
-function pb(a){if(a[Q])return a[Q];for(var b=[];!a[Q];)if(b.push(a),a.parentNode)a=a.parentNode;else return null;var c=void 0,d=a[Q];if(5===d.tag||6===d.tag)return d;for(;a&&(d=a[Q]);a=b.pop())c=d;return c}function qb(a){if(5===a.tag||6===a.tag)return a.stateNode;E("33")}function rb(a){return a[ob]||null}
-var sb=Object.freeze({precacheFiberNode:function(a,b){b[Q]=a},getClosestInstanceFromNode:pb,getInstanceFromNode:function(a){a=a[Q];return!a||5!==a.tag&&6!==a.tag?null:a},getNodeFromInstance:qb,getFiberCurrentPropsFromNode:rb,updateFiberProps:function(a,b){a[ob]=b}});function tb(a){do a=a["return"];while(a&&5!==a.tag);return a?a:null}function ub(a,b,c){for(var d=[];a;)d.push(a),a=tb(a);for(a=d.length;0<a--;)b(d[a],"captured",c);for(a=0;a<d.length;a++)b(d[a],"bubbled",c)}
-function vb(a,b,c){if(b=ib(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=$a(c._dispatchListeners,b),c._dispatchInstances=$a(c._dispatchInstances,a)}function wb(a){a&&a.dispatchConfig.phasedRegistrationNames&&ub(a._targetInst,vb,a)}function xb(a){if(a&&a.dispatchConfig.phasedRegistrationNames){var b=a._targetInst;b=b?tb(b):null;ub(b,vb,a)}}
-function yb(a,b,c){a&&c&&c.dispatchConfig.registrationName&&(b=ib(a,c.dispatchConfig.registrationName))&&(c._dispatchListeners=$a(c._dispatchListeners,b),c._dispatchInstances=$a(c._dispatchInstances,a))}function zb(a){a&&a.dispatchConfig.registrationName&&yb(a._targetInst,null,a)}function Ab(a){ab(a,wb)}
-function Bb(a,b,c,d){if(c&&d)a:{var e=c;for(var f=d,g=0,h=e;h;h=tb(h))g++;h=0;for(var k=f;k;k=tb(k))h++;for(;0<g-h;)e=tb(e),g--;for(;0<h-g;)f=tb(f),h--;for(;g--;){if(e===f||e===f.alternate)break a;e=tb(e);f=tb(f)}e=null}else e=null;f=e;for(e=[];c&&c!==f;){g=c.alternate;if(null!==g&&g===f)break;e.push(c);c=tb(c)}for(c=[];d&&d!==f;){g=d.alternate;if(null!==g&&g===f)break;c.push(d);d=tb(d)}for(d=0;d<e.length;d++)yb(e[d],"bubbled",a);for(a=c.length;0<a--;)yb(c[a],"captured",b)}
-var Cb=Object.freeze({accumulateTwoPhaseDispatches:Ab,accumulateTwoPhaseDispatchesSkipTarget:function(a){ab(a,xb)},accumulateEnterLeaveDispatches:Bb,accumulateDirectDispatches:function(a){ab(a,zb)}}),Db=null;function Eb(){!Db&&l.canUseDOM&&(Db="textContent"in document.documentElement?"textContent":"innerText");return Db}var S={_root:null,_startText:null,_fallbackText:null};
-function Fb(){if(S._fallbackText)return S._fallbackText;var a,b=S._startText,c=b.length,d,e=Gb(),f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);S._fallbackText=e.slice(a,1<d?1-d:void 0);return S._fallbackText}function Gb(){return"value"in S._root?S._root.value:S._root[Eb()]}
-var Hb="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),Ib={type:null,target:null,currentTarget:C.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
-function T(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?C.thatReturnsTrue:C.thatReturnsFalse;this.isPropagationStopped=C.thatReturnsFalse;return this}
-B(T.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=C.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=C.thatReturnsTrue)},persist:function(){this.isPersistent=C.thatReturnsTrue},isPersistent:C.thatReturnsFalse,
-destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<Hb.length;a++)this[Hb[a]]=null}});T.Interface=Ib;T.augmentClass=function(a,b){function c(){}c.prototype=this.prototype;var d=new c;B(d,a.prototype);a.prototype=d;a.prototype.constructor=a;a.Interface=B({},this.Interface,b);a.augmentClass=this.augmentClass;Jb(a)};Jb(T);function Kb(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}
-function Lb(a){a instanceof this?void 0:E("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function Jb(a){a.eventPool=[];a.getPooled=Kb;a.release=Lb}function Mb(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(Mb,{data:null});function Nb(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(Nb,{data:null});var Pb=[9,13,27,32],Vb=l.canUseDOM&&"CompositionEvent"in window,Wb=null;l.canUseDOM&&"documentMode"in document&&(Wb=document.documentMode);var Xb;
-if(Xb=l.canUseDOM&&"TextEvent"in window&&!Wb){var Yb=window.opera;Xb=!("object"===typeof Yb&&"function"===typeof Yb.version&&12>=parseInt(Yb.version(),10))}
-var Zb=Xb,$b=l.canUseDOM&&(!Vb||Wb&&8<Wb&&11>=Wb),ac=String.fromCharCode(32),bc={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",
-captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},cc=!1;
-function dc(a,b){switch(a){case "topKeyUp":return-1!==Pb.indexOf(b.keyCode);case "topKeyDown":return 229!==b.keyCode;case "topKeyPress":case "topMouseDown":case "topBlur":return!0;default:return!1}}function ec(a){a=a.detail;return"object"===typeof a&&"data"in a?a.data:null}var fc=!1;function gc(a,b){switch(a){case "topCompositionEnd":return ec(b);case "topKeyPress":if(32!==b.which)return null;cc=!0;return ac;case "topTextInput":return a=b.data,a===ac&&cc?null:a;default:return null}}
-function hc(a,b){if(fc)return"topCompositionEnd"===a||!Vb&&dc(a,b)?(a=Fb(),S._root=null,S._startText=null,S._fallbackText=null,fc=!1,a):null;switch(a){case "topPaste":return null;case "topKeyPress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "topCompositionEnd":return $b?null:b.data;default:return null}}
-var ic={eventTypes:bc,extractEvents:function(a,b,c,d){var e;if(Vb)b:{switch(a){case "topCompositionStart":var f=bc.compositionStart;break b;case "topCompositionEnd":f=bc.compositionEnd;break b;case "topCompositionUpdate":f=bc.compositionUpdate;break b}f=void 0}else fc?dc(a,c)&&(f=bc.compositionEnd):"topKeyDown"===a&&229===c.keyCode&&(f=bc.compositionStart);f?($b&&(fc||f!==bc.compositionStart?f===bc.compositionEnd&&fc&&(e=Fb()):(S._root=d,S._startText=Gb(),fc=!0)),f=Mb.getPooled(f,b,c,d),e?f.data=
-e:(e=ec(c),null!==e&&(f.data=e)),Ab(f),e=f):e=null;(a=Zb?gc(a,c):hc(a,c))?(b=Nb.getPooled(bc.beforeInput,b,c,d),b.data=a,Ab(b)):b=null;return[e,b]}},jc=null,kc=null,lc=null;function mc(a){if(a=Xa(a)){jc&&"function"===typeof jc.restoreControlledState?void 0:E("194");var b=Wa(a.stateNode);jc.restoreControlledState(a.stateNode,a.type,b)}}var nc={injectFiberControlledHostComponent:function(a){jc=a}};function oc(a){kc?lc?lc.push(a):lc=[a]:kc=a}
-function pc(){if(kc){var a=kc,b=lc;lc=kc=null;mc(a);if(b)for(a=0;a<b.length;a++)mc(b[a])}}var qc=Object.freeze({injection:nc,enqueueStateRestore:oc,restoreStateIfNeeded:pc});function rc(a,b){return a(b)}var sc=!1;function tc(a,b){if(sc)return rc(a,b);sc=!0;try{return rc(a,b)}finally{sc=!1,pc()}}var uc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};
-function vc(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!uc[a.type]:"textarea"===b?!0:!1}function wc(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var xc;l.canUseDOM&&(xc=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));
-function yc(a,b){if(!l.canUseDOM||b&&!("addEventListener"in document))return!1;b="on"+a;var c=b in document;c||(c=document.createElement("div"),c.setAttribute(b,"return;"),c="function"===typeof c[b]);!c&&xc&&"wheel"===a&&(c=document.implementation.hasFeature("Events.wheel","3.0"));return c}function zc(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)}
-function Ac(a){var b=zc(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"function"===typeof c.get&&"function"===typeof c.set)return Object.defineProperty(a,b,{enumerable:c.enumerable,configurable:!0,get:function(){return c.get.call(this)},set:function(a){d=""+a;c.set.call(this,a)}}),{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker=null;delete a[b]}}}
-function Bc(a){a._valueTracker||(a._valueTracker=Ac(a))}function Cc(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=zc(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}var Dc={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}};
-function Ec(a,b,c){a=T.getPooled(Dc.change,a,b,c);a.type="change";oc(c);Ab(a);return a}var Fc=null,Gc=null;function Hc(a){kb(a);lb(!1)}function Ic(a){var b=qb(a);if(Cc(b))return a}function Jc(a,b){if("topChange"===a)return b}var Kc=!1;l.canUseDOM&&(Kc=yc("input")&&(!document.documentMode||9<document.documentMode));function Lc(){Fc&&(Fc.detachEvent("onpropertychange",Mc),Gc=Fc=null)}function Mc(a){"value"===a.propertyName&&Ic(Gc)&&(a=Ec(Gc,a,wc(a)),tc(Hc,a))}
-function Nc(a,b,c){"topFocus"===a?(Lc(),Fc=b,Gc=c,Fc.attachEvent("onpropertychange",Mc)):"topBlur"===a&&Lc()}function Oc(a){if("topSelectionChange"===a||"topKeyUp"===a||"topKeyDown"===a)return Ic(Gc)}function Pc(a,b){if("topClick"===a)return Ic(b)}function $c(a,b){if("topInput"===a||"topChange"===a)return Ic(b)}
-var ad={eventTypes:Dc,_isInputEventSupported:Kc,extractEvents:function(a,b,c,d){var e=b?qb(b):window,f=e.nodeName&&e.nodeName.toLowerCase();if("select"===f||"input"===f&&"file"===e.type)var g=Jc;else if(vc(e))if(Kc)g=$c;else{g=Oc;var h=Nc}else f=e.nodeName,!f||"input"!==f.toLowerCase()||"checkbox"!==e.type&&"radio"!==e.type||(g=Pc);if(g&&(g=g(a,b)))return Ec(g,c,d);h&&h(a,e,b);"topBlur"===a&&null!=b&&(a=b._wrapperState||e._wrapperState)&&a.controlled&&"number"===e.type&&(a=""+e.value,e.getAttribute("value")!==
-a&&e.setAttribute("value",a))}};function bd(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(bd,{view:null,detail:null});var cd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=cd[a])?!!b[a]:!1}function ed(){return dd}function fd(a,b,c,d){return T.call(this,a,b,c,d)}
-bd.augmentClass(fd,{screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:ed,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)}});
-var gd={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},hd={eventTypes:gd,extractEvents:function(a,b,c,d){if("topMouseOver"===a&&(c.relatedTarget||c.fromElement)||"topMouseOut"!==a&&"topMouseOver"!==a)return null;var e=d.window===d?d:(e=d.ownerDocument)?e.defaultView||e.parentWindow:window;"topMouseOut"===a?(a=b,b=(b=c.relatedTarget||c.toElement)?pb(b):null):a=null;if(a===
-b)return null;var f=null==a?e:qb(a);e=null==b?e:qb(b);var g=fd.getPooled(gd.mouseLeave,a,c,d);g.type="mouseleave";g.target=f;g.relatedTarget=e;c=fd.getPooled(gd.mouseEnter,b,c,d);c.type="mouseenter";c.target=e;c.relatedTarget=f;Bb(g,c,a,b);return[g,c]}},id=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;function jd(a){a=a.type;return"string"===typeof a?a:"function"===typeof a?a.displayName||a.name:null}
-function kd(a){var b=a;if(a.alternate)for(;b["return"];)b=b["return"];else{if(0!==(b.effectTag&2))return 1;for(;b["return"];)if(b=b["return"],0!==(b.effectTag&2))return 1}return 3===b.tag?2:3}function ld(a){return(a=a._reactInternalFiber)?2===kd(a):!1}function md(a){2!==kd(a)?E("188"):void 0}
-function nd(a){var b=a.alternate;if(!b)return b=kd(a),3===b?E("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c["return"],f=e?e.alternate:null;if(!e||!f)break;if(e.child===f.child){for(var g=e.child;g;){if(g===c)return md(e),a;if(g===d)return md(e),b;g=g.sibling}E("188")}if(c["return"]!==d["return"])c=e,d=f;else{g=!1;for(var h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}g?
-void 0:E("189")}}c.alternate!==d?E("190"):void 0}3!==c.tag?E("188"):void 0;return c.stateNode.current===c?a:b}function od(a){a=nd(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child["return"]=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b["return"]||b["return"]===a)return null;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}}return null}
-function pd(a){a=nd(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child&&4!==b.tag)b.child["return"]=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b["return"]||b["return"]===a)return null;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}}return null}var qd=[];
-function rd(a){var b=a.targetInst;do{if(!b){a.ancestors.push(b);break}var c;for(c=b;c["return"];)c=c["return"];c=3!==c.tag?null:c.stateNode.containerInfo;if(!c)break;a.ancestors.push(b);b=pb(c)}while(b);for(c=0;c<a.ancestors.length;c++)b=a.ancestors[c],sd(a.topLevelType,b,a.nativeEvent,wc(a.nativeEvent))}var td=!0,sd=void 0;function ud(a){td=!!a}function U(a,b,c){return c?ba.listen(c,b,vd.bind(null,a)):null}function wd(a,b,c){return c?ba.capture(c,b,vd.bind(null,a)):null}
-function vd(a,b){if(td){var c=wc(b);c=pb(c);null===c||"number"!==typeof c.tag||2===kd(c)||(c=null);if(qd.length){var d=qd.pop();d.topLevelType=a;d.nativeEvent=b;d.targetInst=c;a=d}else a={topLevelType:a,nativeEvent:b,targetInst:c,ancestors:[]};try{tc(rd,a)}finally{a.topLevelType=null,a.nativeEvent=null,a.targetInst=null,a.ancestors.length=0,10>qd.length&&qd.push(a)}}}
-var xd=Object.freeze({get _enabled(){return td},get _handleTopLevel(){return sd},setHandleTopLevel:function(a){sd=a},setEnabled:ud,isEnabled:function(){return td},trapBubbledEvent:U,trapCapturedEvent:wd,dispatchEvent:vd});function yd(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;c["ms"+a]="MS"+b;c["O"+a]="o"+b.toLowerCase();return c}
-var zd={animationend:yd("Animation","AnimationEnd"),animationiteration:yd("Animation","AnimationIteration"),animationstart:yd("Animation","AnimationStart"),transitionend:yd("Transition","TransitionEnd")},Ad={},Bd={};l.canUseDOM&&(Bd=document.createElement("div").style,"AnimationEvent"in window||(delete zd.animationend.animation,delete zd.animationiteration.animation,delete zd.animationstart.animation),"TransitionEvent"in window||delete zd.transitionend.transition);
-function Cd(a){if(Ad[a])return Ad[a];if(!zd[a])return a;var b=zd[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Bd)return Ad[a]=b[c];return""}
-var Dd={topAbort:"abort",topAnimationEnd:Cd("animationend")||"animationend",topAnimationIteration:Cd("animationiteration")||"animationiteration",topAnimationStart:Cd("animationstart")||"animationstart",topBlur:"blur",topCancel:"cancel",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",
-topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoad:"load",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",
-topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",
-topTouchStart:"touchstart",topTransitionEnd:Cd("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},Ed={},Fd=0,Gd="_reactListenersID"+(""+Math.random()).slice(2);function Hd(a){Object.prototype.hasOwnProperty.call(a,Gd)||(a[Gd]=Fd++,Ed[a[Gd]]={});return Ed[a[Gd]]}function Id(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
-function Jd(a,b){var c=Id(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Id(c)}}function Kd(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&"text"===a.type||"textarea"===b||"true"===a.contentEditable)}
-var Ld=l.canUseDOM&&"documentMode"in document&&11>=document.documentMode,Md={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},Nd=null,Od=null,Pd=null,Qd=!1;
-function Rd(a,b){if(Qd||null==Nd||Nd!==da())return null;var c=Nd;"selectionStart"in c&&Kd(c)?c={start:c.selectionStart,end:c.selectionEnd}:window.getSelection?(c=window.getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}):c=void 0;return Pd&&ea(Pd,c)?null:(Pd=c,a=T.getPooled(Md.select,Od,a,b),a.type="select",a.target=Nd,Ab(a),a)}
-var Sd={eventTypes:Md,extractEvents:function(a,b,c,d){var e=d.window===d?d.document:9===d.nodeType?d:d.ownerDocument,f;if(!(f=!e)){a:{e=Hd(e);f=Sa.onSelect;for(var g=0;g<f.length;g++){var h=f[g];if(!e.hasOwnProperty(h)||!e[h]){e=!1;break a}}e=!0}f=!e}if(f)return null;e=b?qb(b):window;switch(a){case "topFocus":if(vc(e)||"true"===e.contentEditable)Nd=e,Od=b,Pd=null;break;case "topBlur":Pd=Od=Nd=null;break;case "topMouseDown":Qd=!0;break;case "topContextMenu":case "topMouseUp":return Qd=!1,Rd(c,d);case "topSelectionChange":if(Ld)break;
-case "topKeyDown":case "topKeyUp":return Rd(c,d)}return null}};function Td(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(Td,{animationName:null,elapsedTime:null,pseudoElement:null});function Ud(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(Ud,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}});function Vd(a,b,c,d){return T.call(this,a,b,c,d)}bd.augmentClass(Vd,{relatedTarget:null});
-function Wd(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;return 32<=a||13===a?a:0}
-var Xd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",
-116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};function Zd(a,b,c,d){return T.call(this,a,b,c,d)}
-bd.augmentClass(Zd,{key:function(a){if(a.key){var b=Xd[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=Wd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?Yd[a.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:ed,charCode:function(a){return"keypress"===a.type?Wd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===
-a.type?Wd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}});function $d(a,b,c,d){return T.call(this,a,b,c,d)}fd.augmentClass($d,{dataTransfer:null});function ae(a,b,c,d){return T.call(this,a,b,c,d)}bd.augmentClass(ae,{touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:ed});function be(a,b,c,d){return T.call(this,a,b,c,d)}T.augmentClass(be,{propertyName:null,elapsedTime:null,pseudoElement:null});
-function ce(a,b,c,d){return T.call(this,a,b,c,d)}fd.augmentClass(ce,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:null,deltaMode:null});var de={},ee={};
-"abort animationEnd animationIteration animationStart blur cancel canPlay canPlayThrough click close contextMenu copy cut doubleClick drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error focus input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing progress rateChange reset scroll seeked seeking stalled submit suspend timeUpdate toggle touchCancel touchEnd touchMove touchStart transitionEnd volumeChange waiting wheel".split(" ").forEach(function(a){var b=a[0].toUpperCase()+
-a.slice(1),c="on"+b;b="top"+b;c={phasedRegistrationNames:{bubbled:c,captured:c+"Capture"},dependencies:[b]};de[a]=c;ee[b]=c});
-var fe={eventTypes:de,extractEvents:function(a,b,c,d){var e=ee[a];if(!e)return null;switch(a){case "topKeyPress":if(0===Wd(c))return null;case "topKeyDown":case "topKeyUp":a=Zd;break;case "topBlur":case "topFocus":a=Vd;break;case "topClick":if(2===c.button)return null;case "topDoubleClick":case "topMouseDown":case "topMouseMove":case "topMouseUp":case "topMouseOut":case "topMouseOver":case "topContextMenu":a=fd;break;case "topDrag":case "topDragEnd":case "topDragEnter":case "topDragExit":case "topDragLeave":case "topDragOver":case "topDragStart":case "topDrop":a=
-$d;break;case "topTouchCancel":case "topTouchEnd":case "topTouchMove":case "topTouchStart":a=ae;break;case "topAnimationEnd":case "topAnimationIteration":case "topAnimationStart":a=Td;break;case "topTransitionEnd":a=be;break;case "topScroll":a=bd;break;case "topWheel":a=ce;break;case "topCopy":case "topCut":case "topPaste":a=Ud;break;default:a=T}b=a.getPooled(e,b,c,d);Ab(b);return b}};sd=function(a,b,c,d){a=jb(a,b,c,d);kb(a);lb(!1)};hb.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));
-Wa=sb.getFiberCurrentPropsFromNode;Xa=sb.getInstanceFromNode;Ya=sb.getNodeFromInstance;hb.injectEventPluginsByName({SimpleEventPlugin:fe,EnterLeaveEventPlugin:hd,ChangeEventPlugin:ad,SelectEventPlugin:Sd,BeforeInputEventPlugin:ic});var ge=[],he=-1;function V(a){0>he||(a.current=ge[he],ge[he]=null,he--)}function W(a,b){he++;ge[he]=a.current;a.current=b}new Set;var ie={current:D},X={current:!1},je=D;function ke(a){return le(a)?je:ie.current}
-function me(a,b){var c=a.type.contextTypes;if(!c)return D;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function le(a){return 2===a.tag&&null!=a.type.childContextTypes}function ne(a){le(a)&&(V(X,a),V(ie,a))}
-function oe(a,b,c){null!=ie.cursor?E("168"):void 0;W(ie,b,a);W(X,c,a)}function pe(a,b){var c=a.stateNode,d=a.type.childContextTypes;if("function"!==typeof c.getChildContext)return b;c=c.getChildContext();for(var e in c)e in d?void 0:E("108",jd(a)||"Unknown",e);return B({},b,c)}function qe(a){if(!le(a))return!1;var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||D;je=ie.current;W(ie,b,a);W(X,X.current,a);return!0}
-function re(a,b){var c=a.stateNode;c?void 0:E("169");if(b){var d=pe(a,je);c.__reactInternalMemoizedMergedChildContext=d;V(X,a);V(ie,a);W(ie,d,a)}else V(X,a);W(X,b,a)}
-function Y(a,b,c){this.tag=a;this.key=b;this.stateNode=this.type=null;this.sibling=this.child=this["return"]=null;this.index=0;this.memoizedState=this.updateQueue=this.memoizedProps=this.pendingProps=this.ref=null;this.internalContextTag=c;this.effectTag=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.expirationTime=0;this.alternate=null}
-function se(a,b,c){var d=a.alternate;null===d?(d=new Y(a.tag,a.key,a.internalContextTag),d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.effectTag=0,d.nextEffect=null,d.firstEffect=null,d.lastEffect=null);d.expirationTime=c;d.pendingProps=b;d.child=a.child;d.memoizedProps=a.memoizedProps;d.memoizedState=a.memoizedState;d.updateQueue=a.updateQueue;d.sibling=a.sibling;d.index=a.index;d.ref=a.ref;return d}
-function te(a,b,c){var d=void 0,e=a.type,f=a.key;"function"===typeof e?(d=e.prototype&&e.prototype.isReactComponent?new Y(2,f,b):new Y(0,f,b),d.type=e,d.pendingProps=a.props):"string"===typeof e?(d=new Y(5,f,b),d.type=e,d.pendingProps=a.props):"object"===typeof e&&null!==e&&"number"===typeof e.tag?(d=e,d.pendingProps=a.props):E("130",null==e?e:typeof e,"");d.expirationTime=c;return d}function ue(a,b,c,d){b=new Y(10,d,b);b.pendingProps=a;b.expirationTime=c;return b}
-function ve(a,b,c){b=new Y(6,null,b);b.pendingProps=a;b.expirationTime=c;return b}function we(a,b,c){b=new Y(7,a.key,b);b.type=a.handler;b.pendingProps=a;b.expirationTime=c;return b}function xe(a,b,c){a=new Y(9,null,b);a.expirationTime=c;return a}function ye(a,b,c){b=new Y(4,a.key,b);b.pendingProps=a.children||[];b.expirationTime=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}var ze=null,Ae=null;
-function Be(a){return function(b){try{return a(b)}catch(c){}}}function Ce(a){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)return!0;try{var c=b.inject(a);ze=Be(function(a){return b.onCommitFiberRoot(c,a)});Ae=Be(function(a){return b.onCommitFiberUnmount(c,a)})}catch(d){}return!0}function De(a){"function"===typeof ze&&ze(a)}function Ee(a){"function"===typeof Ae&&Ae(a)}
-function Fe(a){return{baseState:a,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1}}function Ge(a,b){null===a.last?a.first=a.last=b:(a.last.next=b,a.last=b);if(0===a.expirationTime||a.expirationTime>b.expirationTime)a.expirationTime=b.expirationTime}
-function He(a,b){var c=a.alternate,d=a.updateQueue;null===d&&(d=a.updateQueue=Fe(null));null!==c?(a=c.updateQueue,null===a&&(a=c.updateQueue=Fe(null))):a=null;a=a!==d?a:null;null===a?Ge(d,b):null===d.last||null===a.last?(Ge(d,b),Ge(a,b)):(Ge(d,b),a.last=b)}function Ie(a,b,c,d){a=a.partialState;return"function"===typeof a?a.call(b,c,d):a}
-function Je(a,b,c,d,e,f){null!==a&&a.updateQueue===c&&(c=b.updateQueue={baseState:c.baseState,expirationTime:c.expirationTime,first:c.first,last:c.last,isInitialized:c.isInitialized,callbackList:null,hasForceUpdate:!1});c.expirationTime=0;c.isInitialized?a=c.baseState:(a=c.baseState=b.memoizedState,c.isInitialized=!0);for(var g=!0,h=c.first,k=!1;null!==h;){var q=h.expirationTime;if(q>f){var v=c.expirationTime;if(0===v||v>q)c.expirationTime=q;k||(k=!0,c.baseState=a)}else{k||(c.first=h.next,null===
-c.first&&(c.last=null));if(h.isReplace)a=Ie(h,d,a,e),g=!0;else if(q=Ie(h,d,a,e))a=g?B({},a,q):B(a,q),g=!1;h.isForced&&(c.hasForceUpdate=!0);null!==h.callback&&(q=c.callbackList,null===q&&(q=c.callbackList=[]),q.push(h))}h=h.next}null!==c.callbackList?b.effectTag|=32:null!==c.first||c.hasForceUpdate||(b.updateQueue=null);k||(c.baseState=a);return a}
-function Ke(a,b){var c=a.callbackList;if(null!==c)for(a.callbackList=null,a=0;a<c.length;a++){var d=c[a],e=d.callback;d.callback=null;"function"!==typeof e?E("191",e):void 0;e.call(b)}}
-function Le(a,b,c,d){function e(a,b){b.updater=f;a.stateNode=b;b._reactInternalFiber=a}var f={isMounted:ld,enqueueSetState:function(c,d,e){c=c._reactInternalFiber;e=void 0===e?null:e;var g=b(c);He(c,{expirationTime:g,partialState:d,callback:e,isReplace:!1,isForced:!1,nextCallback:null,next:null});a(c,g)},enqueueReplaceState:function(c,d,e){c=c._reactInternalFiber;e=void 0===e?null:e;var g=b(c);He(c,{expirationTime:g,partialState:d,callback:e,isReplace:!0,isForced:!1,nextCallback:null,next:null});
-a(c,g)},enqueueForceUpdate:function(c,d){c=c._reactInternalFiber;d=void 0===d?null:d;var e=b(c);He(c,{expirationTime:e,partialState:null,callback:d,isReplace:!1,isForced:!0,nextCallback:null,next:null});a(c,e)}};return{adoptClassInstance:e,constructClassInstance:function(a,b){var c=a.type,d=ke(a),f=2===a.tag&&null!=a.type.contextTypes,g=f?me(a,d):D;b=new c(b,g);e(a,b);f&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=d,a.__reactInternalMemoizedMaskedChildContext=g);return b},mountClassInstance:function(a,
-b){var c=a.alternate,d=a.stateNode,e=d.state||null,g=a.pendingProps;g?void 0:E("158");var h=ke(a);d.props=g;d.state=a.memoizedState=e;d.refs=D;d.context=me(a,h);null!=a.type&&null!=a.type.prototype&&!0===a.type.prototype.unstable_isAsyncReactComponent&&(a.internalContextTag|=1);"function"===typeof d.componentWillMount&&(e=d.state,d.componentWillMount(),e!==d.state&&f.enqueueReplaceState(d,d.state,null),e=a.updateQueue,null!==e&&(d.state=Je(c,a,e,d,g,b)));"function"===typeof d.componentDidMount&&(a.effectTag|=
-4)},updateClassInstance:function(a,b,e){var g=b.stateNode;g.props=b.memoizedProps;g.state=b.memoizedState;var h=b.memoizedProps,k=b.pendingProps;k||(k=h,null==k?E("159"):void 0);var u=g.context,z=ke(b);z=me(b,z);"function"!==typeof g.componentWillReceiveProps||h===k&&u===z||(u=g.state,g.componentWillReceiveProps(k,z),g.state!==u&&f.enqueueReplaceState(g,g.state,null));u=b.memoizedState;e=null!==b.updateQueue?Je(a,b,b.updateQueue,g,k,e):u;if(!(h!==k||u!==e||X.current||null!==b.updateQueue&&b.updateQueue.hasForceUpdate))return"function"!==
-typeof g.componentDidUpdate||h===a.memoizedProps&&u===a.memoizedState||(b.effectTag|=4),!1;var G=k;if(null===h||null!==b.updateQueue&&b.updateQueue.hasForceUpdate)G=!0;else{var I=b.stateNode,L=b.type;G="function"===typeof I.shouldComponentUpdate?I.shouldComponentUpdate(G,e,z):L.prototype&&L.prototype.isPureReactComponent?!ea(h,G)||!ea(u,e):!0}G?("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(k,e,z),"function"===typeof g.componentDidUpdate&&(b.effectTag|=4)):("function"!==typeof g.componentDidUpdate||
-h===a.memoizedProps&&u===a.memoizedState||(b.effectTag|=4),c(b,k),d(b,e));g.props=k;g.state=e;g.context=z;return G}}}var Qe="function"===typeof Symbol&&Symbol["for"],Re=Qe?Symbol["for"]("react.element"):60103,Se=Qe?Symbol["for"]("react.call"):60104,Te=Qe?Symbol["for"]("react.return"):60105,Ue=Qe?Symbol["for"]("react.portal"):60106,Ve=Qe?Symbol["for"]("react.fragment"):60107,We="function"===typeof Symbol&&Symbol.iterator;
-function Xe(a){if(null===a||"undefined"===typeof a)return null;a=We&&a[We]||a["@@iterator"];return"function"===typeof a?a:null}var Ye=Array.isArray;
-function Ze(a,b){var c=b.ref;if(null!==c&&"function"!==typeof c){if(b._owner){b=b._owner;var d=void 0;b&&(2!==b.tag?E("110"):void 0,d=b.stateNode);d?void 0:E("147",c);var e=""+c;if(null!==a&&null!==a.ref&&a.ref._stringRef===e)return a.ref;a=function(a){var b=d.refs===D?d.refs={}:d.refs;null===a?delete b[e]:b[e]=a};a._stringRef=e;return a}"string"!==typeof c?E("148"):void 0;b._owner?void 0:E("149",c)}return c}
-function $e(a,b){"textarea"!==a.type&&E("31","[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b,"")}
-function af(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.effectTag=8}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b,c){a=se(a,b,c);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.effectTag=
-2,c):d;b.effectTag=2;return c}function g(b){a&&null===b.alternate&&(b.effectTag=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=ve(c,a.internalContextTag,d),b["return"]=a,b;b=e(b,c,d);b["return"]=a;return b}function k(a,b,c,d){if(null!==b&&b.type===c.type)return d=e(b,c.props,d),d.ref=Ze(b,c),d["return"]=a,d;d=te(c,a.internalContextTag,d);d.ref=Ze(b,c);d["return"]=a;return d}function q(a,b,c,d){if(null===b||7!==b.tag)return b=we(c,a.internalContextTag,d),b["return"]=a,b;b=e(b,c,d);
-b["return"]=a;return b}function v(a,b,c,d){if(null===b||9!==b.tag)return b=xe(c,a.internalContextTag,d),b.type=c.value,b["return"]=a,b;b=e(b,null,d);b.type=c.value;b["return"]=a;return b}function y(a,b,c,d){if(null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=ye(c,a.internalContextTag,d),b["return"]=a,b;b=e(b,c.children||[],d);b["return"]=a;return b}function u(a,b,c,d,f){if(null===b||10!==b.tag)return b=ue(c,a.internalContextTag,
-d,f),b["return"]=a,b;b=e(b,c,d);b["return"]=a;return b}function z(a,b,c){if("string"===typeof b||"number"===typeof b)return b=ve(""+b,a.internalContextTag,c),b["return"]=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case Re:if(b.type===Ve)return b=ue(b.props.children,a.internalContextTag,c,b.key),b["return"]=a,b;c=te(b,a.internalContextTag,c);c.ref=Ze(null,b);c["return"]=a;return c;case Se:return b=we(b,a.internalContextTag,c),b["return"]=a,b;case Te:return c=xe(b,a.internalContextTag,
-c),c.type=b.value,c["return"]=a,c;case Ue:return b=ye(b,a.internalContextTag,c),b["return"]=a,b}if(Ye(b)||Xe(b))return b=ue(b,a.internalContextTag,c,null),b["return"]=a,b;$e(a,b)}return null}function G(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case Re:return c.key===e?c.type===Ve?u(a,b,c.props.children,d,e):k(a,b,c,d):null;case Se:return c.key===e?q(a,b,c,d):null;case Te:return null===
-e?v(a,b,c,d):null;case Ue:return c.key===e?y(a,b,c,d):null}if(Ye(c)||Xe(c))return null!==e?null:u(a,b,c,d,null);$e(a,c)}return null}function I(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case Re:return a=a.get(null===d.key?c:d.key)||null,d.type===Ve?u(b,a,d.props.children,e,d.key):k(b,a,d,e);case Se:return a=a.get(null===d.key?c:d.key)||null,q(b,a,d,e);case Te:return a=a.get(c)||null,v(b,a,d,e);case Ue:return a=
-a.get(null===d.key?c:d.key)||null,y(b,a,d,e)}if(Ye(d)||Xe(d))return a=a.get(c)||null,u(b,a,d,e,null);$e(b,d)}return null}function L(e,g,m,A){for(var h=null,r=null,n=g,w=g=0,k=null;null!==n&&w<m.length;w++){n.index>w?(k=n,n=null):k=n.sibling;var x=G(e,n,m[w],A);if(null===x){null===n&&(n=k);break}a&&n&&null===x.alternate&&b(e,n);g=f(x,g,w);null===r?h=x:r.sibling=x;r=x;n=k}if(w===m.length)return c(e,n),h;if(null===n){for(;w<m.length;w++)if(n=z(e,m[w],A))g=f(n,g,w),null===r?h=n:r.sibling=n,r=n;return h}for(n=
-d(e,n);w<m.length;w++)if(k=I(n,e,w,m[w],A)){if(a&&null!==k.alternate)n["delete"](null===k.key?w:k.key);g=f(k,g,w);null===r?h=k:r.sibling=k;r=k}a&&n.forEach(function(a){return b(e,a)});return h}function N(e,g,m,A){var h=Xe(m);"function"!==typeof h?E("150"):void 0;m=h.call(m);null==m?E("151"):void 0;for(var r=h=null,n=g,w=g=0,k=null,x=m.next();null!==n&&!x.done;w++,x=m.next()){n.index>w?(k=n,n=null):k=n.sibling;var J=G(e,n,x.value,A);if(null===J){n||(n=k);break}a&&n&&null===J.alternate&&b(e,n);g=f(J,
-g,w);null===r?h=J:r.sibling=J;r=J;n=k}if(x.done)return c(e,n),h;if(null===n){for(;!x.done;w++,x=m.next())x=z(e,x.value,A),null!==x&&(g=f(x,g,w),null===r?h=x:r.sibling=x,r=x);return h}for(n=d(e,n);!x.done;w++,x=m.next())if(x=I(n,e,w,x.value,A),null!==x){if(a&&null!==x.alternate)n["delete"](null===x.key?w:x.key);g=f(x,g,w);null===r?h=x:r.sibling=x;r=x}a&&n.forEach(function(a){return b(e,a)});return h}return function(a,d,f,h){"object"===typeof f&&null!==f&&f.type===Ve&&null===f.key&&(f=f.props.children);
-var m="object"===typeof f&&null!==f;if(m)switch(f.$$typeof){case Re:a:{var r=f.key;for(m=d;null!==m;){if(m.key===r)if(10===m.tag?f.type===Ve:m.type===f.type){c(a,m.sibling);d=e(m,f.type===Ve?f.props.children:f.props,h);d.ref=Ze(m,f);d["return"]=a;a=d;break a}else{c(a,m);break}else b(a,m);m=m.sibling}f.type===Ve?(d=ue(f.props.children,a.internalContextTag,h,f.key),d["return"]=a,a=d):(h=te(f,a.internalContextTag,h),h.ref=Ze(d,f),h["return"]=a,a=h)}return g(a);case Se:a:{for(m=f.key;null!==d;){if(d.key===
-m)if(7===d.tag){c(a,d.sibling);d=e(d,f,h);d["return"]=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=we(f,a.internalContextTag,h);d["return"]=a;a=d}return g(a);case Te:a:{if(null!==d)if(9===d.tag){c(a,d.sibling);d=e(d,null,h);d.type=f.value;d["return"]=a;a=d;break a}else c(a,d);d=xe(f,a.internalContextTag,h);d.type=f.value;d["return"]=a;a=d}return g(a);case Ue:a:{for(m=f.key;null!==d;){if(d.key===m)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===
-f.implementation){c(a,d.sibling);d=e(d,f.children||[],h);d["return"]=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=ye(f,a.internalContextTag,h);d["return"]=a;a=d}return g(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f,h)):(c(a,d),d=ve(f,a.internalContextTag,h)),d["return"]=a,a=d,g(a);if(Ye(f))return L(a,d,f,h);if(Xe(f))return N(a,d,f,h);m&&$e(a,f);if("undefined"===typeof f)switch(a.tag){case 2:case 1:h=a.type,E("152",h.displayName||
-h.name||"Component")}return c(a,d)}}var bf=af(!0),cf=af(!1);
-function df(a,b,c,d,e){function f(a,b,c){var d=b.expirationTime;b.child=null===a?cf(b,null,c,d):bf(b,a.child,c,d)}function g(a,b){var c=b.ref;null===c||a&&a.ref===c||(b.effectTag|=128)}function h(a,b,c,d){g(a,b);if(!c)return d&&re(b,!1),q(a,b);c=b.stateNode;id.current=b;var e=c.render();b.effectTag|=1;f(a,b,e);b.memoizedState=c.state;b.memoizedProps=c.props;d&&re(b,!0);return b.child}function k(a){var b=a.stateNode;b.pendingContext?oe(a,b.pendingContext,b.pendingContext!==b.context):b.context&&oe(a,
-b.context,!1);I(a,b.containerInfo)}function q(a,b){null!==a&&b.child!==a.child?E("153"):void 0;if(null!==b.child){a=b.child;var c=se(a,a.pendingProps,a.expirationTime);b.child=c;for(c["return"]=b;null!==a.sibling;)a=a.sibling,c=c.sibling=se(a,a.pendingProps,a.expirationTime),c["return"]=b;c.sibling=null}return b.child}function v(a,b){switch(b.tag){case 3:k(b);break;case 2:qe(b);break;case 4:I(b,b.stateNode.containerInfo)}return null}var y=a.shouldSetTextContent,u=a.useSyncScheduling,z=a.shouldDeprioritizeSubtree,
-G=b.pushHostContext,I=b.pushHostContainer,L=c.enterHydrationState,N=c.resetHydrationState,J=c.tryToClaimNextHydratableInstance;a=Le(d,e,function(a,b){a.memoizedProps=b},function(a,b){a.memoizedState=b});var w=a.adoptClassInstance,m=a.constructClassInstance,A=a.mountClassInstance,Ob=a.updateClassInstance;return{beginWork:function(a,b,c){if(0===b.expirationTime||b.expirationTime>c)return v(a,b);switch(b.tag){case 0:null!==a?E("155"):void 0;var d=b.type,e=b.pendingProps,r=ke(b);r=me(b,r);d=d(e,r);b.effectTag|=
-1;"object"===typeof d&&null!==d&&"function"===typeof d.render?(b.tag=2,e=qe(b),w(b,d),A(b,c),b=h(a,b,!0,e)):(b.tag=1,f(a,b,d),b.memoizedProps=e,b=b.child);return b;case 1:a:{e=b.type;c=b.pendingProps;d=b.memoizedProps;if(X.current)null===c&&(c=d);else if(null===c||d===c){b=q(a,b);break a}d=ke(b);d=me(b,d);e=e(c,d);b.effectTag|=1;f(a,b,e);b.memoizedProps=c;b=b.child}return b;case 2:return e=qe(b),d=void 0,null===a?b.stateNode?E("153"):(m(b,b.pendingProps),A(b,c),d=!0):d=Ob(a,b,c),h(a,b,d,e);case 3:return k(b),
-e=b.updateQueue,null!==e?(d=b.memoizedState,e=Je(a,b,e,null,null,c),d===e?(N(),b=q(a,b)):(d=e.element,r=b.stateNode,(null===a||null===a.child)&&r.hydrate&&L(b)?(b.effectTag|=2,b.child=cf(b,null,d,c)):(N(),f(a,b,d)),b.memoizedState=e,b=b.child)):(N(),b=q(a,b)),b;case 5:G(b);null===a&&J(b);e=b.type;var n=b.memoizedProps;d=b.pendingProps;null===d&&(d=n,null===d?E("154"):void 0);r=null!==a?a.memoizedProps:null;X.current||null!==d&&n!==d?(n=d.children,y(e,d)?n=null:r&&y(e,r)&&(b.effectTag|=16),g(a,b),
-2147483647!==c&&!u&&z(e,d)?(b.expirationTime=2147483647,b=null):(f(a,b,n),b.memoizedProps=d,b=b.child)):b=q(a,b);return b;case 6:return null===a&&J(b),a=b.pendingProps,null===a&&(a=b.memoizedProps),b.memoizedProps=a,null;case 8:b.tag=7;case 7:e=b.pendingProps;if(X.current)null===e&&(e=a&&a.memoizedProps,null===e?E("154"):void 0);else if(null===e||b.memoizedProps===e)e=b.memoizedProps;d=e.children;b.stateNode=null===a?cf(b,b.stateNode,d,c):bf(b,b.stateNode,d,c);b.memoizedProps=e;return b.stateNode;
-case 9:return null;case 4:a:{I(b,b.stateNode.containerInfo);e=b.pendingProps;if(X.current)null===e&&(e=a&&a.memoizedProps,null==e?E("154"):void 0);else if(null===e||b.memoizedProps===e){b=q(a,b);break a}null===a?b.child=bf(b,null,e,c):f(a,b,e);b.memoizedProps=e;b=b.child}return b;case 10:a:{c=b.pendingProps;if(X.current)null===c&&(c=b.memoizedProps);else if(null===c||b.memoizedProps===c){b=q(a,b);break a}f(a,b,c);b.memoizedProps=c;b=b.child}return b;default:E("156")}},beginFailedWork:function(a,b,
-c){switch(b.tag){case 2:qe(b);break;case 3:k(b);break;default:E("157")}b.effectTag|=64;null===a?b.child=null:b.child!==a.child&&(b.child=a.child);if(0===b.expirationTime||b.expirationTime>c)return v(a,b);b.firstEffect=null;b.lastEffect=null;b.child=null===a?cf(b,null,null,c):bf(b,a.child,null,c);2===b.tag&&(a=b.stateNode,b.memoizedProps=a.props,b.memoizedState=a.state);return b.child}}}
-function ef(a,b,c){function d(a){a.effectTag|=4}var e=a.createInstance,f=a.createTextInstance,g=a.appendInitialChild,h=a.finalizeInitialChildren,k=a.prepareUpdate,q=a.persistence,v=b.getRootHostContainer,y=b.popHostContext,u=b.getHostContext,z=b.popHostContainer,G=c.prepareToHydrateHostInstance,I=c.prepareToHydrateHostTextInstance,L=c.popHydrationState,N=void 0,J=void 0,w=void 0;a.mutation?(N=function(){},J=function(a,b,c){(b.updateQueue=c)&&d(b)},w=function(a,b,c,e){c!==e&&d(b)}):q?E("235"):E("236");
-return{completeWork:function(a,b,c){var m=b.pendingProps;if(null===m)m=b.memoizedProps;else if(2147483647!==b.expirationTime||2147483647===c)b.pendingProps=null;switch(b.tag){case 1:return null;case 2:return ne(b),null;case 3:z(b);V(X,b);V(ie,b);m=b.stateNode;m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null);if(null===a||null===a.child)L(b),b.effectTag&=-3;N(b);return null;case 5:y(b);c=v();var A=b.type;if(null!==a&&null!=b.stateNode){var p=a.memoizedProps,q=b.stateNode,x=u();q=
-k(q,A,p,m,c,x);J(a,b,q,A,p,m,c);a.ref!==b.ref&&(b.effectTag|=128)}else{if(!m)return null===b.stateNode?E("166"):void 0,null;a=u();if(L(b))G(b,c,a)&&d(b);else{a=e(A,m,c,a,b);a:for(p=b.child;null!==p;){if(5===p.tag||6===p.tag)g(a,p.stateNode);else if(4!==p.tag&&null!==p.child){p.child["return"]=p;p=p.child;continue}if(p===b)break;for(;null===p.sibling;){if(null===p["return"]||p["return"]===b)break a;p=p["return"]}p.sibling["return"]=p["return"];p=p.sibling}h(a,A,m,c)&&d(b);b.stateNode=a}null!==b.ref&&
-(b.effectTag|=128)}return null;case 6:if(a&&null!=b.stateNode)w(a,b,a.memoizedProps,m);else{if("string"!==typeof m)return null===b.stateNode?E("166"):void 0,null;a=v();c=u();L(b)?I(b)&&d(b):b.stateNode=f(m,a,c,b)}return null;case 7:(m=b.memoizedProps)?void 0:E("165");b.tag=8;A=[];a:for((p=b.stateNode)&&(p["return"]=b);null!==p;){if(5===p.tag||6===p.tag||4===p.tag)E("247");else if(9===p.tag)A.push(p.type);else if(null!==p.child){p.child["return"]=p;p=p.child;continue}for(;null===p.sibling;){if(null===
-p["return"]||p["return"]===b)break a;p=p["return"]}p.sibling["return"]=p["return"];p=p.sibling}p=m.handler;m=p(m.props,A);b.child=bf(b,null!==a?a.child:null,m,c);return b.child;case 8:return b.tag=7,null;case 9:return null;case 10:return null;case 4:return z(b),N(b),null;case 0:E("167");default:E("156")}}}}
-function ff(a,b){function c(a){var c=a.ref;if(null!==c)try{c(null)}catch(A){b(a,A)}}function d(a){"function"===typeof Ee&&Ee(a);switch(a.tag){case 2:c(a);var d=a.stateNode;if("function"===typeof d.componentWillUnmount)try{d.props=a.memoizedProps,d.state=a.memoizedState,d.componentWillUnmount()}catch(A){b(a,A)}break;case 5:c(a);break;case 7:e(a.stateNode);break;case 4:k&&g(a)}}function e(a){for(var b=a;;)if(d(b),null===b.child||k&&4===b.tag){if(b===a)break;for(;null===b.sibling;){if(null===b["return"]||
-b["return"]===a)return;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}else b.child["return"]=b,b=b.child}function f(a){return 5===a.tag||3===a.tag||4===a.tag}function g(a){for(var b=a,c=!1,f=void 0,g=void 0;;){if(!c){c=b["return"];a:for(;;){null===c?E("160"):void 0;switch(c.tag){case 5:f=c.stateNode;g=!1;break a;case 3:f=c.stateNode.containerInfo;g=!0;break a;case 4:f=c.stateNode.containerInfo;g=!0;break a}c=c["return"]}c=!0}if(5===b.tag||6===b.tag)e(b),g?J(f,b.stateNode):N(f,b.stateNode);
-else if(4===b.tag?f=b.stateNode.containerInfo:d(b),null!==b.child){b.child["return"]=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b["return"]||b["return"]===a)return;b=b["return"];4===b.tag&&(c=!1)}b.sibling["return"]=b["return"];b=b.sibling}}var h=a.getPublicInstance,k=a.mutation;a=a.persistence;k||(a?E("235"):E("236"));var q=k.commitMount,v=k.commitUpdate,y=k.resetTextContent,u=k.commitTextUpdate,z=k.appendChild,G=k.appendChildToContainer,I=k.insertBefore,L=k.insertInContainerBefore,
-N=k.removeChild,J=k.removeChildFromContainer;return{commitResetTextContent:function(a){y(a.stateNode)},commitPlacement:function(a){a:{for(var b=a["return"];null!==b;){if(f(b)){var c=b;break a}b=b["return"]}E("160");c=void 0}var d=b=void 0;switch(c.tag){case 5:b=c.stateNode;d=!1;break;case 3:b=c.stateNode.containerInfo;d=!0;break;case 4:b=c.stateNode.containerInfo;d=!0;break;default:E("161")}c.effectTag&16&&(y(b),c.effectTag&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c["return"]||f(c["return"])){c=
-null;break a}c=c["return"]}c.sibling["return"]=c["return"];for(c=c.sibling;5!==c.tag&&6!==c.tag;){if(c.effectTag&2)continue b;if(null===c.child||4===c.tag)continue b;else c.child["return"]=c,c=c.child}if(!(c.effectTag&2)){c=c.stateNode;break a}}for(var e=a;;){if(5===e.tag||6===e.tag)c?d?L(b,e.stateNode,c):I(b,e.stateNode,c):d?G(b,e.stateNode):z(b,e.stateNode);else if(4!==e.tag&&null!==e.child){e.child["return"]=e;e=e.child;continue}if(e===a)break;for(;null===e.sibling;){if(null===e["return"]||e["return"]===
-a)return;e=e["return"]}e.sibling["return"]=e["return"];e=e.sibling}},commitDeletion:function(a){g(a);a["return"]=null;a.child=null;a.alternate&&(a.alternate.child=null,a.alternate["return"]=null)},commitWork:function(a,b){switch(b.tag){case 2:break;case 5:var c=b.stateNode;if(null!=c){var d=b.memoizedProps;a=null!==a?a.memoizedProps:d;var e=b.type,f=b.updateQueue;b.updateQueue=null;null!==f&&v(c,f,e,a,d,b)}break;case 6:null===b.stateNode?E("162"):void 0;c=b.memoizedProps;u(b.stateNode,null!==a?a.memoizedProps:
-c,c);break;case 3:break;default:E("163")}},commitLifeCycles:function(a,b){switch(b.tag){case 2:var c=b.stateNode;if(b.effectTag&4)if(null===a)c.props=b.memoizedProps,c.state=b.memoizedState,c.componentDidMount();else{var d=a.memoizedProps;a=a.memoizedState;c.props=b.memoizedProps;c.state=b.memoizedState;c.componentDidUpdate(d,a)}b=b.updateQueue;null!==b&&Ke(b,c);break;case 3:c=b.updateQueue;null!==c&&Ke(c,null!==b.child?b.child.stateNode:null);break;case 5:c=b.stateNode;null===a&&b.effectTag&4&&q(c,
-b.type,b.memoizedProps,b);break;case 6:break;case 4:break;default:E("163")}},commitAttachRef:function(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:b(h(c));break;default:b(c)}}},commitDetachRef:function(a){a=a.ref;null!==a&&a(null)}}}var gf={};
-function hf(a){function b(a){a===gf?E("174"):void 0;return a}var c=a.getChildHostContext,d=a.getRootHostContext,e={current:gf},f={current:gf},g={current:gf};return{getHostContext:function(){return b(e.current)},getRootHostContainer:function(){return b(g.current)},popHostContainer:function(a){V(e,a);V(f,a);V(g,a)},popHostContext:function(a){f.current===a&&(V(e,a),V(f,a))},pushHostContainer:function(a,b){W(g,b,a);b=d(b);W(f,a,a);W(e,b,a)},pushHostContext:function(a){var d=b(g.current),h=b(e.current);
-d=c(h,a.type,d);h!==d&&(W(f,a,a),W(e,d,a))},resetHostContainer:function(){e.current=gf;g.current=gf}}}
-function jf(a){function b(a,b){var c=new Y(5,null,0);c.type="DELETED";c.stateNode=b;c["return"]=a;c.effectTag=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function c(a,b){switch(a.tag){case 5:return b=f(b,a.type,a.pendingProps),null!==b?(a.stateNode=b,!0):!1;case 6:return b=g(b,a.pendingProps),null!==b?(a.stateNode=b,!0):!1;default:return!1}}function d(a){for(a=a["return"];null!==a&&5!==a.tag&&3!==a.tag;)a=a["return"];y=a}var e=a.shouldSetTextContent;
-a=a.hydration;if(!a)return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){E("175")},prepareToHydrateHostTextInstance:function(){E("176")},popHydrationState:function(){return!1}};var f=a.canHydrateInstance,g=a.canHydrateTextInstance,h=a.getNextHydratableSibling,k=a.getFirstHydratableChild,q=a.hydrateInstance,v=a.hydrateTextInstance,y=null,u=null,z=!1;return{enterHydrationState:function(a){u=
-k(a.stateNode.containerInfo);y=a;return z=!0},resetHydrationState:function(){u=y=null;z=!1},tryToClaimNextHydratableInstance:function(a){if(z){var d=u;if(d){if(!c(a,d)){d=h(d);if(!d||!c(a,d)){a.effectTag|=2;z=!1;y=a;return}b(y,u)}y=a;u=k(d)}else a.effectTag|=2,z=!1,y=a}},prepareToHydrateHostInstance:function(a,b,c){b=q(a.stateNode,a.type,a.memoizedProps,b,c,a);a.updateQueue=b;return null!==b?!0:!1},prepareToHydrateHostTextInstance:function(a){return v(a.stateNode,a.memoizedProps,a)},popHydrationState:function(a){if(a!==
-y)return!1;if(!z)return d(a),z=!0,!1;var c=a.type;if(5!==a.tag||"head"!==c&&"body"!==c&&!e(c,a.memoizedProps))for(c=u;c;)b(a,c),c=h(c);d(a);u=y?h(a.stateNode):null;return!0}}}
-function kf(a){function b(a){Qb=ja=!0;var b=a.stateNode;b.current===a?E("177"):void 0;b.isReadyForCommit=!1;id.current=null;if(1<a.effectTag)if(null!==a.lastEffect){a.lastEffect.nextEffect=a;var c=a.firstEffect}else c=a;else c=a.firstEffect;yg();for(t=c;null!==t;){var d=!1,e=void 0;try{for(;null!==t;){var f=t.effectTag;f&16&&zg(t);if(f&128){var g=t.alternate;null!==g&&Ag(g)}switch(f&-242){case 2:Ne(t);t.effectTag&=-3;break;case 6:Ne(t);t.effectTag&=-3;Oe(t.alternate,t);break;case 4:Oe(t.alternate,
-t);break;case 8:Sc=!0,Bg(t),Sc=!1}t=t.nextEffect}}catch(Tc){d=!0,e=Tc}d&&(null===t?E("178"):void 0,h(t,e),null!==t&&(t=t.nextEffect))}Cg();b.current=a;for(t=c;null!==t;){c=!1;d=void 0;try{for(;null!==t;){var k=t.effectTag;k&36&&Dg(t.alternate,t);k&128&&Eg(t);if(k&64)switch(e=t,f=void 0,null!==R&&(f=R.get(e),R["delete"](e),null==f&&null!==e.alternate&&(e=e.alternate,f=R.get(e),R["delete"](e))),null==f?E("184"):void 0,e.tag){case 2:e.stateNode.componentDidCatch(f.error,{componentStack:f.componentStack});
-break;case 3:null===ca&&(ca=f.error);break;default:E("157")}var Qc=t.nextEffect;t.nextEffect=null;t=Qc}}catch(Tc){c=!0,d=Tc}c&&(null===t?E("178"):void 0,h(t,d),null!==t&&(t=t.nextEffect))}ja=Qb=!1;"function"===typeof De&&De(a.stateNode);ha&&(ha.forEach(G),ha=null);null!==ca&&(a=ca,ca=null,Ob(a));b=b.current.expirationTime;0===b&&(qa=R=null);return b}function c(a){for(;;){var b=Fg(a.alternate,a,H),c=a["return"],d=a.sibling;var e=a;if(2147483647===H||2147483647!==e.expirationTime){if(2!==e.tag&&3!==
-e.tag)var f=0;else f=e.updateQueue,f=null===f?0:f.expirationTime;for(var g=e.child;null!==g;)0!==g.expirationTime&&(0===f||f>g.expirationTime)&&(f=g.expirationTime),g=g.sibling;e.expirationTime=f}if(null!==b)return b;null!==c&&(null===c.firstEffect&&(c.firstEffect=a.firstEffect),null!==a.lastEffect&&(null!==c.lastEffect&&(c.lastEffect.nextEffect=a.firstEffect),c.lastEffect=a.lastEffect),1<a.effectTag&&(null!==c.lastEffect?c.lastEffect.nextEffect=a:c.firstEffect=a,c.lastEffect=a));if(null!==d)return d;
-if(null!==c)a=c;else{a.stateNode.isReadyForCommit=!0;break}}return null}function d(a){var b=rg(a.alternate,a,H);null===b&&(b=c(a));id.current=null;return b}function e(a){var b=Gg(a.alternate,a,H);null===b&&(b=c(a));id.current=null;return b}function f(a){if(null!==R){if(!(0===H||H>a))if(H<=Uc)for(;null!==F;)F=k(F)?e(F):d(F);else for(;null!==F&&!A();)F=k(F)?e(F):d(F)}else if(!(0===H||H>a))if(H<=Uc)for(;null!==F;)F=d(F);else for(;null!==F&&!A();)F=d(F)}function g(a,b){ja?E("243"):void 0;ja=!0;a.isReadyForCommit=
-!1;if(a!==ra||b!==H||null===F){for(;-1<he;)ge[he]=null,he--;je=D;ie.current=D;X.current=!1;x();ra=a;H=b;F=se(ra.current,null,b)}var c=!1,d=null;try{f(b)}catch(Rc){c=!0,d=Rc}for(;c;){if(eb){ca=d;break}var g=F;if(null===g)eb=!0;else{var k=h(g,d);null===k?E("183"):void 0;if(!eb){try{c=k;d=b;for(k=c;null!==g;){switch(g.tag){case 2:ne(g);break;case 5:qg(g);break;case 3:p(g);break;case 4:p(g)}if(g===k||g.alternate===k)break;g=g["return"]}F=e(c);f(d)}catch(Rc){c=!0;d=Rc;continue}break}}}b=ca;eb=ja=!1;ca=
-null;null!==b&&Ob(b);return a.isReadyForCommit?a.current.alternate:null}function h(a,b){var c=id.current=null,d=!1,e=!1,f=null;if(3===a.tag)c=a,q(a)&&(eb=!0);else for(var g=a["return"];null!==g&&null===c;){2===g.tag?"function"===typeof g.stateNode.componentDidCatch&&(d=!0,f=jd(g),c=g,e=!0):3===g.tag&&(c=g);if(q(g)){if(Sc||null!==ha&&(ha.has(g)||null!==g.alternate&&ha.has(g.alternate)))return null;c=null;e=!1}g=g["return"]}if(null!==c){null===qa&&(qa=new Set);qa.add(c);var h="";g=a;do{a:switch(g.tag){case 0:case 1:case 2:case 5:var k=
-g._debugOwner,Qc=g._debugSource;var m=jd(g);var n=null;k&&(n=jd(k));k=Qc;m="\n in "+(m||"Unknown")+(k?" (at "+k.fileName.replace(/^.*[\\\/]/,"")+":"+k.lineNumber+")":n?" (created by "+n+")":"");break a;default:m=""}h+=m;g=g["return"]}while(g);g=h;a=jd(a);null===R&&(R=new Map);b={componentName:a,componentStack:g,error:b,errorBoundary:d?c.stateNode:null,errorBoundaryFound:d,errorBoundaryName:f,willRetry:e};R.set(c,b);try{var p=b.error;p&&p.suppressReactErrorLogging||console.error(p)}catch(Vc){Vc&&
-Vc.suppressReactErrorLogging||console.error(Vc)}Qb?(null===ha&&(ha=new Set),ha.add(c)):G(c);return c}null===ca&&(ca=b);return null}function k(a){return null!==R&&(R.has(a)||null!==a.alternate&&R.has(a.alternate))}function q(a){return null!==qa&&(qa.has(a)||null!==a.alternate&&qa.has(a.alternate))}function v(){return 20*(((I()+100)/20|0)+1)}function y(a){return 0!==ka?ka:ja?Qb?1:H:!Hg||a.internalContextTag&1?v():1}function u(a,b){return z(a,b,!1)}function z(a,b){for(;null!==a;){if(0===a.expirationTime||
-a.expirationTime>b)a.expirationTime=b;null!==a.alternate&&(0===a.alternate.expirationTime||a.alternate.expirationTime>b)&&(a.alternate.expirationTime=b);if(null===a["return"])if(3===a.tag){var c=a.stateNode;!ja&&c===ra&&b<H&&(F=ra=null,H=0);var d=c,e=b;Rb>Ig&&E("185");if(null===d.nextScheduledRoot)d.remainingExpirationTime=e,null===O?(sa=O=d,d.nextScheduledRoot=d):(O=O.nextScheduledRoot=d,O.nextScheduledRoot=sa);else{var f=d.remainingExpirationTime;if(0===f||e<f)d.remainingExpirationTime=e}Fa||(la?
-Sb&&(ma=d,na=1,m(ma,na)):1===e?w(1,null):L(e));!ja&&c===ra&&b<H&&(F=ra=null,H=0)}else break;a=a["return"]}}function G(a){z(a,1,!0)}function I(){return Uc=((Wc()-Pe)/10|0)+2}function L(a){if(0!==Tb){if(a>Tb)return;Jg(Xc)}var b=Wc()-Pe;Tb=a;Xc=Kg(J,{timeout:10*(a-2)-b})}function N(){var a=0,b=null;if(null!==O)for(var c=O,d=sa;null!==d;){var e=d.remainingExpirationTime;if(0===e){null===c||null===O?E("244"):void 0;if(d===d.nextScheduledRoot){sa=O=d.nextScheduledRoot=null;break}else if(d===sa)sa=e=d.nextScheduledRoot,
-O.nextScheduledRoot=e,d.nextScheduledRoot=null;else if(d===O){O=c;O.nextScheduledRoot=sa;d.nextScheduledRoot=null;break}else c.nextScheduledRoot=d.nextScheduledRoot,d.nextScheduledRoot=null;d=c.nextScheduledRoot}else{if(0===a||e<a)a=e,b=d;if(d===O)break;c=d;d=d.nextScheduledRoot}}c=ma;null!==c&&c===b?Rb++:Rb=0;ma=b;na=a}function J(a){w(0,a)}function w(a,b){fb=b;for(N();null!==ma&&0!==na&&(0===a||na<=a)&&!Yc;)m(ma,na),N();null!==fb&&(Tb=0,Xc=-1);0!==na&&L(na);fb=null;Yc=!1;Rb=0;if(Ub)throw a=Zc,Zc=
-null,Ub=!1,a;}function m(a,c){Fa?E("245"):void 0;Fa=!0;if(c<=I()){var d=a.finishedWork;null!==d?(a.finishedWork=null,a.remainingExpirationTime=b(d)):(a.finishedWork=null,d=g(a,c),null!==d&&(a.remainingExpirationTime=b(d)))}else d=a.finishedWork,null!==d?(a.finishedWork=null,a.remainingExpirationTime=b(d)):(a.finishedWork=null,d=g(a,c),null!==d&&(A()?a.finishedWork=d:a.remainingExpirationTime=b(d)));Fa=!1}function A(){return null===fb||fb.timeRemaining()>Lg?!1:Yc=!0}function Ob(a){null===ma?E("246"):
-void 0;ma.remainingExpirationTime=0;Ub||(Ub=!0,Zc=a)}var r=hf(a),n=jf(a),p=r.popHostContainer,qg=r.popHostContext,x=r.resetHostContainer,Me=df(a,r,n,u,y),rg=Me.beginWork,Gg=Me.beginFailedWork,Fg=ef(a,r,n).completeWork;r=ff(a,h);var zg=r.commitResetTextContent,Ne=r.commitPlacement,Bg=r.commitDeletion,Oe=r.commitWork,Dg=r.commitLifeCycles,Eg=r.commitAttachRef,Ag=r.commitDetachRef,Wc=a.now,Kg=a.scheduleDeferredCallback,Jg=a.cancelDeferredCallback,Hg=a.useSyncScheduling,yg=a.prepareForCommit,Cg=a.resetAfterCommit,
-Pe=Wc(),Uc=2,ka=0,ja=!1,F=null,ra=null,H=0,t=null,R=null,qa=null,ha=null,ca=null,eb=!1,Qb=!1,Sc=!1,sa=null,O=null,Tb=0,Xc=-1,Fa=!1,ma=null,na=0,Yc=!1,Ub=!1,Zc=null,fb=null,la=!1,Sb=!1,Ig=1E3,Rb=0,Lg=1;return{computeAsyncExpiration:v,computeExpirationForFiber:y,scheduleWork:u,batchedUpdates:function(a,b){var c=la;la=!0;try{return a(b)}finally{(la=c)||Fa||w(1,null)}},unbatchedUpdates:function(a){if(la&&!Sb){Sb=!0;try{return a()}finally{Sb=!1}}return a()},flushSync:function(a){var b=la;la=!0;try{a:{var c=
-ka;ka=1;try{var d=a();break a}finally{ka=c}d=void 0}return d}finally{la=b,Fa?E("187"):void 0,w(1,null)}},deferredUpdates:function(a){var b=ka;ka=v();try{return a()}finally{ka=b}}}}
-function lf(a){function b(a){a=od(a);return null===a?null:a.stateNode}var c=a.getPublicInstance;a=kf(a);var d=a.computeAsyncExpiration,e=a.computeExpirationForFiber,f=a.scheduleWork;return{createContainer:function(a,b){var c=new Y(3,null,0);a={current:c,containerInfo:a,pendingChildren:null,remainingExpirationTime:0,isReadyForCommit:!1,finishedWork:null,context:null,pendingContext:null,hydrate:b,nextScheduledRoot:null};return c.stateNode=a},updateContainer:function(a,b,c,q){var g=b.current;if(c){c=
-c._reactInternalFiber;var h;b:{2===kd(c)&&2===c.tag?void 0:E("170");for(h=c;3!==h.tag;){if(le(h)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break b}(h=h["return"])?void 0:E("171")}h=h.stateNode.context}c=le(c)?pe(c,h):h}else c=D;null===b.context?b.context=c:b.pendingContext=c;b=q;b=void 0===b?null:b;q=null!=a&&null!=a.type&&null!=a.type.prototype&&!0===a.type.prototype.unstable_isAsyncReactComponent?d():e(g);He(g,{expirationTime:q,partialState:{element:a},callback:b,isReplace:!1,isForced:!1,
-nextCallback:null,next:null});f(g,q)},batchedUpdates:a.batchedUpdates,unbatchedUpdates:a.unbatchedUpdates,deferredUpdates:a.deferredUpdates,flushSync:a.flushSync,getPublicRootInstance:function(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return c(a.child.stateNode);default:return a.child.stateNode}},findHostInstance:b,findHostInstanceWithNoPortals:function(a){a=pd(a);return null===a?null:a.stateNode},injectIntoDevTools:function(a){var c=a.findFiberByHostInstance;return Ce(B({},
-a,{findHostInstanceByFiber:function(a){return b(a)},findFiberByHostInstance:function(a){return c?c(a):null}}))}}}var mf=Object.freeze({default:lf}),nf=mf&&lf||mf,of=nf["default"]?nf["default"]:nf;function pf(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Ue,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}var qf="object"===typeof performance&&"function"===typeof performance.now,rf=void 0;rf=qf?function(){return performance.now()}:function(){return Date.now()};
-var sf=void 0,tf=void 0;
-if(l.canUseDOM)if("function"!==typeof requestIdleCallback||"function"!==typeof cancelIdleCallback){var uf=null,vf=!1,wf=-1,xf=!1,yf=0,zf=33,Af=33,Bf;Bf=qf?{didTimeout:!1,timeRemaining:function(){var a=yf-performance.now();return 0<a?a:0}}:{didTimeout:!1,timeRemaining:function(){var a=yf-Date.now();return 0<a?a:0}};var Cf="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(a){if(a.source===window&&a.data===Cf){vf=!1;a=rf();if(0>=yf-a)if(-1!==wf&&wf<=
-a)Bf.didTimeout=!0;else{xf||(xf=!0,requestAnimationFrame(Df));return}else Bf.didTimeout=!1;wf=-1;a=uf;uf=null;null!==a&&a(Bf)}},!1);var Df=function(a){xf=!1;var b=a-yf+Af;b<Af&&zf<Af?(8>b&&(b=8),Af=b<zf?zf:b):zf=b;yf=a+Af;vf||(vf=!0,window.postMessage(Cf,"*"))};sf=function(a,b){uf=a;null!=b&&"number"===typeof b.timeout&&(wf=rf()+b.timeout);xf||(xf=!0,requestAnimationFrame(Df));return 0};tf=function(){uf=null;vf=!1;wf=-1}}else sf=window.requestIdleCallback,tf=window.cancelIdleCallback;else sf=function(a){return setTimeout(function(){a({timeRemaining:function(){return Infinity}})})},
-tf=function(a){clearTimeout(a)};var Ef=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ff={},Gf={};
-function Hf(a){if(Gf.hasOwnProperty(a))return!0;if(Ff.hasOwnProperty(a))return!1;if(Ef.test(a))return Gf[a]=!0;Ff[a]=!0;return!1}
-function If(a,b,c){var d=wa(b);if(d&&va(b,c)){var e=d.mutationMethod;e?e(a,c):null==c||d.hasBooleanValue&&!c||d.hasNumericValue&&isNaN(c)||d.hasPositiveNumericValue&&1>c||d.hasOverloadedBooleanValue&&!1===c?Jf(a,b):d.mustUseProperty?a[d.propertyName]=c:(b=d.attributeName,(e=d.attributeNamespace)?a.setAttributeNS(e,b,""+c):d.hasBooleanValue||d.hasOverloadedBooleanValue&&!0===c?a.setAttribute(b,""):a.setAttribute(b,""+c))}else Kf(a,b,va(b,c)?c:null)}
-function Kf(a,b,c){Hf(b)&&(null==c?a.removeAttribute(b):a.setAttribute(b,""+c))}function Jf(a,b){var c=wa(b);c?(b=c.mutationMethod)?b(a,void 0):c.mustUseProperty?a[c.propertyName]=c.hasBooleanValue?!1:"":a.removeAttribute(c.attributeName):a.removeAttribute(b)}
-function Lf(a,b){var c=b.value,d=b.checked;return B({type:void 0,step:void 0,min:void 0,max:void 0},b,{defaultChecked:void 0,defaultValue:void 0,value:null!=c?c:a._wrapperState.initialValue,checked:null!=d?d:a._wrapperState.initialChecked})}function Mf(a,b){var c=b.defaultValue;a._wrapperState={initialChecked:null!=b.checked?b.checked:b.defaultChecked,initialValue:null!=b.value?b.value:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value}}
-function Nf(a,b){b=b.checked;null!=b&&If(a,"checked",b)}function Of(a,b){Nf(a,b);var c=b.value;if(null!=c)if(0===c&&""===a.value)a.value="0";else if("number"===b.type){if(b=parseFloat(a.value)||0,c!=b||c==b&&a.value!=c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);else null==b.value&&null!=b.defaultValue&&a.defaultValue!==""+b.defaultValue&&(a.defaultValue=""+b.defaultValue),null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}
-function Pf(a,b){switch(b.type){case "submit":case "reset":break;case "color":case "date":case "datetime":case "datetime-local":case "month":case "time":case "week":a.value="";a.value=a.defaultValue;break;default:a.value=a.value}b=a.name;""!==b&&(a.name="");a.defaultChecked=!a.defaultChecked;a.defaultChecked=!a.defaultChecked;""!==b&&(a.name=b)}function Qf(a){var b="";aa.Children.forEach(a,function(a){null==a||"string"!==typeof a&&"number"!==typeof a||(b+=a)});return b}
-function Rf(a,b){a=B({children:void 0},b);if(b=Qf(b.children))a.children=b;return a}function Sf(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0)}else{c=""+c;b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e])}null!==b&&(b.selected=!0)}}
-function Tf(a,b){var c=b.value;a._wrapperState={initialValue:null!=c?c:b.defaultValue,wasMultiple:!!b.multiple}}function Uf(a,b){null!=b.dangerouslySetInnerHTML?E("91"):void 0;return B({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Vf(a,b){var c=b.value;null==c&&(c=b.defaultValue,b=b.children,null!=b&&(null!=c?E("92"):void 0,Array.isArray(b)&&(1>=b.length?void 0:E("93"),b=b[0]),c=""+b),null==c&&(c=""));a._wrapperState={initialValue:""+c}}
-function Wf(a,b){var c=b.value;null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&(a.defaultValue=c));null!=b.defaultValue&&(a.defaultValue=b.defaultValue)}function Xf(a){var b=a.textContent;b===a._wrapperState.initialValue&&(a.value=b)}var Yf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
-function Zf(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function $f(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?Zf(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a}
-var ag=void 0,bg=function(a){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==Yf.svg||"innerHTML"in a)a.innerHTML=b;else{ag=ag||document.createElement("div");ag.innerHTML="\x3csvg\x3e"+b+"\x3c/svg\x3e";for(b=ag.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});
-function cg(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}
-var dg={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,
-stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},eg=["Webkit","ms","Moz","O"];Object.keys(dg).forEach(function(a){eg.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);dg[b]=dg[a]})});
-function fg(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--");var e=c;var f=b[c];e=null==f||"boolean"===typeof f||""===f?"":d||"number"!==typeof f||0===f||dg.hasOwnProperty(e)&&dg[e]?(""+f).trim():f+"px";"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e}}var gg=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});
-function hg(a,b,c){b&&(gg[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML?E("137",a,c()):void 0),null!=b.dangerouslySetInnerHTML&&(null!=b.children?E("60"):void 0,"object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML?void 0:E("61")),null!=b.style&&"object"!==typeof b.style?E("62",c()):void 0)}
-function ig(a,b){if(-1===a.indexOf("-"))return"string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return!1;default:return!0}}var jg=Yf.html,kg=C.thatReturns("");
-function lg(a,b){a=9===a.nodeType||11===a.nodeType?a:a.ownerDocument;var c=Hd(a);b=Sa[b];for(var d=0;d<b.length;d++){var e=b[d];c.hasOwnProperty(e)&&c[e]||("topScroll"===e?wd("topScroll","scroll",a):"topFocus"===e||"topBlur"===e?(wd("topFocus","focus",a),wd("topBlur","blur",a),c.topBlur=!0,c.topFocus=!0):"topCancel"===e?(yc("cancel",!0)&&wd("topCancel","cancel",a),c.topCancel=!0):"topClose"===e?(yc("close",!0)&&wd("topClose","close",a),c.topClose=!0):Dd.hasOwnProperty(e)&&U(e,Dd[e],a),c[e]=!0)}}
-var mg={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",
-topWaiting:"waiting"};function ng(a,b,c,d){c=9===c.nodeType?c:c.ownerDocument;d===jg&&(d=Zf(a));d===jg?"script"===a?(a=c.createElement("div"),a.innerHTML="\x3cscript\x3e\x3c/script\x3e",a=a.removeChild(a.firstChild)):a="string"===typeof b.is?c.createElement(a,{is:b.is}):c.createElement(a):a=c.createElementNS(d,a);return a}function og(a,b){return(9===b.nodeType?b:b.ownerDocument).createTextNode(a)}
-function pg(a,b,c,d){var e=ig(b,c);switch(b){case "iframe":case "object":U("topLoad","load",a);var f=c;break;case "video":case "audio":for(f in mg)mg.hasOwnProperty(f)&&U(f,mg[f],a);f=c;break;case "source":U("topError","error",a);f=c;break;case "img":case "image":U("topError","error",a);U("topLoad","load",a);f=c;break;case "form":U("topReset","reset",a);U("topSubmit","submit",a);f=c;break;case "details":U("topToggle","toggle",a);f=c;break;case "input":Mf(a,c);f=Lf(a,c);U("topInvalid","invalid",a);
-lg(d,"onChange");break;case "option":f=Rf(a,c);break;case "select":Tf(a,c);f=B({},c,{value:void 0});U("topInvalid","invalid",a);lg(d,"onChange");break;case "textarea":Vf(a,c);f=Uf(a,c);U("topInvalid","invalid",a);lg(d,"onChange");break;default:f=c}hg(b,f,kg);var g=f,h;for(h in g)if(g.hasOwnProperty(h)){var k=g[h];"style"===h?fg(a,k,kg):"dangerouslySetInnerHTML"===h?(k=k?k.__html:void 0,null!=k&&bg(a,k)):"children"===h?"string"===typeof k?("textarea"!==b||""!==k)&&cg(a,k):"number"===typeof k&&cg(a,
-""+k):"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&"autoFocus"!==h&&(Ra.hasOwnProperty(h)?null!=k&&lg(d,h):e?Kf(a,h,k):null!=k&&If(a,h,k))}switch(b){case "input":Bc(a);Pf(a,c);break;case "textarea":Bc(a);Xf(a,c);break;case "option":null!=c.value&&a.setAttribute("value",c.value);break;case "select":a.multiple=!!c.multiple;b=c.value;null!=b?Sf(a,!!c.multiple,b,!1):null!=c.defaultValue&&Sf(a,!!c.multiple,c.defaultValue,!0);break;default:"function"===typeof f.onClick&&(a.onclick=
-C)}}
-function sg(a,b,c,d,e){var f=null;switch(b){case "input":c=Lf(a,c);d=Lf(a,d);f=[];break;case "option":c=Rf(a,c);d=Rf(a,d);f=[];break;case "select":c=B({},c,{value:void 0});d=B({},d,{value:void 0});f=[];break;case "textarea":c=Uf(a,c);d=Uf(a,d);f=[];break;default:"function"!==typeof c.onClick&&"function"===typeof d.onClick&&(a.onclick=C)}hg(b,d,kg);var g,h;a=null;for(g in c)if(!d.hasOwnProperty(g)&&c.hasOwnProperty(g)&&null!=c[g])if("style"===g)for(h in b=c[g],b)b.hasOwnProperty(h)&&(a||(a={}),a[h]=
-"");else"dangerouslySetInnerHTML"!==g&&"children"!==g&&"suppressContentEditableWarning"!==g&&"suppressHydrationWarning"!==g&&"autoFocus"!==g&&(Ra.hasOwnProperty(g)?f||(f=[]):(f=f||[]).push(g,null));for(g in d){var k=d[g];b=null!=c?c[g]:void 0;if(d.hasOwnProperty(g)&&k!==b&&(null!=k||null!=b))if("style"===g)if(b){for(h in b)!b.hasOwnProperty(h)||k&&k.hasOwnProperty(h)||(a||(a={}),a[h]="");for(h in k)k.hasOwnProperty(h)&&b[h]!==k[h]&&(a||(a={}),a[h]=k[h])}else a||(f||(f=[]),f.push(g,a)),a=k;else"dangerouslySetInnerHTML"===
-g?(k=k?k.__html:void 0,b=b?b.__html:void 0,null!=k&&b!==k&&(f=f||[]).push(g,""+k)):"children"===g?b===k||"string"!==typeof k&&"number"!==typeof k||(f=f||[]).push(g,""+k):"suppressContentEditableWarning"!==g&&"suppressHydrationWarning"!==g&&(Ra.hasOwnProperty(g)?(null!=k&&lg(e,g),f||b===k||(f=[])):(f=f||[]).push(g,k))}a&&(f=f||[]).push("style",a);return f}
-function tg(a,b,c,d,e){"input"===c&&"radio"===e.type&&null!=e.name&&Nf(a,e);ig(c,d);d=ig(c,e);for(var f=0;f<b.length;f+=2){var g=b[f],h=b[f+1];"style"===g?fg(a,h,kg):"dangerouslySetInnerHTML"===g?bg(a,h):"children"===g?cg(a,h):d?null!=h?Kf(a,g,h):a.removeAttribute(g):null!=h?If(a,g,h):Jf(a,g)}switch(c){case "input":Of(a,e);break;case "textarea":Wf(a,e);break;case "select":a._wrapperState.initialValue=void 0,b=a._wrapperState.wasMultiple,a._wrapperState.wasMultiple=!!e.multiple,c=e.value,null!=c?Sf(a,
-!!e.multiple,c,!1):b!==!!e.multiple&&(null!=e.defaultValue?Sf(a,!!e.multiple,e.defaultValue,!0):Sf(a,!!e.multiple,e.multiple?[]:"",!1))}}
-function ug(a,b,c,d,e){switch(b){case "iframe":case "object":U("topLoad","load",a);break;case "video":case "audio":for(var f in mg)mg.hasOwnProperty(f)&&U(f,mg[f],a);break;case "source":U("topError","error",a);break;case "img":case "image":U("topError","error",a);U("topLoad","load",a);break;case "form":U("topReset","reset",a);U("topSubmit","submit",a);break;case "details":U("topToggle","toggle",a);break;case "input":Mf(a,c);U("topInvalid","invalid",a);lg(e,"onChange");break;case "select":Tf(a,c);
-U("topInvalid","invalid",a);lg(e,"onChange");break;case "textarea":Vf(a,c),U("topInvalid","invalid",a),lg(e,"onChange")}hg(b,c,kg);d=null;for(var g in c)c.hasOwnProperty(g)&&(f=c[g],"children"===g?"string"===typeof f?a.textContent!==f&&(d=["children",f]):"number"===typeof f&&a.textContent!==""+f&&(d=["children",""+f]):Ra.hasOwnProperty(g)&&null!=f&&lg(e,g));switch(b){case "input":Bc(a);Pf(a,c);break;case "textarea":Bc(a);Xf(a,c);break;case "select":case "option":break;default:"function"===typeof c.onClick&&
-(a.onclick=C)}return d}function vg(a,b){return a.nodeValue!==b}
-var wg=Object.freeze({createElement:ng,createTextNode:og,setInitialProperties:pg,diffProperties:sg,updateProperties:tg,diffHydratedProperties:ug,diffHydratedText:vg,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(a,b,c){switch(b){case "input":Of(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=
-c.parentNode;c=c.querySelectorAll("input[name\x3d"+JSON.stringify(""+b)+'][type\x3d"radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=rb(d);e?void 0:E("90");Cc(d);Of(d,e)}}}break;case "textarea":Wf(a,c);break;case "select":b=c.value,null!=b&&Sf(a,!!c.multiple,b,!1)}}});nc.injectFiberControlledHostComponent(wg);var xg=null,Mg=null;function Ng(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}
-function Og(a){a=a?9===a.nodeType?a.documentElement:a.firstChild:null;return!(!a||1!==a.nodeType||!a.hasAttribute("data-reactroot"))}
-var Z=of({getRootHostContext:function(a){var b=a.nodeType;switch(b){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:$f(null,"");break;default:b=8===b?a.parentNode:a,a=b.namespaceURI||null,b=b.tagName,a=$f(a,b)}return a},getChildHostContext:function(a,b){return $f(a,b)},getPublicInstance:function(a){return a},prepareForCommit:function(){xg=td;var a=da();if(Kd(a)){if("selectionStart"in a)var b={start:a.selectionStart,end:a.selectionEnd};else a:{var c=window.getSelection&&window.getSelection();
-if(c&&0!==c.rangeCount){b=c.anchorNode;var d=c.anchorOffset,e=c.focusNode;c=c.focusOffset;try{b.nodeType,e.nodeType}catch(z){b=null;break a}var f=0,g=-1,h=-1,k=0,q=0,v=a,y=null;b:for(;;){for(var u;;){v!==b||0!==d&&3!==v.nodeType||(g=f+d);v!==e||0!==c&&3!==v.nodeType||(h=f+c);3===v.nodeType&&(f+=v.nodeValue.length);if(null===(u=v.firstChild))break;y=v;v=u}for(;;){if(v===a)break b;y===b&&++k===d&&(g=f);y===e&&++q===c&&(h=f);if(null!==(u=v.nextSibling))break;v=y;y=v.parentNode}v=u}b=-1===g||-1===h?null:
-{start:g,end:h}}else b=null}b=b||{start:0,end:0}}else b=null;Mg={focusedElem:a,selectionRange:b};ud(!1)},resetAfterCommit:function(){var a=Mg,b=da(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&fa(document.documentElement,c)){if(Kd(c))if(b=d.start,a=d.end,void 0===a&&(a=b),"selectionStart"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(window.getSelection){b=window.getSelection();var e=c[Eb()].length;a=Math.min(d.start,e);d=void 0===d.end?a:Math.min(d.end,e);!b.extend&&a>
-d&&(e=d,d=a,a=e);e=Jd(c,a);var f=Jd(c,d);if(e&&f&&(1!==b.rangeCount||b.anchorNode!==e.node||b.anchorOffset!==e.offset||b.focusNode!==f.node||b.focusOffset!==f.offset)){var g=document.createRange();g.setStart(e.node,e.offset);b.removeAllRanges();a>d?(b.addRange(g),b.extend(f.node,f.offset)):(g.setEnd(f.node,f.offset),b.addRange(g))}}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});ia(c);for(c=0;c<b.length;c++)a=b[c],a.element.scrollLeft=a.left,a.element.scrollTop=
-a.top}Mg=null;ud(xg);xg=null},createInstance:function(a,b,c,d,e){a=ng(a,b,c,d);a[Q]=e;a[ob]=b;return a},appendInitialChild:function(a,b){a.appendChild(b)},finalizeInitialChildren:function(a,b,c,d){pg(a,b,c,d);a:{switch(b){case "button":case "input":case "select":case "textarea":a=!!c.autoFocus;break a}a=!1}return a},prepareUpdate:function(a,b,c,d,e){return sg(a,b,c,d,e)},shouldSetTextContent:function(a,b){return"textarea"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===
-typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&"string"===typeof b.dangerouslySetInnerHTML.__html},shouldDeprioritizeSubtree:function(a,b){return!!b.hidden},createTextInstance:function(a,b,c,d){a=og(a,b);a[Q]=d;return a},now:rf,mutation:{commitMount:function(a){a.focus()},commitUpdate:function(a,b,c,d,e){a[ob]=e;tg(a,b,c,d,e)},resetTextContent:function(a){a.textContent=""},commitTextUpdate:function(a,b,c){a.nodeValue=c},appendChild:function(a,b){a.appendChild(b)},appendChildToContainer:function(a,
-b){8===a.nodeType?a.parentNode.insertBefore(b,a):a.appendChild(b)},insertBefore:function(a,b,c){a.insertBefore(b,c)},insertInContainerBefore:function(a,b,c){8===a.nodeType?a.parentNode.insertBefore(b,c):a.insertBefore(b,c)},removeChild:function(a,b){a.removeChild(b)},removeChildFromContainer:function(a,b){8===a.nodeType?a.parentNode.removeChild(b):a.removeChild(b)}},hydration:{canHydrateInstance:function(a,b){return 1!==a.nodeType||b.toLowerCase()!==a.nodeName.toLowerCase()?null:a},canHydrateTextInstance:function(a,
-b){return""===b||3!==a.nodeType?null:a},getNextHydratableSibling:function(a){for(a=a.nextSibling;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a},getFirstHydratableChild:function(a){for(a=a.firstChild;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a},hydrateInstance:function(a,b,c,d,e,f){a[Q]=f;a[ob]=c;return ug(a,b,c,e,d)},hydrateTextInstance:function(a,b,c){a[Q]=c;return vg(a,b)},didNotMatchHydratedContainerTextInstance:function(){},didNotMatchHydratedTextInstance:function(){},
-didNotHydrateContainerInstance:function(){},didNotHydrateInstance:function(){},didNotFindHydratableContainerInstance:function(){},didNotFindHydratableContainerTextInstance:function(){},didNotFindHydratableInstance:function(){},didNotFindHydratableTextInstance:function(){}},scheduleDeferredCallback:sf,cancelDeferredCallback:tf,useSyncScheduling:!0});rc=Z.batchedUpdates;
-function Pg(a,b,c,d,e){Ng(c)?void 0:E("200");var f=c._reactRootContainer;if(f)Z.updateContainer(b,f,a,e);else{d=d||Og(c);if(!d)for(f=void 0;f=c.lastChild;)c.removeChild(f);var g=Z.createContainer(c,d);f=c._reactRootContainer=g;Z.unbatchedUpdates(function(){Z.updateContainer(b,g,a,e)})}return Z.getPublicRootInstance(f)}function Qg(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;Ng(b)?void 0:E("200");return pf(a,b,null,c)}
-function Rg(a,b){this._reactRootContainer=Z.createContainer(a,b)}Rg.prototype.render=function(a,b){Z.updateContainer(a,this._reactRootContainer,null,b)};Rg.prototype.unmount=function(a){Z.updateContainer(null,this._reactRootContainer,null,a)};
-var Sg={createPortal:Qg,findDOMNode:function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternalFiber;if(b)return Z.findHostInstance(b);"function"===typeof a.render?E("188"):E("213",Object.keys(a))},hydrate:function(a,b,c){return Pg(null,a,b,!0,c)},render:function(a,b,c){return Pg(null,a,b,!1,c)},unstable_renderSubtreeIntoContainer:function(a,b,c,d){null==a||void 0===a._reactInternalFiber?E("38"):void 0;return Pg(a,b,c,!1,d)},unmountComponentAtNode:function(a){Ng(a)?void 0:
-E("40");return a._reactRootContainer?(Z.unbatchedUpdates(function(){Pg(null,null,a,!1,function(){a._reactRootContainer=null})}),!0):!1},unstable_createPortal:Qg,unstable_batchedUpdates:tc,unstable_deferredUpdates:Z.deferredUpdates,flushSync:Z.flushSync,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:mb,EventPluginRegistry:Va,EventPropagators:Cb,ReactControlledComponent:qc,ReactDOMComponentTree:sb,ReactDOMEventListener:xd}};
-Z.injectIntoDevTools({findFiberByHostInstance:pb,bundleType:0,version:"16.2.0",rendererPackageName:"react-dom"});var Tg=Object.freeze({default:Sg}),Ug=Tg&&Sg||Tg;module.exports=Ug["default"]?Ug["default"]:Ug;
+'use strict';var aa=require("react"),n=require("object-assign"),ba=require("schedule");function ca(a,b,c,d,e,f,g,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[c,d,e,f,g,h],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
+function t(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)c+="&args[]="+encodeURIComponent(arguments[d+1]);ca(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}aa?void 0:t("227");function da(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l)}catch(m){this.onError(m)}}
+var ea=!1,fa=null,ha=!1,ia=null,ja={onError:function(a){ea=!0;fa=a}};function ka(a,b,c,d,e,f,g,h,k){ea=!1;fa=null;da.apply(ja,arguments)}function la(a,b,c,d,e,f,g,h,k){ka.apply(this,arguments);if(ea){if(ea){var l=fa;ea=!1;fa=null}else t("198"),l=void 0;ha||(ha=!0,ia=l)}}var ma=null,na={};
+function oa(){if(ma)for(var a in na){var b=na[a],c=ma.indexOf(a);-1<c?void 0:t("96",a);if(!pa[c]){b.extractEvents?void 0:t("97",a);pa[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],g=b,h=d;qa.hasOwnProperty(h)?t("99",h):void 0;qa[h]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&ra(k[e],g,h);e=!0}else f.registrationName?(ra(f.registrationName,g,h),e=!0):e=!1;e?void 0:t("98",d,a)}}}}
+function ra(a,b,c){sa[a]?t("100",a):void 0;sa[a]=b;ta[a]=b.eventTypes[c].dependencies}var pa=[],qa={},sa={},ta={},ua=null,va=null,wa=null;function xa(a,b,c,d){b=a.type||"unknown-event";a.currentTarget=wa(d);la(b,c,void 0,a);a.currentTarget=null}function ya(a,b){null==b?t("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}
+function za(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}var Aa=null;function Ba(a,b){if(a){var c=a._dispatchListeners,d=a._dispatchInstances;if(Array.isArray(c))for(var e=0;e<c.length&&!a.isPropagationStopped();e++)xa(a,b,c[e],d[e]);else c&&xa(a,b,c,d);a._dispatchListeners=null;a._dispatchInstances=null;a.isPersistent()||a.constructor.release(a)}}function Ca(a){return Ba(a,!0)}function Da(a){return Ba(a,!1)}
+var Ea={injectEventPluginOrder:function(a){ma?t("101"):void 0;ma=Array.prototype.slice.call(a);oa()},injectEventPluginsByName:function(a){var b=!1,c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];na.hasOwnProperty(c)&&na[c]===d||(na[c]?t("102",c):void 0,na[c]=d,b=!0)}b&&oa()}};
+function Fa(a,b){var c=a.stateNode;if(!c)return null;var d=ua(c);if(!d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?t("231",b,typeof c):void 0;
+return c}function Ga(a,b){null!==a&&(Aa=ya(Aa,a));a=Aa;Aa=null;if(a&&(b?za(a,Ca):za(a,Da),Aa?t("95"):void 0,ha))throw b=ia,ha=!1,ia=null,b;}var Ha=Math.random().toString(36).slice(2),Ia="__reactInternalInstance$"+Ha,Ja="__reactEventHandlers$"+Ha;function Ka(a){if(a[Ia])return a[Ia];for(;!a[Ia];)if(a.parentNode)a=a.parentNode;else return null;a=a[Ia];return 7===a.tag||8===a.tag?a:null}function La(a){a=a[Ia];return!a||7!==a.tag&&8!==a.tag?null:a}
+function Ma(a){if(7===a.tag||8===a.tag)return a.stateNode;t("33")}function Na(a){return a[Ja]||null}function Oa(a){do a=a.return;while(a&&7!==a.tag);return a?a:null}function Pa(a,b,c){if(b=Fa(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a)}
+function Qa(a){if(a&&a.dispatchConfig.phasedRegistrationNames){for(var b=a._targetInst,c=[];b;)c.push(b),b=Oa(b);for(b=c.length;0<b--;)Pa(c[b],"captured",a);for(b=0;b<c.length;b++)Pa(c[b],"bubbled",a)}}function Ra(a,b,c){a&&c&&c.dispatchConfig.registrationName&&(b=Fa(a,c.dispatchConfig.registrationName))&&(c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a))}function Ta(a){a&&a.dispatchConfig.registrationName&&Ra(a._targetInst,null,a)}
+function Ua(a){za(a,Qa)}var Va=!("undefined"===typeof window||!window.document||!window.document.createElement);function Wa(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Ya={animationend:Wa("Animation","AnimationEnd"),animationiteration:Wa("Animation","AnimationIteration"),animationstart:Wa("Animation","AnimationStart"),transitionend:Wa("Transition","TransitionEnd")},Za={},$a={};
+Va&&($a=document.createElement("div").style,"AnimationEvent"in window||(delete Ya.animationend.animation,delete Ya.animationiteration.animation,delete Ya.animationstart.animation),"TransitionEvent"in window||delete Ya.transitionend.transition);function ab(a){if(Za[a])return Za[a];if(!Ya[a])return a;var b=Ya[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in $a)return Za[a]=b[c];return a}
+var bb=ab("animationend"),cb=ab("animationiteration"),db=ab("animationstart"),eb=ab("transitionend"),fb="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gb=null,hb=null,ib=null;
+function jb(){if(ib)return ib;var a,b=hb,c=b.length,d,e="value"in gb?gb.value:gb.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return ib=e.slice(a,1<d?1-d:void 0)}function kb(){return!0}function lb(){return!1}
+function z(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?kb:lb;this.isPropagationStopped=lb;return this}
+n(z.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=kb)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=kb)},persist:function(){this.isPersistent=kb},isPersistent:lb,destructor:function(){var a=this.constructor.Interface,
+b;for(b in a)this[b]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=lb;this._dispatchInstances=this._dispatchListeners=null}});z.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
+z.extend=function(a){function b(){}function c(){return d.apply(this,arguments)}var d=this;b.prototype=d.prototype;var e=new b;n(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=n({},d.Interface,a);c.extend=d.extend;mb(c);return c};mb(z);function nb(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}function ob(a){a instanceof this?void 0:t("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}
+function mb(a){a.eventPool=[];a.getPooled=nb;a.release=ob}var pb=z.extend({data:null}),qb=z.extend({data:null}),rb=[9,13,27,32],sb=Va&&"CompositionEvent"in window,tb=null;Va&&"documentMode"in document&&(tb=document.documentMode);
+var ub=Va&&"TextEvent"in window&&!tb,vb=Va&&(!sb||tb&&8<tb&&11>=tb),wb=String.fromCharCode(32),xb={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",
+captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},yb=!1;
+function zb(a,b){switch(a){case "keyup":return-1!==rb.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "blur":return!0;default:return!1}}function Ab(a){a=a.detail;return"object"===typeof a&&"data"in a?a.data:null}var Bb=!1;function Cb(a,b){switch(a){case "compositionend":return Ab(b);case "keypress":if(32!==b.which)return null;yb=!0;return wb;case "textInput":return a=b.data,a===wb&&yb?null:a;default:return null}}
+function Db(a,b){if(Bb)return"compositionend"===a||!sb&&zb(a,b)?(a=jb(),ib=hb=gb=null,Bb=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "compositionend":return vb&&"ko"!==b.locale?null:b.data;default:return null}}
+var Eb={eventTypes:xb,extractEvents:function(a,b,c,d){var e=void 0;var f=void 0;if(sb)b:{switch(a){case "compositionstart":e=xb.compositionStart;break b;case "compositionend":e=xb.compositionEnd;break b;case "compositionupdate":e=xb.compositionUpdate;break b}e=void 0}else Bb?zb(a,c)&&(e=xb.compositionEnd):"keydown"===a&&229===c.keyCode&&(e=xb.compositionStart);e?(vb&&"ko"!==c.locale&&(Bb||e!==xb.compositionStart?e===xb.compositionEnd&&Bb&&(f=jb()):(gb=d,hb="value"in gb?gb.value:gb.textContent,Bb=
+!0)),e=pb.getPooled(e,b,c,d),f?e.data=f:(f=Ab(c),null!==f&&(e.data=f)),Ua(e),f=e):f=null;(a=ub?Cb(a,c):Db(a,c))?(b=qb.getPooled(xb.beforeInput,b,c,d),b.data=a,Ua(b)):b=null;return null===f?b:null===b?f:[f,b]}},Fb=null,Gb=null,Hb=null;function Ib(a){if(a=va(a)){"function"!==typeof Fb?t("280"):void 0;var b=ua(a.stateNode);Fb(a.stateNode,a.type,b)}}function Jb(a){Gb?Hb?Hb.push(a):Hb=[a]:Gb=a}function Kb(){if(Gb){var a=Gb,b=Hb;Hb=Gb=null;Ib(a);if(b)for(a=0;a<b.length;a++)Ib(b[a])}}
+function Lb(a,b){return a(b)}function Mb(a,b,c){return a(b,c)}function Nb(){}var Ob=!1;function Pb(a,b){if(Ob)return a(b);Ob=!0;try{return Lb(a,b)}finally{if(Ob=!1,null!==Gb||null!==Hb)Nb(),Kb()}}var Qb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rb(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!Qb[a.type]:"textarea"===b?!0:!1}
+function Sb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}function Tb(a){if(!Va)return!1;a="on"+a;var b=a in document;b||(b=document.createElement("div"),b.setAttribute(a,"return;"),b="function"===typeof b[a]);return b}function Ub(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)}
+function Vb(a){var b=Ub(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker=
+null;delete a[b]}}}}function Wb(a){a._valueTracker||(a._valueTracker=Vb(a))}function Xb(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=Ub(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}
+var Yb=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zb=/^(.*)[\\\/]/,C="function"===typeof Symbol&&Symbol.for,$b=C?Symbol.for("react.element"):60103,ac=C?Symbol.for("react.portal"):60106,bc=C?Symbol.for("react.fragment"):60107,cc=C?Symbol.for("react.strict_mode"):60108,dc=C?Symbol.for("react.profiler"):60114,ec=C?Symbol.for("react.provider"):60109,fc=C?Symbol.for("react.context"):60110,gc=C?Symbol.for("react.async_mode"):60111,hc=C?Symbol.for("react.forward_ref"):60112,ic=C?Symbol.for("react.placeholder"):
+60113,jc="function"===typeof Symbol&&Symbol.iterator;function kc(a){if(null===a||"object"!==typeof a)return null;a=jc&&a[jc]||a["@@iterator"];return"function"===typeof a?a:null}
+function lc(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case gc:return"AsyncMode";case bc:return"Fragment";case ac:return"Portal";case dc:return"Profiler";case cc:return"StrictMode";case ic:return"Placeholder"}if("object"===typeof a){switch(a.$$typeof){case fc:return"Context.Consumer";case ec:return"Context.Provider";case hc:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":
+"ForwardRef")}if("function"===typeof a.then&&(a=1===a._reactStatus?a._reactResult:null))return lc(a)}return null}function mc(a){var b="";do{a:switch(a.tag){case 4:case 0:case 1:case 2:case 3:case 7:case 10:var c=a._debugOwner,d=a._debugSource,e=lc(a.type);var f=null;c&&(f=lc(c.type));c=e;e="";d?e=" (at "+d.fileName.replace(Zb,"")+":"+d.lineNumber+")":f&&(e=" (created by "+f+")");f="\n in "+(c||"Unknown")+e;break a;default:f=""}b+=f;a=a.return}while(a);return b}
+var nc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pc=Object.prototype.hasOwnProperty,qc={},rc={};
+function sc(a){if(pc.call(rc,a))return!0;if(pc.call(qc,a))return!1;if(nc.test(a))return rc[a]=!0;qc[a]=!0;return!1}function tc(a,b,c,d){if(null!==c&&0===c.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(d)return!1;if(null!==c)return!c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}}
+function uc(a,b,c,d){if(null===b||"undefined"===typeof b||tc(a,b,c,d))return!0;if(d)return!1;if(null!==c)switch(c.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function D(a,b,c,d,e){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b}var E={};
+"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){E[a]=new D(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];E[b]=new D(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){E[a]=new D(a,2,!1,a.toLowerCase(),null)});
+["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){E[a]=new D(a,2,!1,a,null)});"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){E[a]=new D(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){E[a]=new D(a,3,!0,a,null)});
+["capture","download"].forEach(function(a){E[a]=new D(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){E[a]=new D(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){E[a]=new D(a,5,!1,a.toLowerCase(),null)});var vc=/[\-:]([a-z])/g;function wc(a){return a[1].toUpperCase()}
+"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(vc,
+wc);E[b]=new D(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(vc,wc);E[b]=new D(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(vc,wc);E[b]=new D(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});E.tabIndex=new D("tabIndex",1,!1,"tabindex",null);
+function xc(a,b,c,d){var e=E.hasOwnProperty(b)?E[b]:null;var f=null!==e?0===e.type:d?!1:!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1]?!1:!0;f||(uc(b,c,e,d)&&(c=null),d||null===e?sc(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&!0===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))))}
+function yc(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return""}}function zc(a,b){var c=b.checked;return n({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}
+function Bc(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=yc(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value}}function Cc(a,b){b=b.checked;null!=b&&xc(a,"checked",b,!1)}
+function Dc(a,b){Cc(a,b);var c=yc(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?Ec(a,b.type,c):b.hasOwnProperty("defaultValue")&&Ec(a,b.type,yc(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}
+function Fc(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;""!==c&&(a.name="");a.defaultChecked=!a.defaultChecked;a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c)}
+function Ec(a,b,c){if("number"!==b||a.ownerDocument.activeElement!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c)}var Gc={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Hc(a,b,c){a=z.getPooled(Gc.change,a,b,c);a.type="change";Jb(c);Ua(a);return a}var Ic=null,Jc=null;function Kc(a){Ga(a,!1)}
+function Lc(a){var b=Ma(a);if(Xb(b))return a}function Mc(a,b){if("change"===a)return b}var Nc=!1;Va&&(Nc=Tb("input")&&(!document.documentMode||9<document.documentMode));function Oc(){Ic&&(Ic.detachEvent("onpropertychange",Pc),Jc=Ic=null)}function Pc(a){"value"===a.propertyName&&Lc(Jc)&&(a=Hc(Jc,a,Sb(a)),Pb(Kc,a))}function Qc(a,b,c){"focus"===a?(Oc(),Ic=b,Jc=c,Ic.attachEvent("onpropertychange",Pc)):"blur"===a&&Oc()}function Rc(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return Lc(Jc)}
+function Sc(a,b){if("click"===a)return Lc(b)}function Tc(a,b){if("input"===a||"change"===a)return Lc(b)}
+var Uc={eventTypes:Gc,_isInputEventSupported:Nc,extractEvents:function(a,b,c,d){var e=b?Ma(b):window,f=void 0,g=void 0,h=e.nodeName&&e.nodeName.toLowerCase();"select"===h||"input"===h&&"file"===e.type?f=Mc:Rb(e)?Nc?f=Tc:(f=Rc,g=Qc):(h=e.nodeName)&&"input"===h.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)&&(f=Sc);if(f&&(f=f(a,b)))return Hc(f,c,d);g&&g(a,e,b);"blur"===a&&(a=e._wrapperState)&&a.controlled&&"number"===e.type&&Ec(e,"number",e.value)}},Vc=z.extend({view:null,detail:null}),Wc={Alt:"altKey",
+Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xc(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Wc[a])?!!b[a]:!1}function Yc(){return Xc}
+var Zc=0,$c=0,ad=!1,bd=!1,cd=Vc.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Yc,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)},movementX:function(a){if("movementX"in a)return a.movementX;var b=Zc;Zc=a.screenX;return ad?"mousemove"===a.type?a.screenX-b:0:(ad=!0,0)},movementY:function(a){if("movementY"in a)return a.movementY;
+var b=$c;$c=a.screenY;return bd?"mousemove"===a.type?a.screenY-b:0:(bd=!0,0)}}),dd=cd.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),ed={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",
+dependencies:["pointerout","pointerover"]}},fd={eventTypes:ed,extractEvents:function(a,b,c,d){var e="mouseover"===a||"pointerover"===a,f="mouseout"===a||"pointerout"===a;if(e&&(c.relatedTarget||c.fromElement)||!f&&!e)return null;e=d.window===d?d:(e=d.ownerDocument)?e.defaultView||e.parentWindow:window;f?(f=b,b=(b=c.relatedTarget||c.toElement)?Ka(b):null):f=null;if(f===b)return null;var g=void 0,h=void 0,k=void 0,l=void 0;if("mouseout"===a||"mouseover"===a)g=cd,h=ed.mouseLeave,k=ed.mouseEnter,l="mouse";
+else if("pointerout"===a||"pointerover"===a)g=dd,h=ed.pointerLeave,k=ed.pointerEnter,l="pointer";var m=null==f?e:Ma(f);e=null==b?e:Ma(b);a=g.getPooled(h,f,c,d);a.type=l+"leave";a.target=m;a.relatedTarget=e;c=g.getPooled(k,b,c,d);c.type=l+"enter";c.target=e;c.relatedTarget=m;d=b;if(f&&d)a:{b=f;e=d;l=0;for(g=b;g;g=Oa(g))l++;g=0;for(k=e;k;k=Oa(k))g++;for(;0<l-g;)b=Oa(b),l--;for(;0<g-l;)e=Oa(e),g--;for(;l--;){if(b===e||b===e.alternate)break a;b=Oa(b);e=Oa(e)}b=null}else b=null;e=b;for(b=[];f&&f!==e;){l=
+f.alternate;if(null!==l&&l===e)break;b.push(f);f=Oa(f)}for(f=[];d&&d!==e;){l=d.alternate;if(null!==l&&l===e)break;f.push(d);d=Oa(d)}for(d=0;d<b.length;d++)Ra(b[d],"bubbled",a);for(d=f.length;0<d--;)Ra(f[d],"captured",c);return[a,c]}},gd=Object.prototype.hasOwnProperty;function hd(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}
+function id(a,b){if(hd(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++)if(!gd.call(b,c[d])||!hd(a[c[d]],b[c[d]]))return!1;return!0}function jd(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 5===b.tag?2:3}function kd(a){2!==jd(a)?t("188"):void 0}
+function ld(a){var b=a.alternate;if(!b)return b=jd(a),3===b?t("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c.return,f=e?e.alternate:null;if(!e||!f)break;if(e.child===f.child){for(var g=e.child;g;){if(g===c)return kd(e),a;if(g===d)return kd(e),b;g=g.sibling}t("188")}if(c.return!==d.return)c=e,d=f;else{g=!1;for(var h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}g?
+void 0:t("189")}}c.alternate!==d?t("190"):void 0}5!==c.tag?t("188"):void 0;return c.stateNode.current===c?a:b}function md(a){a=ld(a);if(!a)return null;for(var b=a;;){if(7===b.tag||8===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}}return null}
+var nd=z.extend({animationName:null,elapsedTime:null,pseudoElement:null}),od=z.extend({clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),pd=Vc.extend({relatedTarget:null});function qd(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}
+var rd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",
+116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},td=Vc.extend({key:function(a){if(a.key){var b=rd[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=qd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?sd[a.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Yc,charCode:function(a){return"keypress"===
+a.type?qd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===a.type?qd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),ud=cd.extend({dataTransfer:null}),vd=Vc.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Yc}),wd=z.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),xd=cd.extend({deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in
+a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:null,deltaMode:null}),yd=[["abort","abort"],[bb,"animationEnd"],[cb,"animationIteration"],[db,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],
+["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],
+["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[eb,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],zd={},Ad={};function Bd(a,b){var c=a[0];a=a[1];var d="on"+(a[0].toUpperCase()+a.slice(1));b={phasedRegistrationNames:{bubbled:d,captured:d+"Capture"},dependencies:[c],isInteractive:b};zd[a]=b;Ad[c]=b}
+[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],
+["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(a){Bd(a,!0)});yd.forEach(function(a){Bd(a,!1)});
+var Cd={eventTypes:zd,isInteractiveTopLevelEventType:function(a){a=Ad[a];return void 0!==a&&!0===a.isInteractive},extractEvents:function(a,b,c,d){var e=Ad[a];if(!e)return null;switch(a){case "keypress":if(0===qd(c))return null;case "keydown":case "keyup":a=td;break;case "blur":case "focus":a=pd;break;case "click":if(2===c.button)return null;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":a=cd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":a=
+ud;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":a=vd;break;case bb:case cb:case db:a=nd;break;case eb:a=wd;break;case "scroll":a=Vc;break;case "wheel":a=xd;break;case "copy":case "cut":case "paste":a=od;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":a=dd;break;default:a=z}b=a.getPooled(e,b,c,d);Ua(b);return b}},Dd=Cd.isInteractiveTopLevelEventType,
+Ed=[];function Fd(a){var b=a.targetInst,c=b;do{if(!c){a.ancestors.push(c);break}var d;for(d=c;d.return;)d=d.return;d=5!==d.tag?null:d.stateNode.containerInfo;if(!d)break;a.ancestors.push(c);c=Ka(d)}while(c);for(c=0;c<a.ancestors.length;c++){b=a.ancestors[c];var e=Sb(a.nativeEvent);d=a.topLevelType;for(var f=a.nativeEvent,g=null,h=0;h<pa.length;h++){var k=pa[h];k&&(k=k.extractEvents(d,b,f,e))&&(g=ya(g,k))}Ga(g,!1)}}var Gd=!0;
+function F(a,b){if(!b)return null;var c=(Dd(a)?Hd:Id).bind(null,a);b.addEventListener(a,c,!1)}function Jd(a,b){if(!b)return null;var c=(Dd(a)?Hd:Id).bind(null,a);b.addEventListener(a,c,!0)}function Hd(a,b){Mb(Id,a,b)}
+function Id(a,b){if(Gd){var c=Sb(b);c=Ka(c);null===c||"number"!==typeof c.tag||2===jd(c)||(c=null);if(Ed.length){var d=Ed.pop();d.topLevelType=a;d.nativeEvent=b;d.targetInst=c;a=d}else a={topLevelType:a,nativeEvent:b,targetInst:c,ancestors:[]};try{Pb(Fd,a)}finally{a.topLevelType=null,a.nativeEvent=null,a.targetInst=null,a.ancestors.length=0,10>Ed.length&&Ed.push(a)}}}var Kd={},Ld=0,Md="_reactListenersID"+(""+Math.random()).slice(2);
+function Nd(a){Object.prototype.hasOwnProperty.call(a,Md)||(a[Md]=Ld++,Kd[a[Md]]={});return Kd[a[Md]]}function Od(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}function Qd(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
+function Rd(a,b){var c=Qd(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Qd(c)}}function Sd(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Sd(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}
+function Td(){for(var a=window,b=Od();b instanceof a.HTMLIFrameElement;){try{a=b.contentDocument.defaultView}catch(c){break}b=Od(a.document)}return b}function Ud(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)}
+var Vd=Va&&"documentMode"in document&&11>=document.documentMode,Wd={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Xd=null,Yd=null,Zd=null,$d=!1;
+function ae(a,b){var c=b.window===b?b.document:9===b.nodeType?b:b.ownerDocument;if($d||null==Xd||Xd!==Od(c))return null;c=Xd;"selectionStart"in c&&Ud(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset});return Zd&&id(Zd,c)?null:(Zd=c,a=z.getPooled(Wd.select,Yd,a,b),a.type="select",a.target=Xd,Ua(a),a)}
+var be={eventTypes:Wd,extractEvents:function(a,b,c,d){var e=d.window===d?d.document:9===d.nodeType?d:d.ownerDocument,f;if(!(f=!e)){a:{e=Nd(e);f=ta.onSelect;for(var g=0;g<f.length;g++){var h=f[g];if(!e.hasOwnProperty(h)||!e[h]){e=!1;break a}}e=!0}f=!e}if(f)return null;e=b?Ma(b):window;switch(a){case "focus":if(Rb(e)||"true"===e.contentEditable)Xd=e,Yd=b,Zd=null;break;case "blur":Zd=Yd=Xd=null;break;case "mousedown":$d=!0;break;case "contextmenu":case "mouseup":case "dragend":return $d=!1,ae(c,d);case "selectionchange":if(Vd)break;
+case "keydown":case "keyup":return ae(c,d)}return null}};Ea.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));ua=Na;va=La;wa=Ma;Ea.injectEventPluginsByName({SimpleEventPlugin:Cd,EnterLeaveEventPlugin:fd,ChangeEventPlugin:Uc,SelectEventPlugin:be,BeforeInputEventPlugin:Eb});function ce(a){var b="";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}
+function de(a,b){a=n({children:void 0},b);if(b=ce(b.children))a.children=b;return a}function ee(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0)}else{c=""+yc(c);b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e])}null!==b&&(b.selected=!0)}}
+function fe(a,b){null!=b.dangerouslySetInnerHTML?t("91"):void 0;return n({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function ge(a,b){var c=b.value;null==c&&(c=b.defaultValue,b=b.children,null!=b&&(null!=c?t("92"):void 0,Array.isArray(b)&&(1>=b.length?void 0:t("93"),b=b[0]),c=b),null==c&&(c=""));a._wrapperState={initialValue:yc(c)}}
+function he(a,b){var c=yc(b.value),d=yc(b.defaultValue);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=""+d)}function ie(a){var b=a.textContent;b===a._wrapperState.initialValue&&(a.value=b)}var je={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
+function ke(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?ke(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a}
+var me=void 0,ne=function(a){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==je.svg||"innerHTML"in a)a.innerHTML=b;else{me=me||document.createElement("div");me.innerHTML="<svg>"+b+"</svg>";for(b=me.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});
+function oe(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}
+var pe={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,
+floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qe=["Webkit","ms","Moz","O"];Object.keys(pe).forEach(function(a){qe.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pe[b]=pe[a]})});
+function re(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--");var e=c;var f=b[c];e=null==f||"boolean"===typeof f||""===f?"":d||"number"!==typeof f||0===f||pe.hasOwnProperty(e)&&pe[e]?(""+f).trim():f+"px";"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e}}var se=n({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});
+function te(a,b){b&&(se[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML?t("137",a,""):void 0),null!=b.dangerouslySetInnerHTML&&(null!=b.children?t("60"):void 0,"object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML?void 0:t("61")),null!=b.style&&"object"!==typeof b.style?t("62",""):void 0)}
+function ue(a,b){if(-1===a.indexOf("-"))return"string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return!1;default:return!0}}
+function ve(a,b){a=9===a.nodeType||11===a.nodeType?a:a.ownerDocument;var c=Nd(a);b=ta[b];for(var d=0;d<b.length;d++){var e=b[d];if(!c.hasOwnProperty(e)||!c[e]){switch(e){case "scroll":Jd("scroll",a);break;case "focus":case "blur":Jd("focus",a);Jd("blur",a);c.blur=!0;c.focus=!0;break;case "cancel":case "close":Tb(e)&&Jd(e,a);break;case "invalid":case "submit":case "reset":break;default:-1===fb.indexOf(e)&&F(e,a)}c[e]=!0}}}function we(){}var xe=null,ye=null;
+function ze(a,b){switch(a){case "button":case "input":case "select":case "textarea":return!!b.autoFocus}return!1}function Ae(a,b){return"textarea"===a||"option"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}function Be(a){for(a=a.nextSibling;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a}
+function Ce(a){for(a=a.firstChild;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a}new Set;var De=[],Ee=-1;function G(a){0>Ee||(a.current=De[Ee],De[Ee]=null,Ee--)}function H(a,b){Ee++;De[Ee]=a.current;a.current=b}var Fe={},I={current:Fe},J={current:!1},Ge=Fe;
+function He(a,b){var c=a.type.contextTypes;if(!c)return Fe;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function K(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Ie(a){G(J,a);G(I,a)}function Je(a){G(J,a);G(I,a)}
+function Ke(a,b,c){I.current!==Fe?t("168"):void 0;H(I,b,a);H(J,c,a)}function Le(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)e in a?void 0:t("108",lc(b)||"Unknown",e);return n({},c,d)}function Me(a){var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||Fe;Ge=I.current;H(I,b,a);H(J,J.current,a);return!0}
+function Ne(a,b,c){var d=a.stateNode;d?void 0:t("169");c?(b=Le(a,b,Ge),d.__reactInternalMemoizedMergedChildContext=b,G(J,a),G(I,a),H(I,b,a)):G(J,a);H(J,c,a)}var Oe=null,Pe=null;function Qe(a){return function(b){try{return a(b)}catch(c){}}}
+function Re(a){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)return!0;try{var c=b.inject(a);Oe=Qe(function(a){return b.onCommitFiberRoot(c,a)});Pe=Qe(function(a){return b.onCommitFiberUnmount(c,a)})}catch(d){}return!0}
+function Se(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=null;this.index=0;this.ref=null;this.pendingProps=b;this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.effectTag=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childExpirationTime=this.expirationTime=0;this.alternate=null}function Te(a){a=a.prototype;return!(!a||!a.isReactComponent)}
+function Ue(a,b,c){var d=a.alternate;null===d?(d=new Se(a.tag,b,a.key,a.mode),d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=b,d.effectTag=0,d.nextEffect=null,d.firstEffect=null,d.lastEffect=null);d.childExpirationTime=a.childExpirationTime;d.expirationTime=b!==a.pendingProps?c:a.expirationTime;d.child=a.child;d.memoizedProps=a.memoizedProps;d.memoizedState=a.memoizedState;d.updateQueue=a.updateQueue;d.firstContextDependency=a.firstContextDependency;d.sibling=a.sibling;
+d.index=a.index;d.ref=a.ref;return d}
+function Ve(a,b,c){var d=a.type,e=a.key;a=a.props;var f=void 0;if("function"===typeof d)f=Te(d)?2:4;else if("string"===typeof d)f=7;else a:switch(d){case bc:return We(a.children,b,c,e);case gc:f=10;b|=3;break;case cc:f=10;b|=2;break;case dc:return d=new Se(15,a,e,b|4),d.type=dc,d.expirationTime=c,d;case ic:f=16;break;default:if("object"===typeof d&&null!==d)switch(d.$$typeof){case ec:f=12;break a;case fc:f=11;break a;case hc:f=13;break a;default:if("function"===typeof d.then){f=4;break a}}t("130",
+null==d?d:typeof d,"")}b=new Se(f,a,e,b);b.type=d;b.expirationTime=c;return b}function We(a,b,c,d){a=new Se(9,a,d,b);a.expirationTime=c;return a}function Xe(a,b,c){a=new Se(8,a,null,b);a.expirationTime=c;return a}function Ye(a,b,c){b=new Se(6,null!==a.children?a.children:[],a.key,b);b.expirationTime=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}
+function Ze(a,b){a.didError=!1;var c=a.earliestPendingTime;0===c?a.earliestPendingTime=a.latestPendingTime=b:c>b?a.earliestPendingTime=b:a.latestPendingTime<b&&(a.latestPendingTime=b);$e(b,a)}function $e(a,b){var c=b.earliestSuspendedTime,d=b.latestSuspendedTime,e=b.earliestPendingTime,f=b.latestPingedTime;e=0!==e?e:f;0===e&&(0===a||d>a)&&(e=d);a=e;0!==a&&0!==c&&c<a&&(a=c);b.nextExpirationTimeToWorkOn=e;b.expirationTime=a}var af=!1;
+function bf(a){return{baseState:a,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function cf(a){return{baseState:a.baseState,firstUpdate:a.firstUpdate,lastUpdate:a.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}
+function df(a){return{expirationTime:a,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function ef(a,b){null===a.lastUpdate?a.firstUpdate=a.lastUpdate=b:(a.lastUpdate.next=b,a.lastUpdate=b)}
+function ff(a,b){var c=a.alternate;if(null===c){var d=a.updateQueue;var e=null;null===d&&(d=a.updateQueue=bf(a.memoizedState))}else d=a.updateQueue,e=c.updateQueue,null===d?null===e?(d=a.updateQueue=bf(a.memoizedState),e=c.updateQueue=bf(c.memoizedState)):d=a.updateQueue=cf(e):null===e&&(e=c.updateQueue=cf(d));null===e||d===e?ef(d,b):null===d.lastUpdate||null===e.lastUpdate?(ef(d,b),ef(e,b)):(ef(d,b),e.lastUpdate=b)}
+function gf(a,b){var c=a.updateQueue;c=null===c?a.updateQueue=bf(a.memoizedState):hf(a,c);null===c.lastCapturedUpdate?c.firstCapturedUpdate=c.lastCapturedUpdate=b:(c.lastCapturedUpdate.next=b,c.lastCapturedUpdate=b)}function hf(a,b){var c=a.alternate;null!==c&&b===c.updateQueue&&(b=a.updateQueue=cf(b));return b}
+function jf(a,b,c,d,e,f){switch(c.tag){case 1:return a=c.payload,"function"===typeof a?a.call(f,d,e):a;case 3:a.effectTag=a.effectTag&-1025|64;case 0:a=c.payload;e="function"===typeof a?a.call(f,d,e):a;if(null===e||void 0===e)break;return n({},d,e);case 2:af=!0}return d}
+function kf(a,b,c,d,e){af=!1;b=hf(a,b);for(var f=b.baseState,g=null,h=0,k=b.firstUpdate,l=f;null!==k;){var m=k.expirationTime;if(m>e){if(null===g&&(g=k,f=l),0===h||h>m)h=m}else l=jf(a,b,k,l,c,d),null!==k.callback&&(a.effectTag|=32,k.nextEffect=null,null===b.lastEffect?b.firstEffect=b.lastEffect=k:(b.lastEffect.nextEffect=k,b.lastEffect=k));k=k.next}m=null;for(k=b.firstCapturedUpdate;null!==k;){var r=k.expirationTime;if(r>e){if(null===m&&(m=k,null===g&&(f=l)),0===h||h>r)h=r}else l=jf(a,b,k,l,c,d),
+null!==k.callback&&(a.effectTag|=32,k.nextEffect=null,null===b.lastCapturedEffect?b.firstCapturedEffect=b.lastCapturedEffect=k:(b.lastCapturedEffect.nextEffect=k,b.lastCapturedEffect=k));k=k.next}null===g&&(b.lastUpdate=null);null===m?b.lastCapturedUpdate=null:a.effectTag|=32;null===g&&null===m&&(f=l);b.baseState=f;b.firstUpdate=g;b.firstCapturedUpdate=m;a.expirationTime=h;a.memoizedState=l}
+function lf(a,b,c){null!==b.firstCapturedUpdate&&(null!==b.lastUpdate&&(b.lastUpdate.next=b.firstCapturedUpdate,b.lastUpdate=b.lastCapturedUpdate),b.firstCapturedUpdate=b.lastCapturedUpdate=null);mf(b.firstEffect,c);b.firstEffect=b.lastEffect=null;mf(b.firstCapturedEffect,c);b.firstCapturedEffect=b.lastCapturedEffect=null}function mf(a,b){for(;null!==a;){var c=a.callback;if(null!==c){a.callback=null;var d=b;"function"!==typeof c?t("191",c):void 0;c.call(d)}a=a.nextEffect}}
+function nf(a,b){return{value:a,source:b,stack:mc(b)}}var of={current:null},pf=null,qf=null,rf=null;function sf(a,b){var c=a.type._context;H(of,c._currentValue,a);c._currentValue=b}function tf(a){var b=of.current;G(of,a);a.type._context._currentValue=b}function uf(a){pf=a;rf=qf=null;a.firstContextDependency=null}
+function vf(a,b){if(rf!==a&&!1!==b&&0!==b){if("number"!==typeof b||1073741823===b)rf=a,b=1073741823;b={context:a,observedBits:b,next:null};null===qf?(null===pf?t("277"):void 0,pf.firstContextDependency=qf=b):qf=qf.next=b}return a._currentValue}var wf={},L={current:wf},xf={current:wf},yf={current:wf};function zf(a){a===wf?t("174"):void 0;return a}
+function Af(a,b){H(yf,b,a);H(xf,a,a);H(L,wf,a);var c=b.nodeType;switch(c){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:le(null,"");break;default:c=8===c?b.parentNode:b,b=c.namespaceURI||null,c=c.tagName,b=le(b,c)}G(L,a);H(L,b,a)}function Bf(a){G(L,a);G(xf,a);G(yf,a)}function Cf(a){zf(yf.current);var b=zf(L.current);var c=le(b,a.type);b!==c&&(H(xf,a,a),H(L,c,a))}function Df(a){xf.current===a&&(G(L,a),G(xf,a))}var Ef=(new aa.Component).refs;
+function Ff(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:n({},b,c);a.memoizedState=c;d=a.updateQueue;null!==d&&0===a.expirationTime&&(d.baseState=c)}
+var Jf={isMounted:function(a){return(a=a._reactInternalFiber)?2===jd(a):!1},enqueueSetState:function(a,b,c){a=a._reactInternalFiber;var d=Gf();d=Hf(d,a);var e=df(d);e.payload=b;void 0!==c&&null!==c&&(e.callback=c);ff(a,e);If(a,d)},enqueueReplaceState:function(a,b,c){a=a._reactInternalFiber;var d=Gf();d=Hf(d,a);var e=df(d);e.tag=1;e.payload=b;void 0!==c&&null!==c&&(e.callback=c);ff(a,e);If(a,d)},enqueueForceUpdate:function(a,b){a=a._reactInternalFiber;var c=Gf();c=Hf(c,a);var d=df(c);d.tag=2;void 0!==
+b&&null!==b&&(d.callback=b);ff(a,d);If(a,c)}};function Kf(a,b,c,d,e,f,g){a=a.stateNode;return"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!id(c,d)||!id(e,f):!0}function Lf(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Jf.enqueueReplaceState(b,b.state,null)}
+function Mf(a,b,c,d){var e=a.stateNode,f=K(b)?Ge:I.current;e.props=c;e.state=a.memoizedState;e.refs=Ef;e.context=He(a,f);f=a.updateQueue;null!==f&&(kf(a,f,c,e,d),e.state=a.memoizedState);f=b.getDerivedStateFromProps;"function"===typeof f&&(Ff(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(b=e.state,"function"===typeof e.componentWillMount&&
+e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Jf.enqueueReplaceState(e,e.state,null),f=a.updateQueue,null!==f&&(kf(a,f,c,e,d),e.state=a.memoizedState));"function"===typeof e.componentDidMount&&(a.effectTag|=4)}var Nf=Array.isArray;
+function Of(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;var d=void 0;c&&(2!==c.tag&&3!==c.tag?t("110"):void 0,d=c.stateNode);d?void 0:t("147",a);var e=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs;b===Ef&&(b=d.refs={});null===a?delete b[e]:b[e]=a};b._stringRef=e;return b}"string"!==typeof a?t("284"):void 0;c._owner?void 0:t("254",a)}return a}
+function Pf(a,b){"textarea"!==a.type&&t("31","[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b,"")}
+function Qf(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.effectTag=8}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b,c){a=Ue(a,b,c);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.effectTag=
+2,c):d;b.effectTag=2;return c}function g(b){a&&null===b.alternate&&(b.effectTag=2);return b}function h(a,b,c,d){if(null===b||8!==b.tag)return b=Xe(c,a.mode,d),b.return=a,b;b=e(b,c,d);b.return=a;return b}function k(a,b,c,d){if(null!==b&&b.type===c.type)return d=e(b,c.props,d),d.ref=Of(a,b,c),d.return=a,d;d=Ve(c,a.mode,d);d.ref=Of(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||6!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=
+Ye(c,a.mode,d),b.return=a,b;b=e(b,c.children||[],d);b.return=a;return b}function m(a,b,c,d,f){if(null===b||9!==b.tag)return b=We(c,a.mode,d,f),b.return=a,b;b=e(b,c,d);b.return=a;return b}function r(a,b,c){if("string"===typeof b||"number"===typeof b)return b=Xe(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case $b:return c=Ve(b,a.mode,c),c.ref=Of(a,null,b),c.return=a,c;case ac:return b=Ye(b,a.mode,c),b.return=a,b}if(Nf(b)||kc(b))return b=We(b,a.mode,c,null),b.return=
+a,b;Pf(a,b)}return null}function A(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case $b:return c.key===e?c.type===bc?m(a,b,c.props.children,d,e):k(a,b,c,d):null;case ac:return c.key===e?l(a,b,c,d):null}if(Nf(c)||kc(c))return null!==e?null:m(a,b,c,d,null);Pf(a,c)}return null}function S(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||null,h(b,a,""+d,e);
+if("object"===typeof d&&null!==d){switch(d.$$typeof){case $b:return a=a.get(null===d.key?c:d.key)||null,d.type===bc?m(b,a,d.props.children,e,d.key):k(b,a,d,e);case ac:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e)}if(Nf(d)||kc(d))return a=a.get(c)||null,m(b,a,d,e,null);Pf(b,d)}return null}function B(e,g,h,k){for(var l=null,m=null,p=g,u=g=0,q=null;null!==p&&u<h.length;u++){p.index>u?(q=p,p=null):q=p.sibling;var v=A(e,p,h[u],k);if(null===v){null===p&&(p=q);break}a&&p&&null===v.alternate&&b(e,
+p);g=f(v,g,u);null===m?l=v:m.sibling=v;m=v;p=q}if(u===h.length)return c(e,p),l;if(null===p){for(;u<h.length;u++)if(p=r(e,h[u],k))g=f(p,g,u),null===m?l=p:m.sibling=p,m=p;return l}for(p=d(e,p);u<h.length;u++)if(q=S(p,e,u,h[u],k))a&&null!==q.alternate&&p.delete(null===q.key?u:q.key),g=f(q,g,u),null===m?l=q:m.sibling=q,m=q;a&&p.forEach(function(a){return b(e,a)});return l}function P(e,g,h,k){var l=kc(h);"function"!==typeof l?t("150"):void 0;h=l.call(h);null==h?t("151"):void 0;for(var m=l=null,p=g,u=g=
+0,q=null,v=h.next();null!==p&&!v.done;u++,v=h.next()){p.index>u?(q=p,p=null):q=p.sibling;var x=A(e,p,v.value,k);if(null===x){p||(p=q);break}a&&p&&null===x.alternate&&b(e,p);g=f(x,g,u);null===m?l=x:m.sibling=x;m=x;p=q}if(v.done)return c(e,p),l;if(null===p){for(;!v.done;u++,v=h.next())v=r(e,v.value,k),null!==v&&(g=f(v,g,u),null===m?l=v:m.sibling=v,m=v);return l}for(p=d(e,p);!v.done;u++,v=h.next())v=S(p,e,u,v.value,k),null!==v&&(a&&null!==v.alternate&&p.delete(null===v.key?u:v.key),g=f(v,g,u),null===
+m?l=v:m.sibling=v,m=v);a&&p.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k="object"===typeof f&&null!==f&&f.type===bc&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case $b:a:{l=f.key;for(k=d;null!==k;){if(k.key===l)if(9===k.tag?f.type===bc:k.type===f.type){c(a,k.sibling);d=e(k,f.type===bc?f.props.children:f.props,h);d.ref=Of(a,k,f);d.return=a;a=d;break a}else{c(a,k);break}else b(a,k);k=k.sibling}f.type===bc?(d=We(f.props.children,
+a.mode,h,f.key),d.return=a,a=d):(h=Ve(f,a.mode,h),h.ref=Of(a,d,f),h.return=a,a=h)}return g(a);case ac:a:{for(k=f.key;null!==d;){if(d.key===k)if(6===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[],h);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Ye(f,a.mode,h);d.return=a;a=d}return g(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&8===d.tag?(c(a,d.sibling),d=e(d,f,h),d.return=
+a,a=d):(c(a,d),d=Xe(f,a.mode,h),d.return=a,a=d),g(a);if(Nf(f))return B(a,d,f,h);if(kc(f))return P(a,d,f,h);l&&Pf(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 2:case 3:case 0:h=a.type,t("152",h.displayName||h.name||"Component")}return c(a,d)}}var Rf=Qf(!0),Sf=Qf(!1),Tf=null,Uf=null,Vf=!1;function Wf(a,b){var c=new Se(7,null,null,0);c.type="DELETED";c.stateNode=b;c.return=a;c.effectTag=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}
+function Xf(a,b){switch(a.tag){case 7:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 8:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;default:return!1}}function Yf(a){if(Vf){var b=Uf;if(b){var c=b;if(!Xf(a,b)){b=Be(c);if(!b||!Xf(a,b)){a.effectTag|=2;Vf=!1;Tf=a;return}Wf(Tf,c)}Tf=a;Uf=Ce(b)}else a.effectTag|=2,Vf=!1,Tf=a}}
+function Zf(a){for(a=a.return;null!==a&&7!==a.tag&&5!==a.tag;)a=a.return;Tf=a}function $f(a){if(a!==Tf)return!1;if(!Vf)return Zf(a),Vf=!0,!1;var b=a.type;if(7!==a.tag||"head"!==b&&"body"!==b&&!Ae(b,a.memoizedProps))for(b=Uf;b;)Wf(a,b),b=Be(b);Zf(a);Uf=Tf?Be(a.stateNode):null;return!0}function ag(){Uf=Tf=null;Vf=!1}
+function bg(a){switch(a._reactStatus){case 1:return a._reactResult;case 2:throw a._reactResult;case 0:throw a;default:throw a._reactStatus=0,a.then(function(b){if(0===a._reactStatus){a._reactStatus=1;if("object"===typeof b&&null!==b){var c=b.default;b=void 0!==c&&null!==c?c:b}a._reactResult=b}},function(b){0===a._reactStatus&&(a._reactStatus=2,a._reactResult=b)}),a;}}var cg=Yb.ReactCurrentOwner;function M(a,b,c,d){b.child=null===a?Sf(b,null,c,d):Rf(b,a.child,c,d)}
+function dg(a,b,c,d,e){c=c.render;var f=b.ref;if(!J.current&&b.memoizedProps===d&&f===(null!==a?a.ref:null))return eg(a,b,e);c=c(d,f);M(a,b,c,e);b.memoizedProps=d;return b.child}function fg(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.effectTag|=128}function gg(a,b,c,d,e){var f=K(c)?Ge:I.current;f=He(b,f);uf(b,e);c=c(d,f);b.effectTag|=1;M(a,b,c,e);b.memoizedProps=d;return b.child}
+function hg(a,b,c,d,e){if(K(c)){var f=!0;Me(b)}else f=!1;uf(b,e);if(null===a)if(null===b.stateNode){var g=K(c)?Ge:I.current,h=c.contextTypes,k=null!==h&&void 0!==h;h=k?He(b,g):Fe;var l=new c(d,h);b.memoizedState=null!==l.state&&void 0!==l.state?l.state:null;l.updater=Jf;b.stateNode=l;l._reactInternalFiber=b;k&&(k=b.stateNode,k.__reactInternalMemoizedUnmaskedChildContext=g,k.__reactInternalMemoizedMaskedChildContext=h);Mf(b,c,d,e);d=!0}else{g=b.stateNode;h=b.memoizedProps;g.props=h;var m=g.context;
+k=K(c)?Ge:I.current;k=He(b,k);var r=c.getDerivedStateFromProps;(l="function"===typeof r||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||m!==k)&&Lf(b,g,d,k);af=!1;var A=b.memoizedState;m=g.state=A;var S=b.updateQueue;null!==S&&(kf(b,S,d,g,e),m=b.memoizedState);h!==d||A!==m||J.current||af?("function"===typeof r&&(Ff(b,c,r,d),m=b.memoizedState),(h=af||Kf(b,c,h,d,A,m,k))?(l||"function"!==
+typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.effectTag|=4)):("function"===typeof g.componentDidMount&&(b.effectTag|=4),b.memoizedProps=d,b.memoizedState=m),g.props=d,g.state=m,g.context=k,d=h):("function"===typeof g.componentDidMount&&(b.effectTag|=4),d=!1)}else g=b.stateNode,h=
+b.memoizedProps,g.props=h,m=g.context,k=K(c)?Ge:I.current,k=He(b,k),r=c.getDerivedStateFromProps,(l="function"===typeof r||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||m!==k)&&Lf(b,g,d,k),af=!1,m=b.memoizedState,A=g.state=m,S=b.updateQueue,null!==S&&(kf(b,S,d,g,e),A=b.memoizedState),h!==d||m!==A||J.current||af?("function"===typeof r&&(Ff(b,c,r,d),A=b.memoizedState),(r=af||Kf(b,c,h,d,
+m,A,k))?(l||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,A,k),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,A,k)),"function"===typeof g.componentDidUpdate&&(b.effectTag|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.effectTag|=256)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=4),"function"!==
+typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=256),b.memoizedProps=d,b.memoizedState=A),g.props=d,g.state=A,g.context=k,d=r):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=256),d=!1);return ig(a,b,c,d,f,e)}
+function ig(a,b,c,d,e,f){fg(a,b);var g=0!==(b.effectTag&64);if(!d&&!g)return e&&Ne(b,c,!1),eg(a,b,f);d=b.stateNode;cg.current=b;var h=g?null:d.render();b.effectTag|=1;null!==a&&g&&(M(a,b,null,f),b.child=null);M(a,b,h,f);b.memoizedState=d.state;b.memoizedProps=d.props;e&&Ne(b,c,!0);return b.child}function jg(a){var b=a.stateNode;b.pendingContext?Ke(a,b.pendingContext,b.pendingContext!==b.context):b.context&&Ke(a,b.context,!1);Af(a,b.containerInfo)}
+function ng(a,b){if(a&&a.defaultProps){b=n({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c])}return b}
+function og(a,b,c,d){null!==a?t("155"):void 0;var e=b.pendingProps;if("object"===typeof c&&null!==c&&"function"===typeof c.then){c=bg(c);var f=c;f="function"===typeof f?Te(f)?3:1:void 0!==f&&null!==f&&f.$$typeof?14:4;f=b.tag=f;var g=ng(c,e);switch(f){case 1:return gg(a,b,c,g,d);case 3:return hg(a,b,c,g,d);case 14:return dg(a,b,c,g,d);default:t("283",c)}}f=He(b,I.current);uf(b,d);f=c(e,f);b.effectTag|=1;if("object"===typeof f&&null!==f&&"function"===typeof f.render&&void 0===f.$$typeof){b.tag=2;K(c)?
+(g=!0,Me(b)):g=!1;b.memoizedState=null!==f.state&&void 0!==f.state?f.state:null;var h=c.getDerivedStateFromProps;"function"===typeof h&&Ff(b,c,h,e);f.updater=Jf;b.stateNode=f;f._reactInternalFiber=b;Mf(b,c,e,d);return ig(a,b,c,!0,g,d)}b.tag=0;M(a,b,f,d);b.memoizedProps=e;return b.child}
+function eg(a,b,c){null!==a&&(b.firstContextDependency=a.firstContextDependency);var d=b.childExpirationTime;if(0===d||d>c)return null;null!==a&&b.child!==a.child?t("153"):void 0;if(null!==b.child){a=b.child;c=Ue(a,a.pendingProps,a.expirationTime);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Ue(a,a.pendingProps,a.expirationTime),c.return=b;c.sibling=null}return b.child}
+function pg(a,b,c){var d=b.expirationTime;if(!J.current&&(0===d||d>c)){switch(b.tag){case 5:jg(b);ag();break;case 7:Cf(b);break;case 2:K(b.type)&&Me(b);break;case 3:K(b.type._reactResult)&&Me(b);break;case 6:Af(b,b.stateNode.containerInfo);break;case 12:sf(b,b.memoizedProps.value)}return eg(a,b,c)}b.expirationTime=0;switch(b.tag){case 4:return og(a,b,b.type,c);case 0:return gg(a,b,b.type,b.pendingProps,c);case 1:var e=b.type._reactResult;d=b.pendingProps;a=gg(a,b,e,ng(e,d),c);b.memoizedProps=d;return a;
+case 2:return hg(a,b,b.type,b.pendingProps,c);case 3:return e=b.type._reactResult,d=b.pendingProps,a=hg(a,b,e,ng(e,d),c),b.memoizedProps=d,a;case 5:jg(b);d=b.updateQueue;null===d?t("282"):void 0;e=b.memoizedState;e=null!==e?e.element:null;kf(b,d,b.pendingProps,null,c);d=b.memoizedState.element;if(d===e)ag(),b=eg(a,b,c);else{e=b.stateNode;if(e=(null===a||null===a.child)&&e.hydrate)Uf=Ce(b.stateNode.containerInfo),Tf=b,e=Vf=!0;e?(b.effectTag|=2,b.child=Sf(b,null,d,c)):(M(a,b,d,c),ag());b=b.child}return b;
+case 7:Cf(b);null===a&&Yf(b);d=b.type;e=b.pendingProps;var f=null!==a?a.memoizedProps:null,g=e.children;Ae(d,e)?g=null:null!==f&&Ae(d,f)&&(b.effectTag|=16);fg(a,b);1073741823!==c&&b.mode&1&&e.hidden?(b.expirationTime=1073741823,b.memoizedProps=e,b=null):(M(a,b,g,c),b.memoizedProps=e,b=b.child);return b;case 8:return null===a&&Yf(b),b.memoizedProps=b.pendingProps,null;case 16:return null;case 6:return Af(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Rf(b,null,d,c):M(a,b,d,c),b.memoizedProps=
+d,b.child;case 13:return dg(a,b,b.type,b.pendingProps,c);case 14:return e=b.type._reactResult,d=b.pendingProps,a=dg(a,b,e,ng(e,d),c),b.memoizedProps=d,a;case 9:return d=b.pendingProps,M(a,b,d,c),b.memoizedProps=d,b.child;case 10:return d=b.pendingProps.children,M(a,b,d,c),b.memoizedProps=d,b.child;case 15:return d=b.pendingProps,M(a,b,d.children,c),b.memoizedProps=d,b.child;case 12:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;b.memoizedProps=e;sf(b,f);if(null!==g){var h=g.value;
+f=h===f&&(0!==h||1/h===1/f)||h!==h&&f!==f?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0;if(0===f){if(g.children===e.children&&!J.current){b=eg(a,b,c);break a}}else for(g=b.child,null!==g&&(g.return=b);null!==g;){h=g.firstContextDependency;if(null!==h){do{if(h.context===d&&0!==(h.observedBits&f)){if(2===g.tag||3===g.tag){var k=df(c);k.tag=2;ff(g,k)}if(0===g.expirationTime||g.expirationTime>c)g.expirationTime=c;k=g.alternate;null!==k&&(0===k.expirationTime||
+k.expirationTime>c)&&(k.expirationTime=c);for(var l=g.return;null!==l;){k=l.alternate;if(0===l.childExpirationTime||l.childExpirationTime>c)l.childExpirationTime=c,null!==k&&(0===k.childExpirationTime||k.childExpirationTime>c)&&(k.childExpirationTime=c);else if(null!==k&&(0===k.childExpirationTime||k.childExpirationTime>c))k.childExpirationTime=c;else break;l=l.return}}k=g.child;h=h.next}while(null!==h)}else k=12===g.tag?g.type===b.type?null:g.child:g.child;if(null!==k)k.return=g;else for(k=g;null!==
+k;){if(k===b){k=null;break}g=k.sibling;if(null!==g){g.return=k.return;k=g;break}k=k.return}g=k}}M(a,b,e.children,c);b=b.child}return b;case 11:return f=b.type,d=b.pendingProps,e=d.children,uf(b,c),f=vf(f,d.unstable_observedBits),e=e(f),b.effectTag|=1,M(a,b,e,c),b.memoizedProps=d,b.child;default:t("156")}}function qg(a){a.effectTag|=4}var rg=void 0,sg=void 0,tg=void 0;rg=function(){};
+sg=function(a,b,c,d,e){var f=a.memoizedProps;if(f!==d){var g=b.stateNode;zf(L.current);a=null;switch(c){case "input":f=zc(g,f);d=zc(g,d);a=[];break;case "option":f=de(g,f);d=de(g,d);a=[];break;case "select":f=n({},f,{value:void 0});d=n({},d,{value:void 0});a=[];break;case "textarea":f=fe(g,f);d=fe(g,d);a=[];break;default:"function"!==typeof f.onClick&&"function"===typeof d.onClick&&(g.onclick=we)}te(c,d);g=c=void 0;var h=null;for(c in f)if(!d.hasOwnProperty(c)&&f.hasOwnProperty(c)&&null!=f[c])if("style"===
+c){var k=f[c];for(g in k)k.hasOwnProperty(g)&&(h||(h={}),h[g]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(sa.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in d){var l=d[c];k=null!=f?f[c]:void 0;if(d.hasOwnProperty(c)&&l!==k&&(null!=l||null!=k))if("style"===c)if(k){for(g in k)!k.hasOwnProperty(g)||l&&l.hasOwnProperty(g)||(h||(h={}),h[g]="");for(g in l)l.hasOwnProperty(g)&&k[g]!==l[g]&&(h||
+(h={}),h[g]=l[g])}else h||(a||(a=[]),a.push(c,h)),h=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,k=k?k.__html:void 0,null!=l&&k!==l&&(a=a||[]).push(c,""+l)):"children"===c?k===l||"string"!==typeof l&&"number"!==typeof l||(a=a||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(sa.hasOwnProperty(c)?(null!=l&&ve(e,c),a||k===l||(a=[])):(a=a||[]).push(c,l))}h&&(a=a||[]).push("style",h);e=a;(b.updateQueue=e)&&qg(b)}};tg=function(a,b,c,d){c!==d&&qg(b)};
+function ug(a,b){var c=b.source,d=b.stack;null===d&&null!==c&&(d=mc(c));null!==c&&lc(c.type);b=b.value;null!==a&&2===a.tag&&lc(a.type);try{console.error(b)}catch(e){setTimeout(function(){throw e;})}}function vg(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null)}catch(c){wg(a,c)}else b.current=null}
+function xg(a){"function"===typeof Pe&&Pe(a);switch(a.tag){case 2:case 3:vg(a);var b=a.stateNode;if("function"===typeof b.componentWillUnmount)try{b.props=a.memoizedProps,b.state=a.memoizedState,b.componentWillUnmount()}catch(c){wg(a,c)}break;case 7:vg(a);break;case 6:yg(a)}}function zg(a){return 7===a.tag||5===a.tag||6===a.tag}
+function Ag(a){a:{for(var b=a.return;null!==b;){if(zg(b)){var c=b;break a}b=b.return}t("160");c=void 0}var d=b=void 0;switch(c.tag){case 7:b=c.stateNode;d=!1;break;case 5:b=c.stateNode.containerInfo;d=!0;break;case 6:b=c.stateNode.containerInfo;d=!0;break;default:t("161")}c.effectTag&16&&(oe(b,""),c.effectTag&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||zg(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;7!==c.tag&&8!==c.tag;){if(c.effectTag&2)continue b;
+if(null===c.child||6===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.effectTag&2)){c=c.stateNode;break a}}for(var e=a;;){if(7===e.tag||8===e.tag)if(c)if(d){var f=b,g=e.stateNode,h=c;8===f.nodeType?f.parentNode.insertBefore(g,h):f.insertBefore(g,h)}else b.insertBefore(e.stateNode,c);else d?(f=b,g=e.stateNode,8===f.nodeType?(h=f.parentNode,h.insertBefore(g,f)):(h=f,h.appendChild(g)),null===h.onclick&&(h.onclick=we)):b.appendChild(e.stateNode);else if(6!==e.tag&&null!==e.child){e.child.return=
+e;e=e.child;continue}if(e===a)break;for(;null===e.sibling;){if(null===e.return||e.return===a)return;e=e.return}e.sibling.return=e.return;e=e.sibling}}
+function yg(a){for(var b=a,c=!1,d=void 0,e=void 0;;){if(!c){c=b.return;a:for(;;){null===c?t("160"):void 0;switch(c.tag){case 7:d=c.stateNode;e=!1;break a;case 5:d=c.stateNode.containerInfo;e=!0;break a;case 6:d=c.stateNode.containerInfo;e=!0;break a}c=c.return}c=!0}if(7===b.tag||8===b.tag){a:for(var f=b,g=f;;)if(xg(g),null!==g.child&&6!==g.tag)g.child.return=g,g=g.child;else{if(g===f)break;for(;null===g.sibling;){if(null===g.return||g.return===f)break a;g=g.return}g.sibling.return=g.return;g=g.sibling}e?
+(f=d,g=b.stateNode,8===f.nodeType?f.parentNode.removeChild(g):f.removeChild(g)):d.removeChild(b.stateNode)}else if(6===b.tag?(d=b.stateNode.containerInfo,e=!0):xg(b),null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return;b=b.return;6===b.tag&&(c=!1)}b.sibling.return=b.return;b=b.sibling}}
+function Bg(a,b){switch(b.tag){case 2:case 3:break;case 7:var c=b.stateNode;if(null!=c){var d=b.memoizedProps,e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[Ja]=d;"input"===a&&"radio"===d.type&&null!=d.name&&Cc(c,d);ue(a,e);b=ue(a,d);for(e=0;e<f.length;e+=2){var g=f[e],h=f[e+1];"style"===g?re(c,h):"dangerouslySetInnerHTML"===g?ne(c,h):"children"===g?oe(c,h):xc(c,g,h,b)}switch(a){case "input":Dc(c,d);break;case "textarea":he(c,d);break;case "select":a=c._wrapperState.wasMultiple,
+c._wrapperState.wasMultiple=!!d.multiple,f=d.value,null!=f?ee(c,!!d.multiple,f,!1):a!==!!d.multiple&&(null!=d.defaultValue?ee(c,!!d.multiple,d.defaultValue,!0):ee(c,!!d.multiple,d.multiple?[]:"",!1))}}}break;case 8:null===b.stateNode?t("162"):void 0;b.stateNode.nodeValue=b.memoizedProps;break;case 5:break;case 15:break;case 16:break;default:t("163")}}function Cg(a,b,c){c=df(c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Dg(d);ug(a,b)};return c}
+function Eg(a,b,c){c=df(c);c.tag=3;var d=a.stateNode;null!==d&&"function"===typeof d.componentDidCatch&&(c.callback=function(){null===Fg?Fg=new Set([this]):Fg.add(this);var c=b.value,d=b.stack;ug(a,b);this.componentDidCatch(c,{componentStack:null!==d?d:""})});return c}
+function Gg(a){switch(a.tag){case 2:K(a.type)&&Ie(a);var b=a.effectTag;return b&1024?(a.effectTag=b&-1025|64,a):null;case 3:return K(a.type._reactResult)&&Ie(a),b=a.effectTag,b&1024?(a.effectTag=b&-1025|64,a):null;case 5:return Bf(a),Je(a),b=a.effectTag,0!==(b&64)?t("285"):void 0,a.effectTag=b&-1025|64,a;case 7:return Df(a),null;case 16:return b=a.effectTag,b&1024?(a.effectTag=b&-1025|64,a):null;case 6:return Bf(a),null;case 12:return tf(a),null;default:return null}}
+var Hg={readContext:vf},Ig=Yb.ReactCurrentOwner,Jg=0,Kg=0,Lg=!1,N=null,Mg=null,O=0,Ng=!1,Q=null,Og=!1,Fg=null;function Pg(){if(null!==N)for(var a=N.return;null!==a;){var b=a;switch(b.tag){case 2:var c=b.type.childContextTypes;null!==c&&void 0!==c&&Ie(b);break;case 3:c=b.type._reactResult.childContextTypes;null!==c&&void 0!==c&&Ie(b);break;case 5:Bf(b);Je(b);break;case 7:Df(b);break;case 6:Bf(b);break;case 12:tf(b)}a=a.return}Mg=null;O=0;Ng=!1;N=null}
+function Qg(a){for(;;){var b=a.alternate,c=a.return,d=a.sibling;if(0===(a.effectTag&512)){var e=b;b=a;var f=b.pendingProps;switch(b.tag){case 0:case 1:break;case 2:K(b.type)&&Ie(b);break;case 3:K(b.type._reactResult)&&Ie(b);break;case 5:Bf(b);Je(b);f=b.stateNode;f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null);if(null===e||null===e.child)$f(b),b.effectTag&=-3;rg(b);break;case 7:Df(b);var g=zf(yf.current),h=b.type;if(null!==e&&null!=b.stateNode)sg(e,b,h,f,g),e.ref!==b.ref&&(b.effectTag|=
+128);else if(f){var k=zf(L.current);if($f(b)){f=b;e=f.stateNode;var l=f.type,m=f.memoizedProps,r=g;e[Ia]=f;e[Ja]=m;h=void 0;g=l;switch(g){case "iframe":case "object":F("load",e);break;case "video":case "audio":for(l=0;l<fb.length;l++)F(fb[l],e);break;case "source":F("error",e);break;case "img":case "image":case "link":F("error",e);F("load",e);break;case "form":F("reset",e);F("submit",e);break;case "details":F("toggle",e);break;case "input":Bc(e,m);F("invalid",e);ve(r,"onChange");break;case "select":e._wrapperState=
+{wasMultiple:!!m.multiple};F("invalid",e);ve(r,"onChange");break;case "textarea":ge(e,m),F("invalid",e),ve(r,"onChange")}te(g,m);l=null;for(h in m)m.hasOwnProperty(h)&&(k=m[h],"children"===h?"string"===typeof k?e.textContent!==k&&(l=["children",k]):"number"===typeof k&&e.textContent!==""+k&&(l=["children",""+k]):sa.hasOwnProperty(h)&&null!=k&&ve(r,h));switch(g){case "input":Wb(e);Fc(e,m,!0);break;case "textarea":Wb(e);ie(e,m);break;case "select":case "option":break;default:"function"===typeof m.onClick&&
+(e.onclick=we)}h=l;f.updateQueue=h;f=null!==h?!0:!1;f&&qg(b)}else{m=b;e=h;r=f;l=9===g.nodeType?g:g.ownerDocument;k===je.html&&(k=ke(e));k===je.html?"script"===e?(e=l.createElement("div"),e.innerHTML="<script>\x3c/script>",l=e.removeChild(e.firstChild)):"string"===typeof r.is?l=l.createElement(e,{is:r.is}):(l=l.createElement(e),"select"===e&&r.multiple&&(l.multiple=!0)):l=l.createElementNS(k,e);e=l;e[Ia]=m;e[Ja]=f;a:for(m=e,r=b,l=r.child;null!==l;){if(7===l.tag||8===l.tag)m.appendChild(l.stateNode);
+else if(6!==l.tag&&null!==l.child){l.child.return=l;l=l.child;continue}if(l===r)break;for(;null===l.sibling;){if(null===l.return||l.return===r)break a;l=l.return}l.sibling.return=l.return;l=l.sibling}r=e;l=h;m=f;var A=g,S=ue(l,m);switch(l){case "iframe":case "object":F("load",r);g=m;break;case "video":case "audio":for(g=0;g<fb.length;g++)F(fb[g],r);g=m;break;case "source":F("error",r);g=m;break;case "img":case "image":case "link":F("error",r);F("load",r);g=m;break;case "form":F("reset",r);F("submit",
+r);g=m;break;case "details":F("toggle",r);g=m;break;case "input":Bc(r,m);g=zc(r,m);F("invalid",r);ve(A,"onChange");break;case "option":g=de(r,m);break;case "select":r._wrapperState={wasMultiple:!!m.multiple};g=n({},m,{value:void 0});F("invalid",r);ve(A,"onChange");break;case "textarea":ge(r,m);g=fe(r,m);F("invalid",r);ve(A,"onChange");break;default:g=m}te(l,g);k=void 0;var B=l,P=r,v=g;for(k in v)if(v.hasOwnProperty(k)){var p=v[k];"style"===k?re(P,p):"dangerouslySetInnerHTML"===k?(p=p?p.__html:void 0,
+null!=p&&ne(P,p)):"children"===k?"string"===typeof p?("textarea"!==B||""!==p)&&oe(P,p):"number"===typeof p&&oe(P,""+p):"suppressContentEditableWarning"!==k&&"suppressHydrationWarning"!==k&&"autoFocus"!==k&&(sa.hasOwnProperty(k)?null!=p&&ve(A,k):null!=p&&xc(P,k,p,S))}switch(l){case "input":Wb(r);Fc(r,m,!1);break;case "textarea":Wb(r);ie(r,m);break;case "option":null!=m.value&&r.setAttribute("value",""+yc(m.value));break;case "select":g=r;g.multiple=!!m.multiple;r=m.value;null!=r?ee(g,!!m.multiple,
+r,!1):null!=m.defaultValue&&ee(g,!!m.multiple,m.defaultValue,!0);break;default:"function"===typeof g.onClick&&(r.onclick=we)}(f=ze(h,f))&&qg(b);b.stateNode=e}null!==b.ref&&(b.effectTag|=128)}else null===b.stateNode?t("166"):void 0;break;case 8:e&&null!=b.stateNode?tg(e,b,e.memoizedProps,f):("string"!==typeof f&&(null===b.stateNode?t("166"):void 0),e=zf(yf.current),zf(L.current),$f(b)?(f=b,h=f.stateNode,e=f.memoizedProps,h[Ia]=f,(f=h.nodeValue!==e)&&qg(b)):(h=b,f=(9===e.nodeType?e:e.ownerDocument).createTextNode(f),
+f[Ia]=h,b.stateNode=f));break;case 13:case 14:break;case 16:break;case 9:break;case 10:break;case 15:break;case 6:Bf(b);rg(b);break;case 12:tf(b);break;case 11:break;case 4:t("167");default:t("156")}b=N=null;f=a;if(1073741823===O||1073741823!==f.childExpirationTime){h=0;for(e=f.child;null!==e;){g=e.expirationTime;m=e.childExpirationTime;if(0===h||0!==g&&g<h)h=g;if(0===h||0!==m&&m<h)h=m;e=e.sibling}f.childExpirationTime=h}if(null!==b)return b;null!==c&&0===(c.effectTag&512)&&(null===c.firstEffect&&
+(c.firstEffect=a.firstEffect),null!==a.lastEffect&&(null!==c.lastEffect&&(c.lastEffect.nextEffect=a.firstEffect),c.lastEffect=a.lastEffect),1<a.effectTag&&(null!==c.lastEffect?c.lastEffect.nextEffect=a:c.firstEffect=a,c.lastEffect=a))}else{a=Gg(a,O);if(null!==a)return a.effectTag&=511,a;null!==c&&(c.firstEffect=c.lastEffect=null,c.effectTag|=512)}if(null!==d)return d;if(null!==c)a=c;else break}return null}function Rg(a){var b=pg(a.alternate,a,O);null===b&&(b=Qg(a));Ig.current=null;return b}
+function Sg(a,b,c){Lg?t("243"):void 0;Lg=!0;Ig.currentDispatcher=Hg;var d=a.nextExpirationTimeToWorkOn;if(d!==O||a!==Mg||null===N)Pg(),Mg=a,O=d,N=Ue(Mg.current,null,O),a.pendingCommitExpirationTime=0;var e=!1;do{try{if(b)for(;null!==N&&!Tg();)N=Rg(N);else for(;null!==N;)N=Rg(N)}catch(r){if(null===N)e=!0,Dg(r);else{null===N?t("271"):void 0;var f=N,g=f.return;if(null===g)e=!0,Dg(r);else{a:{var h=g,k=f,l=r;g=O;k.effectTag|=512;k.firstEffect=k.lastEffect=null;Ng=!0;l=nf(l,k);do{switch(h.tag){case 5:h.effectTag|=
+1024;h.expirationTime=g;g=Cg(h,l,g);gf(h,g);break a;case 2:case 3:k=l;var m=h.stateNode;if(0===(h.effectTag&64)&&null!==m&&"function"===typeof m.componentDidCatch&&(null===Fg||!Fg.has(m))){h.effectTag|=1024;h.expirationTime=g;g=Eg(h,k,g);gf(h,g);break a}}h=h.return}while(null!==h)}N=Qg(f);continue}}}break}while(1);Lg=!1;rf=qf=pf=Ig.currentDispatcher=null;if(e)Mg=null,a.finishedWork=null;else if(null!==N)a.finishedWork=null;else{b=a.current.alternate;null===b?t("281"):void 0;Mg=null;if(Ng){e=a.latestPendingTime;
+f=a.latestSuspendedTime;g=a.latestPingedTime;if(0!==e&&e>d||0!==f&&f>d||0!==g&&g>d){a.didError=!1;c=a.latestPingedTime;0!==c&&c<=d&&(a.latestPingedTime=0);c=a.earliestPendingTime;b=a.latestPendingTime;c===d?a.earliestPendingTime=b===d?a.latestPendingTime=0:b:b===d&&(a.latestPendingTime=c);c=a.earliestSuspendedTime;b=a.latestSuspendedTime;0===c?a.earliestSuspendedTime=a.latestSuspendedTime=d:c>d?a.earliestSuspendedTime=d:b<d&&(a.latestSuspendedTime=d);$e(d,a);a.expirationTime=a.expirationTime;return}if(!a.didError&&
+!c){a.didError=!0;a.nextExpirationTimeToWorkOn=d;d=a.expirationTime=1;a.expirationTime=d;return}}a.pendingCommitExpirationTime=d;a.finishedWork=b}}
+function wg(a,b){var c;a:{Lg&&!Og?t("263"):void 0;for(c=a.return;null!==c;){switch(c.tag){case 2:case 3:var d=c.stateNode;if("function"===typeof c.type.getDerivedStateFromCatch||"function"===typeof d.componentDidCatch&&(null===Fg||!Fg.has(d))){a=nf(b,a);a=Eg(c,a,1);ff(c,a);If(c,1);c=void 0;break a}break;case 5:a=nf(b,a);a=Cg(c,a,1);ff(c,a);If(c,1);c=void 0;break a}c=c.return}5===a.tag&&(c=nf(b,a),c=Cg(a,c,1),ff(a,c),If(a,1));c=void 0}return c}
+function Hf(a,b){0!==Kg?a=Kg:Lg?a=Og?1:O:b.mode&1?(a=Ug?2+10*(((a-2+15)/10|0)+1):2+25*(((a-2+500)/25|0)+1),null!==Mg&&a===O&&(a+=1)):a=1;Ug&&(0===Vg||a>Vg)&&(Vg=a);return a}
+function If(a,b){a:{if(0===a.expirationTime||a.expirationTime>b)a.expirationTime=b;var c=a.alternate;null!==c&&(0===c.expirationTime||c.expirationTime>b)&&(c.expirationTime=b);var d=a.return;if(null===d&&5===a.tag)a=a.stateNode;else{for(;null!==d;){c=d.alternate;if(0===d.childExpirationTime||d.childExpirationTime>b)d.childExpirationTime=b;null!==c&&(0===c.childExpirationTime||c.childExpirationTime>b)&&(c.childExpirationTime=b);if(null===d.return&&5===d.tag){a=d.stateNode;break a}d=d.return}a=null}}if(null!==
+a){!Lg&&0!==O&&b<O&&Pg();Ze(a,b);if(!Lg||Og||Mg!==a){b=a;a=a.expirationTime;if(null===b.nextScheduledRoot)b.expirationTime=a,null===T?(U=T=b,b.nextScheduledRoot=b):(T=T.nextScheduledRoot=b,T.nextScheduledRoot=U);else if(c=b.expirationTime,0===c||a<c)b.expirationTime=a;V||(W?Wg&&(Y=b,Z=1,Xg(b,1,!0)):1===a?Yg(1,null):Zg(b,a))}$g>ah&&($g=0,t("185"))}}function bh(a,b,c,d,e){var f=Kg;Kg=1;try{return a(b,c,d,e)}finally{Kg=f}}
+var U=null,T=null,ch=0,dh=void 0,V=!1,Y=null,Z=0,Vg=0,eh=!1,fh=!1,gh=null,hh=null,W=!1,Wg=!1,Ug=!1,ih=null,jh=ba.unstable_now(),kh=(jh/10|0)+2,lh=kh,ah=50,$g=0,mh=null,nh=1;function oh(){kh=((ba.unstable_now()-jh)/10|0)+2}function Zg(a,b){if(0!==ch){if(b>ch)return;null!==dh&&ba.unstable_cancelScheduledWork(dh)}ch=b;a=ba.unstable_now()-jh;dh=ba.unstable_scheduleWork(ph,{timeout:10*(b-2)-a})}function Gf(){if(V)return lh;qh();if(0===Z||1073741823===Z)oh(),lh=kh;return lh}
+function qh(){var a=0,b=null;if(null!==T)for(var c=T,d=U;null!==d;){var e=d.expirationTime;if(0===e){null===c||null===T?t("244"):void 0;if(d===d.nextScheduledRoot){U=T=d.nextScheduledRoot=null;break}else if(d===U)U=e=d.nextScheduledRoot,T.nextScheduledRoot=e,d.nextScheduledRoot=null;else if(d===T){T=c;T.nextScheduledRoot=U;d.nextScheduledRoot=null;break}else c.nextScheduledRoot=d.nextScheduledRoot,d.nextScheduledRoot=null;d=c.nextScheduledRoot}else{if(0===a||e<a)a=e,b=d;if(d===T)break;if(1===a)break;
+c=d;d=d.nextScheduledRoot}}Y=b;Z=a}function ph(a){if(a.didTimeout&&null!==U){oh();var b=U;do{var c=b.expirationTime;0!==c&&kh>=c&&(b.nextExpirationTimeToWorkOn=kh);b=b.nextScheduledRoot}while(b!==U)}Yg(0,a)}
+function Yg(a,b){hh=b;qh();if(null!==hh)for(oh(),lh=kh;null!==Y&&0!==Z&&(0===a||a>=Z)&&(!eh||kh>=Z);)Xg(Y,Z,kh>=Z),qh(),oh(),lh=kh;else for(;null!==Y&&0!==Z&&(0===a||a>=Z);)Xg(Y,Z,!0),qh();null!==hh&&(ch=0,dh=null);0!==Z&&Zg(Y,Z);hh=null;eh=!1;$g=0;mh=null;if(null!==ih)for(a=ih,ih=null,b=0;b<a.length;b++){var c=a[b];try{c._onComplete()}catch(d){fh||(fh=!0,gh=d)}}if(fh)throw a=gh,gh=null,fh=!1,a;}
+function Xg(a,b,c){V?t("245"):void 0;V=!0;if(null===hh||c){var d=a.finishedWork;null!==d?rh(a,d,b):(a.finishedWork=null,Sg(a,!1,c),d=a.finishedWork,null!==d&&rh(a,d,b))}else d=a.finishedWork,null!==d?rh(a,d,b):(a.finishedWork=null,Sg(a,!0,c),d=a.finishedWork,null!==d&&(Tg()?a.finishedWork=d:rh(a,d,b)));V=!1}
+function rh(a,b,c){var d=a.firstBatch;if(null!==d&&d._expirationTime<=c&&(null===ih?ih=[d]:ih.push(d),d._defer)){a.finishedWork=b;a.expirationTime=0;return}a.finishedWork=null;a===mh?$g++:(mh=a,$g=0);Og=Lg=!0;a.current===b?t("177"):void 0;c=a.pendingCommitExpirationTime;0===c?t("261"):void 0;a.pendingCommitExpirationTime=0;d=b.expirationTime;var e=b.childExpirationTime;d=0===d||0!==e&&e<d?e:d;a.didError=!1;0===d?(a.earliestPendingTime=0,a.latestPendingTime=0,a.earliestSuspendedTime=0,a.latestSuspendedTime=
+0,a.latestPingedTime=0):(e=a.latestPendingTime,0!==e&&(e<d?a.earliestPendingTime=a.latestPendingTime=0:a.earliestPendingTime<d&&(a.earliestPendingTime=a.latestPendingTime)),e=a.earliestSuspendedTime,0===e?Ze(a,d):d>a.latestSuspendedTime?(a.earliestSuspendedTime=0,a.latestSuspendedTime=0,a.latestPingedTime=0,Ze(a,d)):d<e&&Ze(a,d));$e(0,a);Ig.current=null;1<b.effectTag?null!==b.lastEffect?(b.lastEffect.nextEffect=b,d=b.firstEffect):d=b:d=b.firstEffect;xe=Gd;e=Td();if(Ud(e)){if("selectionStart"in e)var f=
+{start:e.selectionStart,end:e.selectionEnd};else a:{f=(f=e.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&0!==g.rangeCount){f=g.anchorNode;var h=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{f.nodeType,k.nodeType}catch(Xa){f=null;break a}var l=0,m=-1,r=-1,A=0,S=0,B=e,P=null;b:for(;;){for(var v;;){B!==f||0!==h&&3!==B.nodeType||(m=l+h);B!==k||0!==g&&3!==B.nodeType||(r=l+g);3===B.nodeType&&(l+=B.nodeValue.length);if(null===(v=B.firstChild))break;P=B;B=v}for(;;){if(B===
+e)break b;P===f&&++A===h&&(m=l);P===k&&++S===g&&(r=l);if(null!==(v=B.nextSibling))break;B=P;P=B.parentNode}B=v}f=-1===m||-1===r?null:{start:m,end:r}}else f=null}f=f||{start:0,end:0}}else f=null;ye={focusedElem:e,selectionRange:f};Gd=!1;for(Q=d;null!==Q;){e=!1;f=void 0;try{for(;null!==Q;){if(Q.effectTag&256){var p=Q.alternate;a:switch(h=Q,h.tag){case 2:case 3:if(h.effectTag&256&&null!==p){var u=p.memoizedProps,x=p.memoizedState,R=h.stateNode;R.props=h.memoizedProps;R.state=h.memoizedState;var yh=R.getSnapshotBeforeUpdate(u,
+x);R.__reactInternalSnapshotBeforeUpdate=yh}break a;case 5:case 7:case 8:case 6:break a;default:t("163")}}Q=Q.nextEffect}}catch(Xa){e=!0,f=Xa}e&&(null===Q?t("178"):void 0,wg(Q,f),null!==Q&&(Q=Q.nextEffect))}for(Q=d;null!==Q;){p=!1;u=void 0;try{for(;null!==Q;){var w=Q.effectTag;w&16&&oe(Q.stateNode,"");if(w&128){var y=Q.alternate;if(null!==y){var q=y.ref;null!==q&&("function"===typeof q?q(null):q.current=null)}}switch(w&14){case 2:Ag(Q);Q.effectTag&=-3;break;case 6:Ag(Q);Q.effectTag&=-3;Bg(Q.alternate,
+Q);break;case 4:Bg(Q.alternate,Q);break;case 8:x=Q,yg(x),x.return=null,x.child=null,x.alternate&&(x.alternate.child=null,x.alternate.return=null)}Q=Q.nextEffect}}catch(Xa){p=!0,u=Xa}p&&(null===Q?t("178"):void 0,wg(Q,u),null!==Q&&(Q=Q.nextEffect))}q=ye;y=Td();w=q.focusedElem;u=q.selectionRange;if(y!==w&&w&&w.ownerDocument&&Sd(w.ownerDocument.documentElement,w)){null!==u&&Ud(w)&&(y=u.start,q=u.end,void 0===q&&(q=y),"selectionStart"in w?(w.selectionStart=y,w.selectionEnd=Math.min(q,w.value.length)):
+(p=w.ownerDocument||document,y=(p&&p.defaultView||window).getSelection(),x=w.textContent.length,q=Math.min(u.start,x),u=void 0===u.end?q:Math.min(u.end,x),!y.extend&&q>u&&(x=u,u=q,q=x),x=Rd(w,q),R=Rd(w,u),x&&R&&(1!==y.rangeCount||y.anchorNode!==x.node||y.anchorOffset!==x.offset||y.focusNode!==R.node||y.focusOffset!==R.offset)&&(p=p.createRange(),p.setStart(x.node,x.offset),y.removeAllRanges(),q>u?(y.addRange(p),y.extend(R.node,R.offset)):(p.setEnd(R.node,R.offset),y.addRange(p)))));y=[];for(q=w;q=
+q.parentNode;)1===q.nodeType&&y.push({element:q,left:q.scrollLeft,top:q.scrollTop});"function"===typeof w.focus&&w.focus();for(w=0;w<y.length;w++)q=y[w],q.element.scrollLeft=q.left,q.element.scrollTop=q.top}ye=null;Gd=!!xe;xe=null;a.current=b;for(Q=d;null!==Q;){d=!1;w=void 0;try{for(y=c;null!==Q;){var Sa=Q.effectTag;if(Sa&36){var oc=Q.alternate;q=Q;p=y;switch(q.tag){case 2:case 3:var X=q.stateNode;if(q.effectTag&4)if(null===oc)X.props=q.memoizedProps,X.state=q.memoizedState,X.componentDidMount();
+else{var Ih=oc.memoizedProps,Jh=oc.memoizedState;X.props=q.memoizedProps;X.state=q.memoizedState;X.componentDidUpdate(Ih,Jh,X.__reactInternalSnapshotBeforeUpdate)}var kg=q.updateQueue;null!==kg&&(X.props=q.memoizedProps,X.state=q.memoizedState,lf(q,kg,X,p));break;case 5:var lg=q.updateQueue;if(null!==lg){u=null;if(null!==q.child)switch(q.child.tag){case 7:u=q.child.stateNode;break;case 2:case 3:u=q.child.stateNode}lf(q,lg,u,p)}break;case 7:var Kh=q.stateNode;null===oc&&q.effectTag&4&&ze(q.type,q.memoizedProps)&&
+Kh.focus();break;case 8:break;case 6:break;case 15:break;case 16:break;default:t("163")}}if(Sa&128){var Ac=Q.ref;if(null!==Ac){var mg=Q.stateNode;switch(Q.tag){case 7:var Pd=mg;break;default:Pd=mg}"function"===typeof Ac?Ac(Pd):Ac.current=Pd}}var Lh=Q.nextEffect;Q.nextEffect=null;Q=Lh}}catch(Xa){d=!0,w=Xa}d&&(null===Q?t("178"):void 0,wg(Q,w),null!==Q&&(Q=Q.nextEffect))}Lg=Og=!1;"function"===typeof Oe&&Oe(b.stateNode);Sa=b.expirationTime;b=b.childExpirationTime;b=0===Sa||0!==b&&b<Sa?b:Sa;0===b&&(Fg=
+null);a.expirationTime=b;a.finishedWork=null}function Tg(){return eh?!0:null===hh||hh.timeRemaining()>nh?!1:eh=!0}function Dg(a){null===Y?t("246"):void 0;Y.expirationTime=0;fh||(fh=!0,gh=a)}function sh(a,b){var c=W;W=!0;try{return a(b)}finally{(W=c)||V||Yg(1,null)}}function th(a,b){if(W&&!Wg){Wg=!0;try{return a(b)}finally{Wg=!1}}return a(b)}function uh(a,b,c){if(Ug)return a(b,c);W||V||0===Vg||(Yg(Vg,null),Vg=0);var d=Ug,e=W;W=Ug=!0;try{return a(b,c)}finally{Ug=d,(W=e)||V||Yg(1,null)}}
+function vh(a){if(!a)return Fe;a=a._reactInternalFiber;a:{2!==jd(a)||2!==a.tag&&3!==a.tag?t("170"):void 0;var b=a;do{switch(b.tag){case 5:b=b.stateNode.context;break a;case 2:if(K(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}break;case 3:if(K(b.type._reactResult)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return}while(null!==b);t("171");b=void 0}if(2===a.tag){var c=a.type;if(K(c))return Le(a,c,b)}else if(3===a.tag&&(c=a.type._reactResult,K(c)))return Le(a,
+c,b);return b}function wh(a,b,c,d,e){var f=b.current;c=vh(c);null===b.context?b.context=c:b.pendingContext=c;b=e;e=df(d);e.payload={element:a};b=void 0===b?null:b;null!==b&&(e.callback=b);ff(f,e);If(f,d);return d}function xh(a,b,c,d){var e=b.current,f=Gf();e=Hf(f,e);return wh(a,b,c,e,d)}function zh(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 7:return a.child.stateNode;default:return a.child.stateNode}}
+function Ah(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ac,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}
+Fb=function(a,b,c){switch(b){case "input":Dc(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Na(d);e?void 0:t("90");Xb(d);Dc(d,e)}}}break;case "textarea":he(a,c);break;case "select":b=c.value,null!=b&&ee(a,!!c.multiple,b,!1)}};
+function Bh(a){var b=2+25*(((Gf()-2+500)/25|0)+1);b<=Jg&&(b=Jg+1);this._expirationTime=Jg=b;this._root=a;this._callbacks=this._next=null;this._hasChildren=this._didComplete=!1;this._children=null;this._defer=!0}Bh.prototype.render=function(a){this._defer?void 0:t("250");this._hasChildren=!0;this._children=a;var b=this._root._internalRoot,c=this._expirationTime,d=new Ch;wh(a,b,null,c,d._onCommit);return d};
+Bh.prototype.then=function(a){if(this._didComplete)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
+Bh.prototype.commit=function(){var a=this._root._internalRoot,b=a.firstBatch;this._defer&&null!==b?void 0:t("251");if(this._hasChildren){var c=this._expirationTime;if(b!==this){this._hasChildren&&(c=this._expirationTime=b._expirationTime,this.render(this._children));for(var d=null,e=b;e!==this;)d=e,e=e._next;null===d?t("251"):void 0;d._next=e._next;this._next=b;a.firstBatch=this}this._defer=!1;b=c;V?t("253"):void 0;Y=a;Z=b;Xg(a,b,!0);Yg(1,null);b=this._next;this._next=null;b=a.firstBatch=b;null!==
+b&&b._hasChildren&&b.render(b._children)}else this._next=null,this._defer=!1};Bh.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++)(0,a[b])()}};function Ch(){this._callbacks=null;this._didCommit=!1;this._onCommit=this._onCommit.bind(this)}Ch.prototype.then=function(a){if(this._didCommit)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
+Ch.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++){var c=a[b];"function"!==typeof c?t("191",c):void 0;c()}}};
+function Dh(a,b,c){b=new Se(5,null,null,b?3:0);a={current:b,containerInfo:a,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:c,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null};this._internalRoot=b.stateNode=a}
+Dh.prototype.render=function(a,b){var c=this._internalRoot,d=new Ch;b=void 0===b?null:b;null!==b&&d.then(b);xh(a,c,null,d._onCommit);return d};Dh.prototype.unmount=function(a){var b=this._internalRoot,c=new Ch;a=void 0===a?null:a;null!==a&&c.then(a);xh(null,b,null,c._onCommit);return c};Dh.prototype.legacy_renderSubtreeIntoContainer=function(a,b,c){var d=this._internalRoot,e=new Ch;c=void 0===c?null:c;null!==c&&e.then(c);xh(b,d,a,e._onCommit);return e};
+Dh.prototype.createBatch=function(){var a=new Bh(this),b=a._expirationTime,c=this._internalRoot,d=c.firstBatch;if(null===d)c.firstBatch=a,a._next=null;else{for(c=null;null!==d&&d._expirationTime<=b;)c=d,d=d._next;a._next=d;null!==c&&(c._next=a)}return a};function Eh(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}Lb=sh;Mb=uh;Nb=function(){V||0===Vg||(Yg(Vg,null),Vg=0)};
+function Fh(a,b){b||(b=a?9===a.nodeType?a.documentElement:a.firstChild:null,b=!(!b||1!==b.nodeType||!b.hasAttribute("data-reactroot")));if(!b)for(var c;c=a.lastChild;)a.removeChild(c);return new Dh(a,!1,b)}
+function Gh(a,b,c,d,e){Eh(c)?void 0:t("200");var f=c._reactRootContainer;if(f){if("function"===typeof e){var g=e;e=function(){var a=zh(f._internalRoot);g.call(a)}}null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)}else{f=c._reactRootContainer=Fh(c,d);if("function"===typeof e){var h=e;e=function(){var a=zh(f._internalRoot);h.call(a)}}th(function(){null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)})}return zh(f._internalRoot)}
+function Hh(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;Eh(b)?void 0:t("200");return Ah(a,b,null,c)}
+var Mh={createPortal:Hh,findDOMNode:function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternalFiber;void 0===b&&("function"===typeof a.render?t("188"):t("268",Object.keys(a)));a=md(b);a=null===a?null:a.stateNode;return a},hydrate:function(a,b,c){return Gh(null,a,b,!0,c)},render:function(a,b,c){return Gh(null,a,b,!1,c)},unstable_renderSubtreeIntoContainer:function(a,b,c,d){null==a||void 0===a._reactInternalFiber?t("38"):void 0;return Gh(a,b,c,!1,d)},unmountComponentAtNode:function(a){Eh(a)?
+void 0:t("40");return a._reactRootContainer?(th(function(){Gh(null,null,a,!1,function(){a._reactRootContainer=null})}),!0):!1},unstable_createPortal:function(){return Hh.apply(void 0,arguments)},unstable_batchedUpdates:sh,unstable_interactiveUpdates:uh,flushSync:function(a,b){V?t("187"):void 0;var c=W;W=!0;try{return bh(a,b)}finally{W=c,Yg(1,null)}},unstable_flushControlled:function(a){var b=W;W=!0;try{bh(a)}finally{(W=b)||V||Yg(1,null)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[La,
+Ma,Na,Ea.injectEventPluginsByName,qa,Ua,function(a){za(a,Ta)},Jb,Kb,Id,Ga]},unstable_createRoot:function(a,b){Eh(a)?void 0:t("278");return new Dh(a,!0,null!=b&&!0===b.hydrate)}};(function(a){var b=a.findFiberByHostInstance;return Re(n({},a,{findHostInstanceByFiber:function(a){a=md(a);return null===a?null:a.stateNode},findFiberByHostInstance:function(a){return b?b(a):null}}))})({findFiberByHostInstance:Ka,bundleType:0,version:"16.5.2",rendererPackageName:"react-dom"});
+var Nh={default:Mh},Oh=Nh&&Mh||Nh;module.exports=Oh.default||Oh;