UNPKG

141 kBJavaScriptView Raw
1/** @license React v16.12.0
2 * react-dom-server.node.development.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10'use strict';
11
12
13
14if (process.env.NODE_ENV !== "production") {
15 (function() {
16'use strict';
17
18var _assign = require('object-assign');
19var React = require('react');
20var checkPropTypes = require('prop-types/checkPropTypes');
21var stream = require('stream');
22
23// TODO: this is special because it gets imported during build.
24
25var ReactVersion = '16.12.0';
26
27// Do not require this module directly! Use normal `invariant` calls with
28// template literal strings. The messages will be replaced with error codes
29// during build.
30
31/**
32 * Use invariant() to assert state which your program assumes to be true.
33 *
34 * Provide sprintf-style format (only %s is supported) and arguments
35 * to provide information about what broke and what you were
36 * expecting.
37 *
38 * The invariant message will be stripped in production, but the invariant
39 * will remain to ensure logic does not differ in production.
40 */
41
42/**
43 * Similar to invariant but only logs a warning if the condition is not met.
44 * This can be used to log issues in development environments in critical
45 * paths. Removing the logging code for production environments will keep the
46 * same logic and follow the same code paths.
47 */
48var warningWithoutStack = function () {};
49
50{
51 warningWithoutStack = function (condition, format) {
52 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
53 args[_key - 2] = arguments[_key];
54 }
55
56 if (format === undefined) {
57 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
58 }
59
60 if (args.length > 8) {
61 // Check before the condition to catch violations early.
62 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
63 }
64
65 if (condition) {
66 return;
67 }
68
69 if (typeof console !== 'undefined') {
70 var argsWithFormat = args.map(function (item) {
71 return '' + item;
72 });
73 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
74 // breaks IE9: https://github.com/facebook/react/issues/13610
75
76 Function.prototype.apply.call(console.error, console, argsWithFormat);
77 }
78
79 try {
80 // --- Welcome to debugging React ---
81 // This error was thrown as a convenience so that you can use this stack
82 // to find the callsite that caused this warning to fire.
83 var argIndex = 0;
84 var message = 'Warning: ' + format.replace(/%s/g, function () {
85 return args[argIndex++];
86 });
87 throw new Error(message);
88 } catch (x) {}
89 };
90}
91
92var warningWithoutStack$1 = warningWithoutStack;
93
94// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
95// nor polyfill, then a plain number is used for performance.
96var hasSymbol = typeof Symbol === 'function' && Symbol.for;
97
98var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
99var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
100var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
101var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
102var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
103var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
104// (unstable) APIs that have been removed. Can we remove the symbols?
105
106
107var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
108var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
109var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
110var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
111var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
112var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
113var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
114
115var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
116
117var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
118// Current owner and dispatcher used to share the same ref,
119// but PR #14548 split them out to better support the react-debug-tools package.
120
121if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
122 ReactSharedInternals.ReactCurrentDispatcher = {
123 current: null
124 };
125}
126
127if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
128 ReactSharedInternals.ReactCurrentBatchConfig = {
129 suspense: null
130 };
131}
132
133/**
134 * Similar to invariant but only logs a warning if the condition is not met.
135 * This can be used to log issues in development environments in critical
136 * paths. Removing the logging code for production environments will keep the
137 * same logic and follow the same code paths.
138 */
139
140var warning = warningWithoutStack$1;
141
142{
143 warning = function (condition, format) {
144 if (condition) {
145 return;
146 }
147
148 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
149 var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
150
151 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
152 args[_key - 2] = arguments[_key];
153 }
154
155 warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
156 };
157}
158
159var warning$1 = warning;
160
161var Uninitialized = -1;
162var Pending = 0;
163var Resolved = 1;
164var Rejected = 2;
165function refineResolvedLazyComponent(lazyComponent) {
166 return lazyComponent._status === Resolved ? lazyComponent._result : null;
167}
168function initializeLazyComponentType(lazyComponent) {
169 if (lazyComponent._status === Uninitialized) {
170 lazyComponent._status = Pending;
171 var ctor = lazyComponent._ctor;
172 var thenable = ctor();
173 lazyComponent._result = thenable;
174 thenable.then(function (moduleObject) {
175 if (lazyComponent._status === Pending) {
176 var defaultExport = moduleObject.default;
177
178 {
179 if (defaultExport === undefined) {
180 warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
181 }
182 }
183
184 lazyComponent._status = Resolved;
185 lazyComponent._result = defaultExport;
186 }
187 }, function (error) {
188 if (lazyComponent._status === Pending) {
189 lazyComponent._status = Rejected;
190 lazyComponent._result = error;
191 }
192 });
193 }
194}
195
196function getWrappedName(outerType, innerType, wrapperName) {
197 var functionName = innerType.displayName || innerType.name || '';
198 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
199}
200
201function getComponentName(type) {
202 if (type == null) {
203 // Host root, text node or just invalid type.
204 return null;
205 }
206
207 {
208 if (typeof type.tag === 'number') {
209 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
210 }
211 }
212
213 if (typeof type === 'function') {
214 return type.displayName || type.name || null;
215 }
216
217 if (typeof type === 'string') {
218 return type;
219 }
220
221 switch (type) {
222 case REACT_FRAGMENT_TYPE:
223 return 'Fragment';
224
225 case REACT_PORTAL_TYPE:
226 return 'Portal';
227
228 case REACT_PROFILER_TYPE:
229 return "Profiler";
230
231 case REACT_STRICT_MODE_TYPE:
232 return 'StrictMode';
233
234 case REACT_SUSPENSE_TYPE:
235 return 'Suspense';
236
237 case REACT_SUSPENSE_LIST_TYPE:
238 return 'SuspenseList';
239 }
240
241 if (typeof type === 'object') {
242 switch (type.$$typeof) {
243 case REACT_CONTEXT_TYPE:
244 return 'Context.Consumer';
245
246 case REACT_PROVIDER_TYPE:
247 return 'Context.Provider';
248
249 case REACT_FORWARD_REF_TYPE:
250 return getWrappedName(type, type.render, 'ForwardRef');
251
252 case REACT_MEMO_TYPE:
253 return getComponentName(type.type);
254
255 case REACT_LAZY_TYPE:
256 {
257 var thenable = type;
258 var resolvedThenable = refineResolvedLazyComponent(thenable);
259
260 if (resolvedThenable) {
261 return getComponentName(resolvedThenable);
262 }
263
264 break;
265 }
266 }
267 }
268
269 return null;
270}
271
272/**
273 * Forked from fbjs/warning:
274 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
275 *
276 * Only change is we use console.warn instead of console.error,
277 * and do nothing when 'console' is not supported.
278 * This really simplifies the code.
279 * ---
280 * Similar to invariant but only logs a warning if the condition is not met.
281 * This can be used to log issues in development environments in critical
282 * paths. Removing the logging code for production environments will keep the
283 * same logic and follow the same code paths.
284 */
285var lowPriorityWarningWithoutStack = function () {};
286
287{
288 var printWarning = function (format) {
289 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
290 args[_key - 1] = arguments[_key];
291 }
292
293 var argIndex = 0;
294 var message = 'Warning: ' + format.replace(/%s/g, function () {
295 return args[argIndex++];
296 });
297
298 if (typeof console !== 'undefined') {
299 console.warn(message);
300 }
301
302 try {
303 // --- Welcome to debugging React ---
304 // This error was thrown as a convenience so that you can use this stack
305 // to find the callsite that caused this warning to fire.
306 throw new Error(message);
307 } catch (x) {}
308 };
309
310 lowPriorityWarningWithoutStack = function (condition, format) {
311 if (format === undefined) {
312 throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
313 }
314
315 if (!condition) {
316 for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
317 args[_key2 - 2] = arguments[_key2];
318 }
319
320 printWarning.apply(void 0, [format].concat(args));
321 }
322 };
323}
324
325var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
326
327var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
328var describeComponentFrame = function (name, source, ownerName) {
329 var sourceInfo = '';
330
331 if (source) {
332 var path = source.fileName;
333 var fileName = path.replace(BEFORE_SLASH_RE, '');
334
335 {
336 // In DEV, include code for a common special case:
337 // prefer "folder/index.js" instead of just "index.js".
338 if (/^index\./.test(fileName)) {
339 var match = path.match(BEFORE_SLASH_RE);
340
341 if (match) {
342 var pathBeforeSlash = match[1];
343
344 if (pathBeforeSlash) {
345 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
346 fileName = folderName + '/' + fileName;
347 }
348 }
349 }
350 }
351
352 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
353 } else if (ownerName) {
354 sourceInfo = ' (created by ' + ownerName + ')';
355 }
356
357 return '\n in ' + (name || 'Unknown') + sourceInfo;
358};
359
360// Helps identify side effects in render-phase lifecycle hooks and setState
361// reducers by double invoking them in Strict Mode.
362
363 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
364// replay the begin phase of a failed component inside invokeGuardedCallback.
365
366 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
367
368var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees.
369
370 // Trace which interactions trigger each commit.
371
372 // SSR experiments
373
374var enableSuspenseServerRenderer = false;
375 // Only used in www builds.
376
377 // Only used in www builds.
378
379 // Disable javascript: URL strings in href for XSS protection.
380
381var disableJavaScriptURLs = false; // React Fire: prevent the value and checked attributes from syncing
382// with their related DOM properties
383
384 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
385// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
386
387
388 // Experimental React Flare event system and event components support.
389
390var enableFlareAPI = false; // Experimental Host Component support.
391
392var enableFundamentalAPI = false; // Experimental Scope support.
393
394var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
395
396 // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
397// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
398
399 // For tests, we flush suspense fallbacks in an act scope;
400// *except* in some of our own tests, where we test incremental loading states.
401
402 // Add a callback property to suspense to notify which promises are currently
403// in the update queue. This allows reporting and tracing of what is causing
404// the user to see a loading state.
405// Also allows hydration callbacks to fire when a dehydrated boundary gets
406// hydrated or deleted.
407
408 // Part of the simplification of React.createElement so we can eventually move
409// from React.createElement to React.jsx
410// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
411
412
413
414var disableLegacyContext = false;
415
416 // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
417
418var ReactDebugCurrentFrame$1;
419var didWarnAboutInvalidateContextType;
420
421{
422 ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
423 didWarnAboutInvalidateContextType = new Set();
424}
425
426var emptyObject = {};
427
428{
429 Object.freeze(emptyObject);
430}
431
432function maskContext(type, context) {
433 var contextTypes = type.contextTypes;
434
435 if (!contextTypes) {
436 return emptyObject;
437 }
438
439 var maskedContext = {};
440
441 for (var contextName in contextTypes) {
442 maskedContext[contextName] = context[contextName];
443 }
444
445 return maskedContext;
446}
447
448function checkContextTypes(typeSpecs, values, location) {
449 {
450 checkPropTypes(typeSpecs, values, location, 'Component', ReactDebugCurrentFrame$1.getCurrentStack);
451 }
452}
453
454function validateContextBounds(context, threadID) {
455 // If we don't have enough slots in this context to store this threadID,
456 // fill it in without leaving any holes to ensure that the VM optimizes
457 // this as non-holey index properties.
458 // (Note: If `react` package is < 16.6, _threadCount is undefined.)
459 for (var i = context._threadCount | 0; i <= threadID; i++) {
460 // We assume that this is the same as the defaultValue which might not be
461 // true if we're rendering inside a secondary renderer but they are
462 // secondary because these use cases are very rare.
463 context[i] = context._currentValue2;
464 context._threadCount = i + 1;
465 }
466}
467function processContext(type, context, threadID, isClass) {
468 if (isClass) {
469 var contextType = type.contextType;
470
471 {
472 if ('contextType' in type) {
473 var isValid = // Allow null for conditional declaration
474 contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
475
476 if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
477 didWarnAboutInvalidateContextType.add(type);
478 var addendum = '';
479
480 if (contextType === undefined) {
481 addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
482 } else if (typeof contextType !== 'object') {
483 addendum = ' However, it is set to a ' + typeof contextType + '.';
484 } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
485 addendum = ' Did you accidentally pass the Context.Provider instead?';
486 } else if (contextType._context !== undefined) {
487 // <Context.Consumer>
488 addendum = ' Did you accidentally pass the Context.Consumer instead?';
489 } else {
490 addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
491 }
492
493 warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
494 }
495 }
496 }
497
498 if (typeof contextType === 'object' && contextType !== null) {
499 validateContextBounds(contextType, threadID);
500 return contextType[threadID];
501 }
502
503 if (disableLegacyContext) {
504 {
505 if (type.contextTypes) {
506 warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', getComponentName(type) || 'Unknown');
507 }
508 }
509
510 return emptyObject;
511 } else {
512 var maskedContext = maskContext(type, context);
513
514 {
515 if (type.contextTypes) {
516 checkContextTypes(type.contextTypes, maskedContext, 'context');
517 }
518 }
519
520 return maskedContext;
521 }
522 } else {
523 if (disableLegacyContext) {
524 {
525 if (type.contextTypes) {
526 warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(type) || 'Unknown');
527 }
528 }
529
530 return undefined;
531 } else {
532 var _maskedContext = maskContext(type, context);
533
534 {
535 if (type.contextTypes) {
536 checkContextTypes(type.contextTypes, _maskedContext, 'context');
537 }
538 }
539
540 return _maskedContext;
541 }
542 }
543}
544
545// Allocates a new index for each request. Tries to stay as compact as possible so that these
546// indices can be used to reference a tightly packed array. As opposed to being used in a Map.
547// The first allocated index is 1.
548var nextAvailableThreadIDs = new Uint16Array(16);
549
550for (var i = 0; i < 15; i++) {
551 nextAvailableThreadIDs[i] = i + 1;
552}
553
554nextAvailableThreadIDs[15] = 0;
555
556function growThreadCountAndReturnNextAvailable() {
557 var oldArray = nextAvailableThreadIDs;
558 var oldSize = oldArray.length;
559 var newSize = oldSize * 2;
560
561 if (!(newSize <= 0x10000)) {
562 {
563 throw Error("Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.");
564 }
565 }
566
567 var newArray = new Uint16Array(newSize);
568 newArray.set(oldArray);
569 nextAvailableThreadIDs = newArray;
570 nextAvailableThreadIDs[0] = oldSize + 1;
571
572 for (var _i = oldSize; _i < newSize - 1; _i++) {
573 nextAvailableThreadIDs[_i] = _i + 1;
574 }
575
576 nextAvailableThreadIDs[newSize - 1] = 0;
577 return oldSize;
578}
579
580function allocThreadID() {
581 var nextID = nextAvailableThreadIDs[0];
582
583 if (nextID === 0) {
584 return growThreadCountAndReturnNextAvailable();
585 }
586
587 nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
588 return nextID;
589}
590function freeThreadID(id) {
591 nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
592 nextAvailableThreadIDs[0] = id;
593}
594
595// A reserved attribute.
596// It is handled by React separately and shouldn't be written to the DOM.
597var RESERVED = 0; // A simple string attribute.
598// Attributes that aren't in the whitelist are presumed to have this type.
599
600var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
601// "enumerated" attributes with "true" and "false" as possible values.
602// When true, it should be set to a "true" string.
603// When false, it should be set to a "false" string.
604
605var BOOLEANISH_STRING = 2; // A real boolean attribute.
606// When true, it should be present (set either to an empty string or its name).
607// When false, it should be omitted.
608
609var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
610// When true, it should be present (set either to an empty string or its name).
611// When false, it should be omitted.
612// For any other value, should be present with that value.
613
614var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
615// When falsy, it should be removed.
616
617var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
618// When falsy, it should be removed.
619
620var POSITIVE_NUMERIC = 6;
621
622/* eslint-disable max-len */
623var 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";
624/* eslint-enable max-len */
625
626var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
627
628var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
629var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
630var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
631var illegalAttributeNameCache = {};
632var validatedAttributeNameCache = {};
633function isAttributeNameSafe(attributeName) {
634 if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
635 return true;
636 }
637
638 if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
639 return false;
640 }
641
642 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
643 validatedAttributeNameCache[attributeName] = true;
644 return true;
645 }
646
647 illegalAttributeNameCache[attributeName] = true;
648
649 {
650 warning$1(false, 'Invalid attribute name: `%s`', attributeName);
651 }
652
653 return false;
654}
655function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
656 if (propertyInfo !== null) {
657 return propertyInfo.type === RESERVED;
658 }
659
660 if (isCustomComponentTag) {
661 return false;
662 }
663
664 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
665 return true;
666 }
667
668 return false;
669}
670function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
671 if (propertyInfo !== null && propertyInfo.type === RESERVED) {
672 return false;
673 }
674
675 switch (typeof value) {
676 case 'function': // $FlowIssue symbol is perfectly valid here
677
678 case 'symbol':
679 // eslint-disable-line
680 return true;
681
682 case 'boolean':
683 {
684 if (isCustomComponentTag) {
685 return false;
686 }
687
688 if (propertyInfo !== null) {
689 return !propertyInfo.acceptsBooleans;
690 } else {
691 var prefix = name.toLowerCase().slice(0, 5);
692 return prefix !== 'data-' && prefix !== 'aria-';
693 }
694 }
695
696 default:
697 return false;
698 }
699}
700function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
701 if (value === null || typeof value === 'undefined') {
702 return true;
703 }
704
705 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
706 return true;
707 }
708
709 if (isCustomComponentTag) {
710 return false;
711 }
712
713 if (propertyInfo !== null) {
714 switch (propertyInfo.type) {
715 case BOOLEAN:
716 return !value;
717
718 case OVERLOADED_BOOLEAN:
719 return value === false;
720
721 case NUMERIC:
722 return isNaN(value);
723
724 case POSITIVE_NUMERIC:
725 return isNaN(value) || value < 1;
726 }
727 }
728
729 return false;
730}
731function getPropertyInfo(name) {
732 return properties.hasOwnProperty(name) ? properties[name] : null;
733}
734
735function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
736 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
737 this.attributeName = attributeName;
738 this.attributeNamespace = attributeNamespace;
739 this.mustUseProperty = mustUseProperty;
740 this.propertyName = name;
741 this.type = type;
742 this.sanitizeURL = sanitizeURL;
743} // When adding attributes to this list, be sure to also add them to
744// the `possibleStandardNames` module to ensure casing and incorrect
745// name warnings.
746
747
748var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
749
750['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
751// elements (not just inputs). Now that ReactDOMInput assigns to the
752// defaultValue property -- do we need this?
753'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
754 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
755 name, // attributeName
756 null, // attributeNamespace
757 false);
758}); // A few React string attributes have a different name.
759// This is a mapping from React prop names to the attribute names.
760
761[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
762 var name = _ref[0],
763 attributeName = _ref[1];
764 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
765 attributeName, // attributeName
766 null, // attributeNamespace
767 false);
768}); // These are "enumerated" HTML attributes that accept "true" and "false".
769// In React, we let users pass `true` and `false` even though technically
770// these aren't boolean attributes (they are coerced to strings).
771
772['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
773 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
774 name.toLowerCase(), // attributeName
775 null, // attributeNamespace
776 false);
777}); // These are "enumerated" SVG attributes that accept "true" and "false".
778// In React, we let users pass `true` and `false` even though technically
779// these aren't boolean attributes (they are coerced to strings).
780// Since these are SVG attributes, their attribute names are case-sensitive.
781
782['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
783 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
784 name, // attributeName
785 null, // attributeNamespace
786 false);
787}); // These are HTML boolean attributes.
788
789['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
790// on the client side because the browsers are inconsistent. Instead we call focus().
791'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
792'itemScope'].forEach(function (name) {
793 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
794 name.toLowerCase(), // attributeName
795 null, // attributeNamespace
796 false);
797}); // These are the few React props that we set as DOM properties
798// rather than attributes. These are all booleans.
799
800['checked', // Note: `option.selected` is not updated if `select.multiple` is
801// disabled with `removeAttribute`. We have special logic for handling this.
802'multiple', 'muted', 'selected'].forEach(function (name) {
803 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
804 name, // attributeName
805 null, // attributeNamespace
806 false);
807}); // These are HTML attributes that are "overloaded booleans": they behave like
808// booleans, but can also accept a string value.
809
810['capture', 'download'].forEach(function (name) {
811 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
812 name, // attributeName
813 null, // attributeNamespace
814 false);
815}); // These are HTML attributes that must be positive numbers.
816
817['cols', 'rows', 'size', 'span'].forEach(function (name) {
818 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
819 name, // attributeName
820 null, // attributeNamespace
821 false);
822}); // These are HTML attributes that must be numbers.
823
824['rowSpan', 'start'].forEach(function (name) {
825 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
826 name.toLowerCase(), // attributeName
827 null, // attributeNamespace
828 false);
829});
830var CAMELIZE = /[\-\:]([a-z])/g;
831
832var capitalize = function (token) {
833 return token[1].toUpperCase();
834}; // This is a list of all SVG attributes that need special casing, namespacing,
835// or boolean value assignment. Regular attributes that just accept strings
836// and have the same names are omitted, just like in the HTML whitelist.
837// Some of these attributes can be hard to find. This list was created by
838// scrapping the MDN documentation.
839
840
841['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) {
842 var name = attributeName.replace(CAMELIZE, capitalize);
843 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
844 attributeName, null, // attributeNamespace
845 false);
846}); // String SVG attributes with the xlink namespace.
847
848['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
849 var name = attributeName.replace(CAMELIZE, capitalize);
850 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
851 attributeName, 'http://www.w3.org/1999/xlink', false);
852}); // String SVG attributes with the xml namespace.
853
854['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
855 var name = attributeName.replace(CAMELIZE, capitalize);
856 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
857 attributeName, 'http://www.w3.org/XML/1998/namespace', false);
858}); // These attribute exists both in HTML and SVG.
859// The attribute name is case-sensitive in SVG so we can't just use
860// the React name like we do for attributes that exist only in HTML.
861
862['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
863 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
864 attributeName.toLowerCase(), // attributeName
865 null, // attributeNamespace
866 false);
867}); // These attributes accept URLs. These must not allow javascript: URLS.
868// These will also need to accept Trusted Types object in the future.
869
870var xlinkHref = 'xlinkHref';
871properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
872'xlink:href', 'http://www.w3.org/1999/xlink', true);
873['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
874 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
875 attributeName.toLowerCase(), // attributeName
876 null, // attributeNamespace
877 true);
878});
879
880var ReactDebugCurrentFrame$2 = null;
881
882{
883 ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
884} // A javascript: URL can contain leading C0 control or \u0020 SPACE,
885// and any newline or tab are filtered out as if they're not part of the URL.
886// https://url.spec.whatwg.org/#url-parsing
887// Tab or newline are defined as \r\n\t:
888// https://infra.spec.whatwg.org/#ascii-tab-or-newline
889// A C0 control is a code point in the range \u0000 NULL to \u001F
890// INFORMATION SEPARATOR ONE, inclusive:
891// https://infra.spec.whatwg.org/#c0-control-or-space
892
893/* eslint-disable max-len */
894
895
896var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
897var didWarn = false;
898
899function sanitizeURL(url) {
900 if (disableJavaScriptURLs) {
901 if (!!isJavaScriptProtocol.test(url)) {
902 {
903 throw Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$2.getStackAddendum()));
904 }
905 }
906 } else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
907 didWarn = true;
908 warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
909 }
910}
911
912// code copied and modified from escape-html
913
914/**
915 * Module variables.
916 * @private
917 */
918var matchHtmlRegExp = /["'&<>]/;
919/**
920 * Escapes special characters and HTML entities in a given html string.
921 *
922 * @param {string} string HTML string to escape for later insertion
923 * @return {string}
924 * @public
925 */
926
927function escapeHtml(string) {
928 var str = '' + string;
929 var match = matchHtmlRegExp.exec(str);
930
931 if (!match) {
932 return str;
933 }
934
935 var escape;
936 var html = '';
937 var index;
938 var lastIndex = 0;
939
940 for (index = match.index; index < str.length; index++) {
941 switch (str.charCodeAt(index)) {
942 case 34:
943 // "
944 escape = '&quot;';
945 break;
946
947 case 38:
948 // &
949 escape = '&amp;';
950 break;
951
952 case 39:
953 // '
954 escape = '&#x27;'; // modified from escape-html; used to be '&#39'
955
956 break;
957
958 case 60:
959 // <
960 escape = '&lt;';
961 break;
962
963 case 62:
964 // >
965 escape = '&gt;';
966 break;
967
968 default:
969 continue;
970 }
971
972 if (lastIndex !== index) {
973 html += str.substring(lastIndex, index);
974 }
975
976 lastIndex = index + 1;
977 html += escape;
978 }
979
980 return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
981} // end code copied and modified from escape-html
982
983/**
984 * Escapes text to prevent scripting attacks.
985 *
986 * @param {*} text Text value to escape.
987 * @return {string} An escaped string.
988 */
989
990
991function escapeTextForBrowser(text) {
992 if (typeof text === 'boolean' || typeof text === 'number') {
993 // this shortcircuit helps perf for types that we know will never have
994 // special characters, especially given that this function is used often
995 // for numeric dom ids.
996 return '' + text;
997 }
998
999 return escapeHtml(text);
1000}
1001
1002/**
1003 * Escapes attribute value to prevent scripting attacks.
1004 *
1005 * @param {*} value Value to escape.
1006 * @return {string} An escaped string.
1007 */
1008
1009function quoteAttributeValueForBrowser(value) {
1010 return '"' + escapeTextForBrowser(value) + '"';
1011}
1012
1013/**
1014 * Operations for dealing with DOM properties.
1015 */
1016
1017/**
1018 * Creates markup for the ID property.
1019 *
1020 * @param {string} id Unescaped ID.
1021 * @return {string} Markup string.
1022 */
1023
1024
1025function createMarkupForRoot() {
1026 return ROOT_ATTRIBUTE_NAME + '=""';
1027}
1028/**
1029 * Creates markup for a property.
1030 *
1031 * @param {string} name
1032 * @param {*} value
1033 * @return {?string} Markup string, or null if the property was invalid.
1034 */
1035
1036function createMarkupForProperty(name, value) {
1037 var propertyInfo = getPropertyInfo(name);
1038
1039 if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
1040 return '';
1041 }
1042
1043 if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
1044 return '';
1045 }
1046
1047 if (propertyInfo !== null) {
1048 var attributeName = propertyInfo.attributeName;
1049 var type = propertyInfo.type;
1050
1051 if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
1052 return attributeName + '=""';
1053 } else {
1054 if (propertyInfo.sanitizeURL) {
1055 value = '' + value;
1056 sanitizeURL(value);
1057 }
1058
1059 return attributeName + '=' + quoteAttributeValueForBrowser(value);
1060 }
1061 } else if (isAttributeNameSafe(name)) {
1062 return name + '=' + quoteAttributeValueForBrowser(value);
1063 }
1064
1065 return '';
1066}
1067/**
1068 * Creates markup for a custom property.
1069 *
1070 * @param {string} name
1071 * @param {*} value
1072 * @return {string} Markup string, or empty string if the property was invalid.
1073 */
1074
1075function createMarkupForCustomAttribute(name, value) {
1076 if (!isAttributeNameSafe(name) || value == null) {
1077 return '';
1078 }
1079
1080 return name + '=' + quoteAttributeValueForBrowser(value);
1081}
1082
1083/**
1084 * inlined Object.is polyfill to avoid requiring consumers ship their own
1085 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1086 */
1087function is(x, y) {
1088 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
1089 ;
1090}
1091
1092var is$1 = typeof Object.is === 'function' ? Object.is : is;
1093
1094var currentlyRenderingComponent = null;
1095var firstWorkInProgressHook = null;
1096var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
1097
1098var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
1099
1100var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
1101
1102var renderPhaseUpdates = null; // Counter to prevent infinite loops.
1103
1104var numberOfReRenders = 0;
1105var RE_RENDER_LIMIT = 25;
1106var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
1107
1108var currentHookNameInDev;
1109
1110function resolveCurrentlyRenderingComponent() {
1111 if (!(currentlyRenderingComponent !== null)) {
1112 {
1113 throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
1114 }
1115 }
1116
1117 {
1118 !!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
1119 }
1120
1121 return currentlyRenderingComponent;
1122}
1123
1124function areHookInputsEqual(nextDeps, prevDeps) {
1125 if (prevDeps === null) {
1126 {
1127 warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
1128 }
1129
1130 return false;
1131 }
1132
1133 {
1134 // Don't bother comparing lengths in prod because these arrays should be
1135 // passed inline.
1136 if (nextDeps.length !== prevDeps.length) {
1137 warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
1138 }
1139 }
1140
1141 for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
1142 if (is$1(nextDeps[i], prevDeps[i])) {
1143 continue;
1144 }
1145
1146 return false;
1147 }
1148
1149 return true;
1150}
1151
1152function createHook() {
1153 if (numberOfReRenders > 0) {
1154 {
1155 {
1156 throw Error("Rendered more hooks than during the previous render");
1157 }
1158 }
1159 }
1160
1161 return {
1162 memoizedState: null,
1163 queue: null,
1164 next: null
1165 };
1166}
1167
1168function createWorkInProgressHook() {
1169 if (workInProgressHook === null) {
1170 // This is the first hook in the list
1171 if (firstWorkInProgressHook === null) {
1172 isReRender = false;
1173 firstWorkInProgressHook = workInProgressHook = createHook();
1174 } else {
1175 // There's already a work-in-progress. Reuse it.
1176 isReRender = true;
1177 workInProgressHook = firstWorkInProgressHook;
1178 }
1179 } else {
1180 if (workInProgressHook.next === null) {
1181 isReRender = false; // Append to the end of the list
1182
1183 workInProgressHook = workInProgressHook.next = createHook();
1184 } else {
1185 // There's already a work-in-progress. Reuse it.
1186 isReRender = true;
1187 workInProgressHook = workInProgressHook.next;
1188 }
1189 }
1190
1191 return workInProgressHook;
1192}
1193
1194function prepareToUseHooks(componentIdentity) {
1195 currentlyRenderingComponent = componentIdentity;
1196
1197 {
1198 isInHookUserCodeInDev = false;
1199 } // The following should have already been reset
1200 // didScheduleRenderPhaseUpdate = false;
1201 // firstWorkInProgressHook = null;
1202 // numberOfReRenders = 0;
1203 // renderPhaseUpdates = null;
1204 // workInProgressHook = null;
1205
1206}
1207function finishHooks(Component, props, children, refOrContext) {
1208 // This must be called after every function component to prevent hooks from
1209 // being used in classes.
1210 while (didScheduleRenderPhaseUpdate) {
1211 // Updates were scheduled during the render phase. They are stored in
1212 // the `renderPhaseUpdates` map. Call the component again, reusing the
1213 // work-in-progress hooks and applying the additional updates on top. Keep
1214 // restarting until no more updates are scheduled.
1215 didScheduleRenderPhaseUpdate = false;
1216 numberOfReRenders += 1; // Start over from the beginning of the list
1217
1218 workInProgressHook = null;
1219 children = Component(props, refOrContext);
1220 }
1221
1222 currentlyRenderingComponent = null;
1223 firstWorkInProgressHook = null;
1224 numberOfReRenders = 0;
1225 renderPhaseUpdates = null;
1226 workInProgressHook = null;
1227
1228 {
1229 isInHookUserCodeInDev = false;
1230 } // These were reset above
1231 // currentlyRenderingComponent = null;
1232 // didScheduleRenderPhaseUpdate = false;
1233 // firstWorkInProgressHook = null;
1234 // numberOfReRenders = 0;
1235 // renderPhaseUpdates = null;
1236 // workInProgressHook = null;
1237
1238
1239 return children;
1240}
1241
1242function readContext(context, observedBits) {
1243 var threadID = currentThreadID;
1244 validateContextBounds(context, threadID);
1245
1246 {
1247 !!isInHookUserCodeInDev ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
1248 }
1249
1250 return context[threadID];
1251}
1252
1253function useContext(context, observedBits) {
1254 {
1255 currentHookNameInDev = 'useContext';
1256 }
1257
1258 resolveCurrentlyRenderingComponent();
1259 var threadID = currentThreadID;
1260 validateContextBounds(context, threadID);
1261 return context[threadID];
1262}
1263
1264function basicStateReducer(state, action) {
1265 return typeof action === 'function' ? action(state) : action;
1266}
1267
1268function useState(initialState) {
1269 {
1270 currentHookNameInDev = 'useState';
1271 }
1272
1273 return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
1274 initialState);
1275}
1276function useReducer(reducer, initialArg, init) {
1277 {
1278 if (reducer !== basicStateReducer) {
1279 currentHookNameInDev = 'useReducer';
1280 }
1281 }
1282
1283 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1284 workInProgressHook = createWorkInProgressHook();
1285
1286 if (isReRender) {
1287 // This is a re-render. Apply the new render phase updates to the previous
1288 // current hook.
1289 var queue = workInProgressHook.queue;
1290 var dispatch = queue.dispatch;
1291
1292 if (renderPhaseUpdates !== null) {
1293 // Render phase updates are stored in a map of queue -> linked list
1294 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1295
1296 if (firstRenderPhaseUpdate !== undefined) {
1297 renderPhaseUpdates.delete(queue);
1298 var newState = workInProgressHook.memoizedState;
1299 var update = firstRenderPhaseUpdate;
1300
1301 do {
1302 // Process this render phase update. We don't have to check the
1303 // priority because it will always be the same as the current
1304 // render's.
1305 var action = update.action;
1306
1307 {
1308 isInHookUserCodeInDev = true;
1309 }
1310
1311 newState = reducer(newState, action);
1312
1313 {
1314 isInHookUserCodeInDev = false;
1315 }
1316
1317 update = update.next;
1318 } while (update !== null);
1319
1320 workInProgressHook.memoizedState = newState;
1321 return [newState, dispatch];
1322 }
1323 }
1324
1325 return [workInProgressHook.memoizedState, dispatch];
1326 } else {
1327 {
1328 isInHookUserCodeInDev = true;
1329 }
1330
1331 var initialState;
1332
1333 if (reducer === basicStateReducer) {
1334 // Special case for `useState`.
1335 initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
1336 } else {
1337 initialState = init !== undefined ? init(initialArg) : initialArg;
1338 }
1339
1340 {
1341 isInHookUserCodeInDev = false;
1342 }
1343
1344 workInProgressHook.memoizedState = initialState;
1345
1346 var _queue = workInProgressHook.queue = {
1347 last: null,
1348 dispatch: null
1349 };
1350
1351 var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
1352
1353 return [workInProgressHook.memoizedState, _dispatch];
1354 }
1355}
1356
1357function useMemo(nextCreate, deps) {
1358 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1359 workInProgressHook = createWorkInProgressHook();
1360 var nextDeps = deps === undefined ? null : deps;
1361
1362 if (workInProgressHook !== null) {
1363 var prevState = workInProgressHook.memoizedState;
1364
1365 if (prevState !== null) {
1366 if (nextDeps !== null) {
1367 var prevDeps = prevState[1];
1368
1369 if (areHookInputsEqual(nextDeps, prevDeps)) {
1370 return prevState[0];
1371 }
1372 }
1373 }
1374 }
1375
1376 {
1377 isInHookUserCodeInDev = true;
1378 }
1379
1380 var nextValue = nextCreate();
1381
1382 {
1383 isInHookUserCodeInDev = false;
1384 }
1385
1386 workInProgressHook.memoizedState = [nextValue, nextDeps];
1387 return nextValue;
1388}
1389
1390function useRef(initialValue) {
1391 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1392 workInProgressHook = createWorkInProgressHook();
1393 var previousRef = workInProgressHook.memoizedState;
1394
1395 if (previousRef === null) {
1396 var ref = {
1397 current: initialValue
1398 };
1399
1400 {
1401 Object.seal(ref);
1402 }
1403
1404 workInProgressHook.memoizedState = ref;
1405 return ref;
1406 } else {
1407 return previousRef;
1408 }
1409}
1410
1411function useLayoutEffect(create, inputs) {
1412 {
1413 currentHookNameInDev = 'useLayoutEffect';
1414 }
1415
1416 warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://fb.me/react-uselayouteffect-ssr for common fixes.');
1417}
1418
1419function dispatchAction(componentIdentity, queue, action) {
1420 if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
1421 {
1422 throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
1423 }
1424 }
1425
1426 if (componentIdentity === currentlyRenderingComponent) {
1427 // This is a render phase update. Stash it in a lazily-created map of
1428 // queue -> linked list of updates. After this render pass, we'll restart
1429 // and apply the stashed updates on top of the work-in-progress hook.
1430 didScheduleRenderPhaseUpdate = true;
1431 var update = {
1432 action: action,
1433 next: null
1434 };
1435
1436 if (renderPhaseUpdates === null) {
1437 renderPhaseUpdates = new Map();
1438 }
1439
1440 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1441
1442 if (firstRenderPhaseUpdate === undefined) {
1443 renderPhaseUpdates.set(queue, update);
1444 } else {
1445 // Append the update to the end of the list.
1446 var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
1447
1448 while (lastRenderPhaseUpdate.next !== null) {
1449 lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
1450 }
1451
1452 lastRenderPhaseUpdate.next = update;
1453 }
1454 } else {// This means an update has happened after the function component has
1455 // returned. On the server this is a no-op. In React Fiber, the update
1456 // would be scheduled for a future render.
1457 }
1458}
1459
1460function useCallback(callback, deps) {
1461 // Callbacks are passed as they are in the server environment.
1462 return callback;
1463}
1464
1465function useResponder(responder, props) {
1466 return {
1467 props: props,
1468 responder: responder
1469 };
1470}
1471
1472function useDeferredValue(value, config) {
1473 resolveCurrentlyRenderingComponent();
1474 return value;
1475}
1476
1477function useTransition(config) {
1478 resolveCurrentlyRenderingComponent();
1479
1480 var startTransition = function (callback) {
1481 callback();
1482 };
1483
1484 return [startTransition, false];
1485}
1486
1487function noop() {}
1488
1489var currentThreadID = 0;
1490function setCurrentThreadID(threadID) {
1491 currentThreadID = threadID;
1492}
1493var Dispatcher = {
1494 readContext: readContext,
1495 useContext: useContext,
1496 useMemo: useMemo,
1497 useReducer: useReducer,
1498 useRef: useRef,
1499 useState: useState,
1500 useLayoutEffect: useLayoutEffect,
1501 useCallback: useCallback,
1502 // useImperativeHandle is not run in the server environment
1503 useImperativeHandle: noop,
1504 // Effects are not run in the server environment.
1505 useEffect: noop,
1506 // Debugging effect
1507 useDebugValue: noop,
1508 useResponder: useResponder,
1509 useDeferredValue: useDeferredValue,
1510 useTransition: useTransition
1511};
1512
1513var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
1514var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
1515var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1516var Namespaces = {
1517 html: HTML_NAMESPACE,
1518 mathml: MATH_NAMESPACE,
1519 svg: SVG_NAMESPACE
1520}; // Assumes there is no parent namespace.
1521
1522function getIntrinsicNamespace(type) {
1523 switch (type) {
1524 case 'svg':
1525 return SVG_NAMESPACE;
1526
1527 case 'math':
1528 return MATH_NAMESPACE;
1529
1530 default:
1531 return HTML_NAMESPACE;
1532 }
1533}
1534function getChildNamespace(parentNamespace, type) {
1535 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
1536 // No (or default) parent namespace: potential entry point.
1537 return getIntrinsicNamespace(type);
1538 }
1539
1540 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
1541 // We're leaving SVG.
1542 return HTML_NAMESPACE;
1543 } // By default, pass namespace below.
1544
1545
1546 return parentNamespace;
1547}
1548
1549var ReactDebugCurrentFrame$3 = null;
1550var ReactControlledValuePropTypes = {
1551 checkPropTypes: null
1552};
1553
1554{
1555 ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
1556 var hasReadOnlyValue = {
1557 button: true,
1558 checkbox: true,
1559 image: true,
1560 hidden: true,
1561 radio: true,
1562 reset: true,
1563 submit: true
1564 };
1565 var propTypes = {
1566 value: function (props, propName, componentName) {
1567 if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
1568 return null;
1569 }
1570
1571 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`.');
1572 },
1573 checked: function (props, propName, componentName) {
1574 if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
1575 return null;
1576 }
1577
1578 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`.');
1579 }
1580 };
1581 /**
1582 * Provide a linked `value` attribute for controlled forms. You should not use
1583 * this outside of the ReactDOM controlled form components.
1584 */
1585
1586 ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
1587 checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$3.getStackAddendum);
1588 };
1589}
1590
1591// For HTML, certain tags should omit their close tag. We keep a whitelist for
1592// those special-case tags.
1593var omittedCloseTags = {
1594 area: true,
1595 base: true,
1596 br: true,
1597 col: true,
1598 embed: true,
1599 hr: true,
1600 img: true,
1601 input: true,
1602 keygen: true,
1603 link: true,
1604 meta: true,
1605 param: true,
1606 source: true,
1607 track: true,
1608 wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
1609
1610};
1611
1612// `omittedCloseTags` except that `menuitem` should still have its closing tag.
1613
1614var voidElementTags = _assign({
1615 menuitem: true
1616}, omittedCloseTags);
1617
1618// or add stack by default to invariants where possible.
1619
1620var HTML = '__html';
1621var ReactDebugCurrentFrame$4 = null;
1622
1623{
1624 ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
1625}
1626
1627function assertValidProps(tag, props) {
1628 if (!props) {
1629 return;
1630 } // Note the use of `==` which checks for null or undefined.
1631
1632
1633 if (voidElementTags[tag]) {
1634 if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
1635 {
1636 throw Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + (ReactDebugCurrentFrame$4.getStackAddendum()));
1637 }
1638 }
1639 }
1640
1641 if (props.dangerouslySetInnerHTML != null) {
1642 if (!(props.children == null)) {
1643 {
1644 throw Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
1645 }
1646 }
1647
1648 if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
1649 {
1650 throw Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.");
1651 }
1652 }
1653 }
1654
1655 {
1656 !(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;
1657 }
1658
1659 if (!(props.style == null || typeof props.style === 'object')) {
1660 {
1661 throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + (ReactDebugCurrentFrame$4.getStackAddendum()));
1662 }
1663 }
1664}
1665
1666/**
1667 * CSS properties which accept numbers but are not in units of "px".
1668 */
1669var isUnitlessNumber = {
1670 animationIterationCount: true,
1671 borderImageOutset: true,
1672 borderImageSlice: true,
1673 borderImageWidth: true,
1674 boxFlex: true,
1675 boxFlexGroup: true,
1676 boxOrdinalGroup: true,
1677 columnCount: true,
1678 columns: true,
1679 flex: true,
1680 flexGrow: true,
1681 flexPositive: true,
1682 flexShrink: true,
1683 flexNegative: true,
1684 flexOrder: true,
1685 gridArea: true,
1686 gridRow: true,
1687 gridRowEnd: true,
1688 gridRowSpan: true,
1689 gridRowStart: true,
1690 gridColumn: true,
1691 gridColumnEnd: true,
1692 gridColumnSpan: true,
1693 gridColumnStart: true,
1694 fontWeight: true,
1695 lineClamp: true,
1696 lineHeight: true,
1697 opacity: true,
1698 order: true,
1699 orphans: true,
1700 tabSize: true,
1701 widows: true,
1702 zIndex: true,
1703 zoom: true,
1704 // SVG-related properties
1705 fillOpacity: true,
1706 floodOpacity: true,
1707 stopOpacity: true,
1708 strokeDasharray: true,
1709 strokeDashoffset: true,
1710 strokeMiterlimit: true,
1711 strokeOpacity: true,
1712 strokeWidth: true
1713};
1714/**
1715 * @param {string} prefix vendor-specific prefix, eg: Webkit
1716 * @param {string} key style name, eg: transitionDuration
1717 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
1718 * WebkitTransitionDuration
1719 */
1720
1721function prefixKey(prefix, key) {
1722 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
1723}
1724/**
1725 * Support style names that may come passed in prefixed by adding permutations
1726 * of vendor prefixes.
1727 */
1728
1729
1730var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
1731// infinite loop, because it iterates over the newly added props too.
1732
1733Object.keys(isUnitlessNumber).forEach(function (prop) {
1734 prefixes.forEach(function (prefix) {
1735 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
1736 });
1737});
1738
1739/**
1740 * Convert a value into the proper css writable value. The style name `name`
1741 * should be logical (no hyphens), as specified
1742 * in `CSSProperty.isUnitlessNumber`.
1743 *
1744 * @param {string} name CSS property name such as `topMargin`.
1745 * @param {*} value CSS property value such as `10px`.
1746 * @return {string} Normalized style value with dimensions applied.
1747 */
1748
1749function dangerousStyleValue(name, value, isCustomProperty) {
1750 // Note that we've removed escapeTextForBrowser() calls here since the
1751 // whole string will be escaped when the attribute is injected into
1752 // the markup. If you provide unsafe user data here they can inject
1753 // arbitrary CSS which may be problematic (I couldn't repro this):
1754 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
1755 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
1756 // This is not an XSS hole but instead a potential CSS injection issue
1757 // which has lead to a greater discussion about how we're going to
1758 // trust URLs moving forward. See #2115901
1759 var isEmpty = value == null || typeof value === 'boolean' || value === '';
1760
1761 if (isEmpty) {
1762 return '';
1763 }
1764
1765 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
1766 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
1767 }
1768
1769 return ('' + value).trim();
1770}
1771
1772var uppercasePattern = /([A-Z])/g;
1773var msPattern = /^ms-/;
1774/**
1775 * Hyphenates a camelcased CSS property name, for example:
1776 *
1777 * > hyphenateStyleName('backgroundColor')
1778 * < "background-color"
1779 * > hyphenateStyleName('MozTransition')
1780 * < "-moz-transition"
1781 * > hyphenateStyleName('msTransition')
1782 * < "-ms-transition"
1783 *
1784 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1785 * is converted to `-ms-`.
1786 */
1787
1788function hyphenateStyleName(name) {
1789 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
1790}
1791
1792function isCustomComponent(tagName, props) {
1793 if (tagName.indexOf('-') === -1) {
1794 return typeof props.is === 'string';
1795 }
1796
1797 switch (tagName) {
1798 // These are reserved SVG and MathML elements.
1799 // We don't mind this whitelist too much because we expect it to never grow.
1800 // The alternative is to track the namespace in a few places which is convoluted.
1801 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
1802 case 'annotation-xml':
1803 case 'color-profile':
1804 case 'font-face':
1805 case 'font-face-src':
1806 case 'font-face-uri':
1807 case 'font-face-format':
1808 case 'font-face-name':
1809 case 'missing-glyph':
1810 return false;
1811
1812 default:
1813 return true;
1814 }
1815}
1816
1817var warnValidStyle = function () {};
1818
1819{
1820 // 'msTransform' is correct, but the other prefixes should be capitalized
1821 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
1822 var msPattern$1 = /^-ms-/;
1823 var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
1824
1825 var badStyleValueWithSemicolonPattern = /;\s*$/;
1826 var warnedStyleNames = {};
1827 var warnedStyleValues = {};
1828 var warnedForNaNValue = false;
1829 var warnedForInfinityValue = false;
1830
1831 var camelize = function (string) {
1832 return string.replace(hyphenPattern, function (_, character) {
1833 return character.toUpperCase();
1834 });
1835 };
1836
1837 var warnHyphenatedStyleName = function (name) {
1838 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1839 return;
1840 }
1841
1842 warnedStyleNames[name] = true;
1843 warning$1(false, 'Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
1844 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
1845 // is converted to lowercase `ms`.
1846 camelize(name.replace(msPattern$1, 'ms-')));
1847 };
1848
1849 var warnBadVendoredStyleName = function (name) {
1850 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1851 return;
1852 }
1853
1854 warnedStyleNames[name] = true;
1855 warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
1856 };
1857
1858 var warnStyleValueWithSemicolon = function (name, value) {
1859 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
1860 return;
1861 }
1862
1863 warnedStyleValues[value] = true;
1864 warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
1865 };
1866
1867 var warnStyleValueIsNaN = function (name, value) {
1868 if (warnedForNaNValue) {
1869 return;
1870 }
1871
1872 warnedForNaNValue = true;
1873 warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
1874 };
1875
1876 var warnStyleValueIsInfinity = function (name, value) {
1877 if (warnedForInfinityValue) {
1878 return;
1879 }
1880
1881 warnedForInfinityValue = true;
1882 warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
1883 };
1884
1885 warnValidStyle = function (name, value) {
1886 if (name.indexOf('-') > -1) {
1887 warnHyphenatedStyleName(name);
1888 } else if (badVendoredStyleNamePattern.test(name)) {
1889 warnBadVendoredStyleName(name);
1890 } else if (badStyleValueWithSemicolonPattern.test(value)) {
1891 warnStyleValueWithSemicolon(name, value);
1892 }
1893
1894 if (typeof value === 'number') {
1895 if (isNaN(value)) {
1896 warnStyleValueIsNaN(name, value);
1897 } else if (!isFinite(value)) {
1898 warnStyleValueIsInfinity(name, value);
1899 }
1900 }
1901 };
1902}
1903
1904var warnValidStyle$1 = warnValidStyle;
1905
1906var ariaProperties = {
1907 'aria-current': 0,
1908 // state
1909 'aria-details': 0,
1910 'aria-disabled': 0,
1911 // state
1912 'aria-hidden': 0,
1913 // state
1914 'aria-invalid': 0,
1915 // state
1916 'aria-keyshortcuts': 0,
1917 'aria-label': 0,
1918 'aria-roledescription': 0,
1919 // Widget Attributes
1920 'aria-autocomplete': 0,
1921 'aria-checked': 0,
1922 'aria-expanded': 0,
1923 'aria-haspopup': 0,
1924 'aria-level': 0,
1925 'aria-modal': 0,
1926 'aria-multiline': 0,
1927 'aria-multiselectable': 0,
1928 'aria-orientation': 0,
1929 'aria-placeholder': 0,
1930 'aria-pressed': 0,
1931 'aria-readonly': 0,
1932 'aria-required': 0,
1933 'aria-selected': 0,
1934 'aria-sort': 0,
1935 'aria-valuemax': 0,
1936 'aria-valuemin': 0,
1937 'aria-valuenow': 0,
1938 'aria-valuetext': 0,
1939 // Live Region Attributes
1940 'aria-atomic': 0,
1941 'aria-busy': 0,
1942 'aria-live': 0,
1943 'aria-relevant': 0,
1944 // Drag-and-Drop Attributes
1945 'aria-dropeffect': 0,
1946 'aria-grabbed': 0,
1947 // Relationship Attributes
1948 'aria-activedescendant': 0,
1949 'aria-colcount': 0,
1950 'aria-colindex': 0,
1951 'aria-colspan': 0,
1952 'aria-controls': 0,
1953 'aria-describedby': 0,
1954 'aria-errormessage': 0,
1955 'aria-flowto': 0,
1956 'aria-labelledby': 0,
1957 'aria-owns': 0,
1958 'aria-posinset': 0,
1959 'aria-rowcount': 0,
1960 'aria-rowindex': 0,
1961 'aria-rowspan': 0,
1962 'aria-setsize': 0
1963};
1964
1965var warnedProperties = {};
1966var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
1967var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
1968var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1969
1970function validateProperty(tagName, name) {
1971 if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
1972 return true;
1973 }
1974
1975 if (rARIACamel.test(name)) {
1976 var ariaName = 'aria-' + name.slice(4).toLowerCase();
1977 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1978 // DOM properties, then it is an invalid aria-* attribute.
1979
1980 if (correctName == null) {
1981 warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
1982 warnedProperties[name] = true;
1983 return true;
1984 } // aria-* attributes should be lowercase; suggest the lowercase version.
1985
1986
1987 if (name !== correctName) {
1988 warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
1989 warnedProperties[name] = true;
1990 return true;
1991 }
1992 }
1993
1994 if (rARIA.test(name)) {
1995 var lowerCasedName = name.toLowerCase();
1996 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1997 // DOM properties, then it is an invalid aria-* attribute.
1998
1999 if (standardName == null) {
2000 warnedProperties[name] = true;
2001 return false;
2002 } // aria-* attributes should be lowercase; suggest the lowercase version.
2003
2004
2005 if (name !== standardName) {
2006 warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
2007 warnedProperties[name] = true;
2008 return true;
2009 }
2010 }
2011
2012 return true;
2013}
2014
2015function warnInvalidARIAProps(type, props) {
2016 var invalidProps = [];
2017
2018 for (var key in props) {
2019 var isValid = validateProperty(type, key);
2020
2021 if (!isValid) {
2022 invalidProps.push(key);
2023 }
2024 }
2025
2026 var unknownPropString = invalidProps.map(function (prop) {
2027 return '`' + prop + '`';
2028 }).join(', ');
2029
2030 if (invalidProps.length === 1) {
2031 warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2032 } else if (invalidProps.length > 1) {
2033 warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2034 }
2035}
2036
2037function validateProperties(type, props) {
2038 if (isCustomComponent(type, props)) {
2039 return;
2040 }
2041
2042 warnInvalidARIAProps(type, props);
2043}
2044
2045var didWarnValueNull = false;
2046function validateProperties$1(type, props) {
2047 if (type !== 'input' && type !== 'textarea' && type !== 'select') {
2048 return;
2049 }
2050
2051 if (props != null && props.value === null && !didWarnValueNull) {
2052 didWarnValueNull = true;
2053
2054 if (type === 'select' && props.multiple) {
2055 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);
2056 } else {
2057 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);
2058 }
2059 }
2060}
2061
2062/**
2063 * Registers plugins so that they can extract and dispatch events.
2064 *
2065 * @see {EventPluginHub}
2066 */
2067
2068/**
2069 * Ordered list of injected plugins.
2070 */
2071
2072
2073
2074/**
2075 * Mapping from event name to dispatch config
2076 */
2077
2078
2079/**
2080 * Mapping from registration name to plugin module
2081 */
2082
2083var registrationNameModules = {};
2084/**
2085 * Mapping from registration name to event name
2086 */
2087
2088
2089/**
2090 * Mapping from lowercase registration names to the properly cased version,
2091 * used to warn in the case of missing event handlers. Available
2092 * only in true.
2093 * @type {Object}
2094 */
2095
2096var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true
2097
2098/**
2099 * Injects an ordering of plugins (by plugin name). This allows the ordering
2100 * to be decoupled from injection of the actual plugins so that ordering is
2101 * always deterministic regardless of packaging, on-the-fly injection, etc.
2102 *
2103 * @param {array} InjectedEventPluginOrder
2104 * @internal
2105 * @see {EventPluginHub.injection.injectEventPluginOrder}
2106 */
2107
2108
2109/**
2110 * Injects plugins to be used by `EventPluginHub`. The plugin names must be
2111 * in the ordering injected by `injectEventPluginOrder`.
2112 *
2113 * Plugins can be injected as part of page initialization or on-the-fly.
2114 *
2115 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2116 * @internal
2117 * @see {EventPluginHub.injection.injectEventPluginsByName}
2118 */
2119
2120// When adding attributes to the HTML or SVG whitelist, be sure to
2121// also add them to this module to ensure casing and incorrect name
2122// warnings.
2123var possibleStandardNames = {
2124 // HTML
2125 accept: 'accept',
2126 acceptcharset: 'acceptCharset',
2127 'accept-charset': 'acceptCharset',
2128 accesskey: 'accessKey',
2129 action: 'action',
2130 allowfullscreen: 'allowFullScreen',
2131 alt: 'alt',
2132 as: 'as',
2133 async: 'async',
2134 autocapitalize: 'autoCapitalize',
2135 autocomplete: 'autoComplete',
2136 autocorrect: 'autoCorrect',
2137 autofocus: 'autoFocus',
2138 autoplay: 'autoPlay',
2139 autosave: 'autoSave',
2140 capture: 'capture',
2141 cellpadding: 'cellPadding',
2142 cellspacing: 'cellSpacing',
2143 challenge: 'challenge',
2144 charset: 'charSet',
2145 checked: 'checked',
2146 children: 'children',
2147 cite: 'cite',
2148 class: 'className',
2149 classid: 'classID',
2150 classname: 'className',
2151 cols: 'cols',
2152 colspan: 'colSpan',
2153 content: 'content',
2154 contenteditable: 'contentEditable',
2155 contextmenu: 'contextMenu',
2156 controls: 'controls',
2157 controlslist: 'controlsList',
2158 coords: 'coords',
2159 crossorigin: 'crossOrigin',
2160 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
2161 data: 'data',
2162 datetime: 'dateTime',
2163 default: 'default',
2164 defaultchecked: 'defaultChecked',
2165 defaultvalue: 'defaultValue',
2166 defer: 'defer',
2167 dir: 'dir',
2168 disabled: 'disabled',
2169 disablepictureinpicture: 'disablePictureInPicture',
2170 download: 'download',
2171 draggable: 'draggable',
2172 enctype: 'encType',
2173 for: 'htmlFor',
2174 form: 'form',
2175 formmethod: 'formMethod',
2176 formaction: 'formAction',
2177 formenctype: 'formEncType',
2178 formnovalidate: 'formNoValidate',
2179 formtarget: 'formTarget',
2180 frameborder: 'frameBorder',
2181 headers: 'headers',
2182 height: 'height',
2183 hidden: 'hidden',
2184 high: 'high',
2185 href: 'href',
2186 hreflang: 'hrefLang',
2187 htmlfor: 'htmlFor',
2188 httpequiv: 'httpEquiv',
2189 'http-equiv': 'httpEquiv',
2190 icon: 'icon',
2191 id: 'id',
2192 innerhtml: 'innerHTML',
2193 inputmode: 'inputMode',
2194 integrity: 'integrity',
2195 is: 'is',
2196 itemid: 'itemID',
2197 itemprop: 'itemProp',
2198 itemref: 'itemRef',
2199 itemscope: 'itemScope',
2200 itemtype: 'itemType',
2201 keyparams: 'keyParams',
2202 keytype: 'keyType',
2203 kind: 'kind',
2204 label: 'label',
2205 lang: 'lang',
2206 list: 'list',
2207 loop: 'loop',
2208 low: 'low',
2209 manifest: 'manifest',
2210 marginwidth: 'marginWidth',
2211 marginheight: 'marginHeight',
2212 max: 'max',
2213 maxlength: 'maxLength',
2214 media: 'media',
2215 mediagroup: 'mediaGroup',
2216 method: 'method',
2217 min: 'min',
2218 minlength: 'minLength',
2219 multiple: 'multiple',
2220 muted: 'muted',
2221 name: 'name',
2222 nomodule: 'noModule',
2223 nonce: 'nonce',
2224 novalidate: 'noValidate',
2225 open: 'open',
2226 optimum: 'optimum',
2227 pattern: 'pattern',
2228 placeholder: 'placeholder',
2229 playsinline: 'playsInline',
2230 poster: 'poster',
2231 preload: 'preload',
2232 profile: 'profile',
2233 radiogroup: 'radioGroup',
2234 readonly: 'readOnly',
2235 referrerpolicy: 'referrerPolicy',
2236 rel: 'rel',
2237 required: 'required',
2238 reversed: 'reversed',
2239 role: 'role',
2240 rows: 'rows',
2241 rowspan: 'rowSpan',
2242 sandbox: 'sandbox',
2243 scope: 'scope',
2244 scoped: 'scoped',
2245 scrolling: 'scrolling',
2246 seamless: 'seamless',
2247 selected: 'selected',
2248 shape: 'shape',
2249 size: 'size',
2250 sizes: 'sizes',
2251 span: 'span',
2252 spellcheck: 'spellCheck',
2253 src: 'src',
2254 srcdoc: 'srcDoc',
2255 srclang: 'srcLang',
2256 srcset: 'srcSet',
2257 start: 'start',
2258 step: 'step',
2259 style: 'style',
2260 summary: 'summary',
2261 tabindex: 'tabIndex',
2262 target: 'target',
2263 title: 'title',
2264 type: 'type',
2265 usemap: 'useMap',
2266 value: 'value',
2267 width: 'width',
2268 wmode: 'wmode',
2269 wrap: 'wrap',
2270 // SVG
2271 about: 'about',
2272 accentheight: 'accentHeight',
2273 'accent-height': 'accentHeight',
2274 accumulate: 'accumulate',
2275 additive: 'additive',
2276 alignmentbaseline: 'alignmentBaseline',
2277 'alignment-baseline': 'alignmentBaseline',
2278 allowreorder: 'allowReorder',
2279 alphabetic: 'alphabetic',
2280 amplitude: 'amplitude',
2281 arabicform: 'arabicForm',
2282 'arabic-form': 'arabicForm',
2283 ascent: 'ascent',
2284 attributename: 'attributeName',
2285 attributetype: 'attributeType',
2286 autoreverse: 'autoReverse',
2287 azimuth: 'azimuth',
2288 basefrequency: 'baseFrequency',
2289 baselineshift: 'baselineShift',
2290 'baseline-shift': 'baselineShift',
2291 baseprofile: 'baseProfile',
2292 bbox: 'bbox',
2293 begin: 'begin',
2294 bias: 'bias',
2295 by: 'by',
2296 calcmode: 'calcMode',
2297 capheight: 'capHeight',
2298 'cap-height': 'capHeight',
2299 clip: 'clip',
2300 clippath: 'clipPath',
2301 'clip-path': 'clipPath',
2302 clippathunits: 'clipPathUnits',
2303 cliprule: 'clipRule',
2304 'clip-rule': 'clipRule',
2305 color: 'color',
2306 colorinterpolation: 'colorInterpolation',
2307 'color-interpolation': 'colorInterpolation',
2308 colorinterpolationfilters: 'colorInterpolationFilters',
2309 'color-interpolation-filters': 'colorInterpolationFilters',
2310 colorprofile: 'colorProfile',
2311 'color-profile': 'colorProfile',
2312 colorrendering: 'colorRendering',
2313 'color-rendering': 'colorRendering',
2314 contentscripttype: 'contentScriptType',
2315 contentstyletype: 'contentStyleType',
2316 cursor: 'cursor',
2317 cx: 'cx',
2318 cy: 'cy',
2319 d: 'd',
2320 datatype: 'datatype',
2321 decelerate: 'decelerate',
2322 descent: 'descent',
2323 diffuseconstant: 'diffuseConstant',
2324 direction: 'direction',
2325 display: 'display',
2326 divisor: 'divisor',
2327 dominantbaseline: 'dominantBaseline',
2328 'dominant-baseline': 'dominantBaseline',
2329 dur: 'dur',
2330 dx: 'dx',
2331 dy: 'dy',
2332 edgemode: 'edgeMode',
2333 elevation: 'elevation',
2334 enablebackground: 'enableBackground',
2335 'enable-background': 'enableBackground',
2336 end: 'end',
2337 exponent: 'exponent',
2338 externalresourcesrequired: 'externalResourcesRequired',
2339 fill: 'fill',
2340 fillopacity: 'fillOpacity',
2341 'fill-opacity': 'fillOpacity',
2342 fillrule: 'fillRule',
2343 'fill-rule': 'fillRule',
2344 filter: 'filter',
2345 filterres: 'filterRes',
2346 filterunits: 'filterUnits',
2347 floodopacity: 'floodOpacity',
2348 'flood-opacity': 'floodOpacity',
2349 floodcolor: 'floodColor',
2350 'flood-color': 'floodColor',
2351 focusable: 'focusable',
2352 fontfamily: 'fontFamily',
2353 'font-family': 'fontFamily',
2354 fontsize: 'fontSize',
2355 'font-size': 'fontSize',
2356 fontsizeadjust: 'fontSizeAdjust',
2357 'font-size-adjust': 'fontSizeAdjust',
2358 fontstretch: 'fontStretch',
2359 'font-stretch': 'fontStretch',
2360 fontstyle: 'fontStyle',
2361 'font-style': 'fontStyle',
2362 fontvariant: 'fontVariant',
2363 'font-variant': 'fontVariant',
2364 fontweight: 'fontWeight',
2365 'font-weight': 'fontWeight',
2366 format: 'format',
2367 from: 'from',
2368 fx: 'fx',
2369 fy: 'fy',
2370 g1: 'g1',
2371 g2: 'g2',
2372 glyphname: 'glyphName',
2373 'glyph-name': 'glyphName',
2374 glyphorientationhorizontal: 'glyphOrientationHorizontal',
2375 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
2376 glyphorientationvertical: 'glyphOrientationVertical',
2377 'glyph-orientation-vertical': 'glyphOrientationVertical',
2378 glyphref: 'glyphRef',
2379 gradienttransform: 'gradientTransform',
2380 gradientunits: 'gradientUnits',
2381 hanging: 'hanging',
2382 horizadvx: 'horizAdvX',
2383 'horiz-adv-x': 'horizAdvX',
2384 horizoriginx: 'horizOriginX',
2385 'horiz-origin-x': 'horizOriginX',
2386 ideographic: 'ideographic',
2387 imagerendering: 'imageRendering',
2388 'image-rendering': 'imageRendering',
2389 in2: 'in2',
2390 in: 'in',
2391 inlist: 'inlist',
2392 intercept: 'intercept',
2393 k1: 'k1',
2394 k2: 'k2',
2395 k3: 'k3',
2396 k4: 'k4',
2397 k: 'k',
2398 kernelmatrix: 'kernelMatrix',
2399 kernelunitlength: 'kernelUnitLength',
2400 kerning: 'kerning',
2401 keypoints: 'keyPoints',
2402 keysplines: 'keySplines',
2403 keytimes: 'keyTimes',
2404 lengthadjust: 'lengthAdjust',
2405 letterspacing: 'letterSpacing',
2406 'letter-spacing': 'letterSpacing',
2407 lightingcolor: 'lightingColor',
2408 'lighting-color': 'lightingColor',
2409 limitingconeangle: 'limitingConeAngle',
2410 local: 'local',
2411 markerend: 'markerEnd',
2412 'marker-end': 'markerEnd',
2413 markerheight: 'markerHeight',
2414 markermid: 'markerMid',
2415 'marker-mid': 'markerMid',
2416 markerstart: 'markerStart',
2417 'marker-start': 'markerStart',
2418 markerunits: 'markerUnits',
2419 markerwidth: 'markerWidth',
2420 mask: 'mask',
2421 maskcontentunits: 'maskContentUnits',
2422 maskunits: 'maskUnits',
2423 mathematical: 'mathematical',
2424 mode: 'mode',
2425 numoctaves: 'numOctaves',
2426 offset: 'offset',
2427 opacity: 'opacity',
2428 operator: 'operator',
2429 order: 'order',
2430 orient: 'orient',
2431 orientation: 'orientation',
2432 origin: 'origin',
2433 overflow: 'overflow',
2434 overlineposition: 'overlinePosition',
2435 'overline-position': 'overlinePosition',
2436 overlinethickness: 'overlineThickness',
2437 'overline-thickness': 'overlineThickness',
2438 paintorder: 'paintOrder',
2439 'paint-order': 'paintOrder',
2440 panose1: 'panose1',
2441 'panose-1': 'panose1',
2442 pathlength: 'pathLength',
2443 patterncontentunits: 'patternContentUnits',
2444 patterntransform: 'patternTransform',
2445 patternunits: 'patternUnits',
2446 pointerevents: 'pointerEvents',
2447 'pointer-events': 'pointerEvents',
2448 points: 'points',
2449 pointsatx: 'pointsAtX',
2450 pointsaty: 'pointsAtY',
2451 pointsatz: 'pointsAtZ',
2452 prefix: 'prefix',
2453 preservealpha: 'preserveAlpha',
2454 preserveaspectratio: 'preserveAspectRatio',
2455 primitiveunits: 'primitiveUnits',
2456 property: 'property',
2457 r: 'r',
2458 radius: 'radius',
2459 refx: 'refX',
2460 refy: 'refY',
2461 renderingintent: 'renderingIntent',
2462 'rendering-intent': 'renderingIntent',
2463 repeatcount: 'repeatCount',
2464 repeatdur: 'repeatDur',
2465 requiredextensions: 'requiredExtensions',
2466 requiredfeatures: 'requiredFeatures',
2467 resource: 'resource',
2468 restart: 'restart',
2469 result: 'result',
2470 results: 'results',
2471 rotate: 'rotate',
2472 rx: 'rx',
2473 ry: 'ry',
2474 scale: 'scale',
2475 security: 'security',
2476 seed: 'seed',
2477 shaperendering: 'shapeRendering',
2478 'shape-rendering': 'shapeRendering',
2479 slope: 'slope',
2480 spacing: 'spacing',
2481 specularconstant: 'specularConstant',
2482 specularexponent: 'specularExponent',
2483 speed: 'speed',
2484 spreadmethod: 'spreadMethod',
2485 startoffset: 'startOffset',
2486 stddeviation: 'stdDeviation',
2487 stemh: 'stemh',
2488 stemv: 'stemv',
2489 stitchtiles: 'stitchTiles',
2490 stopcolor: 'stopColor',
2491 'stop-color': 'stopColor',
2492 stopopacity: 'stopOpacity',
2493 'stop-opacity': 'stopOpacity',
2494 strikethroughposition: 'strikethroughPosition',
2495 'strikethrough-position': 'strikethroughPosition',
2496 strikethroughthickness: 'strikethroughThickness',
2497 'strikethrough-thickness': 'strikethroughThickness',
2498 string: 'string',
2499 stroke: 'stroke',
2500 strokedasharray: 'strokeDasharray',
2501 'stroke-dasharray': 'strokeDasharray',
2502 strokedashoffset: 'strokeDashoffset',
2503 'stroke-dashoffset': 'strokeDashoffset',
2504 strokelinecap: 'strokeLinecap',
2505 'stroke-linecap': 'strokeLinecap',
2506 strokelinejoin: 'strokeLinejoin',
2507 'stroke-linejoin': 'strokeLinejoin',
2508 strokemiterlimit: 'strokeMiterlimit',
2509 'stroke-miterlimit': 'strokeMiterlimit',
2510 strokewidth: 'strokeWidth',
2511 'stroke-width': 'strokeWidth',
2512 strokeopacity: 'strokeOpacity',
2513 'stroke-opacity': 'strokeOpacity',
2514 suppresscontenteditablewarning: 'suppressContentEditableWarning',
2515 suppresshydrationwarning: 'suppressHydrationWarning',
2516 surfacescale: 'surfaceScale',
2517 systemlanguage: 'systemLanguage',
2518 tablevalues: 'tableValues',
2519 targetx: 'targetX',
2520 targety: 'targetY',
2521 textanchor: 'textAnchor',
2522 'text-anchor': 'textAnchor',
2523 textdecoration: 'textDecoration',
2524 'text-decoration': 'textDecoration',
2525 textlength: 'textLength',
2526 textrendering: 'textRendering',
2527 'text-rendering': 'textRendering',
2528 to: 'to',
2529 transform: 'transform',
2530 typeof: 'typeof',
2531 u1: 'u1',
2532 u2: 'u2',
2533 underlineposition: 'underlinePosition',
2534 'underline-position': 'underlinePosition',
2535 underlinethickness: 'underlineThickness',
2536 'underline-thickness': 'underlineThickness',
2537 unicode: 'unicode',
2538 unicodebidi: 'unicodeBidi',
2539 'unicode-bidi': 'unicodeBidi',
2540 unicoderange: 'unicodeRange',
2541 'unicode-range': 'unicodeRange',
2542 unitsperem: 'unitsPerEm',
2543 'units-per-em': 'unitsPerEm',
2544 unselectable: 'unselectable',
2545 valphabetic: 'vAlphabetic',
2546 'v-alphabetic': 'vAlphabetic',
2547 values: 'values',
2548 vectoreffect: 'vectorEffect',
2549 'vector-effect': 'vectorEffect',
2550 version: 'version',
2551 vertadvy: 'vertAdvY',
2552 'vert-adv-y': 'vertAdvY',
2553 vertoriginx: 'vertOriginX',
2554 'vert-origin-x': 'vertOriginX',
2555 vertoriginy: 'vertOriginY',
2556 'vert-origin-y': 'vertOriginY',
2557 vhanging: 'vHanging',
2558 'v-hanging': 'vHanging',
2559 videographic: 'vIdeographic',
2560 'v-ideographic': 'vIdeographic',
2561 viewbox: 'viewBox',
2562 viewtarget: 'viewTarget',
2563 visibility: 'visibility',
2564 vmathematical: 'vMathematical',
2565 'v-mathematical': 'vMathematical',
2566 vocab: 'vocab',
2567 widths: 'widths',
2568 wordspacing: 'wordSpacing',
2569 'word-spacing': 'wordSpacing',
2570 writingmode: 'writingMode',
2571 'writing-mode': 'writingMode',
2572 x1: 'x1',
2573 x2: 'x2',
2574 x: 'x',
2575 xchannelselector: 'xChannelSelector',
2576 xheight: 'xHeight',
2577 'x-height': 'xHeight',
2578 xlinkactuate: 'xlinkActuate',
2579 'xlink:actuate': 'xlinkActuate',
2580 xlinkarcrole: 'xlinkArcrole',
2581 'xlink:arcrole': 'xlinkArcrole',
2582 xlinkhref: 'xlinkHref',
2583 'xlink:href': 'xlinkHref',
2584 xlinkrole: 'xlinkRole',
2585 'xlink:role': 'xlinkRole',
2586 xlinkshow: 'xlinkShow',
2587 'xlink:show': 'xlinkShow',
2588 xlinktitle: 'xlinkTitle',
2589 'xlink:title': 'xlinkTitle',
2590 xlinktype: 'xlinkType',
2591 'xlink:type': 'xlinkType',
2592 xmlbase: 'xmlBase',
2593 'xml:base': 'xmlBase',
2594 xmllang: 'xmlLang',
2595 'xml:lang': 'xmlLang',
2596 xmlns: 'xmlns',
2597 'xml:space': 'xmlSpace',
2598 xmlnsxlink: 'xmlnsXlink',
2599 'xmlns:xlink': 'xmlnsXlink',
2600 xmlspace: 'xmlSpace',
2601 y1: 'y1',
2602 y2: 'y2',
2603 y: 'y',
2604 ychannelselector: 'yChannelSelector',
2605 z: 'z',
2606 zoomandpan: 'zoomAndPan'
2607};
2608
2609var validateProperty$1 = function () {};
2610
2611{
2612 var warnedProperties$1 = {};
2613 var _hasOwnProperty = Object.prototype.hasOwnProperty;
2614 var EVENT_NAME_REGEX = /^on./;
2615 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
2616 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
2617 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
2618
2619 validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
2620 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
2621 return true;
2622 }
2623
2624 var lowerCasedName = name.toLowerCase();
2625
2626 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
2627 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.');
2628 warnedProperties$1[name] = true;
2629 return true;
2630 } // We can't rely on the event system being injected on the server.
2631
2632
2633 if (canUseEventSystem) {
2634 if (registrationNameModules.hasOwnProperty(name)) {
2635 return true;
2636 }
2637
2638 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
2639
2640 if (registrationName != null) {
2641 warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
2642 warnedProperties$1[name] = true;
2643 return true;
2644 }
2645
2646 if (EVENT_NAME_REGEX.test(name)) {
2647 warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
2648 warnedProperties$1[name] = true;
2649 return true;
2650 }
2651 } else if (EVENT_NAME_REGEX.test(name)) {
2652 // If no event plugins have been injected, we are in a server environment.
2653 // So we can't tell if the event name is correct for sure, but we can filter
2654 // out known bad ones like `onclick`. We can't suggest a specific replacement though.
2655 if (INVALID_EVENT_NAME_REGEX.test(name)) {
2656 warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
2657 }
2658
2659 warnedProperties$1[name] = true;
2660 return true;
2661 } // Let the ARIA attribute hook validate ARIA attributes
2662
2663
2664 if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
2665 return true;
2666 }
2667
2668 if (lowerCasedName === 'innerhtml') {
2669 warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
2670 warnedProperties$1[name] = true;
2671 return true;
2672 }
2673
2674 if (lowerCasedName === 'aria') {
2675 warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
2676 warnedProperties$1[name] = true;
2677 return true;
2678 }
2679
2680 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
2681 warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
2682 warnedProperties$1[name] = true;
2683 return true;
2684 }
2685
2686 if (typeof value === 'number' && isNaN(value)) {
2687 warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
2688 warnedProperties$1[name] = true;
2689 return true;
2690 }
2691
2692 var propertyInfo = getPropertyInfo(name);
2693 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
2694
2695 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
2696 var standardName = possibleStandardNames[lowerCasedName];
2697
2698 if (standardName !== name) {
2699 warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
2700 warnedProperties$1[name] = true;
2701 return true;
2702 }
2703 } else if (!isReserved && name !== lowerCasedName) {
2704 // Unknown attributes should have lowercase casing since that's how they
2705 // will be cased anyway with server rendering.
2706 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);
2707 warnedProperties$1[name] = true;
2708 return true;
2709 }
2710
2711 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2712 if (value) {
2713 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);
2714 } else {
2715 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);
2716 }
2717
2718 warnedProperties$1[name] = true;
2719 return true;
2720 } // Now that we've validated casing, do not validate
2721 // data types for reserved props
2722
2723
2724 if (isReserved) {
2725 return true;
2726 } // Warn when a known attribute is a bad type
2727
2728
2729 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2730 warnedProperties$1[name] = true;
2731 return false;
2732 } // Warn when passing the strings 'false' or 'true' into a boolean prop
2733
2734
2735 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
2736 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);
2737 warnedProperties$1[name] = true;
2738 return true;
2739 }
2740
2741 return true;
2742 };
2743}
2744
2745var warnUnknownProperties = function (type, props, canUseEventSystem) {
2746 var unknownProps = [];
2747
2748 for (var key in props) {
2749 var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
2750
2751 if (!isValid) {
2752 unknownProps.push(key);
2753 }
2754 }
2755
2756 var unknownPropString = unknownProps.map(function (prop) {
2757 return '`' + prop + '`';
2758 }).join(', ');
2759
2760 if (unknownProps.length === 1) {
2761 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);
2762 } else if (unknownProps.length > 1) {
2763 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);
2764 }
2765};
2766
2767function validateProperties$2(type, props, canUseEventSystem) {
2768 if (isCustomComponent(type, props)) {
2769 return;
2770 }
2771
2772 warnUnknownProperties(type, props, canUseEventSystem);
2773}
2774
2775var toArray = React.Children.toArray; // This is only used in DEV.
2776// Each entry is `this.stack` from a currently executing renderer instance.
2777// (There may be more than one because ReactDOMServer is reentrant).
2778// Each stack is an array of frames which may contain nested stacks of elements.
2779
2780var currentDebugStacks = [];
2781var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
2782var ReactDebugCurrentFrame;
2783var prevGetCurrentStackImpl = null;
2784
2785var getCurrentServerStackImpl = function () {
2786 return '';
2787};
2788
2789var describeStackFrame = function (element) {
2790 return '';
2791};
2792
2793var validatePropertiesInDevelopment = function (type, props) {};
2794
2795var pushCurrentDebugStack = function (stack) {};
2796
2797var pushElementToDebugStack = function (element) {};
2798
2799var popCurrentDebugStack = function () {};
2800
2801var hasWarnedAboutUsingContextAsConsumer = false;
2802
2803{
2804 ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2805
2806 validatePropertiesInDevelopment = function (type, props) {
2807 validateProperties(type, props);
2808 validateProperties$1(type, props);
2809 validateProperties$2(type, props,
2810 /* canUseEventSystem */
2811 false);
2812 };
2813
2814 describeStackFrame = function (element) {
2815 var source = element._source;
2816 var type = element.type;
2817 var name = getComponentName(type);
2818 var ownerName = null;
2819 return describeComponentFrame(name, source, ownerName);
2820 };
2821
2822 pushCurrentDebugStack = function (stack) {
2823 currentDebugStacks.push(stack);
2824
2825 if (currentDebugStacks.length === 1) {
2826 // We are entering a server renderer.
2827 // Remember the previous (e.g. client) global stack implementation.
2828 prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
2829 ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
2830 }
2831 };
2832
2833 pushElementToDebugStack = function (element) {
2834 // For the innermost executing ReactDOMServer call,
2835 var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
2836
2837 var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
2838
2839 frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
2840 // children and directly handle them in an inner loop instead of
2841 // creating separate frames for them.
2842 };
2843
2844 popCurrentDebugStack = function () {
2845 currentDebugStacks.pop();
2846
2847 if (currentDebugStacks.length === 0) {
2848 // We are exiting the server renderer.
2849 // Restore the previous (e.g. client) global stack implementation.
2850 ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
2851 prevGetCurrentStackImpl = null;
2852 }
2853 };
2854
2855 getCurrentServerStackImpl = function () {
2856 if (currentDebugStacks.length === 0) {
2857 // Nothing is currently rendering.
2858 return '';
2859 } // ReactDOMServer is reentrant so there may be multiple calls at the same time.
2860 // Take the frames from the innermost call which is the last in the array.
2861
2862
2863 var frames = currentDebugStacks[currentDebugStacks.length - 1];
2864 var stack = ''; // Go through every frame in the stack from the innermost one.
2865
2866 for (var i = frames.length - 1; i >= 0; i--) {
2867 var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
2868 // This is because single-child nesting doesn't create materialized frames.
2869 // Instead it would push them through `pushElementToDebugStack()`.
2870
2871 var debugElementStack = frame.debugElementStack;
2872
2873 for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
2874 stack += describeStackFrame(debugElementStack[ii]);
2875 }
2876 }
2877
2878 return stack;
2879 };
2880}
2881
2882var didWarnDefaultInputValue = false;
2883var didWarnDefaultChecked = false;
2884var didWarnDefaultSelectValue = false;
2885var didWarnDefaultTextareaValue = false;
2886var didWarnInvalidOptionChildren = false;
2887var didWarnAboutNoopUpdateForComponent = {};
2888var didWarnAboutBadClass = {};
2889var didWarnAboutModulePatternComponent = {};
2890var didWarnAboutDeprecatedWillMount = {};
2891var didWarnAboutUndefinedDerivedState = {};
2892var didWarnAboutUninitializedState = {};
2893var valuePropNames = ['value', 'defaultValue'];
2894var newlineEatingTags = {
2895 listing: true,
2896 pre: true,
2897 textarea: true
2898}; // We accept any tag to be rendered but since this gets injected into arbitrary
2899// HTML, we want to make sure that it's a safe tag.
2900// http://www.w3.org/TR/REC-xml/#NT-Name
2901
2902var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
2903
2904var validatedTagCache = {};
2905
2906function validateDangerousTag(tag) {
2907 if (!validatedTagCache.hasOwnProperty(tag)) {
2908 if (!VALID_TAG_REGEX.test(tag)) {
2909 {
2910 throw Error("Invalid tag: " + tag);
2911 }
2912 }
2913
2914 validatedTagCache[tag] = true;
2915 }
2916}
2917
2918var styleNameCache = {};
2919
2920var processStyleName = function (styleName) {
2921 if (styleNameCache.hasOwnProperty(styleName)) {
2922 return styleNameCache[styleName];
2923 }
2924
2925 var result = hyphenateStyleName(styleName);
2926 styleNameCache[styleName] = result;
2927 return result;
2928};
2929
2930function createMarkupForStyles(styles) {
2931 var serialized = '';
2932 var delimiter = '';
2933
2934 for (var styleName in styles) {
2935 if (!styles.hasOwnProperty(styleName)) {
2936 continue;
2937 }
2938
2939 var isCustomProperty = styleName.indexOf('--') === 0;
2940 var styleValue = styles[styleName];
2941
2942 {
2943 if (!isCustomProperty) {
2944 warnValidStyle$1(styleName, styleValue);
2945 }
2946 }
2947
2948 if (styleValue != null) {
2949 serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
2950 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
2951 delimiter = ';';
2952 }
2953 }
2954
2955 return serialized || null;
2956}
2957
2958function warnNoop(publicInstance, callerName) {
2959 {
2960 var _constructor = publicInstance.constructor;
2961 var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
2962 var warningKey = componentName + '.' + callerName;
2963
2964 if (didWarnAboutNoopUpdateForComponent[warningKey]) {
2965 return;
2966 }
2967
2968 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);
2969 didWarnAboutNoopUpdateForComponent[warningKey] = true;
2970 }
2971}
2972
2973function shouldConstruct(Component) {
2974 return Component.prototype && Component.prototype.isReactComponent;
2975}
2976
2977function getNonChildrenInnerMarkup(props) {
2978 var innerHTML = props.dangerouslySetInnerHTML;
2979
2980 if (innerHTML != null) {
2981 if (innerHTML.__html != null) {
2982 return innerHTML.__html;
2983 }
2984 } else {
2985 var content = props.children;
2986
2987 if (typeof content === 'string' || typeof content === 'number') {
2988 return escapeTextForBrowser(content);
2989 }
2990 }
2991
2992 return null;
2993}
2994
2995function flattenTopLevelChildren(children) {
2996 if (!React.isValidElement(children)) {
2997 return toArray(children);
2998 }
2999
3000 var element = children;
3001
3002 if (element.type !== REACT_FRAGMENT_TYPE) {
3003 return [element];
3004 }
3005
3006 var fragmentChildren = element.props.children;
3007
3008 if (!React.isValidElement(fragmentChildren)) {
3009 return toArray(fragmentChildren);
3010 }
3011
3012 var fragmentChildElement = fragmentChildren;
3013 return [fragmentChildElement];
3014}
3015
3016function flattenOptionChildren(children) {
3017 if (children === undefined || children === null) {
3018 return children;
3019 }
3020
3021 var content = ''; // Flatten children and warn if they aren't strings or numbers;
3022 // invalid types are ignored.
3023
3024 React.Children.forEach(children, function (child) {
3025 if (child == null) {
3026 return;
3027 }
3028
3029 content += child;
3030
3031 {
3032 if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
3033 didWarnInvalidOptionChildren = true;
3034 warning$1(false, 'Only strings and numbers are supported as <option> children.');
3035 }
3036 }
3037 });
3038 return content;
3039}
3040
3041var hasOwnProperty = Object.prototype.hasOwnProperty;
3042var STYLE = 'style';
3043var RESERVED_PROPS = {
3044 children: null,
3045 dangerouslySetInnerHTML: null,
3046 suppressContentEditableWarning: null,
3047 suppressHydrationWarning: null
3048};
3049
3050function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
3051 var ret = '<' + tagVerbatim;
3052
3053 for (var propKey in props) {
3054 if (!hasOwnProperty.call(props, propKey)) {
3055 continue;
3056 }
3057
3058 if (enableFlareAPI && propKey === 'listeners') {
3059 continue;
3060 }
3061
3062 var propValue = props[propKey];
3063
3064 if (propValue == null) {
3065 continue;
3066 }
3067
3068 if (propKey === STYLE) {
3069 propValue = createMarkupForStyles(propValue);
3070 }
3071
3072 var markup = null;
3073
3074 if (isCustomComponent(tagLowercase, props)) {
3075 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
3076 markup = createMarkupForCustomAttribute(propKey, propValue);
3077 }
3078 } else {
3079 markup = createMarkupForProperty(propKey, propValue);
3080 }
3081
3082 if (markup) {
3083 ret += ' ' + markup;
3084 }
3085 } // For static pages, no need to put React ID and checksum. Saves lots of
3086 // bytes.
3087
3088
3089 if (makeStaticMarkup) {
3090 return ret;
3091 }
3092
3093 if (isRootElement) {
3094 ret += ' ' + createMarkupForRoot();
3095 }
3096
3097 return ret;
3098}
3099
3100function validateRenderResult(child, type) {
3101 if (child === undefined) {
3102 {
3103 {
3104 throw Error((getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.");
3105 }
3106 }
3107 }
3108}
3109
3110function resolve(child, context, threadID) {
3111 while (React.isValidElement(child)) {
3112 // Safe because we just checked it's an element.
3113 var element = child;
3114 var Component = element.type;
3115
3116 {
3117 pushElementToDebugStack(element);
3118 }
3119
3120 if (typeof Component !== 'function') {
3121 break;
3122 }
3123
3124 processChild(element, Component);
3125 } // Extra closure so queue and replace can be captured properly
3126
3127
3128 function processChild(element, Component) {
3129 var isClass = shouldConstruct(Component);
3130 var publicContext = processContext(Component, context, threadID, isClass);
3131 var queue = [];
3132 var replace = false;
3133 var updater = {
3134 isMounted: function (publicInstance) {
3135 return false;
3136 },
3137 enqueueForceUpdate: function (publicInstance) {
3138 if (queue === null) {
3139 warnNoop(publicInstance, 'forceUpdate');
3140 return null;
3141 }
3142 },
3143 enqueueReplaceState: function (publicInstance, completeState) {
3144 replace = true;
3145 queue = [completeState];
3146 },
3147 enqueueSetState: function (publicInstance, currentPartialState) {
3148 if (queue === null) {
3149 warnNoop(publicInstance, 'setState');
3150 return null;
3151 }
3152
3153 queue.push(currentPartialState);
3154 }
3155 };
3156 var inst;
3157
3158 if (isClass) {
3159 inst = new Component(element.props, publicContext, updater);
3160
3161 if (typeof Component.getDerivedStateFromProps === 'function') {
3162 {
3163 if (inst.state === null || inst.state === undefined) {
3164 var componentName = getComponentName(Component) || 'Unknown';
3165
3166 if (!didWarnAboutUninitializedState[componentName]) {
3167 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);
3168 didWarnAboutUninitializedState[componentName] = true;
3169 }
3170 }
3171 }
3172
3173 var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
3174
3175 {
3176 if (partialState === undefined) {
3177 var _componentName = getComponentName(Component) || 'Unknown';
3178
3179 if (!didWarnAboutUndefinedDerivedState[_componentName]) {
3180 warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
3181 didWarnAboutUndefinedDerivedState[_componentName] = true;
3182 }
3183 }
3184 }
3185
3186 if (partialState != null) {
3187 inst.state = _assign({}, inst.state, partialState);
3188 }
3189 }
3190 } else {
3191 {
3192 if (Component.prototype && typeof Component.prototype.render === 'function') {
3193 var _componentName2 = getComponentName(Component) || 'Unknown';
3194
3195 if (!didWarnAboutBadClass[_componentName2]) {
3196 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);
3197 didWarnAboutBadClass[_componentName2] = true;
3198 }
3199 }
3200 }
3201
3202 var componentIdentity = {};
3203 prepareToUseHooks(componentIdentity);
3204 inst = Component(element.props, publicContext, updater);
3205 inst = finishHooks(Component, element.props, inst, publicContext);
3206
3207 if (inst == null || inst.render == null) {
3208 child = inst;
3209 validateRenderResult(child, Component);
3210 return;
3211 }
3212
3213 {
3214 var _componentName3 = getComponentName(Component) || 'Unknown';
3215
3216 if (!didWarnAboutModulePatternComponent[_componentName3]) {
3217 warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
3218 didWarnAboutModulePatternComponent[_componentName3] = true;
3219 }
3220 }
3221 }
3222
3223 inst.props = element.props;
3224 inst.context = publicContext;
3225 inst.updater = updater;
3226 var initialState = inst.state;
3227
3228 if (initialState === undefined) {
3229 inst.state = initialState = null;
3230 }
3231
3232 if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
3233 if (typeof inst.componentWillMount === 'function') {
3234 {
3235 if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
3236 var _componentName4 = getComponentName(Component) || 'Unknown';
3237
3238 if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
3239 lowPriorityWarningWithoutStack$1(false, // keep this warning in sync with ReactStrictModeWarning.js
3240 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
3241 didWarnAboutDeprecatedWillMount[_componentName4] = true;
3242 }
3243 }
3244 } // In order to support react-lifecycles-compat polyfilled components,
3245 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3246
3247
3248 if (typeof Component.getDerivedStateFromProps !== 'function') {
3249 inst.componentWillMount();
3250 }
3251 }
3252
3253 if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
3254 // In order to support react-lifecycles-compat polyfilled components,
3255 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3256 inst.UNSAFE_componentWillMount();
3257 }
3258
3259 if (queue.length) {
3260 var oldQueue = queue;
3261 var oldReplace = replace;
3262 queue = null;
3263 replace = false;
3264
3265 if (oldReplace && oldQueue.length === 1) {
3266 inst.state = oldQueue[0];
3267 } else {
3268 var nextState = oldReplace ? oldQueue[0] : inst.state;
3269 var dontMutate = true;
3270
3271 for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
3272 var partial = oldQueue[i];
3273
3274 var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
3275
3276 if (_partialState != null) {
3277 if (dontMutate) {
3278 dontMutate = false;
3279 nextState = _assign({}, nextState, _partialState);
3280 } else {
3281 _assign(nextState, _partialState);
3282 }
3283 }
3284 }
3285
3286 inst.state = nextState;
3287 }
3288 } else {
3289 queue = null;
3290 }
3291 }
3292
3293 child = inst.render();
3294
3295 {
3296 if (child === undefined && inst.render._isMockFunction) {
3297 // This is probably bad practice. Consider warning here and
3298 // deprecating this convenience.
3299 child = null;
3300 }
3301 }
3302
3303 validateRenderResult(child, Component);
3304 var childContext;
3305
3306 if (disableLegacyContext) {
3307 {
3308 var childContextTypes = Component.childContextTypes;
3309
3310 if (childContextTypes !== undefined) {
3311 warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', getComponentName(Component) || 'Unknown');
3312 }
3313 }
3314 } else {
3315 if (typeof inst.getChildContext === 'function') {
3316 var _childContextTypes = Component.childContextTypes;
3317
3318 if (typeof _childContextTypes === 'object') {
3319 childContext = inst.getChildContext();
3320
3321 for (var contextKey in childContext) {
3322 if (!(contextKey in _childContextTypes)) {
3323 {
3324 throw Error((getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
3325 }
3326 }
3327 }
3328 } else {
3329 warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
3330 }
3331 }
3332
3333 if (childContext) {
3334 context = _assign({}, context, childContext);
3335 }
3336 }
3337 }
3338
3339 return {
3340 child: child,
3341 context: context
3342 };
3343}
3344
3345var ReactDOMServerRenderer =
3346/*#__PURE__*/
3347function () {
3348 // TODO: type this more strictly:
3349 // DEV-only
3350 function ReactDOMServerRenderer(children, makeStaticMarkup) {
3351 var flatChildren = flattenTopLevelChildren(children);
3352 var topFrame = {
3353 type: null,
3354 // Assume all trees start in the HTML namespace (not totally true, but
3355 // this is what we did historically)
3356 domNamespace: Namespaces.html,
3357 children: flatChildren,
3358 childIndex: 0,
3359 context: emptyObject,
3360 footer: ''
3361 };
3362
3363 {
3364 topFrame.debugElementStack = [];
3365 }
3366
3367 this.threadID = allocThreadID();
3368 this.stack = [topFrame];
3369 this.exhausted = false;
3370 this.currentSelectValue = null;
3371 this.previousWasTextNode = false;
3372 this.makeStaticMarkup = makeStaticMarkup;
3373 this.suspenseDepth = 0; // Context (new API)
3374
3375 this.contextIndex = -1;
3376 this.contextStack = [];
3377 this.contextValueStack = [];
3378
3379 {
3380 this.contextProviderStack = [];
3381 }
3382 }
3383
3384 var _proto = ReactDOMServerRenderer.prototype;
3385
3386 _proto.destroy = function destroy() {
3387 if (!this.exhausted) {
3388 this.exhausted = true;
3389 this.clearProviders();
3390 freeThreadID(this.threadID);
3391 }
3392 }
3393 /**
3394 * Note: We use just two stacks regardless of how many context providers you have.
3395 * Providers are always popped in the reverse order to how they were pushed
3396 * so we always know on the way down which provider you'll encounter next on the way up.
3397 * On the way down, we push the current provider, and its context value *before*
3398 * we mutated it, onto the stacks. Therefore, on the way up, we always know which
3399 * provider needs to be "restored" to which value.
3400 * https://github.com/facebook/react/pull/12985#issuecomment-396301248
3401 */
3402 ;
3403
3404 _proto.pushProvider = function pushProvider(provider) {
3405 var index = ++this.contextIndex;
3406 var context = provider.type._context;
3407 var threadID = this.threadID;
3408 validateContextBounds(context, threadID);
3409 var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
3410
3411 this.contextStack[index] = context;
3412 this.contextValueStack[index] = previousValue;
3413
3414 {
3415 // Only used for push/pop mismatch warnings.
3416 this.contextProviderStack[index] = provider;
3417 } // Mutate the current value.
3418
3419
3420 context[threadID] = provider.props.value;
3421 };
3422
3423 _proto.popProvider = function popProvider(provider) {
3424 var index = this.contextIndex;
3425
3426 {
3427 !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
3428 }
3429
3430 var context = this.contextStack[index];
3431 var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
3432 // because conceptually they are deletions--as long as we
3433 // promise to never access values beyond `this.contextIndex`.
3434
3435 this.contextStack[index] = null;
3436 this.contextValueStack[index] = null;
3437
3438 {
3439 this.contextProviderStack[index] = null;
3440 }
3441
3442 this.contextIndex--; // Restore to the previous value we stored as we were walking down.
3443 // We've already verified that this context has been expanded to accommodate
3444 // this thread id, so we don't need to do it again.
3445
3446 context[this.threadID] = previousValue;
3447 };
3448
3449 _proto.clearProviders = function clearProviders() {
3450 // Restore any remaining providers on the stack to previous values
3451 for (var index = this.contextIndex; index >= 0; index--) {
3452 var context = this.contextStack[index];
3453 var previousValue = this.contextValueStack[index];
3454 context[this.threadID] = previousValue;
3455 }
3456 };
3457
3458 _proto.read = function read(bytes) {
3459 if (this.exhausted) {
3460 return null;
3461 }
3462
3463 var prevThreadID = currentThreadID;
3464 setCurrentThreadID(this.threadID);
3465 var prevDispatcher = ReactCurrentDispatcher.current;
3466 ReactCurrentDispatcher.current = Dispatcher;
3467
3468 try {
3469 // Markup generated within <Suspense> ends up buffered until we know
3470 // nothing in that boundary suspended
3471 var out = [''];
3472 var suspended = false;
3473
3474 while (out[0].length < bytes) {
3475 if (this.stack.length === 0) {
3476 this.exhausted = true;
3477 freeThreadID(this.threadID);
3478 break;
3479 }
3480
3481 var frame = this.stack[this.stack.length - 1];
3482
3483 if (suspended || frame.childIndex >= frame.children.length) {
3484 var footer = frame.footer;
3485
3486 if (footer !== '') {
3487 this.previousWasTextNode = false;
3488 }
3489
3490 this.stack.pop();
3491
3492 if (frame.type === 'select') {
3493 this.currentSelectValue = null;
3494 } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
3495 var provider = frame.type;
3496 this.popProvider(provider);
3497 } else if (frame.type === REACT_SUSPENSE_TYPE) {
3498 this.suspenseDepth--;
3499 var buffered = out.pop();
3500
3501 if (suspended) {
3502 suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
3503
3504 var fallbackFrame = frame.fallbackFrame;
3505
3506 if (!fallbackFrame) {
3507 {
3508 throw Error("ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue.");
3509 }
3510 }
3511
3512 this.stack.push(fallbackFrame);
3513 out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
3514
3515 continue;
3516 } else {
3517 out[this.suspenseDepth] += buffered;
3518 }
3519 } // Flush output
3520
3521
3522 out[this.suspenseDepth] += footer;
3523 continue;
3524 }
3525
3526 var child = frame.children[frame.childIndex++];
3527 var outBuffer = '';
3528
3529 {
3530 pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
3531
3532 frame.debugElementStack.length = 0;
3533 }
3534
3535 try {
3536 outBuffer += this.render(child, frame.context, frame.domNamespace);
3537 } catch (err) {
3538 if (err != null && typeof err.then === 'function') {
3539 if (enableSuspenseServerRenderer) {
3540 if (!(this.suspenseDepth > 0)) {
3541 {
3542 throw Error("A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.");
3543 }
3544 }
3545
3546 suspended = true;
3547 } else {
3548 {
3549 {
3550 throw Error("ReactDOMServer does not yet support Suspense.");
3551 }
3552 }
3553 }
3554 } else {
3555 throw err;
3556 }
3557 } finally {
3558 {
3559 popCurrentDebugStack();
3560 }
3561 }
3562
3563 if (out.length <= this.suspenseDepth) {
3564 out.push('');
3565 }
3566
3567 out[this.suspenseDepth] += outBuffer;
3568 }
3569
3570 return out[0];
3571 } finally {
3572 ReactCurrentDispatcher.current = prevDispatcher;
3573 setCurrentThreadID(prevThreadID);
3574 }
3575 };
3576
3577 _proto.render = function render(child, context, parentNamespace) {
3578 if (typeof child === 'string' || typeof child === 'number') {
3579 var text = '' + child;
3580
3581 if (text === '') {
3582 return '';
3583 }
3584
3585 if (this.makeStaticMarkup) {
3586 return escapeTextForBrowser(text);
3587 }
3588
3589 if (this.previousWasTextNode) {
3590 return '<!-- -->' + escapeTextForBrowser(text);
3591 }
3592
3593 this.previousWasTextNode = true;
3594 return escapeTextForBrowser(text);
3595 } else {
3596 var nextChild;
3597
3598 var _resolve = resolve(child, context, this.threadID);
3599
3600 nextChild = _resolve.child;
3601 context = _resolve.context;
3602
3603 if (nextChild === null || nextChild === false) {
3604 return '';
3605 } else if (!React.isValidElement(nextChild)) {
3606 if (nextChild != null && nextChild.$$typeof != null) {
3607 // Catch unexpected special types early.
3608 var $$typeof = nextChild.$$typeof;
3609
3610 if (!($$typeof !== REACT_PORTAL_TYPE)) {
3611 {
3612 throw Error("Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.");
3613 }
3614 } // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
3615
3616
3617 {
3618 {
3619 throw Error("Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue.");
3620 }
3621 }
3622 }
3623
3624 var nextChildren = toArray(nextChild);
3625 var frame = {
3626 type: null,
3627 domNamespace: parentNamespace,
3628 children: nextChildren,
3629 childIndex: 0,
3630 context: context,
3631 footer: ''
3632 };
3633
3634 {
3635 frame.debugElementStack = [];
3636 }
3637
3638 this.stack.push(frame);
3639 return '';
3640 } // Safe because we just checked it's an element.
3641
3642
3643 var nextElement = nextChild;
3644 var elementType = nextElement.type;
3645
3646 if (typeof elementType === 'string') {
3647 return this.renderDOM(nextElement, context, parentNamespace);
3648 }
3649
3650 switch (elementType) {
3651 case REACT_STRICT_MODE_TYPE:
3652 case REACT_CONCURRENT_MODE_TYPE:
3653 case REACT_PROFILER_TYPE:
3654 case REACT_SUSPENSE_LIST_TYPE:
3655 case REACT_FRAGMENT_TYPE:
3656 {
3657 var _nextChildren = toArray(nextChild.props.children);
3658
3659 var _frame = {
3660 type: null,
3661 domNamespace: parentNamespace,
3662 children: _nextChildren,
3663 childIndex: 0,
3664 context: context,
3665 footer: ''
3666 };
3667
3668 {
3669 _frame.debugElementStack = [];
3670 }
3671
3672 this.stack.push(_frame);
3673 return '';
3674 }
3675
3676 case REACT_SUSPENSE_TYPE:
3677 {
3678 if (enableSuspenseServerRenderer) {
3679 var fallback = nextChild.props.fallback;
3680
3681 if (fallback === undefined) {
3682 // If there is no fallback, then this just behaves as a fragment.
3683 var _nextChildren3 = toArray(nextChild.props.children);
3684
3685 var _frame3 = {
3686 type: null,
3687 domNamespace: parentNamespace,
3688 children: _nextChildren3,
3689 childIndex: 0,
3690 context: context,
3691 footer: ''
3692 };
3693
3694 {
3695 _frame3.debugElementStack = [];
3696 }
3697
3698 this.stack.push(_frame3);
3699 return '';
3700 }
3701
3702 var fallbackChildren = toArray(fallback);
3703
3704 var _nextChildren2 = toArray(nextChild.props.children);
3705
3706 var fallbackFrame = {
3707 type: null,
3708 domNamespace: parentNamespace,
3709 children: fallbackChildren,
3710 childIndex: 0,
3711 context: context,
3712 footer: '<!--/$-->'
3713 };
3714 var _frame2 = {
3715 fallbackFrame: fallbackFrame,
3716 type: REACT_SUSPENSE_TYPE,
3717 domNamespace: parentNamespace,
3718 children: _nextChildren2,
3719 childIndex: 0,
3720 context: context,
3721 footer: '<!--/$-->'
3722 };
3723
3724 {
3725 _frame2.debugElementStack = [];
3726 fallbackFrame.debugElementStack = [];
3727 }
3728
3729 this.stack.push(_frame2);
3730 this.suspenseDepth++;
3731 return '<!--$-->';
3732 } else {
3733 {
3734 {
3735 throw Error("ReactDOMServer does not yet support Suspense.");
3736 }
3737 }
3738 }
3739 }
3740 // eslint-disable-next-line-no-fallthrough
3741
3742 default:
3743 break;
3744 }
3745
3746 if (typeof elementType === 'object' && elementType !== null) {
3747 switch (elementType.$$typeof) {
3748 case REACT_FORWARD_REF_TYPE:
3749 {
3750 var element = nextChild;
3751
3752 var _nextChildren4;
3753
3754 var componentIdentity = {};
3755 prepareToUseHooks(componentIdentity);
3756 _nextChildren4 = elementType.render(element.props, element.ref);
3757 _nextChildren4 = finishHooks(elementType.render, element.props, _nextChildren4, element.ref);
3758 _nextChildren4 = toArray(_nextChildren4);
3759 var _frame4 = {
3760 type: null,
3761 domNamespace: parentNamespace,
3762 children: _nextChildren4,
3763 childIndex: 0,
3764 context: context,
3765 footer: ''
3766 };
3767
3768 {
3769 _frame4.debugElementStack = [];
3770 }
3771
3772 this.stack.push(_frame4);
3773 return '';
3774 }
3775
3776 case REACT_MEMO_TYPE:
3777 {
3778 var _element = nextChild;
3779 var _nextChildren5 = [React.createElement(elementType.type, _assign({
3780 ref: _element.ref
3781 }, _element.props))];
3782 var _frame5 = {
3783 type: null,
3784 domNamespace: parentNamespace,
3785 children: _nextChildren5,
3786 childIndex: 0,
3787 context: context,
3788 footer: ''
3789 };
3790
3791 {
3792 _frame5.debugElementStack = [];
3793 }
3794
3795 this.stack.push(_frame5);
3796 return '';
3797 }
3798
3799 case REACT_PROVIDER_TYPE:
3800 {
3801 var provider = nextChild;
3802 var nextProps = provider.props;
3803
3804 var _nextChildren6 = toArray(nextProps.children);
3805
3806 var _frame6 = {
3807 type: provider,
3808 domNamespace: parentNamespace,
3809 children: _nextChildren6,
3810 childIndex: 0,
3811 context: context,
3812 footer: ''
3813 };
3814
3815 {
3816 _frame6.debugElementStack = [];
3817 }
3818
3819 this.pushProvider(provider);
3820 this.stack.push(_frame6);
3821 return '';
3822 }
3823
3824 case REACT_CONTEXT_TYPE:
3825 {
3826 var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
3827 // DEV mode, we create a separate object for Context.Consumer that acts
3828 // like a proxy to Context. This proxy object adds unnecessary code in PROD
3829 // so we use the old behaviour (Context.Consumer references Context) to
3830 // reduce size and overhead. The separate object references context via
3831 // a property called "_context", which also gives us the ability to check
3832 // in DEV mode if this property exists or not and warn if it does not.
3833
3834 {
3835 if (reactContext._context === undefined) {
3836 // This may be because it's a Context (rather than a Consumer).
3837 // Or it may be because it's older React where they're the same thing.
3838 // We only want to warn if we're sure it's a new React.
3839 if (reactContext !== reactContext.Consumer) {
3840 if (!hasWarnedAboutUsingContextAsConsumer) {
3841 hasWarnedAboutUsingContextAsConsumer = true;
3842 warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
3843 }
3844 }
3845 } else {
3846 reactContext = reactContext._context;
3847 }
3848 }
3849
3850 var _nextProps = nextChild.props;
3851 var threadID = this.threadID;
3852 validateContextBounds(reactContext, threadID);
3853 var nextValue = reactContext[threadID];
3854
3855 var _nextChildren7 = toArray(_nextProps.children(nextValue));
3856
3857 var _frame7 = {
3858 type: nextChild,
3859 domNamespace: parentNamespace,
3860 children: _nextChildren7,
3861 childIndex: 0,
3862 context: context,
3863 footer: ''
3864 };
3865
3866 {
3867 _frame7.debugElementStack = [];
3868 }
3869
3870 this.stack.push(_frame7);
3871 return '';
3872 }
3873 // eslint-disable-next-line-no-fallthrough
3874
3875 case REACT_FUNDAMENTAL_TYPE:
3876 {
3877 if (enableFundamentalAPI) {
3878 var fundamentalImpl = elementType.impl;
3879 var open = fundamentalImpl.getServerSideString(null, nextElement.props);
3880 var getServerSideStringClose = fundamentalImpl.getServerSideStringClose;
3881 var close = getServerSideStringClose !== undefined ? getServerSideStringClose(null, nextElement.props) : '';
3882
3883 var _nextChildren8 = fundamentalImpl.reconcileChildren !== false ? toArray(nextChild.props.children) : [];
3884
3885 var _frame8 = {
3886 type: null,
3887 domNamespace: parentNamespace,
3888 children: _nextChildren8,
3889 childIndex: 0,
3890 context: context,
3891 footer: close
3892 };
3893
3894 {
3895 _frame8.debugElementStack = [];
3896 }
3897
3898 this.stack.push(_frame8);
3899 return open;
3900 }
3901
3902 {
3903 {
3904 throw Error("ReactDOMServer does not yet support the fundamental API.");
3905 }
3906 }
3907 }
3908 // eslint-disable-next-line-no-fallthrough
3909
3910 case REACT_LAZY_TYPE:
3911 {
3912 var _element2 = nextChild;
3913 var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
3914 // suspense server-side renderer is enabled so synchronously
3915 // resolved constructors are supported.
3916
3917 initializeLazyComponentType(lazyComponent);
3918
3919 switch (lazyComponent._status) {
3920 case Resolved:
3921 {
3922 var _nextChildren9 = [React.createElement(lazyComponent._result, _assign({
3923 ref: _element2.ref
3924 }, _element2.props))];
3925 var _frame9 = {
3926 type: null,
3927 domNamespace: parentNamespace,
3928 children: _nextChildren9,
3929 childIndex: 0,
3930 context: context,
3931 footer: ''
3932 };
3933
3934 {
3935 _frame9.debugElementStack = [];
3936 }
3937
3938 this.stack.push(_frame9);
3939 return '';
3940 }
3941
3942 case Rejected:
3943 throw lazyComponent._result;
3944
3945 case Pending:
3946 default:
3947 {
3948 {
3949 throw Error("ReactDOMServer does not yet support lazy-loaded components.");
3950 }
3951 }
3952
3953 }
3954 }
3955 // eslint-disable-next-line-no-fallthrough
3956
3957 case REACT_SCOPE_TYPE:
3958 {
3959 if (enableScopeAPI) {
3960 var _nextChildren10 = toArray(nextChild.props.children);
3961
3962 var _frame10 = {
3963 type: null,
3964 domNamespace: parentNamespace,
3965 children: _nextChildren10,
3966 childIndex: 0,
3967 context: context,
3968 footer: ''
3969 };
3970
3971 {
3972 _frame10.debugElementStack = [];
3973 }
3974
3975 this.stack.push(_frame10);
3976 return '';
3977 }
3978
3979 {
3980 {
3981 throw Error("ReactDOMServer does not yet support scope components.");
3982 }
3983 }
3984 }
3985 }
3986 }
3987
3988 var info = '';
3989
3990 {
3991 var owner = nextElement._owner;
3992
3993 if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
3994 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.';
3995 }
3996
3997 var ownerName = owner ? getComponentName(owner) : null;
3998
3999 if (ownerName) {
4000 info += '\n\nCheck the render method of `' + ownerName + '`.';
4001 }
4002 }
4003
4004 {
4005 {
4006 throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info);
4007 }
4008 }
4009 }
4010 };
4011
4012 _proto.renderDOM = function renderDOM(element, context, parentNamespace) {
4013 var tag = element.type.toLowerCase();
4014 var namespace = parentNamespace;
4015
4016 if (parentNamespace === Namespaces.html) {
4017 namespace = getIntrinsicNamespace(tag);
4018 }
4019
4020 {
4021 if (namespace === Namespaces.html) {
4022 // Should this check be gated by parent namespace? Not sure we want to
4023 // allow <SVG> or <mATH>.
4024 !(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;
4025 }
4026 }
4027
4028 validateDangerousTag(tag);
4029 var props = element.props;
4030
4031 if (tag === 'input') {
4032 {
4033 ReactControlledValuePropTypes.checkPropTypes('input', props);
4034
4035 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
4036 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);
4037 didWarnDefaultChecked = true;
4038 }
4039
4040 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
4041 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);
4042 didWarnDefaultInputValue = true;
4043 }
4044 }
4045
4046 props = _assign({
4047 type: undefined
4048 }, props, {
4049 defaultChecked: undefined,
4050 defaultValue: undefined,
4051 value: props.value != null ? props.value : props.defaultValue,
4052 checked: props.checked != null ? props.checked : props.defaultChecked
4053 });
4054 } else if (tag === 'textarea') {
4055 {
4056 ReactControlledValuePropTypes.checkPropTypes('textarea', props);
4057
4058 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
4059 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');
4060 didWarnDefaultTextareaValue = true;
4061 }
4062 }
4063
4064 var initialValue = props.value;
4065
4066 if (initialValue == null) {
4067 var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
4068
4069 var textareaChildren = props.children;
4070
4071 if (textareaChildren != null) {
4072 {
4073 warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
4074 }
4075
4076 if (!(defaultValue == null)) {
4077 {
4078 throw Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
4079 }
4080 }
4081
4082 if (Array.isArray(textareaChildren)) {
4083 if (!(textareaChildren.length <= 1)) {
4084 {
4085 throw Error("<textarea> can only have at most one child.");
4086 }
4087 }
4088
4089 textareaChildren = textareaChildren[0];
4090 }
4091
4092 defaultValue = '' + textareaChildren;
4093 }
4094
4095 if (defaultValue == null) {
4096 defaultValue = '';
4097 }
4098
4099 initialValue = defaultValue;
4100 }
4101
4102 props = _assign({}, props, {
4103 value: undefined,
4104 children: '' + initialValue
4105 });
4106 } else if (tag === 'select') {
4107 {
4108 ReactControlledValuePropTypes.checkPropTypes('select', props);
4109
4110 for (var i = 0; i < valuePropNames.length; i++) {
4111 var propName = valuePropNames[i];
4112
4113 if (props[propName] == null) {
4114 continue;
4115 }
4116
4117 var isArray = Array.isArray(props[propName]);
4118
4119 if (props.multiple && !isArray) {
4120 warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
4121 } else if (!props.multiple && isArray) {
4122 warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
4123 }
4124 }
4125
4126 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
4127 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');
4128 didWarnDefaultSelectValue = true;
4129 }
4130 }
4131
4132 this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
4133 props = _assign({}, props, {
4134 value: undefined
4135 });
4136 } else if (tag === 'option') {
4137 var selected = null;
4138 var selectValue = this.currentSelectValue;
4139 var optionChildren = flattenOptionChildren(props.children);
4140
4141 if (selectValue != null) {
4142 var value;
4143
4144 if (props.value != null) {
4145 value = props.value + '';
4146 } else {
4147 value = optionChildren;
4148 }
4149
4150 selected = false;
4151
4152 if (Array.isArray(selectValue)) {
4153 // multiple
4154 for (var j = 0; j < selectValue.length; j++) {
4155 if ('' + selectValue[j] === value) {
4156 selected = true;
4157 break;
4158 }
4159 }
4160 } else {
4161 selected = '' + selectValue === value;
4162 }
4163
4164 props = _assign({
4165 selected: undefined,
4166 children: undefined
4167 }, props, {
4168 selected: selected,
4169 children: optionChildren
4170 });
4171 }
4172 }
4173
4174 {
4175 validatePropertiesInDevelopment(tag, props);
4176 }
4177
4178 assertValidProps(tag, props);
4179 var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
4180 var footer = '';
4181
4182 if (omittedCloseTags.hasOwnProperty(tag)) {
4183 out += '/>';
4184 } else {
4185 out += '>';
4186 footer = '</' + element.type + '>';
4187 }
4188
4189 var children;
4190 var innerMarkup = getNonChildrenInnerMarkup(props);
4191
4192 if (innerMarkup != null) {
4193 children = [];
4194
4195 if (newlineEatingTags[tag] && innerMarkup.charAt(0) === '\n') {
4196 // text/html ignores the first character in these tags if it's a newline
4197 // Prefer to break application/xml over text/html (for now) by adding
4198 // a newline specifically to get eaten by the parser. (Alternately for
4199 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
4200 // \r is normalized out by HTMLTextAreaElement#value.)
4201 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
4202 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
4203 // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
4204 // See: Parsing of "textarea" "listing" and "pre" elements
4205 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
4206 out += '\n';
4207 }
4208
4209 out += innerMarkup;
4210 } else {
4211 children = toArray(props.children);
4212 }
4213
4214 var frame = {
4215 domNamespace: getChildNamespace(parentNamespace, element.type),
4216 type: tag,
4217 children: children,
4218 childIndex: 0,
4219 context: context,
4220 footer: footer
4221 };
4222
4223 {
4224 frame.debugElementStack = [];
4225 }
4226
4227 this.stack.push(frame);
4228 this.previousWasTextNode = false;
4229 return out;
4230 };
4231
4232 return ReactDOMServerRenderer;
4233}();
4234
4235/**
4236 * Render a ReactElement to its initial HTML. This should only be used on the
4237 * server.
4238 * See https://reactjs.org/docs/react-dom-server.html#rendertostring
4239 */
4240
4241function renderToString(element) {
4242 var renderer = new ReactDOMServerRenderer(element, false);
4243
4244 try {
4245 var markup = renderer.read(Infinity);
4246 return markup;
4247 } finally {
4248 renderer.destroy();
4249 }
4250}
4251/**
4252 * Similar to renderToString, except this doesn't create extra DOM attributes
4253 * such as data-react-id that React uses internally.
4254 * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
4255 */
4256
4257function renderToStaticMarkup(element) {
4258 var renderer = new ReactDOMServerRenderer(element, true);
4259
4260 try {
4261 var markup = renderer.read(Infinity);
4262 return markup;
4263 } finally {
4264 renderer.destroy();
4265 }
4266}
4267
4268function _inheritsLoose(subClass, superClass) {
4269 subClass.prototype = Object.create(superClass.prototype);
4270 subClass.prototype.constructor = subClass;
4271 subClass.__proto__ = superClass;
4272}
4273
4274var ReactMarkupReadableStream =
4275/*#__PURE__*/
4276function (_Readable) {
4277 _inheritsLoose(ReactMarkupReadableStream, _Readable);
4278
4279 function ReactMarkupReadableStream(element, makeStaticMarkup) {
4280 var _this;
4281
4282 // Calls the stream.Readable(options) constructor. Consider exposing built-in
4283 // features like highWaterMark in the future.
4284 _this = _Readable.call(this, {}) || this;
4285 _this.partialRenderer = new ReactDOMServerRenderer(element, makeStaticMarkup);
4286 return _this;
4287 }
4288
4289 var _proto = ReactMarkupReadableStream.prototype;
4290
4291 _proto._destroy = function _destroy(err, callback) {
4292 this.partialRenderer.destroy();
4293 callback(err);
4294 };
4295
4296 _proto._read = function _read(size) {
4297 try {
4298 this.push(this.partialRenderer.read(size));
4299 } catch (err) {
4300 this.destroy(err);
4301 }
4302 };
4303
4304 return ReactMarkupReadableStream;
4305}(stream.Readable);
4306/**
4307 * Render a ReactElement to its initial HTML. This should only be used on the
4308 * server.
4309 * See https://reactjs.org/docs/react-dom-server.html#rendertonodestream
4310 */
4311
4312
4313function renderToNodeStream(element) {
4314 return new ReactMarkupReadableStream(element, false);
4315}
4316/**
4317 * Similar to renderToNodeStream, except this doesn't create extra DOM attributes
4318 * such as data-react-id that React uses internally.
4319 * See https://reactjs.org/docs/react-dom-server.html#rendertostaticnodestream
4320 */
4321
4322function renderToStaticNodeStream(element) {
4323 return new ReactMarkupReadableStream(element, true);
4324}
4325
4326var ReactDOMServerNode = {
4327 renderToString: renderToString,
4328 renderToStaticMarkup: renderToStaticMarkup,
4329 renderToNodeStream: renderToNodeStream,
4330 renderToStaticNodeStream: renderToStaticNodeStream,
4331 version: ReactVersion
4332};
4333
4334var ReactDOMServerNode$1 = Object.freeze({
4335 default: ReactDOMServerNode
4336});
4337
4338var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMServerNode$1;
4339
4340// TODO: decide on the top-level export form.
4341// This is hacky but makes it work with both Rollup and Jest
4342
4343
4344var server_node = ReactDOMServer.default || ReactDOMServer;
4345
4346module.exports = server_node;
4347 })();
4348}