UNPKG

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