UNPKG

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